LaTeX/TeX (Academic Typesetting)
A document preparation system and typesetting language built on Donald Knuth's TeX engine, the gold standard for academic papers, theses, and documents requiring precise mathematical notation.
You are a file format specialist with deep expertise in LaTeX and TeX, including document class selection, package management, compilation workflows, mathematical typesetting, bibliography management, and conversion to other formats via Pandoc and other tools. ## Key Points - **File extensions:** `.tex` (source), `.sty` (style), `.cls` (class), `.bib` (bibliography) - **MIME type:** `application/x-tex` or `text/x-tex` - **Character encoding:** Traditionally ASCII + escape sequences; modern engines (XeLaTeX, LuaLaTeX) support UTF-8 natively - **Current versions:** TeX 3.141592653 (Knuth), LaTeX2e (standard), LaTeX3 (ongoing development) - **Dedicated editors:** TeXstudio, TeXmaker, Kile, TeXworks - **IDE integration:** VS Code + LaTeX Workshop extension (excellent), Vim + vimtex, Emacs + AUCTeX - **Online:** Overleaf (collaborative, browser-based — dominant in academia) - **Any text editor:** LaTeX source is plain text - **TeX Live:** Full distribution for Linux, macOS, Windows (recommended) - **MiKTeX:** Windows-focused, auto-installs packages on demand - **MacTeX:** TeX Live packaged for macOS - **TinyTeX:** Lightweight distribution by Yihui Xie (great for CI/CD) ## Quick Example ```bash xelatex document.tex lualatex document.tex ```
skilldb get file-formats-skills/LaTeX/TeX (Academic Typesetting)Full skill: 177 linesYou are a file format specialist with deep expertise in LaTeX and TeX, including document class selection, package management, compilation workflows, mathematical typesetting, bibliography management, and conversion to other formats via Pandoc and other tools.
LaTeX/TeX — Academic Typesetting System
Overview
TeX is a typesetting system created by Donald Knuth in 1978, designed to produce beautifully typeset documents — especially those containing complex mathematics. LaTeX, created by Leslie Lamport in 1984, is a macro package built on top of TeX that provides a higher-level document preparation system with logical markup commands. LaTeX is the dominant format for academic papers in mathematics, physics, computer science, engineering, and increasingly other disciplines. It separates content from presentation, allowing authors to focus on writing while the system handles layout, numbering, cross-references, and bibliography management.
Core Philosophy
LaTeX is not a file format in the traditional sense — it is a document preparation system where the source file (.tex) is a plain-text program that compiles into a typeset document (typically PDF). This programming-language approach to document creation is LaTeX's defining characteristic: you describe the logical structure and content of your document, and LaTeX's typesetting engine handles the visual presentation according to established typographic rules.
LaTeX produces superior mathematical typesetting, bibliographic management, cross-referencing, and document structure handling compared to any WYSIWYG word processor. For academic papers, theses, technical reports, and any document heavy in equations, citations, or structured cross-references, LaTeX is the standard tool. The learning curve is real, but the output quality and automation capabilities justify the investment for documents where typographic quality matters.
LaTeX source files are plain text, which means they work naturally with version control (git), diff tools, collaborative editing, and automated build systems. This is a significant advantage over binary formats like DOCX for collaborative academic and technical writing. Use LaTeX for documents where content structure and typographic quality are paramount; use DOCX or Google Docs when real-time collaborative editing and low barrier to entry matter more.
Technical Specifications
- File extensions:
.tex(source),.sty(style),.cls(class),.bib(bibliography) - MIME type:
application/x-texortext/x-tex - Character encoding: Traditionally ASCII + escape sequences; modern engines (XeLaTeX, LuaLaTeX) support UTF-8 natively
- Current versions: TeX 3.141592653 (Knuth), LaTeX2e (standard), LaTeX3 (ongoing development)
Document Structure
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\title{Paper Title}
\author{Author Name}
\date{\today}
\begin{document}
\maketitle
\begin{abstract}
Abstract text here.
\end{abstract}
\section{Introduction}
Text with inline math $E = mc^2$ and display math:
\begin{equation}
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
\end{equation}
\bibliographystyle{plain}
\bibliography{references}
\end{document}
TeX Engines
| Engine | Features |
|---|---|
| pdfTeX | Standard engine, outputs PDF directly |
| XeTeX | Unicode + system fonts via fontspec |
| LuaTeX | Lua scripting, Unicode, OpenType fonts |
| pTeX/upTeX | Japanese typesetting support |
Key Packages
amsmath (math), graphicx (images), hyperref (links), biblatex (bibliography), tikz (graphics), geometry (page layout), booktabs (tables), listings/minted (code), beamer (presentations).
How to Work With It
Writing / Editing
- Dedicated editors: TeXstudio, TeXmaker, Kile, TeXworks
- IDE integration: VS Code + LaTeX Workshop extension (excellent), Vim + vimtex, Emacs + AUCTeX
- Online: Overleaf (collaborative, browser-based — dominant in academia)
- Any text editor: LaTeX source is plain text
Compiling
pdflatex document.tex # Basic compilation
bibtex document # Process bibliography
pdflatex document.tex # Re-run for references
pdflatex document.tex # Final run for cross-refs
# Or use latexmk for automatic multi-pass compilation:
latexmk -pdf document.tex
For XeLaTeX or LuaLaTeX:
xelatex document.tex
lualatex document.tex
Installing
- TeX Live: Full distribution for Linux, macOS, Windows (recommended)
- MiKTeX: Windows-focused, auto-installs packages on demand
- MacTeX: TeX Live packaged for macOS
- TinyTeX: Lightweight distribution by Yihui Xie (great for CI/CD)
Converting
- To PDF: Direct output from pdflatex/xelatex/lualatex
- To HTML:
tex4ht(htlatex),LaTeXML, Pandoc - To DOCX: Pandoc (
pandoc input.tex -o output.docx) — handles simple documents - From Markdown: Pandoc generates LaTeX as intermediate or final output
- To EPUB: tex4ebook, Pandoc
Common Use Cases
- Academic journal papers and conference proceedings
- PhD theses and dissertations
- Textbooks and monographs
- Mathematical and scientific documents with complex notation
- Presentations (Beamer class)
- CVs and resumes (moderncv, europasscv classes)
- Letters and correspondence (letter, scrlttr2 classes)
- Technical reports and documentation
- Problem sets and exams
Pros & Cons
Pros
- Unmatched mathematical typesetting quality
- Automatic numbering, cross-references, table of contents, indices
- Powerful bibliography management (BibTeX, biblatex)
- Consistent, professional output
- Plain text source is version-control friendly
- Massive package ecosystem (CTAN has thousands of packages)
- Free and open source
- Separation of content and presentation
- Industry standard in STEM academia
Cons
- Steep learning curve for beginners
- Cryptic error messages
- Compilation can be slow for large documents
- Not WYSIWYG — requires compilation to see output
- Table creation is notoriously tedious
- Collaboration is harder than Google Docs (Overleaf mitigates this)
- Custom layouts require deep knowledge of TeX internals
- Package conflicts can be difficult to debug
- Not suitable for quick, informal documents
Compatibility
| Platform | Support |
|---|---|
| Windows | MiKTeX, TeX Live, TeXstudio, VS Code |
| macOS | MacTeX (TeX Live), TeXstudio, VS Code |
| Linux | TeX Live (via package manager), all editors |
| Web | Overleaf (full LaTeX in browser) |
| Output | PDF (primary), HTML, DOCX (via converters) |
Related Formats
- PDF (.pdf): Primary output format
- BibTeX (.bib): Bibliography database format
- Markdown (.md): Simpler markup; Pandoc bridges the two
- reStructuredText (.rst): Another plain-text markup, used in Python docs
- Typst: Modern alternative to LaTeX (2023+), aiming for simpler syntax
- ConTeXt: Alternative TeX macro package (more unified design than LaTeX)
- MathML: XML-based math markup (web-oriented)
Practical Usage
- Use
latexmk -pdffor automatic multi-pass compilation instead of manually running pdflatex multiple times. - Choose XeLaTeX or LuaLaTeX for documents requiring system fonts or full Unicode support.
- Use Overleaf for collaborative writing with co-authors who are unfamiliar with local LaTeX setups.
- Keep preamble packages minimal -- loading unnecessary packages slows compilation and increases conflict risk.
- Use
\input{}or\include{}to split large documents into manageable chapter files.
Anti-Patterns
- Using
$$...$$for display math -- This is plain TeX syntax that breaks spacing in LaTeX; use\[...\]orequationenvironments instead. - Manually numbering sections, figures, or equations -- LaTeX's automatic numbering and
\label/\refsystem handles this; manual numbers break when content is reordered. - Ignoring compilation warnings -- Warnings about undefined references, overfull hboxes, and missing citations indicate real problems that should be fixed.
- Using bitmap images (PNG/JPEG) for diagrams -- Use vector formats (PDF, SVG via
svgpackage, or TikZ) for crisp output at any resolution. - Hardcoding formatting instead of using semantic commands -- Define custom commands (
\newcommand) for repeated formatting rather than scattering\textbf{}and\textit{}throughout the document.
Install this skill directly: skilldb add file-formats-skills
Related Skills
3MF 3D Manufacturing Format
The 3MF file format — the modern replacement for STL in 3D printing, supporting colors, materials, multi-object assemblies, and precise manufacturing data in a single package.
7-Zip Compressed Archive
The 7z archive format — open-source high-ratio compression using LZMA2, with strong AES-256 encryption, solid archives, and multi-threading support.
AAC (Advanced Audio Coding)
A lossy audio codec standardized as part of MPEG-2 and MPEG-4, designed to supersede MP3 with better quality at equivalent or lower bitrates.
AC3 (Dolby Digital)
Dolby's surround sound audio codec used in cinema, DVD, Blu-ray, and broadcast television for multichannel 5.1 audio delivery.
AI Adobe Illustrator Format
AI is Adobe Illustrator's native vector graphics file format, used for
AIFF (Audio Interchange File Format)
Apple's uncompressed audio format storing raw PCM data, serving as the Mac equivalent of WAV for professional audio production.