Skip to content
Learn LaTeX

Learn LaTeX by writing a document.

Eight short lessons and a quick reference. Each lesson has an example you can paste into Tulip and compile.

8 lessonsCopy-ready examplesCompile as you go

1. Your first document

LaTeX turns plain text and a few commands into a typeset document. Create a blank project in Tulip, open main.tex, and replace its contents with this example. Then press the play button to compile.

main.tex
\documentclass{article}
\title{My first paper}
\author{Your name}
\date{\today}
 
\begin{document}
\maketitle
\section{Introduction}
Every good project starts with a question.
\end{document}
Compiles to
My first paperYour nameOctober 22, 2026

1Introduction

Every good project starts with a question.

1

Everything before \begin{document} is the preamble: the document’s setup. Your writing belongs between \begin{document} and \end{document}.

2. Give your writing structure

Use commands for meaning rather than manually styling every heading. LaTeX handles numbering and spacing. Leave a blank line between paragraphs.

Sections and emphasis
\section{Methods}
This is the first paragraph.
 
This is a new paragraph with \emph{emphasis}.
\subsection{Measurements}
Explain how the data were collected.
Compiles to

1Methods

This is the first paragraph.

This is a new paragraph with emphasis.

1.1Measurements

Explain how the data were collected.

1

A larger project can split chapters across files with \input{chapters/methods}. Compile the root document that contains \documentclass, rather than an individual chapter.

3. Write mathematics

Put short mathematics inside $…$. Use an equation environment for a numbered expression. Labels let you refer to equations without hard-coding a number.

Equations and labels
Inline mathematics: $E = mc^2$.
 
\begin{equation}
  \sum_{i=1}^{n} x_i = n\bar{x}
  \label{eq:mean}
\end{equation}
 
See Equation~\ref{eq:mean}.
Compiles to

Inline mathematics: E = mc2.

n∑i=1xi = nx(1)

See Equation 1.

1

Packages such as amsmath add more mathematical environments. Add \usepackage{amsmath} in the preamble when you need them.

4. Add a figure

Upload an image into your project first. File paths and capitalization must match. The example below expects a file named result.png inside a figures folder.

A figure with a caption
% Add this in the preamble, before \begin{document}:
\usepackage{graphicx}
 
% Upload figures/result.png, then use this in the document:
\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.8\linewidth]{figures/result.png}
  \caption{The result of the experiment.}
  \label{fig:result}
\end{figure}
 
See Figure~\ref{fig:result}.
Compiles to
01020304000.51RoundMean opinionCohort ACohort BCohort C
Figure 1: The result of the experiment.

See Figure 1.

1

The letters in [htbp] suggest where the figure may be placed: here, top, bottom, or a separate page. LaTeX makes the final placement decision.

5. Make a table

A tabular holds the cells; a table around it adds a caption, a label and placement. Each letter in {lrr} is a column: left, right, right. & separates cells and \\ ends a row.

A table with a caption
\begin{table}[htbp]
  \centering
  \begin{tabular}{lrr}
    \hline
    Sample & Mass (g) & Volume (mL) \\
    \hline
    A & 12.4 & 10.0 \\
    B & 15.1 & 12.5 \\
    \hline
  \end{tabular}
  \caption{Measurements for each sample.}
  \label{tab:samples}
\end{table}
 
See Table~\ref{tab:samples}.
Compiles to
SampleMass (g)Volume (mL)
A12.410.0
B15.112.5

Table 1: Measurements for each sample.

See Table 1.

1

The booktabs package gives the cleaner rules most journals expect: \toprule, \midrule and \bottomrule, with no vertical lines.

6. Cite your sources

A short bibliography can live directly in the document. Put the bibliography before \end{document}, then cite an entry where you discuss it.

A small bibliography
\begin{thebibliography}{9}
  \bibitem{einstein1905}
  Albert Einstein.
  On the electrodynamics of moving bodies.
  Annalen der Physik, 1905.
\end{thebibliography}
 
% Cite this entry elsewhere in the document:
% \cite{einstein1905}
Compiles to

References

[1]Albert Einstein. On the electrodynamics of moving bodies. Annalen der Physik, 1905.

1

For more than a handful of entries, use a .bib file instead (next lesson). Cross-references can take more than one compilation pass to resolve.

7. Use a .bib file

For anything longer than a few references, keep entries in a .bib file. Export one from Zotero, Mendeley or your reference manager, upload it, and cite entries by key. The bibliography lists only what you cite.

references.bib
@article{einstein1905,
  author  = {Albert Einstein},
  title   = {On the Electrodynamics of Moving Bodies},
  journal = {Annalen der Physik},
  year    = {1905},
}
main.tex
% In the preamble:
\usepackage[style=authoryear]{biblatex}
\addbibresource{references.bib}
 
% In the text:
\textcite{einstein1905} introduced special relativity.
 
% Where the bibliography should appear:
\printbibliography
Compiles to

Einstein (1905) introduced special relativity.

References

Einstein, Albert (1905). “On the Electrodynamics of Moving Bodies”. In: Annalen der Physik.

1

If your journal template uses BibTeX instead of biblatex, keep its \bibliographystyle{…} and replace \printbibliography with \bibliography{references}. Tulip runs Biber or BibTeX for you.

When it doesn’t compile

  1. Open the compilation output and start with the first error; later errors may be consequences.
  2. Check matching braces, \begin/\end pairs, and the exact paths of images.
  3. Use \%, \&, and \_ for these characters in ordinary text.
  4. Check that the main file is the one with \documentclass. Missing packages download automatically; if one still fails, the compile log names it.

Quick reference

Commands you’ll use most
To getWrite
Bold, italic\textbf{…} \emph{…}
A bulleted list\begin{itemize} \item … \end{itemize}
A numbered list\begin{enumerate} \item … \end{enumerate}
A footnote\footnote{…}
A link\usepackage{hyperref} … \url{…}
Fraction, root\frac{a}{b} \sqrt{x}
Sub- and superscriptx_{i} x^{2}
Sum, integral\sum_{i=1}^{n} \int_{0}^{1}
Greek letters\alpha \beta \gamma \Delta
Aligned equations\begin{align} a &= b \\ c &= d \end{align}
A cross-reference\label{sec:intro} … \ref{sec:intro}
A page break\newpage
%, &, _, # in text\% \& \_ \#

Can’t find a symbol? Draw it in Detexify