\output{pdf}
LaTeX to PDF
Three ways to compile your .tex file to PDF — browser, terminal, or REST API. Pick the method that fits your workflow.
Option 1
Online — no installation required
The fastest way to compile LaTeX to PDF. Open the FormaTeX playground, paste your source, and click Compile. Your PDF appears in seconds. Recommended for beginners and quick edits.
Option 2
Local compilation with pdflatex
Install TeX Live (Linux/macOS) or MiKTeX (Windows) once, then run pdflatex main.tex from your terminal. Use latexmk -pdf to handle multi-pass compilation automatically.
# Install TeX Live first (one-time)
# Ubuntu/Debian:
sudo apt-get install texlive-full
# macOS (MacTeX):
brew install --cask mactex
# Compile your .tex file
pdflatex main.tex
# For bibliography support (run multiple times)
pdflatex main.tex
bibtex main
pdflatex main.tex
pdflatex main.tex
# Or use latexmk (handles everything automatically)
latexmk -pdf main.texTip: latexmk -pdf automatically detects how many passes are needed (including BibTeX/Biber runs) — recommended over calling pdflatex manually.
Option 3
Compile via REST API
No local TeX installation needed. Send your LaTeX source to the FormaTeX API and receive a PDF in response. Integrate into any language or CI pipeline.
# No installation needed — just an API key
curl -X POST https://api.formatex.io/v1/compile/sync \
-H "Authorization: Bearer $FORMATEX_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"source\": $(cat main.tex | jq -Rs .), \"engine\": \"pdflatex\"}" \
--output output.pdf\section{Which engine?}
Which LaTeX engine to use
Choose based on your document requirements. Most users should start with pdfLaTeX. Full engine comparison →
| Engine | Best for | Unicode | Speed |
|---|---|---|---|
| pdflatex | Most documents | Limited | Fast |
| xelatex | Custom fonts, Unicode | Full | Medium |
| lualatex | Scripting, large docs | Full | Slower |
| latexmk | Automation, bibliography | Depends on sub-engine | Auto |
\section{Common errors}
Common compilation errors
Quick fixes for the most frequent pdflatex errors. Full error reference →
Undefined control sequence
You used a command from a package that is not loaded. Add the required \usepackage{...} before \begin{document}.
File not found
pdflatex cannot locate an included file. Ensure relative paths are correct and all images/inputs exist in the same directory as main.tex.
Missing $ inserted
Math-mode commands appear outside of a math environment. Wrap the expression in $...$ for inline or \[...\] for display math.
Ready to compile your first PDF?
Start with the free online compiler — no install, no credit card. 15 compilations per month included.

