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