From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/units/COPYING | 339 ++++++++++++++++++++ macros/latex/contrib/units/README | 29 ++ macros/latex/contrib/units/units.dtx | 605 +++++++++++++++++++++++++++++++++++ macros/latex/contrib/units/units.ins | 46 +++ macros/latex/contrib/units/units.pdf | Bin 0 -> 220961 bytes 5 files changed, 1019 insertions(+) create mode 100644 macros/latex/contrib/units/COPYING create mode 100644 macros/latex/contrib/units/README create mode 100644 macros/latex/contrib/units/units.dtx create mode 100644 macros/latex/contrib/units/units.ins create mode 100644 macros/latex/contrib/units/units.pdf (limited to 'macros/latex/contrib/units') diff --git a/macros/latex/contrib/units/COPYING b/macros/latex/contrib/units/COPYING new file mode 100644 index 0000000000..e77696ae8d --- /dev/null +++ b/macros/latex/contrib/units/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/macros/latex/contrib/units/README b/macros/latex/contrib/units/README new file mode 100644 index 0000000000..1d67555520 --- /dev/null +++ b/macros/latex/contrib/units/README @@ -0,0 +1,29 @@ + units, a LaTeX bundle for typesetting units and nice fractions. + Copyright (C) 1998 Axel Reichert + + Files: + units.ins Batch file, run through LaTeX + units.dtx Docstrip archive, run through LaTeX + units.sty LaTeX package, will be generated from units.ins + nicefrac.sty LaTeX package, will be generated from units.ins + units.dvi Package documentation, will be generated from units.dtx + README This file + COPYING The GNU General Public License + + E-Mail: reich@mpie-duesseldorf.mpg.de + Address: Axel Reichert, Beethovenstrasse 25, D-40233 Duesseldorf + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. diff --git a/macros/latex/contrib/units/units.dtx b/macros/latex/contrib/units/units.dtx new file mode 100644 index 0000000000..e63a755427 --- /dev/null +++ b/macros/latex/contrib/units/units.dtx @@ -0,0 +1,605 @@ +% \iffalse +% +% units.dtx +% Docstrip archive, run through LaTeX. +% +% Copyright (C) 1998 Axel Reichert +% See the files README and COPYING. +% +% \fi +% +% \CheckSum{174} +% +% \changes{v0.9a}{1998-06-25}{First release} +% \changes{v0.9b}{1998-08-04}{Documentation update} +% +%% \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 \~} +% +% \newcommand{\file}[1]{\texttt{#1}} +% \newcommand{\option}[1]{\texttt{#1}} +% \newcommand{\package}[1]{\texttt{#1}} +% \newcommand{\person}[1]{\textsc{#1}} +% \newcommand{\winkey}{\texttt{(-;}} +% +% \title{\file{units.sty} -- \file{nicefrac.sty}} +% \author{Axel Reichert} +% \date{1998-08-04} +% \maketitle +% \begin{abstract} +% \file{units.sty} is a package for setting units in a +% typographically correct way. It is based upon +% \file{nicefrac.sty}, a package for nice fractions. See the +% files \file{README} and \file{COPYING} for additional +% information. +% \end{abstract} +% \section{Loading} +% \begin{tabbing} +% Only nice fractions: \= |\usepackage{nicefrac}| \\ +% Only units or both: \> |\usepackage{units}| +% \end{tabbing} +% \section{Options} +% \begin{tabbing} +% Tight spacing for units (default): \= +% |\usepackage[tight]{units}| \\ +% Loose spacing for units: \> +% |\usepackage[loose]{units}| \\ +% ``Nice'' fractions (default): \> +% |\usepackage[nice]{nicefrac}| \\ +% ``Ugly'' fractions: \> +% |\usepackage[ugly]{nicefrac}| +% \end{tabbing} +% +% The options \option{nice} and \option{ugly} can also be used for +% the \package{units} package, they will simply be passed to the +% \package{nicefrac} package, so you can combine the options, +% e.\,g.: |\usepackage[loose,ugly]{units}| +% +% Tight spacing means \cmd{\,} for the space between the value and the +% dimension, loose spacing uses |~|, like \unit[1]{m} and 1~m. Nice +% fractions look like \nicefrac{m}{s}, ugly fractions look like m/s +% in text mode and $\frac{\mathrm{m}}{\mathrm{s}}$ in math mode. +% \section{Commands} +% \begin{tabbing} +% Fractions of units: \= +% |\unitfrac[|\meta{val}|]{|\meta{num}|}{|\meta{denom}|}| \kill +% Units: \> |\unit[|\meta{val}|]{|\meta{dim}|}| \\ +% Fractions of units: \> +% |\unitfrac[|\meta{val}|]{|\meta{num}|}{|\meta{denom}|}| \\ +% Nice fractions: \> +% |\nicefrac[|\meta{fontcmd}|]{|\meta{num}|}{|\meta{denom}|}| +% \end{tabbing} +% In these list, \meta{val} and \meta{dim} denote the value and the +% dimension of the unit, respectively. \meta{num} and \meta{denom} +% are the numerator and denominator of the fraction, and +% \meta{fontcmd} can be an author command for fonts or a math +% alphabet, see \file{fntguide.dvi}. +% +% Typically, \meta{val} is only a number and \meta{num} and +% \meta{denom} are relatively simple \LaTeX{} expressions. If you +% really feel the need for putting whole paragraphs or complex +% formula into such a fraction, you have misunderstood the purpose +% of this package. \winkey +% +% A common mistake is to forget the enclosing braces when using the +% optional argument of the commands inside another optional +% argument. This is no package bug, but a \LaTeX{} feature. Correct +% example: |\section[{\unit[1]{m}}]{...}|.\footnote{Credits go to +% \person{Frank Knappe} for suggesting this documentation update.} +% +% It is very important to be aware of the fact that all these +% commands distinguish between text mode and math mode. Within text +% mode, the font of the surrounding text will be used by default, +% for math mode \cmd{\mathrm} is the default. +% +% This is quite sensible, because you would not want your +% collection of delicious recipes (typeset in a mega-cool ultra +% condensed bold italic calligraphical font) contain those spindle +% Computer Modern Roman just for half a litre of milk. \winkey +% +% Otherwise, when working on scientific papers, strict and +% consistent notation is really a virtue, and, like it or not, +% units are typeset with upright fonts. So take great care when +% deciding about math mode or not. +% \section{Examples} +% \begin{tabbing} +% |\sffamily\itshape$\unitfrac[1]{m}{s}$| \quad \= +% \sffamily\itshape$\unitfrac[1]{m}{s}$ \kill +% |\sffamily\bfseries\unit{m}| \> \sffamily\bfseries\unit{m} \\ +% |\sffamily\bfseries$\unit{m}$| \> \sffamily\bfseries$\unit{m}$ \\ +% |\sffamily\itshape\unit[1]{m}| \> \sffamily\itshape\unit[1]{m} \\ +% |\sffamily\itshape$\unit[1]{m}$| \> \sffamily\itshape$\unit[1]{m}$ \\ +% |\sffamily\bfseries\unitfrac{m}{s}| \> +% \sffamily\bfseries\unitfrac{m}{s} \\ +% |\sffamily\bfseries$\unitfrac{m}{s}$| \> +% \sffamily\bfseries$\unitfrac{m}{s}$ \\ +% |\sffamily\itshape\unitfrac[1]{m}{s}| \> +% \sffamily\itshape\unitfrac[1]{m}{s} \\ +% |\sffamily\itshape$\unitfrac[1]{m}{s}$| \> +% \sffamily\itshape$\unitfrac[1]{m}{s}$ +% \end{tabbing} +% As you can see, font changes are ignored in math mode~\ldots +% \begin{tabbing} +% |\scriptsize\sffamily\itshape$\unitfrac[1]{m}{s}$| \quad \= +% \scriptsize\sffamily\itshape$\unitfrac[1]{m}{s}$ \kill +% |\scriptsize\sffamily\itshape\unitfrac[1]{m}{s}| \> +% \scriptsize\sffamily\itshape\unitfrac[1]{m}{s} \\ +% |\scriptsize\sffamily\itshape$\unitfrac[1]{m}{s}$| \> +% \scriptsize\sffamily\itshape$\unitfrac[1]{m}{s}$ +% \end{tabbing} +% \ldots~except for the fontsize. +% \begin{tabbing} +% |\bfseries\itshape$\nicefrac{1}{2}$| \quad \= +% \bfseries\itshape$\nicefrac{1}{2}$ \kill +% |\bfseries\itshape\nicefrac{1}{2}| \> +% \bfseries\itshape\nicefrac{1}{2} \\ +% |\bfseries\itshape$\nicefrac{1}{2}$| \> +% \bfseries\itshape$\nicefrac{1}{2}$ \\ +% |\nicefrac[\texttt]{1}{2}| \> \nicefrac[\texttt]{1}{2} \\ +% |\nicefrac[\texttt]{\textit{1}}{2}| \> +% \nicefrac[\texttt]{\textit{1}}{2} \\ +% |$\nicefrac[\mathcal]{A}{B}$| \> $\nicefrac[\mathcal]{A}{B}$ +% \end{tabbing} +% The \cmd{\nicefrac} command can deal even with quite strange font +% changing commands. +% \section{Typography} +% Why should units be typeset in upright fonts, not in italics? +% Because they have to be distinguished from normal variables: +% ``\unit{m}'' is meter, ``$m$'' is a variable, for example a mass. +% +% Why should the space between the value and the dimension be +% non-breakable? Because the reader is disturbed by linebreaks like +% 1 $\mathrm{m}$. +% +% Why should the space between the value and the dimension be a +% half word space only? Because things belonging together are +% typeset tighter. Compare \unit[1]{m} with 1~m and the normal word +% spacing, which can vary from line to line. +% +% Why should nice fractions be typeset so that the numerator does +% not extend above the height of the letter ``M'' and the +% denominator does not extend below the baseline? Because otherwise +% a stretching of the baselineskip could be necessary due to +% descenders. +% +% By the way, a very common mistake is to place units into +% brackets, like [\unit{N}]. The correct notation is $[F] = +% \unit{N}$. The brackets indeed are a function with a variable as +% an argument. The value returned is the unit. If you need to +% specify units in table headings, then use a single row for the +% units, where you put them into \emph{parentheses} instead. +% \section{Bugs} +% None, are you kidding? +% \section{Features} +% \begin{itemize} +% \item Consistent and logical markup of units is enhanced instead +% of fiddling around with spacing and fonts. +% \item The same command works in text mode \emph{and} math mode, +% font and size are adjusted automatically for nice integration +% within text mode while forcing strict notation in math mode. +% \item Basic requirements of typography are fulfilled: Forbidden +% linebreaks, correct spacing and the numerator automatically +% aligning with the height of an ``M''. +% \item Easy configuration by use of package options. +% \end{itemize} +% \section{Bugs again \winkey} +% Ok, ok, you got me. +% \begin{itemize} +% \item Fonts without ``M'' do not work correctly. Do you know one? +% \item Fractions in \cmd{\scriptscriptstyle} look ugly because they +% exceed the height of an ``M''. As far as I know this is a +% \LaTeX{} problem, because there are no smaller math fonts +% available. +% \item The kerning between numerator and slash or denominator and +% slash is bad. In fact, there is none. +% \item The combination of the \option{ugly} option with text mode +% can lead to ambiguous fractions. Be happy that a warning is +% issued. Why do you use this option? Your boss? Ah, I see. +% \end{itemize} +% \section{Implementation} +% \subsection{Documentation Driver} +% \begin{macrocode} +%<*driver> +\documentclass[12pt,a4paper]{ltxdoc} +\usepackage{units} +\begin{document} + \DocInput{units.dtx} +\end{document} +% +% \end{macrocode} +% \StopEventually{ +% \font\logosl=logosl10 scaled\magstep1 +% \begin{thebibliography}{1} +% \bibitem{Goossens:1994} +% \textsc{Goossens, M.; Mittelbach, F.; Samarin, A.}: \emph{Der +% \LaTeX-Begleiter}. \newblock Addison-Wesley, Bonn, 1st edn., +% 1994. +% \bibitem{Kopka:1994} +% \textsc{Kopka, H.}: \emph{Einf{\"u}hrung}, vol.~1 of +% \emph{\LaTeX}. \newblock Addison-Wesley, Bonn, 1st edn., +% 1994. +% \bibitem{Kopka:1995} +% \textsc{Kopka, H.}: \emph{Erg{\"a}nzungen -- mit einer +% Einf{\"u}hrung in {\logosl META}\-{\logosl FONT}}, vol.~2 of +% \emph{\LaTeX}. \newblock Addison-Wesley, Bonn, 1st edn., +% 1995. +% \bibitem{Kopka:1997} +% \textsc{Kopka, H.}: \emph{Erweiterungen}, vol.~3 of +% \emph{\LaTeX}. \newblock Addison-Wesley-Longman, Bonn, 1997. +% \bibitem{Willberg:1997} +% \textsc{Willberg, H.\,P.; Forssman, F.}: +% \emph{Lesetypographie}. \newblock Schmidt, Mainz, 1997. +% \end{thebibliography} +% } +% \subsection{\file{units.sty}} +% \begin{macrocode} +%<*units> +% \end{macrocode} +% \subsubsection{Identification} +% As this package uses the \cmd{\RequirePackage} command, it does +% not work with older \LaTeXe{} versions. +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +% \end{macrocode} +% The package identifies itself with its release date, a version +% number, and a short description. +% \begin{macrocode} +\ProvidesPackage{units}[1998/08/04 v0.9b Typesetting units] +% \end{macrocode} +% \subsubsection{Initialization} +% The \package{ifthen} package is loaded because a new boolean +% variable has to be declared. +% \begin{macrocode} +\RequirePackage{ifthen} +\newboolean{B@UnitsLoose} +% \end{macrocode} +% \subsubsection{Option Declaration} +% This boolean variable is set according to the package options. +% \begin{macrocode} +\DeclareOption{tight}{\setboolean{B@UnitsLoose}{false}} +\DeclareOption{loose}{\setboolean{B@UnitsLoose}{true}} +% \end{macrocode} +% Other options will be passed to the \package{nicefrac} package. +% \begin{macrocode} +\DeclareOption*{% + \PassOptionsToPackage{\CurrentOption}{nicefrac}% +} +% \end{macrocode} +% \subsubsection{Option Processing} +% If no options are specified, tight spacing between the value and +% the dimension of a unit is used by default. Otherwise the options +% are processed in the order given by the calling command. +% \begin{macrocode} +\ExecuteOptions{tight} +\ProcessOptions* +% \end{macrocode} +% \subsubsection{Loading Files} +% \enlargethispage{\baselineskip} +% Because the macro used for fractions of units is also helpful for +% other nice fractions, it is build into a stand-alone package +% called \package{nicefrac}, which therefore is required by +% \file{units.sty}. +% \begin{macrocode} +\RequirePackage{nicefrac}[1998/08/04] +% \end{macrocode} +% \subsubsection{Defining Commands} +% In order to make debugging easier for the package user (missing +% braces or brackets), all commands are declared with the +% \texttt{*}-form of \cmd{\DeclareRobustCommand}. The \texttt{*}-form +% does not allow ``long'' arguments for the commands, so e.\,g.\ +% |\par| commands are forbidden inside the arguments. This should +% be no serious restriction. \winkey +% \begin{macro}{\unit} +% First, it is checked if the optional argument is +% empty.\footnote{Credits go to \person{Bernd Raichle} for +% supplying this method.} +% \begin{macrocode} +\DeclareRobustCommand*{\unit}[2][]{% + \begingroup + \def\0{#1}% + \expandafter + \endgroup +% \end{macrocode} +% If it is, nothing happens. +% \begin{macrocode} + \ifx\0\@empty +% \end{macrocode} +% Otherwise it is typeset and followed by a space depending on the +% boolean declared above. +% \begin{macrocode} + \else + #1% + \ifthenelse{\boolean{B@UnitsLoose}}{~}{\,}% + \fi +% \end{macrocode} +% The use of upright fonts for the dimension is forced in math +% mode. Units in text mode are typeset with the currently active font. +% \begin{macrocode} + \ifthenelse{\boolean{mmode}}{\mathrm{#2}}{#2}% +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\unitfrac} +% Fractions of units are typeset by means of the \cmd{\nicefrac} +% command. Upright fonts are forced in math mode by use of the +% optional argument. The rest of code is identical to the former +% macro. +% \begin{macrocode} +\DeclareRobustCommand*{\unitfrac}[3][]{% + \begingroup + \def\0{#1}% + \expandafter + \endgroup + \ifx\0\@empty + \else + #1% + \ifthenelse{\boolean{B@UnitsLoose}}{~}{\,}% + \fi + \ifthenelse{\boolean{mmode}}{% + \nicefrac[\mathrm]{#2}{#3}% + }% + {% + \nicefrac{#2}{#3}% + }% +} +% +% \end{macrocode} +% \end{macro} +% \subsection{\file{nicefrac.sty}} +% \begin{macrocode} +%<*nicefrac> +% \end{macrocode} +% \subsubsection{Identification} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{nicefrac}[1998/08/04 v0.9b Nice fractions] +% \end{macrocode} +% \subsubsection{Initialization} +% First, some new lengths are allocated. +% \begin{macrocode} +\newlength{\L@UnitsRaiseDisplaystyle} +\newlength{\L@UnitsRaiseTextstyle} +\newlength{\L@UnitsRaiseScriptstyle} +% \end{macrocode} +% \subsubsection{Loading Files} +% The \package{ifthen} package is loaded for easier handling of decisions. +% \begin{macrocode} +\RequirePackage{ifthen} +% \end{macrocode} +% \subsubsection{Defining Commands} +% \begin{macro}{\@UnitsNiceFrac} +% Now the code used for nice fractions in math mode: +% \begin{macrocode} +\DeclareRobustCommand*{\@UnitsNiceFrac}[3][]{% + \ifthenelse{\boolean{mmode}}{% +% \end{macrocode} +% For each of the four different math styles the ``M'' height is +% measured, taking specified font changing commands into account. +% \begin{macrocode} + \settoheight{\L@UnitsRaiseDisplaystyle}{% + \ensuremath{\displaystyle#1{M}}% + }% + \settoheight{\L@UnitsRaiseTextstyle}{% + \ensuremath{\textstyle#1{M}}% + }% + \settoheight{\L@UnitsRaiseScriptstyle}{% + \ensuremath{\scriptstyle#1{M}}% + }% + \settoheight{\@tempdima}{% + \ensuremath{\scriptscriptstyle#1{M}}% + }% +% \end{macrocode} +% The raise height is calculated by taking the difference between +% the height of a normal ``M'' and the height of an ``M'' set in +% the correct numerator size. +% \begin{macrocode} + \addtolength{\L@UnitsRaiseDisplaystyle}{% + -\L@UnitsRaiseScriptstyle% + }% + \addtolength{\L@UnitsRaiseTextstyle}{% + -\L@UnitsRaiseScriptstyle% + }% + \addtolength{\L@UnitsRaiseScriptstyle}{-\@tempdima}% +% \end{macrocode} +% The height of the numerator above the baseline is dependent on +% the actual fontsize within the math environment.\footnote{Credits +% go to \person{Wolfgang May} for telling me of the +% \cmd{\mathchoice} command.} The numerator is put into an +% appropriately raised box, within math mode (the additional +% \cmd{\ensuremath} is necessary, because the \cmd{\raisebox} +% command leaves math mode). +% +% The fontsize for the numerator part is \cmd{\scriptstyle} within +% \cmd{\displaystyle} and \cmd{\textstyle}, but +% \cmd{\scriptscriptstyle} within \cmd{\scriptstyle} and +% \cmd{\scriptscriptstyle} context. +% +% Then the numerator is typeset either with the upright math font or +% using the font command specified in the optional argument (if it +% is given). Only the math alphabet commands may be used: +% \cmd{\mathnormal}, \cmd{\mathrm}, \cmd{\mathbf}, \cmd{\mathsf}, +% \cmd{\mathit}, \cmd{\mathtt}, and \cmd{\mathcal}. +% \begin{macrocode} + \mathchoice + {% + \raisebox{\L@UnitsRaiseDisplaystyle}{% + \ensuremath{\scriptstyle#1{#2}}% + }% + }% + {% + \raisebox{\L@UnitsRaiseTextstyle}{% + \ensuremath{\scriptstyle#1{#2}}% + }% + }% + {% + \raisebox{\L@UnitsRaiseScriptstyle}{% + \ensuremath{\scriptscriptstyle#1{#2}}% + }% + }% +% \end{macrocode} +% Within \cmd{\scriptscriptstyle} context, \LaTeX{} does \emph{not} +% use even smaller fonts for numerator or denominator. Following +% the above calculation scheme would lead to a raise height of +% \unit[0]{pt}. Because this could make fractions at least +% ambiguous (if not wrong, like $\mathrm{J}/\mathrm{kg\cdot K}$ for +% specific thermal capacity), the numerator in +% \cmd{\scriptscriptstyle} context is raised by the same amount as +% in \cmd{\scriptstyle} context and so exceeds the height of an +% adjacent ``M''. This is ugly, but cannot be avoided. +% \begin{macrocode} + {% + \raisebox{\L@UnitsRaiseScriptstyle}{% + \ensuremath{\scriptscriptstyle#1{#2}}% + }% + }% +% \end{macrocode} +% The slash is typeset with reduced spacing to the numerator and to +% the denominator. +% \begin{macrocode} + \mkern-2mu/\mkern-1mu% +% \end{macrocode} +% \changes{v0.9b}{1998-08-04}{\cmd{\bgroup} and \cmd{\egroup} +% instead of \cmd{\begingroup} and \cmd{\endgroup}} +% The denominator needs a seperate group to delimit the range of the +% font commands.\footnote{Credits go to \person{Michael Switkes} +% for the bug report and to \person{Heiko Oberdiek} for telling me +% why the fix works.} The choice for the fontsize and the font +% changing are made just like for the numerator. +% \begin{macrocode} + \bgroup + \mathchoice + {\scriptstyle}% + {\scriptstyle}% + {\scriptscriptstyle}% + {\scriptscriptstyle}% + #1{#3}% + \egroup + }% +% \end{macrocode} +% Now the code for nice fractions in text mode: +% \begin{macrocode} + {% +% \end{macrocode} +% First, the height of a normal ``M'' is measured. +% \begin{macrocode} + \settoheight{\L@UnitsRaiseTextstyle}{#1{M}}% +% \end{macrocode} +% \LaTeX{} offers no commands for relative fontsizes. To make the +% macro work for example within footnotes or chapter headings, it +% is necessary to avoid absolute sizing commands like +% \cmd{\normalsize} or \cmd{\scriptsize}. To obtain a fontsize +% that suits for the numerator and denominator, some code was taken +% from the \LaTeX{} kernel (\file{latex.ltx}, definition of +% \cmd{\textsuperscript}). +% +% In all these measurements the font changing effect of the +% optional argument is taken into account. Only the following font +% commands may be used: \cmd{\textnormal}, \cmd{\textrm}, +% \cmd{\textsf}, \cmd{\texttt}, \cmd{\textbf}, \cmd{\textmd}, +% \cmd{\textup}, \cmd{\textit}, \cmd{\textsc}, and \cmd{\textsl}. +% \begin{macrocode} + \settoheight{\@tempdima}{% + \ensuremath{% + \mbox{\fontsize\sf@size\z@\selectfont#1{M}}% + }% + }% +% \end{macrocode} +% Both lengths are subtracted. The result is used for the raise of +% the numerator. +% \begin{macrocode} + \addtolength{\L@UnitsRaiseTextstyle}{-\@tempdima}% +% \end{macrocode} +% Finally, the numerator is typeset in ``relative scriptsize'' +% either with the normal text font or using the font command +% specified in the optional argument (if it is given). +% \begin{macrocode} + \raisebox{\L@UnitsRaiseTextstyle}{% + \ensuremath{% + \mbox{\fontsize\sf@size\z@\selectfont#1{#2}}% + }% + }% +% \end{macrocode} +% The code for the slash and the denominator should now be straight +% forward. +% \begin{macrocode} + \ensuremath{\mkern-2mu}/\ensuremath{\mkern-1mu}% + \ensuremath{% + \mbox{\fontsize\sf@size\z@\selectfont#1{#3}}% + }% + }% +} +% \end{macrocode} +% \end{macro} +% \clearpage +% \begin{macro}{\@UnitsUglyFrac} +% Ugly fractions in math mode~\ldots +% \begin{macrocode} +\DeclareRobustCommand*{\@UnitsUglyFrac}[3][]{% + \ifthenelse{\boolean{mmode}}{% +% \end{macrocode} +% \ldots~are typeset just like normal fractions. +% \begin{macrocode} + \frac{#1{#2}}{#1{#3}}% + }% +% \end{macrocode} +% In text mode~\ldots +% \begin{macrocode} + {% +% \end{macrocode} +% ~\ldots they are typeset like J/kg\textperiodcentered K. +% \begin{macrocode} + #1{#2}/#1{#3}% +% \end{macrocode} +% Because the fraction can get ambiguous or even wrong, a warning +% message is issued. +% \begin{macrocode} + \PackageWarning{nicefrac}{% + You used \protect\nicefrac\space or + \protect\unitfrac\space in text mode\MessageBreak + and specified the ``ugly'' option.\MessageBreak + The fraction may be ambiguous or wrong.\MessageBreak + Please make sure the denominator is + correct.\MessageBreak + If it is, you can safely ignore\MessageBreak + this warning + }% + }% +} +% \end{macrocode} +% \end{macro} +% \subsubsection{Option Declaration} +% Dependent on the package options, the \cmd{\nicefrac} command +% typesets either nice or ugly fractions by means of the +% corresponding macros. +% \begin{macrocode} +\DeclareOption{nice}{% + \DeclareRobustCommand*{\nicefrac}{\@UnitsNiceFrac}% +} +\DeclareOption{ugly}{% + \DeclareRobustCommand*{\nicefrac}{\@UnitsUglyFrac}% +} +% \end{macrocode} +% \subsubsection{Option Processing} +% If no options are specified, nice fractions are used by default. +% Otherwise the options are processed in the order given by the +% calling command. +% \begin{macrocode} +\ExecuteOptions{nice} +\ProcessOptions* +% +% \end{macrocode} +% \Finale +\endinput diff --git a/macros/latex/contrib/units/units.ins b/macros/latex/contrib/units/units.ins new file mode 100644 index 0000000000..4fc14706f4 --- /dev/null +++ b/macros/latex/contrib/units/units.ins @@ -0,0 +1,46 @@ +%% +%% units.ins +%% Batch file, run through LaTeX. +%% +%% Copyright (C) 1998 Axel Reichert +%% See the files README and COPYING. +%% +\def\batchfile{units.ins} +\input docstrip.tex +\declarepreamble\units + +LaTeX package for typesetting units + +Copyright (C) 1998 Axel Reichert +See the files README and COPYING. + +\endpreamble +\declarepreamble\nicefrac + +LaTeX package for typesetting nice fractions + +Copyright (C) 1998 Axel Reichert +See the files README and COPYING. + +\endpreamble +\keepsilent +\usepreamble\units +\generateFile{units.sty}{t}{\from{units.dtx}{units}} +\usepreamble\nicefrac +\generateFile{nicefrac.sty}{t}{\from{units.dtx}{nicefrac}} +\Msg{**************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* files into a directory searched by LaTeX:} +\Msg{*} +\Msg{* \space\space units.sty} +\Msg{* \space\space nicefrac.sty} +\Msg{*} +\Msg{* To produce the documentation run the following files} +\Msg{* through LaTeX:} +\Msg{*} +\Msg{* \space\space units.dtx} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{**************************************************************} diff --git a/macros/latex/contrib/units/units.pdf b/macros/latex/contrib/units/units.pdf new file mode 100644 index 0000000000..d41f562098 Binary files /dev/null and b/macros/latex/contrib/units/units.pdf differ -- cgit v1.2.3