| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 2019-2023 by Jan Hajer |
| 4 |
% ----------------------------------- |
| 5 |
% |
| 6 |
% This file may be distributed and/or modified under the |
| 7 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 8 |
% of this license or (at your option) any later version. |
| 9 |
% The latest version of this license is in: |
| 10 |
% |
| 11 |
% http://www.latex-project.org/lppl.txt |
| 12 |
% |
| 13 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 14 |
% version 2005/12/01 or later. |
| 15 |
% |
| 16 |
% \fi |
| 17 |
% |
| 18 |
% \iffalse |
| 19 |
|
| 20 |
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01] |
| 21 |
%<package>\ProvidesPackage{hep-math-font}[2025/09/01 v1.4 selection of math fonts for latin modern] |
| 22 |
%<documentation>\ProvidesFile{hep-math-font-documentation.tex}[2025/09/01 v1.4 hep-math-Font documentation] |
| 23 |
% |
| 24 |
%<*documentation> |
| 25 |
\documentclass{ltxdoc} |
| 26 |
|
| 27 |
\renewcommand*\theCodelineNo{\rmfamily\tstyle\footnotesize\arabic{CodelineNo}} |
| 28 |
\AtBeginEnvironment{macrocode}{\renewcommand*{\ttdefault}{clmt}} |
| 29 |
\renewcommand*{\MacroFont}{\codestyle} |
| 30 |
\AtBeginDocument{\DeleteShortVerb{\|}} |
| 31 |
\AtBeginDocument{\MakeShortVerb{\"}} |
| 32 |
\EnableCrossrefs |
| 33 |
\CodelineIndex |
| 34 |
\RecordChanges |
| 35 |
|
| 36 |
\usepackage{hologo} |
| 37 |
\usepackage{fonttable} |
| 38 |
|
| 39 |
\usepackage[parskip,oldstyle,font=10pt]{hep-paper} |
| 40 |
\bibliography{bibliography} |
| 41 |
\acronym{CM}{computer modern} |
| 42 |
\acronym{LM}{latin modern} |
| 43 |
\acronym{NFSS}{new font selection scheme} |
| 44 |
\acronym{PU}{PDF Unicode} |
| 45 |
\acronym{TU}{\hologo{TeX} Unicode} |
| 46 |
\acronym{LGR}{local Greek} |
| 47 |
%</documentation> |
| 48 |
|
| 49 |
%<*driver> |
| 50 |
\expandafter\newif\csname ifshort\endcsname |
| 51 |
\shortfalse |
| 52 |
\begin{document} |
| 53 |
\DocInput{hep-math-font-implementation.dtx} |
| 54 |
\end{document} |
| 55 |
%</driver> |
| 56 |
% |
| 57 |
% \fi |
| 58 |
% |
| 59 |
% \CheckSum{698} |
| 60 |
% |
| 61 |
% \CharacterTable |
| 62 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 63 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 64 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 65 |
% Exclamation \! Double quote \" Hash (number) \# |
| 66 |
% Dollar \$ Percent \% Ampersand \& |
| 67 |
% Acute accent \' Left paren \( Right paren \) |
| 68 |
% Asterisk \* Plus \+ Comma \, |
| 69 |
% Minus \- Point \. Solidus \/ |
| 70 |
% Colon \: Semicolon \; Less than \< |
| 71 |
% Equals \= Greater than \> Question mark \? |
| 72 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 73 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 74 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 75 |
% Right brace \} Tilde \~} |
| 76 |
% |
| 77 |
% \changes{v1.0}{2021/09/01}{Initial version of the style file.} |
| 78 |
% \changes{v1.1}{2022/11/01}{Bug fixes.} |
| 79 |
% \changes{v1.2}{2023/07/01}{Bug fixes.} |
| 80 |
% \changes{v1.3}{2024/11/01}{Bug fixes.} |
| 81 |
% \changes{v1.4}{2025/09/01}{Bug fixes.} |
| 82 |
% |
| 83 |
% \ifshort |
| 84 |
%<*documentation> |
| 85 |
% \fi |
| 86 |
% |
| 87 |
\GetFileInfo{hep-math-font.sty} |
| 88 |
|
| 89 |
\title{The \software{hep-math-font} package\thanks{This document corresponds to \software{hep-math-font}~\fileversion.}} |
| 90 |
\subtitle{Extended Greek and sans-serif math} |
| 91 |
\author{Jan Hajer \email{[email protected]}} |
| 92 |
\date{\filedate} |
| 93 |
|
| 94 |
% \ifshort |
| 95 |
\begin{document} |
| 96 |
% \fi |
| 97 |
|
| 98 |
\newgeometry{vscale=.8, vmarginratio=3:4, includeheadfoot, left=11em, marginparwidth=4.6cm, marginparsep=3mm, right=7em} |
| 99 |
|
| 100 |
\maketitle |
| 101 |
|
| 102 |
\begin{abstract} |
| 103 |
The \software{hep-math-font} package adjust the math fonts to be italic sans-serif if the document is sans-serif. |
| 104 |
Additionally Greek letters are redefined to be always italic and upright in math and text mode, respectively. |
| 105 |
Some math font macros are adjusted to give more consistently the naively expected results. |
| 106 |
\end{abstract} |
| 107 |
|
| 108 |
The package is loaded using "\usepackage{hep-math-font}". |
| 109 |
|
| 110 |
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. |
| 111 |
\DescribeMacro{warning} |
| 112 |
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. |
| 113 |
This is is neither the literal meaning of the macros nor the best behaviour if a single large document is written in sans-serif. |
| 114 |
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. |
| 115 |
|
| 116 |
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. |
| 117 |
Greek letters can be written by using their unicode characters, with code following the \software{alphabeta} package \cite{alphabeta}. |
| 118 |
|
| 119 |
\DescribeMacro{symbols} |
| 120 |
The "symbols"=\meta{family} class option sets the family of the symbol fonts. |
| 121 |
"symbols=ams" loads the two \hologo{AmS} fonts \cite{amsfonts} and the \software{bm} bold fonts. |
| 122 |
The default "symbols=true" replaces additionally the blackboard font with the \software{dsfont} \cite{dsfont}. |
| 123 |
"symbols=minion" switches the symbol fonts to the Adobe MinionPro companion font from the \software{MnSymbol} package \cite{MnSymbol}. |
| 124 |
"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. |
| 125 |
|
| 126 |
\section{Macros} |
| 127 |
|
| 128 |
\DescribeMacro{\text} |
| 129 |
\DescribeMacro{\mathrm} |
| 130 |
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. |
| 131 |
|
| 132 |
\DescribeMacro{\mathbf} |
| 133 |
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$). |
| 134 |
Macros switching to "bfseries" such as "\section"\marg{text} are ensured to also typeset math in bold. |
| 135 |
|
| 136 |
\DescribeMacro{\mathsf} |
| 137 |
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}$). |
| 138 |
Ensuring that the distinction between these fonts is also kept if the \prefix{sans}{serif} option of the document is switched. |
| 139 |
|
| 140 |
\DescribeMacro{\mathscr} |
| 141 |
The "\mathcal" font \ie ($\mathcal{ABCD}$) is accompanied by the "\mathscr" font \ie ($\mathscr{ABCD}$). |
| 142 |
|
| 143 |
\DescribeMacro{\mathbb} |
| 144 |
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}$). |
| 145 |
|
| 146 |
\DescribeMacro{\mathtt} |
| 147 |
The "\mathtt" macro switches to \LM typewriter font \ie ($\mathtt A \mathtt b \mathtt \Gamma \mathbf{\mathtt A} \mathbf{\mathtt b} \mathbf{\mathtt \Gamma}$). |
| 148 |
|
| 149 |
\DescribeMacro{\mathfrak} |
| 150 |
Finally, the "\mathfrak" font is also available \ie ($\mathfrak{AaBb12}$). |
| 151 |
|
| 152 |
Details about the font handling in \hologo{TeX} can be found in \ccite{fntguide}. |
| 153 |
|
| 154 |
\section{Math alphabet allocation} \label{sec:allocation} |
| 155 |
|
| 156 |
\bgroup |
| 157 |
\makeatletter |
| 158 |
\renewcommand*{\arraystretch}{0} |
| 159 |
\setlength{\tabcolsep}{0pt} |
| 160 |
\nodecimals |
| 161 |
\nohexoct |
| 162 |
\fntcolwidth=0pt |
| 163 |
\setlength\arrayrulewidth{0pt} |
| 164 |
|
| 165 |
\begin{figure} |
| 166 |
\begin{panels}[t]{4} |
| 167 |
\fonttable{rm-\ifhepmathfont@serif lmr\else lmss\fi10} |
| 168 |
\caption{Text} |
| 169 |
\panel |
| 170 |
\fontrange{0}{127} |
| 171 |
\fonttable{\ifhepmathfont@serif lm\else cmss\fi mi10} |
| 172 |
\caption{Math}\vspace{2ex} |
| 173 |
\fonttable{\ifhepmathfont@serif lm\else cmss\fi sy10} |
| 174 |
\caption{Symbol} |
| 175 |
\panel |
| 176 |
\fontrange{0}{127} |
| 177 |
\fonttable{\ifhepmathfont@serif\else ss\fi msam10} |
| 178 |
\caption{AMS a}\vspace{2ex} |
| 179 |
\fontrange{0}{79} |
| 180 |
\fonttable{\ifhepmathfont@serif\else ss\fi msbm10} |
| 181 |
\fontrange{96}{127} |
| 182 |
\fonttable{\ifhepmathfont@serif\else ss\fi msbm10} |
| 183 |
\caption{AMS b} |
| 184 |
\panel |
| 185 |
\fontrange{0}{8} |
| 186 |
\fonttable{eufm10} |
| 187 |
\fontrange{32}{127} |
| 188 |
\fonttable{eufm10} |
| 189 |
\caption{Euler fraktur}\vspace{2ex} |
| 190 |
\fontrange{64}{95} |
| 191 |
\fonttable{eusm10} |
| 192 |
\caption{Euler caligraphy}\vspace{2ex} |
| 193 |
\fonttable{MnSymbolS10} |
| 194 |
\caption{Minion caligraphy}\vspace{2ex} |
| 195 |
\fonttable{ds\ifhepmathfont@serif rom\else ss\fi10} |
| 196 |
\caption{Doublestroke} |
| 197 |
\end{panels} |
| 198 |
\caption{Basic math fonts} |
| 199 |
\end{figure} |
| 200 |
|
| 201 |
\begin{figure} |
| 202 |
\hspace*{-2cm}% |
| 203 |
\begin{panels}[t]{.3} |
| 204 |
\fontrange{0}{127} |
| 205 |
\fonttable{cm\ifhepmathfont@serif\else ss\fi ex10} |
| 206 |
\caption{Computer modern} |
| 207 |
\panel{.22} |
| 208 |
\fontrange{0}{143} |
| 209 |
\fonttable{MnSymbolE5} |
| 210 |
\caption{Mn Symbol E 1} |
| 211 |
\panel{.6} |
| 212 |
\fontrange{144}{215} |
| 213 |
\fonttable{MnSymbolE5} |
| 214 |
\caption{Mn Symbol E 2}\vspace{2ex} |
| 215 |
\begin{minipage}{.48\linewidth} |
| 216 |
\fontrange{0}{127}\fonttable{MnSymbolF10} |
| 217 |
\caption{Mn Symbols F} |
| 218 |
\end{minipage}% |
| 219 |
\begin{minipage}{.5\linewidth} |
| 220 |
\fontrange{0}{47}\fonttable{\ifhepmathfont@serif\else ss\fi esint10} |
| 221 |
\caption{Extended set of integrals} |
| 222 |
\end{minipage} |
| 223 |
\end{panels} |
| 224 |
\caption{Math extension fonts} |
| 225 |
\end{figure} |
| 226 |
|
| 227 |
\begin{figure} |
| 228 |
\begin{panels}[t]{.26} |
| 229 |
\fonttable{MnSymbolA10} |
| 230 |
\caption{Mn Symbol A} |
| 231 |
\panel{.26} |
| 232 |
\fonttable{MnSymbolB10} |
| 233 |
\caption{Mn Symbol B} |
| 234 |
\panel{.26} |
| 235 |
\fonttable{MnSymbolC10} |
| 236 |
\caption{Mn Symbol C} |
| 237 |
\panel{.2} |
| 238 |
\fonttable{MnSymbolD10} |
| 239 |
\caption{Mn Symbol D} |
| 240 |
\end{panels} |
| 241 |
\makeatother |
| 242 |
\caption{Minion symbol fonts} |
| 243 |
\end{figure} |
| 244 |
\egroup |
| 245 |
|
| 246 |
Of the 16 available math alphabets, \hologo{TeX} loads four by default |
| 247 |
\begin{enumdescript}[start=0,label=\arabic*)] |
| 248 |
\item{OT1} \label{it:math text} Text (latin, upper case greek, numerals, text symbols) |
| 249 |
|
| 250 |
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". |
| 251 |
\item{OML} \label{it:math italic} Math Italic (latin, greek, numerals, text symbols) |
| 252 |
|
| 253 |
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}. |
| 254 |
\item{OMS} \label{it:math symbol} Symbol ("\mathcal", operators) |
| 255 |
|
| 256 |
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}. |
| 257 |
\item{OMX} \label{it:math extension} Math Extension (big operators, delimiters) |
| 258 |
|
| 259 |
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". |
| 260 |
\end{enumdescript} |
| 261 |
|
| 262 |
The \software{amssymb} (\software{amsfonts}) packages \cite{amssymb} load two more symbol fonts |
| 263 |
\begin{enumdescript}[start=4,label=\arabic*)] |
| 264 |
\item{msam10} \label{it:math ams a} "\U/msa/m/n/10" AMS symbol font A (special math operators) |
| 265 |
\item{msbm10} \label{it:math ams b} "\U/msb/m/n/10" AMS symbol font B ("\mathbb", negated operators) |
| 266 |
\end{enumdescript} |
| 267 |
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. |
| 268 |
|
| 269 |
The \software{bm} package \cite{bm} loads the bold version for the fonts \labelcref{it:math text,it:math italic,it:math symbol}. |
| 270 |
|
| 271 |
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. |
| 272 |
The "\mathscr" macro uses the script font from the \software{mathrsfs} package \cite{mathrsfs} |
| 273 |
\begin{enumdescript}[start=9,label=\arabic*)] |
| 274 |
\item{rsfs10} "\U/rsfs/m/n/10" Math script font (capital letters) |
| 275 |
\end{enumdescript} |
| 276 |
The "\mathbb" macro loads the double stroke font from the \software{dsfont} package \cite{dsfont}, this can be prevented with the "symbols=ams" option. |
| 277 |
\begin{enumdescript}[start=10,label=\arabic*)] |
| 278 |
\item{dsrom10} "\U/dsrom/m/n/10" Double stroke font |
| 279 |
\end{enumdescript} |
| 280 |
The "\mathfrak" macro loads the fractur font from the \software{amssymb} package \cite{amssymb} |
| 281 |
\begin{enumdescript}[start=11,label=\arabic*)] |
| 282 |
\item{eufm10} "\U/euf/m/n/10" Math fraktur (Basic Latin) |
| 283 |
\end{enumdescript} |
| 284 |
|
| 285 |
The \software{hep-math-font} package uses nine of the available 16 math alphabets. |
| 286 |
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". |
| 287 |
|
| 288 |
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}. |
| 289 |
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. |
| 290 |
Hence, the minion option uses three to four more math alphabets than a usual setup. |
| 291 |
|
| 292 |
% \ifshort |
| 293 |
\printbibliography |
| 294 |
|
| 295 |
\end{document} |
| 296 |
% |
| 297 |
%</documentation> |
| 298 |
% \fi |
| 299 |
% |
| 300 |
% \StopEventually{ |
| 301 |
% \printbibliography |
| 302 |
% \PrintChanges |
| 303 |
%} |
| 304 |
% |
| 305 |
% \appendix |
| 306 |
% |
| 307 |
% \section{Implementation} |
| 308 |
% |
| 309 |
%<*package> |
| 310 |
% |
| 311 |
% Use the \software{kvoptions} package \cite{kvoptions}. |
| 312 |
% \begin{macrocode} |
| 313 |
\RequirePackage{kvoptions} |
| 314 |
\SetupKeyvalOptions{ |
| 315 |
family=hepmathfont, |
| 316 |
prefix=hepmathfont@ |
| 317 |
} |
| 318 |
% \end{macrocode} |
| 319 |
% |
| 320 |
% \begin{macro}{symbols} |
| 321 |
% Provide the "symbols" option allowing to switch the symbol font. |
| 322 |
% \begin{macrocode} |
| 323 |
\DeclareStringOption[true]{symbols} |
| 324 |
% \end{macrocode} |
| 325 |
% \end{macro} |
| 326 |
% |
| 327 |
% \begin{macrocode} |
| 328 |
\ProcessKeyvalOptions* |
| 329 |
% \end{macrocode} |
| 330 |
% |
| 331 |
% Define conditionals based on the "symbols" package option using the \software{pdftexcmds} package \cite{pdftexcmds}. |
| 332 |
% \begin{macrocode} |
| 333 |
\RequirePackage{pdftexcmds} |
| 334 |
\newif\ifhepmathfont@symbols |
| 335 |
\ifnum |
| 336 |
\pdf@strcmp{\hepmathfont@symbols}{false}=0 |
| 337 |
\else |
| 338 |
\hepmathfont@symbolstrue |
| 339 |
\fi |
| 340 |
\newif\ifhep@ams |
| 341 |
\ifnum\pdf@strcmp{\hepmathfont@symbols}{ams}=0 \hep@amstrue\fi |
| 342 |
\newif\ifhep@minion |
| 343 |
\ifnum\pdf@strcmp{\hepmathfont@symbols}{minion}=0 \hep@miniontrue\fi |
| 344 |
% \end{macrocode} |
| 345 |
% Check if document is set to sans-serif using the \software{xstring} package \cite{xstring}. |
| 346 |
% \begin{macrocode} |
| 347 |
\newif\ifhepmathfont@serif |
| 348 |
\RequirePackage{xstring} |
| 349 |
\IfStrEq{\familydefault}{\sfdefault}{% |
| 350 |
\hepmathfont@seriffalse}{\hepmathfont@seriftrue% |
| 351 |
} |
| 352 |
% \end{macrocode} |
| 353 |
% |
| 354 |
% \subsection{Lualatex} |
| 355 |
% |
| 356 |
% Check for Lualatex using the \software{iftex} package \cite{iftex}. |
| 357 |
% \begin{macrocode} |
| 358 |
\RequirePackage{iftex} |
| 359 |
\iftutex |
| 360 |
% \end{macrocode} |
| 361 |
% Load the \software{unicode-math} package \cite{unicode-math}. |
| 362 |
% \begin{macrocode} |
| 363 |
\AtBeginDocument{ |
| 364 |
\let\mathbf\symbf |
| 365 |
\let\mathrm\symup |
| 366 |
\let\mathsf\symsf |
| 367 |
\let\mathbfrm\symbfup |
| 368 |
\let\mathbfsf\symbfsf |
| 369 |
} |
| 370 |
% \end{macrocode} |
| 371 |
% Unicode implementation of Greek letters. |
| 372 |
% \begin{macrocode} |
| 373 |
\AtBeginDocument{ |
| 374 |
\renewcommand*{\Gamma}{Γ} |
| 375 |
\renewcommand*{\Delta}{Δ} |
| 376 |
\renewcommand*{\Lambda}{Λ} |
| 377 |
\renewcommand*{\Phi}{Φ} |
| 378 |
\renewcommand*{\Pi}{Π} |
| 379 |
\renewcommand*{\Psi}{Ψ} |
| 380 |
\renewcommand*{\Sigma}{Σ} |
| 381 |
\renewcommand*{\Theta}{Θ} |
| 382 |
\renewcommand*{\Upsilon}{Υ} |
| 383 |
\renewcommand*{\Xi}{Ξ} |
| 384 |
\renewcommand*{\Omega}{Ω} |
| 385 |
\renewcommand*{\alpha}{α} |
| 386 |
\renewcommand*{\beta}{β} |
| 387 |
\renewcommand*{\gamma}{γ} |
| 388 |
\renewcommand*{\delta}{δ} |
| 389 |
\renewcommand*{\epsilon}{ε} |
| 390 |
\renewcommand*{\zeta}{ζ} |
| 391 |
\renewcommand*{\eta}{η} |
| 392 |
\renewcommand*{\theta}{θ} |
| 393 |
\renewcommand*{\iota}{ι} |
| 394 |
\renewcommand*{\kappa}{κ} |
| 395 |
\renewcommand*{\lambda}{λ} |
| 396 |
\renewcommand*{\mu}{μ} |
| 397 |
\renewcommand*{\nu}{ν} |
| 398 |
\renewcommand*{\xi}{ξ} |
| 399 |
\renewcommand*{\pi}{π} |
| 400 |
\renewcommand*{\rho}{ρ} |
| 401 |
\renewcommand*{\sigma}{σ} |
| 402 |
\renewcommand*{\varsigma}{ς} |
| 403 |
\renewcommand*{\tau}{τ} |
| 404 |
\renewcommand*{\upsilon}{υ} |
| 405 |
\renewcommand*{\phi}{φ} |
| 406 |
\renewcommand*{\chi}{χ} |
| 407 |
\renewcommand*{\psi}{ψ} |
| 408 |
\renewcommand*{\omega}{ω} |
| 409 |
} |
| 410 |
% \end{macrocode} |
| 411 |
% |
| 412 |
% \subsection{PdfLatex} |
| 413 |
% |
| 414 |
% \begin{macrocode} |
| 415 |
\else |
| 416 |
% \end{macrocode} |
| 417 |
% |
| 418 |
% \subsubsection{Serif} |
| 419 |
% |
| 420 |
% \begin{macrocode} |
| 421 |
\newcommand*\mathbfrm[1]{\mathbf{\mathrm{#1}}} |
| 422 |
\newcommand*\mathbfsf[1]{\mathbf{\mathsf{#1}}} |
| 423 |
% \end{macrocode} |
| 424 |
% |
| 425 |
% If the "sansserif" package option is active use code adjusted from the \software{sansmathfonts} package \cite{sansmathfonts}. |
| 426 |
% Ensure that "\mathsf" is italic as well as sans-serif and sans for sans and sans-serif documents, respectively. |
| 427 |
% \begin{macrocode} |
| 428 |
\ifhepmathfont@serif |
| 429 |
% \end{macrocode} |
| 430 |
% \begin{macro}{\mathsf} |
| 431 |
% Declare "\mathsf" for serif documents. |
| 432 |
% \begin{macrocode} |
| 433 |
\newcommand*\hep@font@sf{cmssm} |
| 434 |
\DeclareMathAlphabet{\mathsf}{OML}{\hep@font@sf}{m}{it} |
| 435 |
\SetMathAlphabet{\mathsf}{bold}{OML}{\hep@font@sf}{b}{it} |
| 436 |
\newcommand*\hep@textfont@sf{lmss} |
| 437 |
\DeclareMathAlphabet{\mathsftext}{OT1}{\hep@textfont@sf}{m}{n} |
| 438 |
\SetMathAlphabet{\mathsftext}{bold}{OT1}{\hep@textfont@sf}{bx}{n} |
| 439 |
% \end{macrocode} |
| 440 |
% \end{macro} |
| 441 |
% |
| 442 |
% \subsubsection{Sans serif} |
| 443 |
% |
| 444 |
% Define fonts for sans-serif documents. |
| 445 |
% \begin{macrocode} |
| 446 |
\else |
| 447 |
% \end{macrocode} |
| 448 |
% \begin{macrocode} |
| 449 |
\newcommand*\hep@font@sf{lmr} |
| 450 |
\newcommand*\hep@font@text{lmss} |
| 451 |
\newcommand*\hep@font@math{cmssm} |
| 452 |
\newcommand*\hep@font@symbol{cmsssy} |
| 453 |
\newcommand*\hep@font@extra{cmssex} |
| 454 |
% \end{macrocode} |
| 455 |
% Declare font substitutions. |
| 456 |
% \begin{macrocode} |
| 457 |
\DeclareFontSubstitution{OML}{\hep@font@math}{m}{it} |
| 458 |
\ifhepmathfont@symbols\ifhep@minion\else |
| 459 |
\DeclareFontSubstitution{OMS}{\hep@font@symbol}{m}{n} |
| 460 |
\DeclareFontSubstitution{OMX}{\hep@font@extra}{m}{n} |
| 461 |
\fi\fi |
| 462 |
% \end{macrocode} |
| 463 |
% Declare the symbol fonts. |
| 464 |
% \begin{macrocode} |
| 465 |
\DeclareSymbolFont{operators}{OT1}{\hep@font@text}{m}{n} |
| 466 |
\DeclareSymbolFont{letters}{OML}{\hep@font@math}{m}{it} |
| 467 |
\ifhepmathfont@symbols\ifhep@minion\else |
| 468 |
\DeclareSymbolFont{symbols}{OMS}{\hep@font@symbol}{m}{n} |
| 469 |
\DeclareSymbolFont{largesymbols}{OMX}{\hep@font@extra}{m}{n} |
| 470 |
\fi\fi |
| 471 |
% \end{macrocode} |
| 472 |
% Set bold symbol fonts. |
| 473 |
% \begin{macrocode} |
| 474 |
\SetSymbolFont{operators}{bold}{OT1}{\hep@font@text}{b}{n} |
| 475 |
\SetSymbolFont{letters}{bold}{OML}{\hep@font@math}{b}{it} |
| 476 |
\ifhepmathfont@symbols\ifhep@minion\else |
| 477 |
\SetSymbolFont{symbols}{bold}{OMS}{\hep@font@symbol}{b}{n} |
| 478 |
\fi\fi |
| 479 |
% \end{macrocode} |
| 480 |
% Adjust the fonts loaded by the \software{amsfonts} \cite{amsfonts} and \software{esint} \cite{esint} packages. |
| 481 |
% \begin{macrocode} |
| 482 |
\ifhepmathfont@symbols\ifhep@minion\else |
| 483 |
\DeclareSymbolFont{AMSa}{U}{ssmsa}{m}{n} |
| 484 |
\DeclareSymbolFont{AMSb}{U}{ssmsb}{m}{n} |
| 485 |
\fi\fi |
| 486 |
\ifhepmathfont@symbols\RequirePackage{alphabeta}\fi %fix compilation error |
| 487 |
\AtBeginDocument{% |
| 488 |
\@ifpackageloaded{esint}{% |
| 489 |
\DeclareSymbolFont{largesymbolsA}{U}{ssesint}{m}{n} |
| 490 |
}{} |
| 491 |
} |
| 492 |
% \end{macrocode} |
| 493 |
% \begin{macro}{\mathrm} |
| 494 |
% \begin{macro}{\mathnormal} |
| 495 |
% \begin{macro}{\mathcal} |
| 496 |
% Declare the symbol font alphabets. |
| 497 |
% \begin{macrocode} |
| 498 |
\DeclareSymbolFontAlphabet{\mathrm}{operators} |
| 499 |
\DeclareSymbolFontAlphabet{\mathnormal}{letters} |
| 500 |
\ifhep@minion\else |
| 501 |
\DeclareSymbolFontAlphabet{\mathcal}{symbols} |
| 502 |
\fi |
| 503 |
% \end{macrocode} |
| 504 |
% \end{macro} |
| 505 |
% \end{macro} |
| 506 |
% \end{macro} |
| 507 |
% \begin{macro}{\mathit} |
| 508 |
% Declare "\mathit". |
| 509 |
% \begin{macrocode} |
| 510 |
\DeclareMathAlphabet{\mathit}{OML}{\hep@font@text}{m}{it} |
| 511 |
\SetMathAlphabet\mathit{bold}{OML}{\hep@font@text}{bx}{it} |
| 512 |
% \end{macrocode} |
| 513 |
% \end{macro} |
| 514 |
% \begin{macro}{\mathsf} |
| 515 |
% Declare "\mathsf" for sans-serif documents to produce serif. |
| 516 |
% \begin{macrocode} |
| 517 |
\DeclareMathAlphabet{\mathsf}{OML}{\hep@font@sf}{m}{it} |
| 518 |
\SetMathAlphabet{\mathsf}{bold}{OML}{\hep@font@sf}{bx}{it} |
| 519 |
% \end{macrocode} |
| 520 |
% \end{macro} |
| 521 |
% End of "sansserif". |
| 522 |
% \begin{macrocode} |
| 523 |
\fi |
| 524 |
% \end{macrocode} |
| 525 |
% |
| 526 |
% \subsection{Greek letters} |
| 527 |
% |
| 528 |
% Load the \software{fixmath} \cite{fixmath} and \software{alphabeta} \cite{alphabeta} packages ensuring that upper Greek letters in math mode are italic and providing upright Greek letters in text mode, respectively. |
| 529 |
% \begin{macrocode} |
| 530 |
\ifhepmathfont@symbols |
| 531 |
\RequirePackage{amssymb} |
| 532 |
\RequirePackage{amstext} |
| 533 |
\RequirePackage{fixmath} |
| 534 |
\RequirePackage{alphabeta} |
| 535 |
% \end{macrocode} |
| 536 |
% Define the "hep@greek" macro ensuring that both "\text" and "\mathrm" produce upright Greek letters using the \software{amssymb} \cite{amssymb} and \software{amstext} \cite{amstext} packages. |
| 537 |
% \begin{macrocode} |
| 538 |
\newcommand*\hep@greek[2]{% |
| 539 |
\TextOrMath{#1}{\ifnum\fam=0 \text{#1}\else#2\fi}% |
| 540 |
} |
| 541 |
\AtBeginDocument{ |
| 542 |
\renewcommand*{\alpha}{\hep@greek{\textalpha}{\mathalpha}} |
| 543 |
\renewcommand*{\beta}{\hep@greek{\textbeta}{\mathbeta}} |
| 544 |
\renewcommand*{\gamma}{\hep@greek{\textgamma}{\mathgamma}} |
| 545 |
\renewcommand*{\delta}{\hep@greek{\textdelta}{\mathdelta}} |
| 546 |
\renewcommand*{\epsilon}{\hep@greek{\textepsilon}{\mathepsilon}} |
| 547 |
\renewcommand*{\zeta}{\hep@greek{\textzeta}{\mathzeta}} |
| 548 |
\renewcommand*{\eta}{\hep@greek{\texteta}{\matheta}} |
| 549 |
\renewcommand*{\theta}{\hep@greek{\texttheta}{\maththeta}} |
| 550 |
\renewcommand*{\iota}{\hep@greek{\textiota}{\mathiota}} |
| 551 |
\renewcommand*{\kappa}{\hep@greek{\textkappa}{\mathkappa}} |
| 552 |
\renewcommand*{\lambda}{\hep@greek{\textlambda}{\mathlambda}} |
| 553 |
\renewcommand*{\mu}{\hep@greek{\textmu}{\mathmu}} |
| 554 |
\renewcommand*{\nu}{\hep@greek{\textnu}{\mathnu}} |
| 555 |
\renewcommand*{\xi}{\hep@greek{\textxi}{\mathxi}} |
| 556 |
\renewcommand*{\pi}{\hep@greek{\textpi}{\mathpi}} |
| 557 |
\renewcommand*{\rho}{\hep@greek{\textrho}{\mathrho}} |
| 558 |
\renewcommand*{\sigma}{\hep@greek{\textsigma}{\mathsigma}} |
| 559 |
\renewcommand*{\finalsigma}{\hep@greek{\textfinalsigma}{\mathvarsigma}} |
| 560 |
\renewcommand*{\tau}{\hep@greek{\texttau}{\mathtau}} |
| 561 |
\renewcommand*{\upsilon}{\hep@greek{\textupsilon}{\mathupsilon}} |
| 562 |
\renewcommand*{\phi}{\hep@greek{\textphi}{\mathphi}} |
| 563 |
\renewcommand*{\chi}{\hep@greek{\textchi}{\mathchi}} |
| 564 |
\renewcommand*{\psi}{\hep@greek{\textpsi}{\mathpsi}} |
| 565 |
\renewcommand*{\omega}{\hep@greek{\textomega}{\mathomega}} |
| 566 |
\renewcommand*{\digamma}{\hep@greek{\textdigamma}{\mathdigamma}} |
| 567 |
\renewcommand*{\varpi}{\hep@greek{\textpisymbol}{\mathvarpi}} |
| 568 |
\renewcommand*{\varrho}{\hep@greek{\textrhosymbol}{\mathvarrho}} |
| 569 |
\renewcommand*{\rhosymbol}{\hep@greek{\textrhosymbol}{\mathvarrho}} |
| 570 |
\renewcommand*{\vartheta}{\hep@greek{\textthetasymbol}{\mathvartheta}} |
| 571 |
\renewcommand*{\varepsilon}{\hep@greek{\textepsilon}{\mathvarepsilon}} |
| 572 |
\renewcommand*{\epsilonsymbol}{% |
| 573 |
\hep@greek{\textepsilonsymbol}{\mathepsilon}% |
| 574 |
} |
| 575 |
\renewcommand*{\varphi}{\hep@greek{\textphi}{\mathvarphi}} |
| 576 |
\renewcommand*{\phisymbol}{\hep@greek{\textphisymbol}{\mathphi}} |
| 577 |
\ifdefined\mathvarbeta |
| 578 |
\renewcommand*{\varbeta}{\hep@greek{\textbetasymbol}{\mathvarbeta}} |
| 579 |
\else |
| 580 |
\renewcommand*{\varbeta}{\textbetasymbol} |
| 581 |
\fi |
| 582 |
\ifdefined\mathvarkappa |
| 583 |
\renewcommand*{\varkappa}{\hep@greek{\textkappasymbol}{\mathvarkappa}} |
| 584 |
\else |
| 585 |
\renewcommand*{\varkappa}{\textkappasymbol} |
| 586 |
\fi |
| 587 |
\ifdefined\mathvarTheta |
| 588 |
\renewcommand*{\varTheta}{\hep@greek{\textTheta}{\mathvarTheta}} |
| 589 |
\else |
| 590 |
\renewcommand*{\varTheta}{\textTheta} |
| 591 |
\fi |
| 592 |
\renewcommand*{\Thetasymbol}{\textThetasymbol} |
| 593 |
} |
| 594 |
% \end{macrocode} |
| 595 |
% Ensure that this works also after loading other fonts packages such as \software{cfr-lm}. |
| 596 |
% \begin{macrocode} |
| 597 |
\AtBeginDocument{\@ifpackageloaded{nfssext-cfr}{ |
| 598 |
\DeclareFontFamily{LGR}{clmj}{} |
| 599 |
\DeclareFontFamilySubstitution{LGR}{clmj}{lmr} |
| 600 |
\DeclareFontFamily{LGR}{clm2j}{} |
| 601 |
\DeclareFontFamilySubstitution{LGR}{clm2j}{lmr} |
| 602 |
\DeclareFontFamily{LGR}{clm2}{} |
| 603 |
\DeclareFontFamilySubstitution{LGR}{clm2}{lmr} |
| 604 |
\DeclareFontFamily{LGR}{clm2s}{} |
| 605 |
\DeclareFontFamilySubstitution{LGR}{clm2s}{lmss} |
| 606 |
\DeclareFontFamily{LGR}{clm2js}{} |
| 607 |
\DeclareFontFamilySubstitution{LGR}{clm2js}{lmss} |
| 608 |
\DeclareFontFamily{LGR}{clmjs}{} |
| 609 |
\DeclareFontFamilySubstitution{LGR}{clmjs}{lmss} |
| 610 |
}{}} |
| 611 |
% \fi |
| 612 |
% \end{macrocode} |
| 613 |
% |
| 614 |
% \subsection{Additional math fonts} |
| 615 |
% |
| 616 |
% Either load the \software{MnSymbol} package \cite{MnSymbol} or the the \software{exscale} package \cite{exscale} in order to fix Latin Modern "lmex" fonts. |
| 617 |
% Additionally, load the \software{amssymb} package \cite{amsfonts} which provides further math symbols and also loads the \software{amsfonts} package \cite{amsfonts}. |
| 618 |
% \begin{macrocode} |
| 619 |
\ifhep@minion |
| 620 |
\RequirePackage{MnSymbol} |
| 621 |
\else |
| 622 |
\RequirePackage{exscale} |
| 623 |
\RequirePackage{amssymb} |
| 624 |
\fi |
| 625 |
% \end{macrocode} |
| 626 |
% |
| 627 |
% \begin{macro}{\mathbf} |
| 628 |
% Load the \software{bm} package \cite{bm} for superior boldmath. |
| 629 |
% Make math symbols bold whenever they appear in bold macros such as "\section"\marg{text}. |
| 630 |
% \begin{macrocode} |
| 631 |
\RequirePackage{bm} |
| 632 |
\AtBeginDocument{\let\mathbf\bm} |
| 633 |
\g@addto@macro\bfseries{\boldmath} |
| 634 |
% \end{macrocode} |
| 635 |
% \end{macro} |
| 636 |
% |
| 637 |
% \begin{macro}{\mathtt} |
| 638 |
% Typewriter math font |
| 639 |
% \begin{macrocode} |
| 640 |
\DeclareMathAlphabet{\mathtt}{OT1}{lmtt}{m}{n} |
| 641 |
\SetMathAlphabet{\mathtt}{bold}{OT1}{lmtt}{bx}{n} |
| 642 |
% \end{macrocode} |
| 643 |
% \end{macro} |
| 644 |
% |
| 645 |
% \begin{macro}{\mathscr} |
| 646 |
% Provid the "\mathscr" math script font from the \software{mathrsfs} package \cite{mathrsfs}. |
| 647 |
% \begin{macrocode} |
| 648 |
\DeclareMathAlphabet{\mathscr}{U}{rsfs}{m}{n} |
| 649 |
% \end{macrocode} |
| 650 |
% \end{macro} |
| 651 |
% \begin{macro}{\mathbb} |
| 652 |
% Redefine the the "\mathbb" math blackboard style font according to the \prefix{sans}{serif} option with the font from the \software{dsfont} package \cite{dsfont}. |
| 653 |
% \begin{macrocode} |
| 654 |
\ifhep@minion |
| 655 |
\DeclareMathAlphabet{\mathbb}{U}{% |
| 656 |
\ifhepmathfont@serif dsrom\else dsss\fi% |
| 657 |
}{m}{n} |
| 658 |
\else |
| 659 |
\ifhep@ams\else |
| 660 |
\SetMathAlphabet{\mathbb}{normal}{U}{% |
| 661 |
\ifhepmathfont@serif dsrom\else dsss\fi% |
| 662 |
}{m}{n} |
| 663 |
\fi |
| 664 |
\fi |
| 665 |
% \end{macrocode} |
| 666 |
% End of symbols conditional. |
| 667 |
% \begin{macrocode} |
| 668 |
\fi |
| 669 |
% \end{macrocode} |
| 670 |
% End of xetex conditional. |
| 671 |
% \begin{macrocode} |
| 672 |
\fi |
| 673 |
% \end{macrocode} |
| 674 |
% \end{macro} |
| 675 |
% |
| 676 |
%</package> |
| 677 |
% |
| 678 |
% \section{Tests} |
| 679 |
% |
| 680 |
%<*testserif|testsans> |
| 681 |
% |
| 682 |
% \begin{macrocode} |
| 683 |
\documentclass{article} |
| 684 |
|
| 685 |
%<testserif>\usepackage[oldstyle]{hep-font} |
| 686 |
%<testsans>\usepackage[oldstyle,sans]{hep-font} |
| 687 |
\usepackage{hep-math-font} |
| 688 |
|
| 689 |
\usepackage{fancyvrb}\DefineShortVerb{\|} |
| 690 |
\newenvironment{vrb}{\begin{tabular}{@{}p{6cm}l@{}}}{\end{tabular}} |
| 691 |
|
| 692 |
\begin{document} |
| 693 |
|
| 694 |
\begin{vrb} |
| 695 |
|| & $Ab\Gamma\delta123$ \\ |
| 696 |
|\mathbf | & $\mathbf{Ab\Gamma\delta123}$ \\ |
| 697 |
|\mathrm | & $\mathrm{Ab\Gamma\delta123}$ \\ |
| 698 |
| \mathbf | & $\mathbfrm{Ab\Gamma\delta123}$ !! \\ |
| 699 |
|\text | & $\text{Ab\Gamma\delta123}$ \\ |
| 700 |
| \textbf | & $\textbf{\text{Ab\Gamma\delta123}}$ \\ |
| 701 |
|\mathsf | & $\mathsf{Ab\Gamma\delta123}$ \\ |
| 702 |
| \mathbf | & $\mathbfsf{Ab\Gamma\delta123}$ \\ |
| 703 |
|\mathtt | & $\mathtt{Ab\Gamma123}$ \\ |
| 704 |
| \mathbf | & $\mathbf{\mathtt{Ab\Gamma123}}$ \\ |
| 705 |
|\mathcal | & $\mathcal{ABC}$ \\ |
| 706 |
|\mathscr | & $\mathscr{ABC123}$ \\ |
| 707 |
|\mathbb | & $\mathbb{ABC1}$ \\ |
| 708 |
|\mathfrak | & $\mathfrak{ABC123}$ \\ |
| 709 |
\end{vrb} |
| 710 |
|
| 711 |
$\Gamma\Delta\Lambda\Phi\Pi\Psi\Sigma\Theta\Upsilon\Xi\Omega$ |
| 712 |
|
| 713 |
$\mathrm{\Gamma\Delta\Lambda\Phi\Pi\Psi\Sigma\Theta\Upsilon\Xi\Omega}$ |
| 714 |
|
| 715 |
\Gamma\Delta\Lambda\Phi\Pi\Psi\Sigma\Theta\Upsilon\Xi\Omega |
| 716 |
|
| 717 |
$\alpha\beta\gamma\delta\epsilon\zeta\eta\theta\iota\kappa\lambda |
| 718 |
\mu\nu\xi\pi\rho\sigma\varsigma\tau\upsilon\phi\chi\psi\omega$ |
| 719 |
|
| 720 |
$\mathrm{\alpha\beta\gamma\delta\epsilon\zeta\eta\theta\iota\kappa\lambda |
| 721 |
\mu\nu\xi\pi\rho\sigma\varsigma\tau\upsilon\phi\chi\psi\omega}$ |
| 722 |
|
| 723 |
\alpha\beta\gamma\delta\epsilon\zeta\eta\theta\iota\kappa\lambda |
| 724 |
\mu\nu\xi\pi\rho\sigma\varsigma\tau\upsilon\phi\chi\psi\omega |
| 725 |
|
| 726 |
\end{document} |
| 727 |
% \end{macrocode} |
| 728 |
% |
| 729 |
%</testserif|testsans> |
| 730 |
% |
| 731 |
% \section{Readme} |
| 732 |
% |
| 733 |
%<*readme> |
| 734 |
% |
| 735 |
% \begin{macrocode} |
| 736 |
# The `hep-math-font` package |
| 737 |
|
| 738 |
Extended Greek and sans-serif math |
| 739 |
|
| 740 |
## Introduction |
| 741 |
|
| 742 |
The `hep-math-font` package adjust the math fonts to be sans-serif if the |
| 743 |
document is sans-serif. Additionally Greek letters are redefined to be |
| 744 |
always italic and upright in math and text mode respectively. Some math |
| 745 |
font macros are adjusted to give more consistently the naively expected |
| 746 |
results. |
| 747 |
|
| 748 |
The package is loaded using `\usepackage{hep-math-font}`. |
| 749 |
|
| 750 |
## Author |
| 751 |
|
| 752 |
Jan Hajer |
| 753 |
|
| 754 |
## License |
| 755 |
|
| 756 |
This file may be distributed and/or modified under the conditions of the |
| 757 |
`LaTeX` Project Public License, either version 1.3c of this license or |
| 758 |
(at your option) any later version. The latest version of this license is |
| 759 |
in `http://www.latex-project.org/lppl.txt` and version 1.3c or later is |
| 760 |
part of all distributions of LaTeX version 2005/12/01 or later. |
| 761 |
% \end{macrocode} |
| 762 |
% |
| 763 |
%</readme> |
| 764 |
% |
| 765 |
% \Finale |
| 766 |
|
| 767 |
\endinput |
| 768 |
|
| 769 |
% \PrintIndex |
| 770 |
% makeindex -s gglo.ist -o hep-math-font-implementation.gls hep-math-font-implementation.glo |
| 771 |
% makeindex -s gglo.ist -o hep-math-font-implementation.ind hep-math-font-implementation.idx |