document mathalias package

This commit is contained in:
Maximilian Keßler 2022-01-30 17:04:59 +01:00
parent 91db761097
commit aef9318118
3 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,4 @@
$makeindex = "makeindex -s gind.ist %O -o %D %S";
$clean_ext .= ' glo';
$clean_ext .= ' hd';
$clean_ext .= ' ins';

View File

@ -0,0 +1,8 @@
doc:
latexmk
full:
latexmk -gg
clean:
latexmk -C

View File

@ -0,0 +1,102 @@
\documentclass[full]{l3doc}
\title{The \pkg{mkessler-mathalias} package}
\author{Maximilian Keßler}
\usepackage{mkessler-mathalias}
\begin{document}
\maketitle
\begin{abstract}
Lazy people prefer to write stuff like \cs{Z}, \cs{Q} to get the integers
$\mathbb{Z}$ and rationals $\mathbb{Q}$.
They also often use shortcuts like \cs{bA} for \cs{mathbb}\{A\} to get $\mathbb{A}$.
While the author does not encourage such usage,
this package provide a general syntax to generate such aliases.
\end{abstract}
\begin{documentation}
\section{(Don't) be lazy}
You actually should \emph{not} use this package.
This is poor \LaTeX style.
In case you don't care, or you must, because your co-workers do so,
this package is for you.
The author personally uses
\href{https://www.vim.org/}{Vim}
and the
\href{https://github.com/sirver/UltiSnips}{UltiSnips}
plugin to facilitate \LaTeX writing whilst producing a clean document
without those poor shortcut styles.
So in fact, \emph{be} lazy, but do it the proper way.
If you are, however, lazy, then put
\begin{verbatim}
\usepackage[extended]{mkessler-mathalias}
\end{verbatim}
in your preamble.
\section{Aliases}
\begin{function}{\MakeAliasesForWith}
\begin{syntax}
\cs{MakeAliasesForwith}\marg{macro}\marg{shortcut}\marg{token list}
\end{syntax}
For each \meta{token} in the \meta{token list},
this declares
\enquote{\cs{shortcut\meta{token}}}
as an abbreviation for
\enquote{\meta{macro}\marg{token}}.
\begin{texnote}
In \LaTeX3 syntax, this function would have signature \texttt{Nnn},
so give the \meta{macro} as a single token directly.
\end{texnote}
\begin{texnote}
Technically, the \meta{token list} can contain any tokens that
are fully expandable and thus accepted by \cs{csname} \ldots \cs{endcsname}.
However, as you want \emph{shortcuts}, you would typically invoke this
with tokens of category code 12.
\end{texnote}
\end{function}
As an example,
\begin{verbatim}
\MakeAliasesForWith\mathcal{c}{ABC}
\end{verbatim}
would define the three macros \cs{cA}, \cs{cB} and \cs{cC} to expand to
\cs{mathcal}\{A\},
\cs{mathcal}\{B\}
and
\cs{mathcal}\{c\},
respectively.
\section{Options for default aliases}
There are two options:
\begin{description}
\item[basic]
This declares \cs{C}, \cs{F}, \cs{K}, \cs{N}, \cs{Q}, \cs{R} and \cs{Z}
to expand to the \cs{mathbb} variants of these letters.
\item[extended]
Implies option \textbf{basic}.
Also defines shortcuts for \cs{mathbb}, \cs{mathfrak} and \cs{mathcal}
for each capital arabic letter with the prefixes \enquote{b},
\enquote{f} and \enquote{c}, respectively.
\end{description}
\end{documentation}
\PrintIndex
\end{document}