Paragraph Numbering

Hi,
I would like to automatically number each new paragraph in a column on the left side of the page.

This is possible by creating a list style in ‘body text’, though my preferred method (for other formatting purposes) is to place the numbering in a frame outside the ‘body text’ (and outside the page margins).

Tools > Line Numbering > Show Numbering is insufficient, as it puts a number on every new line, whereas I only desire it for every new paragraph. Is there a way to change this?

Linux Mint 22.3
LibreOffice 24.2.7.2 Ubuntu Package Version
Format: .odt

You could use a paragraph style linked to a list style and have a negative indent for the first line
ParagraphNumberingInMargin.odt (32.9 KB)

Thanks for your response, though as per the above, this is not what I’m looking for:

You have placed the numbers outside the margins using a list, but have not placed them in a separate frame. I already know how to do that, but am looking to see if there is another solution that better fits my needs.

Why would you need a frame? What is your ultimate purpose?

Frames create problems. You must master frame styles (otherwise frame direct formatting ruins your layout) and this is the most daunting challenge in Writer.

I see only one reason to use frames: to send the number in the outer margin, i.e. right margin in right pages, left margin in left pages. But then you become vulnerable to order of creation of the frames when autonumbering is involved (because frames are independent unordered sub-documents).

1 Like
  1. If I use a numbered list, when I copy/paste the text, it also copy/pastes the numbers, which I don’t want.

  2. There are some cases I would like to keep the number aligned with the rest of the numbers outside the margin, but would like the text to be centered. If I alter the paragraph style to ‘center’, the list number moves in also.

That is intended to be so. If the paragraph is to be unnumbered, use a style not associated with a list style. Or insert an unnumbered list item: put the cursor at the very beginning of the item and press Bksp. This temporarily (only for this paragraph) removes the numbering but keeps the item in the list.

Be more precise. Are the numbers centred or not?

Many number alignment schemes can be achieved with smart configuration of the list style, leaving your paragraph style untouched. Give a rigorous specification and I’ll tell you how.

That is exactly what I’m asking how to do!
The paragraphs themselves are to be unnumbered (thus, not part of a list) - but they are to be counted with numbers separately. How do I do that without making a list style?

No. The numbers are in the left margin.
The paragraph text is left aligned, but there are times it will be center aligned. When the alignment of the paragraph text changes, I do not want the alignment of the numbers in the left margin to change.

I don’t understand because there seems to be a contradiction.

If your paragraphs are unnumbered, they can’t be “counted separately”, otherwise they are members of another list.

This means centred paragraphs have not the same significance as the others. Consequently, according to semantic styling method, a different paragraph style should be applied. Then numbering can be set to look like the others.


For a better suggestion, tell us what your ultimate goal is:

  • what type of document do you want to create?
  • which is its contents?
  • what is the objective with numbering? (how do you use it in the document: reference, TOC, …?)
  • will the document be heavily maintained? updates, evolutions, reviews, …
  • is it a member of a collection of similar documents?

No less significant, just a different form of writing; and yes, a different style has been applied to achieve this.

mock-up.odt (38.9 KB)

Here is an example to show what I am doing.

I don’t understand why you attached Body Text to outline level 2. Outline paragraphs define the structural “skeleton” of the document upon which flesh is added. Most of the argumentation does not belong in the outline. Outline is intended to be captured into a TOC to provide a quick summary of the topics. It is not a duplicate of contents.

If you accept to use hacks (meaning you need to be careful when editing), your specification can be achieved.

Paragraph numbering

Since you want to reset the number at beginning of each chapter (after a Heading 1 paragraph), I use a number range instead of a list style. A number range can be made relative to an outline level. In the present case, I create Para number range which is preceded by level-1 outline number with no separator.

You don’t use automatic heading numbering. Consequently, the (internal) chapter number does not exist and returns void. You’re left with the number range which restarts at one at each chapter.

This Para field is manually inserted at start of every to-be-numbered paragraph and followed by a Tab.

I modified Body Text to create a 1cm first line hanging indent. The Tab causes an implicit alignment to left indent.

You’ll object that your text no longer exhibits an indent on first line. If you really insist on it, create a tab stop in Body Text (say at 0.5cm). Add a new <kbd<Tab to jump from left indent to your stop.

I don’t like it because indenting like this is akin to direct formatting and is less controllable from the style, though the stop is configured in it.

Centred stanzas

This is more difficult because applying centre alignment is effective over all the extent of the paragraph. In your case, you need to isolate the number area from the text itself. Once again I had to resolve to some kind of direct formatting.

Since paragraph alignment constitutes the base for all text, alignment is reverted to left to cope with the number constraint. Text itself will be handled with tab stop properties. This implies a contorted Stanza configuration:

  • negative first line indent to position the number in the same position as in other styles
  • standard left and right indent
  • tab stop located at the exact middle of the line width
    This tab stop requests centre alignment

Using the Stanza style becomes more complicated (not really user-friendly but you already use line breaks to delimit verses). You insert the Para number range at start of paragraph, as usual. Then you press Tab twice (first to jump to left indent, second to align text at centre). Every new line must also begin with a Tab to activate tab stop alignment.

Remarks

From a “logical” point of view, the Paragraph Pre-Stanza is not a good idea. You create a specificity on a “common” scene paragraph. Unless these paragraphs systematically contain some pre-announcement for the stanzas (like Keep with next paragraph), you associate teh paragraph without necessity.

IMHO, it would be better to have a “first stanza” paragraph style with augmented spacing above.

To mitigate the “user-unfriendliness” of manual insertion of number range and tab at start of paragraphs, I suggest you create several AutoText entries. This is beneficial for the number range (no need to leave the keyboard for the mouse and manipulate menus), probably less for Tabs. Check the number of key presses to see if it makes a difference.

Revised sample

mock-up-ajl.odt (48.4 KB)

Your annotations inside your sample remind me of something already asked here:
ComplexLayoutExample.odt (43.7 KB)


If the goal is similar, I’ll be glad to discuss it (perhaps on private mail).