LaTeX forum ⇒ TeXworksquestions about .log, .gz, and .aux

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

questions about .log, .gz, and .aux

Postby yaozhao » Sun Oct 28, 2018 3:24 am

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 2021: • •
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
User avatar
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

questions about .log, .gz, and .aux

Postby Johannes_B » Sun Oct 28, 2018 7:49 am

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: 10164
Joined: Mon Mar 10, 2008 9:44 pm

questions about .log, .gz, and .aux

Postby Stefan Kottwitz » Sun Oct 28, 2018 12:58 pm

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 admin

Return to “TeXworks”

Who is online

Users browsing this forum: No registered users and 3 guests