From aef931811813d73e24a95a59edac09f6d403762e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 30 Jan 2022 17:04:59 +0100 Subject: [PATCH] document mathalias package --- doc/math/mathalias/.latexmkrc | 4 ++ doc/math/mathalias/Makefile | 8 +++ doc/math/mathalias/mathalias.tex | 102 +++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 doc/math/mathalias/.latexmkrc create mode 100644 doc/math/mathalias/Makefile create mode 100644 doc/math/mathalias/mathalias.tex diff --git a/doc/math/mathalias/.latexmkrc b/doc/math/mathalias/.latexmkrc new file mode 100644 index 0000000..4c81cd6 --- /dev/null +++ b/doc/math/mathalias/.latexmkrc @@ -0,0 +1,4 @@ +$makeindex = "makeindex -s gind.ist %O -o %D %S"; +$clean_ext .= ' glo'; +$clean_ext .= ' hd'; +$clean_ext .= ' ins'; diff --git a/doc/math/mathalias/Makefile b/doc/math/mathalias/Makefile new file mode 100644 index 0000000..e174370 --- /dev/null +++ b/doc/math/mathalias/Makefile @@ -0,0 +1,8 @@ +doc: + latexmk + +full: + latexmk -gg + +clean: + latexmk -C diff --git a/doc/math/mathalias/mathalias.tex b/doc/math/mathalias/mathalias.tex new file mode 100644 index 0000000..3c5ab1c --- /dev/null +++ b/doc/math/mathalias/mathalias.tex @@ -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}