| 1 |
%&LaTeX |
| 2 |
\def\AmS{{$\mathcal A$\kern-.1667em |
| 3 |
\lower.5ex\hbox{$\mathcal M$}\kern-.125em$\mathcal S$}} |
| 4 |
|
| 5 |
\documentclass{article} |
| 6 |
\usepackage{nath} |
| 7 |
\nathstyle{geometry} |
| 8 |
\mathindent=4pc |
| 9 |
|
| 10 |
\makeatletter |
| 11 |
\def \@listI{\leftmargin 3ex \topsep 4pt \partopsep 0pt |
| 12 |
\itemsep 0pt \parsep 0pt \listparindent 0pt} |
| 13 |
\makeatother |
| 14 |
|
| 15 |
\def\To#1\endTo{\hbox to 4cm{$\displayed{#1}$\hss} \hbox{$#1$}} |
| 16 |
\newcounter{p} |
| 17 |
\def\sect#1{\refstepcounter{p} \paragraph{\S\arabic{p}. #1.}} |
| 18 |
\def\capt#1#2{{\small Table #1: #2}} |
| 19 |
\def\stuff#1{\hbox{\vrule height 1.5ex depth .3ex width 0ex}% |
| 20 |
\raise .6mm\vbox{\hrule width #1 height .5mm}} |
| 21 |
\setbox0\hbox{\tt ????} |
| 22 |
\catcode`\?=0 |
| 23 |
\def????{\leavevmode\hbox to\wd0{\hss\it stuff\/\hss}} |
| 24 |
\def\sref"#1"{\S\ref{#1}} |
| 25 |
\def\refname{{\normalsize\bf References}} |
| 26 |
|
| 27 |
\begin{document} |
| 28 |
|
| 29 |
\title{A Short Guide to Nath} |
| 30 |
|
| 31 |
\author{M. Marvan} |
| 32 |
\date{14 February 2003} |
| 33 |
|
| 34 |
\maketitle |
| 35 |
%\end{document} |
| 36 |
|
| 37 |
|
| 38 |
\sect{Annotation} |
| 39 |
Nath is a \LaTeX\ style to separate presentation and content in mathematical |
| 40 |
typography. |
| 41 |
The style delivers a particular context-dependent presentation on the |
| 42 |
basis of a rather coarse context-independent notation. |
| 43 |
Although essentially backward compatible with \LaTeX, |
| 44 |
Nath aims at producing traditional math typography even from sources |
| 45 |
devoid of aesthetic ambitions. |
| 46 |
Its name is derived from ``{\it na\/}tural ma{\it th\/} notation'' |
| 47 |
(see~\cite{EuroTeX}). |
| 48 |
|
| 49 |
|
| 50 |
\sect{License} |
| 51 |
Nath is a free software distributed under the terms of the GNU General |
| 52 |
Public License, see \verb"http://www.gnu.org/copyleft/gpl.html". |
| 53 |
|
| 54 |
|
| 55 |
\sect{Usage} |
| 56 |
To install Nath, put the \verb"nath.sty" file into the \TeX\ input |
| 57 |
directory. |
| 58 |
A \LaTeX~2.09 document may start like |
| 59 |
\begin{verbatim} |
| 60 |
\documentstyle[nath]{article} |
| 61 |
\end{verbatim} |
| 62 |
Under \LaTeX~2$_{\varepsilon}$, the effect is achieved with |
| 63 |
\begin{verbatim} |
| 64 |
\documentclass{article} |
| 65 |
\usepackage{nath} |
| 66 |
\end{verbatim} |
| 67 |
Nath does not introduce any new fonts. |
| 68 |
See \sref "OtherPackages" for combining Nath and other \LaTeX\ |
| 69 |
styles. |
| 70 |
|
| 71 |
|
| 72 |
\sect{Local options} \label{LocalOptions} |
| 73 |
A few Nath options may be set in the body of a document. |
| 74 |
The command \verb"\nathstyle" accepts a list of arguments of the form |
| 75 |
`{\it name\/}\verb"="{\it value}' or `{\it name}'; the latter having the |
| 76 |
same meaning as `{\it name\/}\verb"=on"'. |
| 77 |
Currently supported options are |
| 78 |
\verb"geometry" (see \sref"Delimiters"), |
| 79 |
\verb"tensors" (see \sref"Tensors"), |
| 80 |
\verb"leqno" (see \sref"EquationNumbering"), |
| 81 |
and \verb"silent" (see \sref"ErrorsWarnings"). |
| 82 |
|
| 83 |
|
| 84 |
\sect{Errors and warnings}\label{ErrorsWarnings} |
| 85 |
Nath errors are visualized by $\natherrormark$ (or whatever is |
| 86 |
\verb"\natherrormark") placed where the error manifests itself |
| 87 |
(which may look misplaced). |
| 88 |
Unlike errors, Nath warnings appear only in the \verb"log" file and |
| 89 |
do so only if the local option (see \sref"LocalOptions") \verb"silent" |
| 90 |
is set to \verb"on". |
| 91 |
|
| 92 |
Be aware that once admissible constructions may produce \TeX\ errors now. |
| 93 |
E.g., superfluous braces may be harmful in math formulas except |
| 94 |
around macro arguments. |
| 95 |
Therefore, \verb"{" and \verb"}" should be used just where something |
| 96 |
(a~sub- or superscript, a numerator, a denominator, and similar) |
| 97 |
begins or ends. |
| 98 |
|
| 99 |
|
| 100 |
\sect{Math modes}\label{MathModes} |
| 101 |
\Nath\ uses two distinct math modes. |
| 102 |
The single dollar sign \verb"$" invokes the {\it in-line\/} mode. |
| 103 |
The double dollar sign \verb"$$" as well as other math environments |
| 104 |
invoke the {\it display\/} mode. |
| 105 |
|
| 106 |
Observe the difference: |
| 107 |
\verb"$(1 + \frac xy)^2$" typesets as $(1 + \frac xy)^2$, while |
| 108 |
\begin{verbatim} |
| 109 |
$$ |
| 110 |
(1 + \frac xy)^2 |
| 111 |
$$ |
| 112 |
\end{verbatim} |
| 113 |
typesets as |
| 114 |
$$ |
| 115 |
(1 + \frac xy)^2, |
| 116 |
$$ |
| 117 |
even though the notation is one and the same. |
| 118 |
|
| 119 |
Commands \verb"\inline" and \verb"\displayed" force either mode |
| 120 |
on a subexpression. |
| 121 |
Sub- and superscripts are normally typeset in in-line mode; but |
| 122 |
\begin{verbatim} |
| 123 |
$$ |
| 124 |
(\sum_{i=1}^n x_i^p)^{\displayed{\frac 1p}} |
| 125 |
$$ |
| 126 |
\end{verbatim} |
| 127 |
produces the {\it display} mode in the {\it script\/} size: |
| 128 |
\nathstyle{debug} |
| 129 |
$$ |
| 130 |
(\sum_{i=1}^n x_i^p)^{\displayed{\frac 1p}}. |
| 131 |
$$ |
| 132 |
Never leave delimiters un\verb"\displayed" in these cases. |
| 133 |
|
| 134 |
The four math style switches of \TeX\ newly refer only to the |
| 135 |
{\it size} of math expressions: |
| 136 |
\verb"\scriptstyle" and \verb"\scriptscriptstyle" to the script |
| 137 |
and second-level-script size of the {\it current\/} size; |
| 138 |
\verb"\textstyle" is void; whereas \verb"\displaystyle" has a special |
| 139 |
meaning in the context of the principle of smallest fences |
| 140 |
(see~\sref "DisplayedFractions"). |
| 141 |
|
| 142 |
|
| 143 |
\sect{Fractions} \label{Fractions} |
| 144 |
Fractions indicate division in a very broad sense |
| 145 |
(cf.~$\frac{\partial f}{\partial x}$) and may occur in three shapes: |
| 146 |
$$ |
| 147 |
\text{built-up \ } \frac AB, |
| 148 |
\qquad |
| 149 |
\text{piece } \hbox{ $\frac 12$}, |
| 150 |
\qquad |
| 151 |
\text{solidus } \hbox{ $\frac AB$}. |
| 152 |
$$ |
| 153 |
\Nath\ provides a single universal command \verb"\frac" |
| 154 |
(besides of the obvious slash, `\verb"/"'). |
| 155 |
The resulting shape is determined by special algorithms |
| 156 |
(see~\cite{EuroTeX}). |
| 157 |
|
| 158 |
|
| 159 |
\sect{Displayed fractions} \label{DisplayedFractions} |
| 160 |
Non-numeric fractions come out as built up. |
| 161 |
According to what we call the {\it principle of smallest fences}, |
| 162 |
numeric fractions are typeset built up if and only if this does not |
| 163 |
extend any paired delimiters. |
| 164 |
E.g., |
| 165 |
\begin{verbatim} |
| 166 |
$$ |
| 167 |
(\frac 12 + x)(\frac 12 + \frac 1x) |
| 168 |
$$ |
| 169 |
\end{verbatim} |
| 170 |
results in |
| 171 |
$$ |
| 172 |
(\frac 12 + x)(\frac 12 + \frac 1x). |
| 173 |
$$ |
| 174 |
One can circumvent the rule in two possible ways. |
| 175 |
\paritem{(i)} |
| 176 |
In order to force a built-up fraction, place \verb"\displaystyle" anywhere |
| 177 |
within the nearest pair of delimiters. |
| 178 |
E.g., |
| 179 |
$$ |
| 180 |
(\frac 12 + x\displaystyle)(\frac 12 + \frac 1x) |
| 181 |
$$ |
| 182 |
results from |
| 183 |
\begin{verbatim} |
| 184 |
$$ |
| 185 |
(\frac 12 + x\displaystyle)(\frac 12 + \frac 1x) |
| 186 |
$$ |
| 187 |
\end{verbatim} |
| 188 |
\paritem{(ii)} |
| 189 |
In order to force a case fraction, insert an extra pair of invisible |
| 190 |
delimiters. E.g., |
| 191 |
$$ |
| 192 |
\int x\,dx = \left. \frac12 x^2 \right. |
| 193 |
$$ |
| 194 |
results from |
| 195 |
\begin{verbatim} |
| 196 |
$$ |
| 197 |
\int x\,dx = \left. \frac12 x^2 \right. |
| 198 |
$$ |
| 199 |
\end{verbatim} |
| 200 |
{\it Compound fractions} have their numerator and denominator in display |
| 201 |
mode: |
| 202 |
$$ |
| 203 |
\frac{1 + \frac xy}{1 - \frac xy}. |
| 204 |
$$ |
| 205 |
One can, of course, force the in-line mode. Namely, |
| 206 |
\begin{verbatim} |
| 207 |
$$ |
| 208 |
\frac{\inline{1 + \frac xy}}{\inline{1 - \frac xy}} |
| 209 |
$$ |
| 210 |
\end{verbatim} |
| 211 |
or, even better, |
| 212 |
\begin{verbatim} |
| 213 |
\newcommand\ifrac[2]{\frac{\inline{#1}}{\inline{#2}}} |
| 214 |
$$ |
| 215 |
\ifrac{1 + \frac xy}{1 - \frac xy} |
| 216 |
$$ |
| 217 |
\end{verbatim} |
| 218 |
(cf. \sref"UserDefinitions") typesets as |
| 219 |
\newcommand\ifrac[2]{\frac{\inline{#1}}{\inline{#2}}} |
| 220 |
$$ |
| 221 |
\ifrac{1 + \frac xy}{1 - \frac xy}. |
| 222 |
$$ |
| 223 |
|
| 224 |
|
| 225 |
\sect{In-line fractions} |
| 226 |
A \verb"\frac" with numeric arguments results in a case fraction, such |
| 227 |
as the Bernoulli number $B_{12} = -\frac {691}{2730}$. |
| 228 |
Otherwise we get a solidus fraction and parentheses are added whenever |
| 229 |
needed for preservation of the mathematical meaning. |
| 230 |
E.g., |
| 231 |
\begin{verbatim} |
| 232 |
$\frac{\frac ab}{\frac cd}$ |
| 233 |
\end{verbatim} |
| 234 |
produces $\frac{\frac ab}{\frac cd}$. |
| 235 |
|
| 236 |
Examples below present one and the same expression in display and in-line |
| 237 |
mode. |
| 238 |
Roughly speaking, Nath assumes that binary operations other than slash |
| 239 |
have less binding power than the slash, |
| 240 |
$$ |
| 241 |
\To \frac{a + b}{c + d} \endTo, \\ |
| 242 |
\To \frac {\frac {a \cdot b}{c} \cdot d}{c \cdot d} \endTo, \\ |
| 243 |
\To x + \frac ab \endTo. |
| 244 |
$$ |
| 245 |
In particular, this rule applies to the binary operations of commutative |
| 246 |
algebra: |
| 247 |
$$ |
| 248 |
\To \frac AB \otimes \frac CD \endTo, \\ |
| 249 |
\To \frac{A \otimes B}{C \otimes D} \endTo, |
| 250 |
$$ |
| 251 |
even though existing tradition may be different in this particular case. |
| 252 |
On the other side, {\it juxtaposition} has more binding power than the |
| 253 |
slash: |
| 254 |
$$ |
| 255 |
\To \frac ab \frac cd \endTo, \\ |
| 256 |
\To \frac {\partial}{\partial x} \frac fg \endTo, \\ |
| 257 |
\To d\frac uv \endTo, \\ |
| 258 |
\To \frac {\partial^3 f}{\partial x \,\partial y^2} \endTo, \\ |
| 259 |
\To \frac a{bc} \endTo. |
| 260 |
$$ |
| 261 |
Nath only avoids inserting parentheses between a |
| 262 |
fraction and a numeric coefficient, e.g., |
| 263 |
$$ |
| 264 |
\To -\frac uv + 2\frac uv - \frac 12 \frac ab \endTo, |
| 265 |
$$ |
| 266 |
unless there is a danger of confusion, e.g., |
| 267 |
$$ |
| 268 |
\To 2\frac {\pm u}{v} \endTo. |
| 269 |
$$ |
| 270 |
In case of loose juxtaposition between operator and its argument, |
| 271 |
there is no obvious winner, thus |
| 272 |
$$ |
| 273 |
\To \frac{\sin x}{2} + \sin\frac x2\endTo. |
| 274 |
$$ |
| 275 |
Of course, no parentheses will be inserted when they are already present |
| 276 |
in one or another form: |
| 277 |
$$ |
| 278 |
\To A [\frac uv]^2 \endTo, \\ |
| 279 |
\To \frac{(x,y)}{\lVert x \rVert\,\lVert y \rVert} \endTo |
| 280 |
$$ |
| 281 |
(the last example uses \verb"\lVert x \rVert \, \lVert y \rVert" in the |
| 282 |
denominator). |
| 283 |
|
| 284 |
Grouping prevents Nath from adding parentheses around the whole fraction: |
| 285 |
\verb"$a{\frac bc}$" typesets as $a{\frac bc}$, otherwise as $a\frac bc$. |
| 286 |
To be on the safe side, avoid superfluous braces in math formulas |
| 287 |
(cf.~\sref"ErrorsWarnings"). |
| 288 |
|
| 289 |
To disable parentheses around the numerator or denominator, |
| 290 |
a pair of invisible parentheses is needed: |
| 291 |
\verb"$\frac{\left.\sin x\right.}{\cos x}$" typesets as |
| 292 |
$\frac{\left.\sin x\right.}{\cos x}$, otherwise as |
| 293 |
$\frac{\sin x}{\cos x}$. |
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
An important remark is due. |
| 298 |
Professional typographers generally follow the rule that `$a/bc$ means |
| 299 |
$a$ divided by $bc$.' |
| 300 |
Still some mathematicians (especially those with a programming background) |
| 301 |
argue that if juxtaposition denotes multiplication, then $a/bc$ means |
| 302 |
$a/b \cdot c$, which is $(a/b) \cdot c$ by the commonly accepted rules of |
| 303 |
precedence. |
| 304 |
However, $ab$ and $a \cdot b$ are different notations and it is the |
| 305 |
notation what matters in typography. |
| 306 |
Yet the AIP style manual~\cite{AIP} is cautious enough to say just: |
| 307 |
``do not write $\frac 1{3x}$ unless you mean $\frac 1{(3x)}$.'' |
| 308 |
Altogether, notation $a/bc$ is considered ambiguous by a nonignorable part |
| 309 |
of the mathematical community. |
| 310 |
Then, at least, the choices made by Nath are known, traditional, and easy |
| 311 |
to remember. |
| 312 |
|
| 313 |
And, of course, it is never unwise to display difficult fractions. |
| 314 |
|
| 315 |
|
| 316 |
\sect{Delimiters} \label{Delimiters} |
| 317 |
\TeX's \verb"\left" and \verb"\right" produce rather poor results, |
| 318 |
especially when overused or underused. |
| 319 |
Under natural notation, every fence is a left or right delimiter by its |
| 320 |
very nature, and delimiters do their best to match the material enclosed: |
| 321 |
$$ |
| 322 |
\frac M |
| 323 |
{(1 - \frac {x_1 + \cdots + x_n + pZ} r) |
| 324 |
(1 - p \frac{\frac{\partial Z}{\partial x_2} + \cdots |
| 325 |
+ \frac{\partial Z}{\partial x_n}} \rho)}. |
| 326 |
$$ |
| 327 |
For matching purposes, every Nath mathematical object is assigned an |
| 328 |
auxiliary height and depth; sub- and superscripts as well as accents |
| 329 |
do not contribute to these dimensions, hence ``small parts'' may exceed |
| 330 |
the fences: |
| 331 |
$$ |
| 332 |
(\tilde P - \tilde Q) |
| 333 |
(1 + \prod_{i = 1}^{\lfloor \sqrt n \rfloor} p_i)^2. |
| 334 |
$$ |
| 335 |
Needless to say, line breaks are allowed between delimiters. E.g., |
| 336 |
$$ |
| 337 |
\sin 2nx = 2n \cos x [\sin x \\ |
| 338 |
\qquad + \sum_{k = 1}^n (-4)^k |
| 339 |
\frac{(n^2 - 1^2)(n^2 - 2^2) \dots (n^2 - k^2)}{(2k - 1)!} |
| 340 |
\sin^{2k - 1} x] |
| 341 |
$$ |
| 342 |
results from the simple |
| 343 |
\begin{verbatim} |
| 344 |
$$ |
| 345 |
\sin 2nx = 2n \cos x [\sin x \\ |
| 346 |
\qquad + \sum_{k = 1}^n (-4)^k |
| 347 |
\frac{(n^2 - 1^2)(n^2 - 2^2) \dots (n^2 - k^2)}{(2k - 1)!} |
| 348 |
\sin^{2k - 1} x] |
| 349 |
$$. |
| 350 |
\end{verbatim} |
| 351 |
The modifiers \verb"\left" and \verb"\right" still |
| 352 |
must be used with symmetric delimiters (e.g., vertical lines $\vert$ and |
| 353 |
$\Vert$) or when intended to override the |
| 354 |
natural disposition (e.g., \verb"\left]"). |
| 355 |
% |
| 356 |
The newly introduced modifiers \verb"\double" and \verb"\triple" create |
| 357 |
double and triple delimiters. E.g., |
| 358 |
\verb"$\double[u_1,\dots,u_n\double]$" produces |
| 359 |
$\double[u_1,\dots,u_n\double]$. |
| 360 |
|
| 361 |
The {\it middle delimiters\/}, such as |
| 362 |
\verb"\mid" and \verb"\middle|" for $\mid$, |
| 363 |
\verb"\Mid" and \verb"\double|" for $\Mid$, and |
| 364 |
\verb"\triple|" for $\triple|$, |
| 365 |
have the size of the nearest outer pair of delimiters. |
| 366 |
For example: |
| 367 |
$$ |
| 368 |
\{ (x_i) \in R^\infty \mid \sum_{i = 1}^\infty x_i^2 = 1\}. |
| 369 |
$$ |
| 370 |
|
| 371 |
With nested delimiters, there are two ways to ensure that outer delimiters |
| 372 |
come out bigger than inner ones. |
| 373 |
In display mode this is controlled by a count \verb"\delimgrowth". |
| 374 |
Setting the \verb"\delimgrowth" to $n$ makes (approx.) |
| 375 |
every $n$th delimiter bigger. |
| 376 |
One should set \verb"\delimgrowth=1" when a display contains many |
| 377 |
vertical bars (and insert extra \verb"\," between adjacent right and |
| 378 |
left bars). |
| 379 |
|
| 380 |
In in-line mode, the {\it command} \verb"\big" has the effect that the |
| 381 |
next entered level of delimiters is set in big size (in the sense of |
| 382 |
plain \TeX). |
| 383 |
It is not necessary that the \verb"\big" is immediately followed by a |
| 384 |
delimiter; and \verb"\bigg" is an abbreviation for \verb"\big\big". |
| 385 |
For instance, \verb"$\Delta\big \frac 1{f(x)}$" produces |
| 386 |
$\Delta\big \frac 1{f(x)}$; in this way one can enlarge implicit |
| 387 |
delimiters such as those induced by the command \verb"\frac". |
| 388 |
It is an error to place a \verb"\big" within delimiters that are not big |
| 389 |
themselves. |
| 390 |
Unbalanced delimiters may be present in an in-line formula |
| 391 |
(as is usual in tensor calculus --- cf. \sref"Tensors"), but then cannot |
| 392 |
be resized. |
| 393 |
|
| 394 |
Table 1 lists paired delimiters. |
| 395 |
\begin{table} |
| 396 |
\normalsize |
| 397 |
\label{tab_delim} |
| 398 |
\begin{center} |
| 399 |
\vskip 2ex |
| 400 |
\begin{tabular}{ll|ll} |
| 401 |
\multicolumn{2}{c}{Left delimiters} |
| 402 |
& \multicolumn{2}{c}{Right delimiters} |
| 403 |
\\ |
| 404 |
\hline |
| 405 |
\verb"(" & $($ |
| 406 |
& \verb")" & $)$ |
| 407 |
\\ |
| 408 |
\verb"[",\verb"\lbrack" & $[$ |
| 409 |
& \verb"]",\verb"\rbrack" & $]$ |
| 410 |
\\ |
| 411 |
\verb"\{", \verb"\lbrace" & $\{$ |
| 412 |
& \verb"\}", \verb"\rbrace" & $\}$ |
| 413 |
\\ |
| 414 |
\verb"<", \verb"\langle" & $<$ |
| 415 |
& \verb">", \verb"\rangle" & $>$ |
| 416 |
\\ |
| 417 |
\verb"\lfloor" & $\lfloor$ |
| 418 |
& \verb"\rfloor" & $\rfloor$ |
| 419 |
\\ |
| 420 |
\verb"\lceil" & $\lceil$ |
| 421 |
& \verb"\rceil" & $\rceil$ |
| 422 |
\\ |
| 423 |
\verb"\lvert", \verb"\left|" & $\left|\right.$ |
| 424 |
& \verb"\rvert", \verb"\right|" & $\left.\right|$ |
| 425 |
\\ |
| 426 |
\verb"\lBrack", \verb"\double[" & $\double[\right.$ |
| 427 |
& \verb"\rBrack", \verb"\double]" & $\left.\double]$ |
| 428 |
\\ |
| 429 |
\verb"\lAngle", \verb"\double<" & $\double<\right.$ |
| 430 |
& \verb"\rAngle", \verb"\double>" & $\left.\double>$ |
| 431 |
\\ |
| 432 |
\verb"\lFloor" & $\lFloor$ |
| 433 |
& \verb"\rFloor" & $\rFloor$ |
| 434 |
\\ |
| 435 |
\verb"\lCeil" & $\lCeil$ |
| 436 |
& \verb"\rCeil" & $\rCeil$ |
| 437 |
\\ |
| 438 |
\verb"\lVert", \verb"\ldouble|" & $\ldouble|\rdouble.$ |
| 439 |
& \verb"\rvert", \verb"\rdouble|" & $\ldouble.\rdouble|$ |
| 440 |
\\ |
| 441 |
\verb"\triple[" & $\triple[\right.$ |
| 442 |
& \verb"\triple]" & $\left.\triple]$ |
| 443 |
\\ |
| 444 |
\verb"\triple<" & $\triple<\right.$ |
| 445 |
& \verb"\triple>" & $\left.\triple>$ |
| 446 |
\\ |
| 447 |
\verb"\ltriple|" & $\ltriple|$ |
| 448 |
& \verb"\rtriple|" & $\rtriple|$ |
| 449 |
\end{tabular} |
| 450 |
\vskip 2ex |
| 451 |
\end{center} |
| 452 |
\capt{1}{Paired delimiters} |
| 453 |
\end{table} |
| 454 |
To enable \verb"<" and \verb">" as a notation for angle braces, |
| 455 |
one must set \verb"\nathstyle{geometry}" |
| 456 |
(this misusage of notation is common in geometry and math physics). |
| 457 |
As symbols of ordering, $\lt$ and $\gt$ can be always accessed through |
| 458 |
`\verb"\lt"' and `\verb"\gt"'. |
| 459 |
|
| 460 |
While in math modes, brackets \verb"[", \verb"]" |
| 461 |
never denote optional arguments. |
| 462 |
This helps to avoid common \LaTeX\ misinterpretations, as with |
| 463 |
\verb"\\[". |
| 464 |
On the other side, {\it grouping} interspersed with delimiters --- once |
| 465 |
harmless --- is a serious defect now (cf.~\sref"ErrorsWarnings"). |
| 466 |
E.g., \verb"({x)}" derails \TeX\ if used in display mode. |
| 467 |
%(Braces around a macro argument are safe.) |
| 468 |
|
| 469 |
|
| 470 |
\sect{Operators} \label{Operators} |
| 471 |
Nath typsets \verb"\lambda\mathop{\rm id} - g" as |
| 472 |
$$\lambda\mathop{\rm id} - g,$$ |
| 473 |
whereas \TeX\ would put uneven spacing around the |
| 474 |
minus sign: \hbox{$\lambda \old{mathop}{\rm id} - g$}, |
| 475 |
erroneously considering the minus sign a unary operator |
| 476 |
(by \cite[rule~5 on p.~442]{texb}). |
| 477 |
|
| 478 |
In subscripts of big operators, \verb"\\" is allowed and starts a new |
| 479 |
line, e.g., |
| 480 |
\begin{verbatim} |
| 481 |
$$ |
| 482 |
\sum_{i,j \in K \\ i \ne j} a_{ij} |
| 483 |
$$ |
| 484 |
\end{verbatim} |
| 485 |
prints as |
| 486 |
$$ |
| 487 |
\sum_{i,j \in K \\ i \ne j} a_{ij}. |
| 488 |
$$ |
| 489 |
|
| 490 |
Within math, the exclamation mark \verb"!" alone ensures suitable |
| 491 |
spacing around factorials: \verb"C^n_k = \frac{n!}{(n - k)!k!}" |
| 492 |
typesets as $C^n_k = \frac{n!}{(n - k)! k!}$ or |
| 493 |
$$ |
| 494 |
C^n_k = \frac{n!}{(n - k)! k!}. |
| 495 |
$$ |
| 496 |
May be doubled: $(2n)!! = n! 2^n$. |
| 497 |
|
| 498 |
Finally, integral signs stick one to another unless something else |
| 499 |
intervenes: |
| 500 |
\begin{verbatim} |
| 501 |
$$ |
| 502 |
\int\int\int_M dV. |
| 503 |
$$ |
| 504 |
\end{verbatim} |
| 505 |
produces |
| 506 |
$$ |
| 507 |
\int\int\int_M dV. |
| 508 |
$$ |
| 509 |
|
| 510 |
|
| 511 |
\sect{Abbreviations} \label{Abbreviations} |
| 512 |
According to typographic tradition, names of variables that are |
| 513 |
abbreviations should be typeset in roman, for which |
| 514 |
Nath offers a handy notation: abbreviations are letter strings |
| 515 |
starting from the back quote~`\verb"`"'. |
| 516 |
E.g., \verb"$`e^{\pi`i}$" and \verb"$`ad_x y$" typeset as |
| 517 |
$`e^{\pi`i} = -1$ and $`ad_x y$, respectively. |
| 518 |
|
| 519 |
Strings containing more than one letter, such as \verb"`span", |
| 520 |
become math operators. |
| 521 |
Until now they must have been declared in advance with some additional |
| 522 |
care to avoid conflicts (\verb"\span" is a \TeX\ primitive). |
| 523 |
Some more examples: |
| 524 |
$$ |
| 525 |
H' = H_{`symm}' + H_{`antisymm}', \\ |
| 526 |
\bar f = f|_{`int U}, \\ |
| 527 |
a = `const_1, \\ |
| 528 |
G = `SO(n). |
| 529 |
$$ |
| 530 |
|
| 531 |
|
| 532 |
\sect{Roots} \label{Roots} |
| 533 |
Nath's \verb"\sqrt" differs in several aspects. |
| 534 |
Firstly, its vertical size never depends on the presence of subscripts: |
| 535 |
$$ |
| 536 |
\sqrt{a} + \sqrt{a_j}. |
| 537 |
$$ |
| 538 |
%\end{document} |
| 539 |
Secondly, nested \verb"\sqrt"'s are aligned at the top: |
| 540 |
$$ |
| 541 |
\cos\frac \pi{10} = \frac 14 \sqrt{10 + 2 \sqrt 5}. |
| 542 |
$$ |
| 543 |
(Compare it with the \TeX's |
| 544 |
$$ |
| 545 |
\cos\frac \pi{10} = \frac 14 \old{sqrt}{10 + 2 \old{sqrt} 5}.\text{)} |
| 546 |
$$ |
| 547 |
Thirdly, no optional arguments are allowed. |
| 548 |
\LaTeX's \verb"\sqrt[3]{x}" must be replaced with |
| 549 |
\verb"\root{3}{x}" to produce $\root{3}{x}$. |
| 550 |
|
| 551 |
|
| 552 |
\sect{Special symbols} \label{SpecialSymbols} |
| 553 |
Nath introduces \verb"\vin" and \verb"\niv" as names of the important |
| 554 |
symbols `$\vin$' and `$\niv$' not included in any standard math font. |
| 555 |
|
| 556 |
Arrows \verb"\to", \verb"\ot", \verb"\otto", and \verb"\mapsto" are |
| 557 |
expandable and descriptable via sub- and superscripts. |
| 558 |
Thus, |
| 559 |
\begin{verbatim} |
| 560 |
$$ |
| 561 |
A \to^f_{\text{isomorphism}} B, \qquad a \mapsto^f a' |
| 562 |
$$ |
| 563 |
\end{verbatim} |
| 564 |
gives |
| 565 |
$$A \to^f_{\text{isomorphism}} B, \qquad a \mapsto^f a'.$$ |
| 566 |
|
| 567 |
The command \verb"\adot" denotes the centered dot to be used a |
| 568 |
an argument placeholder, as in $f(\adot)$ or $g(\adot,\adot)$. |
| 569 |
|
| 570 |
|
| 571 |
\sect{Horizontal braces} \label{HorizontalBraces} |
| 572 |
The upper and lower horizontal braces are created with |
| 573 |
\verb"\underbrace{"{\it expression\/}\verb"}_{"{\it label\/}\verb"}" |
| 574 |
and |
| 575 |
\verb"\overbrace{"{\it expression\/}\verb"}_{"{\it label\/}\verb"}", |
| 576 |
respectively. |
| 577 |
For instance, |
| 578 |
\begin{verbatim} |
| 579 |
$$ |
| 580 |
f^n(x) = \underbrace{f(f(\dots f(}_{n \text{ times}}x) \dots)) |
| 581 |
$$ |
| 582 |
\end{verbatim} |
| 583 |
results in |
| 584 |
\delimgrowth = 1 |
| 585 |
$$ |
| 586 |
f^n(x) = \underbrace{f(f(\dots f(}_{n \text{ times}}x) \dots)) |
| 587 |
$$ |
| 588 |
Observe that the construction does not interfere with the displayed mode |
| 589 |
of delimiters. |
| 590 |
|
| 591 |
|
| 592 |
\sect{Accents} \label{Accents} |
| 593 |
Hat, tilde, and bar accents are extensible and grow wider with the size of |
| 594 |
the accented material: |
| 595 |
$$ |
| 596 |
\hat a + \hat{ab} + \hat{abc}. |
| 597 |
$$ |
| 598 |
When these accents outreach their limit of extensibility, they take the |
| 599 |
superscript position: |
| 600 |
$$ |
| 601 |
\hat{a + b + c}. |
| 602 |
$$ |
| 603 |
A sequence of accents goes from top to down or from right to left. |
| 604 |
For instance, |
| 605 |
\verb"\hat\bar a +" \verb"\hat\bar{ab} +" \verb"\hat\bar{abc}" gives |
| 606 |
$$ |
| 607 |
\hat\bar a + \hat\bar{ab} + \hat\bar{abc}, |
| 608 |
$$ |
| 609 |
whereas \verb"\hat\bar{a + b + c}" typesets as |
| 610 |
$$ |
| 611 |
\hat\bar{a + b + c}. |
| 612 |
$$ |
| 613 |
All kinds of things may happen if braces intervene as in |
| 614 |
\verb"\bar{\bar{ab}}". |
| 615 |
|
| 616 |
Let us note that \verb"\bar" is not arbitrarily extensible, unlike |
| 617 |
\verb"\overline". |
| 618 |
For instance, \verb"\hat{\overline{a + b + c}}" gives |
| 619 |
$\hat{\overline{a + b + c}}$ |
| 620 |
(over- and underlines and arrows are {\it not\/} accents). |
| 621 |
Over a single character, there is no limit on the number and type of |
| 622 |
accents in the sequence; e.g., |
| 623 |
$$ |
| 624 |
\hat\ddot\tilde W |
| 625 |
$$ |
| 626 |
results from \verb"\hat\ddot\tilde W". |
| 627 |
Over an expression, a non-extensible accent, like \verb"\dot", |
| 628 |
makes others non-extensible as well. |
| 629 |
Thus, \verb"\hat{ab} +" \verb"\dot{ab} +" \verb"\dot\hat{ab} +" |
| 630 |
\verb"\hat\dot{ab}" gives |
| 631 |
$$ |
| 632 |
\hat{ab} + \dot{ab} + \dot\hat{ab} + \hat\dot{ab}. |
| 633 |
$$ |
| 634 |
|
| 635 |
|
| 636 |
\sect{Arrays} \label{Arrays} |
| 637 |
Entries are typeset in display mode: |
| 638 |
$$ |
| 639 |
\left|\, |
| 640 |
\begin{array}{cc} x & 1 \\ 1 & \frac 1x \end{array} |
| 641 |
\,\right| = 0. |
| 642 |
$$ |
| 643 |
Moreover, arrays grow smaller when used in sub- and superscripts: |
| 644 |
$$ |
| 645 |
`e^{\displayed{(\begin{matrix} a & b \\ c & d \end{matrix})}}. |
| 646 |
$$ |
| 647 |
A \verb"matrix" environment differs from \verb"array" in that it does not |
| 648 |
have any preamble. |
| 649 |
As a special case, \verb"\binom{"{\it m}\verb"}{"{\it n}\verb"}" |
| 650 |
creates the binomial coefficient $\binom mn$. |
| 651 |
|
| 652 |
|
| 653 |
\sect{Tensors} \label{Tensors} |
| 654 |
With \verb"\nathstyle{tensors}", first-level sub- and superscripts to |
| 655 |
ordinary symbols occupy predetermined positions. |
| 656 |
Thus, |
| 657 |
\nathstyle{tensors} |
| 658 |
$$ |
| 659 |
A^{[k} B^{l]}_{(k} C_{l)} |
| 660 |
$$ |
| 661 |
\nathstyle{tensors=off} |
| 662 |
results from |
| 663 |
\begin{verbatim} |
| 664 |
\nathstyle{tensors=on} |
| 665 |
$$ |
| 666 |
A^{[k} B^{l]}_{(k} C_{l)} |
| 667 |
$$ |
| 668 |
\end{verbatim} |
| 669 |
(unbalanced delimiters are allowed in in-line style). |
| 670 |
|
| 671 |
|
| 672 |
\sect{Displayed formulas} \label{DisplayedFormulas} |
| 673 |
Displayed formulas are indented by \verb"\mathindent" of default |
| 674 |
value of 4\,pc. |
| 675 |
With \verb"\mathindent" set to a negative length, displayed formulas |
| 676 |
are centered. |
| 677 |
Formulas enclosed between double dollars \verb"$$" are unnumbered. |
| 678 |
Alternatively one may enclose them between \verb"\[" and \verb"\]". |
| 679 |
Ends of lines (any formula may be multiline) are marked with |
| 680 |
\verb"\\". |
| 681 |
Nath does not support automatic line breaks (as does the Downes style |
| 682 |
\cite{downes}). |
| 683 |
|
| 684 |
E.g., \verb"$$ ???? = ????, \\ ???? = ????. $$" typesets as a left-aligned |
| 685 |
multiline formula (the punctuation is important, see~\sref "Punctuation"): |
| 686 |
$$ |
| 687 |
\stuff{2cm} = \stuff{5cm}, \\ \stuff{4cm} = \stuff{2cm}. |
| 688 |
$$ |
| 689 |
To achieve finer arrangements, one may begin every continuation line with |
| 690 |
a number of \verb"\quad"'s; e.g., |
| 691 |
two in front of a binary relation, three in front of a binary operation: |
| 692 |
\begin{verbatim} |
| 693 |
$$ |
| 694 |
???? = ???? + (???? \\ |
| 695 |
\qqquad + ????) \\ |
| 696 |
\qquad = ???? \\ |
| 697 |
\qquad = ???? . |
| 698 |
$$ |
| 699 |
\end{verbatim} |
| 700 |
gives |
| 701 |
$$ |
| 702 |
\stuff{4cm} = \stuff{1cm} + (\stuff{2cm} \\ |
| 703 |
\qqquad + \stuff{5cm}) \\ |
| 704 |
\qquad = \stuff{7cm} \\ |
| 705 |
\qquad = \stuff{6cm}\,. |
| 706 |
$$ |
| 707 |
|
| 708 |
|
| 709 |
\sect{Walls} \label{Walls} |
| 710 |
Walls represent a simple and convenient tool to achieve better |
| 711 |
visual appearance of complex displayed equations. |
| 712 |
The syntax is \verb"\wall ???? \\" \verb"???? \\" $\cdots$ |
| 713 |
\verb"\\ ???? \return", |
| 714 |
and can be arbitrarily nested. |
| 715 |
The \verb"\wall" makes every next line to start at the |
| 716 |
``wall'' until removed by \verb"\return". |
| 717 |
For instance, |
| 718 |
\begin{verbatim} |
| 719 |
$$ |
| 720 |
???? |
| 721 |
\wall = ???? + (\wall - ???? \\ |
| 722 |
+ ????) |
| 723 |
\return |
| 724 |
= ???? \\ |
| 725 |
= ????. |
| 726 |
\return |
| 727 |
$$ |
| 728 |
\end{verbatim} |
| 729 |
gives |
| 730 |
$$ |
| 731 |
\stuff{1cm} |
| 732 |
\wall = \stuff{1cm} + (\wall - \stuff{4cm} |
| 733 |
\\ |
| 734 |
+ \stuff{5cm}) \return |
| 735 |
= \stuff{7cm} \\ |
| 736 |
= \stuff{6cm}\,. \return |
| 737 |
$$ |
| 738 |
The typical placement of \verb"\wall" is in front of a relation symbol |
| 739 |
or immediately after an opening delimiter anywhere in the left half |
| 740 |
of a formula. |
| 741 |
|
| 742 |
A simple alternative is \verb"\padded{"{\it A}\verb"}", which prefixes |
| 743 |
each continuation line with {\it A} until stopped by \verb"\return". |
| 744 |
Typically, {\it A} is a kern: |
| 745 |
\begin{verbatim} |
| 746 |
$$ |
| 747 |
\padded\qquad \padded\quad ???? = ???? + (???? \\ |
| 748 |
+ ???? \\ |
| 749 |
+ ????) |
| 750 |
\return |
| 751 |
= ???? \\ |
| 752 |
= ???? |
| 753 |
\return |
| 754 |
$$ |
| 755 |
\end{verbatim} |
| 756 |
gives |
| 757 |
$$ |
| 758 |
\padded\qquad \padded\quad \stuff{4cm} = \stuff{1.5cm} + (\stuff{2cm} \\ |
| 759 |
+ \stuff{6cm} \\ |
| 760 |
+ \stuff{5cm}) |
| 761 |
\return |
| 762 |
= \stuff{7cm} \\ |
| 763 |
= \stuff{4cm}\,. |
| 764 |
\return |
| 765 |
$$ |
| 766 |
With short formulas it may be easier to prefix each line with explicit |
| 767 |
\verb"\quad"'s as we did in \sref "DisplayedFormulas". |
| 768 |
|
| 769 |
See \sref"Punctuation" on the interplay between walls and punctuation. |
| 770 |
|
| 771 |
|
| 772 |
\sect{Alignments} \label{Alignments} |
| 773 |
Unfortunately, display mode of delimiters interferes badly with alignments |
| 774 |
unless every cell is balanced (as is, e.g., with matrices). |
| 775 |
The recommended solution is to fill the cells with balanced |
| 776 |
wall/return blocks. E.g., |
| 777 |
\begin{verbatim} |
| 778 |
\begin{eqnarray*} |
| 779 |
???? &=& \wall ???? \\ |
| 780 |
+ ???? \\ |
| 781 |
+ ????, |
| 782 |
\return |
| 783 |
\\ |
| 784 |
???? &=& ???? |
| 785 |
\end{eqnarray*} |
| 786 |
\end{verbatim} |
| 787 |
produces |
| 788 |
\begin{eqnarray*} |
| 789 |
\stuff{5mm} &=& \wall \stuff{7cm} \\ |
| 790 |
+ \stuff{7cm} \\ |
| 791 |
+ \stuff{3cm}, |
| 792 |
\return |
| 793 |
\\ |
| 794 |
\stuff{3mm} &=& \stuff{5cm}. |
| 795 |
\end{eqnarray*} |
| 796 |
Walls save \verb"&"'s and ensure vertical |
| 797 |
centering of the equation numbers (see \sref"EquationNumbering"). |
| 798 |
|
| 799 |
|
| 800 |
\sect{Equation numbering} \label{EquationNumbering} |
| 801 |
A formula enclosed between \verb"\begin{equation}" and \verb"\end{equation}" |
| 802 |
obtains a single number (the value of \verb"\theequation") on the right. |
| 803 |
Putting the command \verb"\numbered" inside of an unnumbered formula has |
| 804 |
the same effect: |
| 805 |
\begin{verbatim} |
| 806 |
$$ |
| 807 |
????. \numbered |
| 808 |
$$ |
| 809 |
\end{verbatim} |
| 810 |
results in |
| 811 |
$$ |
| 812 |
\stuff{8cm}. \numbered \label{numbered} |
| 813 |
$$ |
| 814 |
Alternatively, \verb"\eqno{"$A$\verb"}" makes $A$ the equation number. |
| 815 |
|
| 816 |
In emergency, the equation number goes one line below the formula: |
| 817 |
\begin{equation} \label{long} |
| 818 |
\stuff{10cm} |
| 819 |
\end{equation} |
| 820 |
We already know that any formula may be multiline. |
| 821 |
If so, the equation number is centered: |
| 822 |
\begin{equation} |
| 823 |
\stuff{8cm}, \label{short1} \\ |
| 824 |
\stuff{7cm}. \label{short2} |
| 825 |
\end{equation} |
| 826 |
To have centered numbers within the \verb"eqnarray" environment, use |
| 827 |
wall/return blocks as described in~\sref "Alignments" (but then |
| 828 |
the equation numbers may be overwritten with the formula content without |
| 829 |
warning). |
| 830 |
|
| 831 |
There is also the \verb"eqns" environment, which puts a number on |
| 832 |
each line: |
| 833 |
\begin{eqns} |
| 834 |
\stuff{8cm}, \label{short3} \\ |
| 835 |
\stuff{7cm}. \label{short4} |
| 836 |
\end{eqns} |
| 837 |
It also uses larger and breakable interline space. |
| 838 |
Multiline blocks then may be created by using the walls (\sref"Walls"). |
| 839 |
|
| 840 |
Equation numbering is normally determined by \verb"\theequation". |
| 841 |
The environment \verb"subabc" introduces a subordinate numbering by letters, |
| 842 |
\begin{subabc} |
| 843 |
\begin{equation} |
| 844 |
A = B, \label{A} |
| 845 |
\end{equation} |
| 846 |
no matter how many numbered equations are enclosed, |
| 847 |
\begin{equation} |
| 848 |
C = D. \label{C} |
| 849 |
\end{equation} |
| 850 |
\end{subabc} |
| 851 |
This output was obtained from |
| 852 |
\begin{verbatim} |
| 853 |
\begin{subabc} |
| 854 |
\begin{equation} |
| 855 |
A = B, \label{A} |
| 856 |
\end{equation} |
| 857 |
no matter how many numbered equations are enclosed, |
| 858 |
\begin{equation} |
| 859 |
C = D. \label{C} |
| 860 |
\end{equation} |
| 861 |
\end{subabc} |
| 862 |
\end{verbatim} |
| 863 |
After \verb"\end{subabc}", the original numbering mode is restored: |
| 864 |
\begin{equation} |
| 865 |
E = F. \label{E} |
| 866 |
\end{equation} |
| 867 |
Every numbered equation should be referred to somewhere, hence it should |
| 868 |
have a label --- a warning (\sref"ErrorsWarnings") is issued if it does not. |
| 869 |
|
| 870 |
To put equation numbers on the left, call either the documentstyle |
| 871 |
option \verb"leqno" or the local option \verb"\nathstyle{leqno}". |
| 872 |
|
| 873 |
|
| 874 |
\sect{Items} \label{Items} |
| 875 |
Lay typographers tend to overuse list environments. |
| 876 |
Rather than list items, numbered statements so often encountered in theorems |
| 877 |
and definitions may be alternatively formatted as numbered paragraphs. |
| 878 |
Nath's command \verb"\paritem{"{\it item label\/}\verb"}" starts a numbered |
| 879 |
paragraph and may occur even within a displayed formula. |
| 880 |
Our next example demonstrates this: |
| 881 |
|
| 882 |
\bigskip\noindent |
| 883 |
The following statements on a real function $f$ are equivalent: |
| 884 |
\paritem{(i)} $f$ is continuous; |
| 885 |
$$ |
| 886 |
\paritem{(ii)} f(\lim_{i\to\infty} x_i) = \lim_{i\to\infty} f(x_i) |
| 887 |
$$ |
| 888 |
for every converging sequence $x_i$. |
| 889 |
|
| 890 |
In a left-numbered formula, \verb"\paritem" supersedes the numbering |
| 891 |
and a warning is issued. |
| 892 |
|
| 893 |
|
| 894 |
\sect{Punctuation} \label{Punctuation} |
| 895 |
Nath provides a simple tool to encourage line breaks after punctuation in |
| 896 |
in-line mode. |
| 897 |
Namely, \verb*"\ " denotes a breakable space no matter where it is used. |
| 898 |
Therefore, \verb"$a = b,\ c = d$" will break after the comma, |
| 899 |
$a = b,\ c = d$, rather than after the `\,$=$\,' sign. |
| 900 |
The inclination to break is measured by \verb"\punctpenalty" |
| 901 |
(if a positive integer less than 10000). |
| 902 |
|
| 903 |
Three dots are denoted by \verb"\dots". |
| 904 |
In some contexts, their proper place is at the level of math axis, |
| 905 |
e.g., $a_1 + \dots + a_n$. |
| 906 |
Nath uses a very simple rule --- the dots are not raised if and only |
| 907 |
if they follow a comma or a semicolon. |
| 908 |
Accordingly, we have $a_1, \dots, a_n$ and $a_1; \dots; a_n$. |
| 909 |
|
| 910 |
Punctuation after displayed formulas is important for recognizing |
| 911 |
continuing lines. |
| 912 |
Without punctuation, what seems to be a system of equations |
| 913 |
$$ |
| 914 |
U_x = AU \\ |
| 915 |
-U_y = BU |
| 916 |
$$ |
| 917 |
may well be a chain of them: |
| 918 |
$$ |
| 919 |
U_x = AU |
| 920 |
-U_y = BU. |
| 921 |
$$ |
| 922 |
To disambiguate your notation, be sure to insert comma (or semicolon |
| 923 |
or full stop or \verb"\text") at the end of each line that is not continued: |
| 924 |
$$ |
| 925 |
U_x = AU, \\ |
| 926 |
-U_y = BU. |
| 927 |
$$ |
| 928 |
(Observe that the minus sign starting the second line is typeset closer |
| 929 |
to $U$ --- becomes a unary operator.) |
| 930 |
|
| 931 |
|
| 932 |
\sect{Spacing} \label{Spacing} |
| 933 |
Nath's displayed formulas use frozen spacing (\TeX's ``skips'' and ``glues'' |
| 934 |
neither stretch nor shrink). |
| 935 |
While it is seldom useful to stretch a displayed formula, one may |
| 936 |
wish to shrink formulas too wide to fit between the margins. |
| 937 |
Within the \verb"tight" environment, displayed formulas occupy slightly less |
| 938 |
horizontal space. |
| 939 |
E.g., |
| 940 |
$$ |
| 941 |
\sin^6 x = |
| 942 |
-\frac 1{32} \cos 6x + \frac 3{16} \cos 4x |
| 943 |
- \frac{15}{32} \cos 2x + \frac 5{16} |
| 944 |
$$ |
| 945 |
becomes |
| 946 |
\begin{tight} |
| 947 |
$$ |
| 948 |
\sin^6 x = |
| 949 |
-\frac 1{32} \cos 6x + \frac 3{16} \cos 4x |
| 950 |
- \frac{15}{32} \cos 2x + \frac 5{16} |
| 951 |
$$ |
| 952 |
\end{tight} |
| 953 |
if written as |
| 954 |
\begin{verbatim} |
| 955 |
\begin{tight} |
| 956 |
$$ |
| 957 |
\sin^6 x = |
| 958 |
-\frac 1{32} \cos 6x + \frac 3{16} \cos 4x |
| 959 |
- \frac{15}{32} \cos 2x + \frac 5{16} |
| 960 |
$$ |
| 961 |
\end{tight} |
| 962 |
\end{verbatim} |
| 963 |
|
| 964 |
Striving for safe defaults, Nath sets even interword spaces in text. |
| 965 |
\TeX perts may wish to call \verb"\nonfrenchspacing" |
| 966 |
(see~\cite[p. 74]{texb}) to achieve a century-old look. |
| 967 |
|
| 968 |
|
| 969 |
\sect{User definitions} \label{UserDefinitions} |
| 970 |
Feel free to introduce your own commands by using \verb"\newcommand" |
| 971 |
or \verb"\def". |
| 972 |
We already gave a useful example of \verb"\ifrac" |
| 973 |
in~\sref"DisplayedFractions". |
| 974 |
|
| 975 |
Here is another example: |
| 976 |
A first-order partial derivative suitable for all math modes and sizes |
| 977 |
can be introduced via |
| 978 |
\begin{verbatim} |
| 979 |
\newcommand\pd[2]{\frac{\partial#1}{\partial#2}} |
| 980 |
\end{verbatim} |
| 981 |
We then have |
| 982 |
\newcommand\pd[2]{\frac{\partial#1}{\partial#2}}% |
| 983 |
$\big(\pd f x \pd g y)^2$ or $`e^{(\pd f x \pd g y)^2}$ or |
| 984 |
$$ |
| 985 |
(\pd f x \pd g y)^2 |
| 986 |
$$ |
| 987 |
from one and the same \verb"(\pd f x \pd g y)^2". |
| 988 |
|
| 989 |
The price is that fragile commands occurring inside in-line math may |
| 990 |
have to be protected (any in-line mode material must be considered a |
| 991 |
``moving argument''). |
| 992 |
Nath commands are robust by design and need no \verb"\protect"ing. |
| 993 |
When encountering a mysterious error, such as ``undefined command |
| 994 |
\verb"\wrapfrac@",'' fragile commands are to be blamed. |
| 995 |
Besides \verb"\protect", Nath offers \verb"\makerobust", a command |
| 996 |
that takes an already assigned control sequence as argument and makes |
| 997 |
it robust. |
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
\sect{Efficiency} |
| 1002 |
Nath helps to prevent wasting human work on something that can |
| 1003 |
be done by computer. |
| 1004 |
On average, \LaTeX\ runs about three times slower with Nath than |
| 1005 |
without it, depending on the complexity of math formulas. |
| 1006 |
|
| 1007 |
|
| 1008 |
\sect{Other packages} \label{OtherPackages} |
| 1009 |
Nath is not guaranteed to be compatible with other \LaTeX\ packages. |
| 1010 |
However, some combinations turn out to be safe and useful. |
| 1011 |
For example, when starting a \LaTeX~2.09 document with |
| 1012 |
\begin{verbatim} |
| 1013 |
\documentstyle[amssymb,nath]{article} |
| 1014 |
\end{verbatim} |
| 1015 |
or a \LaTeX~2$_{\varepsilon}$ document with |
| 1016 |
\begin{verbatim} |
| 1017 |
\documentclass{article} |
| 1018 |
\usepackage{amssymb,nath} |
| 1019 |
\end{verbatim} |
| 1020 |
one invokes \verb"amssymb", a component of the famous \AmS-\LaTeX\ |
| 1021 |
package from the American Mathematical Society, thereby introducing a |
| 1022 |
wider range of mathematical symbols. |
| 1023 |
Users can also enable text mode \verb"amsmath" commands by starting a |
| 1024 |
\LaTeX~2$_{\varepsilon}$ document with |
| 1025 |
\begin{verbatim} |
| 1026 |
\usepackage{amsmath,nath} |
| 1027 |
\end{verbatim} |
| 1028 |
(math mode commands must be those of Nath). |
| 1029 |
|
| 1030 |
|
| 1031 |
\sect{Commands of enhanced functionality} |
| 1032 |
\def??#1??{\if#1**\else{\rm#1}\fi} |
| 1033 |
\def\sref.#1.{\S\ref{#1}} |
| 1034 |
\def\ct.#1.{\cite{#1}} |
| 1035 |
\def\mpst{$\mapsto$} |
| 1036 |
\def\vn{$\vin$} |
| 1037 |
\def\nv{$\niv$} |
| 1038 |
\catcode`\Z=14 |
| 1039 |
\setbox0\hbox{\verb*"\ "} |
| 1040 |
\def\u{\leavevmode\box0} |
| 1041 |
A number of math commands have been redefined; |
| 1042 |
\verb"\old{"{\it command\/}\verb"}" often provides access |
| 1043 |
to what \verb"\"{\it command\/} was before Nath redefined it |
| 1044 |
(see the source code of this guide for examples). |
| 1045 |
|
| 1046 |
Here is the list of all enhanced and newly introduced commands: |
| 1047 |
\begin{verbatim} |
| 1048 |
?u ??a breakable space in math (?sref.Spacing.)?? |
| 1049 |
\\ ??see ?sref.Operators. and ?sref.DisplayedFormulas.?? |
| 1050 |
\abbreviation ??a long form of?? ` ??in math (?sref.Abbreviations.)?? |
| 1051 |
\adot ??argument placeholder (?sref.SpecialSymbols.)?? |
| 1052 |
\arraycolsep ??macro, formerly a dimension register (?sref.Arrays.)?? |
| 1053 |
\big ??making inline delimiters bigger Z |
| 1054 |
(?sref.Delimiters.)?? |
| 1055 |
\bigg ??same as?? \big\big ??(?sref.Delimiters.)?? |
| 1056 |
\biggg ??same as?? \big\big\big ??(?sref.Delimiters.)?? |
| 1057 |
\biggl ??same as?? \big\big\left |
| 1058 |
\bigl ??same as?? \big\left |
| 1059 |
\binom ??binomial coefficient (?sref.Arrays.)?? |
| 1060 |
\delimgrowth ??see ?sref.Delimiters.?? |
| 1061 |
\displayed ??forcing displayed math mode (?sref.MathModes.)?? |
| 1062 |
\double ??doubling a delimiter (?sref.Delimiters.)?? |
| 1063 |
\eqno ??equation number (?sref.EquationNumbering.)?? |
| 1064 |
\natherrormark ??a mark to visualize nath errors Z |
| 1065 |
(?sref.ErrorsWarnings.)?? |
| 1066 |
\factorial ??long form of?? ! ??in math (?sref.Operators.)?? |
| 1067 |
\fbox ??making frame around a subformula?? |
| 1068 |
\frac ??fraction (?sref.Fractions.)?? |
| 1069 |
\gt ??greater than sign (?sref.Delimiters.)?? |
| 1070 |
\hat ??attaching hat accent (?sref.Accents.)?? |
| 1071 |
\inline ??forcing in-line math mode (?sref.MathModes.)?? |
| 1072 |
\int ??integral sign (?sref.Operators.)?? |
| 1073 |
\langle ??left angle bracket (?sref.Delimiters.)?? |
| 1074 |
\lAngle ??left double angle bracket (?sref.Delimiters.)?? |
| 1075 |
\lbrace ??left brace (?sref.Delimiters.)?? |
| 1076 |
\lbrack ??left bracket (?sref.Delimiters.)?? |
| 1077 |
\lBrack ??left double bracket (?sref.Delimiters.)?? |
| 1078 |
\lceil ??left ceiling bracket (?sref.Delimiters.)?? |
| 1079 |
\lCeil ??left double ceiling bracket (?sref.Delimiters.)?? |
| 1080 |
\ldouble ??left doubling (?sref.Delimiters.)?? |
| 1081 |
\left ??left modifier (?sref.Delimiters.)?? |
| 1082 |
\lfloor ??left floor bracket (?sref.Delimiters.)?? |
| 1083 |
\lFloor ??left double floor bracket (?sref.Delimiters.)?? |
| 1084 |
\lnull ??left invisible fence (?sref.Delimiters.)?? |
| 1085 |
\lt ??less than sign (?sref.Delimiters.)?? |
| 1086 |
\ltriple ??left tripling (?sref.Delimiters.)?? |
| 1087 |
\lvert ??left vertical line (?sref.Delimiters.)?? |
| 1088 |
\lVert ??left double vertical line (?sref.Delimiters.)?? |
| 1089 |
\mapsto ??sizeable `?mpst' (?sref.SpecialSymbols.)?? |
| 1090 |
\mathop ??see ?sref.Operators.?? |
| 1091 |
\mathstrut ??see ?ct.texb.?? |
| 1092 |
\mid ??middle vertical line (?sref.Delimiters.)?? |
| 1093 |
\Mid ??middle double vertical line (?sref.Delimiters.)?? |
| 1094 |
\middle ??middle modifier (?sref.Delimiters.)?? |
| 1095 |
\Nath ??logo?? |
| 1096 |
\nathstyle ??local options (?sref.LocalOptions.)?? |
| 1097 |
\niv ??the symbol `?nv' (?sref.SpecialSymbols.)?? |
| 1098 |
\nonumber ??suppresses equation number (?sref.EquationNumbering.)?? |
| 1099 |
\numbered ??forces equation number (?sref.EquationNumbering.)?? |
| 1100 |
\old ??see the beginning of this section?? |
| 1101 |
\ot ??sizeable left arrow (?sref.SpecialSymbols.)?? |
| 1102 |
\otto ??sizeable left-right arrow (?sref.SpecialSymbols.)?? |
| 1103 |
\overbrace ??horizontal braces over unbalanced math material?? Z ??(?sref.HorizontalBraces.)?? |
| 1104 |
|
| 1105 |
\overleftarrow ??left arrow over an expression?? |
| 1106 |
\overleftrightarrow ??left-right arrow over an expression?? |
| 1107 |
\overline ??overline an expression (?sref.Accents.)?? |
| 1108 |
\overrightarrow ??right arrow over an expression?? |
| 1109 |
\padded ??like a wall, with every next line padded (?sref.Walls.)?? |
| 1110 |
\paritem ??numbered statement (?sref.Items.)?? |
| 1111 |
\punctpenalty ??penalty inserted after punctuation in math Z |
| 1112 |
(?sref.Punctuation.)?? |
| 1113 |
\quad ??1em space (?sref.DisplayedFormulas.)?? |
| 1114 |
\qquad ??2em space (?sref.DisplayedFormulas.)?? |
| 1115 |
\qqquad ??3em space (?sref.DisplayedFormulas.)?? |
| 1116 |
\rangle ??right angle bracket (?sref.Delimiters.)?? |
| 1117 |
\rAngle ??right double angle bracket (?sref.Delimiters.)?? |
| 1118 |
\rbrace ??right brace (?sref.Delimiters.)?? |
| 1119 |
\rbrack ??right bracket (?sref.Delimiters.)?? |
| 1120 |
\rBrack ??right double bracket (?sref.Delimiters.)?? |
| 1121 |
\rceil ??right ceiling bracket (?sref.Delimiters.)?? |
| 1122 |
\rCeil ??right double ceiling bracket (?sref.Delimiters.)?? |
| 1123 |
\rdouble ??right doubling (?sref.Delimiters.)?? |
| 1124 |
\return ??ends?? \wall ??and?? \padded ??(?sref.Walls.)?? |
| 1125 |
\right ??right modifier (?sref.Delimiters.)?? |
| 1126 |
\rfloor ??right floor bracket (?sref.Delimiters.)?? |
| 1127 |
\rFloor ??right double floor bracket (?sref.Delimiters.)?? |
| 1128 |
\rnull ??right invisible fence (?sref.Delimiters.)?? |
| 1129 |
\root ??arbitrary root (?sref.Roots.)?? |
| 1130 |
\rtriple ??right tripling (?sref.Delimiters.)?? |
| 1131 |
\rvert ??right vertical line (?sref.Delimiters.)?? |
| 1132 |
\rVert ??right double vertical line (?sref.Delimiters.)?? |
| 1133 |
\scriptscriptstyle ??setting size to second next level script size?? |
| 1134 |
\scriptstyle ??setting size to next level script size?? |
| 1135 |
\sqrt ??square root (?sref.Roots.)?? |
| 1136 |
\stackrel ??as in ?LaTeX?? |
| 1137 |
\text ??text within math?? |
| 1138 |
\tilde ??attaching tilde accent (?sref.Accents.)?? |
| 1139 |
\to ??sizeable right arrow (?sref.SpecialSymbols.)?? |
| 1140 |
\triple ??tripling a delimiter (?sref.Delimiters.)?? |
| 1141 |
\underbrace ??horizontal braces under unbalanced math material?? Z ??(?sref.HorizontalBraces.)?? |
| 1142 |
|
| 1143 |
\underleftarrow ??left arrow under an expression?? |
| 1144 |
\underleftrightarrow ??left-right arrow under an expression?? |
| 1145 |
\underline ??underline an expression?? |
| 1146 |
\underrightarrow ??right arrow under an expression?? |
| 1147 |
\vin ??the symbol `?vn' (?sref.SpecialSymbols.)?? |
| 1148 |
\wall ??begin a wall/return block (?sref.Walls.)?? |
| 1149 |
\end{verbatim} |
| 1150 |
Redefined and new environments: |
| 1151 |
\begin{verbatim} |
| 1152 |
array ??see ?sref.Arrays.?? |
| 1153 |
cases ??as in ?TeX?? |
| 1154 |
eqnsabc eqns ??within?? subabc |
| 1155 |
eqnarray ??as in ?LaTeX?? |
| 1156 |
eqnarray* ??as in ?LaTeX?? |
| 1157 |
eqnarrayabc eqnarray ??within?? subabc |
| 1158 |
eqns ??a pile of equations (?sref.EquationNumbering.)?? |
| 1159 |
equation ??as in ?LaTeX?? |
| 1160 |
matrix ??see ?sref.Arrays.?? |
| 1161 |
subabc ??subnumbering by letters (?sref.EquationNumbering.)?? |
| 1162 |
tight ??tighter spacing (?sref.Spacing.)?? |
| 1163 |
\end{verbatim} |
| 1164 |
The following characters are active, retaining their previous meaning: |
| 1165 |
\verb"$",~\verb"^",~\verb"_". |
| 1166 |
Other characters become active in math mode: |
| 1167 |
\begin{verbatim} |
| 1168 |
( ??see ?sref.Delimiters.?? |
| 1169 |
) ??see ?sref.Delimiters.?? |
| 1170 |
[ ??see ?sref.Delimiters.?? |
| 1171 |
] ??see ?sref.Delimiters.?? |
| 1172 |
< ??see ?sref.Delimiters.?? |
| 1173 |
> ??see ?sref.Delimiters.?? |
| 1174 |
, ??see ?sref.Punctuation.?? |
| 1175 |
; ??see ?sref.Punctuation.?? |
| 1176 |
! ??see ?sref.Operators.?? |
| 1177 |
` ??see ?sref.Abbreviations.?? |
| 1178 |
\end{verbatim} |
| 1179 |
Commands that became obsolete are still preserved in reduced form for |
| 1180 |
backward compatibility: |
| 1181 |
\begin{verbatim} |
| 1182 |
\Big ??ignored?? |
| 1183 |
\Bigg ??ignored?? |
| 1184 |
\Biggl ??same as?? \left |
| 1185 |
\biggm ??same as?? \middle |
| 1186 |
\Biggm ??same as?? \middle |
| 1187 |
\biggr ??same as?? \right |
| 1188 |
\Biggr ??same as?? \right |
| 1189 |
\Bigl ??same as?? \left |
| 1190 |
\bigm ??same as?? \middle |
| 1191 |
\Bigm ??same as?? \middle |
| 1192 |
\bigr ??same as?? \right |
| 1193 |
\Bigr ??same as?? \right |
| 1194 |
\mathchoice ??useless?? |
| 1195 |
\mathpalette ??useless?? |
| 1196 |
\textstyle ??ignored?? |
| 1197 |
\end{verbatim} |
| 1198 |
The following \TeX\ commands are disabled: |
| 1199 |
\begin{verbatim} |
| 1200 |
\atop |
| 1201 |
\over |
| 1202 |
\choose |
| 1203 |
\end{verbatim} |
| 1204 |
The following \LaTeX\ environment is disabled: |
| 1205 |
\begin{verbatim} |
| 1206 |
math |
| 1207 |
\end{verbatim} |
| 1208 |
New ifs (correspond to local options): |
| 1209 |
\begin{verbatim} |
| 1210 |
\ifgeometry ??see ?sref.Delimiters.?? |
| 1211 |
\ifleqno ??see ?sref.EquationNumbering.?? |
| 1212 |
\ifsilent ??see ?sref.ErrorsWarnings.?? |
| 1213 |
\iftensors ??see ?sref.Tensors.?? |
| 1214 |
\end{verbatim} |
| 1215 |
New dimension registers: |
| 1216 |
\begin{verbatim} |
| 1217 |
\arraycolsepdim ??former?? \arraycolsep |
| 1218 |
\displaylineskiplimit |
| 1219 |
\mathindent ??see ?sref.DisplayedFormulas.?? |
| 1220 |
\mex ??a prorated?? ex |
| 1221 |
\paritemwd ??see ?sref.Items.?? |
| 1222 |
\end{verbatim} |
| 1223 |
New skips (self-explanatory): |
| 1224 |
\begin{verbatim} |
| 1225 |
\displaybaselineskip |
| 1226 |
\displaylineskip |
| 1227 |
\interdisplayskip |
| 1228 |
\intereqnsskip |
| 1229 |
\beloweqnsskip |
| 1230 |
\end{verbatim} |
| 1231 |
New boxes: |
| 1232 |
\begin{verbatim} |
| 1233 |
\sizebox ??delimiters match it (?sref.Delimiters.)?? |
| 1234 |
\end{verbatim} |
| 1235 |
Moreover, Nath takes box and token registers on the fly. |
| 1236 |
|
| 1237 |
|
| 1238 |
\sect{Final remarks} \label{FinalRemarks} |
| 1239 |
Nath is a scientific software intended to assist and ease the process |
| 1240 |
of scientific publication. |
| 1241 |
By disburdening the encoding of mathematics, Nath tries to uphold |
| 1242 |
\TeX's position as a language suitable for both scientific and |
| 1243 |
typographic purposes --- especially if alternatives are still elusive. |
| 1244 |
|
| 1245 |
Nath is provided as it is; only bug reports and serious discussion |
| 1246 |
should go to \verb"M.Marvan@"\verb"math.slu.cz". |
| 1247 |
|
| 1248 |
\setbox0\hbox{\tt kkkk} |
| 1249 |
\def????{\leavevmode\hbox to\wd0{\hss\it stuff\/\hss}} |
| 1250 |
|
| 1251 |
|
| 1252 |
\sect{Release 2003} \label{Release2003} |
| 1253 |
Fixing several bugs, a new release is available since February 2003. |
| 1254 |
|
| 1255 |
As a new feature, Nath takes care of the interline spacing in arrays. |
| 1256 |
There is a new dimension register \verb"\arrayrowsepdim" to hold the |
| 1257 |
minimal interline space. |
| 1258 |
Also, the default setting of \verb"\doublerulesep" is \verb"\arrayrulewidth", |
| 1259 |
so that horizontal lines produced by successive \verb"\hline"'s |
| 1260 |
stick one to another, and similarly for the vertical lines: |
| 1261 |
$$ |
| 1262 |
\begin{array}{||ccc||} |
| 1263 |
\hline\hline |
| 1264 |
p & q & r \\ |
| 1265 |
\hline |
| 1266 |
1 & 1 & 0 \\ |
| 1267 |
1 & 0 & 0 \\ |
| 1268 |
\frac12 & 1 & 0 \\ |
| 1269 |
\hline\hline |
| 1270 |
\end{array} |
| 1271 |
$$ |
| 1272 |
These changes do not affect the \verb"tabular" environment. |
| 1273 |
|
| 1274 |
The \verb"\padded" command now applies to continuation lines only. |
| 1275 |
For example |
| 1276 |
$$ |
| 1277 |
\padded{\qquad} |
| 1278 |
\stuff{3cm} = \stuff{3.5cm} \\ |
| 1279 |
- \stuff{6cm}, \\ |
| 1280 |
\stuff{4cm} = \stuff{1.5cm} \\ |
| 1281 |
- \stuff{7cm}, \\ |
| 1282 |
\stuff{2cm} = (\stuff{2cm}, \\ |
| 1283 |
-\stuff{2cm}). |
| 1284 |
\return |
| 1285 |
$$ |
| 1286 |
is produced by a single \verb"\padded"--\verb"\return" pair: |
| 1287 |
\begin{verbatim} |
| 1288 |
\padded{\qquad} |
| 1289 |
???? = ???? \\ |
| 1290 |
- ????, \\ |
| 1291 |
???? = ???? \\ |
| 1292 |
- ????, \\ |
| 1293 |
???? = (????, \\ |
| 1294 |
-????). |
| 1295 |
\return |
| 1296 |
\end{verbatim} |
| 1297 |
(Commas that occur within delimiters do not start a new equation.) |
| 1298 |
|
| 1299 |
Some errors still survive. |
| 1300 |
In particular, double accents do not work with MathTime fonts. |
| 1301 |
|
| 1302 |
|
| 1303 |
\begin{thebibliography}{9} |
| 1304 |
\small |
| 1305 |
|
| 1306 |
\bibitem{AIP} |
| 1307 |
{\it AIP Style Manual}, 4th edition |
| 1308 |
(Amer. Inst. Physics, New York, 1990). |
| 1309 |
\bibitem{downes} |
| 1310 |
M. Downes, Breaking equations, {\it TUGboat} 18 (1997) 182--194. |
| 1311 |
\bibitem{texb} |
| 1312 |
D.E. Knuth, {\it The \TeX book} (Addison Wesley, Reading, 1984). |
| 1313 |
\bibitem{EuroTeX} |
| 1314 |
M. Marvan, Natural \TeX\ notation in mathematics, |
| 1315 |
in: Proc. Conf. {\it Euro\TeX\ 2001}, Kerkrade, 23--27 September 2001; |
| 1316 |
online {\tt www.ntg.nl/eurotex/marvan-3.pdf}. |
| 1317 |
\end{thebibliography} |
| 1318 |
|
| 1319 |
\end{document} |
| 1320 |
|
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 |
|
| 1325 |
|
| 1326 |
|
| 1327 |
|
| 1328 |
|
| 1329 |
|