| 1 |
%% |
| 2 |
%% This is file `hep-math-font-documentation.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% hep-math-font-implementation.dtx (with options: `documentation') |
| 8 |
%% This is a generated file. |
| 9 |
%% Copyright (C) 2019-2025 by Jan Hajer |
| 10 |
%% This file may be distributed and/or modified under the |
| 11 |
%% conditions of the LaTeX Project Public License, either |
| 12 |
%% version 1.3c of this license or (at your option) any later |
| 13 |
%% version. The latest version of this license is in: |
| 14 |
%% http://www.latex-project.org/lppl.txt |
| 15 |
%% and version 1.3c or later is part of all distributions of |
| 16 |
%% LaTeX version 2005/12/01 or later. |
| 17 |
|
| 18 |
\ProvidesFile{hep-math-font-documentation.tex}[2025/09/01 v1.4 hep-math-Font documentation] |
| 19 |
\documentclass{ltxdoc} |
| 20 |
|
| 21 |
\renewcommand*\theCodelineNo{\rmfamily\tstyle\footnotesize\arabic{CodelineNo}} |
| 22 |
\AtBeginEnvironment{macrocode}{\renewcommand*{\ttdefault}{clmt}} |
| 23 |
\renewcommand*{\MacroFont}{\codestyle} |
| 24 |
\AtBeginDocument{\DeleteShortVerb{\|}} |
| 25 |
\AtBeginDocument{\MakeShortVerb{\"}} |
| 26 |
\EnableCrossrefs |
| 27 |
\CodelineIndex |
| 28 |
\RecordChanges |
| 29 |
|
| 30 |
\usepackage{hologo} |
| 31 |
\usepackage{fonttable} |
| 32 |
|
| 33 |
\usepackage[parskip,oldstyle,font=10pt]{hep-paper} |
| 34 |
\bibliography{bibliography} |
| 35 |
\acronym{CM}{computer modern} |
| 36 |
\acronym{LM}{latin modern} |
| 37 |
\acronym{NFSS}{new font selection scheme} |
| 38 |
\acronym{PU}{PDF Unicode} |
| 39 |
\acronym{TU}{\hologo{TeX} Unicode} |
| 40 |
\acronym{LGR}{local Greek} |
| 41 |
|
| 42 |
\GetFileInfo{hep-math-font.sty} |
| 43 |
|
| 44 |
\title{The \software{hep-math-font} package\thanks{This document corresponds to \software{hep-math-font}~\fileversion.}} |
| 45 |
\subtitle{Extended Greek and sans-serif math} |
| 46 |
\author{Jan Hajer \email{[email protected]}} |
| 47 |
\date{\filedate} |
| 48 |
|
| 49 |
\begin{document} |
| 50 |
|
| 51 |
\newgeometry{vscale=.8, vmarginratio=3:4, includeheadfoot, left=11em, marginparwidth=4.6cm, marginparsep=3mm, right=7em} |
| 52 |
|
| 53 |
\maketitle |
| 54 |
|
| 55 |
\begin{abstract} |
| 56 |
The \software{hep-math-font} package adjust the math fonts to be italic sans-serif if the document is sans-serif. |
| 57 |
Additionally Greek letters are redefined to be always italic and upright in math and text mode, respectively. |
| 58 |
Some math font macros are adjusted to give more consistently the naively expected results. |
| 59 |
\end{abstract} |
| 60 |
|
| 61 |
The package is loaded using "\usepackage{hep-math-font}". |
| 62 |
|
| 63 |
If the document "\familydefault" font is switched to the sansserif "\sfdefault" font the math font is adjusted accordingly using fonts compatible to \LM and \CM. |
| 64 |
\DescribeMacro{warning} |
| 65 |
In order to be able to easily switch large chucks of math from serif to sans-serif documents the meaning of "\mathrm" and "\mathsf" is adjusted in this case so that the first generates upright sans-serif math and the second serif math. |
| 66 |
This is is neither the literal meaning of the macros nor the best behaviour if a single large document is written in sans-serif. |
| 67 |
However, it simplifies working in an environment where one copies pieces of math between serif and sans-serif documents \eg publications \vs talks and funding applications. |
| 68 |
|
| 69 |
Using the \software{fixmath} \cite{fixmath} and \software{textalpha} \cite{textalpha} packages Greek letter are adjusted so that they are always italic and upright in math and text mode, respectively. |
| 70 |
Greek letters can be written by using their unicode characters, with code following the \software{alphabeta} package \cite{alphabeta}. |
| 71 |
|
| 72 |
\DescribeMacro{symbols} |
| 73 |
The "symbols"=\meta{family} class option sets the family of the symbol fonts. |
| 74 |
"symbols=ams" loads the two \hologo{AmS} fonts \cite{amsfonts} and the \software{bm} bold fonts. |
| 75 |
The default "symbols=true" replaces additionally the blackboard font with the \software{dsfont} \cite{dsfont}. |
| 76 |
"symbols=minion" switches the symbol fonts to the Adobe MinionPro companion font from the \software{MnSymbol} package \cite{MnSymbol}. |
| 77 |
"symbols=false" deactivates loading any additional symbol fonts, effectively restricting the package to only switch the math font according to the sans-serif property of the main text. |
| 78 |
|
| 79 |
\section{Macros} |
| 80 |
|
| 81 |
\DescribeMacro{\text} |
| 82 |
\DescribeMacro{\mathrm} |
| 83 |
The "\mathrm"\marg{math} macro and the "\text"\marg{text} macro from \software{amstext} \cite{amstext} are adjusted to produce upright Greek letters, \ie ($ \text A \text b \text \Gamma \text \delta \text{\textbf A} \text{\textbf b} \text{\textbf \Gamma} \text{\textbf \delta}$), by adjusting the code from the \software{alphabeta} \cite{alphabeta} package. |
| 84 |
|
| 85 |
\DescribeMacro{\mathbf} |
| 86 |
Bold math, via "\mathbf" is improved with the \software{bm} package \cite{bm}, \ie ($ A b \Gamma \delta \mathbf A \mathbf b \mathbf \Gamma \mathbf \delta$). |
| 87 |
Macros switching to "bfseries" such as "\section"\marg{text} are ensured to also typeset math in bold. |
| 88 |
|
| 89 |
\DescribeMacro{\mathsf} |
| 90 |
The math sans-serif alphabet is redefined to be italic sans-serif if the main text is serif and italic serif if the main text is sans-serif, \ie ($\mathsf A \mathsf b \mathsf \Gamma \mathsf \delta \mathbf{\mathsf A} \mathbf{\mathsf b} \mathbf{\mathsf \Gamma} \mathbf{\mathsf \delta}$). |
| 91 |
Ensuring that the distinction between these fonts is also kept if the \prefix{sans}{serif} option of the document is switched. |
| 92 |
|
| 93 |
\DescribeMacro{\mathscr} |
| 94 |
The "\mathcal" font \ie ($\mathcal{ABCD}$) is accompanied by the "\mathscr" font \ie ($\mathscr{ABCD}$). |
| 95 |
|
| 96 |
\DescribeMacro{\mathbb} |
| 97 |
The "\mathbb" font is improved by the \software{doublestroke} package \cite{dsfont} and adjusted depending on the \prefix{sans}{serif} option of the document \ie ($\mathbb{Ah1}$). |
| 98 |
|
| 99 |
\DescribeMacro{\mathtt} |
| 100 |
The "\mathtt" macro switches to \LM typewriter font \ie ($\mathtt A \mathtt b \mathtt \Gamma \mathbf{\mathtt A} \mathbf{\mathtt b} \mathbf{\mathtt \Gamma}$). |
| 101 |
|
| 102 |
\DescribeMacro{\mathfrak} |
| 103 |
Finally, the "\mathfrak" font is also available \ie ($\mathfrak{AaBb12}$). |
| 104 |
|
| 105 |
Details about the font handling in \hologo{TeX} can be found in \ccite{fntguide}. |
| 106 |
|
| 107 |
\section{Math alphabet allocation} \label{sec:allocation} |
| 108 |
|
| 109 |
\bgroup |
| 110 |
\makeatletter |
| 111 |
\renewcommand*{\arraystretch}{0} |
| 112 |
\setlength{\tabcolsep}{0pt} |
| 113 |
\nodecimals |
| 114 |
\nohexoct |
| 115 |
\fntcolwidth=0pt |
| 116 |
\setlength\arrayrulewidth{0pt} |
| 117 |
|
| 118 |
\begin{figure} |
| 119 |
\begin{panels}[t]{4} |
| 120 |
\fonttable{rm-\ifhepmathfont@serif lmr\else lmss\fi10} |
| 121 |
\caption{Text} |
| 122 |
\panel |
| 123 |
\fontrange{0}{127} |
| 124 |
\fonttable{\ifhepmathfont@serif lm\else cmss\fi mi10} |
| 125 |
\caption{Math}\vspace{2ex} |
| 126 |
\fonttable{\ifhepmathfont@serif lm\else cmss\fi sy10} |
| 127 |
\caption{Symbol} |
| 128 |
\panel |
| 129 |
\fontrange{0}{127} |
| 130 |
\fonttable{\ifhepmathfont@serif\else ss\fi msam10} |
| 131 |
\caption{AMS a}\vspace{2ex} |
| 132 |
\fontrange{0}{79} |
| 133 |
\fonttable{\ifhepmathfont@serif\else ss\fi msbm10} |
| 134 |
\fontrange{96}{127} |
| 135 |
\fonttable{\ifhepmathfont@serif\else ss\fi msbm10} |
| 136 |
\caption{AMS b} |
| 137 |
\panel |
| 138 |
\fontrange{0}{8} |
| 139 |
\fonttable{eufm10} |
| 140 |
\fontrange{32}{127} |
| 141 |
\fonttable{eufm10} |
| 142 |
\caption{Euler fraktur}\vspace{2ex} |
| 143 |
\fontrange{64}{95} |
| 144 |
\fonttable{eusm10} |
| 145 |
\caption{Euler caligraphy}\vspace{2ex} |
| 146 |
\fonttable{MnSymbolS10} |
| 147 |
\caption{Minion caligraphy}\vspace{2ex} |
| 148 |
\fonttable{ds\ifhepmathfont@serif rom\else ss\fi10} |
| 149 |
\caption{Doublestroke} |
| 150 |
\end{panels} |
| 151 |
\caption{Basic math fonts} |
| 152 |
\end{figure} |
| 153 |
|
| 154 |
\begin{figure} |
| 155 |
\hspace*{-2cm}% |
| 156 |
\begin{panels}[t]{.3} |
| 157 |
\fontrange{0}{127} |
| 158 |
\fonttable{cm\ifhepmathfont@serif\else ss\fi ex10} |
| 159 |
\caption{Computer modern} |
| 160 |
\panel{.22} |
| 161 |
\fontrange{0}{143} |
| 162 |
\fonttable{MnSymbolE5} |
| 163 |
\caption{Mn Symbol E 1} |
| 164 |
\panel{.6} |
| 165 |
\fontrange{144}{215} |
| 166 |
\fonttable{MnSymbolE5} |
| 167 |
\caption{Mn Symbol E 2}\vspace{2ex} |
| 168 |
\begin{minipage}{.48\linewidth} |
| 169 |
\fontrange{0}{127}\fonttable{MnSymbolF10} |
| 170 |
\caption{Mn Symbols F} |
| 171 |
\end{minipage}% |
| 172 |
\begin{minipage}{.5\linewidth} |
| 173 |
\fontrange{0}{47}\fonttable{\ifhepmathfont@serif\else ss\fi esint10} |
| 174 |
\caption{Extended set of integrals} |
| 175 |
\end{minipage} |
| 176 |
\end{panels} |
| 177 |
\caption{Math extension fonts} |
| 178 |
\end{figure} |
| 179 |
|
| 180 |
\begin{figure} |
| 181 |
\begin{panels}[t]{.26} |
| 182 |
\fonttable{MnSymbolA10} |
| 183 |
\caption{Mn Symbol A} |
| 184 |
\panel{.26} |
| 185 |
\fonttable{MnSymbolB10} |
| 186 |
\caption{Mn Symbol B} |
| 187 |
\panel{.26} |
| 188 |
\fonttable{MnSymbolC10} |
| 189 |
\caption{Mn Symbol C} |
| 190 |
\panel{.2} |
| 191 |
\fonttable{MnSymbolD10} |
| 192 |
\caption{Mn Symbol D} |
| 193 |
\end{panels} |
| 194 |
\makeatother |
| 195 |
\caption{Minion symbol fonts} |
| 196 |
\end{figure} |
| 197 |
\egroup |
| 198 |
|
| 199 |
Of the 16 available math alphabets, \hologo{TeX} loads four by default |
| 200 |
\begin{enumdescript}[start=0,label=\arabic*)] |
| 201 |
\item{OT1} \label{it:math text} Text (latin, upper case greek, numerals, text symbols) |
| 202 |
|
| 203 |
The text font \ref{it:math text}\strut\ of \CM is \textbf{cmr10} "\OT1/cmr/m/n/10", which is replaced by \LM to be \textbf{rm-lmr10} "\OT1/lmr/m/n/10", the "sansserif" option uses \textbf{rm-lmss10} "\OT1/lmss/m/n/10". |
| 204 |
\item{OML} \label{it:math italic} Math Italic (latin, greek, numerals, text symbols) |
| 205 |
|
| 206 |
The italic math font \ref{it:math italic} of \CM is \textbf{cmmi10} "\OML/cmm/m/it/"\allowbreak"10", and is replaced by \LM to be \textbf{lmmi10} "\OML/lmm/m/it/10", the "sansserif" options uses \textbf{cmssmi10} "\OML/cmssrm/m/it/10" from the \software{sansmathfonts} package \cite{sansmathfonts}. |
| 207 |
\item{OMS} \label{it:math symbol} Symbol ("\mathcal", operators) |
| 208 |
|
| 209 |
The symbol font \ref{it:math symbol}\strut\ of \CM is \textbf{cmsy10} "\OMS/cmsy/m/n/10", and is replaced by \LM to be \textbf{lmsy10} "\OMS/lmsy/m/n/10", the "sansserif" options uses \textbf{cmsssy10} "\OMS/cmsssy/m/n/10" from the \software{sansmathfonts} package \cite{sansmathfonts}. |
| 210 |
\item{OMX} \label{it:math extension} Math Extension (big operators, delimiters) |
| 211 |
|
| 212 |
The extension font \ref{it:math extension}\strut\ of \CM is \textbf{cmex10} "\OMX/cmex/m/n/5", and is replaced by the \software{exscale} package \cite{exscale} to be \textbf{cmex10} "\OMX/cmex/m/n/10", the "sansserif" option loads \textbf{cmssex10} "\OMX/cmssex/m/n/10". |
| 213 |
\end{enumdescript} |
| 214 |
|
| 215 |
The \software{amssymb} (\software{amsfonts}) packages \cite{amssymb} load two more symbol fonts |
| 216 |
\begin{enumdescript}[start=4,label=\arabic*)] |
| 217 |
\item{msam10} \label{it:math ams a} "\U/msa/m/n/10" AMS symbol font A (special math operators) |
| 218 |
\item{msbm10} \label{it:math ams b} "\U/msb/m/n/10" AMS symbol font B ("\mathbb", negated operators) |
| 219 |
\end{enumdescript} |
| 220 |
The "sansserif" option replaces them with \textbf{ssmsam10} "\U/ssmsa/m/n/10" and \textbf{ssmsbm10} "\U/ssmsb/m/n/10" from the \software{sansmathfonts} package \cite{sansmathfonts}, respectively. |
| 221 |
|
| 222 |
The \software{bm} package \cite{bm} loads the bold version for the fonts \labelcref{it:math text,it:math italic,it:math symbol}. |
| 223 |
|
| 224 |
Other math alphabets are only loaded on demand, \eg "\mathsf" uses a sans-serif font and "\mathbf" without the \software{bm} package uses a bold font. |
| 225 |
The "\mathscr" macro uses the script font from the \software{mathrsfs} package \cite{mathrsfs} |
| 226 |
\begin{enumdescript}[start=9,label=\arabic*)] |
| 227 |
\item{rsfs10} "\U/rsfs/m/n/10" Math script font (capital letters) |
| 228 |
\end{enumdescript} |
| 229 |
The "\mathbb" macro loads the double stroke font from the \software{dsfont} package \cite{dsfont}, this can be prevented with the "symbols=ams" option. |
| 230 |
\begin{enumdescript}[start=10,label=\arabic*)] |
| 231 |
\item{dsrom10} "\U/dsrom/m/n/10" Double stroke font |
| 232 |
\end{enumdescript} |
| 233 |
The "\mathfrak" macro loads the fractur font from the \software{amssymb} package \cite{amssymb} |
| 234 |
\begin{enumdescript}[start=11,label=\arabic*)] |
| 235 |
\item{eufm10} "\U/euf/m/n/10" Math fraktur (Basic Latin) |
| 236 |
\end{enumdescript} |
| 237 |
|
| 238 |
The \software{hep-math-font} package uses nine of the available 16 math alphabets. |
| 239 |
This number can be reduced by three using "\newcommand{\bmmax}{0}" from the \software{bm} package \cite{bm} and brought down to the default of four with the option "symbols=false". |
| 240 |
|
| 241 |
The "symbols=minion" options replaces the fonts \labelcref{it:math symbol,it:math extension,it:math ams a,it:math ams b} with corresponding fonts from the \software{MnSymbol} package \cite{MnSymbol}. |
| 242 |
Additionally, two more symbol alphabets are allocated, the \software{bm} package \cite{bm} loads one more font and now "\mathcal" triggers the use of one additional alphabet. |
| 243 |
Hence, the minion option uses three to four more math alphabets than a usual setup. |
| 244 |
|
| 245 |
\printbibliography |
| 246 |
|
| 247 |
\end{document} |
| 248 |
|
| 249 |
\endinput |
| 250 |
%% |
| 251 |
%% End of file `hep-math-font-documentation.tex'. |