29 How to Use LaTeX
Prerequisites (read first if unfamiliar): Chapter 12, Chapter 31.
See also: Chapter 25, Chapter 26, Chapter 28, Chapter 7, Chapter 6, Chapter 35.
Purpose

Your advisor sends you a link to an Overleaf project and says “just add your section to the paper.” You open it and find a screen full of backslashes and curly braces, a file called references.bib, and a PDF on the right that looks exactly like the papers you read for class. You type a paragraph, click Recompile, and a red box appears: 12 errors, a log that scrolls forever, and one line that says ! Undefined control sequence. You didn’t even touch the part it’s complaining about.
If that’s where you are, you’re in good company. LaTeX has a reputation for making smart people feel dumb. It’s also the system behind most papers in computer science, math, statistics, and physics, and many in engineering, HCI, and information science, because it handles equations and bibliographies better than anything else. The first hour is the steepest part, and on Overleaf you don’t need to install anything to get through it.
This chapter is that on-ramp: when LaTeX is worth it, a first document, the syntax you’ll use in nearly every paper, venue templates, bibliographies, Beamer slides, and how to read errors without panicking. It isn’t a complete reference (Further reading points to those). It pairs with Chapter 25, whose Zotero setup makes bibliographies painless, Chapter 26 for what goes in the paper, and Chapter 28 for the design side of slides.
Why read this chapter
- Someone handed you a
.texfile and said “just use Overleaf,” and you’ve never written a command that starts with a backslash. - You clicked Recompile and got a wall of log output ending in
! Undefined control sequence., and you can’t tell which of the hundreds of lines matters. - Your citations show up as [?] in the PDF, even though the entry is sitting right there in your
.bibfile. - Your figure floats to the top of the next page (or to the end of the paper) no matter where you put it in the source.
- You downloaded the ACM or IEEE template for a class project or a submission, and it either won’t compile or you don’t know which lines to change.
- You’re writing equations for a stats or methods class, and Word’s equation editor is fighting you on every subscript.
- You’re deciding whether LaTeX is worth learning at all, or whether Word or Google Docs is fine for what you write.
Running theme: start on Overleaf and be productive on day one
The folklore that LaTeX has a steep learning curve is half true. The first hour is steep; after that it flattens fast, and what you learn keeps paying off for every paper, thesis, and talk you write afterwards.
29.1 Why LaTeX (and when not)
LaTeX is a markup language, not a word processor. In Word, what you see is what you get, and you format by clicking; in LaTeX, you write plain text with commands mixed in (\section{Method}, $x^2$), and a program turns it into a PDF. That program is TeX, which Donald Knuth released in 1978 because he didn’t like how a new edition of his own book had been typeset. LaTeX, first released by Leslie Lamport in 1984, is the friendlier layer of commands on top.
That design wins on three problems most academic writers have. Math: journal-quality equations from a few keystrokes. Bibliographies: a .bib file plus \cite{key} is far more reliable than a word processor’s reference manager, especially with several authors on several machines. Versioning: plain-text source works with Git (see Chapter 31), so you can see exactly which sentence a co-author changed last Tuesday.
It loses elsewhere. Skip it for short documents with no math or citations; a memo is faster in Markdown or Word. Skip it when collaborators won’t learn it, or the LaTeX users end up doing all the typesetting. And don’t fight your venue: if a journal wants Word, draft in LaTeX only if you trust your conversion workflow (Pandoc gets you most of the way).
The skeptics have evidence, too. In a 2014 study, Markus Knauff and Jelica Nejasmic had 40 researchers retype sample texts in Word or LaTeX. On plain text and on a table, Word users typed more and made fewer formatting mistakes; on the text full of equations, it flipped. The lesson: LaTeX pays off for math- and citation-heavy writing, not for every document.
29.2 Overleaf as the default environment
The hardest part of LaTeX used to be installing it. Overleaf (1) makes that disappear: it’s a LaTeX editor in your browser, with source on the left, the PDF on the right, and a Recompile button that does everything a local installation would. It’s the right default for a student, and you can write a whole thesis there.
Make an account. The free plan is enough for most class papers; its main limit is one collaborator per project. Many universities have an institutional license that lifts the limits, so ask your library before paying.
Start a project with New Project, then Blank Project or a template. You’ll see a file list, the source editor, and the PDF preview, with Recompile at the top of the preview. If LaTeX is brand new to you, Overleaf’s Learn LaTeX in 30 minutes is time well spent.
Share with the Share button. Editing is live, like Google Docs.
Get your files out whenever you like: download a .zip, or, on paid and institutional plans, git clone the project and push changes back. An Overleaf project is just a folder of .tex and .bib files, so moving to a local setup later costs you nothing.
29.3 A first document
Here is a complete LaTeX document. Paste it into a blank Overleaf project, click Recompile, and you get a one-page PDF:
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}
\title{A Minimal Example}
\author{Your Name}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
This is a minimal LaTeX document. It compiles into a PDF.
\section{An equation}
Einstein's famous equation is $E = mc^2$. In display form:
\[
E = mc^2.
\]
\end{document}Every LaTeX document has the same three parts, and once you can see them, any template gets less scary. The \documentclass line picks the overall layout (article here, a venue’s own class when you submit). The preamble, everything before \begin{document}, loads packages and sets the title and author; nothing in it appears on the page by itself. The body, between \begin{document} and \end{document}, is what ends up in the PDF, and its \maketitle prints the title you set in the preamble.
Older templates often add \usepackage[utf8]{inputenc}. It’s harmless but unnecessary: UTF-8 has been the default since the April 2018 release of LaTeX.
29.4 Other languages and scripts
Thanks to that UTF-8 default, accented Latin letters just work: type José, Gdańsk, or São Paulo into the first document and pdfLaTeX, Overleaf’s default compiler, prints them. Now add a name in Chinese or a word in Arabic, say Letters from José 李 and مرحبا., and the compile stops:
! LaTeX Error: Unicode character 李 (U+674E)
not set up for use with LaTeX.
You get one of these for every character it can’t set, and if you click past the red box, the PDF quietly leaves those characters out. pdfLaTeX can print only the characters some loaded package has set up for it. (Greek and Cyrillic can be set up that way, with babel, as Overleaf’s guide to non-Latin languages explains.)
For everything else, switch to one of the two Unicode engines, XeLaTeX or LuaLaTeX, which can use any font installed on the computer, and load fontspec to pick a font that has your characters. On Overleaf, open Settings (the gear icon, or File, then Settings), choose Compiler, and pick XeLaTeX or LuaLaTeX from the Compiler menu. Locally, run latexmk -lualatex main.tex. This compiles with either engine:
% Compile with XeLaTeX or LuaLaTeX, not pdfLaTeX.
\documentclass[11pt]{article}
\usepackage{fontspec}
\setmainfont{Noto Serif} % Latin, Greek, Cyrillic
\newfontfamily\chinesefont{Noto Serif CJK SC} % Chinese
\begin{document}
Letters from José {\chinesefont 李}, Zoë, Ольга, and Σοφία.
\end{document}\setmainfont sets the font for the whole document, and \newfontfamily defines a command, \chinesefont here, that switches to a second font for a stretch of text, since few fonts cover every script. Overleaf has both fonts; on your own computer, use any installed font with the characters you need. If you forget to change the compiler, fontspec tells you: The fontspec package requires either XeTeX or LuaTeX.
A right-to-left script such as Arabic or Hebrew needs more than a font: something has to lay the text out right to left, even in the middle of an English sentence. That’s the job of babel or polyglossia. With LuaLaTeX and babel, you can type each script as it comes and let babel pick its font:
% Compile with LuaLaTeX.
\documentclass[11pt]{article}
\usepackage[english, bidi=basic]{babel}
\babelprovide[import, onchar=ids fonts]{arabic}
\babelprovide[import, onchar=ids fonts]{chinese}
\babelfont{rm}{Noto Serif}
\babelfont[arabic]{rm}{Noto Naskh Arabic}
\babelfont[chinese]{rm}{Noto Serif CJK SC}
\begin{document}
Letters from José 李 and مرحبا.
\end{document}Overleaf’s guide to multilingual typesetting with babel and fontspec covers more languages, and its non-Latin languages page points to dedicated classes for documents written mostly in Chinese, Japanese, or Korean.
29.5 Syntax you’ll actually use
LaTeX has thousands of commands, and most papers use a few dozen. These are the ones you’ll reach for; for anything else, search “latex” plus what you want, and the answer is usually on Overleaf’s help pages or TeX StackExchange.
Sectioning numbers itself: \section{Title}, \subsection{Title}, \subsubsection{Title}, and \section*{Title} for an unnumbered one.
Environments, paired \begin{...} and \end{...} lines, hold most of the structure: lists, quotations, equations, figures. Lists and quotes look like this:
\begin{itemize}
\item Bullet one.
\item Bullet two.
\end{itemize}
\begin{enumerate}
\item First.
\item Second.
\end{enumerate}
\begin{quote}
A short block quote.
\end{quote}Math is where LaTeX earns its keep. Inline math goes between dollar signs, $...$; \[ ... \] displays an unnumbered equation, and the equation environment a numbered one:
The Pythagorean theorem: $a^2 + b^2 = c^2$.
\begin{equation}
\label{eq:pythag}
a^2 + b^2 = c^2.
\end{equation}amsmath adds align (lines lined up at the = signs), cases, and other multi-line layouts; Overleaf’s page on mathematical expressions is a good tour.
Cross-references mean you never type “Figure 3” yourself. Put \label{...} on the target and refer to it with \ref{...} (the number), \eqref{...} (an equation number in parentheses), or \autoref{...} (from hyperref, which adds the word, as in “Figure 1”). cleveref’s \cref{eq:pythag} does the same, so you never write “Equation~\(\ref{eq:pythag}\)” by hand. The snag everyone hits: on the first compile, every reference shows as ??, and the log says:
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
Nothing is broken. LaTeX learns where the labels are on the first pass and fills in the numbers on the second, so compile twice (Overleaf and latexmk do this for you); Overleaf’s guide to cross-referencing has more.
Figures and tables go in figure and table environments, which LaTeX calls floats, and the name is a warning: LaTeX decides where each goes, so a figure you placed in section 2 may turn up on the next page, or at the very end. The option [!htbp] says you’d accept here, top, bottom, or a page of floats, and asks LaTeX to try hard:
\begin{figure}[!htbp]
\centering
\includegraphics[width=0.8\linewidth]{figures/main-result.pdf}
\caption{The main result, with annotations.}
\label{fig:main-result}
\end{figure}A table has a tabular inside, where & separates columns and \\ ends a row. booktabs’s \toprule, \midrule, and \bottomrule give you a published paper’s clean rules instead of a grid:
\begin{table}[!htbp]
\centering
\begin{tabular}{lrr}
\toprule
Group & Mean & SD \\
\midrule
Treated & 3.42 & 0.81 \\
Comparison & 2.18 & 0.92 \\
\bottomrule
\end{tabular}
\caption{Outcome statistics.}
\label{tab:outcomes}
\end{table}If a float still lands somewhere odd, don’t fight it yet: placement changes with every paragraph you add, and most complaints vanish once the text is near its final length. Overleaf’s page on positioning images and tables has tricks for the rest. Refer to figures with \autoref, not “the figure below,” and it won’t matter where they land.
Packages are libraries of extra commands, loaded with \usepackage{name}; almost every one, with its manual, is on CTAN, the Comprehensive TeX Archive Network. These are worth loading in nearly every document:
\usepackage{amsmath} % math
\usepackage{graphicx} % figures
\usepackage{booktabs} % publication-quality tables
\usepackage{microtype} % subtle typography improvements
\usepackage{hyperref} % links and \autoref
\usepackage{cleveref} % smart cross-referencesThe order is deliberate. hyperref changes how many other packages work, so its manual asks you to load it after nearly everything else, and cleveref must come after hyperref. When two packages clash, the order is the first thing to check. (microtype makes tiny spacing adjustments so lines justify evenly with fewer hyphens; you’ll rarely notice it, which is the point.)
29.6 Document classes and journal templates
Most venues want your paper in their own template, and the first one you open can look like a wall of code you’re afraid to touch. Remember the three parts: the template is mostly preamble, and your job is mostly the body. Overleaf keeps a gallery of templates (2), the easiest place to start.
The article class is the default for anything not headed to a particular venue.
ACM’s acmart class covers CHI, CSCW, FAccT, and other ACM venues; get the current version from https://www.acm.org/publications/proceedings-template or CTAN. For an anonymous submission, the option anonymous hides the authors and review adds line numbers:
\documentclass[sigconf,anonymous,review]{acmart}For the camera-ready version, remove anonymous,review and add the rights and publication details ACM sends you (\setcopyright, \acmConference, \acmDOI, and friends). Chapter 26 covers the rest of anonymous submission.
IEEE’s IEEEtran class (3) covers IEEE venues, with its own conventions: two columns by default and numbered citations in square brackets.
Springer, Elsevier, and other journals publish their own classes, some well maintained and some old and fussy. Download a fresh copy rather than reusing a colleague’s, since the journal may have changed it. If a journal template won’t compile, check that every file in its .zip made it into your project, that you’re using the compiler its instructions name (some need XeLaTeX or LuaLaTeX), and that the error isn’t in a line you added.
Thesis templates come from your university. Ask your graduate program whether to use the official class (usually), a student-maintained one (sometimes better), or a generic class with a custom title page; Chapter 27 has the rest of the paperwork.
29.7 Bibliographies with BibTeX and BibLaTeX
LaTeX bibliographies use two files: main.tex, your manuscript, and references.bib, a plain-text list of sources, each with a citation key like matias2019civic. You cite with \cite{key}, and a separate program builds the reference list in whatever style the venue wants. That program is either the classic BibTeX, which the ACM and IEEE templates use, or the newer BibLaTeX with its helper Biber, which is more flexible about styles and Unicode. Use whichever your template uses.
Let Zotero write the .bib file, because typing entries by hand is how typos get into author names. With the Better BibTeX plugin, Zotero keeps a .bib file such as ~/code/term-paper/references.bib up to date on its own (Chapter 25 has the setup). Point \bibliography{references} at it locally; on Overleaf, upload the file (again when it changes), or link your Zotero library on a paid or institutional plan.
Citing has a few flavors. Plain \cite{keshav2007} works everywhere. The natbib package adds \citep{keshav2007} for a parenthetical citation and \citet{keshav2007} for one in your sentence (“Keshav (2007) argues”). Its default brackets are square, “[Keshav, 2007]”; load it as \usepackage[round]{natbib} for parentheses. With BibLaTeX, use \autocite{} and \textcite{}.
The bibliography style decides how it all looks: author-year or numbered, “et al.” or full author lists. With BibTeX, you pick one with \bibliographystyle{...}:
ACM-Reference-Formatfor ACM venues (theacmarttemplates set this up).IEEEtranfor IEEE venues.plainnat(author-year, withnatbib),apalike,chicago, orplain(numbered) for everything else.
With BibLaTeX, it’s an option instead, as in \usepackage[style=authoryear]{biblatex}. One BibTeX quirk catches everyone: many styles lowercase titles, so “End Users on Reddit” comes out “end users on reddit.” Wrap anything that must keep its capitals in braces, {Reddit}, in the .bib file.
Then comes the compile dance, behind the most common LaTeX question of all: “why do my citations say [?]?” The first pdflatex run notes which keys you cited; bibtex looks them up and writes the formatted list; the second pdflatex run reads that list, and the third fills in the citation labels. Until then, every citation shows as [?] (or (?) with natbib), and the log says:
LaTeX Warning: Citation `matias2019civic' on page 1 undefined on input line 3.
You almost never run these by hand. Overleaf’s Recompile runs latexmk, which works out which programs to run and how many times. Locally, latexmk -pdf main.tex does the same (and runs Biber instead of BibTeX when your document uses BibLaTeX). A latexmkrc file in the project folder saves the options, so the command is just latexmk:
$pdf_mode = 1; # produce a PDF
$bibtex_use = 2; # run BibTeX or Biber whenever it's needed
@default_files = ('main.tex');Overleaf reads a latexmkrc too. Its guides to bibliographies with BibTeX and with BibLaTeX cover the rest.
29.8 Beamer for presentations
Retyping equations into PowerPoint is miserable. Beamer is LaTeX’s class for slides: the source format you already know, one frame per slide, and math that looks just like your paper’s (see Chapter 28 for what makes a talk good). A minimal talk with the metropolis theme (4):
\documentclass{beamer}
\usetheme{metropolis}
\usepackage{appendixnumberbeamer}
\title{A Minimal Beamer Talk}
\author{Your Name}
\date{\today}
\institute{Your Institution}
\begin{document}
\maketitle
\begin{frame}{Opening slide}
An empowerment promise: by the end of this talk you'll know X.
\end{frame}
\begin{frame}{The result}
\begin{itemize}
\item Result one.
\item<2-> Result two (revealed on second click).
\end{itemize}
\end{frame}
\begin{frame}{Contribution}
We contribute X, Y, and Z.
\end{frame}
\end{document}Each frame is a slide, titled in the braces after \begin{frame}. The <2-> on the second bullet is an overlay: the bullet appears from the slide’s second step on, so this four-frame talk compiles to a five-page PDF, one page per click. \onslide does the same for anything else, and appendixnumberbeamer keeps backup slides after \appendix out of the slide count.
metropolis is clean and modern, where many find the built-in themes (Madrid, Berlin) dated. It hasn’t been updated since 2017, though, and a maintained fork, moloch, exists if it gives you trouble. Compiled with pdfLaTeX, it warns:
Package beamerthememetropolis Warning: You need to compile with XeLaTeX or LuaLaTeX to use the Fira fonts on input line 95.
It’s harmless; the slides compile in a standard font. For the intended Fira fonts, switch the compiler to XeLaTeX (on Overleaf, under Settings, then Compiler). Overleaf’s Beamer guide covers the rest.
29.9 Local installation (optional)
Everything in this chapter works on Overleaf. Install LaTeX locally when you want to write offline, when a big project compiles slowly, or when you want Git and your usual editor. Three good choices:
- TeX Live (5) is the reference distribution for Linux, macOS, and Windows (on a Mac, as MacTeX). The full installation needs several gigabytes, and then everything is there.
- MiKTeX (6) is popular on Windows and runs on macOS and Linux too. It starts small and installs missing packages the first time a document asks for them.
- Tectonic (7) is a self-contained engine in a single program that downloads packages on demand and reruns TeX and BibTeX as needed: the least hassle to set up.
For an editor, VS Code with the LaTeX Workshop extension (8) is a strong free choice (see Chapter 12); TeXShop, TeXstudio, Emacs with AUCTeX, and Vim with vimtex are fine too, and one you know beats one that’s new. A local project also makes files Overleaf hides from you (main.aux, main.log, main.bbl, and more), so keep them out of Git with the .gitignore in Templates.
29.10 Reading LaTeX errors without panicking
When a compile fails, the log is the scary part: hundreds of lines about fonts and packages, with the one that matters buried in the middle. The secret: look for lines that start with !. Those are the errors; the rest is mostly LaTeX thinking out loud. (Overleaf’s logs panel lists errors and warnings with clickable line numbers.) Every error has the same shape: a message, then l. and a line number, with the line broken where TeX stopped reading. Here’s \toprule without booktabs loaded:
! Undefined control sequence.
l.4 Some text. \toprule
TeX reached \toprule on line 4 and didn’t know it. That’s the whole diagnosis, found with the same loop you use for Python tracebacks (see Chapter 7 and Chapter 6). A handful of errors cause most of the trouble:
! Undefined control sequence. LaTeX doesn’t know a command. Usually it’s a typo (\secton) or a command from a package you didn’t load: \includegraphics needs graphicx, \toprule needs booktabs, \autoref needs hyperref, and \cref needs cleveref.
! Missing $ inserted. You used a math-only character, usually _ or ^, in ordinary text, classically in a file name:
! Missing $ inserted.
<inserted text>
$
l.4 Save it as data_
file.csv please.
Escape it as \_. The same error appears if you forget an equation’s closing $.
! Misplaced alignment tab character &. & separates table columns, so anywhere else write \&, as in Smith \& Jones. In a .bib file, a journal like New Media & Society passes through BibTeX untouched and the error points to main.bbl, a file you never wrote; the fix goes in the .bib file.
! LaTeX Error: File `booktab.sty' not found. On Overleaf, which has nearly every package, it’s a typo (booktab for booktabs). Locally, the package may be missing: tlmgr install <name> for TeX Live, or MiKTeX’s console.
! LaTeX Error: Unicode character 李 (U+674E) not set up for use with LaTeX. pdfLaTeX can’t print that character. Switch to XeLaTeX or LuaLaTeX and load a font that has it, as “Other languages and scripts” explains.
LaTeX Warning: Citation ... undefined. The bibliography step hasn’t run, or the key isn’t in your .bib file. If it survives a full compile, BibTeX’s log, main.blg, says I didn't find a database entry for "matias2019civc" about a mistyped key.
! Missing \endcsname inserted. Usually a command inside a \label or \ref, like \label{sec:\textit{intro}}. Keep labels to letters, digits, colons, and hyphens.
Two messages look alarming and aren’t errors. Overfull \hbox (120.69057pt too wide) means a line sticks into the margin, often a long URL; fix it only if you can see it in the PDF. LaTeX Warning: `h' float specifier changed to `ht'. is a figure floating, as described earlier.
When a message makes no sense, try Overleaf’s Recompile from scratch (in the menu beside Recompile), which clears leftover helper files that can keep a fixed error alive. Then bisect: comment out half the body with %, recompile, and halve whichever half still fails. Overleaf’s guide to errors explains many more messages. And since Overleaf produces a PDF despite errors by default, don’t leave errors sitting because the PDF looks fine: later ones are often side effects of earlier ones, so fix them from the top down.
29.11 AI assistance with LaTeX
LLMs are good at LaTeX (see Chapter 35). They’ll turn a Markdown table into a tabular, explain an error that has stumped you for ten minutes, clean stray characters out of a .bib file, and write a latexmkrc. They’re bad at math correctness: an LLM will happily typeset an equation with a sign flipped or a subscript on the wrong variable, and because it’s beautifully typeset, it looks right. Check every step of anything it derives. Ask the way you’d ask a person: what you’re trying to do, the error message exactly as the log shows it, the source around that line, and whether you’re on Overleaf or a local install.
29.12 Stakes and politics
Run pdfinfo on the PDF from this chapter’s first document, and one line of its output reads Tagged: no. The text is in the file, but nothing marks which line is a heading, what order the columns are read in, or what a figure shows. A screen reader user gets a flat stream of words, and equations can come out as strings of symbols. Most LaTeX papers you’ve read were made this way, because an untagged PDF is what pdflatex has always produced unless someone asks for more.
Asking for more is getting easier. The LaTeX Project’s tagging instructions describe adding a \DocumentMetadata line before \documentclass and an alt= description to each \includegraphics, which together produce a tagged PDF. The work is still in progress, and many packages and journal templates don’t support it yet. The convenience LaTeX gives sighted authors has long been paid for by disabled readers, and the default is the politics: nobody chose to exclude them, and nothing in the workflow asked.
See Chapter 8 for the broader framework. The concrete prompt to carry forward: when you submit a LaTeX-typeset document, ask whether the people who need to read it actually can.
29.13 Worked examples
From Word outline to a compiled LaTeX article on Overleaf
You have a Word outline with two citations and one equation (a difference-in-differences estimate), and you’d like a proper LaTeX PDF. In Overleaf, click New Project, then Blank Project, and name it term-paper. Replace the contents of its main.tex with:
\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{natbib}
\title{Civility After Moderation Policy Changes}
\author{Your Name}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
Online platforms increasingly use moderation interventions to shape user behavior \citep{matias2019civic}. The relationship between policy changes and user-level outcomes is not well understood, especially on volunteer-run platforms like Reddit \citep{squirrell2019platform}.
\section{Method}
We use a difference-in-differences design. The treatment effect $\tau$ is estimated by:
\begin{equation}
\tau = (\bar{y}^{\text{post}}_{\text{treated}} - \bar{y}^{\text{pre}}_{\text{treated}}) - (\bar{y}^{\text{post}}_{\text{comparison}} - \bar{y}^{\text{pre}}_{\text{comparison}}).
\end{equation}
\section{Conclusion}
The effect is statistically and substantively significant.
\bibliographystyle{plainnat}
\bibliography{references}
\end{document}Make references.bib with the new-file icon above the file list, and paste in two entries (or export them from Zotero):
@article{matias2019civic,
title = {Preventing Harassment and Increasing Group Participation through Social Norms in 2,190 Online Science Discussions},
author = {Matias, J. Nathan},
journal = {Proceedings of the National Academy of Sciences},
volume = {116},
number = {20},
pages = {9785--9789},
year = {2019}
}
@article{squirrell2019platform,
title = {Platform Dialectics: The Relationships between Volunteer Moderators and End Users on {Reddit}},
author = {Squirrell, Tim},
journal = {New Media \& Society},
volume = {21},
number = {9},
pages = {1910--1927},
year = {2019}
}Note the \& in the journal name and the braces around {Reddit}. Click Recompile, and latexmk runs pdflatex, bibtex, and pdflatex as many times as it takes. The PDF shows your title, two citations as “[Matias, 2019]” and “[Squirrell, 2019]” (use \usepackage[round]{natbib} for parentheses), the numbered equation, and a References section. The first time takes about ten minutes; the next paper takes less.
Fixing “Citation undefined” in an ACM paper
Your acmart project has a new Zotero .bib file, and the first compile fills the log with “Citation undefined” while every citation reads [?]. That’s normal, and it takes one or two fixes.
Check the file name. \bibliography{references} looks for references.bib in the project’s top folder.
Check the keys. Each \cite{} key must match a .bib key exactly, including capitals; search the .bib file for it.
Run the whole sequence. On Overleaf, Recompile. Locally, pdflatex main.tex, bibtex main, then pdflatex main.tex twice, or just latexmk -pdf main.tex.
If a warning survives, read main.blg, BibTeX’s log, which names keys it couldn’t find and entries it couldn’t read: usually an unescaped &, a character BibTeX can’t handle, or a missing comma or brace. BibTeX needs one pdflatex run to know what you cited, and later runs need its output, so several passes are simply how it works.
A ten-minute lab-meeting deck in Beamer
You want a clean lab-meeting deck with the method’s equation typeset properly:
\documentclass{beamer}
\usetheme{metropolis}
\usepackage{appendixnumberbeamer}
\title{Civility After Moderation: Preliminary Findings}
\subtitle{Lab meeting, 2026-04-30}
\author{Your Name}
\date{\today}
\begin{document}
\maketitle
\begin{frame}{What you'll know in 10 minutes}
\begin{itemize}
\item One subreddit's policy change had a measurable effect.
\item Off-the-shelf classifiers underestimate it.
\item Three things to discuss with you.
\end{itemize}
\end{frame}
\begin{frame}{Outline}
\tableofcontents
\end{frame}
\section{Setup}
\begin{frame}{The site and the policy change}
Reddit, r/\textit{Anonymized}, about 250,000 subscribers. Moderators introduced a stricter incivility rule on 2025-03-15.
\end{frame}
\begin{frame}{Method: difference-in-differences}
\begin{equation}
\tau = (\bar{y}^{\text{post}}_{T} - \bar{y}^{\text{pre}}_{T}) - (\bar{y}^{\text{post}}_{C} - \bar{y}^{\text{pre}}_{C}).
\end{equation}
Matched comparison community by size and topic.
\end{frame}
\section{Results}
\begin{frame}{Civility rose 18\% over four weeks}
\begin{center}
[Figure: time series]
\end{center}
\end{frame}
\begin{frame}{The classifier missed half the change}
\begin{itemize}
\item Off-the-shelf: $+9\%$.
\item Community-grounded annotation: $+18\%$.
\item<2-> The gap is informative.
\end{itemize}
\end{frame}
\section{Discussion}
\begin{frame}{Three things to discuss}
\begin{enumerate}
\item Is one site enough for the contribution?
\item Should the classifier comparison be a separate paper?
\item Where to send: CHI or CSCW?
\end{enumerate}
\end{frame}
\begin{frame}[standout]
Thanks --- let's discuss.
\end{frame}
\end{document}Compile it and you get twelve slides from the nine you wrote (the title and eight frames), because metropolis adds a divider slide for each \section, which \tableofcontents also lists. [standout] gives the last frame a dark background, and the one overlay makes the PDF 13 pages. Note 18\%: a bare % starts a comment and silently hides the rest of the line. And “about 250,000” is written out, because in LaTeX ~ is a non-breaking space, not “approximately.”
29.14 Templates
A minimal article, tagged for screen readers (see “Stakes and politics”):
% Tagged PDF. Needs the LaTeX release of 2025-06-01 or later (on Overleaf,
% pick the newest TeX Live under Settings, Compiler); older releases
% reject the tagging key. Some classes and packages don't support
% tagging yet; check yours at
% https://latex3.github.io/tagging-project/tagging-status/
\DocumentMetadata{
lang = en,
pdfstandard = ua-2,
pdfstandard = a-4f,
tagging = on
}
\documentclass[11pt]{article}
\usepackage{amsmath, graphicx, booktabs, microtype, hyperref, cleveref}
\title{}
\author{}
\date{\today}
\begin{document}
\maketitle
\section{}
\end{document}A CHI/CSCW acmart skeleton:
\documentclass[sigconf,anonymous,review]{acmart}
% Remove "anonymous,review" for camera-ready.
\usepackage{booktabs}
\title{Your Title}
\author{Anonymous Authors}
\begin{document}
\maketitle
\section{Introduction}
\section{Related Work}
\section{Method}
\section{Findings}
\section{Discussion}
\section{Limitations and Future Work}
\bibliographystyle{ACM-Reference-Format}
\bibliography{references}
\end{document}Three .bib entries, one for each common entry type (the first is a made-up example, with a placeholder DOI):
@inproceedings{lastname2025example,
title = {Title of Your Paper in Title Case},
author = {Lastname, Firstname and Coauthor, Second},
booktitle = {Proceedings of the Conference Name},
year = {2025},
publisher = {ACM},
doi = {10.1145/0000000.0000000}
}
@article{webster2002analyzing,
title = {Analyzing the Past to Prepare for the Future: Writing a Literature Review},
author = {Webster, Jane and Watson, Richard T.},
journal = {MIS Quarterly},
volume = {26},
number = {2},
pages = {xiii--xxiii},
year = {2002}
}
@misc{overleaf,
title = {Overleaf: Online {LaTeX} Editor},
author = {{Overleaf}},
year = {2026},
url = {https://www.overleaf.com/}
}A minimal Beamer metropolis deck: see the third worked example above.
A latexmkrc:
$pdf_mode = 1;
$bibtex_use = 2;
@default_files = ('main.tex');A .gitignore for a LaTeX project (the last four lines are for Beamer and BibLaTeX):
*.aux
*.log
*.out
*.toc
*.bbl
*.blg
*.fls
*.fdb_latexmk
*.synctex.gz
*.nav
*.snm
*.bcf
*.run.xml
Add main.pdf too if you’d rather not track the compiled PDF.
29.15 Exercises
- Compile your first Overleaf document. Share the read-only link with a classmate.
- Take a Markdown document with two citations and convert it into a LaTeX article with a
.bibfile generated from Zotero. - Submit a one-page document using the ACM
acmarttemplate. Toggle the[anonymous,review]flags and confirm the author block changes correctly. - Build and present a five-slide Beamer deck on a topic of your choice.
- Diagnose three deliberately broken
.texfiles (provided as exercises, or generated by deleting one\usepackage{}line at a time from a working document) and submit the fixes. Note the error message you used to find each problem.
29.16 One-page checklist
- Did you start a new project from a venue-appropriate template?
- Is your
.bibfile generated from Zotero with stable Better BibTeX keys? - Is your project under version control (see Chapter 31)?
- Does your
.gitignoreexclude.aux,.log,.out,.bbl,.synctex.gz, and the rendered PDF if you don’t want it tracked? - Are you compiling early and often (or letting Overleaf auto-compile)?
- Are figures in PDF or PNG with readable axis labels?
- Are tables using
booktabs(\toprule,\midrule,\bottomrule)? - Are cross-references using
\autoreforclevereffor consistent prefixes? - Did you load
hyperrefafter most other packages andcleverefafterhyperref? - When the log shows errors, did you fix them from the first
!line down?
29.17 Quick reference: the LaTeX commands you’ll use most
| Purpose | Command |
|---|---|
| Document class | \documentclass[options]{class} |
| Load a package | \usepackage{name} |
| Section / subsection | \section{...} / \subsection{...} |
| Inline math | $...$ |
| Display math | \[ ... \] or equation env |
| Bold / italic | \textbf{...} / \textit{...} |
| Bullet list | \begin{itemize} \item ... \end{itemize} |
| Numbered list | \begin{enumerate} \item ... \end{enumerate} |
| Figure | figure env with \includegraphics{f.pdf}, \caption{}, \label{fig:x} |
| Table (booktabs) | \toprule, \midrule, \bottomrule |
| Cite | \cite{key} / \citep{} / \citet{} |
| Cross-reference | \label{...} / \ref{...} / \autoref{...} / \cref{...} |
| URL | \url{...} (via hyperref) |
Literal %, &, _ |
\%, \&, \_ |
| Comment | % ... |
| Build (CLI) | latexmk -pdf main.tex |
- Overleaf, Learn LaTeX — the most approachable online LaTeX reference, with a page for nearly every task and error; where most students start.
- learnlatex.org, Learn LaTeX — a short series of hands-on lessons, each with an example you can run in the browser; complements Overleaf’s reference.
- Wikibooks, LaTeX — open, comprehensive, and surprisingly current; good for “how do I do X in LaTeX” questions.
- TeX StackExchange, tex.stackexchange.com — the community Q&A, one of the best Stack Exchange sites, and the place to take any error you can’t solve in 15 minutes.
- Detexify, Detexify — draw a symbol with your mouse and get its LaTeX command; saves you from ever again wondering what
\Updownarrowis called. - CU-ITSS, Intro-to-LaTeX — a sequenced course repository; a strong next step after Overleaf’s Learn pages.
- LaTeX Project, How to make accessible PDF and the LaTeX Tagged PDF project — where the work on screen-reader-accessible LaTeX PDFs stands; read these when accessibility is non-negotiable.