Tag Info

Hot answers tagged

45

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 ...


41

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.


39

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 ...


38

.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 ...


34

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@ ...


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. ...


30

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} ...


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> . ...


28

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 ...


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

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 ...


23

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 ...


23

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 ...


22

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

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, ...


20

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 ...


19

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 ...


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

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), ...


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 ...


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

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 ...


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 ...


15

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 ...


15

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


15

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 ...


14

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 ...


14

\documentclass{article} \def\foo{First execution} \newif\ifFirstRun \makeatletter \AtBeginDocument{% \ifx\FirstRunTest\@undefined \FirstRuntrue \else \FirstRunfalse \fi \write\@auxout{\string\gdef\string\FirstRunTest{}}} \makeatother \begin{document} testing: \ifFirstRun\foo\fi \end{document} And the same for counting the runs: ...


14

If you change this in \protected@write the side effects are severe. For example, \protected@write is used in \label. The page number is not known right away in general. The delay of the \write without \immediate writes the entry at page shipout time, when the page number is known. Thus do not change \protected@write. If you need immediate writing, use a new ...


13

As David already said, the contents of boxes cannot be written to a file. However the contents of the environment can be caught using the package environ and stored in a macro that can be called and can also be written to a file. BTW, before reading the output stream, it should be closed first. \documentclass{article} \usepackage{newfile} ...



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