LaTeX notes
Notes for using Tex and related things like Latex. In practice I access latex through pandoc
commands.
General Resources
- TexLive distribution
- TeX Stackexchange site
- Short tutorial geared to math students.
- Harvard math dept. reference
- A simple LaTeX pre-viewer that can be used for code on this page.
- An SE question with lots of tips and best practices for LaTeX.
Installing
Debian
The full TexLive (texlive_full
) distribution is very big, so installing the subset that includes latex, the texlive
package, is probably wise. When using funny unicode symbols when making pdfs with pandoc Xetex (texlive-xetex
package) is very helpful
Citations
Insert a citation with cite{citationID}
, where citationID
is the
identifier in a BibTeX (.bib) bibliography file. The .bib
is defined
somewhere in the LaTeX file with bibliography{~\user...\bibfile.bib}
.
There are other, improved implementations for citations, such as natbib.
Currently there is an error in the Zotero export filter for .bib files (parentheses and brackets are sometimes reversed when abbreviations and special characters are present). Open bibtex in vim and do:
:%s/)\}/\})/c
Citation Resources
- A natbib reference sheet.
- Some tips on using Zotero with BibTeX
Making Tables
It may be easier to make and format the table in a spreadsheet first, and some spreadsheets can export tables directly to LaTeX format. Gnumeric, and Libre Calc (using Calc2LaTeX) do a decent job, but there will still be formatting to make it look nice. Table data can also be pasted into this website to generate latex formatted tables. Once you have some data to format into a LaTeX table, this is the traditional way to do it:
\begin{tabular}{|c|c|c|}
\hline
A & B & C\\
\hline\hline
foo & bar & baz\\
\hline
zab & rab & oof\\
\hline
\end{tabular}
Depending on the table, a nicer/easier way could be to use the Booktabs package, and do something like this:
\begin{tabular}{ccc}
\toprule
A & B & C\\
\midrule
foo & bar & baz\\
zab & rab & oof\\
\bottomrule
\end{tabular}
Mathematical typesetting
TeX/LaTeX excels at this. Mathematical statements or formulas are generally placed between dollar signs. Here are a few resources:
Comments, TODOs, and other document annotations
Comments can be added to a Tex or latex document with the %
signifying the
beginning of a comment. If a document is reviewed by another and they
add these types of comments, they will be picked up by a diff between
the original and the patch.
A couple other ideas
- The todonotes package places callouts (Word style) in the compiled document.
Converting to Word/LO formats
Pandoc should do this, or...
- This tex.se question has some great ideas and links.
- There are other ideas in this SE question