diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/unitsdef |
Initial commit
Diffstat (limited to 'macros/latex/contrib/unitsdef')
-rw-r--r-- | macros/latex/contrib/unitsdef/README.1st | 99 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/config/ampabbrv.cfg | 9 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/config/enerabbr.cfg | 11 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/config/freqabbr.cfg | 7 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/config/lengabbr.cfg | 11 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/config/molabbrv.cfg | 9 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/config/timeabbr.cfg | 10 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/config/volabbrv.cfg | 11 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/config/voltabbr.cfg | 6 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/config/weigabbr.cfg | 10 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/defedpraef.tex | 23 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/defedunits.tex | 150 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/unitsdef.dtx | 1430 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/unitsdef.ins | 52 | ||||
-rw-r--r-- | macros/latex/contrib/unitsdef/unitsdef.pdf | bin | 0 -> 672652 bytes |
15 files changed, 1838 insertions, 0 deletions
diff --git a/macros/latex/contrib/unitsdef/README.1st b/macros/latex/contrib/unitsdef/README.1st new file mode 100644 index 0000000000..f72a0df0e6 --- /dev/null +++ b/macros/latex/contrib/unitsdef/README.1st @@ -0,0 +1,99 @@ + +unitsdef + +Patrick Happel (patrick.happel@rub.de) + +============================================================ + +1. Abstract +-------------------------- + +There are a lot of packages for typesetting units in LaTeX2e. +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. + 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. + + +2. Contents of the package +-------------------------- + + unitsdef.dtx + unitsdef.ins + README.1st (this file) + defedunits.tex + defedpraef.tex + unitsdef.pdf + ampabbrv.cfg + freqabbr.cfg + molabbrv.cfg + volabbrv.cfg + weigabbr.cfg + enerabbr.cfg + lengabbr.cfg + timeabbr.cfg + voltabbr.cfg + + + +3. Installation +-------------------------- + + - Run unitsdef.ins through latex to produce the packages style + file. + + - If you want to produce the documentation by yourself: + Run unitsdef.dtx through latex twice, run + + makeindex -s gglo.ist -o unitsdef.gls unitsdef.glo + + to produce the list of changes and + + makeindex -s gind.ist unitsdef + + and run unitsdef.dtx through latex again. + + + - If in your TDS already proper directories exist you should be able + to skip the next two steps + + - Move the resulting .sty file to where latex finds it. On a TDS + compliant system this should be (substitute $TEXMF with your + texmf directory): + + $TEXMF/tex/latex/unitsdef/ + + - Move all files from the config directory to a place where latex + finds them. + + $TEXMF/tex/latex/unitsdef/config/ + + - Move the documentation (unitsdef.pdf, if you haven't produced + your own copy in a different format) to a place where latex will + find it, usually, in a TDS compliant system: + + $TEXMF/doc/unitsdef + + - If you like to move the source files (.dtx, .ins and .tex) in a + source directory of your system. + + - Update your filename database. How to do this depends on your + distribution. + + +4. License +-------------------------- +This material is subject to the LaTeX Project Public License. See + + http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html + +for the details of that license. + + + +Enjoy unitsdef. + += ENDE = diff --git a/macros/latex/contrib/unitsdef/config/ampabbrv.cfg b/macros/latex/contrib/unitsdef/config/ampabbrv.cfg new file mode 100644 index 0000000000..9c0b9e0583 --- /dev/null +++ b/macros/latex/contrib/unitsdef/config/ampabbrv.cfg @@ -0,0 +1,9 @@ +\ProvidesFile{ampabbrv}[2004/12/09 v0.1 unitsdef configuration file] + +\newcommand\pA\picoampere +\newcommand\nA\nanoampere +\newcommand\micA\microampere +\newcommand\mA\milliampere +\newcommand\kA\kiloampere + +\endinput diff --git a/macros/latex/contrib/unitsdef/config/enerabbr.cfg b/macros/latex/contrib/unitsdef/config/enerabbr.cfg new file mode 100644 index 0000000000..de433b12db --- /dev/null +++ b/macros/latex/contrib/unitsdef/config/enerabbr.cfg @@ -0,0 +1,11 @@ +\ProvidesFile{enerabbr}[2004/12/09 v0.1 unitsdef configuration file] + +\newcommand\kJ\kilojoule +\newcommand\eV\electronvolt +\newcommand\meV\millielectronvolt +\newcommand\keV\kiloelectronvolt +\newcommand\MeV\megaelectronvolt +\newcommand\GeV\gigaelectronvolt +\newcommand\TeV\teraelectronvolt + +\endinput diff --git a/macros/latex/contrib/unitsdef/config/freqabbr.cfg b/macros/latex/contrib/unitsdef/config/freqabbr.cfg new file mode 100644 index 0000000000..c847cff9cb --- /dev/null +++ b/macros/latex/contrib/unitsdef/config/freqabbr.cfg @@ -0,0 +1,7 @@ +\ProvidesFile{freqabbr}[2004/12/09 v0.1 unitsdef configuration file] + +\newcommand\kHz\kilohertz +\newcommand\MHz\megahertz +\newcommand\GHz\gigahertz + +\endinput diff --git a/macros/latex/contrib/unitsdef/config/lengabbr.cfg b/macros/latex/contrib/unitsdef/config/lengabbr.cfg new file mode 100644 index 0000000000..5f3e1b9798 --- /dev/null +++ b/macros/latex/contrib/unitsdef/config/lengabbr.cfg @@ -0,0 +1,11 @@ +\ProvidesFile{lengabbr}[2004/12/09 v0.1 unitsdef configuration file] + +\newcommand\picom\picometer +\newcommand\nm\nanometer +\newcommand\micm\micrometer +\newcommand\mm\millimeter +\newcommand\cm\centimeter +\newcommand\dm\decimeter +\newcommand\km\kilometer + +\endinput diff --git a/macros/latex/contrib/unitsdef/config/molabbrv.cfg b/macros/latex/contrib/unitsdef/config/molabbrv.cfg new file mode 100644 index 0000000000..f4922cf785 --- /dev/null +++ b/macros/latex/contrib/unitsdef/config/molabbrv.cfg @@ -0,0 +1,9 @@ +\ProvidesFile{molabbrv}[2004/12/09 v0.1 unitsdef configuration file] + +\newcommand\fmol\femtomole +\newcommand\pmol\picomole +\newcommand\nmol\nanomole +\newcommand\micmol\micromole +\newcommand\mmol\millimole + +\endinput diff --git a/macros/latex/contrib/unitsdef/config/timeabbr.cfg b/macros/latex/contrib/unitsdef/config/timeabbr.cfg new file mode 100644 index 0000000000..cfc5613404 --- /dev/null +++ b/macros/latex/contrib/unitsdef/config/timeabbr.cfg @@ -0,0 +1,10 @@ +\ProvidesFile{timeabbr}[2004/12/09 v0.1 unitsdef configuration file] + +\newcommand\sek\second +\newcommand\fs\femtosecond +\newcommand\ps\picosecond +\newcommand\ns\nanosecond +\newcommand\mics\microsecond +\newcommand\ms\millisecond + +\endinput diff --git a/macros/latex/contrib/unitsdef/config/volabbrv.cfg b/macros/latex/contrib/unitsdef/config/volabbrv.cfg new file mode 100644 index 0000000000..1bd400ecb8 --- /dev/null +++ b/macros/latex/contrib/unitsdef/config/volabbrv.cfg @@ -0,0 +1,11 @@ +\ProvidesFile{volabbrv}[2004/12/09 v0.1 unitsdef configuration file] + +\newcommand\fl\femtoliter +\newcommand\pl\picoliter +\newcommand\nl\nanoliter +\newcommand\micl\microliter +\newcommand\ml\milliliter +\newcommand\cl\centiliter +\newcommand\dl\deciliter + +\endinput diff --git a/macros/latex/contrib/unitsdef/config/voltabbr.cfg b/macros/latex/contrib/unitsdef/config/voltabbr.cfg new file mode 100644 index 0000000000..73a68455da --- /dev/null +++ b/macros/latex/contrib/unitsdef/config/voltabbr.cfg @@ -0,0 +1,6 @@ +\ProvidesFile{voltabbr}[2004/12/09 v0.1 unitsdef configuration file] + +\newcommand\kv\kilovolt +\newcommand\mv\millivolt + +\endinput diff --git a/macros/latex/contrib/unitsdef/config/weigabbr.cfg b/macros/latex/contrib/unitsdef/config/weigabbr.cfg new file mode 100644 index 0000000000..039220f2c4 --- /dev/null +++ b/macros/latex/contrib/unitsdef/config/weigabbr.cfg @@ -0,0 +1,10 @@ +\ProvidesFile{weigabbr}[2004/12/09 v0.1 unitsdef configuration file] + +\newcommand\kg\kilogram +\newcommand\fg\femtogram +\newcommand\pg\picogram +\newcommand\nanog\nanogram +\newcommand\micg\microgram +\newcommand\mg\milligram + +\endinput diff --git a/macros/latex/contrib/unitsdef/defedpraef.tex b/macros/latex/contrib/unitsdef/defedpraef.tex new file mode 100644 index 0000000000..f148c79f55 --- /dev/null +++ b/macros/latex/contrib/unitsdef/defedpraef.tex @@ -0,0 +1,23 @@ + \begin{longtable}{XX>{\ttfamily\textbackslash}XXXX>{\ttfamily\textbackslash}XX} + \caption{predefined preficies}\\ + \toprule + \emph{name}&\emph{prefix}&\multicolumn{1}{X}{\emph{macro}}&\emph{value}& + \emph{name}&\emph{prefix}&\multicolumn{1}{X}{\emph{macro}}&\emph{value}\\ + \midrule\endfirsthead + \caption{predefined preficies}\\ + \toprule + \emph{name}&\emph{prefix}&\multicolumn{1}{X}{\emph{macro}}&\emph{value}& + \emph{name}&\emph{prefix}&\multicolumn{1}{X}{\emph{macro}}&\emph{value}\\ + \midrule\endhead + yocto & \yocto &yocto & $10^{-24}$& zepto & \zepto &zepto & $10^{-21}$\\ + atto & \atto &atto & $10^{-18}$& femto & \femto &femto & $10^{-15}$\\ + pico & \pico &pico & $10^{-12}$& nano & \nano &nano & $10^{-9}$\\ + micro & \micro µ & $10^{-6} $& milli & \milli &milli & $10^{-3}$\\[1ex] + centi & \centi ¢i & $10^{-2} $& deci & \deci &deci & $10^{-1}$\\[1ex] + deca & \deca &deca & $10^{+1} $& hecto & \hecto &hecto & $10^{+2}$\\[1ex] + kilo & \kilo &kilo & $10^{+3} $& mega & \mega &mega & $10^{+6} $\\ + giga & \giga &giga & $10^{+9} $& tera & \tera &tera & $10^{+12}$\\ + peta & \peta &peta & $10^{+15}$& exa & \exa &exa & $10^{+18}$\\ + zetta & \zetta &zetta & $10^{+21}$& yotta & \yotta &yotta & $10^{+24}$\\ + \bottomrule + \end{longtable} diff --git a/macros/latex/contrib/unitsdef/defedunits.tex b/macros/latex/contrib/unitsdef/defedunits.tex new file mode 100644 index 0000000000..7ad50d06b2 --- /dev/null +++ b/macros/latex/contrib/unitsdef/defedunits.tex @@ -0,0 +1,150 @@ + \begin{longtable}{Xl>{\ttfamily\textbackslash}Xl} + \caption{predefined units}\\ + \toprule + \emph{name} &\emph{sign} &\multicolumn{1}{X}{\emph{macro}}&\emph{alias}\\ + \midrule \endfirsthead + \caption{predefined units}\\ + \toprule + \emph{name} &\emph{sign} &\multicolumn{1}{X}{\emph{macro}}&\emph{alias}\\ + \midrule \endhead \bottomrule \endfoot + \multicolumn{4}{l}{\emph{base units}}\\[.5ex] + meter &\unitsignonly{\meter} &meter & \\ + kilogram &\unitsignonly{\kilogram} &kilogram &\cmd{\kg} \\ + mole &\unitsignonly{\mole} &mole & \\ + second &\unitsignonly{\second} &second&\cmd{\sek}\\ + ampere &\unitsignonly{\ampere} &ere&\\ + kelvin &\unitsignonly{\kelvin} &kelvin&\\ + candela &\unitsignonly{\candela} &candela&\\[1ex] + \multicolumn{4}{l}{\emph{units of length}}\\[.5ex] + picometer &\unitsignonly{\picometer} &picometer&\cmd{\picom}\\ + nanometer &\unitsignonly{\nanometer} &nanometer&\cmd{\nm}\\ + micrometer &\unitsignonly{\micrometer} µmeter&\cmd{\micm}\\ + millimeter &\unitsignonly{\millimeter} &millimeter&\cmd{\mm}\\ + centimeter &\unitsignonly{\centimeter} ¢imeter&\cmd{\cm}\\ + decimeter &\unitsignonly{\decimeter} &decimeter&\cmd{\dm}\\ + kilometer &\unitsignonly{\kilometer} &kilometer&\cmd{\km}\\[1ex] + \multicolumn{4}{l}{\emph{units of weight}}\\[.5ex] + gram &\unitsignonly{\gram} &gram & \\ + femtogram &\unitsignonly{\femtogram} &femtogram&\cmd{\fg}\\ + picogram &\unitsignonly{\picogram} &picoram&\cmd{\pg}\\ + nanogram &\unitsignonly{\nanogram} &nanogram&\cmd{\nanog}\\ + microgram &\unitsignonly{\microgram} µgram&\cmd{\micg}\\ + milligram &\unitsignonly{\milligram} &milligram&\cmd{\mg}\\[1ex] + \multicolumn{4}{l}{\emph{units of amount of substance}}\\[.5ex] + femtomole &\unitsignonly{\femtomole} &femtomole&\cmd{\fmol}\\ + picomole &\unitsignonly{\picomole} &picomole&\cmd{\pmol}\\ + nanomole &\unitsignonly{\nanomole} &nanomole&\cmd{\nmol}\\ + micromole &\unitsignonly{\micromole} µmole&\cmd{\micmol}\\ + millimole &\unitsignonly{\millimole} &millimole&\cmd{\mmol}\\[1ex] + \multicolumn{4}{l}{\emph{units of time}}\\[.5ex] + attosecond &\unitsignonly{\attosecond} &attosecond&\\ + femtosecond &\unitsignonly{\femtosecond} &femtosecond&\cmd{\fs}\\ + pikosecond &\unitsignonly{\picosecond} &picosecond&\cmd{\ps}\\ + nanosecond &\unitsignonly{\nanosecond} &nanosecond&\cmd{\ns}\\ + microsecond &\unitsignonly{\microsecond} µsecond&\cmd{\mics}\\ + millisecond &\unitsignonly{\millisecond} &millisecond&\cmd{\ms}\\[1ex] + \multicolumn{4}{l}{\emph{units of amperage}}\\[.5ex] + picoampere &\unitsignonly{\picoampere} &picoampere&\cmd{\pA}\\ + nanoampere &\unitsignonly{\nanoampere} &nanoampere&\cmd{\nA}\\ + microampere &\unitsignonly{\microampere} µampere&\cmd{\micA}\\ + milliampere &\unitsignonly{\milliampere} &milliampere&\cmd{\mA}\\ + kiloampere &\unitsignonly{\kiloampere} &kiloampere&\cmd{\kA}\\[1ex] + \multicolumn{4}{l}{\emph{units of volume}}\\[.5ex] + liter &\unitsignonly{\liter} &liter&\\ + femtoliter &\unitsignonly{\femtoliter} &femtoliter&\cmd{\fl}\\ + picoliter &\unitsignonly{\picoliter} &picoliter&\cmd{\pl}\\ + nanoliter &\unitsignonly{\nanoliter} &nanoliter&\cmd{\nl}\\ + microliter &\unitsignonly{\microliter} µliter&\cmd{\micl}\\ + milliliter &\unitsignonly{\milliliter} &milliliter&\cmd{\ml}\\ + centiliter &\unitsignonly{\centiliter} ¢iliter&\cmd{\cl}\\ + deciliter &\unitsignonly{\deciliter} &deciliter&\cmd{\dl}\\ + hectoliter &\unitsignonly{\hectoliter} &hectoliter&\cmd{\hl}\\ + cubicmeter &\unitsignonly{\cubicmeter} &cubicmeter&\\ + cubicmicrometer &\unitsignonly{\cubicmicrometer} &cubicmicrometer&\\ + cubicmillimeter &\unitsignonly{\cubicmillimeter} &cubicmillimeter&\\[1ex] + \multicolumn{4}{l}{\emph{units of area}}\\[.5ex] + squaremeter &\unitsignonly{\squaremeter} &squaremeter&\\ + ar &\unitsignonly{\ar} &ar&\\ + Hektar &\unitsignonly{\hektar} &hektar&\\ + squarecentimeter &\unitsignonly{\squarecentimeter} &squarecentimeter&\\ + squaremillimeter &\unitsignonly{\squaremillimeter} &squaremillimeter&\\ + squarekilometer &\unitsignonly{\squarekilometer} &squarekilometer&\\[1ex] + \multicolumn{4}{l}{\emph{more units of weight}}\\[.5ex] + ton &\unitsignonly{\ton} &ton&\\[1ex] + \multicolumn{4}{l}{\emph{derived units of electricity}}\\[.5ex] + volt &\unitsignonly{\volt} &volt&\\ + millivolt &\unitsignonly{\millivolt} &millivolt&\cmd{\mV}\\ + kilovolt &\unitsignonly{\kilovolt} &kilovolt&\cmd{\kv}\\ + Watt &\unitsignonly{\watt} &watt&\\ + milliwatt &\unitsignonly{\milliwatt} &milliwatt&\\ + kilowatt &\unitsignonly{\kilowatt} &kilowatt&\\ + megawatt &\unitsignonly{\megawatt} &megawatt&\\ + coulomb &\unitsignonly{\coulomb} &coulomb&\\ + ohm &\unitsignonly{\ohm}&ohm \textrm{or} \cmd{\Ohm}&\\ + kiloohm &\unitsignonly{\kiloohm} &kiloohm&\\ + megaohm &\unitsignonly{\megaohm} &megaohm&\\ + gigaohm &\unitsignonly{\gigaohm} &gigaohm&\\ + siemens &\unitsignonly{\siemens} &siemens&\\ + millisiemens &\unitsignonly{\millisiemens} &millisiemens&\\ + farad &\unitsignonly{\farad} &farad&\\ + femtofarad &\unitsignonly{\femtofarad} &femtofarad&\\ + picofarad &\unitsignonly{\picofarad} &picofarad&\\ + nanofarad &\unitsignonly{\nanofarad} &nanofarad&\\ + microfarad &\unitsignonly{\microfarad} µfarad&\\ + millifarad &\unitsignonly{\millifarad} &millifarad&\\[1ex] + \multicolumn{4}{l}{\emph{units of energy}}\\[.5ex] + joule &\unitsignonly{\joule} &joule&\\ + millijoule &\unitsignonly{\millijoule} &millijoule&\\ + kilojoule &\unitsignonly{\kilojoule} &kilojoule&\cmd{\kJ}\\ + megajoule &\unitsignonly{\megajoule} &megajoule&\\ + calorie &\unitsignonly{\calory} &calory&\\ + kilocalorie &\unitsignonly{\kilocalory} &kilocalory&\\ + electronvolt &\unitsignonly{\electronvolt} &electronvolt&\cmd{\eV}\\ + millielectronvolt&\unitsignonly{\millielectronvolt}&millielectronvolt&\cmd{\meV}\\ + kiloelectronvolt &\unitsignonly{\kiloelectronvolt} &kiloelectronvolt&\cmd{\keV}\\ + megaelectronvolt &\unitsignonly{\megaelectronvolt} &megaelectronvolt&\cmd{\MeV}\\ + gigaelectronvolt &\unitsignonly{\gigaelectronvolt} &gigaelectronvolt&\cmd{\GeV}\\ + teraelectronvolt &\unitsignonly{\teraelectronvolt} &teraelectronvolt&\cmd{\TeV}\\ + \multicolumn{4}{l}{\emph{more units of time}}\\[.5ex] + minute &\unitsignonly{\minute} &minute&\\ + hour &\unitsignonly{\hour} &hour&\\ + days &\unitsignonly{\days} &days&\\[1ex] + \multicolumn{4}{l}{\emph{units of temperature}}\\[.5ex] + degree Celsius &\unitsignonly{\celsius} &celsius \textrm{or} \cmd{\Celsius}&\\[1ex] + \multicolumn{4}{l}{\emph{units of angle}}\\[.5ex] + radian &\unitsignonly{\radian} &radian&\\ + steradian &\unitsignonly{\steradian} &steradian&\\ + degree &\unitsignonly{\degree} °ree \textrm{or} \cmd{\Degree}&\\ + arc minute &\unitsignonly{\arcmin} &arcmin&\\ + arc second &\unitsignonly{\arcsec} &arcsec&\\[1ex] + \multicolumn{4}{l}{\emph{units of frequencies}}\\[.5ex] + hertz &\unitsignonly{\hertz} &hertz&\\ + kilohertz &\unitsignonly{\kilohertz} &kilohertz&\cmd{\kHz}\\ + megahertz &\unitsignonly{\megahertz} &megahertz&\cmd{\MHz}\\ + gigahertz &\unitsignonly{\gigahertz} &gigahertz&\cmd{\GHz}\\[1ex] + \multicolumn{4}{l}{\emph{units of force}}\\[.5ex] + newton &\unitsignonly{\newton} &newton&\\ + millinewton &\unitsignonly{\millinewton} &millinewton&\\ + kilonewton &\unitsignonly{\kilonewton} &kilonewton&\\[1ex] + \multicolumn{4}{l}{\emph{units of pressure}}\\[.5ex] + pascal &\unitsignonly{\pascal} &pascal&\\ + hectopascal &\unitsignonly{\hectopascal} &hectopascal&\\ + bar &\unitsignonly{\uBar} &uBar&\\ + millibar &\unitsignonly{\millibar} &millibar&\\[1ex] + \multicolumn{4}{l}{\emph{units of magnetism}}\\[.5ex] + weber &\unitsignonly{\weber} &weber&\\ + tesla &\unitsignonly{\tesla} &tesla&\\ + henry &\unitsignonly{\henry} &henry&\\[1ex] + \multicolumn{4}{l}{\emph{units of light}}\\[.5ex] + lumen &\unitsignonly{\lumen} &lumen&\\ + lux &\unitsignonly{\lux} &lux&\\[1ex] + \multicolumn{4}{l}{\emph{units of radioactivity}}\\[.5ex] + becquerel &\unitsignonly{\becquerel} &becquerel&\\ + megabecquerel &\unitsignonly{\megabecquerel} &megabecquerel&\\ + curie &\unitsignonly{\curie} &curie&\\ + sievert &\unitsignonly{\sievert} &sievert&\\ + millisievert &\unitsignonly{\millisievert} &millisievert&\\ + \multicolumn{4}{l}{\emph{percent}}\\[.5ex] + percent &\unitsignonly{\percent} &percent& + \end{longtable} + diff --git a/macros/latex/contrib/unitsdef/unitsdef.dtx b/macros/latex/contrib/unitsdef/unitsdef.dtx new file mode 100644 index 0000000000..208134835f --- /dev/null +++ b/macros/latex/contrib/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/macros/latex/contrib/unitsdef/unitsdef.ins b/macros/latex/contrib/unitsdef/unitsdef.ins new file mode 100644 index 0000000000..3dd2ee9edc --- /dev/null +++ b/macros/latex/contrib/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 diff --git a/macros/latex/contrib/unitsdef/unitsdef.pdf b/macros/latex/contrib/unitsdef/unitsdef.pdf Binary files differnew file mode 100644 index 0000000000..e6ae7fa169 --- /dev/null +++ b/macros/latex/contrib/unitsdef/unitsdef.pdf |