# Tag Info

58

You might not care about these files, but pdflatex does quite a bit. These files hold information collected during the first run(s) and are needed to build the final PDF with correct ToC, references, PDF bookmarks, etc. Your can delete these files afterwards, e.g. manually or using a front-end tool like latexmk (-c option). However, future compilations of ...

45

With MiKTeX and TeX Live you can use --output-directory=dir. This will put all output files including .log and .pdf/.dvi in this directory (and append it to the search path so that auxiliary files are found). In MiKTeX you can additionally set --aux-directory=dir which will put only the auxiliary files in this directory.

42

.fd = Font definition; used in generating the output .bst = BiBTeX Style File (e.g., a certain journal's preferred Bibliography layout settings); used by BibTeX when generating the bibliography .aux = LaTeX auxiliary file; created when LaTeX is run, these contain information LaTeX records which is then either used by BibTeX or LaTeX itself on later runs ...

42

You can write to the aux file with \write\@auxout{hello} or \immediate\write\@auxout{hello2} or \protected@write\@auxout{}{hello3} Depending on requirements. \immediate\write writes to the specified file at that point, expanding the supplied tokens (like \edef) so fragile commands will do the wrong thing. \write does not write at that point it ...

36

In addition to Martin's answer, I thought it might be useful to explain why LaTeX creates all these extra files. Let's take the example of the .aux file. Let's say you have a \label in your document and a reference to it somewhere above where the label occurs. When pdflatex reads your .tex file, it reads the \ref first. Now, it doesn't know what to do with ...

35

The reason for an ignore file list is the following. When your VCS spots a file in the directory that it isn't versioning, it tells you about it (politely). For example, in one of my directories then running bzr status, I get the following message: tex.SE% bzr status unknown: Project/ braids.sty@ bzr_test/ lessonplan.cls@ lessonplan.sty@ ...

33

There is a user friendly LaTeX package: newfile. You can use it to read and write files easily. It provides normal file IO functions, and also verbatim file IO functions. It is more suitable for your example, than those low-level macros. The package document has some good examples. A naive example (similar to table of contents): \documentclass{article} ...

32

Based on this example on texample.net I have created this diagram: This infographic is an attempt to visualize the interaction of 'User level' and 'Software/file level' in LaTeX workflow. Sources available here. This is not exactly an answer. To give an idea of the files involved in the compilation, the node named ".tex file" should be elaborated further. ...

28

If you have one write handle left you can do it with the following commands which are also used for .toc, .lof, .lot, etc. \@starttoc{<extension>} Reads the file with the given extension (\jobname.<extension>) and opens it for writing afterwards. The file is initially empty. Creates the output file handle \tf@<extension> . ...

27

if you want get rid of those files in your document directory then use the optional argument -output-directory=whatever. Then all auxiliary files and the pdf are saved in that directory. For example what I use: pdflatex -output-directory=target <file> then my <file>.pdf is also in target, but I always use a softlink ln -s ...

25

You already got lots of very good answers explaining why pdflatex needs all those auxiliary files. However you might still feel frustrated about having to live with all those files polluting a directory where (I'm guessing) you would like to keep all your LaTeX documents and their corresponding .pdf outputs. The best solution is to keep one directory for ...

25

How does LaTeX implement UTF-8? The Unicode character é is encoded as two byte in UTF-8, precisely <C3><A9> (I'll use throughout this to denote bytes, also when they are character tokens for TeX). When \usepackage[utf8]{inputenc} is loaded, the byte <C3> is made active and defined to look for the following byte, because <C3> in UTF-8 ...

24

Each document in a different folder, is a good archiving. Though I usually remove auxiliary files, keeping the tex source and pdf output, for convenience. The dedicated document folder keeps your file system clean if you compile again. I organize my documents in topic folders, first such as letters, articles, books, and below subfolders such as job, private ...

24

TeX writes the .log file. It contains more information about processing the job than what is shown on the console. It's very useful for debugging. LaTeX writes the .aux and .toc files. They are used for managing cross-references and table-of-contents information. Since TeX's organism digests the input document from beginning to end, once per job, ...

24

No, TeX itself can't delete files, just create or overwrite them. You need to use an external tool, like a LaTeX editor or Makefile to delete it for you. For example latexmk has a -c option which cleans up all auxiliary files. I also use Makefiles under Linux which contain a clean rule which remove all auxiliary files. However, this isn't really a good way ...

21

Writing balanced braces doesn't require anything special, as the following transcript of an interactive TeX session shows: $tex This is TeX, Version 3.1415926 (TeX Live 2011) **\relax *\newwrite\mywr *\immediate\openout\mywr=temp.dat *\immediate\write\mywr{{}} *\bye No pages of output. Transcript written on texput.log.$ cat temp.dat {} If you want to ...

20

LaTeX and its packages produce a variety of auxiliary files. There are also some external tools which create their own files. Then there is the set of output files generated by (La)TeX like DVI, PS and PDF files which you may or may not want to put under version control. Normally you don't. The reason some extension are missing in some lists is because the ...

20

You want the macro \jobname. This isn't quite the filename; to quote from the TeX FAQ: TeX retains what it considers the name of the job, only, in the primitive \jobname; this is the name of the file first handed to TeX, stripped of its directory name and of any extension (such as .tex). If no file was passed (i.e., you're using TeX interactively), ...

18

For portability purposes, as well as keeping things clean/tidy, I use embedfile to attach the source .tex (as well as other required sources) to the output .pdf. The attachment is compressed, which also saves some space. Then, once a project is complete, you can erase everything but the .pdf. The requirement though is that you use pdflatex. Here is a ...

17

This may be a job easily done with the help of your tex editor. With winedt, it is done like this (for miktex only ): Go to winedt menu Options ---> Execution Modes. In the window that opens choose TeX Options: Make the modifications as shown in the picture. Give OK and come out. Now all the auxiliary files will be stored inside a folder TeXAux inside ...

17

You can specify different directories for auxiliary files and output files. -aux-directory=DIR Use DIR as the directory to write auxiliary files to. -output-directory=DIR Use DIR as the directory to write output files to. These are MikTeX option names. They ...

17

I've made a new version of latexmk, which supports -aux-directory and -output-directory. It's v. 4.27a and can be found at http://www.phys.psu.edu/~collins/latexmk/versions.html This version will be submitted to CTAN fairly soon, but some feedback would be useful, since I have not tested the new features extensively, especially as I don't have current ...

17

It depends on how paranoid your settings in texmf.cnf are. Mine (default texlive 2014) says: % Allow TeX \openin, \openout, or \input on filenames starting with .' % (e.g., .rhosts) or outside the current tree (e.g., /etc/passwd)? % a (any) : any file can be opened. % r (restricted) : disallow opening "dotfiles". % p (paranoid) : as r' and ...

16

The files that you are talking about (.log, .aux., .bbl., .blg, .toc, etc.) are created by LaTeX (or BibTeX, or any other auxiliary program) “on the fly.” They are usually dependent on the source .tex file. Since there's no information in those files that's unique to them (i.e., that can't be recovered from the source .tex file) and you would never edit ...

16

The .aux file is read as part of the \document macro (\begin{document}) but before the \AtBeginDocument hook is used. (You can check this by inserting some 'test code' into the .aux file and the hook.) Writing to the .aux file takes place both 'immediately' and at shipout. The latter is important to get for example the correct page numbers for ...

16

First of all, an interesting remark: it's quite surprising and amusing that this fact went unnoticed for virtually every single release of arara. I blame Nicola, of course: once she found this major issue, apparently the universe captured an unbalanced force and decided to go ballistic. :) As retaliation, Nicola is now part of the official arara team. ♥ ...

16

There are certainly several ways to implement a data transport mechanism between runs. The LaTeX one attempts to be rather economically with resources. There are a number of tasks that it caters for: TOC-type files are only generated if the document asks for a TOC. This only becomes clear somewhere within the document (i.e., not automatically available at ...

16

Not regarding the LaTeX processing flow, but dependencies of LaTeX, TeX and related software, still matching the title of your question and your visual thinking: An overview of TEX, its children and their friends by Arno Trautmann is an overview with a many diagrams. It deals with the difference between engine, format and distribution Gives a short and an ...

16

Here's a Plain TeX solution that uses the ε-TeX extension \readline. It copies its source to \jobname.copy. \newread\in \openin\in=\jobname.tex \newwrite\out \immediate\openout\out\jobname.copy \endlinechar-1 \loop \unless\ifeof\in \readline\in to\l \immediate\write\out{\l} \repeat \immediate\closeout\out \closein\in \end

16

TeX does not have a serialisation of its box structures that may be accessed, in particular it can not be written to a file. You either need to save the box within TeX memory for re-use or instead of saving the box, grab the tokens that make up the text and write those to a file to be re-set when the file is read in. That is how tables of contents and ...

Only top voted, non community-wiki answers of a minimum length are eligible