writer: index with 2 styles on same row

I need a help with Index in writer

as obvious from structure below it’s a table of contents (TOC)

I need to catch two style in the same row of the index.

Act 1…pag

Chapter 1: title 1........pag
Chapter 2: title 2........pag
Chapter 3: title 3........pag

Act 2…pag.

Chapter 4: title 4........pag
Chapter 5: title 5........pag

Act 3…pag.

Chapter 6: title 6........pag

Where obviously every entry are a different chapter

My page is something like:


Chapter 1

title 1

Chapter 2

title 2

Chapter 3

title 3

Act 2

Chapter 4

title 4

Chapter 5

title 5

Act 3

Chapter 6

title 6

Someone can help me?

Edited as requested

A question of vocabulary: do you want an [alphabetical] index or a table of contents (TOC)? An index is sorted alphabetically on header while a TOC is sorted on page number.

Edit your question to relate the first example with the structure below, i.e. replace “header2/3” with text like “chapter”.

Your structure exhibits a non-conventional numbering: “acts” are on one sequence, “chapters” on another independent one, i.e. number does not reset when you change act. Should this be rendered with Writer autonumbering? The same for “title”.

Don’t use an answer for this additional information. On this site, answers are reserved for solutions. Click on the edit link.

As I presently understand the requirement, the solution involves styles and fields.

In addition to @ajlittoz,

Formatting an Index or a Table of Contents


As you can see, the help and manual are of no use for anything other than extremely trivial and straightforward.

Absolutely my need is not considered

Before giving you a solution, I want to make sure I understand your specification. Are “Chapter 1” and “Title 1” unrelated items? In your “sample” you enclosed them respectively in HTML <H2> and <H3> letting suppose that several “Title 9” may follow a “Chapter 9”. Another interpretation could be you want a line break between “Chapter 9” and its heading “Title 9”. In this second interpretation, “Chapter 9” can be automatically added.

Please confirm that “Chapters” are numbered consecutively across “Acts” (i.e. you don’t get “Chapter 1” immediately after “Act 2”).

I hope you’re familiar with styles because the solution is quite “easy” with styles although a bit tricky for a beginner.


The book structure is one of the most typical possible.

Act is unrealted with chapter. Every Act can have many chapter below.



Chaper 1 is related to title 1

Chapter 2 is related to title 2


Chapter n is the number of the chapter

Title n is the title of the chapter

They are on different line and for simplicity, of different header.


I’m familiar with styles but not with index

Because you want to number your acts independently from your chapters, you need two distinct counters. I keep “chapter numbering” associated with your chapter headings so that you can have subchapters numbered as usual "per chapter. The other counter is assigned to “acts”.

  • Create a new “list style” (ill-named because they really define a sequence counter)

    1. In the style sidepane (F11 if not already there) toolbar, click on the fifth icon from the left.
    2. Right-click in the list and New.
    3. Give it name Act in the Organizer tab.
    4. Ignore Bullets, Numbering Style, Outline and Image; if you click here after having started to configure your style you’ll mess up everything and will be compelled to restart from scratch.
    5. In Customize tab, configure Level 1 (the only one we will use) for Number 1, 2, 3 …, Separator Before "Act " (note the trailing space).
    6. Tab Position allows you to position the numbering and eventual heading as you like. You can do it later through style editing.
  • Temporarily detach Heading 1 from chapter numbering so that you can customise it

    1. Tools>Chapter Numbering
    2. In Numbering tab, click on Level 1 and assign Paragraph style [None] (instead of Heading 1)
  • Modify Heading 1

    1. In the style sidepane toolbar, click on the first icon at left for paragraph styles
    2. Right-click on Header 1 and Modify.
    3. In Outline & Numbering, the Outline level is now Text Body because the style has been detached from chapter numbering. Select Act for *Numbering style. Assign back Outline level 1.
  • Reattach Heading 1 to chapter numbering so that it is included in the TOC

    1. Tools>Chapter Numbering
    2. In Numbering tab, click on Level 1 and assign Paragraph style Heading 1

Style your act heading Heading 1 and your chapter heading Heading 2. If your act headings reduce to simply “Act #”, then type a space to guarantee the “number” will be there (it is frequently automatically suppresses on empty paragraphs.

Your TOC is generated, as usual, with Insert>TOC & Index>TOC, Index or Bibliography. Records in the TOC are formatted with Contents n paragraph styles.

Special requirements:

  • Chapter numbering and heading on separate lines

    Tools>Chapter Numbering, Position tab, for Level 2, Numbering followed by: New Line

  • Different formatting for number and heading (as suggested by your use of <H2> and <H3> in your sample.

    Heading 2 will format the heading. To have a different formatting for the number, create a dedicated character style. In Tools>Chapter Numbering, Numbering tab, for Level 2, select this character style in Character style: to replace None.

  • Adding a colon in the TOC between chapter number and heading

    1. Define a character style (with name Hidden or another one at your convenience) with Hidden checked in Font Effects tab (and nothing else in any other tab)
      1.In your chapter headings (paragraphs styles *Heading 2), add ": " (colon + space) before the first word of the heading; select this string and style it Hidden (your special character style)

Note: there will be a space before the colon in the TOC because the line break is transformed into a space. Make sure anyway that Separator After in chapter numbering is empty for level 2 (otherwise, you’ll have more spaces).

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.

thank you for your answer,very interesting, I will try it




“Because you want to number your acts independently from your chapters”


“Act 1” IT’S the name not the number


sometimes i feel like I’m speaking with robots

“act 1” can be “duffy duck” and “chapter 1” can be “mikey mouse” and “title 1” can be “augustus”

Really a number create so great problems?

If the “1” in “Act 1” is not a number (meaning it does not need to be monotonously increasing) and the whole “Act 1” can be replaced by “duffy duck”, forget my answer: just style it Heading 1 without number (the default configuration for Tools>Numbering). Similarly, if “chapter one” is just a fancy manual heading, type a Shift+Enter after it. Style the whole paragraph as Heading 2 without number. The Shift+Enter is automatically converted into a space in the TOC. The tip about character styles is still valid, like the trick with Hidden to add “decoration” invisible in the text but revealed in the TOC.