Skip to content

amanuensisfrances/TeX-et-al

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

TeX et al.

A (mainly paraphrased and extensive but not necessarily comprehensive) guide for and an overview of TeX, LaTeX, and the extended TeX family.

What is TeX?

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.

What are TeX macros?

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.

What is LaTeX?

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).

What are TeX engines?

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:

  1. 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).
  2. e-TeX (also written as ε-tex), which adds a number of additional primitives to TeX and bidirectional typesetting extension called TeX--XeT.
  3. pdfTeX, which implements direct PDF output (but can produce DVI) and adds a number of (mainly) PDF-related primitives.
  4. XeTeX, which does the above and supports UTF-8 encoded Unicode natively, OpenType and TrueType fonts, and access to system fonts.
  5. LuaTeX, which does all the above and provides access to many internals via the embedded Lua programming language.
  6. pTeX, which adds a number of primitives to support vertical typesetting using "traditional" Japanese encodings.
  7. upTeX, which is similar to pTeX 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.

What are TeX Formats/TeX Macro Packages?

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:

Non-LaTeX TeX Formats

  1. Plain TeX, a set of macros created by Donald Knuth to typeset his books, including the TeXbook.

  2. AMS-TeX, a now-obsolete TeX format originally written by Michael Spivak for the American Mathematical Society (AMS) during 1983–1985.

  3. ConTeXt (see the ConTeXt section)

LaTeX TeX Formats

  1. LaTeX2.09, Leslie Lamport's last version of LaTeX which was last updated in 1992.

  2. LaTeX2e (also written as LaTeX2ε), the most commonly used TeX format and the current version of LaTeX, replacing LaTeX2.09 in 1994, which is actively being maintained and developed by The LaTeX Project team.

  3. LaTeX3, a LaTeX version in development since the early 1990s which was initially planned to replace LaTeX2e the same way LaTeX2e replaced LaTeX2.09 but whose features are instead currently being gradually incorporated in newer versions of LaTeX2e since 2020.

What does it mean when someone says they're using LaTeX or pdfLaTeX or XeLaTeX or LuaLaTeX?

  • "Using LaTeX" is a phrase often used as a shorthand for contexts where one uses a version of LaTeX (presumably LaTeX2e) 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 original TeX engine only supports DVI outputs).

  • "Using pdfLaTeX" is a phrase often used as a shorthand for contexts where one uses a version of LaTeX (presumably LaTeX2e) as the TeX format to write TeX files (with the .tex filename extension) whose (PDF or DVI) outputs are compiled using pdfTeX as the TeX engine.

  • "Using XeLaTeX" is a phrase often used as a shorthand for contexts where one uses a version of LaTeX (presumably LaTeX2e) as the TeX format to write TeX files (with the .tex filename extension) whose (PDF or DVI) outputs are compiled using XeTeX as the TeX engine.

  • "Using LuaLaTeX" is a phrase often used a shorthand for contexts where one uses a version of LaTeX (presumably LaTeX2e) as the TeX format to write TeX files (with the .tex filename extension) files whose (PDF or DVI) outputs are compiled using LuaTeX as the TeX engine.

Also, see this answer to TeX.SX's "Questions regarding the distinction between XeTeX and XeLaTeX and how they relate to TeX and LaTeX?"

What is ConTeXt?

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).

What is LyX?

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.

What are LaTeX macro packages?

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.

What are TeX distributions?

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:

1. TeX Live (cross-platform)

2. MikTeX (available on Windows, macOS, and certain Linux 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.

What are TeX editors?

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.

Local TeX Editors (Requires installing a TeX distribution)

For more local TeX editor recommendations, see TeX.SX's "LaTeX Editors/IDEs".

Cloud-based TeX Editors (Works without installing a TeX distribution)

  • 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)

Why should I use LaTeX?

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:

  1. The Beauty of LaTeX - Dario Taraborelli
  2. TeX.SX's "What is TeX used for?"
  3. TeX.SX's "What professions use TeX/LaTeX besides CS?"
  4. TeX.SX's "Why should I use LaTeX?"
  5. TeX.SX's "LaTeX vs Word; improvements of LaTeX over the years"
  6. TeX.SX's "Showcase of beautiful typography done in TeX & friends"
  7. TeX.SX's "Showcase TeX Typography for TUG's Calendar"
  8. TeX.SX's "Examples of simple beautiful PhD theses"
  9. TeX.SX's "Nice scientific pictures show off"
  10. TeX.SX's "How can I convert my TeX-illiterate coworkers to LaTeX?"
  11. TeX.SX's "What are the benefits of writing resumes in TeX/LaTeX?"
  12. 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.

What is the structure of a LaTeX document?

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.

What are LaTeX document classes?

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:

Standard Document Classes

  1. book (has \chapter, has \frontmatter, \mainmatter, and \backmatter, doesn't have the abstract environment, starts a new page for \part's heading)
  2. report (has \chapter, doesn't have \frontmatter, \mainmatter, \backmatter, has the abstract environment, starts a new page for \part's heading)
  3. article (doesn't have \chapter, doesn't have \frontmatter, \mainmatter, \backmatter, has the abstract environment, doesn't start a new page for \part's heading)
  4. letter (for writing letters)

KOMA-Script Document Classes (see the KOMA-Script section)

AMS Document Classes (see amscls-doc for the user documentation)

  1. amsbook (for books)
  2. amsart (for writing articles for the AMS)
  3. amsproc (for proceedings)

Miscellaneous Document Classes

  1. memoir (see the memoir section)
  2. beamer (see the beamer section)
  3. standalone (see the standalone section)

For more information, see TeX.SX's "What are the available 'documentclass' types and their uses?".

What is KOMA-Script?

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.

KOMA-Script Document Classes

  1. scrbook (KOMA-Script analogue to the standard book class) [KOMA-Script Documentation, Chapter 3]
  2. scrreprt (KOMA-Script analogue to the standard report class) [KOMA-Script Documentation, Chapter 3]
  3. scrartcl (KOMA-Script analogue to the standard article class) [KOMA-Script Documentation, Chapter 3]
  4. scrlttr2 (KOMA-Script analogue to the standard letter class) [KOMA-Script Documentation, Chapter 4] [KOMA-Script Documentation, Chapter 22] [KOMA-Script Documentation, Appendix A]

KOMA-Script Packages

KOMA-Script's packages (which are integrated in any KOMA-Script class, but are also usable in other classes) include:

  1. typearea (for providing type area calculation and should not be directly loaded in a KOMA-Script class) (KOMA-Script Documentation, Chapter 2) [KOMA-Script Documentation, Chapter 20]

  2. scrletter (for providing letter-based functionality of scrlttr2 to other classes) [KOMA-Script Documentation, Chapter 4] [KOMA-Script Documentation, Chapter 22] [KOMA-Script Documentation, Appendix A]

  3. scrlayer-scrpage (for page styles and is not loaded by default in a KOMA-Script class, replaces the now-obsolete scrpage2) [KOMA-Script Documentation, Chapter 5] [KOMA-Script Documentation, Chapter 18]

  4. scrdate (for providing calendar date operations) [KOMA-Script Documentation, Chapter 6]

  5. scrtime (for providing time information of the current LaTeX run) [KOMA-Script Documentation, Chapter 7]

  6. scraddr (for providing data from scrlttr2's address files) [KOMA-Script Documentation, Chapter 8]

  7. scrextend (for providing basic features of KOMA-Script classes in other classes and should not be used in a KOMA-Script class) [KOMA-Script Documentation, Chapter 9] [KOMA-Script Documentation, Chapter 21]

  8. scrjura (for providing environments suitable for writing contracts, laws, acts or other legal purposes) [KOMA-Script Documentation, Chapter 10]

  9. scrlogo (for providing the \KOMAScript macro which outputs the word mark KOMA-Script in a sans serif font and with slight letter spacing of the part set in uppercase) [KOMA-Script Documentation, Chapter 11]

  10. scrbase (for providing basic features of KOMA-Script) [KOMA-Script Documentation, Chapter 12]

  11. scrlfile (for providing control of package dependencies) [KOMA-Script Documentation, Chapter 13]

  12. 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]

  13. tocbasic (for providing management of tables/lists of contents, replaces the now-obsolete tocstyle) [KOMA-Script Documentation, Chapter 15]

  14. scrhack (for improving third-party packages) [KOMA-Script Documentation, Chapter 16]

  15. scrlayer [KOMA-Script Documentation, Chapter 17]

  16. scrlayer-notecolumn [KOMA-Script Documentation, Chapter 19]

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".

What is the memoir class?

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?".

What is the beamer class?

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].

What is the standalone class and package?

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].

What are math modes in LaTeX?

LaTeX provides two writing modes for typesetting mathematics:

LaTeX Inline Math Mode

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}).

LaTeX Display Math Mode

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].

How can I type LaTeX macros faster?

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}"
	}
}

What are some recommended packages for LaTeX?

LaTeX Packages for General Typesetting

  1. babel or polyglossia (only for XeLaTeX and LuaLaTeX)
  2. microtype
  3. setspace

LaTeX Packages for Font Selection and Unicode Support

  1. fontspec (only for XeLaTeX and LuaLaTeX, see also \fontspec All the Fonts!)

  2. unicode-math (only for XeLaTeX and LuaLaTeX)

  3. newunicodechar

LaTeX Packages for Mathematical and Scientific Typesetting

  1. mathtools

  2. amssymb

  3. amsthm

  4. mleftright

  5. centernot

  6. siunitx

  7. systeme

  8. polynom

LaTeX Packages for Source Code Typesetting

  1. listings

LaTeX Packages for List Environments

  1. enumitem

LaTeX Packages for Tables

  1. array
  2. tabularx
  3. booktabs
  4. longtable
  5. multirow
  6. cellspace
  7. tabularray
  8. nicematrix

LaTeX Packages for Colors

  1. xcolor

LaTeX Packages for Graphics Inclusion

  1. graphicx

LaTeX Packages for Placeholder Texts

  1. lipsum
  2. blindtext

LaTeX Packages for Citations and Bibliographies

  1. biblatex

LaTeX Packages for LaTeX Programming

  1. ifthen

LaTeX Packages for Hyperlinks and Cross-References

  1. hyperref
  2. cleveref
  3. bookmark

LaTeX Packages for Vector Graphics Production

  1. tikz (see the PGF/TikZ section)
  2. pgfplots
  3. todonotes
  4. forest

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.

What is PGF/TikZ?

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].

What are the different LaTeX macros and switches for font sizes, font families, and font styles?

LaTeX Font Size Switches

  1. \tiny
  2. \scriptsize
  3. \footnotesize
  4. \small
  5. \normalsize
  6. \large
  7. \Large
  8. \LARGE
  9. \huge
  10. \Huge

LaTeX Font Family Macros

  1. \textrm{<serif/roman-text>} (Serif/Roman)
  2. \textsf{<sans-serif-text>} (Sans Serif)
  3. \texttt{<monospaced/typewriter-text>} (Monospaced/typewriter)

LaTeX Font Family Switches

  1. \rmfamily (Serif/Roman)
  2. \sffamily (Sans Serif)
  3. \ttfamily (Monospaced/Typewriter)

LaTeX Font Weight Macros

  1. \textmd{<medium-weight-text>} (Medium Weight)
  2. \textbf{<boldface-text>} (Boldface)

LaTeX Font Weight Switches

  1. \mdseries (Medium Weight)
  2. \bfseries (Boldface)

LaTeX Font Style Macros

  1. \textup{<upright-text>} (Upright)
  2. \textit{<italic-text>} (Italic)
  3. \textsl{<slanted-text>} (Slanted)
  4. \textsc{<text-in-small-caps>} (Small Caps)

LaTeX Font Style Switches

  1. \upshape (Upright)
  2. \itshape (Italic)
  3. \slshape (Slanted)
  4. \scshape (Small Caps)

LaTeX Default Font Macro (\textnormal{<text-in-default-text-font>})

LaTeX Default Font Switch (\normalfont)

LaTeX Math Mode Font Macros

  1. \mathrm{<serif/roman-math>}
  2. \mathsf{<sans-serif-math>}
  3. \mathtt{<monospaced/typewriter-math>}
  4. \mathbf{<boldface-math>}
  5. \mathit{<italic-math>}
  6. \mathbb{<blackboard-bold-math>}
  7. \mathcal{<calligraphic-math>}
  8. \mathscr{<script-math>}
  9. \mathfrak{<fraktur-math>}
  10. \mathbfit{<bold-italic-math>}
  11. \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?".

What are some nice text and mathematics fonts to use for LaTeX?

These are ones I personally use:

Serif/Roman Text Fonts

  • 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, and Baskervaldx-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, and NewCM10-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.

Sans Serif Text Fonts

  • 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, and NewCMSans10-BoldOblique.otf for the bold italic font style.

Monospace/Typewriter Text Fonts

  • 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.

Mathematics Fonts

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?".

How do I load fonts when using LuaLaTeX?

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:

  1. <SerifFont>-Regular<serif-font-extension>
  2. <SerifFont>-Bold<serif-font-extension>
  3. <SerifFont>-Italic<serif-font-extension>
  4. <SerifFont>-BoldItalic<serif-font-extension>
  5. <SansSerifFont>-Regular<sans-font-extension>
  6. <SansSerifFont>-Bold<sans-font-extension>
  7. <SansSerifFont>-Oblique<sans-font-extension>
  8. <SansSerifFont>-BoldOblique<sans-font-extension>
  9. <MonospacedFont>-Regular<mono-font-extension>
  10. <MonospacedFont>-Bold<mono-font-extension>
  11. <MonospacedFont>-Italic<mono-font-extension>
  12. <MonospacedFont>-BoldItalic<mono-font-extension>
  13. <FourthFontFamily>-Regular<fourth-font-extension>
  14. <FourthFontFamily>-Bold<fourth-font-extension>
  15. <FourthFontFamily>-Italic<fourth-font-extension>
  16. <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?".

What are some nice LaTeX templates?

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.

What are some useful LaTeX-related tools?

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 some useful resources for reading and learning more about TeX, LaTeX, etc.?

12. Recommended Books on TeX and LaTeX

13. Miscellaneous TeX, LaTeX, and Typography Resources

What are some alternatives to TeX, LaTeX, etc.?

For more alternatives, see Alternatives to TeX and TeX.SX's "Alternatives to LaTeX".

About

A guide for and an overview of TeX, LaTeX, and the extended TeX family.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published