Making <$hn> title prefix part of the title in LaTeX output

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

Sat Sep 15, 2018 7:10 pm Post

I'm using hierarchical numbering for all of my sections (title prefix = "<$hn> "), which works out for each document title in the main body of the document. But when I include the document title in the header, like this:

Code: Select all

\fancyhead[LE,LO]{\large <$title>}

The number is omitted.

How can I make Latex define all titles as if the expanded <$hn> tag were part of them? There is no part of my document where I want to reference the document without the number it was assigned during compile.

As a last resort, I tried putting a special character at the beginning of every document title in the binder, and then used the replacements tab of the project to swap that character out for <$hn>. But in the headers of each page where I reference <$parenttitle>, the <$hn> tag remains unexpanded on the final LaTeX output.

Note that I'm not using hashes on the titles, because those were being expanded as "CHAPTER 1" and the like, rather than it just starting with 1, 3.1, 4.2.1.12, etc... And apparently LaTeX doesn't, by default, do hierarchical numbering beyond 3 levels, whereas Scrivener seems to have no problems with it.

If I have to, I can put <$hn> into the title of every binder entry directly, but that would be super ugly, and I'd like to avoid doing that.

ADDENDUM: I just experimented with placing <$hn> in the titles of binder items, and the problem with that seems to be that it is placed throughout the output first, and then expanded, so headers referencing the title increment the number as well as when using the title in the body of the document. If the replacements technique I described above had worked, I bet that would have been a problem too.

So… I guess the best approach is to try and force LaTeX to do the numbering rather than Scrivener, so references to titles with those numbers don't increment the numbers… Or I have to give up on the headers including the numbers… *le sigh*
FKA: robertdguthrie
AKA: R Dale Guthrie, Robert, Mr. Obscure, and "Oh, it's you again".