Thursday 4 August 2016

Some LaTeX questions and answers

Where's my table of contents?
You have to compile it twice (I use pdfLaTeX). First run generates a .toc file and the second time uses that to create a table of contents in your document.

Using \tableofcontents is giving me an error!
You need to delete your .toc file every time you switch document types.

Where's my bibliography?
I'm assuming you've already created a .bib file and have referenced it in your document using \bibliography{...} . Compile to generate an .aux file which will contain references to the citations in your document. Then compile with BibTeX which will use your document's .aux file and the specified .bib file to generate a .bbl file for your document. It will also generate a .blg file which will contain the output of running BibTex. Now compile once again with pdfLaTeX to have the .bbl file included where \bibliography{...} is.

What is a .bbl file?
Simply put, it's the same as using the embedded bibliography system but automated. BibTex will style your \bibitem{...} contents the according what you specify in \bibliographystyle{...}.

How can I modularize my document? How can I separately compile each module?
If you just want to combine multiple files you can use either \include or \input. Use \subfile if you want the ability to compile each document separately. For more details, including the pros/cons of each, see here https://en.wikibooks.org/wiki/LaTeX/Modular_Documents