Table of contents: how to get contents separated by commas

I would like to have a level where contents are separated by commas or spaces

image

is it possible? how?

It is extremely tricky and fully manual. It requires to replace the standard TOC machinery by cross-references. Any update to the TOC also requires manual “re-editing”.

I already suggested a solution on this site but I can’t find it. The closest question seems to be TOC entries in a single line but the answer has been removed.

If you don’t master with highest skill styles and fields, you’d better stick with the standard feature. Or explain the rationale behind the requirement. There may be an alternative.

is there maybe a way to define a style paragraph where the next paragraph follows without a new line?

No. A paragraph is defined by its having a new line at the end. Without that, it isn’t a paragraph.

1 Like

No. the basic “objects” in Writer are paragraphs. Styles are only decorations applied onto paragraphs. A style can’t modify paragraph contents.

In your example, are “Sal n” Heading 1 paragraphs, the same as “Introduzione …”? I assume there are no sub-chapters in “Sal n” otherwise you wouldn’t attempt to insert them inline.

Have you any other chapters, appendices, … after “Sal n”? I.e. the “Sal n” are the “terminal” parts of the book? In this case there may be an “easy” workaround. But give more detail about the structure of the book.

This makes me think to a trick I used to enable InLine headings in my InLineHeadings extension (having a character style that mimics the corresponding heading paragraph style and hiding that one).
But here, its even more tricky: you want both worlds. A standard TOC where only some levels are inlined.
I’d guess some macro coding is in order.
Anyway, as ajlittoz said: give more details about the actual structure and contents of your document. A sample of sorts might be of help.

Remember that a TOC is a place where the reader will find where a chapter or subchapter starts. If you get cluttered lines with many headings and page numbers in between, it will become less usable.

You can, of course, completely bypass the inbuilt TOC feature and build one from scratch, using cross-references. You can use the inbuilt paragraph styles for the items in the TOC, and modify them according to need. It’s more work, but you will be completely free to format it as you want.

I try to clarify better.

The structure of book is:

Heading 1 Chapter A

  • Heading 2 Sub-Chapter A
    – Heading 3 Sub-Sub-Chapter aa
    – Heading 3 Sub-Sub-Chapter ab
    – Heading 3 Sub-Sub-Chapter ac
    – Heading 3 Sub-Sub-Chapter …

Heading 1 Chapter B

  • Heading 2 Sub-Chapter B
    – Heading 3 Sub-Sub-Chapter ba
    – Heading 3 Sub-Sub-Chapter bb
    – Heading 3 Sub-Sub-Chapter bc
    – Heading 3 Sub-Sub-Chapter …

Heading 1 Chapter C

  • Heading 2 Sub-Chapter C
    – Heading 3 Sub-Sub-Chapter ca
    – Heading 3 Sub-Sub-Chapter cb
    – Heading 3 Sub-Sub-Chapter cc
    – Heading 3 Sub-Sub-Chapter …

Heading 1 Other

  • Heading 2 Appendix a
  • Heading 2 Appendix b

The document will be used to be read on PC/tablet; the index works as a list of internal links (so I do not need the number of page in the index but just the link).
As Sub-Sub-Chapters are many (more than 30) per each Sub-Capter I will have a too long index.
So my goal is to compact the index arranging Sub-Sub-Chapters links without new line (excluding the last).

Would format the TOC landscape in 2 columns partly fix the issue?

already format in 6 :slight_smile:

I am surprised by the number of sub-sub-chapters: more than 30 is rather unusual. Can you structure more your document? Or else use a “2-layer TOC”:

  • the main TOC listing levels 1 and 2 only (with hyperlinks)
  • secondary TOCs at the beginning of every sub-chapter listing only level 3; putting it in a 3-column section will only result in 5 lines

This imposes an indirection on your readers but might be a simpler solution.

I can’t do what you suggest: Sub-Chapter are the names of Bible books (i.e. Exodus) and Sub-sub-Chapters are the chapters (for Exodus are 40).

I do not how to get it. Could you make an example?

When you insert “main” TOC, Evaluate up to level: 2 (instead of default 10).

At head of each sub-chapter, insert a new TOC For: Chapter (instead of default Entire document). You’ll get a TOC for the current chapter.

WARNING! It says “Chapter” and for Writer a chapter starts with Heading 1. Consequently the partial TOC will cover more than the sub-chapter. Then untick Protected against manual changes so that you can delete excess information (levels 1 and 2 and level 3 for other sub-chapters).

Good suggestion; let me try!