PDF (LaTeX) sections in TOC
dvalter opened this issue · comments
Currently I'm trying to compile Rustbook into PDF natively with crowbook.
Building PDF with rendering.inline_toc: true
generates incorrect document:
pt1.md
# Chapter A
text
## Section A1
text
pt2.md
## Section A2
text
included as:
+ pt1.md
-- pt2.md
produces incorrect TOC entry for Section A2 (1.2.............. instead of 1.2....Section A2).
It may be caused by difference in LaTeX code:
% skipped
\section{Section A1}
% skipped
\end{mdcodeblock}\section{}
\label{chapter-2}
\subsection{Section A2}
% skipped
Otherwise when pt1.md and pt2.md are concatenated into one file (as simple as cat pt1.md pt2.md > chapter.md
), TOC looks like it should do.
If you need some more examples to reproduce, I may upload them as a gist or a repo.
Including
+ pt1.md
-- pt2.md
should only be done when pt1 uses e.g.
# Title #
ie. uses level-1 headers that make sense inside of the file but don't mean a chapter break for the book, and all headers are "moved down" one level in consequence. This is why "Section A2" is moved into a subsection.
Using
+ pt1.md
- pt2.md
should now (as of latest commit) work fine for this case (before it added an empty chapter break in all cases).