OS: FreeBSD 14
Shell: csh
X Window Manager: FVWM
DVI Viewer: xdvi PDF Viewers: zathura, mupdf
Hello World in TeX
$ cat helloworld.tex
% Hello World in plain \TeX
Hello, World!
\bye
Running TeX on this file (for example, by typing tex helloworld.tex
) creates an output file called helloworld.dvi, representing the content of the page in a device independent format (DVI). A DVI file could then be either viewed on screen or converted to a suitable format for printing.
$ tex helloworld.tex
If your system doesn’t have a program for viewing .dvi files, you can install xdvi program (DVI Previewer for the X Window System):
$ pkg search xdvi
tex-xdvik-22.87.06_3 DVI Previewer (kpathsearch) for X
$ sudo pkg install tex-xdvik
$ xdvi helloworld.dvi
To change the colour of the background and the colour of the text (foreground):
$ xdvi -bg white -fg black helloworld.dvi
Alternatively, you can use pdfTeX, which is capable of generating typeset PDF output in place of DVI. pdfTeX has other capabilities, most notably in the area of fine typographic detail (for example, its support for optimising line breaks), but its greatest impact to date has been in the area of PDF output. [1] [2]
NOTE:
In FreeBSD, pdftex is installed by tex-basic-engines package.
$ pdftex helloworld.tex
$ zathura helloworld.pdf
Hello World in LaTeX
$ cat helloworld.tex
% Hello World! in LaTeX
\documentclass{minimal}
\begin{document}
Hello, World!
\end{document}
$ pdflatex helloworld.tex
$ zathura helloworld.pdf
What is TeX (also called Plain TeX)?
- Typesetting engine (typesetting system) [3]
- Typesetting language [4]
- Typesetting computer program [5]
- Plain TeX is the basic macro package [6]
What is LaTeX? Answer (Simplified): LaTeX = TeX + Macros
- A TeX macro package [7]
- A document processing system [7]
- A set of commands for interacting with the system at a higher level than the plain TeX [8]
- A macro system (built on top of TeX that aims to simplify its use and automate many common formatting tasks) [9]
- LaTeX uses the TeX formatter as its typesetting engine [10]
The Levels of TeX
From LaTeX vs. MiKTeX: The levels of TeX - TUG (TeX User Group): [11]
- Distributions: MiKTeX, TeX Live, W32TeX, …
- Front ends and editors: Emacs, vim, TeXworks, TeXShop, WinEdt, …
- Engines: TeX, pdfTeX, XeTeX, LuaTeX, …
- Formats: LaTeX, plain TeX, OpTeX, …
- Packages: geometry, lm, …
The First LaTeX Document
Based on first-latex-doc – A document for absolute LaTeX beginners:
The document leads a reader, who knows nothing about LaTeX, through the production of a two page document.
The user who has completed that first document, and wants to carry on, will find recommendations for tutorials.
and
first-latex-doc.pdf – The PDF file of example first document with embedded explanation
See also:
A First Set of LaTeX Resources
and
A Typical LaTeX Input File - From Getting Started with LaTeX, 2nd Edition, 1995 - David R. Wilkins
TeX/LaTeX Document Structure
Based on LaTeX/Document Structure - Wikibooks and Free edition of the book “TeX for the Impatient”.
- Commands
- Preamble
- Classes (Document Classes)
- Packages
- Groups
- Environments
- The Document Environment
- Top Matter (aka Front Matter)
- Table Of Contents (TOC)
- Abstract
- Sectioning (Sectioning Commands)
- Section Numbering
- Section Number Style
- Ordinary Paragraphs
- Back Matter (aka End Matter or Special Pages)
- Bibliography
- Appendix or Appendices
- Index
- Acronyms
- Nomenclature
- Glossary
- Top Matter (aka Front Matter)
- Book Structure
- Page Order
The following image (based on A Simplified Introduction to LaTeX - Harvey J. Greenberg and Dan Luecking shows a structure of a LaTeX document.
You can also download this image as a cropped PDF from here: latex-doc-structure.pdf [12]
An image showing the structure of a LaTeX document
Commands
Every input file must contain the commands.
From An Introduction to LaTeX - UNSW Mathematics Society:
Commands are what you use to access the features in LaTeX. Every command is preceeded by the backslash symbol:
\command
. Some commands may require you to provide arguments; for example, bold font requires you to provide the text you wish to bold as an argument:\textbf{bold text here}
. Each command is different, and the number of arguments required depends on which command you are currently using.
Preamble
A.k.a. the layout (or the setup) of the document.
\documentclass{...}
\begin{document}
...
\end{document}
The area between \documentclass{...}
and \begin{document}
is called the preamble. The preamble consists of all of the packages, commands and any other functionality you want to include.
Major or permanent modifications should go in a .sty file and be invoked with a \usepackage
command.
Classes (Document Classes)
When processing an input file, LaTeX needs to know which layout standard to use. Layouts standards are contained within ‘class files’ which have .cls as their filename extension.
\documentclass[options]{class}
Here, the class
parameter for the command \documentclass
specifies the .cls file to use for the document. It is recommended to put this declaration at the very beginning. The LaTeX distribution provides additional classes for other layouts, including letters and slides. It is also possible to create your own.
The options
parameter customizes the behaviour of the document class. The options have to be separated by commas.
Example: an input file for a LaTeX document could start with the line
\documentclass[11pt,twoside,a4paper]{article}
which instructs LaTeX to typeset the document as an article with a base font size of 11 points, and to produce a layout suitable for double sided printing on A4 paper.
Here’s a comprehensive list of document classes.
Code Snippets for Standard Classes
Packages
While writing your document, you will probably find that there are some areas where basic LaTeX cannot solve your problem. If you want to include graphics, coloured text or source code from a file into your document, you need to enhance the capabilities of LaTeX. Such enhancements are called packages. Some packages come with the LaTeX base distribution. Others are provided separately. Modern TeX distributions come with a large number of packages pre-installed. The command to use a package is pretty simple: \usepackage
:
The \usepackage
command goes into the preamble of the document; that is, in the area between \documentclass{...}
and \begin{document}
.
\usepackage[options]{package}
You can pass several options to a package, each separated by a comma.
\usepackage[option1,option2,option3]{''package_name''}
Recommended Packages
From ‘A Simplified Introduction to LaTeX’
From A Simplified Introduction to LaTeX - Harvey J. Greenberg and Dan Luecking.
You will find other packages useful, depending upon your technical area. Here are some packages that give you special symbols: chemsym, qsymbols, wasysym, and xypic. Also, the algorithm package enables an environment to write source code with standard language elements, and there are others with similar properties or for particular programming languages (viz., c-pascal and listings). The graphtex package specializes in all sorts of graphs, including those commonly found in automata theory.
From the preamble in that document:
\usepackage{amsmath} % formerly amstex
\usepackage{amssymb} % ams symbols (\mathbb fonts)
\usepackage{amscd} % draws commutative diagrams
\usepackage{bm} % bold math fonts (\mathbm)
\usepackage{graphicx,pst-all} % graphics
\usepackage{hyphenat} % enables control over hyphenation
\usepackage{fancyvrb,moreverb} % verbatim
\usepackage{float} % enable float [H] option
\usepackage[T1]{fontenc} % ...to write \textbf{\textsc{..}}
\usepackage{ifthen} % ifthenelse {condition}{true}{false}
\usepackage{makeidx} % index
\usepackage{multirow} % like multicolumn
\usepackage{mathrsfs} % more math symbols (viz., \mathscr)
\usepackage{theorem} % enables more control over newtheorem
\usepackage{url} % \url{...}
Recommended Packages - References
- https://www.ctan.org/pkg/nag
- https://www.ctan.org/pkg/l2tabu
l2tabu - Obsolete packages and commands
The “sins” of LaTeX users, and how to correct them. The document provides a list of obsolete packages and commands.
This original is in German. Translated version in English: https://www.ctan.org/pkg/l2tabu-english
It also comes with TeX Live so you can access it by entering the following command in your OS.
$ texdoc l2tabuen
In FreeBSD, your PDF viewer opens this file: /usr/local/share/texmf-dist/doc/latex/l2tabu-english/l2tabuen.pdf
.
An essential guide to LaTeX2e usage - Obsolete commands and packages
by Mark Trettin
English translation by Jürgen Fenn
June 17, 2007Abstract
This is the English version 1.8.5.7 of l2tabu, focusing on obsolete commands and packages, and demonstrating the most severe mistakes most LaTeX users are prone to make. You should read this guide if you want to improve on your LaTeX code.
- https://ctan.org/pkg/amsmath
- https://ctan.org/pkg/geometry
- https://ctan.org/pkg/graphicx
- https://ctan.org/pkg/nag
- https://ctan.org/pkg/microtype
- https://ctan.org/pkg/siunitx
- https://ctan.org/pkg/booktabs
- https://ctan.org/pkg/cleveref
- https://ctan.org/pkg/hyperref
Note on hyperref package: as a rule of thumb it should be loaded at the end of the preamble, after all the other packages. A few exceptions exist, such as the cleveref package. cleveref should be loaded after hyperref. More exceptions are listed in this post on TeX.SE: Which packages should be loaded after hyperref instead of before?
From Four effortless LaTeX packages you should use:
- https://ctan.org/pkg/mathpazo
- https://ctan.org/pkg/microtype
- https://ctan.org/pkg/caption
- https://ctan.org/pkg/sectsty
Groups
From Free edition of the book “TeX for the Impatient”:
A group consists of material enclosed in matching left and right braces ({ and }). By placing a command within a group, you can limit its effects to the material within the group. For instance, the
\bf
command tells TeX to set something in boldface type. If you were to put\bf
into your input file and do nothing else to counteract it, everything in your document following the\bf
would be set in boldface. By enclosing\bf
in a group, you limit its effect to the group. For example, if you type:
We have {\bf a few boldface words} in this sentence.
you’ll get:
We have a few boldface words in this sentence.
Environments
Areas between \begin{...}
and \end{...}
pairs are called environments. [13] [14] [15]
Environments typically take the form:
\begin{environmentname}[optional parameters]{mandatory parameters}
**--text--**
\end{environmentname}
In other words, the begin/end structure distinguishes the syntax of environments from commands. Note that some environments don’t have required parameters. For the subtle distinction between commands in environments, refer to this SE discussion: Why does LaTeX make a distinction between commands and environments?
The Document Environment
A.k.a. Actual Document (Document Body or Main Body of the Text)
After the preamble, the text of your document is enclosed between two commands which identify the beginning and end of the actual document:
\begin{document}
...
\end{document}
A useful side-effect of marking the end of the document text is that you can store comments or temporary text underneath the \end{document}
in the knowledge that LaTeX will never try to typeset them:
\end{document}
...
Top Matter (aka Front Matter)
At the beginning of most documents there will be information about the document itself, such as the title and date, and also information about the authors, such as name, address, email etc. All of this type of information within LaTeX is collectively referred to as top matter (aka front matter). Although never explicitly specified (there is no \topmatter or \frontmatter command) you are likely to encounter the term within LaTeX documentation.
A simple example:
\documentclass[11pt,a4paper]{report}
\begin{document}
\title{How to Structure a LaTeX Document}
\author{Andrew Roberts}
\date{December 2004}
\maketitle
\end{document}
You always finish the top matter (front matter) with the \maketitle command, which tells LaTeX that it’s complete and it can typeset the title according to the information you have provided and the class (style) you are using. If you omit \maketitle
, the title will not be typeset.
Using this approach, you can only create a title with a fixed layout. If you want to create your title freely, see the Title Creation.
Abstract
As most research papers have an abstract, there are predefined commands for telling LaTeX which part of the content makes up the abstract. This should appear in its logical order, therefore, after the top matter (front matter), but before the main sections of the body. This command is available for the document classes article and report, but not book.
\documentclass{article}
\begin{document}
\begin{abstract}
Your abstract goes here...
...
\end{abstract}
...
\end{document}
By default, LaTeX will use the word “Abstract” as a title for your abstract. If you want to change it into anything else, e.g. “Executive Summary”, add the following line before you begin the abstract environment:
\renewcommand{\abstractname}{Executive Summary}
Sectioning (Sectioning Commands)
Here are some of the sectioning commands.
\chapter{Introduction}
This chapter's content...
\section{Structure}
This section's content...
\subsection{Top Matter}
This subsection's content...
\subsubsection{Article Information}
This subsubsection's content...
You do not need to specify section numbers; LaTeX performs automatic numbering of the sections. Also, for sections, you do not need to use \begin
and \end
commands to indicate which content belongs to a given block.
If you want to use sections without numbering them, then add an asterisk (*) after the section command, but before the first curly brace, i.e. \section*{A Title Without Numbers}
.
LaTeX provides 7 levels of depth for defining sections (see table below). Each section in this table is a subsection of the one above it.
+---------------------------------+-------+-----------------------+
| Command | Level | Comment |
+---------------------------------+-------+-----------------------+
| \part{"part"} | -1 | not in letter |
+---------------------------------+-------+-----------------------+
| \chapter{"chapter"} | 0 | only book and report* |
+---------------------------------+-------+-----------------------+
| \section{"section"} | 1 | not in letter |
+---------------------------------+-------+-----------------------+
| \subsection{"subsection"} | 2 | not in letter |
+---------------------------------+-------+-----------------------+
| \subsubsection{"subsubsection"} | 3 | not in letter |
+---------------------------------+-------+-----------------------+
| \paragraph{"paragraph"} | 4 | not in letter |
+---------------------------------+-------+-----------------------+
| \subparagraph{"subparagraph"} | 5 | not in letter |
+---------------------------------+-------+-----------------------+
[*] You need \documentclass{book} or \documentclass{report}.
All the titles of the sections are added automatically to the table of contents (if you decide to insert one). But if you make manual styling changes to your heading, for example a very long title, or some special line-breaks or unusual font-play, this would appear in the Table of Contents as well, which you almost certainly don’t want. LaTeX allows you to give an optional extra version of the heading text which only gets used in the Table of Contents and any running heads, if they are in effect. This optional alternative heading goes in [square brackets] before the curly braces:
\section[Effect on staff turnover]{An analysis of the
effect of the revised recruitment policies on staff
turnover at divisional headquarters}
Ordinary Paragraphs
Sample LaTeX Documents
Based on Getting started with TeX, LaTeX, and friends.
Introductory LaTeX Document (small2e.tex)
If you have TeX installed and just want to get started, you can peruse and process this introductory LaTeX document (small2e). When you’ve mastered that, move on to this more complex example (sample2e).
The basic procedure is to create plain text files in any editor or GUI front end (TeXworks, TeXShop, GNU Emacs, etc.), and then run
pdflatex myfile.tex
from a command line to get PDF output. Or runlatex
to get DVI output, instead of PDF.
$ fetch https://mirror.ctan.org/macros/latex/base/small2e.tex
$ pdflatex small2e.tex
$ mupdf small2e.pdf
More Complex Introductory LaTeX Document (sample2e.tex)
$ fetch https://mirror.ctan.org/macros/latex/base/sample2e.tex
$ pdflatex sample2e.tex
$ mupdf sample2e.pdf
Template from AMS-LaTeX Primer
(aka Getting up and running with AMS-LaTeX)
From Getting up and running with AMS-LaTeX – Philip S. Hirschhorn
Abstract.
Together with the template file template.tex, these notes are an attempt to tell you enough about LaTeX and AMS-LaTeX so that you can get started without having to read the book.
You can download the template.tex from CTAN here: https://mirrors.ctan.org/info/amslatex/primer/template.tex
MWE (Minimal Working Example) of a LaTeX Document
From LaTeX for tabletop - a MWE (minimal working example) of a LaTeX document
STY files
It is quite useful to keep all of your custom formatting parameters and macros in a separate file.
You can download the .tex and .sty files for this example here:
example.tex
example.sty
Minimal LaTeX File
\documentclass{article}
\begin{document}
A Minimal LaTeX File.
\end{document}
Slightly More than Minimal LaTeX Input File
Based on The Not-So Short Guide to LaTeX2e - Or LaTeX2e in 139 minutes
$ cat small.tex
\documentclass[a4paper,11pt]{article}
% define the title
\author{P.~Dusko}
\title{Minimalism}
\begin{document}
% generates the title
\maketitle
% insert the table of contents
\tableofcontents
\section{Section with Some Interesting Words}
Well, and here begins my lovely article.
\section{Good Bye Section}
\ldots{} and here it ends.
\end{document}
NOTE: When you have a TOC (Table Of Contents) in your document, you need to invoke LaTeX two times so unless you are using latexmk(1)
Perl script, or LaTeX-Mk (make-based build system for LaTeX projects), or the make(1)
program, you need to run the pdflatex(1)
command (or thelatex
command, or the lualatex
command) two times in order to get a correct table of contents. [16] [17] [18]
$ pdflatex small.tex
$ pdflatex small.tex
$ mupdf small.pdf
An image showing a slightly more than minimal LaTeX file
One Page Document Template (One-Pager Boilerplate)
$ cat latexonepage.tex
\documentclass{article}
% Preamble - the area between \documentclass{...} and \begin{document}
\usepackage{lipsum}
\title{The quick brown fox jumps over the lazy dog}
\author{Name}
% Preamble - the area between \documentclass{...} and \begin{document}
% Document Body - the area between \begin{document} and \end{document}
\begin{document}
% Document title; Author's name; Date - From \title and \author
\maketitle
The lipsum command automatically generates the specified number of paragraphs of text that is commonly used for examples.
\section{Text for the first section}
\lipsum[1]
\subsection{Text for a subsection of the first section}
Text for a subsection of the first section.
\subsection{Another subsection of the first section}
Text for another subsection of the first section.
\section{The second section}
Text for the second section.
\subsection{Title of the first subsection of the second section}
Text for the second subsection.
\end{document}
% Document Body - the area between \begin{document} and \end{document}
$ pdflatex latexonepage.tex
If your run ends with a question mark, then you can type ‘x’ and press the ‘Enter’ key to get out.
$ zathura latexonepage.pdf
Note that numbering of the sections and subsections is done automatically.
Optional: All-in-One Preamble
All-in-one preamble that takes care of LuaLaTeX and XeLaTeX (based on The Not-So Short Guide to LaTeX2e (Version 6.4, Mar 9, 2021) - Figure 2.1: All-in-one preamble that takes care of LuaLaTeX and XeLaTeX, page 24):
\usepackage{iftex}
\ifXeTeX
\usepackage{fontspec}
\else
\usepackage{luatextra}
\fi
\defaultfontfeatures{Ligatures=TeX}
\usepackage{polyglossia}
You can download the latexonepage.tex
file with the all-in-one preamble here: latexonepage.tex
$ lualatex latexonepage.tex
$ zathura latexonepage.pdf
Mini FAQ for One Page Document Template
My Typical Minimal Document Template (Boilerplate)
Based on:
- Beginners’ LaTeX (now called the Formatting Information document) - CTAN,
- LaTeX cheat sheet - Winston Chang,
- Formatting Information - https://latex.silmaril.ie/formattinginformation.
$ cat latex-template.tex
\documentclass[12pt]{article}
% vv-- Preamble - the area between \documentclass{...} and \begin{document}
\usepackage{fontspec,url}
\usepackage{fullpage} % Use 1 inch margins
\setmainfont{XCharter}
\setcounter{secnumdepth}{0}
\pagenumbering{gobble} % Preventing pages from being numbered
% ^^-- Preamble - the area between \documentclass{...} and \begin{document}
% vv-- Document Body - the area between \begin{document} and \end{document}
\begin{document}
\section{My \LaTeX\ Template}
This is a short example of a \LaTeX\ document I wrote on \today.
It shows a few simple features of automated typesetting, including:
\begin{itemize}
\item setting the font size to 12pt for the `article' class;
\item using any font, not just the default;
\item using the special formatting for URIs (URLs or web addresses);
\item using the XCharter typeface;
\item preventing sections from being numbered;
\item preventing pages from being numbered;
\item formatting a section heading;
\item using the \textbf{ \LaTeX\ } logo;
\item generating today's date;
\item formatting this list of items;
\item formatting a subsection heading;
\item using opening and closing quotes;
\item boxing, centering, italicizing, and putting text into bold type.
\end{itemize}
\subsection{More information}
This example was taken from the book `Formatting
Information', which you can read online at
\url{http://latex.silmaril.ie/formattinginformation/}
and use as a teach-yourself guide.
\bigskip
A table:
\begin{table}[!th]
\begin{tabular}{|l|c|r|}
\hline
first & row & data \\
second & row & data \\
\hline
\end{tabular}
\caption{This is the caption}
\label{ex:table}
\end{table}
The table is numbered \ref{ex:table}.
\begin{center}
\fbox{\emph{Have a nice day!}}
\end{center}
\end{document}
% ^^-- Document Body - the area between \begin{document} and \end{document}
$ lualatex latex-template.tex
. . .
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
$ lualatex latex-template.tex
$ zathura latex-template.pdf
An image showing my typical minimal LaTeX template file
Tips and Tricks
Supressing Page Numbering
Use \pagenumbering{gobble}
in the preamble of your LaTeX document.
Unnumbered Headings
To get an unnumbered heading which does not go into the TOC (Table of Contents), follow the command name with an asterisk (*) before the opening curly brace.
\section*{Section Title}
Sample File with Some Interesting TeX and LaTeX Examples
You can download the sample file here:
tex-latex-extras.tex
tex-latex-extras.pdf
$ lualatex tex-latex-extras.tex
. . .
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
. . .
$ lualatex tex-latex-extras.tex
$ zathura tex-latex-extras.pdf
Customization
Commands \newcommand and \renewcommand
The \newcommand
and \renewcommand
commands enable you to define your own commands and change parameter values of existing commands.
Your Own Abbreviations and Commands
The command that gives us the ability to make our own has the following form:
\newcommand{\name}[n]{whatever }
, where n is the number of arguments, and whatever is whatever you want the command to do. Here are two examples simply to abbreviate commands with long names:
\newcommand{\ul}{\underline}
\newcommand{\mc}{\multicolumn}
The first lets us write
\ul{something}
to underline something. The second lets us write\mc{3}{c}{stuff}
to enter a multicolumn, in either a tabular or an array environment, spanning 3 columns and centered.The latex compiler will not let you use a name that is already being used. For example, if you specify
\newcommand{\fbox}
…, you will get a fatal error message since there is already a\fbox
command.A related use is when the command requires some lines of code. Consider the following example:
\newcommand{\Box}{\mbox{\begin{picture}(0,0) \put( 2,0){\framebox(7,7)} \end{picture} }}
(
\mbox
is used to ensure text mode). Now\Box
⇒ □ and, having defined the\Box
command, you can use it in other new commands.For example, if in the document preamble you specified:
\newcommand{\chkbox}{$\Box^\surd\;$}
Then, \chkbox ⇒ ☑. . .
The preamble can become very long as we add your commands so it is useful to put them in a separate file, say mydefs.tex (note the .tex suffix). Then, we use the
\input
command to have the latex compiler read it wherever it is placed. In particular, the preamble of this document contains the command:
\input{mydefs}
(The suffix .tex is assumed.) Different source files could simply input this same file so duplication of work is avoided.
Your Own Names, Titles and Numbers
Your Own Environments
Your Own Margins and Spacing
Your Own Output Control
Your Own Bibliography
Makefile
NOTE: The second line (pdflatex helloworld.tex
) starts with one ASCII tab, a.k.a. the TAB character.
From the man page for make(1):
Each of the lines in this script must be preceded by a tab.
$ cat makefile
helloworld.pdf: helloworld.tex
pdflatex helloworld.tex
$ make
Makefile Scripts with LaTeX-Mk
Author: Dan McMahill (dmcmahill)
LaTeX-Mk: Collection of makefile and scripts for LaTeX documents [19] [20]
$ sudo pkg install latex-mk
LaTeX-Mk homepage - SourceForge.net: https://latex-mk.sourceforge.net/
LaTeX-Mk project - GitHub: https://github.com/dmcmahill/latex-mk
Using latexmk to Generate PDF by pdflatex
Author: John Collins
From Using Latexmk - aka What is LaTeXmk?:
If you use cross-references, you often have to run LaTeX more than once, if you use BibTeX for your bibliography or if you want to have a glossary you even need to run external programs in-between.
To avoid all this hassle, you should simply use Latexmk!
Latexmk is a Perl script which you just have to run once and it does everything else for you … completely automagically.
And the nice thing is: you probably have it already installed on your computer, because it is part of MacTeX and MikTeX and it is bundled with many Linux Distributions.
In FreeBSD, latexmk is installed by package texlive-base.
$ latexmk -pdflatex helloworld.tex
$ mupdf helloworld.pdf
$ latexmk -C
Using latexmk with LuaLaTeX for Processing Files to PDF
$ latexmk -lualatex helloworld.tex
$ mupdf helloworld.pdf
$ latexmk -C
Latexmk homepage: https://www.cantab.net/users/johncollins/latexmk/index.html
Latexmk is also available at CTAN at https://ctan.org/pkg/latexmk/, and is/will be in the TeXLive and MiKTeX distributions.
Editors
Online Editors
NOTE 1: ShareLaTeX and Overleaf have been merged in to one Overleaf v2 and Overleaf v1 had retired on January 8th, 2019.
NOTE 2: It’s Open Source, so you can install it on your own server:
https://github.com/overleaf/overleafPapeeria - Online LaTeX editor – LaTeX and Markdown online Collaborative, free and reliable
LaTeXOnlineEditor (XO) – Your browser-based writing & formatting program to create PDFs
Editors - References
Fonts and Typefaces (Font Families) in Tex/LaTeX
LaTeX handles its fonts as combination of three parameters. These individual switches can be used inside a group, or as an environment:
{\ttfamily This is typewriter (monospaced) text}
\begin{mdseries}
This text is set in medium weight.
\end{mdseries}
Here are the categories and possible values.
family roman, sans serif, typewriter (monospaced) type: \rmfamily
, \sffamily
, \ttfamily
.
series medium and bold: \mdseries
, \bfseries
.
shape upright, italic, slanted, and small caps: \upshape
, \itshape
, \slshape
, \scshape
.
Basically:
- roman: Computer Modern Roman
- sans serif: Computer Modern Sans Serif
- typewriter (monospaced): Computer Modern Typewriter
Font Size
size tiny, scriptsize, footnotesize, small, normalsize, large, Large, LARGE, huge, HUGE: \tiny
, \scriptsize
, \footnotesize
, \small
, \normalsize
, \large
, \Large
, \LARGE
, \huge
, \HUGE
LaTeX2e Fonts
From LaTeX2e font selection. LaTeX Project Team, March 2024:
1.1 LaTeX2e fonts
The most important difference between LaTeX 2.09 and LaTeX2e is the way that fonts are selected. In LaTeX 2.09, the Computer Modern fonts were built into the LaTeX format, and so customizing LaTeX to use other fonts was a major effort.
In LaTeX2e, very few fonts are built into the format, and there are commands to load new text and math fonts. Packages such as times or latexsym allow authors to access these fonts. This document describes how to write similar font-loading packages.
The LaTeX2e font selection system was first released as the ‘New Font Selection Scheme’ (NFSS) in 1989, and then in release 2 in 1993. LaTeX2e includes NFSS release 2 as standard.
Changing the Default Document Fonts
a.k.a. Changing Fonts
Default font: the Computer Modern fonts (part of what makes TeX recognizable).
From Font typefaces - Overleaf (previously ShareLaTeX)
By default, LaTeX typesets documents using the Computer Modern typeface family but you can use LaTeX packages to use different fonts according to your needs or preferences.
When TeX starts up it has sixteen fonts available. A complete list of the sixteen fonts is given in Appendix F of The TeXbook (Donald E. Knuth, Addison-Wesley, Reading,Massachusetts, 1984, ISBN 0-201-13488-9 – Archived from original on Aug 11, 2023).
More details: A Gentle Introduction to Tex (A Manual for Self-study) by Michael Doob, Department of Mathematics, The University of Manitoba
There is a minimum set of alternative fonts that are available beside Computer Modern. The related collection of macro packages is often referred to as the “PSNFSS collection”. It supports the use of the popular typefaces Times, Helvetica, Palatino and Charter (and a few others), and it supports math fonts that suit Times and Palatino. The related documentation (Using common Postscript fonts with LaTeX - Walter Schmidt) is available in every LaTeX distribution as a PDF file named psnfss2e.pdf, usually in the directory doc/latex/psnfss (on FreeBSD: /usr/local/share/texmf-dist/doc/latex/psnfss/psnfss2e.pdf).
Most contemporary TeX distributions come with (almost) all free text and math fonts that are available from CTAN.
More details: Font selection in LaTeX: The most frequently asked questions An article to the PracTeX Journal by Walter Schmidt
Since 1993, the package PSNFSS (the ‘PostScript New Font Selecting System’) is included in LaTeX2e release 2 as standard. In this package, you choose from ‘Base 35’ fonts, thirty-five fonts that any Level 2 PostScript printer (and GhostScript) has.
There are various packages that change one or more of the font families, some part of the PSNFSS, some not, and there are some that are now obsolete.
Using Fonts that are Intrinsic in a Basic LaTeX Installation
For these fonts, you don’t need to add anything the preamble.
The following shows examples of how to use all of LaTeX intrinsic font styles.
This is \textbf{boldface}.
This is \textit{italic}.
This is \textrm{roman}.
This is \textsc{small caps}.
This is \textsf{sans serif}.
This is \textsl{slanted}.
This is \texttt{typewriter}.
More fonts are available in LaTeX packages. Also, you can install additional fonts manually or with your operating system’s package manager.
Changing Default Font to Fonts Included with TeX/LaTeX Distributions
For these fonts, you need to add a package name in the document preamble.
For example, by adding \usepackage{tgbonum} to the document preamble, LaTeX will use the TEX Gyre Bonum font family to typeset your document:
For example, if you want to use the Palatino font, by adding the following in the preamble, LaTeX will use the Palatino font family to typeset your LaTeX document.
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{palatino}
Changing Default Font to One Installed by OS Package Manager
For example, you want to install Atkinson Hyperlegible font and use it in your LaTeX document.
To install it on FreeBSD with its package manager:
$ sudo pkg install atkinson-hyperlegible
$ fc-list | grep -i Atkinson | wc -l
8
$ fc-list | grep -i Atkinson
/usr/local/share/fonts/atkinson-hyperlegible/Atkinson-Hyperlegible-Bold-102.otf: Atkinson Hyperlegible:style=Bold
. . .
$ otfinfo --info /usr/local/share/fonts/atkinson-hyperlegible/Atkinson-Hyperlegible-Bold-102.otf
Family: Atkinson Hyperlegible
Subfamily: Bold
Full name: AtkinsonHyperlegible-Bold
PostScript name: AtkinsonHyperlegible-Bold
. . .
Description: Atkinson Hyperlegible is a neo-grotesque typeface created by Applied Design Works for Braille Institute of America, Inc. It has been developed specifically to increase legibility for readers with low vision, and to improve character recognition.
Designer: Elliott Scott, Megan Eiswerth, Linus Boman, Theodore Petrosky
Designer URL: http://helloapplied.com
. . .
Vendor URL: https://www.BrailleInstitute.org/
. . .
$ fc-match "Atkinson Hyperlegible"
Atkinson-Hyperlegible-Regular-102.otf: "Atkinson Hyperlegible" "Regular"
$ fc-match AtkinsonHyperlegible
Atkinson-Hyperlegible-Regular-102.otf: "Atkinson Hyperlegible" "Regular"
$ luaotfload-tool --update
Add the following in the preamble of your LaTeX document:
\usepackage{fontspec}
\setmainfont{Atkinson Hyperlegible}
Changing Fonts for a Specific Element in the Document
Based on Font typefaces - Overleaf (previously ShareLaTeX):
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tgbonum}
\begin{document}
This document is a sample document to
test font families and font typefaces.
{\fontfamily{qcr}\selectfont
This text uses a different font typeface
}
\end{document}
The command
\fontfamily{qcr}\selectfont
will set the TeX gyre cursor font typeface, whose fontcode isqcr
, for the text inside the braces. A lot more LaTeX font typefaces are available, see the reference guide.
The popular LaTeX font typefaces are originated from four families:
- Computer Modern (default in standard LaTeX classes): CM Roman, CM Sans Serif, CM Typewriter (monospaced)
- Latin Modern: LM Roman, LM Sans Serif, LM Typewriter, LM Dunhill
- Post Script Fonts: Times, Utopia/Fourier, Palatino, Bookman, Helvetica, Courier
- TeX Gyre
The command \fontfamily{qcr}\selectfont
will set the TeX gyre cursor font typeface, whose fontcode is qcr, for the text inside the braces. A lot more LaTeX font typefaces are available, see the reference guide. This reference guide lists Roman, Sans Serif and Typewriter (monospaced) typefaces in a table containing four columns: Font, Font Package Name, Fontcode (Font Code), Example.
Commands/Environments for Text Font Appearance
textbf textit textrm textsc textsf texttt
tiny scriptsize footnotesize small normalsize large
Large LARGE huge Huge underline verb verbatim
Commands to Control Fonts in Math Mode
left boldmath (set in text mode)
cal displaystyle mathbf mathcal
mathit mathnormal mathrm mathsf
mathtt mbox overbrace overline
right textstyle underbrace underline
Font and Typefaces - References
Fonts and TeX - TUG (TeX User Group)
My favourite fonts to use with LaTeX (part 1)
The LaTeX Font Catalogue - TUG
Comprehensive LATEX Symbols List, Scott Pakin
The Comprehensive LaTeX Symbol List - Symbols accessible from LaTeX - CTAN
Font typefaces - Overleaf (previously ShareLaTeX)
Palatino and Source Sans Pro, the only fonts a scientist needs
NOTE: If you want to use the Palatino font, you also need to use the following two packages: fontenc (with option T1) and textcomp in the preamble of your LaTeX document.
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{palatino}
References:
- Using common PostScript fonts with LaTeX - PSNFSS - Walter Schmidt:
1 What is PSNFSS?
The PSNFSS collection includes a set of files that provide a complete working setup of the LaTeX font selection scheme (NFSS2) for use with common PostScript fonts. It covers the so-called ‘Base 35’ fonts (which are built into any Level 2 PostScript printing device and the Ghostscript interpreter) and a number of free fonts.
. . .
3 Special considerations
3.1 Output font encoding
None of the packages listed in table 1 changes the output font encoding from its default setting OT1. It is, however, highly recommended to use the fonts with the extended T1 and TS1 (text symbols) encodings by means of the commands:
\usepackage[T1]{fontenc} \usepackage{textcomp}
Also See:
- The TeX Gyre (TG) Collection of Fonts - GUST (Grupa Użytkowników Systemu TeX ) Web Presence
Pagella
The package (download) contains the most recent version of the TeX Gyre Pagella family of fonts in the PostScript Type 1 and OpenType formats. TeX Gyre Pagella is based on the URW Palladio L kindly released by URW++ Design and Development Inc. under GFL (independently of the GPL release accompanying Ghostscript). The Vietnamese glyphs were added by Han The Thanh.
TeX Gyre Pagella can be used as a replacement for the renowned Palatino font (designed by Hermann Zapf in the 1940’s for the Stempel type foundry; an interesting lifestory of Hermann Zapf can be found at: http://www.linotype.com/1494/theschoolyears.html – Archived from the original May 12, 2007
(Please note that with the release of this family the QuasiPalatino fonts became obsolete.)
Using fonts installed in local texlive (including Palatino) - TeX - LaTeX Stack Exchange
- Introduction to variable fonts on the web
The terms font and typeface are often used interchangeably by developers. However, there is a difference: A typeface is the underlying visual design that can exist in many different typesetting technologies, and a font is one of these implementations, in a digital file format. In other words, a typeface is what you see, and the font is what you use.
Another concept that is often overlooked is the distinction between a style, and a family. A style is a single and specific typeface, such as Bold Italic, and a family is the complete set of styles.
My Choice of Engine: LuaTeX (LuaLaTeX)
Reason: Because of Unicode support.
NOTE: As LuaLaTeX allocates as much memory as it happens to need, it can be slow.
From TeX - Wikipedia:
… LuaTeX, a Unicode-aware extension to TeX that includes a Lua runtime with extensive hooks into the underlying TeX routines and algorithms.
From LuaTeX - Wikipedia:
When LuaTeX is used with the LaTeX format, it is sometimes called “LuaLaTeX”.
On FreeBSD, the lualatex
command is installed with package tex-luatex. Similarly, the documentation for LuaLaTeX is also installed with package tex-luatex in directory: /usr/local/share/texmf-dist/doc/lualatex/lualatex-doc/. This directory contains a file lualatex-doc.pdf, which is titled A guide to LuaLaTeX.
From A guide to LuaLaTeX, Manuel Pégourié-Gonnard (mpg@elzevir.fr), May 5, 2013 – 1.1 Just what is LuaLaTeX?:
LuaLaTeX is the LuaTeX engine with the LaTeX format. Well, this answer isn’t very satisfying if you don’t know what LuaTeX and LaTeX are.
As you probably know, LaTeX is the general framework in which documents begin with
\documentclass
, packages are loaded with\usepackage
, fonts are selected in a clever way (so that you can switch to boldface while preserving italics), pages are build with complicated algorithms including support for headers, footers, footnotes, margin notes, floating material, etc. This mostly doesn’t change with LuaLaTeX, but new and more powerful packages are available to make parts of the system work in a better way.So, what’s LuaTeX? Short version: the hottest TeX engine right now! Long version: It is the designated successor of pdfTeX and includes all of its core features: direct generation of PDF files with support for advanced PDF features and micro-typographic enhancements to TeX typographic algorithms.
Repositories
CTAN - The Comprehensive TeX Archive Network
Drawing in TeX and LaTeX
Using TikZ to Prepare Illustrations, by Jennifer Brown. This is a series of tutorials to show how to use TikZ to create professional-quality mathematical diagrams, graphs, and illustrations
KtikZ - a nice user interface for making pictures using TikZ
KtikZ Editor - Archived from the original on Sep 25 2023
KtikZ is a small application helping you to create TikZ (from the LaTeX pgf package) diagrams for your publications. It requires qt4, libpoppler, LaTeX (pdflatex), the LaTeX preview-latex-style package and pgf itself. For the eps export functionality you also need the poppler-utils package. If you’d like to improve this little tool just clone it from https://github.com/fhackenberger/ktikz and send a pull request.
Asymptote - The Vector Graphics Language
Inkscape - Vector graphics editor
Tutorials
Andrew Roberts has a few well written tutorials on his website.
LaTeX tutorials - a primer by the Indian TeX User Group (The TUGIndia).
Creating a LaTeX Minimal (Minimum) Example - aka Minimal Working Example (MWE): PDF, HTML
Getting up and running with AMS-LaTeX – Philip S. Hirschhorn
User’s Guide for the amsmath Package - (AMS) American Mathematical Society, LaTeX Project
Tools
LaTeX.js.org - JavaScript LaTeX to HTML5 Translator
The source of LaTeX.js on GitHub
LaTeX.js Showcase
made with ♥ by Michael Brade
This document will show most of the features of LaTeX.js while at the same time being a gentle introduction to LaTeX. In the appendix, the API as well as the format of custom macro definitions in JavaScript will be explained.
TeXtidote - Spelling, grammar and style checking on LaTeX documents
TexText – Re-editable LaTeX and typst graphics for Inkscape
JabRef – Open-source, cross-platform citation and reference management software
TeX/LaTeX Resources
Getting started with LaTeX - a collection of resources - texblog
TeX Resources on the Web - TeX Users Group (TUG)
What are other good resources on-line for information about TeX, LaTeX and friends?
Footnotes
[1] What is pdfTeX? - The TeX FAQ - The TeX Frequently Asked Question List
One can reasonably say that pdfTeX is (today) the main stream of TeX distributions: most LaTeX nowadays use pdfTeX whether they know it or not.
pdfTeX is a development of TeX that is capable of generating typeset PDF output in place of DVI. pdfTeX has other capabilities, most notably in the area of fine typographic detail (for example, its support for optimising line breaks), but its greatest impact to date has been in the area of PDF output.
[2] From pdfTeX - TUG (TeX Users Group)
pdfTeX is an extension of TeX which can produce PDF directly from TeX source, as well as original DVI files. pdfTeX incorporates the e-TeX extensions.
pdfTeX also has a variety of other extensions, perhaps most notably for microtypography line breaking features. The microtype package provides a convenient interface for LaTeX.
pdfTeX is released as part of TeX Live, and also included in all TeX distributions, notably MiKTeX. Current release: NEWS, manual, sources.
[3] From The TeX showcase:
This is the TeX showcase, edited by Gerben Wierda. It contains extreme examples of what you can do with TeX, the typesetting engine from Donald Knuth, world famous mathematician, computer scientist and above all well known for TeX.
[4] From Getting started with TeX, LaTeX, and friends - TUG (TeX Users Group):
TeX is a typesetting language. Instead of visually formatting your text, you enter your manuscript text intertwined with TeX commands in a plain text file. You then run TeX to produce formatted output, such as a PDF file. Thus, in contrast to standard word processors, your document is a separate file that does not pretend to be a representation of the final typeset output, and so can be easily edited and manipulated.
[5] LaTeX (Guide to LaTeX) - Wikibooks
TeX is a typesetting computer program created by Donald Knuth, originally for his magnum opus, The Art of Computer Programming. It takes a “plain” text file and converts it into a high-quality document for printing or on-screen viewing. LaTeX is a macro system built on top of TeX that aims to simplify its use and automate many common formatting tasks. It is the de-facto standard for academic journals and books in several fields, such as mathematics and physics, and provides some of the best typography free software has to offer.
[7] What is LaTeX? - The TeX FAQ - The TeX Frequently Asked Question List
LaTeX is a TeX macro package, originally written by Leslie Lamport, that provides a document processing system. LaTeX allows markup to describe the structure of a document, so that the user need not think about presentation. By using document classes and add-on packages, the same document can be produced in a variety of different layouts.
Lamport says that LaTeX “represents a balance between functionality and ease of use”. This shows itself as a continual conflict that leads to the need for such things as FAQs: LaTeX can meet most user requirements, but finding out how is often tricky.
[8] From What are TeX and its friends? - CTAN (The Comprehensive TeX Archive Network)
An important boost to that popularity came in 1985 with the introduction of LaTeX by Leslie Lamport. This is a set of commands that allows authors to interact with the system at a higher level than Knuth’s original command set (called Plain TeX).
[9] From LaTeX - Wikibooks:
LaTeX is a macro system built on top of TeX that aims to simplify its use and automate many common formatting tasks.
[10] From The Not-So Short Guide to LaTeX2e, The document itself (A4 paper format) in PDF
1.1.2 LaTeX
LaTeX enables authors to typeset and print their work at the highest typographical quality, using a predefined, professional layout. LATEX was originally written by Leslie Lamport. It uses the TeX formatter as its typesetting engine. These days LaTeX is maintained by the LaTeX Project. LaTeX is pronounced “Lay-tech” or “Lah-tech.” If you refer to LaTeX in an ASCII environment, you type LaTeX. LaTeX 2ε is pronounced “Lay-tech two e” and typed LaTeX2e.
[11] From LaTeX vs. MiKTeX: The levels of TeX - TUG (TeX User Group):
- Distributions: MiKTeX, TeX Live, W32TeX, … These are the large, coherent collections of TeX-related software to be downloaded and installed. When someone says “I need to install TeX on my machine”, they’re usually looking for a distribution.
- Front ends and editors: Emacs, vim, TeXworks, TeXShop, TeXnicCenter, WinEdt, … These editors are what you use to create a document file. Some (e.g., TeXShop) are devoted specifically to TeX, others (e.g., Emacs) can be used to edit any sort of file. TeX documents are independent of any particular editor; the TeX typesetting program itself does not include an editor.
- Engines: TeX, pdfTeX, XeTeX, LuaTeX, … These are the executable binaries which implement different TeX variants. In short:
pdfTeX implements direct PDF output, along with a variety of programming and other extensions. XeTeX does the above, and also supports Unicode natively, OpenType and TrueType fonts, access to system fonts, … LuaTeX does all the above, and provides access to many internals via the embedded Lua language. Thus it is by far the most programmable engine. [e][u]pTeX provide full support for Japanese typesetting. There are other engines, but the above are by far the most commonly used nowadays.
- Formats: LaTeX, plain TeX, OpTeX, … These are the TeX-based languages in which one actually writes documents. When someone says “TeX is giving me a mysterious error”, they usually mean a format.
- Packages: geometry, lm, … These are add-ons to the basic TeX system, developed independently, providing additional typesetting features, fonts, documentation, etc. A package might or might not work with any given format and/or engine; for example, many are designed specifically for LaTeX, but there are plenty of others, too. The CTAN sites provide access to the vast majority of packages in the TeX world; CTAN is generally the source used by the distributions.
[12] Here are the steps explaining how I created the image showing the structure of a LaTeX document.
You can download the source LaTeX file for this image here: latex-doc-structure.tex
Then, run the following commands.
$ latex latex-doc-structure.tex
$ dvipng latex-doc-structure.dvi
$ ls | tail -1
latex-doc-structure1.png
$ mv latex-doc-structure1.png latex-doc-structure.png
$ dvips latex-doc-structure.dvi
$ gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -f latex-doc-structure.ps
%%BoundingBox: 110 506 487 705
%%HiResBoundingBox: 110.861997 506.825985 486.881985 704.249979
$ gs \
-q \
-sDEVICE=pdfwrite \
-o latex-doc-structure.pdf \
-c "[/CropBox [110 506 487 705] /PAGES pdfmark" \
-f latex-doc-structure.ps
$ zathura latex-doc-structure.pdf
[13] Reference: Learn LaTeX.org - Lesson 3 – LaTeX document structure - What you’ve got
[14] Reference: Five minute guide to LaTeX (PDF) - How To LaTeX (howtolatex.com) – Archived from the original on May 5, 2016
1.1.2 Environments
Environments contain special content, such as math, figures, tables, etc. Environments start with
\begin{}
and end with\end{}
, where the environment name is between {}.The
document
environment is most important: all content within this environment will be printed.
[15] Reference: Formatting information - A beginner’s introduction to typesetting with LaTeX
This \begin … \end pair of commands is an example of a common LaTeX structure called an environment. Environments enclose text which is to be handled in a particular way. All environments start with
\begin{...}
and end with\end{...}
(putting the name of the environment in the curly braces).
[16] The TOC (Table Of Contents) is an example of a cross-reference. (Cross-references are references to anything that is numbered; for example, sections, figures, formulas, tables, and special segments of text.)
Since they are not updated on the first LaTeX invocation, when you use cross-references in your document, you need to run LaTeX two times to get a correct table of contents. Sometimes it might be necessary to compile the document a third time. LaTeX will tell you when this is necessary but pdflatex will not tell you that.
LaTeX creates a table of contents by taking the section headings and page numbers from the last compile cycle of the document.
To avoid running LaTeX multiple times, you can use tools like make
or latexmk
or LaTeX-Mk. (Refer to use of these three tools in sections about them in this document.)
From LaTeX Basics - Wikibooks - 4.2 Ancillary files
The TeX compilers are single-pass processes. It means that there is no way for a compiler to jump around the document, which would be useful for the table of contents and references. Indeed the compiler cannot guess at which page a specific section is going to be printed, so when the table of contents is printed before the upcoming sections, it cannot set the page numbers.
To circumvent this issue, many LaTeX commands which need to jump, use ancillary files which usually have the same file name as the current document but a different extension. It stores temporary data into these files and use them for the next compilation. So to have an up-to-date table of contents, you need to compile the document twice. There is no need to re-compile if no section moved.
[17] From the man page for latexmk(1)
(on FreeBSD 14: /usr/local/share/texmf-dist/doc/support/latexmk):
A very annoying complication handled very reliably by latexmk, is that LaTeX is a multiple pass system. On each run, LaTeX reads in information generated on a previous run, for things like cross referencing and indexing. In the simplest cases, a second run of LaTeX suffices, and often the log file contains a message about the need for another pass. However, there is a wide variety of add-on macro packages to LaTeX, with a variety of behaviors. The result is to break simple-minded determinations of how many runs are needed and of which programs. Latexmk has a highly general and efficient solution to these issues. The solution involves retaining between runs information on the source files, and a symptom is that latexmk generates an extra file (with extension .fdb_latexmk, by default) that contains the source file information.
. . .
When latexmk is run, it examines properties of the source files, and if any have been changed since the last document generation, latexmk will run the various LaTeX processing programs as necessary. In particular, it will repeat the run of latex (or a related program) often enough to resolve all cross references; depending on the macro packages used. With some macro packages and document classes, four, or even more, runs may be needed. If necessary, latexmk will also run bibtex, biber, and/or makeindex. In addition, latexmk can be configured to generate other necessary files. For example, from an updated figure file it can automatically generate a file in encapsulated postscript or another suitable format for reading by LaTeX.
In order to produce a TeX document, you’ll need to run the TeX program and several related programs as well. You’ll also need supporting files for TeX and possibly for these other programs. In this book we can tell you about TeX but we can’t tell you about the other programs and the supporting files except in very general terms because they depend on your local TeX environment. The people who provide you with TeX should be able to supply you with what we call local information. The local information tells you how to start up TeX, how to use the related programs, and how to gain access to the supporting files.
[19] From LaTeX-Mk homepage:
LaTeX-Mk is a complete system for simplifying the management of small to large sized LaTeX documents. LaTeX-Mk uses the standard make program for doing most of the work. Users simply create a makefile which many times is as simple as one line that specifies the document name and a single include line that loads all of the LaTeX-Mk rules. LaTeX-Mk has been used for many years on projects ranging in scale from a single page business letter to a published book.
[20] From the latex-mk package description on FreeBSD 14 ($ pkg rquery '%e' latex-mk
):
LaTeX-Mk is a tool for managing small to large sized LaTeX projects. The typical LaTeX-Mk input file is simply a series of variable definitions in a Makefile for the project. After creating a simple Makefile the user can easily perform all required steps to do such tasks as: preview the document, print the document, or produce a PDF file. LaTeX-Mk will keep track of files that have changed and how to run the various programs that are needed to produce the output.
Texdoc - Tool to Find and View Documents in TeX Live
For short help, in your OS enter the following command.
$ texdoc --help
For full manual
$ texdoc texdoc
In FreeBSD, your PDF viewer opens this file: /usr/local/share/texmf-dist/doc/support/texdoc/texdoc.pdf
.
$ ls /usr/local/share/texmf-dist/doc/support/texdoc/
COPYING README.md texdoc.pdf
NEWS texdoc-doc.cls texdoc.tex
Excerpts from /usr/local/share/texmf-dist/doc/support/texdoc/README.md
:
Texdoc - Find and view documentation in TeX Live
General Information
- Website: https://www.tug.org/texdoc/
- Repository: https://github.com/TeX-Live/texdoc/
- Mailing list: texdoc@tug.org
Using Texdoc
Texdoc is part of the TeX Live distribution. Generally, you don’t have to install it yourself.
. . .
Here, $TEXDOC
means the path to the texdoc dev sources you cloned (or downloaded), and $TEXMFHOME
denotes your personal TEXMF tree (you can get its location with kpsewhich --var-value TEXMFHOME
).
- The command. Symlink or copy
$TEXDOC/script
as$TEXMFHOME/scripts/texdoc
. - The configuration file. Symlink or copy
$TEXDOC/texdoc.cnf
as$TEXMFHOME/texdoc/texdoc-dist.cnf
(notice the-dist
part). It will completely override the other configuration files except$TEXMFHOME/texdoc/texdoc.cnf
which you can still use for you personal settings.
You can make sure that the right files are used by running texdoc --files
: the first line contains the full path to the version of used texdoclib.tlu
, and the rest lists the configuration files in use.
Files in This Repository
doc/
contains the documentation,script/
contains the source code,spec/
is a directory for testing scripts, andtexdoc.cnf
is the default configuration file.
. . .
Further Information
More specific information, such as the TODO list of this project and some information for distributors, can be found in the Wiki of our GitHub repository. Please visit: https://github.com/TeX-Live/texdoc/wiki
Most Frequently Referred Documents for this Page
A Simplified Introduction to LaTeX - Harvey J. Greenberg and Dan Luecking
LaTeX Cookbook (A Modern LaTeX Cookbook)
Documents Collection
TeX-nutshell - A short document about TeX principles – https://ctan.org/pkg/tex-nutshell
TeX-nutshell - A short document about TeX principles - The Document Itself
A Simplified Introduction to LaTeX - https://ctan.org/pkg/simplified-latex
A Simplified Introduction to LaTeX - The Document Itself
http://csweb.ucc.ie/~dongen/LAF/Basics.pdf
http://csweb.ucc.ie/~dongen/LAF/Commands.pdf
https://ctan.org/pkg/impatient
http://mirrors.ctan.org/info/impatient/book.pdf
gentle - A Gentle Introduction to Tex (A Manual for Self-study) by Michael Doob, Department of Mathematics, The University of Manitoba
gentle – A Gentle Introduction to TeX - The Document Itself
http://latex.silmaril.ie/veryshortguide/
http://latex.silmaril.ie/veryshortguide/veryshortguide.pdf
http://mirrors.ctan.org/info/latex-veryshortguide/veryshortguide.pdf
http://mirrors.ctan.org/info/latex-veryshortguide/veryshortguide-A4-imposed.pdf
https://ctan.org/pkg/fntguide
https://tug.org/TUGboat/Articles/tb14-2/tb39rahtz-nfss.pdf
https://tug.org/pracjourn/2006-1/schmidt/schmidt.pdf
https://ctan.org/pkg/latex-essential
http://mirrors.ctan.org/info/latex-essential/ess2e.pdf
https://ctan.org/pkg/fontsmpl
http://mirrors.ctan.org/macros/latex/required/tools/fontsmpl.pdf
https://www.ctan.org/tex-archive/info/fontsampler/
https://mirrors.ctan.org/info/fontsampler/sampler.pdf
References
(Retrieved on Jun 1, 2024)
TeX - Wikipedia - How it is run - A sample Hello world program in plain TeX
GitHub – leachim6/hello-world: Hello world in every computer language
- Arbitrary LaTeX reference
Many problems in LaTeX require some research so I started to record my findings. Some of this is overly simplified, never investigated past my own needs, some things are unverified, some quite possible wrong. Lately I haven’t needed TeX much so I don’t work on this page much - feel free to mail me any suggestions, corrections, and such. Please wait until the page is loaded; expansion will not work before it is. You can expand all sections when you want to search or print.
LaTeX Resources - HowToTeX.com – Archived from original on Apr 4, 2016
- Text Processing using LaTeX - CUED (University of Cambridge, Department of Engineering) - Computing Help - LaTeX
TeX (‘Introduction to TeX - a.k.a. Plain TeX’) (Archived from the original on Oct 22, 2015) is a powerful text processing language and is the required format for some periodicals now. TeX has many macros to which you can eventually add your own. LaTeX is a macro package which sits on top of TeX and provides all the structuring facilities to help with writing large documents. Automated chapter and section macros are provided, together with cross referencing and bibliography macros. LaTeX tends to take over the style decisions, but all the benefits of plain TeX are still present when it comes to doing maths. The Why LaTeX? page discusses LaTeX’s strengths/weaknesses.
Introduction to TeX (Plain TeX) – Archived from the original on Oct 22, 2015)
What are TeX and its friends? - CTAN (The Comprehensive TeX Archive Network)
- What is LaTeX and why do linguists love it?
I’ve made a sample document with a few demos of things that linguists do in LaTeX, which you can download here as .tex (input) and> here as .pdf (output).
NOTE: If you want to avoid Dropbox prompting you to register or login before downloading them, you can also download the .tex and the .pdf files here: LinguistLaTeXdemo.tex and LinguistLaTeXdemo.pdf
. . .
Why do linguists use LaTeX?
You may have noticed that it’s easier to take notes about linguistics by hand than it is on a computer, because there are so many symbols and diagrams that are used in linguistics that are really difficult to make in a word processor.
But because LaTeX is free, open-source, and highly customizable, many wonderful people have written packages for anyone to use that let you type linguistics symbols (IPA and semantics), draw trees, and make automatically formatted and numbered example sentences. (See a sample document here.)
The First LaTeX Document – first-latex-doc – A document for absolute LaTeX beginners
first-latex-doc.pdf – The PDF file of example first document with embedded explanation
A Typical LaTeX Input File - From Getting Started with LaTeX, 2nd Edition, 1995 - David R. Wilkins
LaTeX for tabletop - a MWE (minimal working example) of a LaTeX document
What is pdfTeX? - The TeX FAQ - The TeX Frequently Asked Question List
Things with “TeX” in the name - The TeX FAQ - Frequently Asked Question List for TeX
- LaTeX Cookbook (A Modern LaTeX Cookbok)
Download PDF: https://github.com/alexpovel/latex-cookbook/releases/latest/download/cookbook.pdf
This repo contains a LaTeX document, usable as a cookbook (different “recipes” to achieve various things in LaTeX) as well as as a template. The resulting PDF covers LaTeX-specific topics and instructions on compiling the LaTeX source.
A comprehensive LaTeX template with examples for theses, books and more, employing the ‘latest and greatest’ (UTF8, glossaries, fonts, …). The PDF artifact is built using CI/CD, with a Python testing framework.
There is a by former coworkers of the author, at the research institute this template originated from as well. Active development is still happening there:
LaTeX Intro Workshop - Introduction to LaTeX for writing papers in LaTeX
Manual page for style.Makefile(5) - FreeBSD Makefile file style guide - FreeBSD Manual Pages
Manual page for make(1) - Maintain program dependencies - FreeBSD Manual Pages
List of all LaTeX packages - All styles files available on CTAN
TikZ and PGF - TeXample.net – TikZ and PGF Examples – TikZ Galleries
Learn LaTeX - Learn LaTeX online for free in beginner friendly lessons
latex-refsheet - LaTeX Reference Sheet for a thesis with KOMA-Script
TeX for the Impatient - a book (of around 350 pages) on TeX, Plain TeX and Eplain – CTAN
TeX by Topic, A TeXnician’s Reference - Victor Eijkhout - Document Revision 1.5, 2019
- Why does LaTeX make a distinction between commands and environments?
Travels in TeX Land: LaTeX for Productivity in Book Writing (The PracTeX Journal, 2006)
Travels in TeX Land: Final Layout of a Book (The PracTeX Journal, 2006)