diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:58:49 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:58:49 +0000 |
commit | 9b485f17fc03b4be369857cc792790790e72c86a (patch) | |
tree | 7c70c7cd442b7eb30c0325a82d63c3f164b8edbb | |
parent | 1480de361227b38eafb41f16b68555964b5b3021 (diff) |
trunk/Master/texmf-dist/source/latex/unitsdef
git-svn-id: svn://tug.org/texlive/trunk@576 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/source/latex/unitsdef/unitsdef.dtx | 1430 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/unitsdef/unitsdef.ins | 52 |
2 files changed, 1482 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/unitsdef/unitsdef.dtx b/Master/texmf-dist/source/latex/unitsdef/unitsdef.dtx new file mode 100644 index 00000000000..208134835fb --- /dev/null +++ b/Master/texmf-dist/source/latex/unitsdef/unitsdef.dtx @@ -0,0 +1,1430 @@ +% \iffalse meta-comment +% +% unitsdef.dtx +% +% This file is part of the package unitsdef for use with LaTeX2e +% +% Function: Typesetting units in a proper way +% +% Copyright (C) 2004, Patrick Happel +% +% This program 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. +% +% Please send error reports and suggestions for improvements to +% Patrick Happel <patrick.happel@ruhr-uni-bochum.de> +% +% +%<*dtx> + \ProvidesFile{unitsdef.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{unitsdef}[2005/01/04 v0.2 Typesetting units] +%<driver>\ProvidesFile{unitsdef.dtx} +% \fi + \ProvidesFile{unitsdef.dtx} + [2004/01/05 Typesetting units a proper way] +% +% \GetFileInfo{unitsdef.sty} +% +% \CheckSum{1054} +% +%% \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 \~} +%% +% \iffalse +%<*driver> +\documentclass[a4paper,10pt]{ltxdoc} +\usepackage{tabularx} +\usepackage{longtable} +\usepackage{ltxtable} +\usepackage{unitsdef} +\usepackage[latin1]{inputenc} +\usepackage[english]{babel} +\usepackage[DIVcalc]{typearea} +\usepackage{multicol} +\usepackage{color} + \definecolor{dred}{rgb}{.5,0,0} + \definecolor{gray}{rgb}{.9,.9,.9} +\usepackage{url} +\usepackage{soul} +\usepackage{booktabs} +\newcommand{\paket}[1]{\textsf{#1}} +\newcommand{\option}[1]{\texttt{#1}} +\newcommand{\name}[1]{\caps{#1}} +\newcommand{\zitat}[1]{\frqq#1\flqq} + +\GlossaryPrologue{\section*{Changes}} +\makeatletter + +\newenvironment{example}{\par\vspace*{.5\baselineskip}}{\par} +\makeatother +\RecordChanges +\EnableCrossrefs +\CodelineIndex +\begin{document} + \DocInput{unitsdef.dtx} +\end{document} +%</driver> +% \fi +% \MakeShortVerb{\§} +% \title{\paket{unitsdef} -- Typesetting units with \LaTeXe\thanks{Version \fileversion}} +% \author{\name{Patrick Happel}\thanks{patrick.happel@rub.de}} +% \date{\filedate} +% \setcounter{tocdepth}{2} +% \DoNotIndex{\csname,\endcsname,\expandafter,\noexpand,\string} +% \DoNotIndex{\begingroup,\endgroup,\def,\xdef,\long,\let} +% \DoNotIndex{\ifx,\newcommand,\renewcommand} +% \DoNotIndex{\\,\%,\,\@ifpackageloaded,\@tempa,\AtBeginDocument} +% \DoNotIndex{\cdot,\DeclareOption,\DeclareRobustCommand,\edef} +% \DoNotIndex{\else,\ensuremath,\f@family,\fi,\global,\ifmmode} +% \DoNotIndex{\ifnum,\InputIfFileExists,\mathrm,\MessageBreak,\newif} +% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PassOptionsToPackage} +% \DoNotIndex{\prime,\ProcessOptions,\relax,\RequirePackage,\sfdefault} +% \DoNotIndex{\text,\unit,\upshape,\xspace} +% \DoNotIndex{\unit@@literfalse,\unit@@litertrue,\unit@@numprintfalse,\unit@@numprinttrue} +% \DoNotIndex{\unit@@Ohmfalse,\unit@@Ohmtrue,\unit@@redefgensymbfalse,\unit@@redefgensymbtrue} +% \DoNotIndex{\unit@@useabbrvtrue,\unit@@useabbrvfalse} +% \DoNotIndex{\unit@@useampabbrvfalse,\unit@@useampabbrvtrue,\unit@@useampabbrvtrue,\unit@@useampabbrvtrue} +% \DoNotIndex{\unit@@useconfigfiletrue,\unit@@useconfigfilefalse,\unit@@useenergyabbrvtrue} +% \DoNotIndex{\unit@@useenergyabbrvfalse,\unit@@usefreqabbrvtrue,\unit@@usefreqabbrvfalse} +% \DoNotIndex{\unit@@uselengthabbrvtrue,\unit@@uselengthabbrvfalse,\unit@@usemolabbrvfalse} +% \DoNotIndex{\unit@@usemolabbrvtrue,\unit@@usetimeabbrvtrue,\unit@@usetimeabbrvfalse} +% \DoNotIndex{\unit@@usevolabbrvtrue,\unit@@usevolabbrvfalse,\unit@@usevoltabbrvtrue,\unit@@usevoltabbrvfalse} +% \DoNotIndex{\unit@@useweightabbrvtrue,\unit@@useweightabbrvfalse,\unit@@xspacetrue,\unit@@xspacefalse} +% \changes{v0.1}{2004/02/14}{First public release} +% \changes{v0.11}{2004/02/17}{Added electronvolt} +% \changes{v0.12}{2004/02/26}{Fixed some bugs relating to +% \paket{gensymb}.} +% \changes{v0.13}{2004/03/02}{Some bugfixes and some units added.} +% \changes{v0.13a}{2004/04/27}{More bugfixes. \cmd{\utimes} is now +% called \cmd{\unittimes}} +% \maketitle +% \begin{abstract} +% There are a lot of packages for typesetting units in +% \LaTeXe. Some define macros to typeset a lot of units but do not suit +% to the actual font settings, some make the characters needed available +% but do not predefine any unit.\par +% This package tries to comply with both requirements. It predefines +% common units, defines an easy to use interface to define new units and +% changes the output concerning to the surrounding font settings. +% \end{abstract} +% \begin{multicols}{2} +% \tableofcontents +% \end{multicols} +% \PrintChanges +% \vfill +% \section*{Thanks} +% \begin{multicols}{2}\small\noindent\raggedright +% I have to thank some people who helped me by delivering suggestions, bug-reports, +% feature request, providing general ideas or anything else: +% \name{Frank Heimann}, \name{Stephan Mann}, \name{Frank Küster}, \name{Stefan +% Salewski}, \name{Stephan Hennig}, \name{Klaus Wacker}, \name{Christoph Löser} +% \end{multicols}\newpage +% \section{Packages loaded by \paket{unitsdef}} +% \paket{unitsdef} loads (and so needs) the following packages with the given +% options: +% \begin{itemize} +% \item \paket{[T1]fontenc} +% \item \paket{textcomp} +% \item \paket{amsmath} +% \item \paket{units} +% \item \paket{xspace} (as long as \option{noxspace}, see +% section~\ref{sec:more-options}, isn't specified) +% \end{itemize} +% The first two packages are needed for different characters in the +% encodings set by these packages, \paket{amsmath} provides the very useful +% |\text| macro and \paket{units} is used for typesetting the +% units. \paket{xpsace} is included to obtain the facility to write +% §5\mm and some text§ instead of §5\mm\ and some text§. +% \section{General usage}\label{generell} +% To use \paket{unitsdef} simply specify +% \begin{verse} +% \cmd{\usepackage}\oarg{options}|{unitsdef}| +% \end{verse} +% in the preamble of your document. +% \section{Options}\label{sec:options} +% \subsection{Options related to \paket{gensymb}}\label{sec:gensymb-options} +% \paket{unitsdef} knows three options to avoid conflicts with the +% \paket{gensymb}-package that also predefines macros for typesetting +% »\textmu«, »\textohm« and »\textcelsius«. Some macros are definied both by +% \paket{gensymb} and \paket{unitsdef}. To solve this problem three different +% options exist: +% \begin{description} +% \item[OHM] makes \paket{unitsdef} use uppercase macros (\cmd{\Ohm}, +% \cmd{\Celsius}, \cmd{\Micro} and \cmd{\Degree}). The predefined units with +% prefixes still appear lowercase (\cmd{\kiloohm}). +% \item[ohm] is the opposite to \option{OHM} and is the default setting. +% \item[redef-gensymb] This option copies \cmd{\ohm}, \cmd {\celsius}, +% \cmd{\micro} and \cmd{\degree} from \paket{gensymb} to \cmd{\gensymbohm}, +% \cmd{\gensymbcelsius}, \cmd{\gensymbmicro} and \cmd{\gensymbdegree}. +% \paket{unitsdef} then redefines this four commands so that they +% have the same meaning as without \paket{gensymb}. \textbf{Important:} To +% use this option \paket{gensymb} has to be loaded \emph{before} +% \paket{unitsdef}! +% \end{description} +% \subsection{More options}\label{sec:more-options} +% \paket{unitsdef} knows some other options to change its behaviour: +% \begin{description} +% \item[LITER] Makes \paket{unitsdef} use the \emph{uppercase} L as the sign produced +% by \cmd{\liter}. This is default behaviour. +% \item[liter] Makes \paket{unitsdef} use the \emph{lowercase} l as the sign produced +% by \cmd{\liter}. +% \item[noxspace] Maybe some problems occur due to the \paket{xspace} +% functionality of \paket{unitsdef}. This option forces \paket{unitsdef} to do +% without \paket{xspace}. +% \item[noconfig] Tells \paket{unitsdef} not to look for a local +% \paket{unitsdef} configuration file §unitsdef.cfg§ (see +% section~\ref{config-file} for details). +% \item[noabbrv] Is an abbreviation for \emph{no abbreviations}. \paket{unitsdef} +% does not define any short commands for a unit. This might be helpfull if +% another package defines a command with the same name and \LaTeX\ exits with +% an error. +% \item[ugly] Applies the option \option{ugly} to \paket{units}, thus all +% units containing fraction will be typeset like m/s in text mode and +% $\frac{\mathrm{m}}{\mathrm{s}}$ in mathmode. +% \item[\emph{skipping only particular abbreviations}] Usually only +% one macro causes conflict between a definition made by +% \paket{unitsdef} and another package. There are some options to +% avoid loading only particular abbreviations to avoid the definition +% that causes the conflict: +% \begin{description} +% \item[noamperageabbr] Avoids defining the abbreviations for units of +% amperage (\cmd{\pA}, \cmd{\nA}, \cmd{\micA}, \cmd{\mA}, \cmd{\kA}). +% \item[nofrequncyabbr] Avoids defining \cmd{\kHz}, \cmd{\MHz} and +% \cmd{\GHz}. +% \item[nomolabbr] Avoids defining \cmd{\fmol}, \cmd{\pmol}, +% \cmd{\nmol}, \cmd{\micmol} and \cmd{\mmol}. +% \item[novoltageabbr] Avoids defining \cmd{\kV} and \cmd{\mv}. +% \item[novolumeabbr] Avoids defining \cmd{\fl}, \cmd{\pl}, \cmd{\nl}, +% \cmd{\micl}, \cmd{\ml}, \cmd{\cl} and \cmd{\dl}. +% \item[noweightabbr] Avoids defining \cmd{\kg}, \cmd{\fg}, \cmd{\pg}, +% \cmd{\nanog}, \cmd{\micg} and \cmd{\mg}. +% \item[noenergyabbr] Avoids defining \cmd{\kJ}, \cmd{\eV}, +% \cmd{\meV}, \cmd{\keV}, \cmd{\MeV}, \cmd{\GeV} and \cmd{\TeV}. +% \item[nolengthabbr] Avoids defining \cmd{\picom}, \cmd{\nm}, +% \cmd{\micm}, \cmd{\mm}, \cmd{\cm}, \cmd{\dm} and \cmd{\km}. +% \item[notimeabbr] Avoids defining \cmd{\sek}, \cmd{\fs}, \cmd{\ps}, +% \cmd{\ns}, \cmd{\mics} and \cmd{\ms}. +% \end{description} +% \end{description} +% \section{Typesetting units}\label{setzen} +% \paket{unitsdef} includes a large set of predefined units. They are listed +% in section~\ref{definierte}. These units, as well as units defined by +% you with \cmd{\newunit} (see below), can be used as follows: +% \begin{verse} +% |\|\meta{unitmacro}$\left[\left<\text{value}\right>\right]$ +% \end{verse} +% As you see, the value is an optional argument. Thus you can write |5\kg| +% (instead of |\kg[5]|), this may simplify the writing process. The distance +% in both cases is |\unitvaluesep|.\par +% If the optional argument is not used you still can write +% |5\kg and some text| +% due to the \paket{xspace} functionality of \paket{unitsdef}.\par +% \DescribeMacro{\unitvaluesep} If you want another distance between value and +% unit you simply have to redefine |\unitvaluesep|: +% \begin{verse} +% |\renewcommand{\unitvaluesep}{\hspace*{|$\left<\text{\textit{distance}}\right>$|}}| +% \end{verse} +% \DescribeMacro{\unitsignonly} If you want to typeset the sign of a unit +% without any value (for introducing a new unit-sign f.e.) |\unitvaluesep| +% must not be set. This is provided by the macro +% |\unitsignonly{\<unitmacro>}|.\par +% \textbf{Important!} If you want to specify a unit with a prefix, never use +% something like |\milli\hour|. This will lead to problems. Always define the +% units first using \cmd{\newunit} or use the command \cmd{\ilu} to +% typeset an unit without defining it first! +% \subsection{Inline units}\label{sec:inlineunits} +% \DescribeMacro{\ilu} +% Some packages for typesetting units provide the possibility to write +% things like |\micro\meter| to obtain \unitsignonly{\micrometer}. With +% \paket{unitsdef} this will cause some problems due to the toggling of +% some internal switches. If you want to use prefices without defining +% a new unit you have to use the command \cmd{\ilu}. It has one +% optional and one mandatory argument. The first contains the value to +% be typeset, the latter contains the unit: +% \begin{example} +% \noindent\begin{minipage}{\textwidth} +% \begin{minipage}{.45\linewidth} +% \begin{verbatim} +% A force of +% \ilu[17]{\micro\newton} +% is applied. +% $F=17\ilu{\micro\newton}$ +% \textsf{17\ilu{\micro\newton}} +% \end{verbatim} +% \end{minipage}\hfill +% \colorbox{gray}{% +% \begin{minipage}{.45\linewidth} +% A force of \ilu[17]{\micro\newton} is +% applied. $F=17\ilu{\micro\newton}$% \textsf{17\ilu{\micro\newton}} +% \end{minipage}} +% \end{minipage} +% \end{example} +% \subsection{Typesetting angles and arcs}\label{angles} +% If you type |5\degree10\arcmin12\arcsec| you will get the following result: +% \zitat{5\degree10\arcmin12\arcsec}. There are full spaces between the single +% values and the preceding unit-symbol. This is due to the \paket{xspace} +% functionality of \paket{unitsdef}. The correct output you will obtain by using +% the macro \cmd{\arc}\footnote{It is expected to have (nearly?) the same +% usage and results as \cmd{\ang} from the \paket{SIstyle} package.}. Using +% it in this way |\arc{5;10;12}| will lead to \zitat{\arc{5;10;12}}. There +% are some more features of this macro, best understood if you look at this +% example: +% \begin{example} +% \begin{minipage}{.45\textwidth} +% \begin{verbatim} +% \begin{enumerate} +% \item \arc{1} % 1 +% \item \arc{1;2} % 2 +% \item \arc{1;2;3} % 3 +% \item \arc{;2;3} % 4 +% \item \arc{;;3} % 5 +% \item \arc{1;;2} % 6 +% \item \arc{1;;} % 7 +% \item \arc{;;;} % 8 +% \end{enumerate} +% \end{verbatim} +% \end{minipage}\hfill\colorbox{gray}{% +% \begin{minipage}{.45\textwidth}\small +% \begin{enumerate} +% \item \arc{1} +% \item \arc{1;2} +% \item \arc{1;2;3} +% \item \arc{;2;3} +% \item \arc{;;3} +% \item \arc{1;;2} +% \item \arc{1;;} +% \item \arc{;;;} +% \end{enumerate} +% \end{minipage}} +% \end{example} +% \subsection{Logical markup for units}\label{sec:logicalmarkup} +% One advantage of \paket{unitsdef} is that it typesets the units +% suiting to the surrounding font settings. But some people +% (magazines, universities, \ldots) want units always to be typeset in +% a special way. There is a checklist available at +% \url{http://physics.nist.gov/cuu/Units/checklist.html}. +% \paket{unitsdef} does not fit to all these requirements by +% default. But there are some macros for figuring out the +% output. \DescribeMacro{\SI}First, there is the command \cmd{\SI} which typesets (by +% default) all units in upright shape, but doesn't change anything +% else according to the font settings. The command \cmd{\SI} has two +% mandatory arguments, the first has to contain the value, the latter +% contains the unit: +% \begin{example} +% \begin{minipage}{.45\textwidth} +% \begin{verbatim} +% \textbf{\textit{A force of +% \SI{17}{\newton} +% was applied.}} +% \end{verbatim} +% \end{minipage}\hfill\colorbox{gray}{% +% \begin{minipage}{.45\textwidth} +% \textbf{\textit{A force of \SI{17}{\newton} was applied.}} +% \end{minipage}} +% \end{example} +% If you want to customize the output of \cmd{\SI}, you can redefine +% the macro \cmd{\unitSIdef}. By default it contains \cmd{\upright}, +% but if you want units to be typeset upright in serif family, you can +% achieve this by redefining it to |\upshape\rmfamily|: +% \begin{example} +% \begin{minipage}{.45\textwidth} +% \begin{verbatim} +% \renewcommand{\unitSIdef} +% {\upshape\rmfamily} +% \textsf{\textbf{\textit{% +% A force of +% \SI{17}{\newton} +% was applied.}}} +% \end{verbatim} +% \end{minipage}\hfill\colorbox{gray}{% +% \begingroup +% \begin{minipage}{.45\textwidth} +% \renewcommand{\unitSIdef}{\upshape\rmfamily} +% \textsf{\textbf{\textit{% +% A force of +% \SI{17}{\newton} +% was applied.}}} +% \end{minipage}\endgroup} +% \end{example} +% \section{The interface}\label{schnittstelle} +% \subsection{Defining new units} +% \DescribeMacro{\newunit} +% Besides the predefined unit-macros (see section~\ref{definierte}) +% \paket{unitsdef} offers the possibility to define new +% units. This is done with the macro \cmd{\newunit}: +% \begin{verse} +% \cmd{\newunit}\{|\|\meta{unitmacro}\}\marg{unitsign} +% \end{verse} +% To typeset a unit \emph{Newton} (represented by |N|) you have to +% define\footnote{You do not really have to define \emph{newton}, it is +% already defined by \paket{unitsdef}. This is just an example.} it +% as follows: +% \begin{verbatim} +% \newunit{\newton}{N} +% \end{verbatim} +% After this you can use the macro \cmd{\newton}: +% \begin{verbatim} +% 5\newton plus \newton[3] is 8\newton. +% \end{verbatim} +% This will give the following output: +% \begin{verse} +% 5\newton plus \newton[3] is 8\newton. +% \end{verse} +% To define a unit \emph{millinewton} (|mN|) simply define: +% \begin{verbatim} +% \newunit{\millinewton}{\milli\newton} +% \end{verbatim} +% \DescribeMacro{\renewunit} For redefining units, the macro +% \cmd{\renewunit} can be used with the same syntax as \cmd{\newunit} +% (on the lines of \cmd{\newcommand} and \cmd{\renewcommand}).\par +% \DescribeMacro{\newnosepunit} As an additional facility to define new units +% the macro \cmd{\newnosepunit} exists with the same syntax as \cmd{\newunit}. +% It allows you to define a unit without any space between the value and the +% unit-symbol. The only unit I know typeset without leading space is +% \emph{degree}. You typeset 5\degree instead of 5\,\degree. But maybe there +% are other units that must not have leading space, so I included this command +% in the user interface. +% +% \DescribeMacro{\renewnosepunit} If you want to redifine a unit to be typeset +% without leading space, use \cmd{\renewnosepunit}.\par +% \DescribeMacro{\per} To typeset units containing a fraction the macro +% \cmd{\per} is defined. The usage is: +% \begin{verse} +% \cmd{\per}\marg{numerator}\marg{denominator} +% \end{verse} +% To define \emph{newton per squaremeter} you have to say: +% \begin{verbatim} +% \newunit{\newtonpersmeter}{\per{\newton}{\squaremeter}} +% \end{verbatim}\par +% \DescribeMacro{\unittimes} To typeset a multiplication sign between two +% units the macro \cmd{\unittimes} is used: +% \begin{verbatim} +% \newunit{\newtonmeter}{\newton\unittimes\meter} +% \newunit{\newtonmeterpersec}{\per{\newton\unittimes\meter}{\second}} +% \end{verbatim}\par +% \DescribeMacro{\unitsep} To typeset additional space (instead of \cmd{\unittimes}) between two units +% you can use \cmd{\unitsep} (do NOT use \cmd{\,}): +% \begin{verbatim} +% \newunit{\newtonmeter}{\newton\unitsep\meter} +% \end{verbatim} +% The default is \cmd{\,} but if you want different amount of space you can +% simply |\renewcommand{\unitsep}|\marg{distance}.\par +% \DescribeMacro{\unitsuperscript} To typeset superscripts use \cmd{\unitsuperscript}: +% \begin{verbatim} +% \newunit{\squaremeter}{\meter\unitsuperscript{2}} +% \end{verbatim} +% \subsection{Typesetting \textmu, \textohm, \textdegree\ and +% \textcelsius}\label{diesache} +% \DescribeMacro{\setTextOmega}\DescribeMacro{\setMathOmega} +% \DescribeMacro{\setTextmu}\DescribeMacro{\setMathmu} +% \DescribeMacro{\setTextCelsius}\DescribeMacro{\setMathCelsius} +% \DescribeMacro{\setMathDegree}\DescribeMacro{\setTextDegree} +% Typesetting units would be quite easy without \emph{Ohm} and \emph{micro} +% (\emph{degree} and \emph{degree Celsius} as well). The representing +% characters \textmu\ and \textohm\ have to exist in three variants: One for +% use in math-mode +% (suiting to \cmd{\mathrm}) the latter two for use in \cmd{\rmfamily} and +% \cmd{\sffamily}. Most fonts have a suiting \textmu\ but very few fonts own a +% \textohm. The fonts from \name{Bitstream} (delivered with some versions of +% \name{Corel Draw}) have an italic non-suiting \textmu, so you have to take care +% of a \textmu\ when using such fonts, too. Also the \textmu\ in Latin Modern +% fonts isn't very good looking yet (but LM is still in +% beta-state). Because of nearly infinite combinations of different +% fonts it is impossible to choose the correct characters for \textmu, +% \textohm\ and \textcelsius\ automatically. To define these characters +% use the macros \cmd{\setTextOmega}, \cmd{\setMathOmega}, \cmd{\setTextmu}, +% \cmd{\setMathmu}, \cmd{\setTextCelsius}, \cmd{\setMathCelsius}, +% \cmd{\setMathDegree} and \cmd{\setTextDegree}: +% \begin{verse} +% \cmd{\setTextOmega}\marg{serif-definition}\marg{sans-serif-definition}\\ +% \cmd{\setMathOmega}\marg{definition}\\[.5\baselineskip] +% \cmd{\setTextmu}\marg{serif-definition}\marg{sans-serif-definition}\\ +% \cmd{\setMathmu}\marg{definition}\\[.5\baselineskip] +% \cmd{\setTextCelsius}\marg{serif-definition}\marg{sans-serif-definition}\\ +% \cmd{\setMathCelsius}\marg{definition}\\[.5\baselineskip] +% \cmd{\setTextDegree}\marg{serif-definition}\marg{sans-serif-definition}\\ +% \cmd{\setMathDegree}\marg{definition} +% \end{verse} +% \textbf{Important!} The macros concerning typesetting in math-mode use +% \paket{amsamth}'s \cmd{\text}-macro. So you have to switch to math-mode to use a +% character out of the math alphabet. The reason for this is +% \paket{units}. \paket{units} uses \cmd{\mathrm} to typeset in math-mode. But only few +% mathfonts have a suitable \textohm, for example: +% \begin{verbatim} +% \documentclass{article} +% +% \usepackage[T1]{fontenc} +% \usepackage{textcomp} +% \usepackage{mathpazo} +% +% \begin{document} +% $\Omega\qquad\mathrm{\Omega}$ +% \end{document} +% \end{verbatim} +% \paket{unitsdef} sets the defaults in a way suitable to the CM-family: +% \begin{verbatim} +% \setMathOmega{$\mathrm{\Omega}$} +% \setMathmu{\textmu} +% \setTextOmega{\textohm}{\textohm} +% \setTextmu{\textmu}{\textmu} +% \setMathCelsius{\textcelsius} +% \setTextCelsius{\textcelsius}{\textcelsius} +% \setMathDegree{\textdegree} +% \setTextDegree{\textdegree}{\textdegree} +% \end{verbatim} +% To find a suitable \textohm\ for different fonts use \name{Walter Schmidt}'s +% \paket{gensymb}-package\footnote{\texttt{CTAN:macros/latex/contrib/was/}} +% and read the documentation of this package. +% \section{Local configuration file}\label{config-file} +% Since version~0.2 unitsdef by default looks for a file §unitsdef.cfg§ and +% inputs its contents. This is useful if you frequently use a similar set of +% units in your documents. You put your definitions in §unitsdef.cfg§ and they +% are included automaticly in your document\footnote{Keep in mind that \TeX\ +% has to find the file, so follow the instructions given by your +% \TeX-distribution. On §*nix§-like systems and a TDS compliant distribution it might +% be possible to put |unitsdef.cfg| in \texttt{\textasciitilde}|/texmf/tex/latex/unitsdef/config/| +% and update the filename database.} +% +% A configuration file may look like this: +% \begin{verbatim} +% \ProvidesFile{unitsdef.cfg}% +% [2004/12/09 v1.0 some definitions for unitsdef] +% +% \newunit{\molar}{\per{\mole}{\liter}} +% \newunit{\millimolar}{\per{\millimole}{\liter}} +% +% \endinput +% \end{verbatim} +% If, by some reason, you don't want your local config file to be loaded +% specify the option \option{noconfig} in the \cmd{\usepackage} command. +% \section{Predefined units and prefices}\label{definierte} +% \LTXtable{\textwidth}{defedpraef.tex} +% \LTXtable{\textwidth}{defedunits.tex} +% \section{To Do}\label{sec:todo} +% There are a lot of things to be done. Some are mentioned here: +% \begin{itemize} +% \item Add some more macros to figure out the ouptut (something +% similar to \cmd{\SI}). Provide the possibility to typeset all units +% in math mode. +% \item Improve the documentation. +% \item Adding interfaces units for \AA, \textperthousand\ and \unitsignonly{\degree}F +% \end{itemize} +% \StopEventually{} +% \section{Code}\label{code} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \subsection{switches} +% \begin{macro}{\if@@setunitsep} +% This switch is used internally to decide, whether a distance is to be +% typesetted or not. +% \begin{macrocode} +\newif\if@@setunitsep +\@@setunitseptrue +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ifunit@@Ohm} +% This switch decides whether \cmd{\ohm} or \cmd{\Ohm} and +% \cmd{\celsius} or \cmd{\Celsius} is defined (according to \paket{gensymb}). +% \begin{macrocode} +\newif\ifunit@@Ohm% +\unit@@Ohmfalse +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ifunit@@redefgensymb} +% This switch makes \paket{gensymb}'s macros \cmd{\ohm} and \cmd{\celsius} +% available as \cmd{\gensymbohm} and \cmd{\gensymbcelsius}. \paket{unitsdef} +% uses \cmd{\ohm} and \cmd{\celsius}. +% \begin{macrocode} +\newif\ifunit@@redefgensymb +\unit@@redefgensymbfalse +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ifunit@@liter} +% This switch decides whether the output of the unit \cmd{liter} is typeset as +% |l| or |L| +% \begin{macrocode} +\newif\ifunit@@liter +\unit@@literfalse +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ifunit@@xspace} +% This switch decides whether \paket{xspace} is used. +% \begin{macrocode} +\newif\ifunit@@xspace +\unit@@xspacetrue +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ifunit@@xspace} +% This switch decides whether abbreviattions are loaded. +% \begin{macrocode} +\newif\ifunit@@useabbrv +\unit@@useabbrvtrue +% \end{macrocode} +% \end{macro} +% The follwing switches decide whether to load a |.cfg| file containing some +% abbreviations or not. +% \begin{macrocode} +\newif\ifunit@@useampabbrv +\unit@@useampabbrvtrue +\newif\ifunit@@usefreqabbrv +\unit@@usefreqabbrvtrue +\newif\ifunit@@usemolabbrv +\unit@@usemolabbrvtrue +\newif\ifunit@@usevoltabbrv +\unit@@usevoltabbrvtrue +\newif\ifunit@@usevolabbrv +\unit@@usevolabbrvtrue +\newif\ifunit@@useweightabbrv +\unit@@useweightabbrvtrue +\newif\ifunit@@useenergyabbrv +\unit@@useenergyabbrvtrue +\newif\ifunit@@uselengthabbrv +\unit@@uselengthabbrvtrue +\newif\ifunit@@usetimeabbrv +\unit@@usetimeabbrvtrue +% \end{macrocode} +% \begin{macro}{\ifunit@@useconfigfile} +% This switch stores whether the option \option{noconfig} is given. +% \begin{macrocode} +\newif\ifunit@@useconfigfile +\unit@@useconfigfiletrue +% \end{macrocode} +% \end{macro} +% \subsection{Options} +% \begin{macrocode} +\DeclareOption{OHM}{\unit@@Ohmtrue} +\DeclareOption{ohm}{\unit@@Ohmfalse} +\DeclareOption{redef-gensymb}{% + \@ifpackageloaded{gensymb}{% + \unit@@redefgensymbtrue% + \AtBeginDocument{% + \let\gensymbohm\ohm% + \let\gensymbcelsius\celsius% + \let\gensymbmicro\micro% + \renewunit{\ohm}{\unitOmega}% + \renewunit{\celsius}{\unitCelsius}% + \renewcommand{\micro}{\unitmu\@@setunitsepfalse}% + } + }{% + \PackageError{unitsdef}{ + You requestet me to save some macros from the\MessageBreak + gensymb-package. This package is not loaded.\MessageBreak + If you load it later, tell me to use uppercase\MessageBreak + macronames where conflicts appear by giving me\MessageBreak + the option OHM. + } + } +} +\DeclareOption{liter}{\unit@@litertrue} +\DeclareOption{LITER}{\unit@@literfalse} +\DeclareOption{noxspace}{\unit@@xspacefalse} +\DeclareOption{noabbrv}{\unit@@useabbrvfalse} +\DeclareOption{ugly}{\PassOptionsToPackage{ugly}{units}} +\DeclareOption{noamperageabbr}{\unit@@useampabbrvfalse} +\DeclareOption{nofrequncyabbr}{\unit@@usefreqabbrvfalse} +\DeclareOption{nomolabbr}{\unit@@usemolabbrvfalse} +\DeclareOption{novoltageabbr}{\unit@@usevoltabbrvfalse} +\DeclareOption{novolumeabbr}{\unit@@usevolabbrvfalse} +\DeclareOption{noweightabbr}{\unit@@useweightabbrvfalse} +\DeclareOption{noenergyabbr}{\unit@@useenergyabbrvfalse} +\DeclareOption{nolengthabbr}{\unit@@uselengthabbrvfalse} +\DeclareOption{notimeabbr}{\unit@@usetimeabbrvfalse} +\DeclareOption{noconfig}{\unit@@useconfigfilefalse} +\ProcessOptions +% \end{macrocode} +% \subsection{Loading packages} +% \begin{macrocode} +\RequirePackage[T1]{fontenc} +\RequirePackage{amsmath} +\RequirePackage{textcomp} +\RequirePackage{units} +\ifunit@@xspace + \RequirePackage{xspace}% + \let\unit@@xspace\xspace% +\else + \let\unit@@xspace\relax +\fi +% \end{macrocode} +% \subsection{The interface} +% \begin{macro}{\unitsignonly} +% This macro is used to typeset a unit without leading spacing. To +% achieve this \cmd{\@@setunitsep} is set to +% §false§. \cmd{\unitsignonly} has an mandatory argument containig the +% unit to typeset: \cmd{\unitsignonly}\marg{unit}. +% \changes{v0.2}{2004/11/28}{Now defined by \cmd{\DeclareRobustCommand}} +% \begin{macrocode} +\DeclareRobustCommand{\unitsignonly}[1]{% + \@@setunitsepfalse% + \begingroup% + \let\unit@@xspace\relax% + #1% + \endgroup} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitvaluesep} +% This Macro specifies the distance between value and unit, default value is +% \cmd{\,}. +% \begin{macrocode} +\newcommand{\unitvaluesep}{} +\let\unitvaluesep\,% +% \end{macrocode} +% \end{macro} +% \begin{macro}{\newunit} +% \changes{v0.2}{2004/11/23}{Added code for the use of \paket{xspace}} +% This macro is the interface to define new units. Usage is: +% \begin{verse} +% \cmd{\newunit}\{\textbackslash\meta{unitmacro}\}\marg{unitsign}. +% \end{verse} +% \begin{macrocode} +\newcommand{\newunit}[2]{% +% \end{macrocode} +% \changes{v0.2}{2004/11/28}{\cmd{\newunit} now uses \cmd{\DeclareRobustCommand} +% instead of \cmd{\newcommand}} +% First there is a check whether the macro already exists: +% \begin{macrocode} + \newcommand{#1}{}% +% \end{macrocode} +% then its definition is performed. +% \begin{macrocode} + \DeclareRobustCommand{#1}[1][]{##1% +% \end{macrocode} +% The redefinition of \cmd{\unitvaluesep} has to stay local: +% \begin{macrocode} + \begingroup% +% \end{macrocode} +% \cmd{\xpsace} must not do anything when invoked inside a unit. So it is set to +% \cmd{\relax} inside this group. +% \begin{macrocode} + \let\unit@@xspace\relax% + \if@@setunitsep% +% \end{macrocode} +% \changes{v0.2}{2004/11/28}{Now \paket{unitsdef} uses \cmd{\unitvaluesep} +% inistead of \cmd{\,}, thereby the interface is more flexible and allows the +% users to commit changes.} +% \begin{macrocode} + \unitvaluesep% +% \end{macrocode} +% Once a spacing is typeset there must no further spacing be +% typeset. To avoid typesetting more spacings I redefine \cmd{\unitvaluesep} +% to \cmd{\relax}. +% \begin{macrocode} + \let\unitvaluesep\relax% + \fi% + \unit{#2}\global\@@setunitseptrue% + \endgroup% +% \end{macrocode} +% Now \cmd{\xspace} has to be invoked, as long as \option{noxspace} is not set. +% \begin{macrocode} + \unit@@xspace% + }% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\renewunit} +% \changes{v0.2}{2004/11/23}{Added code for the use of +% \paket{xspace}. \cmd{\DeclareRobustCommand} is used instead of +% \cmd{\renewcommand}.} +% This macro is to redifine existing units. +% \begin{macrocode} +\newcommand{\renewunit}[2]{% + \renewcommand{#1}{}% + \DeclareRobustCommand{#1}[1][]{##1% + \begingroup% + \let\unit@@xspace\relax% + \if@@setunitsep% + \unitvaluesep% + \let\,\relax% + \fi% + \unit{#2}\global\@@setunitseptrue% + \endgroup% + \unit@@xspace% + }% +} + +% \end{macrocode} +% \end{macro} +% \begin{macro}{\newnosepunit} +% \changes{v0.2}{2004/11/26}{Added \cmd{\newnosepunit} and \cmd{\renewnosepunit} +% for units without any space between value and unitsign} +% \begin{macrocode} +\newcommand{\newnosepunit}[2]{% + \newcommand{#1}{}% + \DeclareRobustCommand{#1}[1][]{##1% + \begingroup% + \let\xspace\relax% + \if@@setunitsep% + \let\,\relax% + \fi% + \unit{#2}\global\@@setunitseptrue% + \endgroup% + \unit@@xspace% + }% +} +\newcommand{\renewnosepunit}[2]{% + \renewcommand{#1}{}% + \DeclareRobustCommand{#1}[1][]{##1% + \begingroup% + \let\unit@@xspace\relax% + \if@@setunitsep% + \let\,\relax% + \fi% + \unit{#2}\global\@@setunitseptrue% + \endgroup% + \unit@@xspace% + }% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\per} +% \begin{macrocode} +\newcommand\per[2]{% + \@@setunitsepfalse% + \unitfrac{#1}{#2}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ilu} +% The command \cmd{\ilu} provides the possibility to typeset +% inline-units that are not defined by a previous \cmd{\newunit} +% command. +% \begin{macrocode} +\newcommand{\ilu}[2][]{% + \begingroup% + \@@setunitsepfalse% + \let\unit@@xspace\relax% + #1\,\unit{#2}% + \endgroup% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unittimes} +% \begin{macrocode} +\newcommand{\unittimes}{\@@setunitsepfalse\ensuremath{\cdot}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitsep} +% \begin{macrocode} +\let\unitsep\, +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitsuperscript} +% \begin{macrocode} +\newcommand{\unitsuperscript}[1]{% + \ifmmode^{#1}\else\textsuperscript{#1}\fi% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitMathOmega} +% \begin{macrocode} +\newcommand{\unitMathOmega}{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitTextOmega} +% \begin{macrocode} +\newcommand{\unitTextOmega}{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unittextmu} +% \begin{macrocode} +\newcommand{\unitTextmu}{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitmathmu} +% \begin{macrocode} +\newcommand{\unitMathmu}{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitMathCelsius} +% \begin{macrocode} +\newcommand{\unitMathCelsius}{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitTextCelsius} +% \begin{macrocode} +\newcommand{\unitTextCelsius}{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitTextDegree} +% \begin{macrocode} +\newcommand{\unitTextDegree}{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitMathDegree} +% \begin{macrocode} +\newcommand{\unitMathDegree}{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitCelsius} +% \begin{macrocode} +\newcommand{\unitCelsius}{% + \ifmmode\unitMathCelsius\else\unitTextCelsius\fi% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitmu} +% \begin{macrocode} +\newcommand{\unitmu}{% + \ifmmode\unitMathmu\else\unitTextmu\fi% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitOmega} +% \begin{macrocode} +\newcommand{\unitOmega}{% + \ifmmode\unitMathOmega\else\unitTextOmega\fi% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitDegree} +% \begin{macrocode} +\newcommand{\unitDegree}{% + \ifmmode\unitMathDegree\else\unitTextDegree\fi% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\setMathOmega} +% \begin{macrocode} +\newcommand{\setMathOmega}[1]{% + \renewcommand{\unitMathOmega}{\text{#1}}% +} +\setMathOmega{$\mathrm{\Omega}$} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\setMathmu} +% \begin{macrocode} +\newcommand{\setMathmu}[1]{% + \renewcommand{\unitMathmu}{\text{#1}}% +} +\setMathmu{\textmu} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\setMathCelsius} +% \begin{macrocode} +\newcommand{\setMathCelsius}[1]{% + \renewcommand{\unitMathCelsius}{\text{#1}}% +} +\setMathCelsius{\textcelsius} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\setMathDegree} +% \begin{macrocode} +\newcommand{\setMathDegree}[1]{% + \renewcommand{\unitMathDegree}{\text{#1}}% +} +\setMathDegree{\textdegree} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\setTextOmega} +% This macro is to define the \zitat{\textohm} that is used in text +% mode. The first argument is used when \cmd{\rmfamily} is active, the +% latter when \cmd{\sffamily} is active. +% \begin{macrocode} +\newcommand{\setTextOmega}[2]{% + \renewcommand{\unitTextOmega}{% + \begingroup% + \edef\@tempa{\sfdefault}% + \ifx\f@family\@tempa% + #2% + \else% + #1% + \fi% + \endgroup% + }% +} +\setTextOmega{\textohm}{\textohm} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\setTextmu} +% This macro is to define the \zitat{\textmu} that is used in text +% mode. The first argument is used when \cmd{\rmfamily} is active, the +% latter when \cmd{\sffamily} is active. +% \begin{macrocode} +\newcommand{\setTextmu}[2]{% + \renewcommand{\unitTextmu}{% + \begingroup% + \edef\@tempa{\sfdefault}% + \ifx\f@family\@tempa% + #2% + \else% + #1% + \fi% + \endgroup% + }% +} +\setTextmu{\textmu}{\textmu} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\setTextCelsius} +% This macro is to define the \zitat{\textcelsius} that is used in text +% mode. The first argument is used when \cmd{\rmfamily} is active, the +% latter when \cmd{\sffamily} is active. +% \begin{macrocode} +\newcommand{\setTextCelsius}[2]{% + \renewcommand{\unitTextCelsius}{% + \begingroup% + \edef\@tempa{\sfdefault}% + \ifx\f@family\@tempa% + #2% + \else% + #1% + \fi% + \endgroup% + }% +} +\setTextCelsius{\textcelsius}{\textcelsius} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\setTextDegree} +% This macro is to define the \zitat{\textdegree} that is used in text +% mode. The first argument is used when \cmd{\rmfamily} is active, the +% latter when \cmd{\sffamily} is active. +% \begin{macrocode} +\newcommand{\setTextDegree}[2]{% + \renewcommand{\unitTextDegree}{% + \begingroup% + \edef\@tempa{\sfdefault}% + \ifx\f@family\@tempa% + #2% + \else% + #1% + \fi% + \endgroup% + }% +} +\setTextDegree{\textdegree}{\textdegree} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitSIdef} +% \changes{v0.2}{2004/12/22}{Added \cmd{\unitSIdef} to define units +% typeset by \cmd{\SI}.} +% \begin{macrocode} +\newcommand\unitSIdef{\upshape} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\SI} +% \changes{v0.2}{2004/12/22}{Added \cmd{\SI} to typeset units and +% values obeying the SI-rules.} +% \begin{macrocode} +\newcommand{\SI}{} +\DeclareRobustCommand{\SI}[2]{% + \begingroup% + \let\unit@@xspace\relax% + \unitSIdef\selectfont% + #1#2% + \endgroup% +} +% \end{macrocode} +% \end{macro} +% \subsection{Definition of prefices} +% \begin{macrocode} +\newcommand{\yocto}{y\@@setunitsepfalse} % -24 +\newcommand{\zepto}{z\@@setunitsepfalse} % -21 +\newcommand{\atto}{a\@@setunitsepfalse} % -18 +\newcommand{\femto}{f\@@setunitsepfalse} % -15 +\newcommand{\pico}{p\@@setunitsepfalse} % -12 +\newcommand{\nano}{n\@@setunitsepfalse} % -9 +\ifunit@@Ohm + \newcommand{\Micro}{\unitmu\@@setunitsepfalse} + \let\@unit@micro\Micro +\else + \ifunit@@redefgensymb\else + \newcommand{\micro}{\unitmu\@@setunitsepfalse} + \let\@unit@micro\micro + \fi +\fi +\newcommand{\milli}{m\@@setunitsepfalse} % -3 +\newcommand{\centi}{c\@@setunitsepfalse} % -2 +\newcommand{\deci}{d\@@setunitsepfalse} % -1 + +\newcommand{\deca}{da\@@setunitsepfalse} % +1 +\newcommand{\hecto}{h\@@setunitsepfalse} % +2 + +\newcommand{\kilo}{k\@@setunitsepfalse} % +3 +\newcommand{\mega}{M\@@setunitsepfalse} % +6 +\newcommand{\giga}{G\@@setunitsepfalse} % +9 +\newcommand{\tera}{T\@@setunitsepfalse} % +12 +\newcommand{\peta}{P\@@setunitsepfalse} % +15 +\newcommand{\exa}{E\@@setunitsepfalse} % +18 +\newcommand{\zetta}{Z\@@setunitsepfalse} % +21 +\newcommand{\yotta}{Y\@@setunitsepfalse} % +24 + +% \end{macrocode} +% \subsection{Definitions of units} +% \subsubsection{base units} +% \begin{macrocode} +\newunit{\meter}{m} + \newunit{\gram}{g} +\newunit{\kilogram}{\kilo\gram} +\newunit{\mole}{mol} +\newunit{\second}{s} +\newunit{\ampere}{A} +\newunit{\kelvin}{K} +\newunit{\candela}{cd} + +% \end{macrocode} +% \subsubsection{Units of length} +% \begin{macrocode} + +\newunit{\picometer}{\pico\meter} +\newunit{\nanometer}{\nano\meter} +\newunit{\micrometer}{\@unit@micro\meter} +\newunit{\millimeter}{\milli\meter} +\newunit{\centimeter}{\centi\meter} +\newunit{\decimeter}{\deci\meter} +\newunit{\kilometer}{\kilo\meter} + +% \end{macrocode} +% \subsubsection{Units of weight} +% \begin{macrocode} + +\newunit{\femtogram}{\femto\gram} +\newunit{\picogram}{\pico\gram} +\newunit{\nanogram}{\nano\gram} +\newunit{\microgram}{\@unit@micro\gram} +\newunit{\milligram}{\milli\gram} + +% \end{macrocode} +% \subsubsection{Units of quantity} +% \begin{macrocode} + +\newunit{\femtomole}{\femto\mole} +\newunit{\picomole}{\pico\mole} +\newunit{\nanomole}{\nano\mole} +\newunit{\micromole}{\@unit@micro\mole} +\newunit{\millimole}{\milli\mole} + + +% \end{macrocode} +% \subsubsection{Units of time} +% \begin{macrocode} + +\newunit{\attosecond}{\atto\sek} +\newunit{\femtosecond}{\femto\sek} +\newunit{\picosecond}{\pico\sek} +\newunit{\nanosecond}{\nano\sek} +\newunit{\microsecond}{\@unit@micro\sek} +\newunit{\millisecond}{\milli\sek} + + +% \end{macrocode} +% \subsubsection{amperage} +% \begin{macrocode} + +\newunit{\picoampere}{\pico\ampere} +\newunit{\nanoampere}{\nano\ampere} +\newunit{\microampere}{\@unit@micro\ampere} +\newunit{\milliampere}{\milli\ampere} +\newunit{\kiloampere}{\kilo\ampere} + +% \end{macrocode} +% \subsubsection{Percent} +% \begin{macrocode} + +\newunit{\percent}{\%} + +% \end{macrocode} +% \subsubsection{Volumes} +% \begin{macrocode} + +\ifunit@@liter + \newunit{\liter}{l} +\else + \newunit{\liter}{L} +\fi + +\newunit{\femtoliter}{\femto\liter} +\newunit{\picoliter}{\pico\liter} +\newunit{\nanoliter}{\nano\liter} +\newunit{\microliter}{\@unit@micro\liter} +\newunit{\milliliter}{\milli\liter} +\newunit{\centiliter}{\centi\liter} +\newunit{\deciliter}{\deci\liter} +\newunit{\hectoliter}{\hecto\liter} + +\newunit{\cubicmeter}{\meter\unitsuperscript{3}} +\newunit{\cubicmicrometer}{\micrometer\unitsuperscript{3}} +\newunit{\cubicmillimeter}{\millimeter\unitsuperscript{3}} + + +% \end{macrocode} +% \subsubsection{Areas} +% \begin{macrocode} + +\newunit{\squaremeter}{\meter\unitsuperscript{2}} + +\newunit{\ar}{a} +\newunit{\hektar}{\hecto\ar} + +\newunit{\squarecentimeter}{\centimeter\unitsuperscript{2}} +\newunit{\squaremillimeter}{\millimeter\unitsuperscript{2}} +\newunit{\squarekilometer}{\kilometer\unitsuperscript{2}} +% \end{macrocode} +% \subsubsection{more units of weight} +% \begin{macrocode} + +\newunit{\ton}{t} + +% \end{macrocode} +% \subsubsection{Derived electrical units} +% \begin{macrocode} + +\newunit{\volt}{V} +\newunit{\millivolt}{\milli\volt} + +\newunit{\kilovolt}{\kilo\volt} + +\newunit{\watt}{W} +\newunit{\milliwatt}{\milli\watt} +\newunit{\kilowatt}{\kilo\watt} +\newunit{\megawatt}{\mega\watt} + +\newunit{\coulomb}{C} +% \end{macrocode} +% Don't forget the options when typesetting \textohm! +% \begin{macrocode} +\ifunit@@Ohm + \newunit{\Ohm}{\unitOmega} + \newunit{\kiloohm}{\kilo\Ohm} + \newunit{\megaohm}{\mega\Ohm} + \newunit{\gigaohm}{\giga\Ohm} +\else + \ifunit@@redefgensymb\else + \newunit{\ohm}{\unitOmega} + \fi + \newunit{\kiloohm}{\kilo\ohm} + \newunit{\megaohm}{\mega\ohm} + \newunit{\gigaohm}{\giga\ohm} +\fi +\newunit{\siemens}{S} +\newunit{\millisiemens}{\milli\siemens} +\newunit{\farad}{F} +\newunit{\femtofarad}{\femto\farad} +\newunit{\picofarad}{\pico\farad} +\newunit{\nanofarad}{\nano\farad} +\newunit{\microfarad}{\@unit@micro\farad} +\newunit{\millifarad}{\milli\farad} +% \end{macrocode} +% \subsubsection{Units of energy} +% \begin{macrocode} +\newunit{\joule}{J} +\newunit{\millijoule}{\milli\joule} +\newunit{\kilojoule}{\kilo\joule} +\newunit{\megajoule}{\mega\joule} + +\newunit{\calory}{cal} +\newunit{\kilocalory}{\kilo\calory} +\newunit{\electronvolt}{eV} +\newunit{\millielectronvolt}{\milli\eV} +\newunit{\kiloelectronvolt}{\kilo\eV} +\newunit{\megaelectronvolt}{\mega\eV} +\newunit{\gigaelectronvolt}{\giga\eV} +\newunit{\teraelectronvolt}{\tera\eV} + +% \end{macrocode} +% \subsubsection{more units of time} +% \begin{macrocode} +\newunit{\minute}{min} +\newunit{\hour}{h} +\newunit{\days}{d} +% \end{macrocode} +% \subsubsection{more units of temperature} +% Don't forget \paket{gensymb} when typesetting degree Celsius. +% \begin{macrocode} +\ifunit@@Ohm + \newunit{\Celsius}{\unitCelsius} +\else + \ifunit@@redefgensymb\else + \newunit{\celsius}{\unitCelsius} + \fi +\fi +% \end{macrocode} +% \subsubsection{Angles and arcs} +% \begin{macrocode} +\newunit{\radian}{rad} +\newunit{\steradian}{sr} +\ifunit@@Ohm + \newnosepunit{\Degree}{\unitDegree} +\else + \ifunit@@redefgensymb\else + \newnosepunit{\degree}{\unitDegree} + \fi +\fi + +\newunit{\arcmin}{\ensuremath{{}^\prime}} +\newunit{\arcsec}{\ensuremath{{}^{\prime\prime}}} +% \end{macrocode} +% Some \TeX\ to realize the syntax using |;| as separator. +% \begin{macrocode} +\DeclareRobustCommand{\arc}[1]{\expandafter\unit@arc#1;;!} + +\def\unit@arc#1;#2;#3!{% + \ifx\\#1\\\def\unit@arcdegreevalue{0}% + \else\def\unit@arcdegreevalue{#1}\fi% + \ifx\\#2\\\def\unit@arcminvalue{0}% + \else\def\unit@arcminvalue{#2}\fi% + \ifx\\#3\\\def\unit@arcsecvalue{0}% + \else\edef\unit@arcsecvalue{\expandafter\unit@strip#3;!}\fi% + \begingroup% + \let\unit@@xspace\relax% + \ifnum\unit@arcsecvalue=0\relax% + \ifnum\unit@arcminvalue=0\relax% + \ifnum\unit@arcdegreevalue=0\relax\else% + \unit@arcdegreevalue\degree% + \fi% + \else% + \unit@arcdegreevalue\degree% + \unitvaluesep% + \unit@arcminvalue\arcmin% + \fi% + \else% + \unit@arcdegreevalue\degree% + \unitvaluesep% + \unit@arcminvalue\arcmin% + \unitvaluesep% + \unit@arcsecvalue\arcsec% + \fi% + \endgroup% +} + +\def\unit@strip#1;#2!{% + \ifx\\#1\\0\else#1\fi% +} + +% \end{macrocode} +% \subsubsection{Frequencies} +% \begin{macrocode} +\newunit{\hertz}{Hz} + \newunit{\kilohertz}{\kilo\hertz} + \newunit{\megahertz}{\mega\hertz} + \newunit{\gigahertz}{\giga\hertz} + +% \end{macrocode} +% \subsubsection{Force} +% \begin{macrocode} +\newunit{\newton}{N} + \newunit{\millinewton}{\milli\newton} + \newunit{\kilonewton}{\kilo\newton} +% \end{macrocode} +% \subsubsection{Pressure} +% \begin{macrocode} +\newunit{\pascal}{Pa} + \newunit{\hectopascal}{\hecto\pascal} +\newunit{\uBar}{bar} + \newunit{\millibar}{\milli\uBar} +% \end{macrocode} +% \subsubsection{magnetic field strength} +% \begin{macrocode} +\newunit{\weber}{Wb} +% \end{macrocode} +% \subsubsection{magnetic flux density} +% \begin{macrocode} +\newunit{\tesla}{T} +% \end{macrocode} +% \subsubsection{Induction} +% \begin{macrocode} +\newunit{\henry}{H} +% \end{macrocode} +% \subsubsection{Lumen} +% \begin{macrocode} +\newunit{\lumen}{lm} +% \end{macrocode} +% \subsubsection{Illuminance} +% \begin{macrocode} +\newunit{\lux}{lx} +% \end{macrocode} +% \subsubsection{Radioactivity} +% \begin{macrocode} +\newunit{\becquerel}{Bq} + \newunit{\megabecquerel}{\mega\becquerel} +\newunit{\curie}{Cu} +% \end{macrocode} +% \subsubsection{Sievert} +% \begin{macrocode} +\newunit{\sievert}{Sv} + \newunit{\millisievert}{\milli\sievert} +% \end{macrocode} +% \subsection{Loading abbreviations}\label{sec:loading-abbr} +% Now the abbreviations are loaded if no option is specified to +% withhold some abbreviations. +% \begin{macrocode} +\ifunit@@useabbrv + \ifunit@@useampabbrv + \InputIfFileExists{ampabbrv.cfg}% + {\PackageInfo{unitsdef}{Abbreviations for units of amperage loaded.}}% + {\PackageWarning{unitsdef}{ampabbrv.cfg not found!}}% + \fi + \ifunit@@usefreqabbrv + \InputIfFileExists{freqabbr.cfg}% + {\PackageInfo{unitsdef}{Abbreviations for units of frequency loaded.}}% + {\PackageWarning{unitsdef}{freqabbr.cfg not found!}}% + \fi + \ifunit@@usemolabbrv + \InputIfFileExists{molabbrv.cfg}% + {\PackageInfo{unitsdef}{Abbreviations for units of amount of substances loaded.}}% + {\PackageWarning{unitsdef}{molabbrv.cfg not found!}}% + \fi + \ifunit@@usevoltabbrv + \InputIfFileExists{voltabbr.cfg}% + {\PackageInfo{unitsdef}{Abbreviations for units of voltage loaded.}}% + {\PackageWarning{unitsdef}{voltabbr.cfg not found!}}% + \fi + \ifunit@@usevolabbrv + \InputIfFileExists{volabbrv.cfg}% + {\PackageInfo{unitsdef}{Abbreviations for units of volume loaded.}}% + {\PackageWarning{unitsdef}{volabbrv.cfg not found!}}% + \fi + \ifunit@@useweightabbrv + \InputIfFileExists{weigabbr.cfg}% + {\PackageInfo{unitsdef}{Abbreviations for units of weight loaded.}}% + {\PackageWarning{unitsdef}{weigabbr.cfg not found!}}% + \fi + \ifunit@@useenergyabbrv + \InputIfFileExists{enerabbr.cfg}% + {\PackageInfo{unitsdef}{Abbreviations for units of energy loaded.}}% + {\PackageWarning{unitsdef}{enerabbr.cfg not found!}}% + \fi + \ifunit@@uselengthabbrv + \InputIfFileExists{lengabbr.cfg}% + {\PackageInfo{unitsdef}{Abbreviations for units of length loaded.}}% + {\PackageWarning{unitsdef}{lengabbr.cfg not found!}}% + \fi + \ifunit@@usetimeabbrv + \InputIfFileExists{timeabbr.cfg}% + {\PackageInfo{unitsdef}{Abbreviations for units of time loaded.}}% + {\PackageWarning{unitsdef}{timeabbr.cfg not found!}}% + \fi +\fi +\ifunit@@useconfigfile + \InputIfFileExists{unitsdef.cfg}% + {\PackageInfo{unitsdef}{Local config file loaded.}}% + {\PackageInfo{unitsdef}{No local config file found.}}% +\else + \PackageInfo{unitsdef}{Local config file not loaded.} +\fi +% +%</package> +% \end{macrocode} +% \PrintIndex +% \Finale +\endinput diff --git a/Master/texmf-dist/source/latex/unitsdef/unitsdef.ins b/Master/texmf-dist/source/latex/unitsdef/unitsdef.ins new file mode 100644 index 00000000000..3dd2ee9edca --- /dev/null +++ b/Master/texmf-dist/source/latex/unitsdef/unitsdef.ins @@ -0,0 +1,52 @@ +%% +%% Copyright (C) 2004 by Patrick Happel +%% +%% 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. +%% +\input docstrip.tex +\keepsilent +\usedir{tex/latex/unitsdef} +\preamble + +This is a generated file. + +Copyright (C) hyeari by hyour namei + +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 + +\generate{\file{unitsdef.sty}{\from{unitsdef.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{* unitsdef.sty *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* unitsdef.dtx through LaTeX. *} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{****************************************************} + +\endbatchfile |