summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/mattens
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-09-24 17:10:33 +0000
committerNorbert Preining <preining@logic.at>2009-09-24 17:10:33 +0000
commit6b3e4f3f58c3a0728870967c9372697025a4478e (patch)
tree6170501be47579706e89b00bb441176c0ea4b6f4 /Master/texmf-dist/source/latex/mattens
parentb9860d220e7bce989933e1d38ba086a3b90f0a4f (diff)
add mattens package
git-svn-id: svn://tug.org/texlive/trunk@15445 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/mattens')
-rw-r--r--Master/texmf-dist/source/latex/mattens/mattens.dtx1719
-rw-r--r--Master/texmf-dist/source/latex/mattens/mattens.ins37
2 files changed, 1756 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/mattens/mattens.dtx b/Master/texmf-dist/source/latex/mattens/mattens.dtx
new file mode 100644
index 00000000000..46115b9f906
--- /dev/null
+++ b/Master/texmf-dist/source/latex/mattens/mattens.dtx
@@ -0,0 +1,1719 @@
+% \iffalse
+%
+% mattens.dtx Copyright (C) 2001,2004 DNJ Els
+%
+% It may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.1
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.1 or later is part of all distributions of LaTeX
+% version 1999/06/01 or later.
+%
+%<*driver>
+\documentclass[a4paper]{ltxdoc}
+\usepackage{amsmath}
+\usepackage{amsfonts}
+ \DeclareMathSymbol{\square}{\mathord}{AMSa}{"03}
+\usepackage{color}
+ % Declare the following two saved boxes before
+ % the accents and bm packages are loaded
+ \newsavebox{\AccentBox}
+ \sbox{\AccentBox}{$\dot{\overline{f}}^a_b$}
+\usepackage{array}
+\usepackage{accents}
+\usepackage{mattens}
+\usepackage{bm}
+ \bmdefine{\bO}{\mathit{\Omega}}
+
+ \EnableCrossrefs
+ %\DisableCrossrefs % Say \DisableCrossrefs if index is ready
+ \CodelineIndex
+ \RecordChanges % Gather update information
+ %\OnlyDescription % comment out for implementation details
+ \setlength\hfuzz{15pt} % dont make so many
+ \hbadness=7000 % over and under full box warnings
+ \DeclareMathAlphabet{\mathsfsl}{OT1}{cmss}{m}{sl}
+\begin{document}
+ \DocInput{mattens.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+% \CheckSum{585}
+%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%%
+%
+% \DoNotIndex{\,, \@empty, \@gobble, \@ifnextchar, \@ifstar,
+% \@ifundefined, \@firstofone}
+% \DoNotIndex{\addtolength}
+% \DoNotIndex{\begingroup, \boldsymbol, \box}
+% \DoNotIndex{\copy, \csname, \CurrentOption}
+% \DoNotIndex{\DeclareOption, \DeclareRobustCommand, \def, \dp}
+% \DoNotIndex{\edef, \else, \endcsname, \endgroup, \ensuremath,
+% \expandafter}
+% \DoNotIndex{\fi}
+% \DoNotIndex{\global}
+% \DoNotIndex{\hskip, \ht}
+% \DoNotIndex{\ifdim, \ifx}
+% \DoNotIndex{\leavevmode, \left, \let, \lVert}
+% \DoNotIndex{\m@th, \mathpalette, \mathsf, \mathstrut, \mskip}
+% \DoNotIndex{\NeedsTeXFormat, \newbox, \newcommand, \newif, \newlength,
+% \newmuskip, \newsavebox, \null}
+% \DoNotIndex{\overline}
+% \DoNotIndex{\PackageError, \PackageWarning, \ProcessOptions, \protect,
+% \protected@xdef, \providecommand, \ProvidesPackage}
+% \DoNotIndex{\relax, \renewcommand, \RequirePackage, \right, \rlap,
+% \rVert}
+% \DoNotIndex{\sbox, \setbox, \setlength, \space, \string}
+% \DoNotIndex{\the}
+% \DoNotIndex{\underline, \usebox, \wd, \widetilde}
+% \DoNotIndex{\z@}
+%
+% \changes{1.0}{2001 Dec 9}{Initial version}
+% \changes{1.1}{2004 Jan 15}{Doc: Updated}
+%
+%
+% \GetFileInfo{mattens.sty}
+%
+% ^^A Some commands to format document %%%%%%%%%%%%%
+%
+% \newcommand*{\pkg}[1]{\textsf{#1}}
+% \newcommand*{\opt}[1]{\textsf{#1}}
+% \newcommand*{\MT}{\pkg{mattens}}
+% \newcommand*{\Hass}{Hassenpflug}
+%
+% \newcommand*{\myemph}[1]{\emph{#1}}
+%
+% \newenvironment{Decl}^^A
+% {\par\small\addvspace{2.3ex plus 1ex}^^A
+% \vskip -\parskip
+% \noindent\hspace{\leftmargini}^^A
+% \begin{tabular}{|l|}\hline\ignorespaces}^^A
+% {\\\hline\end{tabular}\nobreak\par\nobreak
+% \vspace{2.3ex}\vskip -\parskip}
+%
+% \newenvironment{Indent}[1]{^^A
+% \begin{list}{}{^^A
+% \setlength{\topsep}{0pt}^^A
+% \setlength{\leftmargin}{#1}^^A
+% \setlength{\listparindent}{\parindent}^^A
+% \setlength{\itemindent}{\parindent}^^A
+% \setlength{\parsep}{\parskip}}^^A
+% \item[]
+% }{\end{list}}
+%
+% \newenvironment{sample}{^^A
+% \begin{quote}\small\begin{tabbing}^^A
+% \hskip12pc\=\kill}^^A
+% {\end{tabbing}\end{quote}}
+%
+% \newcommand*{\sphline}{^^A horizontal table line with spaces
+% \noalign{\vskip3pt}^^A
+% \hline^^A
+% \noalign{\vskip3pt}}
+%
+% \newcommand{\dotr}[1]{\accentset{\phantom{r}{\displaystyle.}r}{#1}}
+%
+% \makeatletter
+% \newcommand{\DeclareSBox}[2]{%
+% \@ifdefinable{#1}{^^A
+% \edef\tempa{\expandafter\@gobble\string#1}^^A
+% \edef\tempa{\csname MTbox@\tempa\endcsname}^^A
+% \expandafter\newbox\tempa^^A
+% \global\sbox{\tempa}{#2}^^A
+% \protected@xdef#1{\noexpand\usebox{\tempa}}^^A
+% }}
+% \newcommand*{\tdot}{\ensuremath{\cdot}}
+% \newcommand*{\trnsp}{\ensuremath{\mathsf{T}}}
+% \newcommand*{\norm}[1]{\ensuremath{\lVert{#1}\rVert}}
+% \newcommand*{\SB}[1]{\ensuremath{\left[\, #1\right]}}
+% \makeatother
+%
+% \MakeShortVerb{\|}
+%
+% \title{The \MT\ package\thanks{This file has version number
+% \fileversion, last revised
+% \filedate.}}
+% \author{Danie Els}
+% \date{\filedate}
+% \maketitle
+%
+% \begin{abstract}
+% \noindent The \MT\ package contains the definitions to typeset vectors and
+% tensors such as \aS{e}_i, \bS[\dot]{x}^r, \bSb{E}^s_r, etc., for the representation of common
+% vectors and tensors such as forces, velocities, moments of inertia,
+% etc.
+% These symbols (and variants thereof) are found on the black
+% boards of engineering schools and in many journals and books,
+% particularly those concerned with dynamics and kinematics.
+%
+% This package adheres to the well defined and documented notation
+% of Hassenpflug.\footnote{
+% Hassenpflug, W.C.,
+% Matrix Tensor Notation Part I. Rectilinear Orthogonal Coordinates.
+% \emph{Comput. Math.\ Applic.,} vol.\ 26, no.\ 3, 1993, pp.\ 55--93.}
+% \footnote{
+% Hassenpflug, W.C.,
+% Matrix Tensor Notation Part II. Skew and Curved Coordinates.
+% \emph{Comput. Math. Appl.}, vol.\ 29, no.\ 11, 1993, pp. 1--103.}
+%
+% \medskip
+%
+% \noindent\slshape{\bfseries Keywords:} vector, matrix, tensor, notation.
+% \end{abstract}
+%
+% \clearpage
+% {\parskip0pt\tableofcontents}
+%
+% \clearpage
+% \section{Background}
+%
+% A browse through journals and handbooks, in particular those
+% concerned with dynamics, reveals an amazing array of private
+% notations for vectors and tensors. Every author has his or her own
+% notation, making it very difficult to comprehend what is going on
+% in complex multi reference axes environments.
+%
+% This package is based on the notation of \Hass\cite{Hass93a,Hass93b}.
+% It was developed and refined by Dr.~\Hass{} over many years of
+% teaching engineering, and as stated by him\cite{Hass93a}:
+%
+% \begin{quote}
+% \slshape``It is designed particulary to distinguish between
+% vectors and tensors and their representation as vectors and matrices
+% in different coordinate systems. The main purpose of this notation
+% is that it can be used in the teaching situation, therefore, it
+% conveys all the information explicitly in the symbols, and it can be
+% used in handwriting.''
+% \end{quote}
+% \noindent \Hass\cite{Hass93a} identifies the following list of
+% requirements for a good notation for tensor quantities and
+% operations, to which his notation conforms. A notation must:
+% \begin{itemize}
+% \item be easily written by hand;
+% \item distinguish between vector and scalar quantities;
+% \item distinguish between (second order) tensors and vectors;
+% \item distinguish between physical vectors and their
+% representation by vector arrays, and between physical
+% (second order) tensors and their representation by matrices;
+% \item distinguish between row and column vectors;
+% \item use the same symbol as name for the same vector or tensor in
+% either its physical sense or its representation by a vector
+% array or matrix in different coordinate axes;
+% \item distinguish between matrix/vector representation of the same
+% vector/tensor in different coordinate axes;
+% \item be equally valid in orthonormal and skew coordinate
+% axes;
+% \item indicate all intended operations uniquely;
+% \item be equally valid in all dimensions;
+% \item be equally valid for algebraic vector/matrix algebra
+% which has no connection to any metric space;
+% \item be applicable to differentials;
+% \item allow for defaults to avoid repetitive elaborate symbols, i.e.,
+% not all the symbols need to be written down explicitly if it is
+% clear from the context.
+% \item It must be well documented (own addition).
+% \end{itemize}
+%
+% \noindent The \MT\ package was developed to typeset the \Hass{} matrix
+% tensor symbols in a consistent manner.
+%
+% An appeal is made to
+% the engineering and scientific community to adopt
+% this notation, because of its consistency
+% and ease of use.
+%
+%
+% \section{Usage of \MT\ package}
+%
+% The \MT\ package is loaded in the document preamble with:
+% \begin{quote}
+% \begin{tabbing}^^A
+% \hskip14pc\=\kill^^A
+% $~~~\vdots$\\
+% \cmd{\usepackage}\oarg{options}|{mattens}| \>|% amsmath loaded internally|\\
+% $~~~\vdots$\\
+% \cmd{\usepackage}\marg{font packages} \>|%|\\
+% \cmd{\DeclareSymbolFont}... \>|% All the font changes|\\
+% \cmd{\SetSymbolFont}... \>|%|\\
+% \cmd{\DeclareSymbolFontAlphabet}... \>|%|\\
+% $~~~\vdots$\\
+% \cmd{\usepackage}|{bm} %\boldsymbol redirected to call \bm|\\
+% $~~~\vdots$
+% \end{tabbing}
+% \end{quote}
+%
+% \noindent When \MT\ is loaded, the \pkg{amsmath} package is loaded
+% automatically, because it is needed for the redefined
+% \cmd{\overrightarrow} and \cmd{\underrightarrow} commands,
+% as well as the \cmd{\boldsymbol} command. It
+% must be loaded before any font packages
+% that redefine some of the \pkg{amsmath} symbols or commands.
+%
+% On the other hand, the preferred method for obtaining bold
+% italic math symbols is the \cmd{\bm} command of the
+% \pkg{bm} package.\footnote{In the \pkg{amsmath} documentation,
+% \AmS{} recommends the \cmd{\bm} command of the \pkg{bm} package
+% instead of the \cmd{\boldsymbol} command for bold italic math
+% symbols. The \cmd{\boldsymbol} puts its contents in a box,
+% \cmd{\mbox\{}\cmd{\boldmath\$}\meta{contents}\texttt{\$\}},
+% while \cmd{\bm} is a font changing command that uses the appropriate
+% bold math font.}
+% The \pkg{bm} package must be loaded after all the font packages
+% in order for it to recognize the bold math versions.
+% The \pkg{bm} package reroutes the \cmd{\boldsymbol} command to point
+% to \cmd{\bm}. If \cmd{\boldsymbol} is called after
+% the \pkg{bm} package is loaded, it is equivalent to
+% \cmd{\bm}.
+% If the \pkg{bm} package is not loaded, \MT\ defaults to
+% the \cmd{\boldsymbol} command.
+%
+% The \MT\ package by default sets bold italics symbols. This
+% choice stems from the ISO standards for typesetting of vectors
+% and tensors. The formatting of symbols then indicates the fact
+% that it is a vector/tensor and the lines, arrows and sub- and
+% superscripts indicate the specific type and reference axes.
+%
+% The following options are recognized by \MT:
+%
+% \begin{description}
+% \item[\normalfont\opt{noformat}:~~ ] No symbol formatting is performed,
+% otherwise symbols are set by default in bold italics with the
+% \cmd{\boldsymbol} or \cmd{\bm} command.
+%
+% It is important to note that the \Hass{} requirement of easily
+% written by hand is not fulfilled if the symbols are formatted
+% by anything else than normal math fonts.
+%
+% \item[\normalfont\opt{mathstrut}: ~~] A mathstrut is inserted
+% with the symbol to force all the lines and arrows to the same
+% height and depth. The default is no mathstrut.
+% \end{description}
+%
+% \clearpage
+% \section{List of \MT\ commands}
+%
+% \begin{table}[htbp]
+% \caption{List of Matrix Tensor typing commands} \label{tab:1}
+% \small
+% \renewcommand{\footnoterule}{}
+% \begin{tabular}{@{}ll>{\itshape}r@{}>{\itshape}c@{}>{\itshape}lc@{}}
+% \sphline
+% \bfseries Type &
+% \bfseries Command &
+% \multicolumn{3}{c}{
+% \bfseries Description} &
+% \bfseries Output\\
+% \sphline
+% Physical column vector&
+% \cmd{\aS}\oarg{accent}\marg{Symbol}\SpecialUsageIndex{aS} &
+% arrow--&Symbol& &
+% \aS{x} \\[1.0ex]
+%
+% Physical row vector &
+% \cmd{\Sa}\oarg{accent}\marg{Symbol}\SpecialUsageIndex{Sa} &
+% &Symbol&--arrow&
+% \Sa{x} \\[1.0ex]
+%
+% Column vector &
+% \cmd{\bS}\oarg{accent}\marg{Symbol}\SpecialUsageIndex{bS} &
+% bar--&Symbol& &
+% \bS{x} \\[1.0ex]
+%
+% Row vector &
+% \cmd{\Sb}\oarg{accent}\marg{Symbol}\SpecialUsageIndex{Sb} &
+% &Symbol&--bar &
+% \Sb{x} \\[1.0ex]
+%
+% Physical tensor &
+% \cmd{\aSa}\oarg{accent}\marg{Symbol}\SpecialUsageIndex{aSa}&
+% arrow--&Symbol&--arrow&
+% \aSa{E}\\[1.0ex]
+%
+% Tensor (mixed base) &
+% \cmd{\aSb}\oarg{accent}\marg{Symbol}\SpecialUsageIndex{aSb}&
+% arrow--&Symbol&--bar &
+% \aSb{E}\\[1.0ex]
+%
+% Tensor (mixed base) &
+% \cmd{\bSa}\oarg{accent}\marg{Symbol}\SpecialUsageIndex{bSa}&
+% bar--&Symbol&--arrow&
+% \bSa{E}\\[1.0ex]
+%
+% Tensor &
+% \cmd{\bSb}\oarg{accent}\marg{Symbol}\SpecialUsageIndex{bSb}&
+% bar--&Symbol&--bar &
+% \bSb{E}\\[1.0ex]
+%
+% Cross-product tensor$^\dag$
+% &
+% \cmd{\aCSa}\oarg{accent}\marg{Symbol}\SpecialUsageIndex{aCSa}&
+% arrow--C&Symbol&--arrow&
+% \aCSa{w} \\[1.0ex]
+%
+% Cross-product tensor &
+% \cmd{\bCSb}\oarg{accent}\marg{Symbol}\SpecialUsageIndex{bCSb}&
+% bar--C&Symbol&--bar &
+% \bCSb{w} \\[1.0ex]
+%
+% \sphline
+%
+% \multicolumn{5}{@{}l}{\footnotesize$^\dag$~
+% It is defined as the tensor
+% \bCSb{a}\ associated with the vector \bS{a}, where
+% $\bS{a}\times\bS{c}=\bCSb{a}\cdot\bS{c}$}
+% \end{tabular}
+% \end{table}
+%
+% \subsection{General syntax}
+%
+% The general syntax of the \MT\ commands is
+%{\newcommand*\m{\raisebox{.1ex}{$\scriptscriptstyle\square$}}^^A
+% \begin{Decl}
+% |\|\m|S|\m\,| |\oarg{accent}\marg{Symbol} ~~
+% |\|\m|CS|\m\,| |\oarg{accent}\marg{Symbol}\\[1ex]
+% |\|\m|S|\m\,|*|\oarg{accent}\marg{Symbol}~~~
+% |\|\m|CS|\m\,|*|\oarg{accent}\marg{Symbol}
+% \end{Decl}}
+%
+% \noindent with command names \cmd{\bS}, \cmd{\aS}, \cmd{\aSa}, \cmd{\aSb}, etc.
+% See table\:\ref{tab:1} for a full list of all the commands. The
+% ``starred'' form is used to set the
+% symbol in normal math. This can be used for compound tensors or for
+% pre-declared symbols (see \pkg{bm} documentation).
+% An example of the usage is
+% \begin{sample}
+% \hskip4pc\=\hskip8pc\=\hskip2pc\=\kill^^A
+% \cmd{\aS}|{e}| \> \cmd{\aS*}|{e}| \> \aS{e} \> \aS*{e}\\[0.75ex]
+% \cmd{\Sb}|{x}| \> \cmd{\Sb*}|{x}| \> \Sb{x} \> \Sb*{x}\\[0.75ex]
+% \cmd{\aCSa}|{z}|\> \cmd{\aCSa*}|{z}| \> \aCSa{z}\> \aCSa*{z}
+% \end{sample}
+% The optional argument \meta{accent} is intended for
+% \LaTeX{} accent commands such as \cmd{\dot}, \cmd{\ddot}, etc., or
+% their $\AmS$ equivalents, \cmd{\Dot}, \cmd{\Ddot}.
+%
+% \begin{sample}
+% |\bS[\Ddot]{x}| \> \bS[\Ddot]{x}
+% \end{sample}
+%
+% \noindent The \MT\ commands look ahead for sub- and superscripts (including primes)
+% in order to place them at the correct horizontal and vertical
+% positions.
+% \begin{sample}
+% \cmd{\bS}|[|\cmd{\Dot}|]{x}^s_i| \> \bS[\Dot]{x}^s_i\\[1ex]
+% \cmd{\bS}|[|\cmd{\Ddot}|]{x}_i^s| \> \bS[\Ddot]{x}_i^s\\[1ex]
+% \cmd{\bS}|{x}''^s_i| \> \bS{x}''^s_i\\[1ex]
+% \cmd{\bSa}|{E}^k| \> \bSa{E}^k\\[1ex]
+% \cmd{\aSb}|[|\cmd{\Dot}|]{E}_s| \> \aSb[\Dot]{E}_s
+% \end{sample}
+%
+% \noindent These commands, including the sub- and
+% superscripts, can be used in text mode.
+%
+% \begin{sample}
+% |Vector \bS{x}^s_i{} in text.| \>
+% Vector \bS{x}^s_i{} in text.
+% \end{sample}
+%
+% \noindent The commands are also robust and can be used in moving commands
+% such as footnotes\footnote{A vector \aS{e}_i\ in a footnote},
+% headers, etc.
+%
+% \begin{sample}
+% |\footnote{A vector \aS{e}_i{} in a footnote}|
+% \end{sample}
+%
+% \noindent The symbols scale to the appropriate sizes if used in sub- and
+% superscripts. For example, for an integration path parameterized
+% by the vector $\bS{r}^s(\xi)$, the equation for a line integral
+%
+% \begin{verbatim}
+% \begin{equation*}
+% \oint\limits_{\bS{r}^s(\xi)} \dotsi
+% \end{equation*}
+% \end{verbatim}
+% gives
+% \[\oint\limits_{\bS{r}^s(\xi)} \dotsi\]
+%
+% \bigskip
+%
+% ^^A\clearpage
+% \section{Symbol formatting commands}
+% \subsection{Bold italic symbols}
+%
+% \noindent The symbol format can be set with the package options
+%
+% \begin{sample}
+% \hskip14pc\=\kill
+% |\usepackage{mattens}| \>Uses |\boldsymbol| as default\\
+% |\usepackage[noformat]{mattens}| \>No symbol formatting
+% \end{sample}
+%
+% \noindent or anywhere in the document with the command
+%
+% \begin{Decl}
+% \cmd{\SetSymbFont}\marg{font-command}^^A
+% \SpecialUsageIndex{\SetSymbFont}
+% \end{Decl}
+%
+% \noindent The \pkg{bm} package reroutes the \cmd{\boldsymbol} command to point
+% to \cmd{\bm}. If \cmd{\SetSymbFont}|{\boldsymbol}| is called after
+% the \pkg{bm} package is loaded, it is equivalent to
+% \cmd{\SetSymbFont}|{\bm}|. Bold formatting of individual tensors
+% can also be switched off with the use of the starred forms of the
+% tensor commands.
+%
+% If the symbols are interpreted as tensors, then according to the ISO,
+% it can be typeset in a slanted sans serif font (if you are fond
+% of fonts). For the Computer Modern fonts with an \texttt{OT1}
+% encoding, you can put in the preamble
+%
+% \begin{quote}
+% |\DeclareMathAlphabet{\mathsfsl}{OT1}{cmss}{m}{sl}|
+% \end{quote}
+%
+% \noindent Examples of formats are
+%
+% \begin{sample}
+% |\SetSymbFont{\bm}| \>\SetSymbFont{\bm}\aSb{E}_s\\[1ex]
+% |\SetSymbFont{\relax}| \>\SetSymbFont{\relax}\aSb{E}_s\\[1ex]
+% |\SetSymbFont{\mathsfsl}| \>\SetSymbFont{\mathsfsl}\aSb{E}_s
+% \end{sample}
+% \SetSymbFont{\bm}
+%
+% Only the first symbol (or group) in multi-symbol constructions is
+% formatted. This can be used to obtain
+%
+% \begin{sample}
+% |\bS{{}xy}| ~|\bS*{xy}| \> \bS{{}xy} ~ \bS*{xy}\\
+% |\bS{xy}| \> \bS{xy} \\
+% |\bS{{xy}}| \> \bS{{xy}}
+% \end{sample}
+% or
+% \begin{sample}
+% |\bCSb*{\bS{x}+\bS{y}}| \> \bCSb*{\bS{x}+\bS{y}}\\[1ex]
+% |\bSb{E_{313}}^s_r| \> \bSb{E_{313}}^s_r
+% \end{sample}
+%
+% When a font does not have bold italic symbols and is properly
+% configured, the |\bm| command
+% constructs the symbols with the ``poor man's bold''
+% method. This results in the loss of the subscript kerning.
+% This is the case for the \pkg{mathptm}\ package for Times fonts.
+% If bold italic symbols are needed for Times fonts, it is advisable
+% to use the \pkg{txfonts} package or one of the commercial fonts.
+%
+%
+% \subsection{Struts}
+%
+% A strut can be inserted inside the tensor construction to force
+% all the lines to the same height. This can be given in the package
+% options
+%
+% \begin{sample}
+% \hskip14pc\=\kill
+% |\usepackage{mattens}| \>No strut as default \\
+% |\usepackage[mathstrut]{mattens}| \>Uses |\mathstrut|
+% \end{sample}
+%
+% \noindent or anywhere in the document with the command
+%
+% \begin{Decl}
+% \SpecialUsageIndex{\SetSymbStrut}^^A
+% \cmd{\SetSymbStrut}\marg{strut}
+% \end{Decl}
+%
+% \noindent For example
+%
+% \SetSymbStrut{\relax}
+% \begin{sample}
+% |\SetSymbStrut{\relax}| \\
+% |\bSb{E}|, |\bS{f}|, |\Sb{y}| \>\bSb{E}, \bS{x}, \Sb{y}
+% \end{sample}
+% \SetSymbStrut{\mathstrut}%
+% \begin{sample}
+% |\SetSymbStrut{\mathstrut}| \\
+% |\bSb{E}|, |\bS{f}|, |\Sb{y}| \>\bSb{E}, \bS{x}, \Sb{y}
+% \end{sample}
+% \SetSymbStrut{\vphantom{E}}%
+% \begin{sample}
+% |\SetSymbStrut{\vphantom{E}}| \\
+% |\bSb{E}|, |\bS{f}|, |\Sb{y}| \>\bSb{E}, \bS{x}, \Sb{y}
+% \end{sample}
+% \SetSymbStrut{\relax}
+%
+% \subsection{Additional sub- and superscript spaces}
+%
+% The placing of the sub- and superscripts was fine-tuned for
+% Computer Modern fonts. Other fonts may require the sub- and
+% superscript to shift closer or further away from the lines and the
+% symbols. Additional spaces can be inserted before the sub- and
+% superscripts with the following commands:
+%
+% \begin{Decl}
+% \cmd{\SetArrowSkip}\marg{muskip length}\\[.5ex]
+% \cmd{\SetBarSkip}\marg{muskip length}\\[.5ex]
+% \cmd{\SetSymSubSkip}\marg{muskip length}\\[.5ex]
+% \cmd{\SetSymSupSkip}\marg{muskip length}
+% \SpecialUsageIndex{\SetArrowSkip}
+% \SpecialUsageIndex{\SetBarSkip}
+% \SpecialUsageIndex{\SetSymSubSkip}
+% \SpecialUsageIndex{\SetSymSupSkip}
+% \end{Decl}
+%
+% \noindent The length units must be in math units (\myemph{mu}), where
+% $18\,\mathit{mu}=1\,\mathit{em}$ (a little less than the
+% width of the letter ``M'').
+%
+%
+%
+% \section{Other packages and classes}
+%
+% \begin{description}
+%
+% \item[\normalfont\pkg{bm}:~~] The \pkg{bm} package is preferred for
+% bold\-/\-heavy symbols in math mode. It can also be used to
+% predeclare bold symbols for use with the starred form of the tensor
+% commands, for example:
+% \SetSymbFont{\bm}
+% \begin{sample}
+% |\bmdefine{\bO}{\mathit{\Omega}}|\\
+% |\bSb*{\bO_i}| \>\qquad\qquad\qquad \bSb*{\bO_i}
+% \end{sample}
+%
+% \item[\normalfont\pkg{hyperref}:~~]
+% When tensor symbols are set in chapter and section headers,
+% \pkg{hyperref} crashes if the \cmd{\texorpdfstring} command is not used.
+% \begin{sample}
+% |\section{A header with \texorpdfstring{\bS{x}^i_j}{xij}\ in it}| \\
+% \end{sample}
+%
+% \item[\normalfont\pkg{color}:~~]
+% To change the colour of a symbol the \cmd{\color} command must
+% be grouped two levels deep to survive all the expansions if the
+% \pkg{bm} package is loaded.
+% \begin{sample}
+% |\aSb{{{\color{red}E}}}_i| \> \aSb{{{\color{red}E}}}_i \\
+% \end{sample}
+%
+% \item[\normalfont\pkg{slide}, \pkg{foils}:~~]
+% The Euler math fonts are definitely compulsory. The ratio of
+% the sub- and superscript sizes to normal math font sizes is too
+% big inside the \pkg{slide} class. For tensors such as \bS{x}^j_k,
+% you may find that the sub- and superscripts overlap. Choose
+% your script characters carefully. \\
+%
+% \item[\normalfont\pkg{eulervm}:~~]
+% The \Hass{} ideal of symbols that are easily written by hand
+% is satisfied with the beautiful letters of the Euler fonts.
+% This package is a must for presentation material, but \myemph{please
+% do not use bold Euler symbols}, they just do not look right! \\
+%
+% \item[\normalfont\pkg{accents}:~~]
+% For the creation of alternative accents the \MT\ package is fully
+% compatible with the \pkg{accents}\ package.
+% As an example of its usage, the equation in \Hass\cite{Hass93a},
+% \S10.1, p.82
+%
+% \begin{minipage}{\textwidth}
+% \begin{verbatim}
+% \SetSymbFont{\relax}
+% \SetSymbStrut{\mathstrut}%
+% \newcommand{\dotr}[1]{\accentset{\phantom{r}{\displaystyle.}r}{#1}}
+% \begin{equation*}
+% \text{apparent velocity} = \frac{\partial_r}{\mathrm{d}t} \aS{r}
+% = \aS[\dotr]{r}
+% = \aSb{E}_s \tdot \bS[\dotr]{r}^s
+% \equiv \aS{v}_{\mathrm{app}}
+% = \aS{v}_{\mathrm{rel}}
+% \end{equation*}
+% \end{verbatim}
+% \end{minipage}
+% which gives\SetSymbFont{\relax}\SetSymbStrut{\mathstrut}%
+% \begin{equation*}
+% \text{apparent velocity} =
+% \frac{\partial_r}{\mathrm{d}t} \aS{r} =
+% \aS[\dotr]{r} =
+% \aSb{E}_s \tdot \bS[\dotr]{r}^s \equiv
+% \aS{v}_{\mathrm{app}} =
+% \aS{v}_{\mathrm{rel}}
+% \end{equation*}
+% \SetSymbStrut{\relax}\SetSymbFont{\bm} \\
+%
+% \end{description}
+% ^^A\clearpage
+%
+%
+%
+% \section{Additional commands}
+%
+% The commands in this section are no longer part of the \MT\
+% package, but the definitions are supplied here if the user
+% needs them.
+%
+% \subsection{Saving equations}
+% \changes{1.1}{2004 Jan 15}{Doc: Code for \cs{DeclareSBox}, \cs{SB},
+% \cs{norm}, \cs{trnsp}, \cs{tdot}
+% added to documentation.}
+% \begin{Decl}
+% \SpecialUsageIndex{\DeclareSBox}
+% \cmd{\DeclareSBox}\marg{$\backslash$cmd}\marg{contents}
+% \end{Decl}
+% \begin{sample}
+% |\newcommand{\DeclareSBox}[2]{% |\\
+% | \@ifdefinable{#1}{% |\\
+% | \edef\tempa{\expandafter\@gobble\string#1}% |\\
+% | \edef\tempa{\csname MTbox@\tempa\endcsname}% |\\
+% | \expandafter\newbox\tempa% |\\
+% | \global\sbox{\tempa}{#2}% |\\
+% | \protected@xdef#1{\noexpand\usebox{\tempa}}% |\\
+% | }} |
+% \end{sample}
+%
+% \noindent The \cmd{\DeclareSBox} command can be used
+% to save the \meta{contents} in a savebox
+% |\MTbox@|\textit{cmd}. It then defines a command |\|\textit{cmd} that
+% expands to |\usebox{\MTbox@|\textit{cmd}|}|.
+%
+% It is \myemph{very important} to remember that it is the fully
+% expanded version of the \meta{contents} that is saved and not the macros.
+% If |\|\textit{cmd} is used in a different environment the
+% contents will retain the settings they were declared with. The
+% saved boxes (and commands) are defined globally so that the contents
+% of the box are not destroyed when a group is exited.
+%
+% \begin{sample}
+% \hspace{17pc}\=\kill
+% |{\large\DeclareSBox{\Le}{\bS{e}^s}}| \> {\large\DeclareSBox{\Le}{\bS{e}^s}}\\
+% |{\small\DeclareSBox{\se}{\bS{e}^s}}| \> {\small\DeclareSBox{\se}{\bS{e}^s}}\\
+% |Test \Le\ and \se\ here.| \> {\normalsize Test \Le\ and \se\ here.}
+% \end{sample}
+%
+% This command is also useful for saving other objects such as
+% the graphics of logos that are used repetitively.
+%
+%
+% \subsection{Helper commands}
+%
+% When matrices and tensors are typed, there are some constructs that
+% occur frequently.
+%
+% \begin{Decl}
+% \SpecialUsageIndex{\SB}
+% \cmd{\SB}\marg{argument}
+% \end{Decl}
+% \begin{sample}
+% |\newcommand*{\SB}[1]{\ensuremath{\left[\, #1\right]}}|
+% \end{sample}
+%
+% \noindent This command puts square brackets, \texttt{[...]},
+% around its argument, and can be used in text mode. The square
+% brackets are preferred for the first level delimiter to indicate
+% that we are dealing with matrices.
+%
+% \begin{sample}
+% |$\SB{\bSb{E}^s_r}^{-1}$| \> $\SB{\bSb{E}^s_r}^{-1}$ \\[.5ex]
+% |$\SB{\bS{x}+\bS{y}\,}$| \> $\SB{\bS{x}+\bS{y}\,}$
+% \end{sample}
+%
+% \begin{Decl}
+% \SpecialUsageIndex{\norm}
+% \cmd{\norm}\marg{argument}
+% \end{Decl}
+% \begin{sample}
+% |\newcommand*{\norm}[1]{\ensuremath{\lVert{#1}\rVert}}|
+% \end{sample}
+%
+% \noindent This is the standard form for a matrix or vector norm.
+% \begin{sample}
+% |$\norm{\aS{x}}=x$| \> $\norm{\aS{x}}=x$
+% \end{sample}
+%
+% \begin{Decl}
+% \SpecialUsageIndex{\tdot}
+% \cmd{\tdot}
+% \end{Decl}
+% \begin{sample}
+% |\newcommand*{\tdot}{\ensuremath{\cdot}}|
+% \end{sample}
+%
+% \noindent This command sets a half-high dot to indicate matrix
+% multiplication. It can be used in text mode.
+%
+% \begin{sample}
+% |$\bS{x}^s = | \\
+% | \bSb{E}_r^s\tdot\bS{x}^r$| \>
+% $\bS{x}^s =\bSb{E}_r^s\tdot\bS{x}^r$
+% \end{sample}
+%
+% \begin{Decl}
+% \SpecialUsageIndex{\trnsp}
+% \cmd{\trnsp}
+% \end{Decl}
+% \begin{sample}
+% |\newcommand*{\trnsp}{\ensuremath{\mathsf{T}}}|
+% \end{sample}
+%
+% \noindent This command types the matrix transpose symbol ,\trnsp.
+%
+% \begin{sample}
+% |$\SB{\bSb{E}^s_r}^\trnsp$| \> $\SB{\bSb{E}^s_r}^\trnsp$
+% \end{sample}
+% \clearpage
+%
+%
+%
+%
+% \section{Typesetting the \Hass{} notation in \LaTeX}
+% \subsection{Why?}
+%
+% The \Hass{} notation contains symbols such as, \aS{e}_i,
+% \bS[\dot]{x}^{r}_{\alpha}, \bSa[\dot]{E}^s, etc. These symbols
+% are quite common and variants thereof are found on many
+% blackboards of engineering schools. Based on the reputation of
+% \TeX{} it would seem trivial to typeset them, but to the contrary
+% ...
+% \SetSymbFont{\relax}
+% \begin{sample}
+% |\bS[\dot]{f}^a_b| \> \bS[\dot]{f}^a_b ~~~(correct typesetting)\\[.75ex]
+% |$\dot{\overline{f}}^a_b$| \> \usebox{\AccentBox}\\[.75ex]
+% |$\dot{\overline{f}}{}^a_b$| \> $\dot{\overline{f}}{}^a_b$\\[.75ex]
+% |$\dot{\overline{f}^a_b}$| \> $\dot{\overline{f}^a_b}$
+% \end{sample}
+% \SetSymbFont{\bm}
+%
+% When a subscript is inserted for slanted characters, e.g.,
+% $f^a_b$, the subscript is kerned closer to the symbol.
+% This subscript kerning as well as the superscript height is
+% retained for math accents, e.g., $\dot{f}^a_b$. When
+% the \cmd{\overline} or \cmd{\overrightarrow} commands are used together
+% with math accents, the problems begin\footnote{If you are using
+% Equation Editor or MathType inside word processors in the Windows environment,
+% you end up with the same problems and have to fiddle \myemph{every}
+% sub- and superscript individually. A browse through the accompanying
+% sample document, \pkg{mtsample.tex}, will show that this can amount to
+% hundreds of little equations. I challenge anyone to rewrite that
+% document with one of the popular wordprocessors and still be sane
+% afterwards :-)}:
+%
+% \begin{itemize}
+%
+% \item
+% For an \cmd{\overline}, $\overline{f}^a_b$, the superscript moves up
+% to the height of the overline, which is fine for vector notation,
+% but the subscript kerning is lost, because the symbol is set
+% inside a box with italic correction added (App. G of the
+% \TeX{}book). If the subscript is added inside the \cmd{\overline}
+% construct, $\overline{f_b}^a$, the overline is stretched, which is
+% acceptable only when the subscript is part of the symbol itself.
+% The subscript kerning can be corrected by attaching the subscript
+% to the symbol and the superscript to the overline and then overtyping
+% (\cmd{\rlap} or \cmd{\llap}) them while using a phantom symbol (without
+% subscript) for the overline,
+% \begin{sample}
+% |\leavevmode\rlap{$\overline{\phantom{f}}^a$}%|\\
+% | {$f^{}_b$}|
+% \end{sample}
+% which gives \leavevmode\rlap{$\overline{\phantom{f}}^a$}{$f^{}_b$}.
+%
+% The \cmd{\leavevmode} command is nessesary to prevent the symbol
+% being spread over two lines when it is the first token in a new
+% paragraph (\TeX{} in vertical mode).
+%
+% Care must be taken with the sequence in which the two parts
+% overlap when the one is wider than the other,
+% \leavevmode\rlap{$\overline{\phantom{f}}^{abcde}$}{$f^{}_a$},
+% because the superscript will then run into the following text.
+%
+% \item
+% If a math accent is added to the overline, \usebox{\AccentBox},
+% the superscript goes to the level of the accent (except if the
+% \pkg{accents}\ package is loaded). This can be remedied by
+% controlling the height of the accented overline construction with
+% a \cmd{\vphantom} commands as a strut,
+% ^^A
+% \begin{sample}
+%|\leavevmode\rlap%|\\
+%| {$\dot{\overline{\phantom{f}}}{\vphantom{\overline{f}}}^a$}%|\\
+%| {$f^{}_b$}|
+% \end{sample}
+% which gives
+% \rlap^^A
+% {$\dot{\overline{\phantom{f}}}{\vphantom{\overline{f}}}^a$}^^A
+% {$f^{}_b$}.
+%
+% \item
+% For an |\overrightarrow| in vector notation,
+% ($\overrightarrow{i}_a$, ~$\overrightarrow{iiii}_a\,$), the
+% construction of the stretchable arrow results in an arrow wider
+% than most symbols, with the symbol centred below it.
+% The subscript ended up far removed from the symbol.
+% For multiple symbols, the arrow width is equal to the box containing
+% the letters, resulting in better-looking subscripts
+% (but still without the subscript kerning).
+% The previous procedure can be used to correct the
+% subscript kerning, except that additional white space must be
+% inserted before the symbol to centre it beneath the arrow.
+%
+% \begin{sample}
+% |\newlength{\Wspace}\settowidth{\Wspace}{$\overrightarrow{i}$}|\\
+% |\newlength{\SymWdth}\settowidth{\SymWdth}{$i$}|\\
+% |\addtolength{\Wspace}{-\SymWdth} |\\
+% |\leavevmode\rlap% |\\
+% | {$\dot{\overrightarrow{\phantom{i}}}$}% |\\
+% | {\hspace*{.5\Wspace}$i^{}_b$} |\\
+% \end{sample}
+% \newlength{\Wspace}\settowidth{\Wspace}{$\overrightarrow{i}$}
+% \newlength{\SymWdth}\settowidth{\SymWdth}{$i$}
+% \addtolength{\Wspace}{-\SymWdth}
+% which gives \rlap{$\dot{\overrightarrow{\phantom{i}}}$}{\hspace*{.5\Wspace}$i^{}_b$}.
+%
+% The commands can be optimized by using saveboxes, \myemph{but}
+% the symbols will not scale correctly when used as sub- or
+% superscripts or in the \cmd{\tfrac} macro. A solution is to nest
+% the commands inside a \cmd{\mathpalette} environment, but be warned,
+% this is very expensive!
+% The commands \cmd{\phantom}, \cmd{\smash}, \cmd{\overrightarrow}
+% (in \pkg{amsmath}) are already inside \cmd{\mathpalette} macros, and
+% \TeX{} calls the arguments of a \cmd{\mathpalette} macro four times
+% before deciding on the dimensions.
+%
+% \item
+% The shape of the arrow tip of the |\overrightarrow| command was
+% probably not designed for this type of application and is much too
+% broad in the final CM font version. This broad arrow shape is
+% incidentally one of last changes by Prof.~Knuth to the CM font symbols.
+% The PostScript version of the CM fonts typesets the arrow much
+% better, but it is highly likely that it is still the old outdated
+% version of the symbol.
+%
+% \item
+% The subscript heights differ for the cases with and without
+% superscripts, $x_b,\; x_b^a$. This is not very satisfactory for a
+% consistent matrix-tensor notation, but it can be remedied by
+% inserting a dummy superscript, |$x^{}_b$|, which then gives
+% $x^{}_b$, $x_b^a$.
+%
+% \end{itemize}
+%
+% The \MT\ package was developed to overcome (some of) the above-mentioned
+% problems and to typeset the \Hass{} matrix tensor symbols in a
+% consistent manner.
+%
+%
+% \subsection{To do's}
+%
+% \begin{itemize}
+% \item
+% The vertical spacing between the symbols and the lines and arrows
+% differs, \aSb{E}, \bSa{E}. This problem cannot be fixed easily
+% and would need some additional struts or even a rewriting of the
+% arrows and lines commands.
+%
+% \item
+% For the purists: The ends of the |\overrightarrow| are rounded
+% (ligature of symbols), while the ends of the |\overline| are squared
+% (\TeX{} line drawing).
+%
+% \item
+% \MT\ does not yet work with the \pkg{xspace} package.
+% \end{itemize}
+%
+% \section{Bugs, etc.}
+%
+% I am sure there is much room for improvement, because
+% I am a \TeX{}natic and not a \TeX{}pert and to quote
+% Knuth from the \TeX{}book:
+% \begin{quote}
+% {\slshape\small Always remember, however, that there's usually
+% a simpler and better way to do something than the first way that
+% pops into your head. You may not have to resort to any subterfuge
+% at all, since \TeX{} is able to do lots of things in a
+% straightforward way. Try for simple solutions first.}
+% \end{quote}
+%
+% \noindent Please send all bug reports, suggestions, advice or
+% code improvements to:
+%
+% \begin{center}
+% \colorbox[rgb]{1.00,1.00,0.50}{\begin{minipage}{.6\textwidth}
+% \centering
+% Danie Els\\
+%
+% \smallskip
+% Department of Mechanical Engineering\\
+% University of Stellenbosch\\
+% Private Bag X1, Matieland 7602, South Africa.\\
+% e-mail: \texttt{dnjels@sun.ac.za}
+% \end{minipage}}
+% \end{center}
+%
+% \bigskip
+%
+%
+% \begin{thebibliography}{7}
+%
+% \bibitem{Hass93a}
+% \Hass, W.~C.,
+% ``Matrix Tensor Notation Part I. Rectilinear Orthogonal Coordinates,''
+% \textsl{Comput. Math. Appl.},
+% \textbf{26}(3), 1993, pp. 55--93.
+%
+% \bibitem{Hass93b}
+% \Hass, W.~C.,
+% ``Matrix Tensor Notation Part II. Skew and Curved Coordinates,''
+% \textsl{Comput. Math. Appl.},
+% \textbf{29}(11), 1993, pp. 1--103.
+%
+% \end{thebibliography}
+%
+% \StopEventually{} ^^A end StopEventually
+%
+% \clearpage
+%
+% \section{The Code: \pkg{mattens.sty}}
+% \setlength{\parskip}{\smallskipamount}
+% \setlength{\parindent}{0pt}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+%
+%
+% \subsection{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{mattens}[2004/01/28 v1.2 Matrix/Tensors (DNJ Els)]
+% \end{macrocode}
+%
+%
+%
+% \subsection{Options}
+%
+% \begin{macro}{\MT@SymbStrt}
+% \begin{macro}{\SetSymbStrut}
+% Struts to set all the lines and arrows at
+% predetermined heights and depths.
+% \begin{macrocode}
+\newcommand*{\MT@SymbStrt}{}
+\newcommand*{\SetSymbStrut}[1]{\renewcommand*{\MT@SymbStrt}{#1}}
+\SetSymbStrut{\relax}
+\DeclareOption{mathstrut}{\SetSymbStrut{\mathstrut}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\MT@SymbFnt}
+% \begin{macro}{\SetSymbFont}
+% Initialize the symbol font formatting commands.
+% \begin{macrocode}
+\newcommand*{\MT@SymbFnt}{}
+\newcommand*{\SetSymbFont}[1]{\renewcommand*{\MT@SymbFnt}{#1}}
+\SetSymbFont{\boldsymbol}
+\DeclareOption{noformat}{\SetSymbFont{\relax}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% Process the options
+% \begin{macrocode}
+\DeclareOption*{%
+ \PackageWarning{mattens}{Unknown option ‘\CurrentOption’}}
+\ProcessOptions\relax
+% \end{macrocode}
+%
+%
+%
+% \subsection{Packages}
+%
+% The \pkg{amsmath} package is loaded to provide the scalable
+% \cmd{\overrightarrow} and \cmd{\underrightarrow} commands, as
+% well as the \cmd{\boldsymbol} command for setting bold math
+% symbols.
+%
+% \begin{macrocode}
+\RequirePackage{amsmath}
+% \end{macrocode}
+%
+%
+%
+% \subsection{Workaround commands}
+%
+% \begin{macro}{\MT@Overarrow}
+% \begin{macro}{\MT@Underarrow}
+% We define over- and under-arrows that bypass the
+% \cmd{\mathpalette} part of the \pkg{amsmath} macros
+% \cmd{\overrightarrow} and \cmd{\underrightarrow}. It uses
+% the \pkg{amsmath} internal macros \cmd{\overarrow@},
+% \cmd{\underarrow@} and \cmd{\rightarrowfill@}.
+% The first parameter |#1| consists of math styles \cmd{\displaystyle},
+% \cmd{\textstyle}, etc. The second parameter |#2| is the symbol
+% or character.
+% \begin{macrocode}
+\newcommand{\MT@Overarrow}[2]{\overarrow@{\rightarrowfill@}{#1}{#2}}
+\newcommand{\MT@Underarrow}[2]{\underarrow@{\rightarrowfill@}{#1}{#2}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\MT@Overline}
+% \begin{macro}{\MT@Underline}
+% Make over- and underlines with the same calling syntax as
+% the arrows.
+% \begin{macrocode}
+\newcommand{\MT@Overline}[2]{{#1\overline{#2}}}
+\newcommand{\MT@Underline}[2]{{#1\underline{#2}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\xusebox}
+% \changes{1.1}{2004 Jan 15}{More streamline.}
+% \changes{1.2}{2004 Jan 27}{Test if \pkg{pdftex.def} is loaded.
+% and command is rewritten to use a \cmd{\mathord} to
+% restore script heights}
+% The \cmd{\usebox} command does not function properly when the
+% \pkg{pdftex.def} driver is loaded, because \pkg{pdftex} does
+% not implement a colour stack such as in the \pkg{dvips} driver,
+% but simulate it at \TeX{} macro level. The \cmd{\xusebox} is
+% a workaround where the \cmd{\usebox} command is grouped.\footnote{
+% Thanks to Heiko Oberdiek for this workaround}
+% A |\mathord| is added around the box to regain its height in the
+% \pkg{pdftex} case.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \@ifl@aded{def}{pdftex}%
+ {\newcommand*{\xusebox}[1]{\mathord{{\usebox{#1}}}}}%
+ {\let\xusebox\usebox}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Initialize}
+%
+% Define skip lengths for insertion in front of sub- and
+% superscripts.
+% \begin{macrocode}
+\newmuskip{\MT@Askip}
+\newmuskip{\MT@Bskip}
+\newmuskip{\MT@SPskip}
+\newmuskip{\MT@SBskip}
+% \end{macrocode}
+%
+% \begin{macro}{\SetArrowSkip}
+% \begin{macro}{\SetBarSkip}
+% \begin{macro}{\SetSymSupSkip}
+% \begin{macro}{\SetSymSubSkip}
+% Define commands to set or change the skip lengths and set initial values.
+% \begin{macrocode}
+\newcommand*{\SetArrowSkip}[1]{\MT@Askip#1}
+\newcommand*{\SetBarSkip}[1]{\MT@Bskip#1}
+\newcommand*{\SetSymSupSkip}[1]{\MT@SPskip#1}
+\newcommand*{\SetSymSubSkip}[1]{\MT@SBskip#1}
+\SetArrowSkip{0mu}
+\SetBarSkip{1mu}
+\SetSymSubSkip{0mu}
+\SetSymSupSkip{0mu}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\MT@SubSkip}
+% \begin{macro}{\MT@SupSkip}
+% Define math skip lengths to insert in front of the sub- and
+% superscripts. The values are set inside the main \MT\ commands
+% according to the type of symbol.
+% \begin{macrocode}
+\newmuskip\MT@SubSkip
+\newmuskip\MT@SupSkip
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsection{Main \MT\ commands}
+%
+% Setup command templates and lengths to function as global
+% variables and pointers.
+%
+% \begin{macro}{\MT@accent}
+% The \cmd{\MT@accent} command points
+% to the math accent that are inserted as the optional argument
+% inside the main \MT\ commands.
+%
+% \begin{macrocode}
+\newcommand*{\MT@accent}{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@cmd}
+% \begin{macro}{\MT@@cmd}
+% The commands \cmd{\MT@cmd} and \cmd{\MT@cmd} do the actual
+% typesetting of the symbols.
+% \begin{macrocode}
+\newcommand*{\MT@cmd}{}
+\newcommand*{\MT@@cmd}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% They can be seen
+% as function pointer that are set with |\let| commands inside
+% the main \MT\ commands to point to specific commands.
+%
+% \newcommand{\RA}{\ensuremath{\,\mapsto\,}}
+%
+% \begin{tabbing}
+% \hskip2pc\=\hskip3pc\=\hskip12pc\=\kill
+% \>\textsl{Cmd} \> \textsl{Primary command} \> \textsl{Secondary command}\\[.75ex]
+% \>|\aS|: \>|\MT@cmd| \RA |\MT@OverAandB|, \>|\MT@@cmd| \RA |\MT@Overarrow|\\
+% \>|\bS|: \>|\MT@cmd| \RA |\MT@OverAandB|, \>|\MT@@cmd| \RA |\MT@Overline|\\
+% \>|\Sa|: \>|\MT@cmd| \RA |\MT@UnderAandB|, \>|\MT@@cmd| \RA |\MT@Underarrow|\\
+% \>|\Sb|: \>|\MT@cmd| \RA |\MT@UnderAandB|, \>|\MT@@cmd| \RA |\MT@Underline|\\
+% \>|\bSb|: \>|\MT@cmd| \RA |\MT@DoubleAandB|, \>|\MT@@cmd| \RA |\MT@@bSb| \\
+% \>|\aSb|: \>|\MT@cmd| \RA |\MT@DoubleAandB|, \>|\MT@@cmd| \RA |\MT@@aSb|\\
+% \>|\bSa|: \>|\MT@cmd| \RA |\MT@DoubleAandB|, \>|\MT@@cmd| \RA |\MT@@bSa| \\
+% \>|\aSa|: \>|\MT@cmd| \RA |\MT@DoubleAandB|, \>|\MT@@cmd| \RA |\MT@@aSa|\\
+% \>|\bCSb|: \>|\MT@cmd| \RA |\MT@DoubleAandB|, \>|\MT@@cmd| \RA |\MT@@bCSb|\\
+% \>|\aCSa|: \>|\MT@cmd| \RA |\MT@DoubleAandB|, \>|\MT@@cmd| \RA |\MT@@aCSa|\\
+% \end{tabbing}
+%
+%
+% \begin{macro}{\MT@bold}
+% The \cmd{\MT@bold} command is used internally and set by the
+% ``starred'' command option.
+% \begin{macrocode}
+\newcommand*{\MT@bold}{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\aS}
+% Type the tensor: \aS{x}
+% \begin{macrocode}
+\DeclareRobustCommand*{\aS}{%
+ \let\MT@cmd=\MT@OverAandB%
+ \let\MT@@cmd=\MT@Overarrow%
+ \MT@SupSkip=\MT@Askip%
+ \MT@SubSkip=\MT@SBskip%
+ \MT@Tensor}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bS}
+% Type the tensor: \bS{x}
+% \begin{macrocode}
+\DeclareRobustCommand*{\bS}{%
+ \let\MT@cmd=\MT@OverAandB%
+ \let\MT@@cmd=\MT@Overline%
+ \MT@SupSkip=\MT@Bskip%
+ \MT@SubSkip=\MT@SBskip%
+ \MT@Tensor}%
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\Sa}
+% Type the tensor: \Sa{x}
+% \begin{macrocode}
+\DeclareRobustCommand*{\Sa}{%
+ \let\MT@cmd=\MT@UnderAandB%
+ \let\MT@@cmd=\MT@Underarrow%
+ \MT@SupSkip=\MT@SPskip%
+ \MT@SubSkip=\MT@Askip%
+ \MT@Tensor}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Sb}
+% Type the tensor: \Sb{x}
+% \begin{macrocode}
+\DeclareRobustCommand*{\Sb}{%
+ \let\MT@cmd=\MT@UnderAandB%
+ \let\MT@@cmd=\MT@Underline%
+ \MT@SupSkip=\MT@SPskip%
+ \MT@SubSkip=\MT@Bskip%
+ \MT@Tensor}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bSb}
+% Type the tensor: \bSb{E}
+% \begin{macrocode}
+\DeclareRobustCommand*{\bSb}{%
+ \let\MT@cmd=\MT@DoubleAandB%
+ \let\MT@@cmd=\MT@@bSb%
+ \MT@SupSkip=\MT@Bskip%
+ \MT@SubSkip=\MT@Bskip%
+ \MT@Tensor}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\aSb}
+% Type the tensor: \aSb{E}
+% \begin{macrocode}
+\DeclareRobustCommand*{\aSb}{%
+ \let\MT@cmd=\MT@DoubleAandB%
+ \let\MT@@cmd=\MT@@aSb%
+ \MT@SupSkip=\MT@Askip%
+ \MT@SubSkip=\MT@Bskip%
+ \MT@Tensor}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bSa}
+% Type the tensor: \bSa{E}
+% \begin{macrocode}
+\DeclareRobustCommand*{\bSa}{%
+ \let\MT@cmd=\MT@DoubleAandB%
+ \let\MT@@cmd=\MT@@bSa%
+ \MT@SupSkip=\MT@Bskip%
+ \MT@SubSkip=\MT@Askip%
+ \MT@Tensor}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\aSa}
+% Type the tensor: \aSa{E}
+% \begin{macrocode}
+\DeclareRobustCommand*{\aSa}{%
+ \let\MT@cmd=\MT@DoubleAandB%
+ \let\MT@@cmd=\MT@@aSa%
+ \MT@SupSkip=\MT@Askip%
+ \MT@SubSkip=\MT@Askip%
+ \MT@Tensor}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\bCSb}
+% Type the tensor: \bCSb{\omega}
+% \begin{macrocode}
+\DeclareRobustCommand*{\bCSb}{%
+ \let\MT@cmd=\MT@DoubleAandB%
+ \let\MT@@cmd=\MT@@bCSb%
+ \MT@SupSkip=\MT@Bskip%
+ \MT@SubSkip=\MT@Bskip%
+ \MT@Tensor}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\aCSa}
+% Type the tensor: \aCSa{\omega}
+% \begin{macrocode}
+\DeclareRobustCommand*{\aCSa}{%
+ \let\MT@cmd=\MT@DoubleAandB%
+ \let\MT@@cmd=\MT@@aCSa%
+ \MT@SupSkip=\MT@Askip%
+ \MT@SubSkip=\MT@Askip%
+ \MT@Tensor}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@Tensor}
+% \changes{1.1}{2004 Jan 15}{Added to reduce overall code.}
+% \begin{macro}{\MT@@Tensor}
+% \changes{1.1}{2004 Jan 15}{Added to reduce overall code.}
+% General tensor commands to look for starred form and
+% and initiate script extraction.
+% \begin{macrocode}
+\newcommand*{\MT@Tensor}{%
+ \@ifstar{\let\MT@bold=\@firstofone\MT@@Tensor}
+ {\let\MT@bold=\MT@SymbFnt\MT@@Tensor}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\MT@@Tensor}[2][\@firstofone]{%
+ \let\MT@accent=#1\relax%
+ \MT@GetScripts{#2}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsection{Sub- and superscripts}
+%
+%
+% \begin{macro}{\MT@GetScripts}
+% This part of the code looks ahead for sub- and superscripts.
+% \changes{1.1}{2004 Jan 15}{Add: Code to check for primes}
+% \begin{macrocode}
+\newcommand*\MT@GetScripts[1]{%
+ \@ifnextchar'%
+ {\MT@GetPrimes{#1}{\prime}}%
+ {\MT@UnprimedScripts{#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@GetPrimes}
+% \changes{1.1}{2004 Jan 15}{Add: Extract primes}
+% \begin{macro}{\MT@GetPrimedSuper}
+% \changes{1.1}{2004 Jan 15}{Add: Extract primes}
+% \begin{macro}{\MT@GetPrimedSub}
+% \changes{1.1}{2004 Jan 15}{Add: Extract primes}
+% Extract primes and look ahead for superscripts |^|. Note that
+% the sequence of operators for a primed symbol is:
+% \meta{symb}|'|$^{..}\!\!$|'^|\meta{sup}|_|\meta{sub}
+% \begin{macrocode}
+\newcommand*\MT@GetPrimes[3]{%
+ \@ifnextchar'%
+ {\MT@GetPrimes{#1}{#2\prime}}%
+ {\@ifnextchar^%
+ {\MT@GetPrimedSuper{#1}{#2}}%
+ {\@ifnextchar_%
+ {\MT@GetPrimedSub{#1}{#2}}%
+ {\MT@SetScripts{#1}{#2}{\@empty}}%
+ }%
+ }%
+ }
+% \end{macrocode}
+% \begin{macrocode}
+\def\MT@GetPrimedSuper#1#2^#3{%
+ \@ifnextchar_{\MT@GetPrimedSub{#1}{#2#3}}%
+ {\MT@SetScripts{#1}{#2#3}{\@empty}}}
+% \end{macrocode}
+% \begin{macrocode}
+\def\MT@GetPrimedSub#1#2_#3{%
+ \MT@SetScripts{#1}{#2}{#3}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\MT@UnprimedScripts}
+% The first extraction command for symbols without primes.
+% It looks ahead for |^| or |_|, if not present, then pass
+% \cmd{\@empty} flags forward, otherwise it passes the tokens
+% on to the next extraction commands.
+%
+% \begin{macrocode}
+\newcommand*\MT@UnprimedScripts[1]{%
+ \@ifnextchar^%
+ {\MT@GetSuper{#1}}%
+ {\@ifnextchar_%
+ {\MT@GetSub{#1}}%
+ {\MT@SetScripts{#1}{\@empty}{\@empty}}%
+ }%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@GetSuper}
+% Extract scripts of the form \meta{Sym}|^|\meta{sup}
+% if there are no further |_| tokens available, otherwise pass the
+% tokens on to the next extraction command.
+%
+% \begin{macrocode}
+\def\MT@GetSuper#1^#2{%
+ \@ifnextchar_{\MT@GetSuperSub{#1}{#2}}%
+ {\MT@SetScripts{#1}{#2}{\@empty}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@GetSub}
+% Extract scripts of the form \meta{Sym}|_|\meta{sub}
+% if there are no further |^| tokens available, otherwise pass the
+% tokens on to the next extraction command.
+%
+% \begin{macrocode}
+\def\MT@GetSub#1_#2{%
+ \@ifnextchar^{\MT@GetSubSuper{#1}{#2}}%
+ {\MT@SetScripts{#1}{\@empty}{#2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@GetSuperSub}
+% Extract scripts of the form
+% \meta{Sym}|^|\meta{sup}|_|\meta{sub}.
+%
+% \begin{macrocode}
+\def\MT@GetSuperSub#1#2_#3{%
+ \MT@SetScripts{#1}{#2}{#3}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@GetSubSuper}
+% Extract scripts of the form
+% \meta{Sym}|_|\meta{sub}|^|\meta{sup}.
+%
+% \begin{macrocode}
+\def\MT@GetSubSuper#1#2^#3{%
+ \MT@SetScripts{#1}{#3}{#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@SetSup}
+% \begin{macro}{\MT@SetSub}
+% Define global variables commands that contain the extracted
+% sub- and superscripts. These commands are redefined inside the
+% the final \cmd{\MT@SetScripts} command.
+%
+% \begin{macrocode}
+\newcommand*{\MT@SetSup}{}
+\newcommand*{\MT@SetSub}{}
+\newcommand*{\MT@SetSubS}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macrocode}
+\newcommand*\MT@SetScripts[3]{%
+ \let\MT@SetSup\relax%
+ \let\MT@SetSub\relax%
+ \let\MT@SetSubS\relax%
+ \ifx\@empty#2\@empty\else
+ \def\MT@SetSup{^{\mskip\MT@SupSkip\relax#2}}%
+ \fi
+ \ifx\@empty#3\@empty\else
+ \def\MT@SetSub{_{\mskip\MT@SubSkip\relax#3}}%
+ \def\MT@SetSubS{^{}_{\mskip\MT@SubSkip\relax#3}}%
+ \fi
+ \ensuremath{\MT@cmd{#1}}}
+% \end{macrocode}
+%
+%
+%
+% \subsection{Symbol formatting}
+%
+% \begin{macro}{\MT@Symb}
+% This command type |{|\meta{strut}\meta{font-cmd}\meta{symb}|}|,
+% the formatted symbol preceded by the selected strut. It is called
+% from within the main typesetting commands.
+%
+% \begin{macrocode}
+\newcommand*{\MT@Symb}[1]{\MT@SymbStrt\MT@bold#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@SymbC}
+% Puts a widetilde over the symbol for the cross product tensors.
+% \begin{macrocode}
+\newcommand*{\MT@SymbC}[1]{%
+ \MT@SymbStrt\widetilde{%
+ \MT@bold#1}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Main typesetting commands}
+%
+% The commands in this section are the ones pointed to by
+% the \cmd{\MT@cmd} and \cmd{\MT@@cmd} commands to perform
+% the typesetting of the full tensor symbol.
+%
+% Declare some save boxes
+% \begin{macrocode}
+\newsavebox{\MT@Abox} % for overline/arrow
+\newsavebox{\MT@Sbox} % for symbol
+\newsavebox{\MT@Tbox} % for tempories
+\newsavebox{\MT@APbox} % for overline/arrow phantom
+\newsavebox{\MT@SPbox} % for symbol phantom
+% \end{macrocode}
+% and some lengths.
+% \begin{macrocode}
+\newlength{\MT@SPwdth} % symbol width
+\newlength{\MT@BPwdth} % Bar width
+\newlength{\MT@Wwdth} % leading whitespace width
+% \end{macrocode}
+%
+% \begin{macro}{\MT@OverAandB}
+% This command generates the tensor symbols \aS{e}{} and \bS{e}.
+% It utilizes the \cmd{\mathpalette} macro for the sizing of the
+% final tensor. \LaTeX{} commands \cmd{\smash} and \cmd{\phantom}
+% with embedded \cmd{\mathpalette} calls are avoided to prevent
+% nested \cmd{\mathchoice} calls.
+% \begin{macrocode}
+\newcommand*{\MT@OverAandB}{%
+ \mathpalette\MT@@OverAandB}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@@OverAandB}
+% \changes{1.2}{2004 Jan 27}{Use \cmd{\xusebox} inside accent
+% to account for \cmd{\dddot}.}
+% For this command the first parameter |#1| is supplied by
+% \cmd{\mathpalette} and consists of math styles \cmd{\displaystyle},
+% \cmd{\textstyle}, etc. The second parameter |#2| is the original
+% \meta{symbol} from the call \cmd{\MT@cmd}|{|\meta{symbol}|}|.
+%
+% \begin{macrocode}
+\newcommand*{\MT@@OverAandB}[2]{%
+% \end{macrocode}
+% \begin{Indent}{5em}
+% Set the symbol inside a box for measurement purposes.
+% \end{Indent}
+% \begin{macrocode}
+ \sbox{\MT@Tbox}{$\m@th#1\MT@Symb{#2}$}%
+% \end{macrocode}
+% \begin{Indent}{5em}
+% Make phantom symbol box (empty) with size identical to symbol.
+% \end{Indent}
+% \begin{macrocode}
+ \setbox\MT@SPbox\null%
+ \ht\MT@SPbox\ht\MT@Tbox%
+ \dp\MT@SPbox\dp\MT@Tbox%
+ \wd\MT@SPbox\wd\MT@Tbox%
+% \end{macrocode}
+% \begin{Indent}{5em}
+% Make overline/overarrow over phantom symbol box for measurement.
+% \end{Indent}
+% \begin{macrocode}
+ \sbox{\MT@APbox}{$\m@th\MT@@cmd{#1}{\copy\MT@SPbox}$}%
+% \end{macrocode}
+% \begin{Indent}{5em}
+% Calculate width difference between symbol and arrow/overline.
+% \end{Indent}
+% \begin{macrocode}
+ \setlength{\MT@Wwdth}{\the\wd\MT@APbox}%
+ \addtolength{\MT@Wwdth}{-\the\wd\MT@SPbox}%
+% \end{macrocode}
+% \begin{Indent}{5em}
+% Make final symbol box with white space in front to center is
+% beneath the arrow/over line and subscript that follows.
+% \end{Indent}
+% \begin{macrocode}
+ \sbox{\MT@Sbox}{$\m@th#1\hskip 0.5\MT@Wwdth\relax\MT@Symb{#2}\MT@SetSubS$}%
+% \end{macrocode}
+% \begin{Indent}{5em}
+% Add math accent to overline/overarrow and reset box dimensions to
+% original.
+% \end{Indent}
+% \begin{macrocode}
+ \sbox{\MT@Tbox}{$\m@th#1\MT@accent{\xusebox{\MT@APbox}}$}%
+ \ht\MT@Tbox\ht\MT@APbox%
+ \dp\MT@Tbox\dp\MT@APbox%
+% \end{macrocode}
+% \begin{Indent}{5em}
+% Final overline/overarrow box including accent and superscript at end.
+% \end{Indent}
+% \begin{macrocode}
+ \sbox{\MT@Abox}{$\m@th#1\xusebox{\MT@Tbox}\MT@SetSup$}%
+% \end{macrocode}
+% \begin{Indent}{5em}
+% Overtype the symbol and the overline/overarrow boxes. The wider
+% box of the two is typed last to ensure that the spacing after
+% the full tensor symbol is correct.
+% \end{Indent}
+% \begin{macrocode}
+ \ifdim\wd\MT@Abox<\wd\MT@Sbox%
+ \leavevmode\rlap{\usebox\MT@Abox}{\usebox\MT@Sbox}%
+ \else%
+ \leavevmode\rlap{\usebox\MT@Sbox}{\usebox\MT@Abox}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\MT@UnderAandB}
+% \begin{macro}{\MT@@UnderAandB}
+% \changes{1.2}{2004 Jan 27}{Make provisions for wide accents (\cmd{\dddot}).}
+% This command generates the tensor symbols \Sa{e}{} and \Sb{e}.
+% It is identical to the previous command except the sub- and
+% superscripts are swapped and the phantom box is set to the width
+% of the accent.
+% \begin{macrocode}
+\newcommand*{\MT@UnderAandB}{%
+ \mathpalette\MT@@UnderAandB}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\MT@@UnderAandB}[2]{%
+ \sbox{\MT@Tbox}{$\m@th#1\MT@accent{\MT@Symb{#2}}$}%
+ \setbox\MT@SPbox\null%
+ \wd\MT@SPbox\wd\MT@Tbox%
+ \sbox{\MT@Tbox}{$\m@th#1\MT@Symb{#2}$}%
+ \ht\MT@SPbox\ht\MT@Tbox%
+ \dp\MT@SPbox\dp\MT@Tbox%
+ \sbox{\MT@APbox}{$\m@th\MT@@cmd{#1}{\copy\MT@SPbox}$}%
+ \setlength{\MT@Wwdth}{\the\wd\MT@APbox}%
+ \addtolength{\MT@Wwdth}{-\the\wd\MT@SPbox}%
+ \sbox{\MT@Sbox}{$\m@th#1%
+ \hskip 0.5\MT@Wwdth\relax\MT@accent{\MT@Symb{#2}}\MT@SetSup$}%
+ \sbox{\MT@Abox}{$\m@th#1\xusebox{\MT@APbox}\MT@SetSub$}%
+ \ifdim\wd\MT@Abox<\wd\MT@Sbox%
+ \leavevmode\rlap{\usebox\MT@Abox}{\usebox\MT@Sbox}%
+ \else%
+ \leavevmode\rlap{\usebox\MT@Sbox}{\usebox\MT@Abox}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\MT@@bSb}
+% \begin{macro}{\MT@@bSa}
+% \begin{macro}{\MT@@aSb}
+% \begin{macro}{\MT@@aSa}
+% \begin{macro}{\MT@@bCSb}
+% \begin{macro}{\MT@@aCSa}
+% These commands are pointed to by \cmd{\MT@@cmd} and called from
+% within \cmd{\MT@DoubleAandB}. It has the same calling syntax as
+% the \cmd{\MT@Overarrow} and \cmd{\MT@Underarrow} commands.
+% \begin{macrocode}
+\newcommand*{\MT@@bSb}[2]{\MT@Overline{#1}{\MT@Underline{#1}{\MT@Symb{#2}}}}
+\newcommand*{\MT@@aSb}[2]{\MT@Overarrow{#1}{\MT@Underline{#1}{\MT@Symb{#2}}}}
+\newcommand*{\MT@@bSa}[2]{\MT@Overline{#1}{\MT@Underarrow{#1}{\MT@Symb{#2}}}}
+\newcommand*{\MT@@aSa}[2]{\MT@Overarrow{#1}{\MT@Underarrow{#1}{\MT@Symb{#2}}}}
+\newcommand*{\MT@@bCSb}[2]{\MT@Overline{#1}{\MT@Underline{#1}{\MT@SymbC{#2}}}}
+\newcommand*{\MT@@aCSa}[2]{\MT@Overarrow{#1}{\MT@Underarrow{#1}{\MT@SymbC{#2}}}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\MT@DoubleAandB}
+% \begin{macro}{\MT@@DoubleAandB}
+% \changes{1.2}{2004 Jan 27}{Use \cmd{\xusebox} inside accent
+% to account for \cmd{\dddot}.}
+% This command is used for the remaining tensor symbols and is not
+% so complex compared to the previous commands.
+%
+% \begin{macrocode}
+\newcommand*{\MT@DoubleAandB}{%
+ \mathpalette\MT@@DoubleAandB}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\MT@@DoubleAandB}[2]{%
+ \sbox{\MT@Abox}{$\m@th#1\MT@@cmd{#1}{#2}$}%
+ \sbox{\MT@Tbox}{$\m@th#1\MT@accent{\xusebox{\MT@Abox}}$}%
+ \ht\MT@Tbox\ht\MT@Abox%
+ \dp\MT@Tbox\dp\MT@Abox%
+ \xusebox{\MT@Tbox}\MT@SetSup\MT@SetSub}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \changes{1.1}{2004 Jan 15}{Code: Remove helper commands}
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+% \clearpage
+% \Finale
+% \setcounter{IndexColumns}{2}\PrintIndex
+% \PrintChanges
+%
+\endinput
diff --git a/Master/texmf-dist/source/latex/mattens/mattens.ins b/Master/texmf-dist/source/latex/mattens/mattens.ins
new file mode 100644
index 00000000000..7f7811be80d
--- /dev/null
+++ b/Master/texmf-dist/source/latex/mattens/mattens.ins
@@ -0,0 +1,37 @@
+\input docstrip.tex
+\preamble
+
+ The mattens package
+ Copyright (C) 2001--2004 by Danie Els <dnjels@sun.ac.za>
+
+This file may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.2 of this license
+or (at your option) any later version. The latest version of this
+license is in:
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.2 or later is part of all distributions of LaTeX
+version 1999/12/01 or later.
+
+\endpreamble
+
+\keepsilent
+\askforoverwritefalse
+
+\generate{\file{mattens.sty}{\from{mattens.dtx}{package}}}
+
+\obeyspaces
+\Msg{*********************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the *}
+\Msg{* following file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* mattens.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file mattens.dtx *}
+\Msg{* through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{*********************************************************}
+\endbatchfile