The MWE is the tstextbook
template:
https://www.typesetters.se/latex-textbook-template/
Inserting \usepackage{hyperref}
in the preamble of the file tstextbook.tex
results in error message like so:
./tstextbook.mtc1:1: Argument of \contentsline has an extra }
I understand that the reason for the error is because hyperref
redefines \contentsline
to take four arguments instead of three as referenced here:
Hyperref in toc without page number
If I modify the file tstextbook.mtc1
and make the first line to equal below:
{\reset@font\mtcSfont\mtc@string\contentsline{section}{\noexpand \leavevmode \numberline {1.1}First Section}{\reset@font\mtcSfont 2}{}}
... then the new error is
./tstextbook.mtc1:2: Argument of \contentsline has an extra }
So the solution seems fairly clear, in that the extra brackets need to be inserted. However, I am still struggling with how/where the .mtc
files are auto-generated. Manually changing the .mtc
files myself is not a permanent fix since the template somehow creates the .mtc
files automatically.
Bonus points if you can provide a working solution that uses the tstextbook template and hyperlinks the TOC to appropriate pages within the doc, but am happy to post another follow-up question later once the first one here just regarding including the package is resolved.