Debian Codegraph @

texmf-dist/source/latex/isotope/isotope.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2003-2011 by Heiko Bauke <[email protected]>
4 % -----------------------------------------------------------------------
5 %
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.2
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in:
10 %
11 % http://www.latex-project.org/lppl.txt
12 %
13 % and version 1.2 or later is part of all distributions of LaTeX
14 % version 1999/12/01 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
20 %<package>\ProvidesPackage{isotope}
21 %<package> [2011/08/26 v0.3 for typesetting isotopes]
22 %
23 %<*driver>
24 \documentclass{ltxdoc}
25 \usepackage{isotope}
26 \usepackage{textcomp}
27 \EnableCrossrefs
28 \CodelineIndex
29 \RecordChanges
30 \begin{document}
31 \DocInput{isotope.dtx}
32 \end{document}
33 %</driver>
34 % \fi
35 %
36 %\CheckSum{47}
37 %
38 % \CharacterTable
39 % {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
40 % 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
41 % Digits \0\1\2\3\4\5\6\7\8\9
42 % Exclamation \! Double quote \" Hash (number) \#
43 % Dollar \$ Percent \% Ampersand \&
44 % Acute accent \' Left paren \( Right paren \)
45 % Asterisk \* Plus \+ Comma \,
46 % Minus \- Point \. Solidus \/
47 % Colon \: Semicolon \; Less than \<
48 % Equals \= Greater than \> Question mark \?
49 % Commercial at \@ Left bracket \[ Backslash \\
50 % Right bracket \] Circumflex \^ Underscore \_
51 % Grave accent \` Left brace \{ Vertical bar \|
52 % Right brace \} Tilde \~}
53 %
54 % \changes{v0.1}{2003/12/31}{Initial version.}
55 %
56 % \GetFileInfo{isotope.sty}
57 %
58 % \DoNotIndex{\newcommand,\newenvironment}
59 %
60 %
61 % \title{The \textsf{isotope} package\thanks{This document
62 % corresponds to \textsf{isotope}~\fileversion, dated \filedate.}}
63 % \author{Heiko Bauke\thanks{E-mail: \texttt{[email protected]}}}
64 %
65 % \maketitle
66 %
67 % \section{Introduction}
68 %
69 % Despite its powerful typographic capabilities it is surprisingly
70 % difficult to typeset isotopes with \LaTeX. Ad hoc methods as for
71 % example |$^{232}_{90}\mathrm{Th}$| give poor results as
72 % $^{232}_{90}\mathrm{Th}$.
73 % This is not satisfactory because of the wrong alignment of atomic
74 % and nuclear numbers. The package \textsf{isotope} provides the |\isotope|
75 % macro for correct typesetting of isotopes.
76 %
77 % \section{Usage}
78 %
79 % The package \textsf{isotope} has to be included into the preamble of your
80 % \LaTeX\ file by:
81 % \begin{quote}
82 % |\usepackage{isotope}|
83 % \end{quote}
84 % \DescribeMacro{\isotope}
85 % The usage of the |\isotope| macro is straight forward. Just provide the
86 % isotope's name and optionally its nucleon number and its atomic number.
87 % \begin{quote}
88 % |\isotope|\oarg{nucleon number}\oarg{atomic number}\marg{name}
89 % \end{quote}
90 % See \tablename~\ref{tab:example} for some examples. Note that the
91 % \verb#\alpha# has been enclosed by \verb#\mathnormal#. Not doing so
92 % may give unexpected results for some math fonds.
93 %
94 % \begin{table}[t]
95 % \centering
96 % \caption{Examples for \texttt{\textbackslash isotope} macro usage.}
97 % \label{tab:example}
98 % \begin{tabular}{@{}ll@{}}
99 % \hline
100 % \hline
101 % command & result \\
102 % \hline
103 % |\isotope{Ra}| & \isotope{Ra} \\
104 % |\isotope[228]{Ra}| & \isotope[228]{Ra} \\
105 % |\isotope[228][88]{Ra}| & \isotope[228][88]{Ra} \\
106 % |$\isotope[A][Z]{X}\to\isotope[A-4][Z-2]{Y}+| & \\
107 % |\isotope[4][2]{\mathnormal{\alpha}}$| &
108 % \raisebox{1.5ex}[-1.5ex]{$\isotope[A][Z]{X}\to\isotope[A-4][Z-2]{Y}+\isotope[4][2]{\mathnormal{\alpha}}$}\\
109 % \hline
110 % \hline
111 % \end{tabular}
112 % \end{table}
113 % \DescribeMacro{\isotopestyle}
114 % The macro |\isotopestyle| determines the style which is used to typeset the
115 % name of the iostope. It may be redefined. For example, the redefinition
116 % \begin{quote}
117 % |\renewcommand{\isotopestyle}{\mathsf}|\\
118 % |\isotope[228]{Ra}|
119 % \end{quote}
120 % gives {\renewcommand{\isotopestyle}{\mathsf}\isotope[228]{Ra}}.
121 %
122 % \StopEventually{\PrintChanges\PrintIndex}
123 %
124 % \section{Implementation}
125 %
126 % \begin{macro}{\isotopestyle}
127 % \changes{v0.2}{2004/01/04}{\texttt{\textbackslash isotopestyle} determines
128 % also the style of nuclear and atomic number.}
129 % |\isotopestyle| determines the style which is used to typeset the
130 % name of an iostope and its nucleon and atomic numbers.
131 % \begin{macrocode}
132 \newcommand{\isotopestyle}{\mathrm}
133 % \end{macrocode}
134 % \end{macro}
135 % \begin{macro}{\isotope}
136 % \changes{v0.2}{2004/01/04}{Vertical spacing between nuclear and atomic
137 % number has been improved. The implementation is based no a suggestion
138 % of Walter Schmidt in \texttt{de.comp.text.tex}.}
139 % Now it follows the implementation of the \verb#\isotope# macro.
140 % \begin{macrocode}
141 \newcommand{\isotope@atomicnumber}{}
142 \newcommand{\isotope@nucleonnumber}{}
143 \newcommand{\isotope}[1][]{%
144 \begingroup%
145 \renewcommand{\isotope@nucleonnumber}{#1}%
146 \isotope@two}%
147 \newcommand{\isotope@two}[2][]{%
148 \renewcommand{\isotope@atomicnumber}{#1}%
149 {\m@th%
150 % \end{macrocode}
151 % Determine which has a larger width nucleon number or atomic number.
152 % \begin{macrocode}
153 \settowidth\@tempdimb{\ensuremath{%
154 \scriptstyle\isotope@nucleonnumber}}%
155 \settowidth\@tempdimc{\ensuremath{%
156 \scriptstyle\isotope@atomicnumber}}%
157 \ifdim\@tempdimb<\@tempdimc\@tempdimb=\@tempdimc\fi%
158 \ensuremath{{}%
159 ^{\makebox[\@tempdimb][r]{\ensuremath{%
160 \scriptstyle\isotope@nucleonnumber}}}%
161 _{\makebox[\@tempdimb][r]{\ensuremath{%
162 \scriptstyle\isotope@atomicnumber}}}%
163 \isotopestyle{#2}}%
164 }%
165 \endgroup%
166 }%
167 % \end{macrocode}
168 % \end{macro}
169 % \changes{v0.3}{2011/08/26}{Changed \texttt{\textbackslash
170 % isotopestyle} from \texttt{\textbackslash rm} to
171 % \texttt{\textbackslash mathrm} to improve typographic quality when
172 % sans serif math fonts are used.}
173 % \PrintChanges
174 % \Finale
175 \endinput