**LaTeX Tips, Tricks and Resources**
# Getting Started
- [Learn LaTeX in 30
Minutes](https://www.overleaf.com/learn/latex/Learn_LaTeX_in_30_minutes)
Overleaf's guide to first steps
- [Difference between TeX and
LaTeX](https://tex.stackexchange.com/questions/49/what-is-the-difference-between-tex-and-latex/85)
A term that people use interchangeably that has a technical
difference
# LaTeX Resources
## Free Books on LaTeX
- [The
TeXBook](http://visualmatheditor.equatheque.net/doc/texbook.pdf)
This is the original manual detailing TeX as a typesetting system
and language
- [The Not So Short Guide to
LaTeX2e](https://tobi.oetiker.ch/lshort/lshort.pdf) Specific to
LaTeX's features
- [LaTeX Reference
Manual](https://www.cs.ntua.gr/~sivann/books/LaTeX%20-%20User's%20Guide%20and%20Reference%20Manual-lamport94.pdf)
The manual for LaTeX written by the LaTeX creator himself.
## General Online Resources
- [Overleaf Documentation](https://www.overleaf.com/learn) Not all of
this is for the Overleaf Editor! Has many in depth articles on a
variety of TeX subjects.
- [TeX StackExchange](https://tex.stackexchange.com/) A forum for
asking questions (your future questions have already been asked
here)
- [LaTeX Project
Documentation](https://www.latex-project.org/help/documentation/)
The LaTeX Project's link page for documentation
- [LaTeX2e Unofficial Reference Manual](https://latexref.xyz/) What it
says on the tin
# Creating a Document
What to type to get a nice looking document. (LaTeX books are also
appropriate here)
## Layout
How the page gets laid out.
- [Layout](https://latexref.xyz/Layout.html) How the page gets laid
out (multiple columns, margins, etc.)
- [Cross
Referencing](https://www.overleaf.com/learn/latex/Cross_referencing_sections%2C_equations_and_floats)
Overleaf guide on cross-references
- [Indices](https://www.overleaf.com/learn/latex/Indices) on Overleaf.
Making a index in your document
### Useful Packages
- [geometry](http://mirrors.ctan.org/macros/latex/contrib/geometry/geometry.pdf)
Advanced page layout
- [fancyhdr](http://mirrors.ctan.org/macros/latex/contrib/fancyhdr/fancyhdr.pdf)
Making a page header and footer
- [microtype](http://mirrors.ctan.org/macros/latex/contrib/microtype/microtype.pdf)
Making your text layout look nice in paragraphs
## Scientific Typesetting
### Mathematics
- Math Symbol Lists
- [List of Math
Symbols](https://www.overleaf.com/learn/latex/List_of_Greek_letters_and_math_symbols)
from Overleaf
- [Symbols](https://www.caam.rice.edu/~heinken/latex/symbols.pdf)
A pdf of symbols
- [LaTeX Math
Symbols](https://www.math.uci.edu/~xiangwen/pdf/LaTeX-Math-Symbols.pdf)
Another pdf
- [Amssymb
Symbols](http://milde.users.sourceforge.net/LUCR/Math/mathpackages/amssymb-symbols.pdf)
amssymb package symbols
- [Spacing in math
mode](https://www.overleaf.com/learn/latex/Spacing_in_math_mode) on
Overleaf
- [Detexify](https://detexify.kirelabs.org/classify.html) Draw a
picture, get the math mode command
- [AmsThm](http://mirrors.ctan.org/macros/latex/required/amscls/doc/amsthdoc.pdf)
A package for making the nice definition formatting, proof with a
`\blacksquare` at the end, etc.
- [Tikz-cd](https://ctan.math.washington.edu/tex-archive/graphics/pgf/contrib/tikz-cd/tikz-cd-doc.pdf)
Making commutative diagrams
- [Quiver](https://q.uiver.app/) Web app for generating Tikz-cd
code from an interface
### Other Sciences
- [Feynman
Diagrams](https://www.overleaf.com/learn/latex/Feynman_diagrams)
from Overleaf
- [Molecular Orbital
Diagrams](https://www.overleaf.com/learn/latex/Molecular_orbital_diagrams)
from Overleaf
## Bibliography
- [Bibliography management with
BibLaTeX](https://www.overleaf.com/learn/latex/Bibliography_management_with_biblatex)
from Overleaf
Writing a bib file is hard to do by hand, but there are other ways to do
it! Most papers you can download or copy of a BibTeX entry. Also works
on Google Books. Also worth mentioning is
[Zotero](https://www.zotero.org/), a personal citation/library manager
that can export to BibTeX among many other features.
# Compilers and Technical
- [The TeX family
tree](https://www.overleaf.com/learn/latex/Articles/The_TeX_family_tree%3A_LaTeX%2C_pdfTeX%2C_XeTeX%2C_LuaTeX_and_ConTeXt)
Why are there so many names for LaTeX? Aren't they all the same?
No, they are not.
## [Xe(La)TeX](https://tug.org/xetex/)
XeTeX and XeLaTeX are compilers designed for Unicode and unusual
characters.
- [XeTeX
Reference](https://mirrors.rit.edu/CTAN/info/xetexref/xetex-reference.pdf)
Getting started with the XeTeX engine
- [Why
XeTeX?](https://tex.stackexchange.com/questions/3393/what-is-xetex-exactly-and-why-should-i-use-it)
A TeX Stackexchange answer
- [What is XeLaTeX](https://www.overleaf.com/learn/latex/XeLaTeX) from
Overleaf
## [Lua(La)TeX](http://www.luatex.org/)
LuaTeX and LuaLaTeX are compilers where you can mix Lua code and TeX.
- Introduction to LuaTeX
by Overleaf
- [Introduction to
LuaTeX](https://www.alanshawn.com/tech/2020/06/20/luatex-intro.html)
A blog post explaining the basic idea with some illustrative
examples
- [Lorenz Attrator in Lua and
Tikz](https://tex.stackexchange.com/questions/464045/how-to-use-lua-code-from-external-file-in-lualatex)
An example of generating a plot in Tikz based on computations in Lua
(a good example of how to use LuaTeX effectively)
## Core TeX
How raw TeX works at its core. (The TeXBook may be useful)
- [How do TeX macros actually
work?](https://www.overleaf.com/learn/latex/A_six-part_series%3A_How_do_TeX_macros_actually_work%3F)
From Overleaf. What happens under the hood when a document has
`\command` in it?
## Making your TeX Writing More Efficient
- [Defining a new
command](https://www.overleaf.com/learn/latex/Commands#Defining_a_new_command)
From Overleaf. Tired of writing that pesky `\mathbb{R}` over and
over? Define your own macro!
- [Writing your own
class](https://www.overleaf.com/learn/latex/Writing_your_own_class)
From Overleaf. Bundle some formatting options into a class.
- [Writing your own
class](https://www.overleaf.com/learn/latex/Writing_your_own_package)
From Overleaf. Bundle some commands together in a package.
# Editors
## Overleaf
Web-based editor with premium features. Lots of documentation and
connections (e.g. to GitHub). Documentation and features can be found
[here](https://www.overleaf.com/learn).
## Emacs
### Reading
- [LaTeX input for impatient
scholars](https://karthinks.com/software/latex-input-for-impatient-scholars/)
How to write TeX quickly in Emacs
### Emacs Packages
- [AucTeX](https://www.gnu.org/software/auctex/) THE package for LaTeX
Editing
- [CDLaTeX](https://github.com/cdominik/cdlatex) Input math symbols
and modify text with commands easily
- [RefTeX](https://www.gnu.org/software/auctex/reftex.html) Input
cross-references with ease
- [Helm/Ivy - BibTeX](https://github.com/tmalsburg/helm-bibtex) Look
up BibTeX Entries from a bib file with ease, and pull refs from the
internet
### Other Tips
- For big documents, don't use [Org Mode](https://orgmode.org) and
export. For personal notes, go wild.
- I highly recommend using the `orgtbl` minor mode for generating
tables. It basically puts a spreadsheet in your document and then
generates a LaTeX table from it.
## Vim
### Reading
- [Gilles Castel](https://castel.dev/) A guide on efficient TeX in Vim
### Vim Packages
If you plan on loading many packages, you'll probably get better
support from [NeoVim](https://neovim.io/) than from vanilla Vim.
- [VimTeX](https://github.com/lervag/vimtex) Package for compiling and
syntax highlighting for LaTeX
- [Conqueror of Completion](https://github.com/neoclide/coc.nvim)
Package for syntax checking via LSP (WARNING: Uses node)
- [UltiSnips](https://github.com/SirVer/ultisnips) Expand snippets
into fully fledged lines of TeX
## Visual Studio Code
### Packages
- [LaTeX
Workshop](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop)
Syntax Highlighting and some compile commands
## [LyX](https://www.lyx.org/)
I don't know much about LyX, but I have heard glowing testimonials. Not
exactly 'power-user' appealing, but is the perfect mixture of GUI and
interface and keyboard shortcuts.
## [TeXMacs](https://www.texmacs.org/tmweb/home/welcome.en.html)
This isn't actually LaTeX, but something like it. Only if you want to
be a weirdo. Just use something more standard.
# Extra Utilities
## [Pandoc](https://pandoc.org/)
- Pandoc is a document parser that can translate between many different document formats. Notably, it can turn [markdown](https://daringfireball.net/projects/markdown/) into LaTeX or directly into a pdf, making editing a breeze.
## Compiling
- [LaTeXMk](https://mg.readthedocs.io/latexmk.html) a tool for doing
all the compilation you would do manually all at once. Pretty much
every IDE-like solution is using LaTeXMk under the hood to rerun the
compiler, biber, etc.
## Version Control
- [Git](https://git-scm.com/) THE distributed verison control system.
Allows for making snapshots of files, doing rollbacks, finding
errors, etc. Allows for easy uploads to GitHub
- [LaTeXdiff](https://www.overleaf.com/learn/latex/Articles/Using_Latexdiff_For_Marking_Changes_To_Tex_Documents)
Takes two `.tex` files and compares them. Produces a third file that
you can compile and see the differences marked up in the generated
PDF.
## Make
- [Make](https://www.gnu.org/software/make/manual/make.html) A Unix
tool for running programs, shell commands, etc. in an automated way.
My current `Makefile` for TeX looks something like
``` makefile
.PHONY: compile preview diff clean
TEXFILE = main.tex # Include your main file here!
OTHERFILES = main.bib # Include other necessary files here (.bib, .png, etc.)
compile: ${TEXFILE} ${OTHERFILES}
@echo Compiling...
latexmk -lualatex ${TEXFILE}
preview: ${TEXFILE} ${OTHERFILES}
latexmk -lualatex -pvc -view=none ${TEXFILE}
clean: ${TEXFILE} ${OTHERFILES}
@echo Cleaning up...
latexmk -c
.ONESHELL:
diff: ${TEXFILE} ${OTHERFILES}
@echo Since which commit?
@read COMMIT
@latexdiff-vc --git -r $${COMMIT} --exclude-safecmd=cite ${TEXFILE}
```
A couple of notes about this:
- I use LuaTeX for Unicode support and Lua scripting (see Section [Lua(La)TeX])
- I use `latexmk` for easing the compilation process
- `latexdiff-vc` pulls a previous version from version control and
runs `latexdiff` on the current vs old version. Very helpful for
seeing past changes.