# BibTeX > LaTeX

How to use LaTeX with BibTeX for bibliography management

## Presentation

What is LaTeX?

LaTeX is a free multi-platform markup language for typesetting documents, allowing professional formatting of .tex files. The source code in the .tex files generates printable PDFs that comply with the editorial and typographical standards.

The TeX language was created in 1977 by Donald Knuth. LaTeX, created by Leslie Ramport in 1985, simplified TeX by including macro packages.

The structured documents in LaTeX are WYSIWYM (What You See Is What You Mean), unlike Microsoft Word, a WYSIWYG (What You See Is what You Get) word processor.

## Types of files

There are several types of files associated with LaTeX:

- .tex: LaTeX or TeX file that describes the structure and the presentation of the document;

- .bst: bibliographic style for in-text citations and bibliography (ex.: IEEEtran.bst);

- .bib: file (also called database) containing the bibliographic references;

- .sty: package (macro), containing extra LaTeX commands, which is loaded with \usepackage (ex.: ieeetrantools.sty);

- .cls: class, which controls the formatting of the document and is selected with \documentclass (ex.: ieeetran.cls, beamer: LaTeX class for creating slides and presentations, etc.).

## Dissertation and Thesis Templates @ Polytechnique

Using a template is mandatory!
A template is a style sheet that greatly facilitates your work and ensures that Polytechnique publication requirements are followed.

MS-Word Template in English (last updated March 4, 2019)
MS-Word Template in French (last updated March 4, 2019)
▸ Comment télécharger et appliquer une feuille de style / How to Download and Apply a Template (français + English)

Bilingual LaTeX Template (last updated March 13, 2019)
▸ Polytechnique does not provide an APA style in French for LaTeX, so we recommend that you use the IEEE style in French, which is included in this template.
▸ This template is not compatible with the subcaption package. Use subfigure (see 1 and 2).

▸ If you started writing your dissertation or thesis using an old version of the template:
▸ Use the new Document.tex;
▸ Replace the old IEEEtran-francais.bst and MemoireThese.sty files with the new ones;
▸ Modify the definition of the jury in 0-Definitions_Etudiant.tex according to the new template;
▸ Write the titles of appendices in 9-Annexes.tex in lowercase letters.

## Guides

Are you about to start writing your thesis or dissertation?

Consult the Graduate Studies' Thesis and Dissertation page and these guides:

NOTE: These guides will be updated soon. See the updated title pages in the box "Examples".

## Books

* When a Call Number is displayed, the library also has a print copy of the document.

## Installation

Microsoft users need to minimally install a TeX editor and a TeX distribution.

We recommend the MiKTeX distribution (the current version is 2.9), which includes:

• TeXworks, a multi-platform text editor to create and compile .tex documents;
• A program to install add-on packages;
• A PDF reader. (If this one does not work well, try the free reader SumatraPDF.)

TeXworks interface is available in French and can be displayed with: Edit Preferences ... General Local Interface: French.

To check the available packages in MiKTeX, click Start - Package Manager. To install other packages, select them and choose Task Install.

If necessary, install additional packages (ex.: macros .sty). Consult the Com­pre­hen­sive TeX Archive Net­work (CTAN), which includes over 6,000 packages.

Other TeX distributions and editors for Windows, Mac and Linux exist: WinEdt (which supports the "automatic translation", for example, from " to "\'e" and so the resulting LaTeX file is portable) LyX, MacTeX, etc.

## Create .TeX documents

Do not use accents or spaces in the name of .tex files!

How to write some special symbols and accented letters:

• uppercase letters: {IEEE}
• nonbreak space: ~\cite{Thornton2012}
• French accents: \accentletter *

Ex.: don\'ee; r\`eglement; \'Ecole; h\^opital; d\^iner; \`a faire; \`A Montr\'eal

(* The package inputenc: \usepackage[utf8]{inputenc} recognizes accented letters, so they can be typed directly: é, à, etc.)

Warning! Some packages can be incompatible with one another. Consult the documentation of each package you use.

For more information, consult the recommended books and websites.

## Create a reference list or a bibliography

Note: Open MyDocument.tex to see a concrete example (see next box).

To produce a reference list with references cited in the text:

• Include the references in a .bib file (see BibTeX → Entry Types and Required Fields and Recommendations for .bib Files);
• Cite references in your .tex document with \cite{BibTeX_key} (e.g., \cite{Brydson1999});
• Choose the reference list style with \bibliographystyle{name_of_style} (e.g., \bibliographystyle{IEEEtran});
• Specify the name of the .bib file that contains the references cited in the .tex file with \bibliography{name_of_.bib_file} (e.g., \bibliography{References}; see MyDocument.tex for more information on the \bibliography command);
• Compile the .tex file by following the steps in the Compilation box below.

To produce a bibliography including references that have not been cited in the text:

• Include all these references in a .bib file (see BibTeX → Entry Types and Required Fields and Recommendations for .bib files);
• Cite references in your .tex document with \cite{BibTeX_key} (e.g., \cite{Brydson1999});
• Choose the bibliography style with \bibliographystyle{name_of_style} (e.g., \bibliographystyle{IEEEtran});
• Specify the name of the .bib file that contains these references with \bibliography{name_of_.bib_file} (e.g., \bibliography{References}; see MyDocument.tex for more information on the \bibliography command);
• Use \nocite{*} for a bibliography that will comprise all references in the .bib file, even those that have not been cited in the text;
• Compile the .tex file by following the steps in the Compilation box below.

## Sample files that can be used to practice creating a reference list or bibliography

Example:

• Download the files MyIEEEabrvconf.bib and MyIEEEfullconf.bib in the same folder. (For more information about these files, refer to the box IEEE Abreviations for Conferences under the BibTeX tab.);
• Open MonDocument.tex in TeXworks;
• Compile it following the steps described in the Compilation box below and the file MonDocument.pdf, including a reference list, will be created.

NOTE: MyDocument.tex and MyReferences.bib include many comments (%) that explain the command lines.

The two files can be used as templates for creating other .tex documents and .bib files in TeXworks with File → New from Template...

## Compilation

Note: The compilation steps may be different if you use another TeX editor.

To transform a .tex file open in TeXworks in a PDF document, it should be compiled successively with:

1. pdfLaTeX to create the .aux file;
2. BibTeX to link the .bib file containing the references and the bibliographic style .bst with the .aux file and produce the .bbl file;
3. pdfLaTeX to format the bibliography;
4. pdfLaTeX to properly display the bibliography.

If you make changes and you need to compile the .tex file again, first delete all the auxiliary files created during the previous compilation: .aux, .bbl, .blg, .log, .out, .pdf, .synctex.gz.

If there are compilation errors related to the .sty packages, copy these packages in the directory where the LaTeX document is located.

For error messages and troubleshooting, consult section 1.12 (pages 35-37) of LaTex and Friends and the sections The Joy of TeX errors and LaTeX/Errors and Warnings.