Use the same number twice in ordered list

I woul like to create an ordered list like this:

1 Some text
2 Point 2 option a
2 Point 2 option b
3 Some text

The reason I want to do this is making the 2 options separate sections and then auto hiding one of them depending on some conditions. I tried making these sections with just text inside and then leaving the number outside but then the text starts in new line, which doesnt realy look good.

Unfortunately, you can’t control list numbering through a variable. Consequently, the text inside the list item must be made conditional.

I didn’t find a satisfactory (read: easy and user-friendly) solution. The procedure is:

  1. create the condition
    Preferentially, do this near or at the beginning of your document as a collection of commented variable definitions. Apply a specific paragraph style to these definition paragraphs with Hidden attribute so that the definition paragraphs are “counted off” the document (they won’t change the layout because they are invisible).
    You can still see these paragraphs on screen if, in Tools>Options, LibreOffice Writer>View, Display Fields, you enable Hidden text and Hidden paragraphs. They show with a dotted underline.
  2. manage your conditional list items
    • Type your options continuously, without paragraph breaks, nor spaces after the final full stop of each option.
      I know, this makes your text awkward.
    • Select one option text
      • Insert>Field>More Fields, Functions tab, Hidden text Type
      • in Condition, enter an expression which will hide the text when true (caution: not “display”, so this is the opposite of what we usually want as “display when condition is true”), like v != 0 to show the item when variable v is zero.
    • Repeat for every option

Sample file: AskLOAlternateListItem.odt (12.1 KB)
Study carefully field usage and style application.

You won’t see the result on screen if you have not enabled hidden text view (and I highly recommend to enable it otherwise it is difficult to update or modify your text and condition). Click on the print preview button in the tool bar for feedback.

As always, this is valid only if you save .odt because it uses Writer-specific features.

PS: when asking here, always mention OS name, LO version and save format.*

5 Likes