summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mhchem
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-12-19 00:56:48 +0000
committerKarl Berry <karl@freefriends.org>2006-12-19 00:56:48 +0000
commit8d7729dececc6e5d1fd0d56383ee996069c6a47c (patch)
tree6e083cd7b325cc26d9e168ed90b2553e1e7bdf87 /Master/texmf-dist/tex/latex/mhchem
parent80d42f3ef5d9bf6027aef95d27efea6014dbee02 (diff)
mhchem update (18dec06)
git-svn-id: svn://tug.org/texlive/trunk@2799 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/mhchem')
-rw-r--r--Master/texmf-dist/tex/latex/mhchem/mhchem.sty216
-rw-r--r--Master/texmf-dist/tex/latex/mhchem/rsphrase.sty2
2 files changed, 143 insertions, 75 deletions
diff --git a/Master/texmf-dist/tex/latex/mhchem/mhchem.sty b/Master/texmf-dist/tex/latex/mhchem/mhchem.sty
index 237771b1f01..d5e420ec8d4 100644
--- a/Master/texmf-dist/tex/latex/mhchem/mhchem.sty
+++ b/Master/texmf-dist/tex/latex/mhchem/mhchem.sty
@@ -29,7 +29,7 @@
% mhchem.pdf and legal.txt.
%
%
-\ProvidesPackage{mhchem}[2006/09/21 v3.04 for typesetting chemical formulae]
+\ProvidesPackage{mhchem}[2006/12/17 v3.05 for typesetting chemical formulae]
\RequirePackage{ifthen}
\RequirePackage{calc}[1998/07/07]
\RequirePackage{twoopt}
@@ -41,17 +41,15 @@
%%%%%%%%%% misc %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand*\cmath[1]{\ensuremath{\text{\ensuremath{#1}}}}%
+\newcommand*\mhchem@cmath[1]{\ensuremath{\text{\ensuremath{#1}}}}%
+\newcommand*\cmath[1]{\mhchem@cmath{#1}}%
\DeclareMathSymbol{\mhchem@hyphen}{0}{operators}{45}
\def\mhchem@empty{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%% \ce %%%%%%%%%%
+%%%%%%%%%% \cee %%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newtoks\tok@mhchem@ce@i%
-\newtoks\tok@mhchem@ce@ii%
-
\newcommand*{\cee}[1]{%
\ifnum1<\mhchem@option@version%
\def\mhchem@ce@out{}%
@@ -74,27 +72,82 @@
\g@addto@macro\mhchem@ce@out{\\}%
\mhchem@ce@v#2#3\mhchem@ENDEND%
\fi%
-}
+}
\long\def\mhchem@ce@vii#1&#2#3\mhchem@ENDEND{%
\ifx\mhchem@END#2%
- \g@addto@macro\mhchem@ce@out{\ce{#1}}%
+ \g@addto@macro\mhchem@ce@out{\ce@main{#1}}%
\else%
- \g@addto@macro\mhchem@ce@out{\ce{#1}}%
+ \g@addto@macro\mhchem@ce@out{\ce@main{#1}}%
\g@addto@macro\mhchem@ce@out{&}%
\mhchem@ce@vii#2#3\mhchem@ENDEND%
\fi%
}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% \ce %%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
%%%
-\@ifundefined{hyphen}{%
- \def\hyphen{}%
-}{}
+\def\mhchem@protect{\protect\noexpand\protect}%
+
+\newcommand\ce[1]{\mhchem@ce@xiii{\mhchem@ce@ix#1{} \mhchem@END\mhchem@ENDEND}}%
+%
+%
+\def\mhchem@ce@ix#1#2 #3\mhchem@ENDEND{%
+ \ifx\mhchem@END#3\mhchem@END%
+ \ifx\mhchem@empty#2\mhchem@empty%
+ \mhchem@ce@x{#1}#2\mhchem@END\mhchem@ENDEND%
+ \else%
+ \mhchem@ce@x#1#2\mhchem@END\mhchem@ENDEND%
+ \fi%
+ \else%
+ \ifx\mhchem@empty#2\mhchem@empty%
+ \mhchem@ce@x{#1}#2\mhchem@END\mhchem@ENDEND%
+ \else%
+ \mhchem@ce@x#1#2\mhchem@END\mhchem@ENDEND%
+ \fi%
+ \ifx\mhchem@END#1\else%
+ \space\mhchem@ce@ix#3\mhchem@ENDEND%
+ \fi%
+ \fi%
+}
+\def\mhchem@ce@x#1#2\mhchem@ENDEND{%
+ \ifx\mhchem@END#1\else%
+ \mhchem@ce@xi#1\mhchem@END\mhchem@ENDEND%
+ \fi%
+ \ifx\mhchem@END#2%
+ \else%
+ \mhchem@ce@x#2\mhchem@ENDEND%
+ \fi%
+}
+\def\mhchem@ce@xi#1#2\mhchem@ENDEND{%
+ \ifx\mhchem@END#2\mhchem@END%
+ \if\noexpand#1##%
+ \mhchem@protect\tbond%
+ \else%
+ \mhchem@protect#1%
+ \fi%
+ \else%
+ %{\mhchem@ce@ix#1#2\mhchem@ENDEND}%
+ {\mhchem@ce@xii#1#2}%
+ \fi%
+}
+\def\mhchem@ce@xii#1\mhchem@END{\mhchem@ce@ix#1{} \mhchem@END\mhchem@ENDEND}
+\DeclareRobustCommand\mhchem@ce@xiii[1]{%
+ \bgroup%
+ \def\mhchem@protect{\noexpand}%
+ \edef\mhchem@tmp{#1}%
+ \expandafter\ce@main\expandafter{\mhchem@tmp}%
+ \egroup
+}
+
-\DeclareRobustCommand*{\ce}[1]{%
+%%%
+
+\DeclareRobustCommand*{\ce@main}[1]{%
\bgroup%
- \protect\def\hyphen{\mhchem@hyphen}%
\ifnum1<\mhchem@option@version%
\ifmmode\else\def\mhchem@option@alwaystextmode{1}\fi%
\fi%
@@ -125,16 +178,18 @@
\else\ifx ^#1{\mhchem@ce@ii{#1#2}}%
\else\if ^#1{\mhchem@ce@ii{#1#2}}%
\else\ifx _#1{\mhchem@ce@ii{#1#2}}%
+ \else\ifx $#1{\mhchem@ce@ii{#1#2}}%
\else\ifx -#1{\ifx\mhchem@END#2\mhchem@END#1\else\mhchem@ce@dash#2\mhchem@END\fi}%
\else\if\noexpand#1<{\ifx\mhchem@END#2\mhchem@END#1\else\mhchem@ce@lt#2\mhchem@END\fi}%
\else\ifx +#1+ \mhchem@ce@ii{#2}%
+ \else\ifx \protect#1{\mhchem@ce@ii{#1#2}}%
%
\else\ifx\ce#1 \mhchem@ce@i #2 \mhchem@END%
\else\ifx\cf#1 \cf{#2}%
- \else\ifx\cmath#1 \mhchem@ce@cmath #2\mhchem@END%
+ \else\ifx\cmath#1 \mhchem@ce@cmath#2\mhchem@END%
%
\else #1#2%
- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
%
\ifx\mhchem@END#3\mhchem@END%
\else%
@@ -211,8 +266,9 @@
\else\csname#1\endcsname#2#3\fi\fi%
}
-\def\mhchem@ce@ii@tmp@i{}
-\def\mhchem@ce@ii@tmp@ii{}
+\newtoks\tok@mhchem@ce@ii%
+\def\mhchem@ce@ii@tmp@i{}%
+\def\mhchem@ce@ii@tmp@ii{}%
\def\mhchem@ce@ii#1{%
\tok@mhchem@ce@ii{#1}%
\edef\mhchem@ce@ii@tmp@i{\the\tok@mhchem@ce@ii}%
@@ -234,7 +290,7 @@
\fi\fi\fi\fi%
}%
-\def\mhchem@ce@cmath#1#2\mhchem@END{\cmath{#1}\cf{#2}}
+\def\mhchem@ce@cmath#1#2\mhchem@END{\mhchem@cmath{#1}\cf{#2}}
%%%%%%%%%%%%%
%%% arrows
@@ -582,27 +638,27 @@
\newcommandtwoopt*\mhchem@givesT[2][\hspace{\mhchem@arrowminlength}][]%
{\mhchem@gives[\text{#1}][\text{#2}]}%
\newcommandtwoopt*\mhchem@givesC[2][\hspace{\mhchem@arrowminlength}][]%
- {\mhchem@gives[\ce{#1}][\ce{#2}]}%
+ {\mhchem@gives[\ce@main{#1}][\ce@main{#2}]}%
\newcommandtwoopt*\mhchem@givesleftT[2][\hspace{\mhchem@arrowminlength}][]%
{\mhchem@givesleft[\text{#1}][\text{#2}]}%
\newcommandtwoopt*\mhchem@givesleftC[2][\hspace{\mhchem@arrowminlength}][]%
- {\mhchem@givesleft[\ce{#1}][\ce{#2}]}%
+ {\mhchem@givesleft[\ce@main{#1}][\ce@main{#2}]}%
\newcommandtwoopt*\mhchem@mesomericT[2][\hspace{\mhchem@arrowminlength}][]%
{\mhchem@mesomeric[\text{#1}][\text{#2}]}%
\newcommandtwoopt*\mhchem@mesomericC[2][\hspace{\mhchem@arrowminlength}][]%
- {\mhchem@mesomeric[\ce{#1}][\ce{#2}]}%
+ {\mhchem@mesomeric[\ce@main{#1}][\ce@main{#2}]}%
\newcommandtwoopt*{\mhchem@equilibriumT}[2][\hspace{\mhchem@arrowminlength}][]%
{\mhchem@equilibrium[\text{#1}][\text{#2}]}
\newcommandtwoopt*{\mhchem@equilibriumC}[2][\hspace{\mhchem@arrowminlength}][]%
- {\mhchem@equilibrium[\ce{#1}][\ce{#2}]}
+ {\mhchem@equilibrium[\ce@main{#1}][\ce@main{#2}]}
\newcommandtwoopt*{\mhchem@equilibriumRightT}[2][\hspace{\mhchem@arrowminlength}][]%
{\mhchem@equilibriumRight[\text{#1}][\text{#2}]}
\newcommandtwoopt*{\mhchem@equilibriumRightC}[2][\hspace{\mhchem@arrowminlength}][]%
- {\mhchem@equilibriumRight[\ce{#1}][\ce{#2}]}
+ {\mhchem@equilibriumRight[\ce@main{#1}][\ce@main{#2}]}
\newcommandtwoopt*{\mhchem@equilibriumLeftT}[2][][\hspace{\mhchem@arrowminlength}]%
{\mhchem@equilibriumLeft[\text{#1}][\text{#2}]}
\newcommandtwoopt*{\mhchem@equilibriumLeftC}[2][][\hspace{\mhchem@arrowminlength}]%
- {\mhchem@equilibriumLeft[\ce{#1}][\ce{#2}]}
+ {\mhchem@equilibriumLeft[\ce@main{#1}][\ce@main{#2}]}
%%%%%%%%%%
@@ -632,7 +688,7 @@
\def\mhchem@bond#1{%
\mhchem@cf@length{#1}%
{}%
- \ifnum\count@>1\relax%
+ \ifnum\value{mhchem@cf@length}>1\relax%
\ifthenelse{\equal{#1}{~-}}{%
\mhchem@setbondwidth%
\rlap{\protect\raisebox{.2ex}{\mhchem@halfbond}}%
@@ -665,12 +721,13 @@
\else%
\ifthenelse{\equal{#1}{-}}{\sbond}{%
\ifthenelse{\equal{#1}{=}}{\dbond}{%
+ \ifthenelse{\equal{#1}{\tbond}}{\tbond}{%
\ifthenelse{\equal{#1}{~}}{%
\mhchem@setbondwidth%
\mhchem@halfbond}{%
%
\PackageError{mhchem}{unknown bond type in \string\bond}%
- }}}%
+ }}}}%
\fi%
\fi%
}
@@ -679,14 +736,15 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% \cf %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newtoks\mhchem@cf@element%
+\newtoks\mhchem@cf@number%
\newtoks\mhchem@cf@sup%
-\newtoks\mhchem@cf@number
\newtoks\tok@mhchem@cf@i%
\newcommand*{\cf}[2][]{%
\bgroup%
\def\sbond{{\ensuremath{-}}}%
- \def\dbond{\rlap{\protect\raisebox{.2ex}{\sbond}}\protect\raisebox{-.2ex}{\sbond}}%
+ \DeclareRobustCommand\dbond{\rlap{\protect\raisebox{.2ex}{\sbond}}\protect\raisebox{-.2ex}{\sbond}}%
\def\tbond{\rlap{\protect\raisebox{.4ex}{\sbond}}%
\rlap{\sbond}\protect\raisebox{-.4ex}{\sbond}}%
\def\hyphen{\mhchem@hyphen}%
@@ -705,9 +763,9 @@
\fi%
\ifmmode\else\mhchem@option@textfont\fi%
\ensuremath{%
- \def\mhchem@cf@element{}%
- %\def\mhchem@cf@number{}%
- %\def\mhchem@cf@sup{}%
+ %
+ %
+ %
\def\mhchem@cf@presub{}%
\def\mhchem@cf@presup{}%
\def\mhchem@cf@others{}%
@@ -718,6 +776,8 @@
%
%
%
+%
+%
\ifthenelse{\equal{#1}{}}%
{\mhchem@cf@i #2\mhchem@END\mhchem@ENDEND}%
{\ensuremath{\overset{#1}{\mhchem@cf@i #2\mhchem@END\mhchem@ENDEND}}}%
@@ -727,24 +787,24 @@
}
\def\mhchem@cf@output{%
\if\mhchem@cf@state s%
- %
+ %
\else\if\mhchem@cf@state 1%
{\mhchem@mathortext{\expandafter\mhchem@cf@frac\the\mhchem@cf@number/\mhchem@END}}%
\else\if\mhchem@cf@state n%
{\mhchem@mathortext{\expandafter\mhchem@cf@frac\the\mhchem@cf@number/\mhchem@END}}%
+ \else\if\mhchem@cf@state M%
+ \mhchem@cmath{\the\mhchem@cf@element}
\else%
\if\mhchem@option@usenonsimultaneoussubsuperscripts 0%
\mhchem@chemfive{\mhchem@cf@presup}{\mhchem@cf@presub}%
- {\mhchem@cf@element}{\the\mhchem@cf@number}{\the\mhchem@cf@sup}{}%
+ {\the\mhchem@cf@element}{\the\mhchem@cf@number}{\the\mhchem@cf@sup}{}%
\else%
\mhchem@chemfive{\mhchem@cf@presup}{\mhchem@cf@presub}%
- {\mhchem@cf@element}{\the\mhchem@cf@number}{}{\the\mhchem@cf@sup}%
+ {\the\mhchem@cf@element}{\the\mhchem@cf@number}{}{\the\mhchem@cf@sup}%
\fi%
- \fi\fi\fi%
- \def\mhchem@cf@element{}%
- %
+ \fi\fi\fi\fi%
+ \mhchem@cf@element{}
\mhchem@cf@number{}%
- %
\mhchem@cf@sup{}%
\def\mhchem@cf@presub{}%
\def\mhchem@cf@presup{}%
@@ -755,34 +815,27 @@
\if\mhchem@cf@state s\else\nolinebreak\fi%
{#1}%
}
+
+\newcounter{mhchem@cf@length}%
\def\mhchem@cf@length#1{%
-%
-%
-%
-%
-%
-%
-%
-%
- \count@=0%
+ \setcounter{mhchem@cf@length}{0}%
\ifx\mhchem@END#1\mhchem@END%
\else%
- \count@=1%
+ \setcounter{mhchem@cf@length}{1}%
\mhchem@cf@length@i#1\mhchem@END%
\fi%
}
-%
-%
\def\mhchem@cf@length@i#1#2\mhchem@END{%
\ifx\mhchem@END#2\mhchem@END%
\else%
- \count@=2%
+ \setcounter{mhchem@cf@length}{2}%
\fi%
}
\def\mhchem@cf@frac#1/#2\mhchem@END{\ifthenelse{\equal{#2}{}}{#1\,}{%
\ensuremath{\mathchoice%
- {\textstyle\frac{\mhchem@mathortext{#1}}{\mhchem@mathortext{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mskip1mu}%
+ {\textstyle%
+ \frac{\mhchem@mathortext{#1}}{\mhchem@mathortext{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mskip1mu}%
{\frac{\mhchem@mathortext{#1}}{\mhchem@mathortext{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mskip1mu}%
{\frac{\mhchem@mathortext{#1}}{\mhchem@mathortext{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mskip1mu}%
{\frac{\mhchem@mathortext{#1}}{\mhchem@mathortext{\mhchem@getfirstchar#2\mhchem@ENDgetfirstchar}}\mskip1mu}}}}
@@ -817,16 +870,13 @@
\def\mhchem@END{}
\def\mhchem@ENDEND{}
\def\mhchem@cf@i#1#2\mhchem@ENDEND{%
- \ifx\mhchem@END#1%
+ \ifx\mhchem@END#1\mhchem@END%
\mhchem@cf@output%
\else%
- \if\mhchem@cf@state e%
+ \ifx\protect#1%
+ \else\if\mhchem@cf@state e%
\mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup%
\expandafter\mhchem@cf@replacedot\expandafter{\mhchem@cf@replaceminus{#1}}}%
- %
- %
- %
- %
\def\mhchem@cf@state{+}%
\else\if\mhchem@cf@state E%
\mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup%
@@ -855,22 +905,33 @@
\edef\mhchem@cf@presub{\mhchem@cf@presub%
\mhchem@mathortext@ii{\mhchem@option@mathfont{#1}}{#1}}%
\def\mhchem@cf@state{*}%
- \else\if\mhchem@cf@state m% math
- \cmath{#1}%
+ \else\if\mhchem@cf@state m%
+ \mhchem@cmath{#1}%
\def\mhchem@cf@state{+}%
\else\if\mhchem@cf@state b%
\mhchem@bond{#1}%
\def\mhchem@cf@state{+}%
\else%
\mhchem@cf@length{#1}%
- \ifnum\count@>1%
- \mhchem@cf@output@o{#1}%
- %
+ \ifnum\value{mhchem@cf@length}>1%
+ \if\mhchem@cf@state M%
+ \mhchem@cf@element=\expandafter{\the\mhchem@cf@element{#1}}%
+ \else%
+ \mhchem@cf@output@o{#1}%
+ \fi%
\else%
- \ifx\mhchem@END#1\mhchem@END%
+ \if\mhchem@cf@state M%
+ \ifcat$\noexpand#1%
+ \mhchem@cf@output%
+ \def\mhchem@cf@state{+}%
+ \else%
+ \mhchem@cf@element=\expandafter{\the\mhchem@cf@element#1}%
+ \fi%
+ \else\ifx\mhchem@END#1\mhchem@END%
\mhchem@cf@output%
\def\mhchem@cf@state{s}%
\else\ifx\ #1\mhchem@cf@output%
+ \else\ifx\protect#1%
\else\ifx#1\cmath%
\mhchem@cf@output%
\def\mhchem@cf@state{m}%
@@ -895,13 +956,17 @@
\else\def\mhchem@cf@state{F}%
\fi\fi\fi%
\else\ifx#1(%
- \mhchem@cf@output@o{#1}%
+ \mhchem@cf@output@o{\mhchem@mathortext{#1}}%
\else\ifx#1)%
- \mhchem@cf@output@o{#1}%
+ \mhchem@cf@output@o{\mhchem@mathortext{#1}}%
\else\ifx#1[%
- \mhchem@cf@output@o{#1}%
+ \mhchem@cf@output@o{\mhchem@mathortext{#1}}%
\else\ifx#1]%
- \mhchem@cf@output@o{#1}%
+ \mhchem@cf@output@o{\mhchem@mathortext{#1}}%
+ \else\ifx#1\{%
+ \mhchem@cf@output@o{\mhchem@mathortext{#1}}%
+ \else\ifx#1\}%
+ \mhchem@cf@output@o{\mhchem@mathortext{#1}}%
\else\ifx#1+%
\mhchem@cf@sup=\expandafter{\the\mhchem@cf@sup #1}%
\def\mhchem@cf@state{+}%
@@ -961,7 +1026,7 @@
\fi%
\def\mhchem@cf@state{a}%
\fi%
- \edef\mhchem@cf@element{\mhchem@cf@element #1}%
+ \mhchem@cf@element=\expandafter{\the\mhchem@cf@element#1}%
\else%
\ifcat ^\noexpand#1%
\if\mhchem@cf@state s\def\mhchem@cf@state{p}%
@@ -988,12 +1053,15 @@
\else\if\mhchem@cf@state 2\mhchem@cf@number=\expandafter{\the\mhchem@cf@number\,}\def\mhchem@cf@state{f}%
\else\def\mhchem@cf@state{f}%
\fi\fi\fi\fi%
+ \else\ifcat$\noexpand#1%
+ \mhchem@cf@output%
+ \def\mhchem@cf@state{M}%
\else%
\mhchem@cf@output@o{#1}%
- \fi\fi\fi%
- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
+ \fi\fi\fi\fi%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
\fi%
- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
\mhchem@cf@length{#2}%
\mhchem@cf@i #2\mhchem@ENDEND%
\fi%
@@ -1039,7 +1107,7 @@
\mhchem@minispace% [3]
}%
\mhchem@mathortext@ii{% [5]
- \mhchem@option@mathfont #3%
+ \mhchem@option@mathfont {#3}%
}{\text{#3}}% [5]
\ifthenelse{\equal{#4#5}{}}{}{%
_{%
diff --git a/Master/texmf-dist/tex/latex/mhchem/rsphrase.sty b/Master/texmf-dist/tex/latex/mhchem/rsphrase.sty
index 9c59e72c2f5..3661a4b7939 100644
--- a/Master/texmf-dist/tex/latex/mhchem/rsphrase.sty
+++ b/Master/texmf-dist/tex/latex/mhchem/rsphrase.sty
@@ -48,7 +48,7 @@
% mhchem.pdf and legal.txt.
%
%
-\ProvidesPackage{rsphrase}[2006/09/21 v3.04 Risk and Safety Phrases (mhchem bundle)]
+\ProvidesPackage{rsphrase}[2006/12/17 v3.05 Risk and Safety Phrases (mhchem bundle)]
\RequirePackage{ifthen}
\RequirePackage{textcomp}