Skip to content

Commit

Permalink
Merge branch 'minted'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpovel committed Feb 3, 2021
2 parents daacac3 + 7c88e5f commit 19fbd87
Show file tree
Hide file tree
Showing 7 changed files with 433 additions and 3,841 deletions.
2 changes: 1 addition & 1 deletion .latexmkrc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ $biber = "biber --validate-datamodel %O %S";
# Let latexmk know about generated files, so they can be used to detect if a
# rerun is required, or be deleted in a cleanup.
# loe: List of Examples (KOMAScript)
# lol: List of Listings (listings package)
# lol: List of Listings (`listings` and `minted` packages)
# run.xml: biber runs
# glg: glossaries log
# glstex: generated from glossaries-extra
Expand Down
9 changes: 1 addition & 8 deletions chapters/frontmatter.tex
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
% Helper file that pulls subchapters together.

% In conjunction, packages polyglossia and cleveref do some serious witchcraft.
% If we call these \crefname redefinitions in the preamble, it does not work.
% Also does not work with \AtBeginDocument. Tried with both a macro inside the
% redefinition, and just plain text.
\crefname{listing}{\lstlistingname}{\lstlistingname s}
\Crefname{listing}{\lstlistingname}{\lstlistingname s}

% Set initial pages to alpha, so that they do not collide with later Arabic numbering
% in the generated PDF. This won't show in print because page numbers aren't displayed
% until later. But you will be able to print the title page by printing page 'a', which
Expand Down Expand Up @@ -123,6 +116,6 @@

\listofexamples%

\lstlistoflistings%
\listoflistings%

\subimport{frontmatter/}{preface}
15 changes: 6 additions & 9 deletions chapters/frontmatter/preface.tex
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,12 @@ \section*{Beginning Prerequisites}
\item of course, a source text file, ending in \texttt{.tex}.
A minimal example is:

\begin{lstlisting}[
style=betweenpar,
language={[LaTeX]TeX},
]
\documentclass{scrartcl}
\begin{document}
Hello World!
\end{document}
\end{lstlisting}
\begin{minted}[linenos=false]{latex}
\documentclass{scrartcl}
\begin{document}
Hello World!
\end{document}
\end{minted}
Note the usage of \texttt{scrartcl} over the standard \texttt{article}.
This is a \ctanpackage{koma-script} document class.
There are only \href{https://tex.stackexchange.com/a/73146/120853}{two reasons}
Expand Down
36 changes: 12 additions & 24 deletions chapters/mainmatter/base-features.tex
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,11 @@ \section{Fonts and Text}

\paragraph{Old approach}
The overwhelming majority of \LaTeX{} documents rely on the two lines
\begin{lstlisting}[
style=betweenpar,
language={[LaTeX]TeX}
]
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\end{lstlisting}
This approach is \enquote{outdated} and only required when using \hologo{pdfLaTeX}.
\begin{minted}[linenos=false]{latex}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\end{minted}
This approach is \textbf{outdated} and only required when using \hologo{pdfLaTeX}.
Since this is what most people still do, the two packages are still required.
However, these two packages should at least not be used for \emph{new} work anymore!
Using \hologo{LuaLaTeX}, they are not required anymore:
Expand Down Expand Up @@ -475,12 +472,9 @@ \subsubsection{Physical Units}

Physical units are output using \verb|\si|.
It also has parsing capabilities:
\begin{lstlisting}[
language={[LaTeX]TeX},
style=betweenpar,
]
\si{\meter\cubed\kelvin\per\kilogram\squared\per\giga\watt\per\degreeCelsius}
\end{lstlisting}
\begin{minted}[linenos=false]{latex}
\si{\meter\cubed\kelvin\per\kilogram\squared\per\giga\watt\per\degreeCelsius}
\end{minted}
will print
\si{\meter\cubed\kelvin\per\kilogram\squared\per\giga\watt\per\degreeCelsius}.
The mode in which units with negative exponents are displayed can be changed,
Expand Down Expand Up @@ -1194,32 +1188,26 @@ \subsection{bib2gls}
The sorting and filtering capabilities are very strong, and of course also Unicode
compatible.
A minimal \texttt{bib} file for acronyms can be as simple as:
\begin{lstlisting}[
style=betweenpar,
language={[LaTeX]TeX}
]
\begin{minted}[linenos=false]{bib}
@abbreviation{cont_int,
short={CI},
long={Continuous Integration},
}
\end{lstlisting}
\end{minted}
For concrete examples, see the files for this document at \texttt{bib/glossaries/}.
There can be as many keys as required, with custom ones being easily created.
Effectively, this is analogous to how bibliography entries are created.
Thus, users of \LaTeX{} who are already familiar with that concept and format
should have an easy time getting started with \ctanpackage{glossaries-extra}.
Using it for mathematical symbols can look like:
\begin{lstlisting}[
style=betweenpar,
language={[LaTeX]TeX}
]
\begin{minted}[linenos=false]{bib}
@symbol{abs_temperature,
name={\ensuremath{T}},
description={absolute temperature},
group={roman},
unit={\si{\kelvin}},
}
\end{lstlisting}
\end{minted}

\begin{landscape}
\section{Landscape}
Expand Down
Loading

0 comments on commit 19fbd87

Please sign in to comment.