Text FormattingLatex ToC File Updates Everytime

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ranaya123
Posts: 4
Joined: Wed Apr 02, 2025 8:08 am

Latex ToC File Updates Everytime

Post by ranaya123 »

Dear All,

Hi, in my Latex file arrangement, I have this .toc file with all this Table of Content information. The content may look like below :oops:


\changetocdepth {2}
\babel@toc {dutch}{}\relax
\babel@toc {english}{}\relax
\babel@toc {english}{}\relax
\babel@toc {dutch}{}\relax
\babel@toc {english}{}\relax
\contentsline {chapter}{\chapternumberline {1}Introduction}{1}{chapter.1}%
\contentsline {section}{\numberline {1.1}\ac {cmos} Technology}{4}{section.1.1}%


Now the next question is this. I have been trying to compile my Latex documents with PdfLatex altogether. Every time I open the Latex package in texmaker, The .toc file gets changed and I have to change the "table depth" every time. Now this issue seems to be repeating and I would like to fix this by changing the content.

Can somebody please shed light on to solve this problem ?

Thanks in advance
Anuradha

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10387
Joined: Mon Mar 10, 2008 9:44 pm

Re: Latex ToC File Updates Everytime

Post by Stefan Kottwitz »

Hi Anuradha,

perhaps use in your document:

Code: Select all

\addtocontents{toc}{\protect\changetocdepth{2}}
Stefan
LaTeX.org admin
ranaya123
Posts: 4
Joined: Wed Apr 02, 2025 8:08 am

Re: Latex ToC File Updates Everytime

Post by ranaya123 »

Dear @Stefan,

Well, I find it quite strange to mention this. The content of this file is changing time to time. How is this possible ?

For instance this line over here:

\addtocontents{toc}{\protect\changetocdepth{2}}

Changes next time, to it's old content: \changetocdepth {1}

Can this be really possible ? I have never come across a situation like that. So then, this must be a problem of Windows location ?

Thanks and Best Regards ;)
Anuradha
User avatar
Stefan Kottwitz
Site Admin
Posts: 10387
Joined: Mon Mar 10, 2008 9:44 pm

Re: Latex ToC File Updates Everytime

Post by Stefan Kottwitz »

Hi Anuradha,

LaTeX generates the .doc file every time you run it. Document classes, packages, and macros can write to that file. Without enough information, I cannot say more. Perhaps post the entire preamble of your document.

Stefan
LaTeX.org admin
ranaya123
Posts: 4
Joined: Wed Apr 02, 2025 8:08 am

Re: Latex ToC File Updates Everytime

Post by ranaya123 »

Dear Stefan,

Thanks for the reply. I checked for the appearance of *toc* in all my files, specifically on the "changetocdepth" keyword. I found the related entries in the .aux file.

main.aux:\@writefile{toc}{\changetocdepth {1}}
main.aux:\@writefile{toc}{\contentsline {chapter}{Abbreviations}{185}{chapter*.117}\protected@file@percent }
main.aux:\@writefile{toc}{\contentsline {chapter}{Bibliography}{187}{section*.119}\protected@file@percent }
main.aux:\@writefile{toc}{\contentsline {chapter}{List of Publications from this Thesis}{207}{section*.121}\protected@file@percent }

For instance, the first line doesn't change in any of the runs. Is this the source of the problem? I have changed this one as well, but still the issue seems to be persistent. Can you shed some light ?

Thanks
Anuradha
User avatar
Stefan Kottwitz
Site Admin
Posts: 10387
Joined: Mon Mar 10, 2008 9:44 pm

Re: Latex ToC File Updates Everytime

Post by Stefan Kottwitz »

Something does that, but it's hard to say without knowing your document class and packages. Perhaps post that part of your file before \begin{document}.

Stefan
LaTeX.org admin
Post Reply