Introduction
A .tex file is the source of a document typeset by TeX, the typesetting
system Donald Knuth wrote from 1978, or, far more often today, by LaTeX, the set of
macros Leslie Lamport built on top of it in the 1980s. The author writes plain text with
commands for structure and maths, and a TeX engine turns it into a finished
PDF. It is the standard way to write
papers in mathematics, physics and computer science, and is used for many books and
theses.
Structure
How TeX reads the characters is on the page
characters and commands, and the layout of a
LaTeX document on LaTeX documents.
A LaTeX file is plain text. Commands start with a backslash, such as
\section{Results} or \emph{word}, with required arguments in
braces and optional ones in square brackets. The preamble chooses a document class with
\documentclass and loads packages with \usepackage; the text
itself sits between \begin{document} and \end{document}.
Maths is written between dollar signs or in environments such as
equation, and % starts a comment. Larger documents are split
into several .tex files joined with \input or
\include, with references in a separate .bib file.
\documentclass{article}
\usepackage{amsmath}
\title{A Short Note}
\begin{document}
\maketitle
\section{Introduction}
Euler's identity is $e^{i\pi} + 1 = 0$.
\end{document}
Not described
A TeX file is a program, so its “every field” is not a finite list. The pages describe the syntax and the standard LaTeX structure.
Known, not yet covered
Links
Software
- TeX Live – the main TeX distribution, with LaTeX and thousands of packages (Windows, macOS, Linux)
- MiKTeX – TeX distribution that installs packages as they are needed (Windows, macOS, Linux)
- Overleaf – online LaTeX editor for writing together (web browsers)
- TeXstudio – free LaTeX editor (Windows, macOS, Linux)
- Pandoc – command-line converter that reads and writes LaTeX (Windows, macOS, Linux)
Reference
- The LaTeX Project – the team that maintains LaTeX, with its documentation
- TeX Users Group – the users’ group behind TeX Live, with links to documentation