Debian Codegraph @

texmf-dist/doc/latex/maybemath/maybemath.tex

raw
1 \documentclass[12pt]{article}
2 %\usepackage{setspace}
3 %\usepackage{booktabs}
4 \usepackage{maybemath, xspace}
5 \newcommand{\maybemath}{\texttt{maybemath}\xspace}
6
7 \author{Andy Buckley, \texttt{[email protected]}}
8 \title{The \maybemath package for \LaTeX}
9
10 \newcommand{\manifestsAs}{\ensuremath{\Rightarrow\quad}\xspace}
11 \newcommand{\texcommand}[1]{\texttt{\ensuremath{\backslash{}}{#1}}\xspace}
12 \newcommand{\texarg}[1]{\ensuremath{\!}\texttt{\{}\textit{#1}\texttt{\}}\xspace}
13 \newcommand{\maybebmName}{\texcommand{maybebm}}
14 \newcommand{\maybermName}{\texcommand{mayberm}}
15 \newcommand{\maybeitName}{\texcommand{maybeit}}
16 \newcommand{\maybeitrmName}{\texcommand{maybeitrm}}
17 \newcommand{\maybeitsubscriptName}{\texcommand{maybeitsubscript}}
18 \newcommand{\maybesfName}{\texcommand{maybesf}}
19 \newcommand{\maybebmsfName}{\texcommand{maybebmsf}}
20 \newcommand{\maybemathName}{\texcommand{maybemath}}
21
22 \begin{document}
23 \maketitle
24
25 The \maybemath package provides a set of commands for adjusting math-mode
26 typesetting to match the context of the surrounding paragraph. This includes
27 making the math-mode text bold, upright, forced italic or sans-serif according
28 to context, or any combination of these. It can be particularly useful when math
29 terms must appear in section headings, as this implies the same expression
30 appearing in several boldness contexts: the heading itself, the table of
31 contents and perhaps a page header or footer. Typically this has been resolved
32 manually by use of the optional second argument of the sectioning commands:
33 \maybemath provides a more seamless solution.
34
35 This package was developed in order to implement the \texttt{hepparticles}
36 package, used for typesetting high-energy physics particle names.
37 % The commands are intended more for use in flexible macro definitions than
38 % for direct use in documents, hence the command names are quite verbose.
39
40 The commands available are defined below. In general they may be nested and can
41 take arbitrarily large arguments within a single math expression. The term to
42 watch in the expressions below is the $x^3$:
43
44 \section{Bold contexts}
45 \begin{itemize}
46 \item For context-sensitive boldness use \maybebmName\texarg{expr}:\\
47 {\verb|\dots foo bar, $x^2 + \maybebm{x^3} + \dotsb$|}\\ \manifestsAs {\dots foo bar, $x^2 + \maybebm{x^3} + \dotsb$}\\
48 {\verb|\textbf{\dots foo bar, $x^2 + \maybebm{x^3} + \dotsb$}|}\\ \manifestsAs \textbf{\dots foo bar, $x^2 + \maybebm{x^3} + \dotsb$}
49 \end{itemize}
50
51
52 \section{Upright and italic contexts}
53 \begin{itemize}
54 \item For context-sensitive upright math typesetting use \maybermName\texarg{expr}:\\
55 {\verb|\dots foo bar, $x^2 + \mayberm{x^3} + \dotsb$|}\\ \manifestsAs {\dots foo bar, $x^2 + \mayberm{x^3} + \dotsb$}\\
56 {\verb|\textit{\dots foo bar, $x^2 + \mayberm{x^3} + \dotsb$}|}\\ \manifestsAs \textit{\dots foo bar, $x^2 + \mayberm{x^3} + \dotsb$}
57
58 \item Alternatively, to force \texcommand{mathit} in italic contexts use \maybeitName\texarg{expr}:\\
59 {\verb|\dots foo bar, $x^2 + \maybeit{x^3} + \dotsb$|}\\ \manifestsAs {\dots foo bar, $x^2 + \maybeit{x^3} + \dotsb$}\\
60 {\verb|\textit{\dots foo bar, $x^2 + \maybeit{x^3} + \dotsb$}|}\\ \manifestsAs \textit{\dots foo bar, $x^2 + \maybeit{x^3} + \dotsb$}
61
62 \item The functionality of both \maybermName and \maybeitName is combined for convenience in the command \maybeitrmName\texarg{expr}:\\
63 {\verb|\dots foo bar, $x^2 + \maybeitrm{x^3} + \dotsb$|}\\ \manifestsAs {\dots foo bar, $x^2 + \maybeitrm{x^3} + \dotsb$}\\
64 {\verb|\textit{\dots foo bar, $x^2 + \maybeitrm{x^3} + \dotsb$}|}\\ \manifestsAs \textit{\dots foo bar, $x^2 + \maybeitrm{x^3} + \dotsb$}
65
66 \item An extra command is available for adjusting the spacing of subscripts in italic contexts: they are shifted
67 to the left if wrapped with the command \maybeitsubscriptName\texarg{expr}:\\
68 {\verb|\dots foo bar, $\mayberm{B_d^0} \to \|\\\verb|\mayberm{B_\maybeitsubscript{d}^0}$|}\\ \manifestsAs {\dots foo bar, $\mayberm{B_d^0} \to \mayberm{B_\maybeitsubscript{d}^0}$}\\
69 {\verb|\textit{\dots foo bar, $\mayberm{B_d^0} \to \|\\\verb|\mayberm{B_\maybeitsubscript{d}^0}$}|}\\ \manifestsAs \textit{\dots foo bar, $\mayberm{B_d^0} \to \mayberm{B_\maybeitsubscript{d}^0}$}\\
70 I'm not aware if there are particular uses for this outside the pickinesses of particle-name typesetting but it \emph{may} be useful!
71 \end{itemize}
72
73
74 \section{Sans-serif contexts}
75 \begin{itemize}
76 \item For context-sensitive sans-serif math typesetting use \maybesfName\texarg{expr}:\\
77 {\verb|\dots foo bar, $x^2 + \maybesf{x^3} + \dotsb$|}\\ \manifestsAs {\dots foo bar, $x^2 + \maybesf{x^3} + \dotsb$}\\
78 {\verb|\textsf{\dots foo bar, $x^2 + \maybesf{x^3} + \dotsb$}|}\\ \manifestsAs \textsf{\dots foo bar, $x^2 + \maybesf{x^3} + \dotsb$}\\
79 Note that there is no italic version of the sans-serif math font, so use of \maybesfName eliminates italic context handling.
80 \end{itemize}
81
82
83 \section{Combined contexts}
84 \begin{itemize}
85 \item For combined bold-and-sans-serif context handling, a \maybebmsfName\texarg{expr} command is provided:\\
86 {\verb|\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$|}\\ \manifestsAs {\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$}\\
87 {\verb|\textbf{\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$}|}\\ \manifestsAs \textbf{\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$}\\
88 {\verb|\textsf{\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$}|}\\ \manifestsAs \textsf{\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$}\\
89 {\verb|\textbf{\textsf{\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$}}|}\\ \manifestsAs \textbf{\textsf{\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$}}\\
90 This is assumed to be the most commonly required combination of context-sensitive math typesetting: most other combinations can be achieved by nesting the primitive \maybemath commands.
91 \end{itemize}
92
93 %Finally, a \maybemathName command is provided for typesetting the name of the package:
94 %{\verb|\maybemath|} \manifestsAs \maybemath.\\
95
96 \noindent Any feedback is appreciated! Email to \texttt{[email protected]}, please.
97
98 \end{document}