Document structure
Every LaTeX document follows a basic structure:Everything before
\begin{document} is the preamble. Everything between \begin{document} and \end{document} is your actual content.Document classes
The\documentclass command defines the type of document:
Sections and headings
Organize your document with hierarchical sections:Text formatting
Basic formatting
Font sizes
Line and paragraph breaks
Lists
Unordered lists
Ordered lists
Description lists
Mathematical expressions
One of LaTeX’s greatest strengths is typesetting mathematics.Inline math
Use$...$ for math within text:
Display math
Use\[...\] or equation environments for centered equations:
The
equation environment automatically numbers equations. Use equation* for unnumbered equations.Common math symbols
Matrix notation
Tables
Create tables using thetabular environment:
Table alignment options
Table alignment options
l= left-aligned columnc= center-aligned columnr= right-aligned column|= vertical line\hline= horizontal line
Figures and images
Cross-references
Reference sections, equations, figures, and tables:Packages
Extend LaTeX functionality by loading packages in the preamble:Essential packages
| Package | Purpose |
|---|---|
amsmath | Advanced mathematical typesetting |
amssymb | Additional math symbols |
graphicx | Image inclusion |
hyperref | Hyperlinks and PDF features |
geometry | Page margins and layout |
natbib or biblatex | Bibliography management |
Comments
Add comments that won’t appear in the output:Special characters
Some characters have special meaning in LaTeX and need to be escaped:Bibliography
Create references for academic documents:Bibliography management typically requires external
.bib files. Check Typeset’s documentation for multi-file project support.Common mistakes to avoid
Forgetting to escape special characters
Forgetting to escape special characters
Characters like
$, %, &, _, {, } have special meaning. Use \$, \%, etc. to print them literally.Using $$ for display math
Using $$ for display math
While
$$...$$ works, it’s deprecated. Use \[...\] or \begin{equation}...\end{equation} instead.Not compiling after changes
Not compiling after changes
LaTeX requires compilation to see changes. Click “Compile” in Typeset frequently to catch errors early.
Missing braces in subscripts/superscripts
Missing braces in subscripts/superscripts
Use
x^{10} not x^10 for multi-character exponents. Without braces, only the first character is superscripted.Testing your LaTeX code
In Typeset, you can test any LaTeX code immediately:Learning resources
- Overleaf Documentation: Comprehensive LaTeX guides and examples
- LaTeX Wikibook: Community-maintained LaTeX reference
- CTAN: Comprehensive TeX Archive Network for packages
- Typeset AI: Use the built-in chat to ask questions about LaTeX syntax
Related resources
- Creating projects - Set up new LaTeX documents
- Troubleshooting - Fix LaTeX compilation errors
- Sharing projects - Collaborate on LaTeX documents