135

In addition to the .tex and .dvi or .pdf files, TeX/LaTeX/ConTeXt produces and uses lots of other files. What do they do? Which ones are used to create the document and which ones are automatically created by the compiler. What files can I safely delete?

4
  • 2
    What are the following files? .glg .alg .tdo .agr .acn .fls .fdb_latexmk .run.xml .acr .gls .glo .xdy I found the answer here: tex.stackexchange.com/a/53310/69025 Commented Dec 1, 2017 at 22:58
  • I don't see an entry for files with a *.mw extension. What package(s) do they belong to? Thanks! Commented May 17, 2023 at 8:28
  • 1
    According to David Carlisle (github.com/gpoore/minted/issues/114), turns out the .mw extension is from the morewrites package. Apologies for asking ... trying to track down an obscure Runaway text? error that halts the compiler with a few mysterious, peculiar comments \_morewrites_tex_immediate:w \_morewrites_tex_write:w and \g_morewrites_iow output on the console that I don't understand. Commented May 17, 2023 at 9:41
  • It would be handy to have a basic LaTeX mechanism for indicating the extensions used for temporary files. This could be indicated via an ASCII file in the source code of a project. It would then be very easy to have all the extensions that can be removed.
    – projetmbc
    Commented May 17, 2023 at 9:54

14 Answers 14

102

.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 used by either BibTeX or LaTeX itself on later runs (e.g., about cross-references), and can contain other things as well. This file is created by running LaTeX but also used the next time LaTeX is run. It can be deleted, but then you may need to run multiple times in the future to regenerate it.

.bbl = Bibliography; this is what is outputted by BibTeX for insertion into LaTeX the next time LaTeX is run.

.blg = Bibliography (BibTeX) log -- just like .log but for BibTeX; generated by BibTeX and can be safely deleted if there's no need to check it for errors.

.brf = BackReference file for the backref package, I think. I'm not very familiar with these, but I suspect they're created by LaTeX when a file using that package is compiled.

.cls = Documentclass (like article, or report - if you have them cluttering up your folders, you must use a lot of custom classes for individual journals or universities, etc.) This is obviously used to generate the output.

.dtx = Documented source file; can be used to generate a LaTeX package or other file along with its associated documentation.

Of these, .aux and .blg can be safely deleted. Probably .bbl too if you don't mind rerunning BibTeX and have access to the .bib files needed. The rest should not be deleted but maybe moved somewhere more appropriate. In particular .fd, .cls, and .dtx are better taking up space on a (personal) TeX tree, not in the folder of the document you're working on.

3
  • Thanks very much. Actually, I forgot another extension which is .lbl. Could you please edit your answer to tell me what it is?
    – Rafid
    Commented Dec 26, 2010 at 16:50
  • 2
    I'm afraid I don't know what a .lbl file is. Probably something specific to a package, like .brf, and the letters suggest something having to do with labels. What packages are you using for things like that? Almost all of these are plain text files, so you could open it and see what's inside.
    – frabjous
    Commented Dec 26, 2010 at 17:19
  • 1
    Do we now know what package produces lbl files? Commented Oct 3, 2020 at 23:58
52

General

Manually created

  • .tex: The document itself
    Created by you.

Automatically created

  • .aux: An auxiliary file that saves information for the creation of ToC, references, indices, bibliographies and other things like that. It is reread in the next compiling to create the ToC, references etc.
    Created by (pdf/xe/lua)(la)tex

  • .toc: An auxiliary file that stores the Table of Contents, read in on subsequent runs to create the actual ToC.
    Created by (pdf)latex, xe(la)tex.

  • .lof: An auxiliary file that stores the List of Figures, read in on subsequent runs to create the actual LoF.
    Created by (pdf)latex, xe(la)tex.

  • .lot: An auxiliary file that stores the List of Tables, read in on subsequent runs to create the actual LoT.
    Created by (pdf)latex, xe(la)tex.

  • .log: Stors all messages of the compilation, like errors and warnings. It’s used by most Editors / LaTeX IDEs to show the errors in you document.
    Created by (pdf)latex, xe(la)tex.

  • .pdf: The common output format for your document.
    Created by pdflatex, xelatex, ps2pdf, dvipdf.

0
48

Bibliographies

Manually created

  • .bib: The data base file containing your bibliography entries.
    Created by you.
  • .bst: BibTeX style file.
    Determines how the bibliography looks (usually downloaded from somewhere).
  • .bbx: A biblatex bibliography style.
    Created by users.
  • .cbx: A biblatex cite style.
    Created by users.

Automatically created

  • .bbl: bibliography environment, generated by BibTeX.
    This is what the call to bibtex produces and what is included into your document by the \bibliography command.
  • .blg: bibtex and biber log file.
    Created by bibtex/biber.
  • .bcf: biblatex control file.
  • .run.xml: biber XML file.
  • -blx.bib: biblatex control file.
42

beamer special files

In addition to the standard .aux, .log, and .toc files, a beamer document will also create the following auxiliary files:

  • .nav: contains the information needed for the navigation bar hyperlinks.

  • .vrb: will contain the verbatim material when fragile (containing verbatim material) frames.

  • .snm: will contain information that will be used by \pgfimage to include actual slides when using the beamerarticle package.

  • .out: contains information about the sectional units that will be used to write the outlines.

31

General Layout and Package files

Manually created

  • .cls: Class files containing settings for you document and providing the basic macros for the mark up, e.g \section.
    Created by users or latex with an ins file.

  • .def: Collection of a list of similar definitions, that would make a sty file long and unreadable. See What does the .def file do?, and When to use ".sty" extension and when to use ".def".

  • .dtx: Source file containing template files, like classes and styles and their documentation.
    Created by users.

  • .ins: installation file to extract template files out of a dtx file. Created by users.

  • .sty: Style file containing macro definitions and other extensions for your document. Created by users or latex with an ins file.

Automatically created

2
  • 2
    These are not templates!
    – Joseph Wright
    Commented May 14, 2012 at 7:00
  • 1
    @JosephWright: Maybe it’s the wrong word, I’m no native speaker. Pleas change it if you find a better title :-)
    – Tobi
    Commented May 14, 2012 at 7:27
23

Some further extension you might encounter depending on what packages you are using:

12

I think you don't need to worry about files other than *.tex, *.cls and *.sty.

  1. *.tex is the extension for input files in which you put your document content and format. You can have more than one input file for your project. But only one input file can contain \documentclass call. The input file contains \documentclass call is called as your main input file.

  2. *.cls is the extension for documentclass containing layout settings and commands. There are many documentclass, such as article, book, minimal, report, etc. From within your main input file, you call this document class using the command \documentclass{book}, for example. Calling \documentclass{book} means you want to create a book project. In book project, you will have some settings such as chapter, section, subsection, subsubsection, frontmatter, mainmatter, backmatter, etc. Other documentclass also has different settings.

  3. *.sty is the extension for package containing class-agnostic commands. There are many packages. Each provides different purposes and works indendepently. For example, if you want to draw Euclid diagram for your project, you can use pst-eucl.sty. From within your main input file, you call this package by using \usepackage{pst-eucl}.

As the rule of thumbs: You may accidently lose files other than your input files, image files, data files. If you lost *.cls and *.sty, download again from the internet. If you lost *.aux, just compile again your input file.

5
  • 4
    I don't understand why someone wouldn't need to worry about .bst or .fd files, etc. Deleting those could definitely cause problems.
    – frabjous
    Commented Dec 26, 2010 at 15:58
  • @frabjous. I don't say the other files are not important. :-) Commented Dec 26, 2010 at 16:02
  • 4
    @frabjous: I would read "don't worry about them" as "leave them be: don't try to understand what's going on with them, for now, just treat them as part of the magic of TeX", certainly not as "they're not important; you may as well delete them"! Commented Dec 26, 2010 at 21:04
  • Fair enough! Just so long as it is clear, which it wasn't to me, and may not have been to others. (It is now, thank!.)
    – frabjous
    Commented Dec 26, 2010 at 22:06
  • What about .bst's?
    – einpoklum
    Commented Sep 16, 2017 at 9:35
11

ConTeXt MkIV related files:

User-Input Files

  • .tex: For content and typesetting instructions.
  • .cld: For ConTeXt Lua Documents
  • .xml: For XML data (related: .xhtml)

Macro package files

  • .mkiv: Code for MkIV
  • .mkvi: Code for MkIV written with named variables \def\macro#{val1}#{val2} rather than \def\macro#1#2, etc.)
  • .lua: Lua code for MkIV
  • .lfg: Goodies for fonts (used for creating virtual fonts and changing parameters defined in fonts)

  • .mpiv: Metapost code for MkIV

Automatically generated

  • .tuc: Data stored for multiple passes, ToC, etc.
  • .log: Log file

You can safely delete the .tuc and .log files. These can be automatically deleted if you run

context --purgeall
8

The following is a list of most of the common file extensions used for UNIX (La)TeX files and what they mean. They are in the order in which you are likely to come across them rather than alphabetic order.

  • .tex: denotes a source file for any flavour of TeX.

  • .cls: denotes a LaTeX 2e class file.

  • .clo: denotes a LaTeX 2e class option file. usually options associated with a class are defined in a .cls file, but occasionally they are defined in separate .clo files.

  • .sty: denotes a LaTeX (or AmS-TeX) package/style file. LaTeX 2.09 made no distinction between classes and packages ... all such files were style files - hence the suffix. LaTeX 2e has retained the suffix for what it now terms as packages.

  • .log: denotes a log file for any flavour of TeX.

  • .aux: denotes an auxiliary file. generated by running latex (or etex) on a source file. It typically contains information latex needs on a second pass to construct \refs and \cites and information that bibtex needs to construct a .bbl file.

  • .toc: denotes a table of contents file. generated by latex when the source file contains the line \tableofcontents.

  • .lot: denotes a list of tables file. generated by latex when the source file contains the line \listoftables (Similar to a .toc file.)

  • .lof: denotes a list of figures file. generated by latex when the source file contains the line \listoffigures (Similar to a .toc file.)

  • .bib: denotes a BibTeX source file. such files contain the database from which the .bbl bibliography file is generated.

  • .bst: denotes a BibTeX style file. the style in which bibtex presents the .bbl bibliography file.

  • .bbl: denotes a (La)TeX bibliography file. usually generated by bibtex.

  • .blg: denotes a BibTeX log file.

  • .idx: denotes a MakeIndex index source file. contains \indexentry commands generated by a first pass of a TeX source file through a flavour of TeX.

  • .ist: denotes a MakeIndex style file. needed only when the default manner in which makeindex processes an .idx file needs to be over-ridden, e.g. when makeindex is used for generating a .gls glossary file.

  • .ind: denotes a (La)TeX index file. usually generated by makeindex.

  • .ilg: denotes a MakeIndex log file.

  • .glo: denotes a MakeIndex glossary source file. contains \glossaryentry commands generated by a first pass of a TeX source file through a flavour of TeX.

  • .gls: denotes a TeX glossary file. usually generated by makeindex, which needs an appropriate .ist file to over-ride the MakeIndex defaults that produce indexes.

  • .glg: denotes a MakeIndex glossary log file.

  • .dtx: denotes a file containing (La)TeX package(s)/class(es) together with its documentation. Running (La)TeX on the file usually generates the .dvi documentation. An accompanying .ins file calls docstrip.tex to strip the (La)TeX package(s)/class(es) from the .dtx file and sometimes also a .drv file.

  • .ins: denotes a (La)TeX install file. Running (La)TeX on the file strips package or class files from accompanying .dtx files(s).

  • .drv: denotes a (La)TeX driver file. Sometimes stripped from a .dtx file by running (La)TeX on an .ins file. Running (La)TeX on the .drv file generates the .dvi documentation.

4

Files generated by some other packages

changebar

  • .cb2: Coordinates of "points" in the text for beginning and ending stretches marked by a change-bar on the side.
  • .cb: Some other kind of history / points file (package documentation is not very clear about it)
3

(r)(e)ledmac/(r)(e)ledpar files

  • .1, .1R, .2, .2R file storing metadata about line break and critical notes. One by \beginnumbering...\endnumbering
  • .eledsec1, .elesdec2 etc. File for the eledsection and related commands
  • .Aend, .Bend, .Cend etc. File for the endnotes of series A, B, C etc.
2

In addition to all the other answers mentioned here, I'd like to add the extensions mtc[0-9] and ptc to the list here.

Files with these extension names are created by the titletoc package, usually used in books and long articles to obtain a toc within each chapter.

I guess they stand for mini toc (with the suffix denoting chapter number) and partial toc (i.e. the global toc that gets continuously updated during the build process as each chapter is getting built).

2

I'm surprised no one has mentioned .synctex.gz (used by synctex to let you associate locations in your output with your source) even in the comments. I'm just adding it for completeness

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .