| 1 |
% \iffalse meta comment |
| 2 |
% File: hhtensor.dtx Copyright (C) 2003-2011 Harald Harders |
| 3 |
% \fi |
| 4 |
% |
| 5 |
% \iffalse |
| 6 |
% |
| 7 |
%<*driver> |
| 8 |
\listfiles |
| 9 |
\documentclass[ngerman,english,a4paper]{ltxdoc} |
| 10 |
\usepackage[T1]{fontenc} |
| 11 |
%\usepackage{longtable} |
| 12 |
\usepackage{mathcomp} |
| 13 |
\usepackage{babel} |
| 14 |
\IfFileExists{hhtensor.sty}{% |
| 15 |
\usepackage{hhtensor} |
| 16 |
}{% |
| 17 |
\GenericWarning{hhtensor.dtx}{Package file hhtensor.sty not found |
| 18 |
(Documentation will be messed up!^^J^^A |
| 19 |
Generate hhtensor.sty by (La)TeXing hhtensor.ins, process |
| 20 |
hhtensor.dtx again)^^J}\stop |
| 21 |
} |
| 22 |
\GetFileInfo{hhtensor.sty} |
| 23 |
\title{The \texttt{hhtensor} package\thanks{This file has version |
| 24 |
\fileversion\ last revised \filedate.}} |
| 25 |
\author{Harald Harders\\\texttt{[email protected]}} |
| 26 |
\date{File Date \filedate, Printed \today} |
| 27 |
\newlength{\tempdima}% |
| 28 |
\makeatletter |
| 29 |
\renewenvironment{table}[1][]{% |
| 30 |
\@float{table}[#1]% |
| 31 |
\centering% |
| 32 |
\setlength{\tempdima}{\abovecaptionskip}% |
| 33 |
\setlength{\abovecaptionskip}{\belowcaptionskip}% |
| 34 |
\setlength{\belowcaptionskip}{\tempdima}% |
| 35 |
}{% |
| 36 |
\end@float |
| 37 |
} |
| 38 |
\def\meta@font@select{\normalfont\itshape} |
| 39 |
%% |
| 40 |
\DeclareRobustCommand*\bvec[1]{\ensuremath{\boldsymbol{#1}}} |
| 41 |
\DeclareRobustCommand*\bmatr[1]{\ensuremath{\boldsymbol{#1}}} |
| 42 |
\DeclareRobustCommand*\btens[2]{\ensuremath{\boldsymbol{#1}}} |
| 43 |
\DeclareRobustCommand*\uvec[1]{\ushort{#1}} |
| 44 |
\DeclareRobustCommand*\umatr[1]{\ushortd{#1}} |
| 45 |
\DeclareRobustCommand*\utens[2]{% |
| 46 |
\begingroup |
| 47 |
\setlength{\arraycolsep}{0pt} |
| 48 |
\begin{array}[t]{c}% |
| 49 |
#1 \\[-2.05ex] |
| 50 |
{\scriptstyle \sim} \\[-2.1ex] |
| 51 |
{\scriptscriptstyle #2}\\[-0.7ex] |
| 52 |
\end{array}% |
| 53 |
\endgroup |
| 54 |
} |
| 55 |
\makeatother |
| 56 |
%% |
| 57 |
\EnableCrossrefs |
| 58 |
\CodelineIndex |
| 59 |
\DoNotIndex{\def,\edef,\let,\newcommand,\newenvironment,\newcounter} |
| 60 |
\DoNotIndex{\setcounter,\space,\if,\else,\fi,\empty,\@empty,\ifx,\fi} |
| 61 |
\DoNotIndex{\ifnum,\fi,\expandafter,\csname,\endcsname,\the} |
| 62 |
\DoNotIndex{\MessageBreak,\message,\newlength,\newif,\xdef,\newcount} |
| 63 |
\DoNotIndex{\begingroup,\endgroup,\,,\@tempcnta,\@tempdima,\advance} |
| 64 |
\DoNotIndex{\ensuremath,\filedate,\fileversion,\docdate} |
| 65 |
\DoNotIndex{\mathit,\mathrm,\mathsf,\nprt@tmp,\nprt@tmpnum,\relax} |
| 66 |
\DoNotIndex{\protect,\renewcommand,\setlength,\settowidth,\stepcounter} |
| 67 |
\DoNotIndex{\string,\DeclareRobustCommand,\\} |
| 68 |
\CodelineNumbered |
| 69 |
\RecordChanges |
| 70 |
%\CheckSum{1016} |
| 71 |
\begin{document} |
| 72 |
\DocInput{hhtensor.dtx} |
| 73 |
\end{document} |
| 74 |
%</driver> |
| 75 |
% \fi |
| 76 |
% |
| 77 |
% \changes{0.61}{2011/12/29}{Avoid usage of \cs{fileversion} etc.}% |
| 78 |
% \changes{0.6}{2003/10/15}{Total new implementation}% |
| 79 |
% |
| 80 |
% \maketitle |
| 81 |
% \begin{abstract} |
| 82 |
% \noindent |
| 83 |
% This package provides commands for vectors, matrices, and tensors |
| 84 |
% with different styles (arrows as the \LaTeX\ default, underlined, |
| 85 |
% and bold). |
| 86 |
% \end{abstract} |
| 87 |
% |
| 88 |
% \tableofcontents |
| 89 |
% |
| 90 |
% \section*{Copyright} |
| 91 |
% |
| 92 |
% Copyright 2003--2011 Harald Harders. |
| 93 |
% |
| 94 |
% This program can be redistributed and/or modified under the terms |
| 95 |
% of the LaTeX Project Public License Distributed from CTAN |
| 96 |
% archives in directory macros/latex/base/lppl.txt; either |
| 97 |
% version 1 of the License, or any later version. |
| 98 |
% |
| 99 |
% |
| 100 |
% \section{Load the package} |
| 101 |
% |
| 102 |
% To use this package place |
| 103 |
% \begin{quote} |
| 104 |
% |\usepackage|\oarg{style}\marg{hhtensor} |
| 105 |
% \end{quote} |
| 106 |
% in the preamble of your document. |
| 107 |
% The \meta{style} is |arrow|, |bold|, or |uline| for arrow style, |
| 108 |
% bold symbols, resp.\ underlined symbols. |
| 109 |
% Default is |arrow|. |
| 110 |
% |
| 111 |
% |
| 112 |
% \section{Usage} |
| 113 |
% |
| 114 |
% \DescribeMacro{\vec} |
| 115 |
% Vectors are printed as usual using the \cs{vec\marg{symbol}} |
| 116 |
% command. |
| 117 |
% Depending on the style, they are printed $\vec{\alpha}$, |
| 118 |
% $\bvec{\alpha}$, resp.\ $\uvec{\alpha}$. |
| 119 |
% |
| 120 |
% \DescribeMacro{\matr} |
| 121 |
% Matrices are printed using \cs{matr\marg{symbol}}: $\matr{\alpha}$, |
| 122 |
% $\bmatr{\alpha}$, resp.\ $\umatr{\alpha}$. |
| 123 |
% |
| 124 |
% \DescribeMacro{\tens} |
| 125 |
% Tensors are a little bit different. |
| 126 |
% They take two arguments while the first one is the symbol, while the |
| 127 |
% second is the step: \cs{tens\marg{symbol}\marg{step}}. |
| 128 |
% This leads to $\tens{\alpha}{4}$, $\btens{\alpha}{4}$, resp.\ |
| 129 |
% $\utens{\alpha}{4}$. |
| 130 |
% |
| 131 |
% In the bold style, it is not distinguished between vectors, |
| 132 |
% matrices, and tensors. |
| 133 |
% I would like to use upright symbols but then you cannot use all |
| 134 |
% symbols because there is no full upright bold math alphabet. |
| 135 |
% |
| 136 |
% \DescribeMacro{\dcdot} |
| 137 |
% The \cs{dcdot} command produces a double dot for double scalar |
| 138 |
% products, e.g., |
| 139 |
% $\matr{\sigma}=\tens{A}{4}\dcdot\matr{\varepsilon}$. |
| 140 |
% |
| 141 |
% \DescribeMacro{\trans} |
| 142 |
% \cs{trans} produces a transponed sign: $\matr{A}\trans = \matr{B}$. |
| 143 |
% |
| 144 |
% |
| 145 |
% \StopEventually{\PrintChanges \PrintIndex} |
| 146 |
% |
| 147 |
% \section{The implementation} |
| 148 |
% \iffalse |
| 149 |
%<*package> |
| 150 |
% \fi |
| 151 |
% Heading of the package: |
| 152 |
% \begin{macrocode} |
| 153 |
\NeedsTeXFormat{LaTeX2e} |
| 154 |
\ProvidesPackage{hhtensor} |
| 155 |
[2011/12/29 v0.61 Print vectors and tensors] |
| 156 |
% \end{macrocode} |
| 157 |
% |ushort| underlines with shorter lines than \cs{underline}. |
| 158 |
% \begin{macrocode} |
| 159 |
\RequirePackage{ushort} |
| 160 |
% \end{macrocode} |
| 161 |
% |amsmath| for bold symbols. |
| 162 |
% \begin{macrocode} |
| 163 |
\RequirePackage{amsmath} |
| 164 |
% \end{macrocode} |
| 165 |
% Booleans to decide which version has to be used. |
| 166 |
% \begin{macrocode} |
| 167 |
\newif\iftensor@bold |
| 168 |
\newif\iftensor@uline |
| 169 |
% \end{macrocode} |
| 170 |
% Package options that set the booleans. |
| 171 |
% \begin{macrocode} |
| 172 |
\DeclareOption{bold}{\tensor@boldtrue\tensor@ulinefalse} |
| 173 |
\DeclareOption{uline}{\tensor@boldfalse\tensor@ulinetrue} |
| 174 |
\DeclareOption{arrow}{\tensor@boldfalse\tensor@ulinefalse} |
| 175 |
% \end{macrocode} |
| 176 |
% Default are arrows, as in standard \LaTeX. |
| 177 |
% \begin{macrocode} |
| 178 |
\ExecuteOptions{arrow} |
| 179 |
\ProcessOptions\relax |
| 180 |
% \end{macrocode} |
| 181 |
% \begin{macro}{\origvec} |
| 182 |
% Save the original \cs{vec} command. |
| 183 |
% \begin{macrocode} |
| 184 |
\newcommand\origvec{} |
| 185 |
\let\origvec=\vec |
| 186 |
% \end{macrocode} |
| 187 |
% \end{macro} |
| 188 |
% If bold vectors and tensors are requested, execute this code. |
| 189 |
% \begin{macrocode} |
| 190 |
\iftensor@bold |
| 191 |
% \end{macrocode} |
| 192 |
% \begin{macro}{\vec} |
| 193 |
% Redefine the \cs{vec} command. |
| 194 |
% \begin{macrocode} |
| 195 |
\DeclareRobustCommand*\vec[1]{\ensuremath{\boldsymbol{#1}}} |
| 196 |
% \end{macrocode} |
| 197 |
% \end{macro} |
| 198 |
% \begin{macro}{\matr} |
| 199 |
% Defined the \cs{matr} command. |
| 200 |
% \begin{macrocode} |
| 201 |
\DeclareRobustCommand*\matr[1]{\ensuremath{\boldsymbol{#1}}} |
| 202 |
% \end{macrocode} |
| 203 |
% \end{macro} |
| 204 |
% \begin{macro}{\tens} |
| 205 |
% Defined the \cs{tens} command. |
| 206 |
% \begin{macrocode} |
| 207 |
\DeclareRobustCommand*\tens[2]{\ensuremath{\boldsymbol{#1}}} |
| 208 |
% \end{macrocode} |
| 209 |
% \end{macro} |
| 210 |
% Underlined vectors? |
| 211 |
% \begin{macrocode} |
| 212 |
\else |
| 213 |
\iftensor@uline |
| 214 |
% \end{macrocode} |
| 215 |
% \begin{macro}{\vec} |
| 216 |
% Vectors underlined. |
| 217 |
% \begin{macrocode} |
| 218 |
\DeclareRobustCommand*\vec[1]{\ushort{#1}} |
| 219 |
% \end{macrocode} |
| 220 |
% \end{macro} |
| 221 |
% \begin{macro}{\matr} |
| 222 |
% Matrices double underlined. |
| 223 |
% \begin{macrocode} |
| 224 |
\DeclareRobustCommand*\matr[1]{\ushortd{#1}} |
| 225 |
% \end{macrocode} |
| 226 |
% \end{macro} |
| 227 |
% \begin{macro}{\tens} |
| 228 |
% Tensors with number of step below. |
| 229 |
% \begin{macrocode} |
| 230 |
\DeclareRobustCommand*\tens[2]{% |
| 231 |
\begingroup |
| 232 |
\setlength{\arraycolsep}{0pt} |
| 233 |
\begin{array}[t]{c}% |
| 234 |
#1 \\[-2.05ex] |
| 235 |
{\scriptstyle \sim} \\[-2.1ex] |
| 236 |
{\scriptscriptstyle #2}\\[-0.7ex] |
| 237 |
\end{array}% |
| 238 |
\endgroup |
| 239 |
} |
| 240 |
% \end{macrocode} |
| 241 |
% \end{macro} |
| 242 |
% Vectors with an arrow. |
| 243 |
% Since this is the default, the \cs{vec} command has not to be |
| 244 |
% redefined. |
| 245 |
% \begin{macrocode} |
| 246 |
\else |
| 247 |
% \end{macrocode} |
| 248 |
% \begin{macro}{\matr} |
| 249 |
% Matrix. |
| 250 |
% \begin{macrocode} |
| 251 |
\DeclareRobustCommand*\matr[1]{\ensuremath{\vec{\vec{#1}}}} |
| 252 |
% \end{macrocode} |
| 253 |
% \end{macro} |
| 254 |
% \begin{macro}{\tens} |
| 255 |
% Tensors with number of step below. |
| 256 |
% That does not fit well to the arrow styles, but I don't know a |
| 257 |
% better solution. |
| 258 |
% Does somebody have one? |
| 259 |
% \begin{macrocode} |
| 260 |
\DeclareRobustCommand*\tens[2]{% |
| 261 |
\begingroup |
| 262 |
\setlength{\arraycolsep}{0pt} |
| 263 |
\begin{array}[t]{c}% |
| 264 |
#1 \\[-2.05ex] |
| 265 |
{\scriptstyle \sim} \\[-2.1ex] |
| 266 |
{\scriptscriptstyle #2}\\[-0.7ex] |
| 267 |
\end{array}% |
| 268 |
\endgroup |
| 269 |
} |
| 270 |
% \end{macrocode} |
| 271 |
% \end{macro} |
| 272 |
% \begin{macrocode} |
| 273 |
\fi |
| 274 |
\fi |
| 275 |
% \end{macrocode} |
| 276 |
% \begin{macro}{\dcdot} |
| 277 |
% Double scalar product. |
| 278 |
% \begin{macrocode} |
| 279 |
\DeclareRobustCommand*\dcdot{\mathrel{\cdot\mkern 0.0mu \cdot}}% |
| 280 |
% \end{macrocode} |
| 281 |
% \end{macro} |
| 282 |
% \begin{macro}{\trans} |
| 283 |
% Transformed sign. |
| 284 |
% \begin{macrocode} |
| 285 |
\DeclareRobustCommand*\trans{^{\mathrm{T}}} |
| 286 |
% \end{macrocode} |
| 287 |
% \end{macro} |
| 288 |
% |
| 289 |
% \iffalse |
| 290 |
%</package> |
| 291 |
% \fi |
| 292 |
% \Finale |
| 293 |
|