A (mainly paraphrased and extensive but not necessarily comprehensive) guide for and an overview of TeX, LaTeX, and the extended TeX family.
TeX (derived from the Ancient Greek word τέχνη or technē ("skill", "art", "technique"); pronounced /tɛx/
or /tɛk/
) is a typesetting system and computer program, designed and written by Donald E. Knuth, that is primarily used for creating beautifully typeset mathematical content and producing high-quality documents. TeX, which is free and open-source, was first released in 1978 and uses the Turing-complete TeX markup language with primitive commands that are processed and compiled using the original TeX engine (compiler). All TeX files have the filename extension .tex
and outputs a DVI ("DeVice Independent") file with the filename extension .dvi
.
A TeX macro is command defined using the low-level primitive commands (the "building blocks") of the TeX markup language and/or other macros, and TeX macros are essentially shorthands that can make the source code of TeX documents both easier to read and write. Users can define their own macros which makes TeX a highly customizable typesetting system. TeX macro names are conventionally built from a \
(backslash) followed by a sequence of letters, which may be upper or lower case but they may also be <any-single-special-character>
, which allows all sorts of oddities.
LaTeX (possibly derived from Lamport + TeX; pronounced /ˈlɑːtɛx/
or /ˈleɪtɛx/
) is a document preparation system, originally written and developed by Leslie Lamport in 1984, which consists of a collection of TeX macros and is a program built on top of TeX to process documents which include complex mathematical expressions and multilingual typesetting. The idea behind LaTeX is to shift the focus from the format to the content of your document (separation of content and presentation). LaTeX is widely used in academia because it includes features designed for the production of technical and scientific documentation, and is the de facto standard for the communication and publication of scientific documents. LaTeX is a free and open-source software licensed under the LaTeX Project Public License (LPPL).
A TeX engine is the actual program that is used to run TeX to typeset and compile documents. TeX engines are the executable binaries which implement different TeX variants. There are currently seven [TeX] engines (binaries) in common use which can process TeX input, although not all are used to the same extent:
- Knuth's original
TeX
, which is the definitive TeX but is rarely used as the standard engine in modern TeX distributions (see the TeX distribution section). e-TeX
(also written asε-tex
), which adds a number of additional primitives toTeX
and bidirectional typesetting extension calledTeX--XeT
.pdfTeX
, which implements direct PDF output (but can produce DVI) and adds a number of (mainly) PDF-related primitives.XeTeX
, which does the above and supports UTF-8 encoded Unicode natively, OpenType and TrueType fonts, and access to system fonts.LuaTeX
, which does all the above and provides access to many internals via the embedded Lua programming language.pTeX
, which adds a number of primitives to support vertical typesetting using "traditional" Japanese encodings.upTeX
, which is similar topTeX
but allows for Unicode input (with a number of provisos) and also adds some additional primitives.
To clear up a common confusion, LaTeX is not a TeX engine but a collection of TeX macros, and different versions of LaTeX correspond to different LaTeX TeX formats.
A TeX format (or TeX macro package) is a collection of macros that make the TeX primitives usable for typesetting purposes by humans. TeX formats are the TeX-based languages in which one actually writes documents. Examples of TeX formats:
-
Plain TeX
, a set of macros created by Donald Knuth to typeset his books, including the TeXbook. -
AMS-TeX
, a now-obsolete TeX format originally written by Michael Spivak for the American Mathematical Society (AMS) during 1983–1985. -
ConTeXt
(see theConTeXt
section)
-
LaTeX2.09
, Leslie Lamport's last version of LaTeX which was last updated in 1992. -
LaTeX2e
(also written asLaTeX2ε
), the most commonly used TeX format and the current version of LaTeX, replacingLaTeX2.09
in 1994, which is actively being maintained and developed by The LaTeX Project team. -
LaTeX3
, a LaTeX version in development since the early 1990s which was initially planned to replaceLaTeX2e
the same wayLaTeX2e
replacedLaTeX2.09
but whose features are instead currently being gradually incorporated in newer versions ofLaTeX2e
since 2020.
-
"Using
LaTeX
" is a phrase often used as a shorthand for contexts where one uses a version of LaTeX (presumablyLaTeX2e
) as the TeX format to write TeX files (with the.tex
filename extension) whose (PDF or DVI) outputs are compiled using any TeX engine (with the caveat that the originalTeX
engine only supports DVI outputs). -
"Using
pdfLaTeX
" is a phrase often used as a shorthand for contexts where one uses a version of LaTeX (presumablyLaTeX2e
) as the TeX format to write TeX files (with the.tex
filename extension) whose (PDF or DVI) outputs are compiled usingpdfTeX
as the TeX engine. -
"Using
XeLaTeX
" is a phrase often used as a shorthand for contexts where one uses a version of LaTeX (presumablyLaTeX2e
) as the TeX format to write TeX files (with the.tex
filename extension) whose (PDF or DVI) outputs are compiled usingXeTeX
as the TeX engine. -
"Using
LuaLaTeX
" is a phrase often used a shorthand for contexts where one uses a version of LaTeX (presumablyLaTeX2e
) as the TeX format to write TeX files (with the.tex
filename extension) files whose (PDF or DVI) outputs are compiled usingLuaTeX
as the TeX engine.
ConTeXt
is a TeX-derived document processor, created by Hans Hagen and Ton Otten around 1991, which intends for users to provide users with typographic control more easily and more directly and this makes ConTeXt
differ from LaTeX whose original aim is for users to focus more on the content rather than the presentation although the current LaTeX Project has evolved from this vision (see ltx3info.pdf
linked in the resources section). ConTeXt
is a TeX format distinct from other formats because it uses a separate program (context
) which then runs a TeX engine. This makes it possible to support a wide array of advanced features, such as integrated graphics and XML input, since the control program can determine the flow of processing. For more information, read Berend de Boer's LaTeX in proper ConTeXt (2003).
LyX
is a LaTeX-derived GUI document processor that encourages an approach to writing based on the structure of documents (WYSIWYM) and not simply their appearance (WYSIWYG). LyX uses LaTeX as its backend typesetting mechanism but presents the user with the familiar face of a WYSIWYG word processor. For more information, read the Lyx Wiki.
A LaTeX macro package (or simply LaTeX package) is a collection of macros (based on TeX macros defined in a particular LaTeX TeX format, presumably LaTeX2e
) that are loaded (imported as addons) to add functionality and help users write or improve the typesetting of their LaTeX documents for specific contexts and use-cases. All LaTeX packages have the filename extension .sty
(as they were referred to as styles in LaTeX versions prior to LaTeX2e
). The standard and proper way to install TeX engines, TeX formats, and LaTeX packages is by installing what's called a TeX distribution.
A TeX Distribution provides a structured collection of TeX-related software, files, and macros, including the previously mentioned packages for LaTeX and what are called modules for ConTeXt, and uses a package manager to handle package dependencies. Some TeX distributions install everything you'll ever need right away (e.g., TeX Live) including fonts and documentations while others allows for more minimal installations which support installing packages on-the-go (e.g., MikTeX, see Just enough TeX). For ConTeXt specifically, it is recommended to install a ConTeXt distribution from their official website instead because it is more up-to-date.
There are three mainly used TeX distributions:
3. MacTeX (cross-platform redistribution of TeX Live which includes Mac-specific utilities and front-ends)
After installing a TeX distribution, it is recommended for you to install a TeX editor to help you write TeX and LaTeX documents.
A TeX editor is a text editor or IDE that is suitable for writing TeX documents. You can simply write the source code of your TeX documents in something like notepad
if you so wish of course, but specialized editors simply offer additional features such as syntax highlighting, spell checking, etc. Please do note that an editor alone can not convert a TeX file into a PDF, DVI, or any other output format, but requires programs, mainly a TeX engine, that are included in any TeX distribution.
- Visual Studio Code + LaTeX Workshop extension (free, cross-platform)
- Emacs + AucTeX (free, cross-platform)
- Vim or Neovim +
latex-suite
/vim-latex
(free, cross-platform) - TeXstudio (free, cross-platform)
- Texifier (formerly Texpad) (paid with a free trial version, only available on macOS, iOS, and iPadOS with a future release for Windows)
For more local TeX editor recommendations, see TeX.SX's "LaTeX Editors/IDEs".
- Overleaf (paid, free version allows unlimited documents with only one collaborator, requires registration, uses up-to-date TeX Live)
- Cocalc (paid, free version allows unlimited documents with unlimited collaborators, requires registration)
- Papeeria (paid, free version allows unlimited documents with unlimited collaborators, requires registration except for demo, uses TeX Live 2019)
- ConTeXt Live (free, no registration required)
- TeX Viewer (free, no registration required, limited features)
- Authorea (paid, free version allows only 10 documents with limited sharing, requires registration)
If you've read this far, I would assume you're at least somewhat interested in using LaTeX. For more details about the advantages and disadvantages of LaTeX over other alternatives, read the following:
- The Beauty of LaTeX - Dario Taraborelli
- TeX.SX's "What is TeX used for?"
- TeX.SX's "What professions use TeX/LaTeX besides CS?"
- TeX.SX's "Why should I use LaTeX?"
- TeX.SX's "LaTeX vs Word; improvements of LaTeX over the years"
- TeX.SX's "Showcase of beautiful typography done in TeX & friends"
- TeX.SX's "Showcase TeX Typography for TUG's Calendar"
- TeX.SX's "Examples of simple beautiful PhD theses"
- TeX.SX's "Nice scientific pictures show off"
- TeX.SX's "How can I convert my TeX-illiterate coworkers to LaTeX?"
- TeX.SX's "What are the benefits of writing resumes in TeX/LaTeX?"
- TeX.SX's "Why is LaTeX so complicated?"
If you're not interested in using LaTeX or if you're simply looking for alternatives, see the alternatives section.
How do I install LaTeX on Windows and use Visual Studio Code with the LaTeX Workshop extension as my TeX editor?
See LaTeX-VS-Code-Installation-Guide
.
A LaTeX document (with the .tex
filename extension) generally has the following structure (assuming it is the main file, typically named main.tex
, and not the sub-files).
%!TEX program = <pdflatex/xelatex/pdflatex>
% the comment above is a "magic comment"
% for more information about magic comments, read TeX.SX questions tagged with [magic-comment]: https://tex.stackexchange.com/questions/tagged/magic-comment?tab=Votes
\documentclass[<options>]{<document-class>}
% <preamble>
% the preamble is every piece of LaTeX code written after "\documentclass{<document-class>}" and before "\begin{document}"
% the preamble normally contains commands that affect the entire document
% LaTeX packages are loaded with the macro "\usepackage{<package-name>}" and can only be loaded in the preamble
\begin{document}
% <text>
% any pair of macros "\begin{<name>}" and "\end{<name>}" is called "LaTeX environment"
% every text inside a document environment (written after "\begin{document}" and before "\end{document}") will be typeset
\end{document}
Note that we can write comments in any (La)TeX document using %
(a percent sign). For more information, see the LaTeX/Document Structure article on Wikibooks.
A LaTeX document class (or simply "LaTeX class") is a file (with the .cls
filename extension) containing the general layout of a LaTeX document. As seen from the previous section on the structure of LaTeX documents, document classes are loaded with the \documentclass{<document-class>}
macro. Examples of LaTeX document classes:
book
(has\chapter
, has\frontmatter
,\mainmatter
, and\backmatter
, doesn't have theabstract
environment, starts a new page for\part
's heading)report
(has\chapter
, doesn't have\frontmatter
,\mainmatter
,\backmatter
, has theabstract
environment, starts a new page for\part
's heading)article
(doesn't have\chapter
, doesn't have\frontmatter
,\mainmatter
,\backmatter
, has theabstract
environment, doesn't start a new page for\part
's heading)letter
(for writing letters)
KOMA-Script
Document Classes (see the KOMA-Script
section)
AMS Document Classes (see amscls-doc
for the user documentation)
amsbook
(for books)amsart
(for writing articles for the AMS)amsproc
(for proceedings)
memoir
(see thememoir
section)beamer
(see thebeamer
section)standalone
(see thestandalone
section)
For more information, see TeX.SX's "What are the available 'documentclass' types and their uses?".
KOMA-Script
(possibly derived from Ko(hm) + Ma(rkus) + script
) is a bundle of many versatile LaTeX document classes and packages, originally written and currently developed and maintained by Markus Kohm, released in 1994 as a successor to the script
document style (a term used before LaTeX2e
when there was no distinction between classes and packages), written by Frank Neukam. Initially primarily intended to provide good LaTeX classes for German-language authors, KOMA-Script
currently aims to provide more-flexible alternatives to the standard classes. The capabilities of KOMA-Script
can surpass those of the standard classes and some of them should be considered extensions to the basic capabilities of the LaTeX kernel.
scrbook
(KOMA-Script
analogue to the standardbook
class) [KOMA-Script
Documentation, Chapter 3]scrreprt
(KOMA-Script
analogue to the standardreport
class) [KOMA-Script
Documentation, Chapter 3]scrartcl
(KOMA-Script
analogue to the standardarticle
class) [KOMA-Script
Documentation, Chapter 3]scrlttr2
(KOMA-Script
analogue to the standardletter
class) [KOMA-Script
Documentation, Chapter 4] [KOMA-Script
Documentation, Chapter 22] [KOMA-Script
Documentation, Appendix A]
KOMA-Script
's packages (which are integrated in any KOMA-Script
class, but are also usable in other classes) include:
-
typearea
(for providing type area calculation and should not be directly loaded in aKOMA-Script
class) (KOMA-Script
Documentation, Chapter 2) [KOMA-Script
Documentation, Chapter 20] -
scrletter
(for providing letter-based functionality ofscrlttr2
to other classes) [KOMA-Script
Documentation, Chapter 4] [KOMA-Script
Documentation, Chapter 22] [KOMA-Script
Documentation, Appendix A] -
scrlayer-scrpage
(for page styles and is not loaded by default in aKOMA-Script
class, replaces the now-obsoletescrpage2
) [KOMA-Script
Documentation, Chapter 5] [KOMA-Script
Documentation, Chapter 18] -
scrdate
(for providing calendar date operations) [KOMA-Script
Documentation, Chapter 6] -
scrtime
(for providing time information of the current LaTeX run) [KOMA-Script
Documentation, Chapter 7] -
scraddr
(for providing data fromscrlttr2
's address files) [KOMA-Script
Documentation, Chapter 8] -
scrextend
(for providing basic features ofKOMA-Script
classes in other classes and should not be used in aKOMA-Script
class) [KOMA-Script
Documentation, Chapter 9] [KOMA-Script
Documentation, Chapter 21] -
scrjura
(for providing environments suitable for writing contracts, laws, acts or other legal purposes) [KOMA-Script
Documentation, Chapter 10] -
scrlogo
(for providing the\KOMAScript
macro which outputs the word markKOMA-Script
in a sans serif font and with slight letter spacing of the part set in uppercase) [KOMA-Script
Documentation, Chapter 11] -
scrbase
(for providing basic features ofKOMA-Script
) [KOMA-Script
Documentation, Chapter 12] -
scrlfile
(for providing control of package dependencies) [KOMA-Script
Documentation, Chapter 13] -
scrwfile
(for providing a means of sending all LaTeX\newrite
, table of contents, and other miscellaneous output via the LaTeX.aux
file) [KOMA-Script
Documentation, Chapter 14] -
tocbasic
(for providing management of tables/lists of contents, replaces the now-obsoletetocstyle
) [KOMA-Script
Documentation, Chapter 15] -
scrhack
(for improving third-party packages) [KOMA-Script
Documentation, Chapter 16]
For more information, see TeX.SX's "Most useful additions in KOMA-Script?", TeX.SX's "Why should I *not* use the KOMA-Script classes?", and TeX.SX's "Using KOMA-Script packages with other classes".
memoir
is a LaTeX document class, originally written by Peter Wilson and currently developed and maintained by Lars Madsen, suitable as an alternative to the standard book
and report
classes. The built-in package functions of memoir
are mainly related to document design and layout; memoir
does not touch upon areas like those that are covered by the babel
(for multilingual typesetting) or hyperref
(for hyperlinks and cross-references) packages or any package related to mathematical typesetting. Compared to KOMA-Script
classes (e.g., scrbook
or scrreprt
) which only incorporate a handful of features but execute them well, memoir
has many built-in features based on multiple different LaTeX packages, mainly rewritten, but some of the aspects of those features may be implemented better by smaller, individual packages (e.g., enumitem
for lists).
For more information, see Peter Wilson's The memoir class and TeX.SX's "What are the strengths and weaknesses of KOMA-Script and memoir?".
beamer
is a LaTeX document class used for producing presentations and slides. The class works in both PostScript and direct PDF output modes, using the pgf
graphics system for visual effects.
For more information, see TeX.SX Questions Tagged With [beamer]
.
standalone
is a LaTeX document class and LaTeX package used for producing standalone LaTeX documents which allows users to easily place picture environments or other material in their source files and compile these on their own or as part of a main document. The standalone
class handles such files, which by default crops the resulting output file to
the content.
For more information, see TeX.SX Questions Tagged With [standalone]
.
LaTeX provides two writing modes for typesetting mathematics:
Inline math mode is used for writing mathematical expressions that are part of a paragraph. The TeX syntax for inline math mode is $<inline-math-expression>$
while the LaTeX syntax is \(<inline-math-expression>\)
(or the longer \begin{math} <inline-math-expression> \end{math}
).
Display math mode is used for writing mathematical expressions that are not part of a text or paragraph and are typeset on separate lines. The TeX syntax for unnumbered single-equation display math mode is $$<display-math-expression>$$
while the LaTeX syntax is \[<display-math-expression>\]
(or the longer \begin{displaymath} <display-math-expression> \end{displaymath}
or \begin{equation*} <display-math-expression> \end{equation*}
with the amsmath
package).
For more information, see TeX.SX Questions Tagged With [math-mode]
.
I would personally recommend using local TeX editors that support customizable user snippets that may increase your speed in typing LaTeX macros (especially paired with helpful keybindings for code navigation). I personally use VS Code + LaTeX Workshop (+ Emacs Friendly Keymap for a limited selection of Emacs keybindings) as my local TeX editor and VS Code has customizable user snippets (see Snippets in Visual Studio Code and snippet generator
). For TeX and LaTeX, you can edit the tex.json
and latex.json
files respectively to create your own snippets. For example, here is a LaTeX snippet for writing a general LaTeX document structure in VS Code:
// in file "C:\Users\<USERPROFILE>\AppData\Roaming\Code\User\snippets\latex.json"
{
// Document Class
"Document Class": {
"prefix": "\\cls",
"body": [
"%!TEX program = lualatex\n\n% DOCUMENT CLASS\n\\documentclass${1:[${2:<options>}]}{${3:<class>}}${4:\n\n${5:% <preamble>}}\n\n% START OF DOCUMENT\n\\begin{document}\n\t${6:<document>}\n\\end{document}\n% END OF DOCUMENT"
],
"description": "\\documentclass[<options>]{<class>} <preamble> \\begin{document} <document> \\end{document}"
}
}
babel
orpolyglossia
(only forXeLaTeX
andLuaLaTeX
)microtype
setspace
-
fontspec
(only forXeLaTeX
andLuaLaTeX
, see also\fontspec
All the Fonts!) -
unicode-math
(only forXeLaTeX
andLuaLaTeX
)- Loads
fontspec
- Loads
-
- Loads
amsfonts
- Loads
For more package recommendations, see TeX.SX's "What packages do people load by default in LaTeX?" and A one page, dictatorial guide to LaTeX packages.
pgf
(typeset as PGF, stands for Portable Graphics Format) is a lower-level language and LaTeX package for producing vector graphics (e.g., technical illustrations and drawings) from a geometric/algebraic description, with standard features including the drawing of points, lines, arrows, paths, circles, ellipses and polygons. It is platform- and format-independent and works together with the most important TeX backend drivers, including pdftex
and dvips
(a DVI to PostScript driver). tikz
(typeset as TikZ, stands for "TikZ ist kein Zeichenprogramm" which is German recursive acronym for "TikZ is not a drawing program") is a user-friendly syntax layer and set of higher-level macros called that use pgf
, and both are originally written by Till Tantau and currently developed and maintained by the PGF/TikZ team.
For more information, see TeX.SX Questions Tagged With [tikz-pgf]
.
\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge
\textrm{<serif/roman-text>}
(Serif/Roman)\textsf{<sans-serif-text>}
(Sans Serif)\texttt{<monospaced/typewriter-text>}
(Monospaced/typewriter)
\rmfamily
(Serif/Roman)\sffamily
(Sans Serif)\ttfamily
(Monospaced/Typewriter)
\textmd{<medium-weight-text>}
(Medium Weight)\textbf{<boldface-text>}
(Boldface)
\mdseries
(Medium Weight)\bfseries
(Boldface)
\textup{<upright-text>}
(Upright)\textit{<italic-text>}
(Italic)\textsl{<slanted-text>}
(Slanted)\textsc{<text-in-small-caps>}
(Small Caps)
\upshape
(Upright)\itshape
(Italic)\slshape
(Slanted)\scshape
(Small Caps)
\mathrm{<serif/roman-math>}
\mathsf{<sans-serif-math>}
\mathtt{<monospaced/typewriter-math>}
\mathbf{<boldface-math>}
\mathit{<italic-math>}
\mathbb{<blackboard-bold-math>}
\mathcal{<calligraphic-math>}
\mathscr{<script-math>}
\mathfrak{<fraktur-math>}
\mathbfit{<bold-italic-math>}
\mathnormal{<math-in-default-math-font>}
For more information, see Font sizes, families, and styles on the Overleaf documentation, TeX.SX's "Write 'text' **correctly** in equations", and TeX.SX's "What's the usual, standard way to write text in math mode?".
These are ones I personally use:
- Baskervaldx (free with a GNU GPL2+ license), specifically:
Baskervaldx-Reg.otf
for the upright font style,Baskervaldx-Bol.otf
for the bold style,Baskervaldx-Ita.otf
for the italic style, andBaskervaldx-BolIta.otf
for the bold italic font style. - NewComputerModern (free with a GUST Font License (GFL)), specifically:
NewCM10-Book.otf
for the upright font style,NewCM10-Bold.otf
for the bold font style,NewCM10-BookItalic.otf
for the italic font style, andNewCM10-BoldItalic.otf
for the bold italic font style. - BaskervilleF (free with a SIL Open Font License (OFL)), specifically:
BaskervilleF-Regular.otf
for the upright font style,BaskervilleF-Bold.otf
for the bold font style,BaskervilleF-Italic.otf
for the italic font style,BaskervilleF-BoldItalic.otf
for the bold italic font style.
- URW Classico (free with a No Commercial Use license), specifically:
URWClassico-Regular.otf
for the upright font style,URWClassico-Bold.otf
for the bold font style,URWClassico-Italic.otf
for the italic font style,URWClassico-BoldItalic.otf
for the bold italic font style. - NewComputerModern Sans (free with a GUST Font License (GFL)), specifically:
NewCMSans10-Book.otf
for the upright font style,NewCMSans10-Bold.otf
for the bold font style,NewCMSans10-BookOblique.otf
for the italic font style, andNewCMSans10-BoldOblique.otf
for the bold italic font style.
- JetBrains Mono (free with a SIL Open Font License (OFL)), specifically:
JetBrainsMono-Light.ttf
for the upright font style,JetBrainsMono-Bold.ttf
for the bold font style,JetBrainsMono-LightItalic.ttf
for the italic font style,JetBrainsMono-BoldItalic.ttf
for the bold italic font style.
- NewComputerModern Math (free with a GUST Font License (GFL)), specifically
NewCMMath-Book.otf
.
For more recommendations, see TeX.SX's "What best combination of fonts for Serif, Sans, and Mono do you recommend?", TeX.SX's "Suggest a "nice" font family for my basic LaTeX template (text and math)", TeX.SX's "Which OpenType Math fonts are available?".
Assuming you've installed a TeX distribution and a TeX editor, I will be giving an example of how to load fonts when using LuaLaTeX
specifically as that is the TeX format (LaTeX2e
) and engine (LuaTeX
) I use the most. First, create a main LaTeX file (e.g., main.tex
). Second, create a fonts folder (e.g., Fonts/
) in the same directory as your main file and paste the fonts you want to use in this folder. Let's say you have 16 different font files which consist of 4 different font families with 4 font styles each:
<SerifFont>-Regular<serif-font-extension>
<SerifFont>-Bold<serif-font-extension>
<SerifFont>-Italic<serif-font-extension>
<SerifFont>-BoldItalic<serif-font-extension>
<SansSerifFont>-Regular<sans-font-extension>
<SansSerifFont>-Bold<sans-font-extension>
<SansSerifFont>-Oblique<sans-font-extension>
<SansSerifFont>-BoldOblique<sans-font-extension>
<MonospacedFont>-Regular<mono-font-extension>
<MonospacedFont>-Bold<mono-font-extension>
<MonospacedFont>-Italic<mono-font-extension>
<MonospacedFont>-BoldItalic<mono-font-extension>
<FourthFontFamily>-Regular<fourth-font-extension>
<FourthFontFamily>-Bold<fourth-font-extension>
<FourthFontFamily>-Italic<fourth-font-extension>
<FourthFontFamily>-BoldItalic<fourth-font-extension>
Next, your main file should look something like the following (there may be other ways but this is how I load my fonts when using LuaLaTeX
):
%!TEX program = lualatex
\documentclass[<options>]{<document-class>}
% \usepackage[<language-option>]{babel} % For multilingual typesetting (optional but recommended)
% \usepackage[babel]{microtype} % For microtypography (optional but recommended)
\usepackage{fontspec} % For loading text fonts
\setmainfont[%
Scale = <font-scale>, % default value is 1
Path = <fonts-folder>/,
Extension = <serif-font-extension>,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic
]{<SerifFont>}
\setsansfont[%
Scale = <font-scale>, % default value is 1
Path = <fonts-folder>/,
Extension = <sans-font-extension>,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Oblique,
BoldItalicFont = *-BoldOblique
]{<SansSerifFont>}
\setmonofont[%
Scale = <font-scale>, % default value is 1
Path = <fonts-folder>/,
Extension = <mono-font-extension>,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic
]{<MonospacedFont>}
\begin{document}
<text>
\end{document}
These are main three font families you will use for your LaTeX document. If you want to occassionally switch to a fourth font family, you can use the \newfontfamily
macro, instead of \setmainfont
/\setsansfont
/\setmonofont
, and define \FourthFontFamily
in the preamble as follows:
\newfontfamily{\FourthFontFamily}[%
Scale = <font-scale>, % default value is 1
Path = <fonts-folder>/,
Extension = <fourth-font-extension>,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic
]{<FourthFontFamily>}
Now you can switch to the fourth font family by writing {\FourthFontFamily <text>}
. For more information, read TeX.SX's "How do I use a particular font for a small section of text in my document?".
- My
LuaLaTeX-KOMA-Script-Templates
- TeX.SX's "LaTeX templates for writing a thesis"
- TeX.SX's "Writing and Managing Thesis in LaTeX"
- TeX.SX's "Starting a PhD; Any guides to setting up a 'system'?"
- TeX.SX's "LaTeX template for resume/curriculum vitae"
- TeX.SX's "Package for certificates"
- TeX.SX's "Does anybody know a good source of (free) ornaments, decorations, frames, backgrounds etc.?"
Also, see Peter Flynn's A university thesis class: Automation and its pitfalls and Nicola L. C. Talbot's Using LaTeX to Write a PhD Thesis.
1. MathJax, a cross-browser JavaScript library that displays mathematical notation in web browsers (also, see MathJax basic tutorial and quick reference)
2. MathB.in, a pastebin for sharing LaTeX and Markdown source code snippets
3. EditTeX, an online LaTeX equation editor and a converter with LaTeX math mode expressions as inputs and SVG/PNG/JPG files as outputs
4. LaTeX2Image, an online converter with LaTeX math mode expressions as inputs and SVG/PNG/JPG files as outputs
5. latex2png.com
, an online converter with LaTeX math mode expressions as inputs and PNG files as outputs
6. Detexify, an online converter with handwritten math symbols as inputs and LaTeX math mode expressions as outputs
7. unicodeit.net
, an online converter with LaTeX expressions as inputs and Unicode characters as outputs
8. Unicode / LaTeX Conversion, an online converter with Unicode characters as inputs and LaTeX expressions as outputs
9. SimpleTex, an OCR software and converter with mathematical formula images as inputs and LaTeX code as outputs
10. pix2tex, an OCR command-line tool with an optional GUI and converter with mathematical formula images as inputs and LaTeX code as outputs
11. Tables Generator, an online table generator for LaTeX, HTML, plain text, Markdown, and MediaWiki
12. Quiver, an online graphical editor for commutative and pasting diagrams using the quiver
package which loads tikz-cd
which itself loads tikz
- What are TeX and its friends?
tex
– A sophisticated typesetting enginelatex
– A TeX macro package that defines LaTeXamstex
– American Mathematical Society Plain TeX macrosjoy-of-tex
– User documentation for the AMS-TeX macro collectionetex
– An extended version of TeX, from the NTS projectpdftex
– A TeX extension for direct creation of PDFxetex
– An extended variant of TeX for use with Unicode sourcesluatex
– The LuaTeX enginesource2e
– LaTeX2ε kernel documentation for the entire system as one documentmacros2e
– A list of internal LaTeX2ε macroslatex-base
– Base sources of LaTeXrequired
– Packages "required" of a LaTeX distributionl3kernel
– LaTeX3 programming conventionsl3packages
– High-level LaTeX3 conceptsusrguide
– User-mode documentation for LaTeXlshort-english
– A (Not So) Short Introduction to LaTeX2εlatex2e-help-texinfo
– Unofficial reference manual covering LaTeX2ε (also, see the websitelatexref.xyz
)yet-another-guide-latex2e
– A short guide to using LaTeX2ε to typeset high quality documentsl2tabu-english
– English translation of "Obsolete packages and commands"clsguide
– Documentation of LaTeX class and package writingmaths-symbols
– Summary of mathematical symbols available in LaTeXcomprehensive
– Symbols accessible from LaTeXshort-math-guide
– Guide to using amsmath and related packages to typeset mathematical notation with LaTeXbeginlatex
– A beginner's guide to LaTeX (also, see the updated version, Formatting Information)latex-for-undergraduates
– A tutorial aimed at introducing undergraduate students to LaTeXundergradmath
– LaTeX Math for Undergraduates cheat sheetlatex-doc-ptr
– A direction-finder for LaTeX resources available onlinetex-overview
– An overview of the development of TeXltnews
– The latest LaTeX news
- The LaTeX Project (aka LaTeX3 Project)
ltx3info.pdf
/The LaTeX3 Project - Frank Mittelbach, Chris Rowley- Core Documentation (for the most recent version of the user documentation, visit
usrguide
on CTAN which is linked above] - The LaTeX2e Kernel Code Repository
- The LaTeX3 Programming Language - David Carlisle, Chris Rowley, Frank Mittelbach
- TeX, LaTeX and math - Enrico Gregorio
learnlatex.org
: Taking LaTeX training fully interactive - David Carlisle, Paulo Roberto Massa Cereda, Joseph Wright
tex.pdf
(a version oftex.web
compiled as a PDF thanks to Knuth's Literate Programming)
- Just what is TeX?
- LaTeX vs. MiKTeX: The levels of TeX
- Getting started with TeX, LaTeX, and friends
- TeX Reference Manual (2002) - David Bausum
- Macros: A complement to \smash, \llap, and \rlap (2001) - Alexander R. Perlis
- Tables in LaTeX2ε: Packages and Methods (2007) - Lapo Filippo Mori
5. The TeX FAQ
- TeX Stack Exchange Community Wiki Questions
- TeX Stack Exchange's "What is the difference between TeX and LaTeX?"
- TeX Stack Exchange's "What are TeX and LaTeX?"
- TeX Stack Exchange's "The differences between TeX engines"
- TeX STack Exchange's "Differences between LuaTeX, ConTeXt and XeTeX"
- TeX Stack Exchange's "Glossary of TeX and LaTeX terms"
- TeX Stack Exchange's "Which manuals are on your 'TeX Reference' shelf?
- TeX Stack Exchange's "What are good learning resources for a LaTeX beginner?"
- TeX Stack Exchange's "Everyday LaTeX and workflow?"
- TeX Stack Exchange's "Where do I start LaTeX programming?"
- TeX Stack Exchange's "Consistent typography"
-
The TeX family tree: LaTeX, pdfTeX, XeTeX, LuaTeX and ConTeXt
-
A New Series of Articles: TeX Tokens and Related Concepts—But Why (and How)?
-
A six-part article series on \expandafter, TeX tokens and expansion
- How does \expandafter work: An introduction to TeX tokens
- How does \expandafter work: The meaning of expansion
- How does \expandafter work: TeX uses temporary token lists
- How does \expandafter work: From basic principles to exploring TeX's source code
- How does \expandafter work: A detailed macro case study
- How does \expandafter work: A detailed study of consecutive \expandafter commands
-
An Introduction to LuaTeX (Part 1): What is it—and what makes it so different?
-
An Introduction to LuaTeX (Part 2): Understanding \directlua
10. texblog
11. TikZBlog
- Computers and Typesetting, Volume A: The TeXbook (1986) - Donald E. Knuth (Source code available on CTAN)
- Computers and Typesetting, Volume B: TeX: The Program (1986) - Donald E. Knuth
- TeX by Topic, A TeXnician's Reference (2019) - Victor Eijkhout
- TeX for the Impatient (2020) - Paul W. Abrahams, Kathryn A. Hargreaves, and Karl Berry
- A Beginner's Book of TeX (1991) - Raymond Seroul , Silvio Levy
- LaTeX: A document preparation system, 2nd Edition (1994) - Leslie Lamport
- The LaTeX Companion, 3rd Edition (2023) - Frank Mittelbach, Ulrike Fischer
- A Guide to LaTeX, 4th Edition (2003) - Helmut Kopka, Patrick W. Daly
- More Math Into LaTeX, 5th Edition (2016) - George Grätzer
- Digital Typography Using LaTeX (2003) - Apostolos Syropoulos, Antonis Tsolomitis, Nick Sofroniou
- LaTeX and Friends (2012) - M. R. C. van Dongen
- LaTeX for Complete Novices (2012) - Nicola L. C. Talbot
- Notes On Programming in TeX (2021) - Christian Feuersänger
- Mathematical Typesetting with LaTeX (2017) - Herbert Voß
- LaTeX3: Programming in LaTeX with Ease
- A Few Notes on Book Design (2018) - Peter Wilson
1. Typst
3. AsciiDoc
4. SILE (also, see SILE: A new typesetting system - Simon Cozens)
5. Patoline
For more alternatives, see Alternatives to TeX and TeX.SX's "Alternatives to LaTeX".