TeXworksquestions about .log, .gz, and .aux

Information and discussion about TeXworks, an integrated LaTeX environment for several platforms
Post Reply
yaozhao
Posts: 57
Joined: Sat Oct 27, 2018 10:38 pm

questions about .log, .gz, and .aux

Post by yaozhao »

Every time when I click on the Typeset button, the PDF file will be automatically saved in the same folder as the .tex file. But three other files also emerge, including .log, .gz, and .aux. It seems I never open and use these three files. So it's so annoying.

What's the function of these three file? Are they helpful most of the time?

Many thanks in advance!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

questions about .log, .gz, and .aux

Post by Johannes_B »

They are a natural byproduct to produce your pdf. The files contain important information. Just keep them.

The log file keeps important information needed for debugging the document.
The aux file keeps track of your labels and citations.
The sync files sync source and pdf-output of the editor/viewer.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10266
Joined: Mon Mar 10, 2008 9:44 pm

questions about .log, .gz, and .aux

Post by Stefan Kottwitz »

You may notice even more files. Such as a .toc file for a table of contents, .lof file for a list of figured, .lot file for a list of tables.

Think of it that way: when you typeset the first time, LaTeX compiles from the start to the end, straightforward, but at the beginning it doesn't know at which page a later chapter or section starts. So the table of contents is empty at the beginning. During the typesetting, every time LaTeX encounters a chapter command or a section command, it adds a line to the .toc file with the chapter/section name, number, and page number. So, in the next typeset run, LaTeX can read that from the .toc file and produce a table of contents with headings and numbers.

Similar for the .aux file. LaTeX writes the labels there with the numbers it sees. So it can later read the .aux file and use the correct numbers in the next typeset run.

But later, or at any time, you can remove such files to clean up if you like. LaTeX can reproduce it anyway. But, then you may need 2 or even 3 typeset runs again, as again in 1 run the .aux, .toc etc. files need to be generated, in the 2nd run LaTeX uses it, in a third run it can correct things (you know, a long table of contents that appears would change page numbers that come later, so 3rd run is safe to have final page numbers in the table of contents).

Stefan
LaTeX.org admin
Post Reply