% \iffalse % % mattens.dtx Copyright (C) 2001 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{ltxdoc} \usepackage{amsmath} \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$} \newcounter{cnt} \newsavebox{\nested} \newcommand*{\Sym}[1]{% \boldsymbol{{#1\addtocounter{cnt}{1}}}} \sbox{\nested}{% $Q_\text{\leavevmode\rlap% {$\Sym{x}_i$}% ${\smash{\dot{\overrightarrow{\phantom{\Sym{x}}}}}% \vphantom{\overrightarrow{\Sym{x}^j}}}$}$} \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} \setlength{\parindent}{0pt} \setlength{\parskip}{\medskipamount} \begin{document} \DocInput{mattens.dtx} \end{document} % % % \fi % % \CheckSum{734} %% \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} % \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} % \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} % % % \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]{\textsl{#1}} % % \newenvironment{Decl}^^A % {\par\small\addvspace{4.5ex 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}} % % \MakeShortVerb{\|} % % \title{The \MT\ package\thanks{This file has version number % \fileversion, last revised % \filedate.}} % \author{Danie Els\\ % \small Department of Mechanical Engineering\\ % \small University of Stellenbosch, South Africa\\ % e-mail: \texttt{dnjels@sun.ac.za}} % \date{\filedate} % \maketitle % % \begin{abstract} % \setlength{\parskip}{\medskipamount}\setlength{\parindent}{0pt} % \noindent This package contains the definitions to typeset the matrix % tensor notation of \myemph{\Hass}\cite{Hass93a,Hass93b}. It consists of % symbols such as \aS{e}_i, \bS[\dot]{x}^r, \bSb{E}^s_r, etc. This % notation 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} % % An appeal is made to the engineering and scientific community to % adopt this notation, especially for the representation of common % vectors and tensors such as forces, velocities, moments of inertia, % etc., because of its consistency and ease of use. % % \slshape{\bfseries Keywords:} vector, matrix, tensor, notation. % \end{abstract} % % \clearpage % {\parskip0pt\tableofcontents} % % \clearpage % \section{Introduction} % \subsection{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. % % \myemph{\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{enumerate} % \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{enumerate} % % The \MT\ package was developed to typeset the \Hass{} matrix % tensor symbols in a consistent manner. % % % \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} % % 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 \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} % \begin{minipage}{1.05\textwidth} % \small % \renewcommand{\footnoterule}{} % \begin{tabular*}{\textwidth}{@{}>{\slshape}l l>{\itshape}r@{}>{\itshape}c@{}>{\itshape} l c@{}} % \sphline \textbf{\slshape Type} & % \textbf{\slshape Command}& % \multicolumn{3}{c}{\textbf{\slshape Description}} & % \textbf{\slshape 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\footnote{It is defined as the tensor % \bCSb{a}\ associated \protect\\ with the vector \bS{a}, where % $\bS{a}\times\bS{c}=\bCSb{a}\cdot\bS{c}$} % & % \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 % \end{tabular*} % \end{minipage} % \end{table} % % \subsection{General syntax} % % The general syntax of the \MT\ commands is % % \begin{Decl} % |\|$\alpha$|S|$\gamma$\oarg{accent}\marg{Symbol} ~~~~ % |\|$\alpha$|CS|$\gamma$\oarg{accent}\marg{Symbol}\\[1ex] % |\|$\alpha$|S|$\gamma$\,|*|\oarg{accent}\marg{Symbol}~~~ % |\|$\alpha$|CS|$\gamma$\,|*|\oarg{accent}\marg{Symbol} % \end{Decl} % % with command names \cmd{\bS}, \cmd{\aS}, \cmd{\aSa}, \cmd{\aSb}, etc. % See Tab.\:\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} % % The \MT\ commands look ahead for sub- and superscripts % 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\\[.75ex] % \cmd{\bS}|[|\cmd{\ddot}|]{x}_i^s| \> \bS[\ddot]{x}_i^s\\[.75ex] % \cmd{\bSa}|{E}^k| \> \bSa{E}^k\\[.75ex] % \cmd{\aSb}|{E}_s| \> \aSb{E}_s % \end{sample} % % 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} % % 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} % % 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 % % \clearpage % \section{Symbol formatting commands} % \subsection{Bold italic symbols} % % 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} % % or anywhere in the document with the command % % \begin{Decl} % \cmd{\SetSymbFont}\marg{font-command}^^A % \SpecialUsageIndex{\SetSymbFont} % \end{Decl} % % 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} % % 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} % % or anywhere in the document with the command % % \begin{Decl} % \SpecialUsageIndex{\SetSymbStrut}^^A % \cmd{\SetSymbStrut}\marg{strut} % \end{Decl} % % For example % % \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} % \begin{sample} % |\SetSymbStrut{\relax}| \\ % |\bSb{E}|, |\bS{f}|, |\Sb{y}| \>\bSb{E}, \bS{x}, \Sb{y} % \end{sample} % % \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}\\ % \cmd{\SetBarSkip}\marg{muskip length}\\ % \cmd{\SetSymSuBSkip}\marg{muskip length}\\ % \cmd{\SetSymSuPSkip}\marg{muskip length} % \SpecialUsageIndex{\SetArrowSkip} % \SpecialUsageIndex{\SetBarSkip} % \SpecialUsageIndex{\SetSymSuBSkip} % \SpecialUsageIndex{\SetSymSuPSkip} % \end{Decl} % % 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''). % % % \clearpage % \section{Additional commands} % \subsection{Saving equations} % % The \MT\ commands use a large number of calculations. % When the same symbol is used repetitively throughout % a document, a command % % \begin{Decl} % \SpecialUsageIndex{\DeclareSBox} % \cmd{\DeclareSBox}\marg{$\backslash$cmd}\marg{contents} % \end{Decl} % % is provided that saves 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 commands that % occur frequently and these are therefore included in the \MT\ package. % % \begin{Decl} % \SpecialUsageIndex{\SB} % \cmd{\SB}\marg{argument} % \end{Decl} % % 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} % % This command is provided if it does not already exist. % \begin{sample} % |$\norm{\aS{x}}=x$| \> $\norm{\aS{x}}=x$ % \end{sample} % % \begin{Decl} % \SpecialUsageIndex{\tdot} % \cmd{\tdot} % \end{Decl} % % This command, which is shorthand for % |\ensuremath{{\cdot}}|, 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} % % This command types the matrix transpose symbol ,\trnsp. % % \begin{sample} % |$\SB{\bSb{E}^s_r}^\trnsp$| \> $\SB{\bSb{E}^s_r}^\trnsp$ % \end{sample} % % % \section{Other programs, classes and packages} % % \begin{description} % \item[\normalfont{\sffamily{\bfseries\scriptsize PDF}\LaTeX}]^^A % --- The \MT\ package works fine, but some workarounds were necessary % when the \pkg{pdftex.def} driver is loaded with the \pkg{color}, % \pkg{hyperref} or \pkg{graphics} packages. The main problem it % the \cmd{\usebox} command that functions differently from standard % \LaTeX{}. This is because \pkg{pdftex} does not implement a colour % stack such as in the \pkg{dvips} driver, but simulate it at \TeX{} % macro level. % \\ % % \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} ---] % 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 \myemph{\Hass}\cite{Hass93a}, % \S10.1, p.82 % % \begin{minipage}{\textwidth} % \begin{verbatim} % \SetSymbFont{\relax} % \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} % \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} \\ % % \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: % \begin{sample} % |\bmdefine{\bO}{\mathit{\Omega}}| \\ % |\bSb*{\bO_i}| \>\qquad\qquad\qquad \bSb*{\bO_i} % \end{sample} % % \end{description} % % % \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{$f^{}_b$}$\overline{\phantom{f}}^a$| % \end{sample} % which gives \leavevmode\rlap{$f^{}_b$}$\overline{\phantom{f}}^a$. % % 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 symbol (including subscript) is wider than the % overline, % \leavevmode\rlap{$f^{}_{abcd}$}$\overline{\phantom{f}}^a$, % because the subscript 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 % \cmd{\smash} and \cmd{\vphantom} commands, % ^^A % \begin{sample} % |\leavevmode\rlap{$f^{}_b$}%|\\ % |${\smash{\dot{\overline{\phantom{f}}}}\vphantom{\overline{f}}}^a$| % \end{sample} % % % which gives % \leavevmode\rlap{${\smash{\dot{\overline{\phantom{f}}}}^^A % \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{\ArrWdth}\settowidth{\ArrWdth}{$\overrightarrow{i}$}|\\ % |\newlength{\SymWdth}\settowidth{\SymWdth}{$i$}|\\ % |\newlength{\Wspace}\setlength{\Wspace}{0.5\ArrWdth}|\\ % |\addtolength{\Wspace}{-0.5\SymWdth}|\\ % |\leavevmode\rlap{$\hspace*{\Wspace}i^{}_b$}%|\\ % |${\smash{\dot{\overrightarrow{\phantom{i}}}}%|\\ % | \vphantom{\overrightarrow{i}}}^a$| % \end{sample} % \newlength{\ArrWdth}\settowidth{\ArrWdth}{$\overrightarrow{i}$}^^A % \newlength{\SymWdth}\settowidth{\SymWdth}{$i$}^^A % \newlength{\Wspace}\setlength{\Wspace}{0.5\ArrWdth}^^A % \addtolength{\Wspace}{-0.5\SymWdth}^^A % which gives \leavevmode\rlap{\hspace*{\Wspace}$i^{}_b$}${^^A % \smash{\dot{\overrightarrow{\phantom{i}}}}\vphantom{\overrightarrow{i}}}^a$^^A % % 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. % The next piece of code simulates a \cmd{\mathpalette} by using the % \pkg{amsmath} command \cmd{\text}. Take a guess at the value of |cnt|. % \begin{sample} % |\newcounter{cnt}|\\ % |\newcommand*{\Sym}[1]{%|\\ % | \boldsymbol{{#1\addtocounter{cnt}{1}}}}|\\ % |$Q_\text{\leavevmode\rlap%|\\ % | {$\Sym{x}_i$}%|\\ % | ${\smash{\dot{\overrightarrow{\phantom{\Sym{x}}}}}%|\\ % | \vphantom{\overrightarrow{\Sym{x}^j}}}$%|\\ % | }$ ~~cnt $=$ \thecnt| % \end{sample} % It gives the correct scaled tensor \usebox{\nested} (proper white % space before symbol not implemented) % % This piece of code is nominated as the worst \LaTeX{} code, in % terms of efficiency, that has ever been written. But before voting, % load the \pkg{accents} package, rerun it, and then cast % your vote. % % \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. So, people at Y\&Y or Bluesky, \myemph{please} % do not update your font. % % \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} % % \subsection{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} % % Please send all bug reports, suggestions, advice or code improvements % to: % \medskip % % \fbox{\begin{minipage}{\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}} % % \StopEventually{ % % \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} % % } ^^A end StopEventually % % \clearpage % \section{The Code: \pkg{mattens.sty}} % \setlength{\parskip}{\smallskipamount} % % \begin{macrocode} %<*package> % \end{macrocode} % % \subsection{Identification} % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mattens}[2001/12/09 v1.0 DNJ Els] % \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} % 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 an additional \cmd{\begingroup}, \cmd{\endgroup} is placed around % the \cmd{\usebox} command\footnote{Thanks to Heiko Oberdiek for this % workaround}. A strut is added after the box to regain its height. % \begin{macrocode} \newcommand{\xusebox}[1]{% \setbox\z@\null% \ht\z@\ht#1% \dp\z@\dp#1% \begingroup% \usebox{#1}% \endgroup% \box\z@} % \end{macrocode} % \end{macro} % % % \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}{\relax} \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{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} % % % \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@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} % % The following commands are the main \MT\ commands that set up % all the global variables and pointers and then calls the command % \cmd{\MT@GetScrpts} to extract the sub- and superscripts and % which then in turn calls the global pointer \cmd{\MT@cmd} to % do the typesetting. It first checks if the command is starred and % set the bold italic formatting accordingly. % % \begin{macro}{\ifMT@bold} % A boolean if bold italic formatting is on or off % \begin{macrocode} \newif\ifMT@bold \MT@boldfalse % \end{macrocode} % \end{macro} % % \begin{macro}{\aS} % \begin{macro}{\@aS} % Type the tensor: \aS{x} % \begin{macrocode} \DeclareRobustCommand*{\aS}{% \@ifstar{\MT@boldfalse\@aS}{\MT@boldtrue\@aS}} % \end{macrocode} % \begin{macrocode} \newcommand*{\@aS}[2][\@empty]{% \let\MT@accent=#1% \let\MT@cmd=\MT@OverAandB% \let\MT@@cmd=\MT@Overarrow% \MT@SuPskip=\MT@Askip% \MT@SuBskip=\MT@SBskip% \MT@GetScrpts{#2}}% % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\bS} % \begin{macro}{\@bS} % Type the tensor: \bS{x} % \begin{macrocode} \DeclareRobustCommand*{\bS}{% \@ifstar{\MT@boldfalse\@bS}{\MT@boldtrue\@bS}} % \end{macrocode} % \begin{macrocode} \newcommand*{\@bS}[2][\@empty]{% \let\MT@accent=#1% \let\MT@cmd=\MT@OverAandB% \let\MT@@cmd=\MT@Overline% \MT@SuPskip=\MT@Bskip% \MT@SuBskip=\MT@SBskip% \MT@GetScrpts{#2}}% % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\Sa} % \begin{macro}{\@Sa} % Type the tensor: \Sa{x} % \begin{macrocode} \DeclareRobustCommand*{\Sa}{% \@ifstar{\MT@boldfalse\@Sa}{\MT@boldtrue\@Sa}} % \end{macrocode} % \begin{macrocode} \newcommand*{\@Sa}[2][\@empty]{% \let\MT@accent=#1% \let\MT@cmd=\MT@UnderAandB% \let\MT@@cmd=\MT@Underarrow% \MT@SuPskip=\MT@SPskip% \MT@SuBskip=\MT@Askip% \MT@GetScrpts{#2}}% % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\Sb} % \begin{macro}{\@Sb} % Type the tensor: \Sb{x} % \begin{macrocode} \DeclareRobustCommand*{\Sb}{% \@ifstar{\MT@boldfalse\@Sb}{\MT@boldtrue\@Sb}} % \end{macrocode} % \begin{macrocode} \newcommand*{\@Sb}[2][\@empty]{% \let\MT@accent=#1% \let\MT@cmd=\MT@UnderAandB% \let\MT@@cmd=\MT@Underline% \MT@SuPskip=\MT@SPskip% \MT@SuBskip=\MT@Bskip% \MT@GetScrpts{#2}}% % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\bSb} % \begin{macro}{\@bSb} % Type the tensor: \bSb{E} % \begin{macrocode} \DeclareRobustCommand*{\bSb}{% \@ifstar{\MT@boldfalse\@bSb}{\MT@boldtrue\@bSb}} % \end{macrocode} % \begin{macrocode} \newcommand*{\@bSb}[2][\@empty]{% \let\MT@accent=#1% \let\MT@cmd=\MT@DoubleAandB% \let\MT@@cmd=\MT@@bSb% \MT@SuPskip=\MT@Bskip% \MT@SuBskip=\MT@Bskip% \MT@GetScrpts{#2}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\aSb} % \begin{macro}{\@aSb} % Type the tensor: \aSb{E} % \begin{macrocode} \DeclareRobustCommand*{\aSb}{% \@ifstar{\MT@boldfalse\@aSb}{\MT@boldtrue\@aSb}} % \end{macrocode} % \begin{macrocode} \newcommand*{\@aSb}[2][\@empty]{% \let\MT@accent=#1% \let\MT@cmd=\MT@DoubleAandB% \let\MT@@cmd=\MT@@aSb% \MT@SuPskip=\MT@Askip% \MT@SuBskip=\MT@Bskip% \MT@GetScrpts{#2}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\bSa} % \begin{macro}{\@bSa} % Type the tensor: \bSa{E} % \begin{macrocode} \DeclareRobustCommand*{\bSa}{% \@ifstar{\MT@boldfalse\@bSa}{\MT@boldtrue\@bSa}} % \end{macrocode} % \begin{macrocode} \newcommand*{\@bSa}[2][\@empty]{% \let\MT@accent=#1% \let\MT@cmd=\MT@DoubleAandB% \let\MT@@cmd=\MT@@bSa% \MT@SuPskip=\MT@Bskip% \MT@SuBskip=\MT@Askip% \MT@GetScrpts{#2}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\aSa} % \begin{macro}{\@aSa} % Type the tensor: \aSa{E} % \begin{macrocode} \DeclareRobustCommand*{\aSa}{% \@ifstar{\MT@boldfalse\@aSa}{\MT@boldtrue\@aSa}} % \end{macrocode} % \begin{macrocode} \newcommand*{\@aSa}[2][\@empty]{% \let\MT@accent=#1% \let\MT@cmd=\MT@DoubleAandB% \let\MT@@cmd=\MT@@aSa% \MT@SuPskip=\MT@Askip% \MT@SuBskip=\MT@Askip% \MT@GetScrpts{#2}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\bCSb} % \begin{macro}{\@bCSb} % Type the tensor: \bCSb{\omega} % \begin{macrocode} \DeclareRobustCommand*{\bCSb}{% \@ifstar{\MT@boldfalse\@bCSb}{\MT@boldtrue\@bCSb}} % \end{macrocode} % \begin{macrocode} \newcommand*{\@bCSb}[2][\@empty]{% \let\MT@accent=#1% \let\MT@cmd=\MT@DoubleAandB% \let\MT@@cmd=\MT@@bCSb% \MT@SuPskip=\MT@Bskip% \MT@SuBskip=\MT@Bskip% \MT@GetScrpts{#2}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\aCSa} % \begin{macro}{\@aCSa} % Type the tensor: \aCSa{\omega} % \begin{macrocode} \DeclareRobustCommand*{\aCSa}{% \@ifstar{\MT@boldfalse\@aCSa}{\MT@boldtrue\@aCSa}} % \end{macrocode} % \begin{macrocode} \newcommand*{\@aCSa}[2][\@empty]{% \let\MT@accent=#1% \let\MT@cmd=\MT@DoubleAandB% \let\MT@@cmd=\MT@@aCSa% \MT@SuPskip=\MT@Askip% \MT@SuBskip=\MT@Askip% \MT@GetScrpts{#2}} % \end{macrocode} % \end{macro} % \end{macro} % % % \subsection{Sub- and superscripts} % % This part of the code looks ahead for sub- and superscripts and % put those tokens into the global variables (commands) % \cmd{\MT@suB} and \cmd{\MT@suP}. If there are sub-and % superscripts present then the flags \cmd{\ifMT@@suB} and % \cmd{\ifMT@@suP} are set accordingly. These variables are stored % for the final typesetting with the commands \cmd{\MT@setsuB}, % \cmd{\MT@setsuBS} and \cmd{\MT@setsuP}. % % \begin{macro}{\ifMT@@suB} % \begin{macro}{\ifMT@@suP} % Define flags that are set inside the extraction commands if sub- % or superscripts are present. % % \begin{macrocode} \newif\ifMT@@suB \newif\ifMT@@suP % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\MT@suB} % \begin{macro}{\MT@suP} % Define global variables (commands) that contains the extracted % sub- and superscripts. These commands are redefined inside the % extraction commands. % % \begin{macrocode} \newcommand*{\MT@suB}{} \newcommand*{\MT@suP}{} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\MT@GetScrpts} % The first extraction command. It looks ahead for |^| or |_|, % if not present, then calls the typesetting command pointer % \cmd{\MT@cmd} with empty sub- and superscripts, otherwise passes % the tokens on to the next extraction commands. % % \begin{macrocode} \newcommand*{\MT@GetScrpts}[1]{% \@ifnextchar^% {\MT@GetsuP{#1}}% {\@ifnextchar_% {\MT@GetsuB{#1}}% {\MT@@suBfalse% \MT@@suPfalse% \ensuremath{\MT@cmd{#1}}}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\MT@GetsuP} % Extract and typeset calls 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@GetsuP#1^#2{% \@ifnextchar_% {\MT@GetsuPsuB{#1}{#2}}% {\MT@@suBfalse% \MT@@suPtrue% \renewcommand*{\MT@suP}{#2}% \ensuremath{\MT@cmd{#1}}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\MT@GetsuB} % Extract and typeset calls 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@GetsuBsuP{#1}{#2}}% {\MT@@suBtrue% \MT@@suPfalse% \renewcommand*{\MT@suB}{#2}% \ensuremath{\MT@cmd{#1}}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\MT@GetsuPsuB} % Extract and typeset calls of the form % \meta{Sym}|^|\meta{sup}|_|\meta{sub}. % % \begin{macrocode} \def\MT@GetsuPsuB#1#2_#3{% \MT@@suBtrue% \MT@@suPtrue% \renewcommand*{\MT@suB}{#3}% \renewcommand*{\MT@suP}{#2}% \ensuremath{\MT@cmd{#1}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\MT@GetsuBsuP} % Extract and typeset calls of the form % \meta{Sym}|_|\meta{sub}|^|\meta{sup}. % % \begin{macrocode} \def\MT@GetsuBsuP#1#2^#3{% \MT@@suBtrue% \MT@@suPtrue% \renewcommand*{\MT@suB}{#2}% \renewcommand*{\MT@suP}{#3}% \ensuremath{\MT@cmd{#1}}} % \end{macrocode} % \end{macro} % % The next commands are for the actual typesetting of the % saved sub- and superscripts. These commands are called from % within the main typesetting command pointed to by \cmd{\MT@cmd}. % % \begin{macro}{\MT@setsuB} % Type |_{|\meta{mskip}\meta{sub}|}| if subscript is present. % % \begin{macrocode} \newcommand*{\MT@setsuB}{% \ifMT@@suB _{\mskip\MT@SuBskip\relax\MT@suB}% \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\MT@setsuBS} % Type |^{}_{|\meta{mskip}\meta{sub}|}| if subscript is present. % % \begin{macrocode} \newcommand*{\MT@setsuBS}{% \ifMT@@suB ^{}_{\mskip\MT@SuBskip\relax\MT@suB}% \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\MT@setsuP} % Type |^{|\meta{mskip}\meta{sup}|}| if superscript is present. % % \begin{macrocode} \newcommand*{\MT@setsuP}{% \ifMT@@suP ^{\mskip\MT@SuPskip\relax\MT@suP}% \fi} % \end{macrocode} % \end{macro} % % % \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% \ifMT@bold\MT@SymbFnt#1\else#1\fi} % \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{% \ifMT@bold\MT@SymbFnt#1\else#1\fi}} % \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} % 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}|}|. % % The command \cmd{\xusebox} is used in place \cmd{\usebox} because % of compatibility problems with \pkg{pdftex.def}. % % \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#1\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\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{\xusebox\MT@Abox}{\xusebox\MT@Sbox}% \else% \leavevmode\rlap{\xusebox\MT@Sbox}{\xusebox\MT@Abox}% \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\MT@UnderAandB} % \begin{macro}{\MT@@UnderAandB} % 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. % \begin{macrocode} \newcommand*{\MT@UnderAandB}{% \mathpalette\MT@@UnderAandB} % \end{macrocode} % \begin{macrocode} \newcommand*{\MT@@UnderAandB}[2]{% \sbox{\MT@Tbox}{$\m@th#1\MT@Symb{#2}$}% \setbox\MT@SPbox\null% \ht\MT@SPbox\ht\MT@Tbox% \dp\MT@SPbox\dp\MT@Tbox% \wd\MT@SPbox\wd\MT@Tbox% \sbox{\MT@APbox}{$\m@th#1\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\MT@Symb{#2}\MT@setsuP$}% \sbox{\MT@Tbox}{$\m@th#1\MT@accent{\xusebox{\MT@APbox}}$}% \ht\MT@Tbox\ht\MT@APbox% \dp\MT@Tbox\dp\MT@APbox% \sbox{\MT@Abox}{$\m@th#1\xusebox{\MT@Tbox}\MT@setsuB$}% \ifdim\wd\MT@Abox<\wd\MT@Sbox% \leavevmode\rlap{\xusebox\MT@Abox}{\xusebox\MT@Sbox}% \else% \leavevmode\rlap{\xusebox\MT@Sbox}{\xusebox\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} % 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} % %^^A {\smash{\MT@accent{\MT@@cmd{#1}{#2}}}\vphantom{\MT@@cmd{#1}{#2}}}% %^^A \MT@setsuP% %^^A \MT@setsuB} % % \subsection{A save/recall box utility} % % \begin{macro}{\DeclareSBox} % \begin{macro}{\MT@cname} % \begin{macro}{\MT@bname} % \begin{macro}{\MT@bnameuse} % % For the command % \cmd{\DeclareSBox}\marg{$\backslash$cmd}\marg{contents}, % it saves the \meta{contents} in a savebox % |\MTbox@|\textit{cmd}. It then defines a command |\|\textit{cmd} % that expands to |\usebox{\MTbox@|\textit{cmd}|}|. % % First a safety check if internal commands exist. % \begin{macrocode} \newcommand*{\MT@cname}{} % -> \newcommand*{\MT@bname}{} % -> MTbox@ \newcommand*{\MT@bnameuse}{} % -> \MTbox@ % \end{macrocode} % % Here the main command % % \begin{macrocode} \newcommand{\DeclareSBox}[2]{% \edef\MT@cname{\expandafter\@gobble\string#1}% \edef\MT@bname{MTbox@\MT@cname}% \@ifundefined{\MT@cname}{% \edef\MT@bnameuse{\csname\MT@bname\endcsname}% \expandafter\newbox\MT@bnameuse% \global\sbox{\MT@bnameuse}{#2}% % \end{macrocode} % % \begin{Indent}{8em} % In the next declaration |\xdef| was replaced % by |\protected@xdef| and an additional |\protect| was added before % the |\xusebox| command. This was nessesary to be compatable with % \pkg{pdftex.def}\footnote{Thanks to Heiko Oberdiek and Robin Fairbairns % for this advice.}. % \end{Indent} % % \begin{macrocode} \protected@xdef#1{\protect\xusebox{\MT@bnameuse}}% }% {\PackageError{mattens}% {Command \space\protect#1\space allready\space defined!}% {Use\space a\space different\space name}}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % % \subsection{Helper utility functions} % % % \begin{macro}{\cdot} % \begin{macro}{\trnsp} % \begin{macro}{\norm} % \begin{macro}{\SB} % The following is a set of very simple utility macro's inside \MT\ % to ease the typesetting of matrix--tensor stuff. They can all be % used in text mode. % % \begin{macrocode} \newcommand*{\tdot}{\ensuremath{{\cdot}}} % Center dot \newcommand*{\trnsp}{\ensuremath{\mathsf{T}}} % Matrix transpose \providecommand*{\norm}[1]{\ensuremath{\lVert{#1}\rVert}}% Norm delimiters \newcommand*{\SB}[1]{\ensuremath{\left[\, #1\right]}} % Square brackets % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macrocode} % % \end{macrocode} % \clearpage % \Finale % \setcounter{IndexColumns}{2}\PrintIndex % \PrintChanges % \endinput