summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mhchem
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-03-21 23:03:32 +0000
committerKarl Berry <karl@freefriends.org>2014-03-21 23:03:32 +0000
commit75be5262a5f80a24cf575c485d368b188d8da97d (patch)
tree6e246aa46f34cfa4701a4ab1b90ecc143a65a217 /Master/texmf-dist/tex/latex/mhchem
parent92d905be3ae707fa5be86dc2700f7f37465fd0f6 (diff)
mhchem (21mar14)
git-svn-id: svn://tug.org/texlive/trunk@33255 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/mhchem')
-rw-r--r--Master/texmf-dist/tex/latex/mhchem/mhchem.sty68
1 files changed, 59 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/latex/mhchem/mhchem.sty b/Master/texmf-dist/tex/latex/mhchem/mhchem.sty
index 949bd97f148..8b90f9713f0 100644
--- a/Master/texmf-dist/tex/latex/mhchem/mhchem.sty
+++ b/Master/texmf-dist/tex/latex/mhchem/mhchem.sty
@@ -27,7 +27,7 @@
% This work consists of all files listed in manifest.txt.
%
%
-\ProvidesPackage{mhchem}[2014/02/01 v3.15 for typesetting chemical formulae]
+\ProvidesPackage{mhchem}[2014/03/20 v3.16 for typesetting chemical formulae]
\RequirePackage{ifthen}
\RequirePackage{calc}[1998/07/07]
\RequirePackage{twoopt}
@@ -65,9 +65,14 @@
\else%
\mhchem@cee@ii#1&\mhchem@END\mhchem@ENDEND%
\g@addto@macro\mhchem@ce@out{\\}%
- \mhchem@cee@i#2#3\mhchem@ENDEND%
+ \@ifnextchar[%
+ \mhchem@cee@optArg%
+ \mhchem@cee@i#2#3\mhchem@ENDEND%
\fi%
}
+\def\mhchem@cee@optArg[#1]{%
+ \g@addto@macro\mhchem@ce@out{[#1]}\mhchem@cee@i%
+}
\long\def\mhchem@cee@ii#1&#2#3\mhchem@ENDEND{%
\ifx\mhchem@END#2%
@@ -91,7 +96,51 @@
%%%%%%%%%% \ce %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\DeclareRobustCommand\ce[1]{\mhchem@ce{#1}}
+
+%%% \/ %%% Prevent argument from expanding when written to .aux
+%%%%%%%%%% Solution by Heiko Oberdiek
+%%%%%%%%%% http://tex.stackexchange.com/questions/160306/prevent-caption-from-expanding-argument-too-early
+\newcommand*{\ce}{%
+ \ifx\protect\@typeset@protect
+ \csname ce \expandafter\endcsname
+ \else
+ \ifx\protect\@unexpandable@protect
+ \protect@unexpand@cmd@arg\aaaa
+ \else
+ \ifx\protect\string
+ \protect@string@cmd@arg\aaaa
+ \else
+ \expandafter\protect@unknown@cmd@arg
+ \csname aaaa \endcsname
+ \fi
+ \fi
+ \fi
+}
+\expandafter\newcommand\csname ce \endcsname[1]{%
+ \mhchem@ce{#1}%
+}
+% unexpanded protect
+\def\protect@unexpand@cmd@arg#1\else#2\fi\fi\fi#3{%
+ \fi\fi
+ \ifx\thepage\relax
+ \detokenize
+ \else
+ \unexpanded
+ \fi
+ {#1{#3}}%
+}
+% display protect
+\def\protect@string@cmd@arg#1\else#2\fi\fi\fi#3{%
+ \fi\fi\fi
+ \detokenize{#1{#3}}%
+}
+% unknown protect
+\def\protect@unknown@cmd@arg#1\fi\fi\fi{%
+ \fi\fi\fi
+ \protect#1%
+}
+%%%%%%%%%%
+%%% /\ %%%
\edef\mhchem@char@lbrace{\string{} %}
\begingroup%
@@ -476,7 +525,7 @@
}{}}}%
\renewcommandtwoopt*\mhchem@arrow@equilibriumRightM[2][][]{%
\ensuremath{{}\mathrel{%
- \@ifempty{##1}{% if only above, center optically; if above AND below, center exactly to avoid misalignment
+ \@ifempty{##1}{%
\rlap{\raisebox{-.22ex}{$\kern0.5em\mhchem@ext@arrow{0}{0}{}{9}{5}{##2}{\mhchem@arrow@minlength-1em}{\mhchem@leftharpoondownfill@}$}}%
\@ifempty{##2}%
{\raisebox{.22ex}{$\mhchem@ext@arrow{0}{0}{}{0}{0}{}{\mhchem@arrow@minlength}{\mhchem@rightharpoonupfill@}$}}%
@@ -530,7 +579,7 @@
}{}}}%
\renewcommandtwoopt*\mhchem@arrow@equilibriumRightM[2][][]{%
\ensuremath{{}\mathrel{%
- \@ifempty{##1}{% if only above, center optically; if above AND below, center exactly to avoid misalignment
+ \@ifempty{##1}{%
\rlap{\raisebox{-.22ex}{$\kern0.5em\mhchem@ext@arrow@pgf{0}{0}{}{9}{5}{##2}{\mhchem@arrow@minlength-1em}{\mhchem@leftharpoondown@pgf}$}}%
\@ifempty{##2}%
{\raisebox{.22ex}{$\mhchem@ext@arrow@pgf{0}{0}{}{0}{0}{}{\mhchem@arrow@minlength}{\mhchem@rightharpoonup@pgf}$}}%
@@ -915,10 +964,10 @@
\ifnum 2=\mhchem@option@version%
\let\bond\sbond%
\else\ifnum 2<\mhchem@option@version%
- \DeclareRobustCommand*\bond{\mhchem@bond}%
+ \def\bond{\mhchem@bond}%
\fi\fi%
- \DeclareRobustCommand\dbond{\rlap{\protect\raisebox{.2ex}{\sbond}}\protect\raisebox{-.2ex}{\sbond}}%
- \DeclareRobustCommand\tbond{\rlap{\protect\raisebox{.4ex}{\sbond}}%
+ \def\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}%
\bool_if:NF \__mhchem_cf_cfActive_bool
@@ -1816,7 +1865,8 @@
{ 1 }
{
\tl_put_right:Nx \__mhchem_cf_result_tl
- { \exp_not:N \mhchem@mathOrText { \exp_not:N \mhchem@cf@frac \exp_not:V \__mhchem_cf_element_tl / \exp_not:N \mhchem@END { \mhchem@option@skipAfterFracAmount } } } }
+ { \exp_not:N \mhchem@mathOrText { \exp_not:N \mhchem@cf@frac \exp_not:V \__mhchem_cf_element_tl / \exp_not:N \mhchem@END { \mhchem@option@skipAfterFracAmount } } }
+ }
{ 9 }
{
\tl_put_right:Nx \__mhchem_cf_result_tl