Add unnumbered chapter to table of contents in Scrivener 3

be
bertozzivill
Posts: 4
Joined: Fri Jan 31, 2020 6:15 pm
Platform: Mac

Fri Jan 31, 2020 8:37 pm Post

Hi,

Starting from the "Non-Fiction Format for LaTeX" template, I'm trying to modify the "Unnumbered Chapter" section layout such that it appears in the Table of Contents. I created a copy of the default format to allow editing, and tried modifying the "Section prefix" segment as follows:
Screen Shot 2020-01-31 at 12.34.27 PM.png
Screen Shot 2020-01-31 at 12.34.27 PM.png (121.57 KiB) Viewed 711 times


While this does add unnumbered chapters to my ToC, it gives all of them the title of "Section Title", as opposed to detecting their actual titles. How do I modify the code to dynamically react to chapter titles? Or is there a different way to achieve this goal?

Thanks in advance.

User avatar
rdale
Posts: 2080
Joined: Tue Jul 14, 2015 1:07 pm
Platform: Mac, Win + iOS
Location: St. Louis, MO
Contact:

Fri Jan 31, 2020 8:48 pm Post

You have to use the placeholder (variable) instead of the literal text "Section Title" in your LaTeX code. So where you have
\addcontentsline{toc}{chapter}{Section Title}

delete "Section Title" and replace it with <$title>:
\addcontentsline{toc}{chapter}{<$title>}

If you have any punctuation in your titles, you may have to do something to escape that text. I've found that sometimes adding a extra set of {} around the title helps.

A list of all placeholders can be found under the Help menu.
FKA: robertdguthrie
AKA: R Dale Guthrie, Robert, Mr. Obscure, and "Oh, it's you again".

be
bertozzivill
Posts: 4
Joined: Fri Jan 31, 2020 6:15 pm
Platform: Mac

Fri Jan 31, 2020 9:16 pm Post

That works perfectly, thank you! And I appreciate the pointer to the other placeholders, that will be useful.