From 39a1e82993af86b8eba5877884dcde5334e51d10 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 13 Jan 2006 00:10:41 +0000 Subject: unitsdef git-svn-id: svn://tug.org/texlive/trunk@1430 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/unitsdef/unitsdef.sty | 595 ++++++++++++++++++++++ 1 file changed, 595 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/unitsdef/unitsdef.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/unitsdef/unitsdef.sty b/Master/texmf-dist/tex/latex/unitsdef/unitsdef.sty new file mode 100644 index 00000000000..f7c1a78bf2d --- /dev/null +++ b/Master/texmf-dist/tex/latex/unitsdef/unitsdef.sty @@ -0,0 +1,595 @@ +%% +%% This is file `unitsdef.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% unitsdef.dtx (with options: `package') +%% +%% 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. +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{unitsdef}[2005/01/04 v0.2 Typesetting units] + \ProvidesFile{unitsdef.dtx} + [2004/01/05 Typesetting units a proper way] +%% \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 \~} +%% +\newif\if@@setunitsep +\@@setunitseptrue +\newif\ifunit@@Ohm% +\unit@@Ohmfalse +\newif\ifunit@@redefgensymb +\unit@@redefgensymbfalse +\newif\ifunit@@liter +\unit@@literfalse +\newif\ifunit@@xspace +\unit@@xspacetrue +\newif\ifunit@@useabbrv +\unit@@useabbrvtrue +\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 +\newif\ifunit@@useconfigfile +\unit@@useconfigfiletrue +\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 +\RequirePackage[T1]{fontenc} +\RequirePackage{amsmath} +\RequirePackage{textcomp} +\RequirePackage{units} +\ifunit@@xspace + \RequirePackage{xspace}% + \let\unit@@xspace\xspace% +\else + \let\unit@@xspace\relax +\fi +\DeclareRobustCommand{\unitsignonly}[1]{% + \@@setunitsepfalse% + \begingroup% + \let\unit@@xspace\relax% + #1% + \endgroup} +\newcommand{\unitvaluesep}{} +\let\unitvaluesep\,% +\newcommand{\newunit}[2]{% + \newcommand{#1}{}% + \DeclareRobustCommand{#1}[1][]{##1% + \begingroup% + \let\unit@@xspace\relax% + \if@@setunitsep% + \unitvaluesep% + \let\unitvaluesep\relax% + \fi% + \unit{#2}\global\@@setunitseptrue% + \endgroup% + \unit@@xspace% + }% +} +\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% + }% +} + +\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% + }% +} +\newcommand\per[2]{% + \@@setunitsepfalse% + \unitfrac{#1}{#2}% +} +\newcommand{\ilu}[2][]{% + \begingroup% + \@@setunitsepfalse% + \let\unit@@xspace\relax% + #1\,\unit{#2}% + \endgroup% +} +\newcommand{\unittimes}{\@@setunitsepfalse\ensuremath{\cdot}} +\let\unitsep\, +\newcommand{\unitsuperscript}[1]{% + \ifmmode^{#1}\else\textsuperscript{#1}\fi% +} +\newcommand{\unitMathOmega}{} +\newcommand{\unitTextOmega}{} +\newcommand{\unitTextmu}{} +\newcommand{\unitMathmu}{} +\newcommand{\unitMathCelsius}{} +\newcommand{\unitTextCelsius}{} +\newcommand{\unitTextDegree}{} +\newcommand{\unitMathDegree}{} +\newcommand{\unitCelsius}{% + \ifmmode\unitMathCelsius\else\unitTextCelsius\fi% +} +\newcommand{\unitmu}{% + \ifmmode\unitMathmu\else\unitTextmu\fi% +} +\newcommand{\unitOmega}{% + \ifmmode\unitMathOmega\else\unitTextOmega\fi% +} +\newcommand{\unitDegree}{% + \ifmmode\unitMathDegree\else\unitTextDegree\fi% +} +\newcommand{\setMathOmega}[1]{% + \renewcommand{\unitMathOmega}{\text{#1}}% +} +\setMathOmega{$\mathrm{\Omega}$} +\newcommand{\setMathmu}[1]{% + \renewcommand{\unitMathmu}{\text{#1}}% +} +\setMathmu{\textmu} +\newcommand{\setMathCelsius}[1]{% + \renewcommand{\unitMathCelsius}{\text{#1}}% +} +\setMathCelsius{\textcelsius} +\newcommand{\setMathDegree}[1]{% + \renewcommand{\unitMathDegree}{\text{#1}}% +} +\setMathDegree{\textdegree} +\newcommand{\setTextOmega}[2]{% + \renewcommand{\unitTextOmega}{% + \begingroup% + \edef\@tempa{\sfdefault}% + \ifx\f@family\@tempa% + #2% + \else% + #1% + \fi% + \endgroup% + }% +} +\setTextOmega{\textohm}{\textohm} +\newcommand{\setTextmu}[2]{% + \renewcommand{\unitTextmu}{% + \begingroup% + \edef\@tempa{\sfdefault}% + \ifx\f@family\@tempa% + #2% + \else% + #1% + \fi% + \endgroup% + }% +} +\setTextmu{\textmu}{\textmu} +\newcommand{\setTextCelsius}[2]{% + \renewcommand{\unitTextCelsius}{% + \begingroup% + \edef\@tempa{\sfdefault}% + \ifx\f@family\@tempa% + #2% + \else% + #1% + \fi% + \endgroup% + }% +} +\setTextCelsius{\textcelsius}{\textcelsius} +\newcommand{\setTextDegree}[2]{% + \renewcommand{\unitTextDegree}{% + \begingroup% + \edef\@tempa{\sfdefault}% + \ifx\f@family\@tempa% + #2% + \else% + #1% + \fi% + \endgroup% + }% +} +\setTextDegree{\textdegree}{\textdegree} +\newcommand\unitSIdef{\upshape} +\newcommand{\SI}{} +\DeclareRobustCommand{\SI}[2]{% + \begingroup% + \let\unit@@xspace\relax% + \unitSIdef\selectfont% + #1#2% + \endgroup% +} +\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 + +\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} + + +\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} + + +\newunit{\femtogram}{\femto\gram} +\newunit{\picogram}{\pico\gram} +\newunit{\nanogram}{\nano\gram} +\newunit{\microgram}{\@unit@micro\gram} +\newunit{\milligram}{\milli\gram} + + +\newunit{\femtomole}{\femto\mole} +\newunit{\picomole}{\pico\mole} +\newunit{\nanomole}{\nano\mole} +\newunit{\micromole}{\@unit@micro\mole} +\newunit{\millimole}{\milli\mole} + + +\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} + + +\newunit{\picoampere}{\pico\ampere} +\newunit{\nanoampere}{\nano\ampere} +\newunit{\microampere}{\@unit@micro\ampere} +\newunit{\milliampere}{\milli\ampere} +\newunit{\kiloampere}{\kilo\ampere} + + +\newunit{\percent}{\%} + + +\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}} + + +\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}} + +\newunit{\ton}{t} + + +\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} +\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} +\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} + +\newunit{\minute}{min} +\newunit{\hour}{h} +\newunit{\days}{d} +\ifunit@@Ohm + \newunit{\Celsius}{\unitCelsius} +\else + \ifunit@@redefgensymb\else + \newunit{\celsius}{\unitCelsius} + \fi +\fi +\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}}} +\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% +} + +\newunit{\hertz}{Hz} + \newunit{\kilohertz}{\kilo\hertz} + \newunit{\megahertz}{\mega\hertz} + \newunit{\gigahertz}{\giga\hertz} + +\newunit{\newton}{N} + \newunit{\millinewton}{\milli\newton} + \newunit{\kilonewton}{\kilo\newton} +\newunit{\pascal}{Pa} + \newunit{\hectopascal}{\hecto\pascal} +\newunit{\uBar}{bar} + \newunit{\millibar}{\milli\uBar} +\newunit{\weber}{Wb} +\newunit{\tesla}{T} +\newunit{\henry}{H} +\newunit{\lumen}{lm} +\newunit{\lux}{lx} +\newunit{\becquerel}{Bq} + \newunit{\megabecquerel}{\mega\becquerel} +\newunit{\curie}{Cu} +\newunit{\sievert}{Sv} + \newunit{\millisievert}{\milli\sievert} +\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 +\endinput +%% +%% End of file `unitsdef.sty'. -- cgit v1.2.3