%&LaTeX
\def\AmS{{$\mathcal A$\kern-.1667em
 \lower.5ex\hbox{$\mathcal M$}\kern-.125em$\mathcal S$}}

\documentclass{article}
\usepackage{nath}
\nathstyle{geometry}
\mathindent=4pc

\makeatletter
\def \@listI{\leftmargin 3ex \topsep 4pt \partopsep 0pt
 \itemsep 0pt \parsep 0pt \listparindent 0pt}
\makeatother

\def\To#1\endTo{\hbox to 4cm{$\displayed{#1}$\hss} \hbox{$#1$}}
\newcounter{p}
\def\sect#1{\refstepcounter{p} \paragraph{\S\arabic{p}. #1.}}
\def\capt#1#2{{\small Table #1: #2}}
\def\stuff#1{\hbox{\vrule height 1.5ex depth .3ex width 0ex}%
 \raise .6mm\vbox{\hrule width #1 height .5mm}}
\setbox0\hbox{\tt ????}
\catcode`\?=0
\def????{\leavevmode\hbox to\wd0{\hss\it stuff\/\hss}}
\def\sref"#1"{\S\ref{#1}}
\def\refname{{\normalsize\bf References}}

\begin{document}

\title{A Short Guide to Nath}

\author{M. Marvan}
\date{14 February 2003}

\maketitle
%\end{document}


\sect{Annotation}
Nath is a \LaTeX\ style to separate presentation and content in mathematical 
typography.
The style delivers a particular context-dependent presentation on the
basis of a rather coarse context-independent notation. 
Although essentially backward compatible with \LaTeX,
Nath aims at producing traditional math typography even from sources 
devoid of aesthetic ambitions.
Its name is derived from ``{\it na\/}tural ma{\it th\/} notation''  
(see~\cite{EuroTeX}).


\sect{License}
Nath is a free software distributed under the terms of the GNU General 
Public License, see \verb"http://www.gnu.org/copyleft/gpl.html".


\sect{Usage} 
To install Nath, put the \verb"nath.sty" file into the \TeX\ input 
directory. 
A \LaTeX~2.09 document may start like
\begin{verbatim}
\documentstyle[nath]{article}
\end{verbatim}
Under \LaTeX~2$_{\varepsilon}$, the effect is achieved with
\begin{verbatim}
\documentclass{article}
\usepackage{nath}
\end{verbatim}
Nath does not introduce any new fonts.
See \sref "OtherPackages" for combining Nath and other \LaTeX\
styles.


\sect{Local options} \label{LocalOptions}
A few Nath options may be set in the body of a document.
The command \verb"\nathstyle" accepts a list of arguments of the form
`{\it name\/}\verb"="{\it value}' or `{\it name}'; the latter having the 
same meaning as `{\it name\/}\verb"=on"'.
Currently supported options are 
\verb"geometry" (see \sref"Delimiters"), 
\verb"tensors" (see \sref"Tensors"), 
\verb"leqno" (see \sref"EquationNumbering"),
and \verb"silent" (see \sref"ErrorsWarnings").


\sect{Errors and warnings}\label{ErrorsWarnings}
Nath errors are visualized by $\natherrormark$ (or whatever is 
\verb"\natherrormark") placed where the error manifests itself 
(which may look misplaced). 
Unlike errors, Nath warnings appear only in the \verb"log" file and 
do so only if the local option (see \sref"LocalOptions") \verb"silent" 
is set to \verb"on".

Be aware that once admissible constructions may produce \TeX\ errors now.
E.g., superfluous braces may be harmful in math formulas except 
around macro arguments.
Therefore, \verb"{" and \verb"}" should be used just where something 
(a~sub- or superscript, a numerator, a denominator, and similar) 
begins or ends.


\sect{Math modes}\label{MathModes}
\Nath\ uses two distinct math modes.
The single dollar sign \verb"$" invokes the {\it in-line\/} mode.
The double dollar sign \verb"$$" as well as other math environments
invoke the {\it display\/} mode.

Observe the difference:
\verb"$(1 + \frac xy)^2$" typesets as $(1 + \frac xy)^2$, while 
\begin{verbatim}
$$
(1 + \frac xy)^2
$$
\end{verbatim} 
typesets as
$$
(1 + \frac xy)^2,
$$
even though the notation is one and the same.

Commands \verb"\inline" and \verb"\displayed" force either mode
on a subexpression.
Sub- and superscripts are normally typeset in in-line mode; but
\begin{verbatim}
$$
(\sum_{i=1}^n x_i^p)^{\displayed{\frac 1p}}
$$
\end{verbatim}
produces the {\it display} mode in the {\it script\/} size:
\nathstyle{debug}
$$
(\sum_{i=1}^n x_i^p)^{\displayed{\frac 1p}}.
$$
Never leave delimiters un\verb"\displayed" in these cases.

The four math style switches of \TeX\ newly refer only to the 
{\it size} of math expressions:
\verb"\scriptstyle" and \verb"\scriptscriptstyle" to the script 
and second-level-script size of the {\it current\/} size;
\verb"\textstyle" is void; whereas \verb"\displaystyle" has a special 
meaning in the context of the principle of smallest fences 
(see~\sref "DisplayedFractions").


\sect{Fractions} \label{Fractions}
Fractions indicate division in a very broad sense 
(cf.~$\frac{\partial f}{\partial x}$) and may occur in three shapes:
$$
\text{built-up \ } \frac AB,
\qquad
\text{piece } \hbox{ $\frac 12$},
\qquad
\text{solidus } \hbox{ $\frac AB$}.
$$
\Nath\ provides a single universal command \verb"\frac" 
(besides of the obvious slash, `\verb"/"').
The resulting shape is determined by special algorithms 
(see~\cite{EuroTeX}).


\sect{Displayed fractions} \label{DisplayedFractions}
Non-numeric fractions come out as built up.
According to what we call the {\it principle of smallest fences},
numeric fractions are typeset built up if and only if this does not 
extend any paired delimiters.
E.g., 
\begin{verbatim}
$$
(\frac 12 + x)(\frac 12 + \frac 1x)
$$ 
\end{verbatim}
results in
$$
(\frac 12 + x)(\frac 12 + \frac 1x).
$$ 
One can circumvent the rule in two possible ways. 
\paritem{(i)}
In order to force a built-up fraction, place \verb"\displaystyle" anywhere
within the nearest pair of delimiters.
E.g.,
$$
(\frac 12 + x\displaystyle)(\frac 12 + \frac 1x)
$$ 
results from
\begin{verbatim}
$$
(\frac 12 + x\displaystyle)(\frac 12 + \frac 1x)
$$ 
\end{verbatim}
\paritem{(ii)}
In order to force a case fraction, insert an extra pair of invisible 
delimiters. E.g., 
$$
\int x\,dx = \left. \frac12 x^2 \right.
$$
results from
\begin{verbatim}
$$
\int x\,dx = \left. \frac12 x^2 \right.
$$
\end{verbatim}
{\it Compound fractions} have their numerator and denominator in display 
mode:
$$
\frac{1 + \frac xy}{1 - \frac xy}.
$$
One can, of course, force the in-line mode. Namely, 
\begin{verbatim}
$$
\frac{\inline{1 + \frac xy}}{\inline{1 - \frac xy}}
$$
\end{verbatim} 
or, even better, 
\begin{verbatim}
\newcommand\ifrac[2]{\frac{\inline{#1}}{\inline{#2}}}
$$
\ifrac{1 + \frac xy}{1 - \frac xy}
$$
\end{verbatim}
(cf. \sref"UserDefinitions") typesets as
\newcommand\ifrac[2]{\frac{\inline{#1}}{\inline{#2}}}
$$
\ifrac{1 + \frac xy}{1 - \frac xy}.
$$


\sect{In-line fractions}
A \verb"\frac" with numeric arguments results in a case fraction, such 
as the Bernoulli number $B_{12} = -\frac {691}{2730}$.
Otherwise we get a solidus fraction and parentheses are added whenever 
needed for preservation of the mathematical meaning.
E.g., 
\begin{verbatim}
$\frac{\frac ab}{\frac cd}$
\end{verbatim} 
produces $\frac{\frac ab}{\frac cd}$.

Examples below present one and the same expression in display and in-line 
mode.
Roughly speaking, Nath assumes that binary operations other than slash 
have less binding power than the slash,
$$
\To \frac{a + b}{c + d} \endTo, \\
\To \frac {\frac {a \cdot b}{c} \cdot d}{c \cdot d} \endTo, \\ 
\To x + \frac ab \endTo.
$$
In particular, this rule applies to the binary operations of commutative 
algebra:
$$
\To \frac AB \otimes \frac CD \endTo, \\
\To \frac{A \otimes B}{C \otimes D} \endTo, 
$$
even though existing tradition may be different in this particular case.
On the other side, {\it juxtaposition} has more binding power than the 
slash:
$$
\To \frac ab \frac cd \endTo, \\
\To \frac {\partial}{\partial x} \frac fg \endTo, \\
\To d\frac uv \endTo, \\
\To \frac {\partial^3 f}{\partial x \,\partial y^2} \endTo, \\
\To \frac a{bc} \endTo.
$$
Nath only avoids inserting parentheses between a 
fraction and a numeric coefficient, e.g.,
$$
\To -\frac uv + 2\frac uv - \frac 12 \frac ab \endTo,
$$
unless there is a danger of confusion, e.g.,
$$
\To 2\frac {\pm u}{v} \endTo.
$$
In case of loose juxtaposition between operator and its argument,
there is no obvious winner, thus
$$
\To \frac{\sin x}{2} + \sin\frac x2\endTo.
$$
Of course, no parentheses will be inserted when they are already present
in one or another form:
$$
\To A [\frac uv]^2 \endTo, \\
\To \frac{(x,y)}{\lVert x \rVert\,\lVert y \rVert} \endTo
$$
(the last example uses \verb"\lVert x \rVert \, \lVert y \rVert" in the
denominator).

Grouping prevents Nath from adding parentheses around the whole fraction: 
\verb"$a{\frac bc}$" typesets as $a{\frac bc}$, otherwise as $a\frac bc$.
To be on the safe side, avoid superfluous braces in math formulas 
(cf.~\sref"ErrorsWarnings"). 

To disable parentheses around the numerator or denominator,
a pair of invisible parentheses is needed:
\verb"$\frac{\left.\sin x\right.}{\cos x}$" typesets as
$\frac{\left.\sin x\right.}{\cos x}$, otherwise as 
$\frac{\sin x}{\cos x}$.



An important remark is due. 
Professional typographers generally follow the rule that `$a/bc$ means 
$a$ divided by $bc$.'
Still some mathematicians (especially those with a programming background) 
argue that if juxtaposition denotes multiplication, then $a/bc$ means 
$a/b \cdot c$, which is $(a/b) \cdot c$ by the commonly accepted rules of 
precedence. 
However, $ab$ and $a \cdot b$ are different notations and it is the 
notation what matters in typography. 
Yet the AIP style manual~\cite{AIP} is cautious enough to say just: 
``do not write $\frac 1{3x}$ unless you mean $\frac 1{(3x)}$.''
Altogether, notation $a/bc$ is considered ambiguous by a nonignorable part 
of the mathematical community.
Then, at least, the choices made by Nath are known, traditional, and easy 
to remember.

And, of course, it is never unwise to display difficult fractions.


\sect{Delimiters} \label{Delimiters}
\TeX's \verb"\left" and \verb"\right" produce rather poor results, 
especially when overused or underused.
Under natural notation, every fence is a left or right delimiter by its 
very nature, and delimiters do their best to match the material enclosed:
$$
\frac M 
   {(1 - \frac {x_1 + \cdots + x_n + pZ} r)
    (1 - p \frac{\frac{\partial Z}{\partial x_2} + \cdots
                  + \frac{\partial Z}{\partial x_n}} \rho)}.
$$
For matching purposes, every Nath mathematical object is assigned an 
auxiliary height and depth; sub- and superscripts as well as accents 
do not contribute to these dimensions, hence ``small parts'' may exceed 
the fences:
$$ 
(\tilde P - \tilde Q)
(1 + \prod_{i = 1}^{\lfloor \sqrt n \rfloor} p_i)^2.
$$
Needless to say, line breaks are allowed between delimiters. E.g.,
$$
\sin 2nx = 2n \cos x [\sin x \\
\qquad + \sum_{k = 1}^n (-4)^k
 \frac{(n^2 - 1^2)(n^2 - 2^2) \dots (n^2 - k^2)}{(2k - 1)!}
 \sin^{2k - 1} x] 
$$
results from the simple
\begin{verbatim}
$$
\sin 2nx = 2n \cos x [\sin x \\
\qquad + \sum_{k = 1}^n (-4)^k
 \frac{(n^2 - 1^2)(n^2 - 2^2) \dots (n^2 - k^2)}{(2k - 1)!}
 \sin^{2k - 1} x] 
$$.
\end{verbatim}
The modifiers \verb"\left" and \verb"\right" still  
must be used with symmetric delimiters (e.g., vertical lines $\vert$ and 
$\Vert$) or when intended to override the 
natural disposition (e.g., \verb"\left]").
%
The newly introduced modifiers \verb"\double" and \verb"\triple" create 
double and triple delimiters. E.g.,
\verb"$\double[u_1,\dots,u_n\double]$" produces
$\double[u_1,\dots,u_n\double]$.

The {\it middle delimiters\/}, such as
\verb"\mid" and \verb"\middle|" for $\mid$,
\verb"\Mid" and \verb"\double|" for $\Mid$, and
\verb"\triple|" for $\triple|$, 
have the size of the nearest outer pair of delimiters.
For example:
$$
\{ (x_i) \in R^\infty \mid \sum_{i = 1}^\infty x_i^2 = 1\}.
$$

With nested delimiters, there are two ways to ensure that outer delimiters 
come out bigger than inner ones.
In display mode this is controlled by a count \verb"\delimgrowth". 
Setting the \verb"\delimgrowth" to $n$ makes (approx.)
every $n$th delimiter bigger.
One should set \verb"\delimgrowth=1" when a display contains many
vertical bars (and insert extra \verb"\," between adjacent right and 
left bars).

In in-line mode, the {\it command} \verb"\big" has the effect that the 
next entered level of delimiters is set in big size (in the sense of
plain \TeX).
It is not necessary that the \verb"\big" is immediately followed by a 
delimiter; and \verb"\bigg" is an abbreviation for \verb"\big\big".
For instance, \verb"$\Delta\big \frac 1{f(x)}$" produces
$\Delta\big \frac 1{f(x)}$; in this way one can enlarge implicit 
delimiters such as those induced by the command \verb"\frac".
It is an error to place a \verb"\big" within delimiters that are not big
themselves.
Unbalanced delimiters may be present in an in-line formula
(as is usual in tensor calculus --- cf. \sref"Tensors"), but then cannot 
be resized.

Table 1 lists paired delimiters.
\begin{table}
\normalsize
\label{tab_delim}
\begin{center}
\vskip 2ex
\begin{tabular}{ll|ll}
\multicolumn{2}{c}{Left delimiters}
 & \multicolumn{2}{c}{Right delimiters}
\\ 
\hline 
\verb"(" & $($
 & \verb")" & $)$
\\
\verb"[",\verb"\lbrack" & $[$
 & \verb"]",\verb"\rbrack" & $]$
\\
\verb"\{", \verb"\lbrace" & $\{$
 & \verb"\}", \verb"\rbrace" & $\}$
\\
\verb"<", \verb"\langle" & $<$
 & \verb">", \verb"\rangle" & $>$
\\
\verb"\lfloor" & $\lfloor$
 & \verb"\rfloor" & $\rfloor$
\\
\verb"\lceil" & $\lceil$
 & \verb"\rceil" & $\rceil$
\\
\verb"\lvert", \verb"\left|" & $\left|\right.$
 & \verb"\rvert", \verb"\right|" & $\left.\right|$
\\
\verb"\lBrack", \verb"\double[" & $\double[\right.$
 & \verb"\rBrack", \verb"\double]" & $\left.\double]$
\\
\verb"\lAngle", \verb"\double<" & $\double<\right.$
 & \verb"\rAngle", \verb"\double>" & $\left.\double>$
\\
\verb"\lFloor" & $\lFloor$
 & \verb"\rFloor" & $\rFloor$
\\
\verb"\lCeil" & $\lCeil$
 & \verb"\rCeil" & $\rCeil$
\\
\verb"\lVert", \verb"\ldouble|" & $\ldouble|\rdouble.$
 & \verb"\rvert", \verb"\rdouble|" & $\ldouble.\rdouble|$
\\
\verb"\triple[" & $\triple[\right.$
 & \verb"\triple]" & $\left.\triple]$
\\
\verb"\triple<" & $\triple<\right.$
 & \verb"\triple>" & $\left.\triple>$
\\
\verb"\ltriple|" & $\ltriple|$
 & \verb"\rtriple|" & $\rtriple|$
\end{tabular}
\vskip 2ex
\end{center}
\capt{1}{Paired delimiters}
\end{table}
To enable \verb"<" and \verb">" as a notation for angle braces, 
one must set \verb"\nathstyle{geometry}" 
(this misusage of notation is common in geometry and math physics).
As symbols of ordering, $\lt$ and $\gt$ can be always accessed through 
`\verb"\lt"' and `\verb"\gt"'.

While in math modes, brackets \verb"[", \verb"]" 
never denote optional arguments.
This helps to avoid common \LaTeX\ misinterpretations, as with
\verb"\\[".
On the other side, {\it grouping} interspersed with delimiters --- once 
harmless --- is a serious defect now (cf.~\sref"ErrorsWarnings").
E.g., \verb"({x)}" derails \TeX\ if used in display mode.
%(Braces around a macro argument are safe.)


\sect{Operators} \label{Operators}
Nath typsets \verb"\lambda\mathop{\rm id} - g" as 
$$\lambda\mathop{\rm id} - g,$$
whereas \TeX\ would put uneven spacing around the 
minus sign: \hbox{$\lambda \old{mathop}{\rm id} - g$},
erroneously considering the minus sign a unary operator
(by \cite[rule~5 on p.~442]{texb}).

In subscripts of big operators, \verb"\\" is allowed and starts a new 
line, e.g.,
\begin{verbatim}
$$
\sum_{i,j \in K \\ i \ne j} a_{ij}
$$
\end{verbatim}
prints as
$$
\sum_{i,j \in K \\ i \ne j} a_{ij}.
$$

Within math, the exclamation mark \verb"!" alone ensures suitable
spacing around factorials: \verb"C^n_k = \frac{n!}{(n - k)!k!}" 
typesets as $C^n_k = \frac{n!}{(n - k)! k!}$ or
$$
C^n_k = \frac{n!}{(n - k)! k!}.
$$
May be doubled: $(2n)!! = n! 2^n$.

Finally, integral signs stick one to another unless something else 
intervenes:
\begin{verbatim}
$$
\int\int\int_M dV.
$$
\end{verbatim}
produces
$$
\int\int\int_M dV.
$$


\sect{Abbreviations} \label{Abbreviations}
According to typographic tradition, names of variables that are 
abbreviations should be typeset in roman, for which
Nath offers a handy notation: abbreviations are letter strings 
starting from the back quote~`\verb"`"'.
E.g., \verb"$`e^{\pi`i}$" and \verb"$`ad_x y$" typeset as 
$`e^{\pi`i} = -1$ and $`ad_x y$, respectively.

Strings containing more than one letter, such as \verb"`span", 
become math operators.
Until now they must have been declared in advance with some additional
care to avoid conflicts (\verb"\span" is a \TeX\ primitive).
Some more examples: 
$$
H' = H_{`symm}' + H_{`antisymm}', \\
\bar f = f|_{`int U}, \\
a = `const_1, \\
G = `SO(n).
$$


\sect{Roots} \label{Roots}
Nath's \verb"\sqrt" differs in several aspects.
Firstly, its vertical size never depends on the presence of subscripts:
$$
\sqrt{a} + \sqrt{a_j}.
$$
%\end{document}
Secondly, nested \verb"\sqrt"'s are aligned at the top:
$$
\cos\frac \pi{10} = \frac 14 \sqrt{10 + 2 \sqrt 5}.
$$
(Compare it with the \TeX's
$$
\cos\frac \pi{10} = \frac 14 \old{sqrt}{10 + 2 \old{sqrt} 5}.\text{)}
$$
Thirdly, no optional arguments are allowed.
\LaTeX's \verb"\sqrt[3]{x}" must be replaced with 
\verb"\root{3}{x}" to produce $\root{3}{x}$.


\sect{Special symbols} \label{SpecialSymbols}
Nath introduces \verb"\vin" and \verb"\niv" as names of the important 
symbols `$\vin$' and `$\niv$' not included in any standard math font.

Arrows \verb"\to", \verb"\ot", \verb"\otto", and \verb"\mapsto" are 
expandable and descriptable via sub- and superscripts.
Thus, 
\begin{verbatim}
$$
A \to^f_{\text{isomorphism}} B, \qquad a \mapsto^f a'
$$
\end{verbatim}
gives
$$A \to^f_{\text{isomorphism}} B, \qquad a \mapsto^f a'.$$

The command \verb"\adot" denotes the centered dot to be used a
an argument placeholder, as in $f(\adot)$ or $g(\adot,\adot)$.


\sect{Horizontal braces} \label{HorizontalBraces}
The upper and lower horizontal braces are created with
\verb"\underbrace{"{\it expression\/}\verb"}_{"{\it label\/}\verb"}"
and 
\verb"\overbrace{"{\it expression\/}\verb"}_{"{\it label\/}\verb"}",
respectively.
For instance,
\begin{verbatim}
$$
f^n(x) = \underbrace{f(f(\dots f(}_{n \text{ times}}x) \dots))
$$
\end{verbatim}
results in
\delimgrowth = 1
$$
f^n(x) = \underbrace{f(f(\dots f(}_{n \text{ times}}x) \dots))
$$
Observe that the construction does not interfere with the displayed mode 
of delimiters.


\sect{Accents} \label{Accents}
Hat, tilde, and bar accents are extensible and grow wider with the size of 
the accented material:
$$
\hat a + \hat{ab} + \hat{abc}.
$$
When these accents outreach their limit of extensibility, they take the 
superscript position:
$$
\hat{a + b + c}.
$$
A sequence of accents goes from top to down or from right to left.
For instance, 
\verb"\hat\bar a +" \verb"\hat\bar{ab} +" \verb"\hat\bar{abc}" gives
$$
\hat\bar a + \hat\bar{ab} + \hat\bar{abc},
$$
whereas \verb"\hat\bar{a + b + c}" typesets as
$$
\hat\bar{a + b + c}.
$$
All kinds of things may happen if braces intervene as in 
\verb"\bar{\bar{ab}}".

Let us note that \verb"\bar" is not arbitrarily extensible, unlike
\verb"\overline".
For instance, \verb"\hat{\overline{a + b + c}}" gives
$\hat{\overline{a + b + c}}$ 
(over- and underlines and arrows are {\it not\/} accents).
Over a single character, there is no limit on the number and type of 
accents in the sequence; e.g.,
$$
\hat\ddot\tilde W
$$
results from \verb"\hat\ddot\tilde W".
Over an expression, a non-extensible accent, like \verb"\dot",
makes others non-extensible as well.
Thus, \verb"\hat{ab} +" \verb"\dot{ab} +" \verb"\dot\hat{ab} +" 
\verb"\hat\dot{ab}" gives
$$
\hat{ab} + \dot{ab} + \dot\hat{ab} + \hat\dot{ab}.
$$


\sect{Arrays} \label{Arrays}
Entries are typeset in display mode:
$$
\left|\,
\begin{array}{cc} x & 1 \\ 1 & \frac 1x \end{array}
\,\right| = 0.
$$ 
Moreover, arrays grow smaller when used in sub- and superscripts:
$$
`e^{\displayed{(\begin{matrix} a & b \\ c & d \end{matrix})}}.
$$
A \verb"matrix" environment differs from \verb"array" in that it does not 
have any preamble.
As a special case, \verb"\binom{"{\it m}\verb"}{"{\it n}\verb"}"
creates the binomial coefficient $\binom mn$.


\sect{Tensors} \label{Tensors}
With \verb"\nathstyle{tensors}", first-level sub- and superscripts to
ordinary symbols occupy predetermined positions.
Thus, 
\nathstyle{tensors}
$$
A^{[k} B^{l]}_{(k} C_{l)}
$$
\nathstyle{tensors=off}
results from
\begin{verbatim}
\nathstyle{tensors=on}
$$
A^{[k} B^{l]}_{(k} C_{l)}
$$
\end{verbatim}
(unbalanced delimiters are allowed in in-line style).


\sect{Displayed formulas} \label{DisplayedFormulas}
Displayed formulas are indented by \verb"\mathindent" of default
value of 4\,pc.
With \verb"\mathindent" set to a negative length, displayed formulas 
are centered.
Formulas enclosed between double dollars \verb"$$" are unnumbered.
Alternatively one may enclose them between \verb"\[" and \verb"\]".
Ends of lines (any formula may be multiline) are marked with 
\verb"\\". 
Nath does not support automatic line breaks (as does the Downes style
\cite{downes}).

E.g., \verb"$$ ???? = ????, \\ ???? = ????. $$" typesets as a left-aligned 
multiline formula (the punctuation is important, see~\sref "Punctuation"):
$$
\stuff{2cm} = \stuff{5cm}, \\ \stuff{4cm} = \stuff{2cm}.
$$
To achieve finer arrangements, one may begin every continuation line with 
a number of \verb"\quad"'s; e.g.,
two in front of a binary relation, three in front of a binary operation:
\begin{verbatim}
$$
???? = ???? + (???? \\
\qqquad + ????) \\
\qquad = ???? \\
\qquad = ???? . 
$$
\end{verbatim}
gives
$$
\stuff{4cm} = \stuff{1cm} + (\stuff{2cm} \\
\qqquad + \stuff{5cm}) \\
\qquad = \stuff{7cm} \\
\qquad = \stuff{6cm}\,. 
$$


\sect{Walls} \label{Walls}
Walls represent a simple and convenient tool to achieve better
visual appearance of complex displayed equations.
The syntax is \verb"\wall ???? \\" \verb"???? \\" $\cdots$ 
\verb"\\ ???? \return",
and can be arbitrarily nested.
The \verb"\wall" makes every next line to start at the
``wall'' until removed by \verb"\return". 
For instance,
\begin{verbatim}
$$
????
\wall = ???? + (\wall - ???? \\
                      + ????)
                \return 
      = ???? \\
      = ????. 
\return
$$
\end{verbatim}
gives
$$
\stuff{1cm}
\wall = \stuff{1cm} + (\wall - \stuff{4cm}
\\
+ \stuff{5cm}) \return 
= \stuff{7cm} \\
= \stuff{6cm}\,. \return
$$
The typical placement of \verb"\wall" is in front of a relation symbol 
or immediately after an opening delimiter anywhere in the left half 
of a formula.

A simple alternative is \verb"\padded{"{\it A}\verb"}", which prefixes 
each continuation line with {\it A} until stopped by \verb"\return".
Typically, {\it A} is a kern:
\begin{verbatim}
$$ 
\padded\qquad \padded\quad ???? = ???? + (???? \\
                                       + ???? \\
                                       + ????)
              \return 
              = ???? \\
              = ????
\return
$$
\end{verbatim}
gives
$$ 
\padded\qquad \padded\quad \stuff{4cm} = \stuff{1.5cm} + (\stuff{2cm} \\
                                                       + \stuff{6cm} \\
                                                       + \stuff{5cm})
              \return 
              = \stuff{7cm} \\
              = \stuff{4cm}\,.
\return
$$
With short formulas it may be easier to prefix each line with explicit 
\verb"\quad"'s as we did in \sref "DisplayedFormulas".

See \sref"Punctuation" on the interplay between walls and punctuation.


\sect{Alignments} \label{Alignments}
Unfortunately, display mode of delimiters interferes badly with alignments 
unless every cell is balanced (as is, e.g., with matrices).
The recommended solution is to fill the cells with balanced 
wall/return blocks. E.g.,
\begin{verbatim}
\begin{eqnarray*}
???? &=& \wall ???? \\
             + ???? \\
             + ????,
         \return 
\\
???? &=& ????
\end{eqnarray*}
\end{verbatim}
produces
\begin{eqnarray*}
\stuff{5mm} &=& \wall \stuff{7cm} \\
                    + \stuff{7cm} \\
                    + \stuff{3cm},
                \return 
\\
\stuff{3mm} &=& \stuff{5cm}.
\end{eqnarray*}
Walls save \verb"&"'s and ensure vertical 
centering of the equation numbers (see \sref"EquationNumbering").


\sect{Equation numbering} \label{EquationNumbering}
A formula enclosed between \verb"\begin{equation}" and \verb"\end{equation}"
obtains a single number (the value of \verb"\theequation") on the right.
Putting the command \verb"\numbered" inside of an unnumbered formula has 
the same effect:
\begin{verbatim}
$$ 
????. \numbered 
$$
\end{verbatim}
results in
$$ 
\stuff{8cm}. \numbered \label{numbered}
$$
Alternatively, \verb"\eqno{"$A$\verb"}" makes $A$ the equation number.

In emergency, the equation number goes one line below the formula:
\begin{equation} \label{long}
\stuff{10cm}
\end{equation}
We already know that any formula may be multiline.
If so, the equation number is centered:
\begin{equation} 
\stuff{8cm}, \label{short1} \\
\stuff{7cm}. \label{short2}
\end{equation}
To have centered numbers within the \verb"eqnarray" environment, use 
wall/return blocks as described in~\sref "Alignments" (but then
the equation numbers may be overwritten with the formula content without
warning). 

There is also the \verb"eqns" environment, which puts a number on 
each line:
\begin{eqns}
\stuff{8cm}, \label{short3} \\
\stuff{7cm}. \label{short4}
\end{eqns}
It also uses larger and breakable interline space.
Multiline blocks then may be created by using the walls (\sref"Walls").

Equation numbering is normally determined by \verb"\theequation". 
The environment \verb"subabc" introduces a subordinate numbering by letters,
\begin{subabc}
\begin{equation}
A = B, \label{A}
\end{equation}
no matter how many numbered equations are enclosed,
\begin{equation}
C = D. \label{C}
\end{equation}
\end{subabc}
This output was obtained from
\begin{verbatim}
\begin{subabc}
\begin{equation}
A = B, \label{A}
\end{equation}
no matter how many numbered equations are enclosed,
\begin{equation}
C = D. \label{C}
\end{equation}
\end{subabc}
\end{verbatim}
After \verb"\end{subabc}", the original numbering mode is restored:
\begin{equation}
E = F. \label{E}
\end{equation}
Every numbered equation should be referred to somewhere, hence it should 
have a label --- a warning (\sref"ErrorsWarnings") is issued if it does not. 

To put equation numbers on the left, call either the documentstyle 
option \verb"leqno" or the local option \verb"\nathstyle{leqno}".


\sect{Items} \label{Items}
Lay typographers tend to overuse list environments. 
Rather than list items, numbered statements so often encountered in theorems 
and definitions may be alternatively formatted as numbered paragraphs. 
Nath's command \verb"\paritem{"{\it item label\/}\verb"}" starts a numbered 
paragraph and may occur even within a displayed formula.
Our next example demonstrates this:

\bigskip\noindent
The following statements on a real function $f$ are equivalent:
\paritem{(i)} $f$ is continuous;
$$ 
\paritem{(ii)} f(\lim_{i\to\infty} x_i) = \lim_{i\to\infty} f(x_i)
$$
for every converging sequence $x_i$.

In a left-numbered formula, \verb"\paritem" supersedes the numbering
and a warning is issued.


\sect{Punctuation} \label{Punctuation}
Nath provides a simple tool to encourage line breaks after punctuation in 
in-line mode. 
Namely, \verb*"\ " denotes a breakable space no matter where it is used.
Therefore, \verb"$a = b,\ c = d$" will break after the comma,
$a = b,\ c = d$, rather than after the `\,$=$\,' sign.
The inclination to break is measured by \verb"\punctpenalty"
(if a positive integer less than 10000).

Three dots are denoted by \verb"\dots".
In some contexts, their proper place is at the level of math axis, 
e.g., $a_1 + \dots + a_n$.
Nath uses a very simple rule --- the dots are not raised if and only
if they follow a comma or a semicolon.
Accordingly, we have $a_1, \dots, a_n$ and $a_1; \dots; a_n$.

Punctuation after displayed formulas is important for recognizing
continuing lines.
Without punctuation, what seems to be a system of equations
$$ 
U_x = AU \\ 
-U_y = BU
$$ 
may well be a chain of them:
$$
U_x = AU
-U_y = BU.
$$
To disambiguate your notation, be sure to insert comma (or semicolon
or full stop or \verb"\text") at the end of each line that is not continued:
$$
U_x = AU, \\
-U_y = BU.
$$
(Observe that the minus sign starting the second line is typeset closer
to $U$ --- becomes a unary operator.)


\sect{Spacing} \label{Spacing}
Nath's displayed formulas use frozen spacing (\TeX's ``skips'' and ``glues'' 
neither stretch nor shrink).
While it is seldom useful to stretch a displayed formula, one may
wish to shrink formulas too wide to fit between the margins. 
Within the \verb"tight" environment, displayed formulas occupy slightly less
horizontal space.
E.g.,
$$
\sin^6 x =
 -\frac 1{32} \cos 6x + \frac 3{16} \cos 4x
 - \frac{15}{32} \cos 2x + \frac 5{16}
$$
becomes
\begin{tight}
$$
\sin^6 x =
 -\frac 1{32} \cos 6x + \frac 3{16} \cos 4x
 - \frac{15}{32} \cos 2x + \frac 5{16}
$$
\end{tight}
if written as
\begin{verbatim}
\begin{tight}
$$
\sin^6 x =
 -\frac 1{32} \cos 6x + \frac 3{16} \cos 4x
 - \frac{15}{32} \cos 2x + \frac 5{16}
$$
\end{tight}
\end{verbatim}

Striving for safe defaults, Nath sets even interword spaces in text. 
\TeX perts may wish to call \verb"\nonfrenchspacing" 
(see~\cite[p. 74]{texb}) to achieve a century-old look.


\sect{User definitions} \label{UserDefinitions}
Feel free to introduce your own commands by using \verb"\newcommand"
or \verb"\def".
We already gave a useful example of \verb"\ifrac" 
in~\sref"DisplayedFractions".

Here is another example: 
A first-order partial derivative suitable for all math modes and sizes 
can be introduced via
\begin{verbatim}
\newcommand\pd[2]{\frac{\partial#1}{\partial#2}}
\end{verbatim}
We then have
\newcommand\pd[2]{\frac{\partial#1}{\partial#2}}%
$\big(\pd f x \pd g y)^2$ or $`e^{(\pd f x \pd g y)^2}$ or
$$
(\pd f x \pd g y)^2
$$
from one and the same \verb"(\pd f x \pd g y)^2".

The price is that fragile commands occurring inside in-line math may 
have to be protected (any in-line mode material must be considered a 
``moving argument'').
Nath commands are robust by design and need no \verb"\protect"ing.
When encountering a mysterious error, such as ``undefined command
\verb"\wrapfrac@",'' fragile commands are to be blamed.
Besides \verb"\protect", Nath offers \verb"\makerobust", a command 
that takes an already assigned control sequence as argument and makes 
it robust.



\sect{Efficiency}
Nath helps to prevent wasting human work on something that can
be done by computer. 
On average, \LaTeX\ runs about three times slower with Nath than 
without it, depending on the complexity of math formulas.


\sect{Other packages} \label{OtherPackages}
Nath is not guaranteed to be compatible with other \LaTeX\ packages.
However, some combinations turn out to be safe and useful.
For example, when starting a \LaTeX~2.09 document with
\begin{verbatim}
\documentstyle[amssymb,nath]{article}
\end{verbatim}
or a \LaTeX~2$_{\varepsilon}$ document with
\begin{verbatim}
\documentclass{article}
\usepackage{amssymb,nath}
\end{verbatim}
one invokes \verb"amssymb", a component of the famous \AmS-\LaTeX\ 
package from the American Mathematical Society, thereby introducing a 
wider range of mathematical symbols. 
Users can also enable text mode \verb"amsmath" commands by starting a
\LaTeX~2$_{\varepsilon}$ document with
\begin{verbatim}
\usepackage{amsmath,nath}
\end{verbatim}
(math mode commands must be those of Nath).


\sect{Commands of enhanced functionality}
\def??#1??{\if#1**\else{\rm#1}\fi}
\def\sref.#1.{\S\ref{#1}}
\def\ct.#1.{\cite{#1}}
\def\mpst{$\mapsto$}
\def\vn{$\vin$}
\def\nv{$\niv$}
\catcode`\Z=14
\setbox0\hbox{\verb*"\ "}
\def\u{\leavevmode\box0}
A number of math commands have been redefined;
\verb"\old{"{\it command\/}\verb"}" often provides access 
to what \verb"\"{\it command\/} was before Nath redefined it
(see the source code of this guide for examples). 

Here is the list of all enhanced and newly introduced commands:
\begin{verbatim}
?u                ??a breakable space in math (?sref.Spacing.)??
\\                ??see ?sref.Operators. and ?sref.DisplayedFormulas.??
\abbreviation     ??a long form of?? ` ??in math (?sref.Abbreviations.)??
\adot             ??argument placeholder (?sref.SpecialSymbols.)??
\arraycolsep      ??macro, formerly a dimension register (?sref.Arrays.)??
\big              ??making inline delimiters bigger Z
(?sref.Delimiters.)??  
\bigg             ??same as?? \big\big ??(?sref.Delimiters.)??
\biggg            ??same as?? \big\big\big ??(?sref.Delimiters.)??
\biggl            ??same as?? \big\big\left
\bigl             ??same as?? \big\left
\binom            ??binomial coefficient (?sref.Arrays.)??
\delimgrowth      ??see ?sref.Delimiters.??
\displayed        ??forcing displayed math mode (?sref.MathModes.)??
\double           ??doubling a delimiter (?sref.Delimiters.)??
\eqno             ??equation number (?sref.EquationNumbering.)??
\natherrormark    ??a mark to visualize nath errors Z
(?sref.ErrorsWarnings.)??
\factorial        ??long form of?? ! ??in math (?sref.Operators.)??
\fbox             ??making frame around a subformula??
\frac             ??fraction (?sref.Fractions.)??
\gt               ??greater than sign (?sref.Delimiters.)??
\hat              ??attaching hat accent (?sref.Accents.)??
\inline           ??forcing in-line math mode (?sref.MathModes.)??
\int              ??integral sign (?sref.Operators.)??
\langle           ??left angle bracket (?sref.Delimiters.)??
\lAngle           ??left double angle bracket (?sref.Delimiters.)??
\lbrace           ??left brace (?sref.Delimiters.)??
\lbrack           ??left bracket (?sref.Delimiters.)??
\lBrack           ??left double bracket (?sref.Delimiters.)??
\lceil            ??left ceiling bracket (?sref.Delimiters.)??
\lCeil            ??left double ceiling bracket (?sref.Delimiters.)?? 
\ldouble          ??left doubling (?sref.Delimiters.)??
\left             ??left modifier (?sref.Delimiters.)??
\lfloor           ??left floor bracket (?sref.Delimiters.)??
\lFloor           ??left double floor bracket (?sref.Delimiters.)??
\lnull            ??left invisible fence (?sref.Delimiters.)??  
\lt               ??less than sign (?sref.Delimiters.)??
\ltriple          ??left tripling (?sref.Delimiters.)??
\lvert            ??left vertical line (?sref.Delimiters.)??
\lVert            ??left double vertical line (?sref.Delimiters.)??
\mapsto           ??sizeable `?mpst' (?sref.SpecialSymbols.)??
\mathop           ??see ?sref.Operators.??
\mathstrut        ??see ?ct.texb.??
\mid              ??middle vertical line (?sref.Delimiters.)??
\Mid              ??middle double vertical line (?sref.Delimiters.)??
\middle           ??middle modifier (?sref.Delimiters.)??
\Nath             ??logo??
\nathstyle        ??local options (?sref.LocalOptions.)??
\niv              ??the symbol `?nv' (?sref.SpecialSymbols.)??
\nonumber         ??suppresses equation number (?sref.EquationNumbering.)??
\numbered         ??forces equation number (?sref.EquationNumbering.)?? 
\old              ??see the beginning of this section??
\ot               ??sizeable left arrow (?sref.SpecialSymbols.)??
\otto             ??sizeable left-right arrow (?sref.SpecialSymbols.)??
\overbrace        ??horizontal braces over unbalanced math material?? Z ??(?sref.HorizontalBraces.)??

\overleftarrow    ??left arrow over an expression??
\overleftrightarrow  ??left-right arrow over an expression?? 
\overline         ??overline an expression (?sref.Accents.)??
\overrightarrow   ??right arrow over an expression??
\padded           ??like a wall, with every next line padded (?sref.Walls.)??
\paritem          ??numbered statement (?sref.Items.)??
\punctpenalty     ??penalty inserted after punctuation in math Z
(?sref.Punctuation.)??
\quad             ??1em space (?sref.DisplayedFormulas.)??
\qquad            ??2em space (?sref.DisplayedFormulas.)??
\qqquad           ??3em space (?sref.DisplayedFormulas.)??
\rangle           ??right angle bracket (?sref.Delimiters.)??
\rAngle           ??right double angle bracket (?sref.Delimiters.)??
\rbrace           ??right brace (?sref.Delimiters.)??
\rbrack           ??right bracket (?sref.Delimiters.)??
\rBrack           ??right double bracket (?sref.Delimiters.)??
\rceil            ??right ceiling bracket (?sref.Delimiters.)??
\rCeil            ??right double ceiling bracket (?sref.Delimiters.)?? 
\rdouble          ??right doubling (?sref.Delimiters.)??
\return           ??ends?? \wall ??and?? \padded ??(?sref.Walls.)??
\right            ??right modifier (?sref.Delimiters.)??
\rfloor           ??right floor bracket (?sref.Delimiters.)??
\rFloor           ??right double floor bracket (?sref.Delimiters.)??
\rnull            ??right invisible fence (?sref.Delimiters.)??
\root             ??arbitrary root (?sref.Roots.)??
\rtriple          ??right tripling (?sref.Delimiters.)??
\rvert            ??right vertical line (?sref.Delimiters.)??
\rVert            ??right double vertical line (?sref.Delimiters.)??
\scriptscriptstyle  ??setting size to second next level script size??
\scriptstyle      ??setting size to next level script size??
\sqrt             ??square root (?sref.Roots.)??
\stackrel         ??as in ?LaTeX??
\text             ??text within math??
\tilde            ??attaching tilde accent (?sref.Accents.)??
\to               ??sizeable right arrow (?sref.SpecialSymbols.)??
\triple           ??tripling a delimiter (?sref.Delimiters.)??
\underbrace       ??horizontal braces under unbalanced math material?? Z ??(?sref.HorizontalBraces.)??

\underleftarrow   ??left arrow under an expression??
\underleftrightarrow  ??left-right arrow under an expression?? 
\underline        ??underline an expression??
\underrightarrow  ??right arrow under an expression??
\vin              ??the symbol `?vn' (?sref.SpecialSymbols.)?? 
\wall             ??begin a wall/return block (?sref.Walls.)??
\end{verbatim}
Redefined and new environments:  
\begin{verbatim}
array             ??see ?sref.Arrays.?? 
cases             ??as in ?TeX??
eqnsabc           eqns ??within?? subabc
eqnarray          ??as in ?LaTeX??
eqnarray*         ??as in ?LaTeX??
eqnarrayabc       eqnarray ??within?? subabc
eqns              ??a pile of equations (?sref.EquationNumbering.)?? 
equation          ??as in ?LaTeX?? 
matrix            ??see ?sref.Arrays.?? 
subabc            ??subnumbering by letters (?sref.EquationNumbering.)??
tight             ??tighter spacing (?sref.Spacing.)??
\end{verbatim}
The following characters are active, retaining their previous meaning: 
\verb"$",~\verb"^",~\verb"_".
Other characters become active in math mode:
\begin{verbatim}
(                 ??see ?sref.Delimiters.?? 
)                 ??see ?sref.Delimiters.?? 
[                 ??see ?sref.Delimiters.?? 
]                 ??see ?sref.Delimiters.?? 
<                 ??see ?sref.Delimiters.?? 
>                 ??see ?sref.Delimiters.?? 
,                 ??see ?sref.Punctuation.?? 
;                 ??see ?sref.Punctuation.?? 
!                 ??see ?sref.Operators.?? 
`                 ??see ?sref.Abbreviations.?? 
\end{verbatim}
Commands that became obsolete are still preserved in reduced form for
backward compatibility:
\begin{verbatim}
\Big              ??ignored??
\Bigg             ??ignored??
\Biggl            ??same as?? \left
\biggm            ??same as?? \middle
\Biggm            ??same as?? \middle
\biggr            ??same as?? \right
\Biggr            ??same as?? \right
\Bigl             ??same as?? \left
\bigm             ??same as?? \middle
\Bigm             ??same as?? \middle
\bigr             ??same as?? \right
\Bigr             ??same as?? \right
\mathchoice       ??useless??
\mathpalette      ??useless??
\textstyle        ??ignored??
\end{verbatim}
The following \TeX\ commands are disabled:  
\begin{verbatim}
\atop 
\over
\choose
\end{verbatim}
The following \LaTeX\ environment is disabled:  
\begin{verbatim}
math  
\end{verbatim}
New ifs (correspond to local options): 
\begin{verbatim}
\ifgeometry       ??see ?sref.Delimiters.?? 
\ifleqno          ??see ?sref.EquationNumbering.??
\ifsilent         ??see ?sref.ErrorsWarnings.?? 
\iftensors        ??see ?sref.Tensors.??
\end{verbatim}
New dimension registers:  
\begin{verbatim}
\arraycolsepdim   ??former?? \arraycolsep
\displaylineskiplimit
\mathindent       ??see ?sref.DisplayedFormulas.?? 
\mex              ??a prorated?? ex
\paritemwd        ??see ?sref.Items.?? 
\end{verbatim}
New skips (self-explanatory):
\begin{verbatim}
\displaybaselineskip
\displaylineskip
\interdisplayskip
\intereqnsskip
\beloweqnsskip
\end{verbatim}
New boxes: 
\begin{verbatim}
\sizebox          ??delimiters match it (?sref.Delimiters.)??
\end{verbatim}
Moreover, Nath takes box and token registers on the fly.


\sect{Final remarks} \label{FinalRemarks}
Nath is a scientific software intended to assist and ease the process
of scientific publication. 
By disburdening the encoding of mathematics, Nath tries to uphold
\TeX's position as a language suitable for both scientific and 
typographic purposes --- especially if alternatives are still elusive.

Nath is provided as it is; only bug reports and serious discussion 
should go to \verb"M.Marvan@"\verb"math.slu.cz".

\setbox0\hbox{\tt kkkk}
\def????{\leavevmode\hbox to\wd0{\hss\it stuff\/\hss}}


\sect{Release 2003} \label{Release2003}
Fixing several bugs, a new release is available since February 2003. 

As a new feature, Nath takes care of the interline spacing in arrays.
There is a new dimension register \verb"\arrayrowsepdim" to hold the
minimal interline space.
Also, the default setting of \verb"\doublerulesep" is \verb"\arrayrulewidth",
so that horizontal lines produced by successive \verb"\hline"'s 
stick one to another, and similarly for the vertical lines:
$$
\begin{array}{||ccc||}
\hline\hline
p & q & r \\
\hline
1 & 1 & 0 \\
1 & 0 & 0 \\
\frac12 & 1 & 0 \\
\hline\hline
\end{array}
$$
These changes do not affect the \verb"tabular" environment.

The \verb"\padded" command now applies to continuation lines only.
For example
$$
\padded{\qquad}
\stuff{3cm} = \stuff{3.5cm} \\
         - \stuff{6cm}, \\
\stuff{4cm} = \stuff{1.5cm} \\
         - \stuff{7cm}, \\
\stuff{2cm} = (\stuff{2cm}, \\
         -\stuff{2cm}). 
\return
$$
is produced by a single \verb"\padded"--\verb"\return" pair:
\begin{verbatim}
\padded{\qquad}
???? = ???? \\
       - ????, \\
???? = ???? \\
       - ????, \\
???? = (????, \\
       -????). 
\return
\end{verbatim}
(Commas that occur within delimiters do not start a new equation.)

Some errors still survive. 
In particular, double accents do not work with MathTime fonts.


\begin{thebibliography}{9}
\small

\bibitem{AIP} 
{\it AIP Style Manual}, 4th edition
(Amer. Inst. Physics, New York, 1990).
\bibitem{downes} 
M. Downes, Breaking equations, {\it TUGboat} 18 (1997) 182--194.
\bibitem{texb} 
D.E. Knuth, {\it The \TeX book} (Addison Wesley, Reading, 1984).
\bibitem{EuroTeX} 
M. Marvan, Natural \TeX\ notation in mathematics,
in: Proc. Conf. {\it Euro\TeX\ 2001}, Kerkrade, 23--27 September 2001;
online {\tt www.ntg.nl/eurotex/marvan-3.pdf}.
\end{thebibliography}

\end{document}










