.tex file to a complete LaTeX document containing a title block, sections, formatted text, a list, equations, a figure, a table, cross-references, and a bibliography citation. Unlike a word processor, you write plain text with commands (\section, \cite, \frac), and a TeX compiler builds the PDF.
What you will build
Here is the complete document you will assemble across the steps below, along with itsreferences.bib file and compiled output:
complete-document.tex
references.bib
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio
Step 1: Create the document and title block
Every LaTeX file has a preamble (before\begin{document}) for the document class, packages, and metadata, and a body (between \begin{document} and \end{document}) for printed content. Add \title, \author, and \date in the preamble and call \maketitle in the body. Lines starting with % are comments and do not appear in the PDF.
first-document.tex
Step 2: Add sections, text formatting, and lists
Use\section{...} and \subsection{...} to number headings automatically. Leave a blank line between paragraphs (avoid using \\ to separate paragraphs). Format inline words with \textbf{...} (bold), \emph{...} (emphasis), and \texttt{...} (monospace), and create bulleted or numbered lists with itemize and enumerate.
formatting-and-lists.tex
Step 3: Write inline and display mathematics
Wrap inline math in$...$, unnumbered display equations in \[...\], and numbered equations in \begin{equation}...\end{equation}. Load \usepackage{amsmath} for multi-line equations and \eqref.
math-equations.tex
Step 4: Insert a figure and a table
Load\usepackage{graphicx} to place images with \includegraphics, and \usepackage{booktabs} for horizontal table rules (\toprule, \midrule, \bottomrule). Wrapping each in a figure or table environment gives it a numbered \caption and lets LaTeX place it cleanly ([htbp]).
figure-and-table.tex
Step 5: Add cross-references and a citation
Attach\label{key} to a section, equation, or right after a \caption, then refer to it with \ref{key} (or \eqref{key} for equations). Store bibliographic sources in references.bib, cite them with \cite{key}, and print the reference list with \bibliographystyle{plain} and \bibliography{references}.
citations.tex
references.bib
pdflatex, bibtex, pdflatex, pdflatex). In LaTeX Cloud Studio, a full compile runs latexmk on TeX Live 2026 so those passes run in one compile.
Learn more in Cross-referencing, BibTeX bibliography guide, and BibLaTeX guide.
Step 6: Compile and fix errors
When a compile fails, fix the first error reported in the log and compile again—most beginner errors are an unescaped_ or & outside math mode (Missing $ inserted, Misplaced alignment tab character &) or a missing \usepackage{...} (Undefined control sequence). Keep Common LaTeX errors and Warnings explained handy while you write.
Try it in the editor
Start from the Basic Article template in LaTeX Cloud Studio, replacemain.tex with the complete example (complete-document.tex), and add references.bib to compile the full lab note in your browser.