LyXWrong page numbers in ToC of unnumbered sections

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
sascq
Posts: 3
Joined: Wed Aug 21, 2019 10:50 pm

Wrong page numbers in ToC of unnumbered sections

Post by sascq »

Hi all,

I am a LyX user and wanted to list an unnumbered chapter and sections to the table of content, document class "Book".
So I added this in the LaTeX Preamble:
\addcontentsline{toc}{chapter}{Title}
\addcontentsline{toc}{section}{Title}
In the PDF everything is ok, except for the fact that in the ToC the chapter and all following sections are listed under page number 1. How can I add (the correct) page numbers? It should be 7, 13, 16 etc. instead of 1, 1, 1 ...

Thanks in advance!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Wrong page numbers in ToC of unnumbered sections

Post by Stefan Kottwitz »

Hi sascq,

welcome to the forum!

Put such commands as TeX code (ERT) into the document at the beginning of the corresponding chapter or section.

Stefan
LaTeX.org admin
sascq
Posts: 3
Joined: Wed Aug 21, 2019 10:50 pm

Wrong page numbers in ToC of unnumbered sections

Post by sascq »

Thank you so much! Problem solved!
Post Reply