% \iffalse meta comment % File: hhtensor.dtx Copyright (C) 2003-2011 Harald Harders % \fi % % \iffalse % %<*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 } \GetFileInfo{hhtensor.sty} \title{The \texttt{hhtensor} package\thanks{This file has version \fileversion\ last revised \filedate.}} \author{Harald Harders\\\texttt{harald.harders@gmx.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} % % \fi % % \changes{0.61}{2011/12/29}{Avoid usage of \cs{fileversion} etc.}% % \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--2011 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} [2011/12/29 v0.61 Print vectors and tensors] % \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 % % \fi % \Finale