Combine two headings in TOC

Is there a way to combine two heading levels in a single Table of Contents row?

I have an anthology in which I use the following structure:
Heading level 2 - article title
Heading level 3 - article author name

That allows me to put the information for each chapter in the header - author on one side, title on the other.

However, I don’t know how to include both pieces of data in the TOC, in the same row.

I could do it in two rows as:
Title
Author
Title
Author

But that’s not as clean as I’d like. I’d like to make it
Title - author
Title - author

Is there any way to do that? Or to achieve my objectives in a different way?

I could do fix the TOC by combining title and author in one heading, but then the chapter header would need a different look.

There is no way to combine heading entries into a single entry. Heading x is related to its corresponding level Contents x. If x is not the same, the TOC entry is on a different level.

Consequently, you must “massage” your Heading x entry to get the desired result.

Remember that a newline (obtained with Shift+Enter) is passed to the TOC entry as a space character. You can then write your title, then a newline and the author name. To align title and author on different horizontal references, adjust the Heading x paragraph style Indents andSpacing properties: set Before Text to the distance where you want the author to appear and First Line to the negative of this value so that title starts at left margin. You get something like:

image description

Improvements are possible in case the author name must be highlighted in some way (smaller size, italics, …): define a character style to apply to author name, leading to:

image description

Here, I changed font size and face and added red colour (I also used different indents on Heading 1 compared to the previous snapshot). As you can see, this character style highlighting is not forwarded to the TOC entry.

Experiment on the content of your heading to get the expected content in the TOC. For instance, if you want “by” between title and author in the TOC and not in the heading, add the word in the heading (so that it is entered in the TOC entry), but apply a specific style to it to hide it (I defined an Invisible character style with colour set to White). This gives:

image description

This trick relies heavily on styles (paragraph and character). If you’re not familiar with them, take this opportunity to learn. Download the Writer Guide and read the related chapter(s).

If this answer helped you, please accept it by clicking the check mark :heavy_check_mark: to the left and, karma permitting, upvote it. If this resolves your problem, close the question, that will help other people with the same question.

Hi

I think you can get the desired result by inserting cross-reference fields.

In the attached example I have created paragraphs in which the fields referring to the titles are inserted on the same line.

I applied a custom style (named Hidden in the example) to these paragraphs. As the name suggests, set the Hidden attribute for this style (Font Effects tab of the style).

Detail of one field:

Then simply do not base the TOC on outline. In the definition dialog, Type tab, check Additional styles uncheck Outline and click on Assign styles.

Assign levels according to your convenience. In the attached example:

This solution remains “dynamic”: if the contents of the titles change, the cross-reference fields are updated and consequently the TOC.

HTH - Regards