summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-08-29 22:52:58 +0000
committerKarl Berry <karl@freefriends.org>2015-08-29 22:52:58 +0000
commit2b50a83aec0bcb5624b16581aa558efae661a12c (patch)
treedc15d4047575cfc89b940989dea9c6ff151cec1e /Master
parent23625ee03a438cf3c8003d3a4bdbcd2cb0834813 (diff)
chemformula (29aug15)
git-svn-id: svn://tug.org/texlive/trunk@38240 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/chemformula/README2
-rw-r--r--Master/texmf-dist/doc/latex/chemformula/chemformula_en.pdfbin950707 -> 950933 bytes
-rw-r--r--Master/texmf-dist/doc/latex/chemformula/chemformula_en.tex35
-rw-r--r--Master/texmf-dist/tex/latex/chemformula/chemformula.sty171
4 files changed, 152 insertions, 56 deletions
diff --git a/Master/texmf-dist/doc/latex/chemformula/README b/Master/texmf-dist/doc/latex/chemformula/README
index 2d02c34654f..2af05040d98 100644
--- a/Master/texmf-dist/doc/latex/chemformula/README
+++ b/Master/texmf-dist/doc/latex/chemformula/README
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------
-the CHEMFORMULA package v4.12 2015/08/12
+the CHEMFORMULA package v4.12a 2015/08/29
typeset chemical compounds and reactions
diff --git a/Master/texmf-dist/doc/latex/chemformula/chemformula_en.pdf b/Master/texmf-dist/doc/latex/chemformula/chemformula_en.pdf
index 6b7ffc7f4a9..8d14e16f914 100644
--- a/Master/texmf-dist/doc/latex/chemformula/chemformula_en.pdf
+++ b/Master/texmf-dist/doc/latex/chemformula/chemformula_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/chemformula/chemformula_en.tex b/Master/texmf-dist/doc/latex/chemformula/chemformula_en.tex
index b13b9eecc44..b6c78810134 100644
--- a/Master/texmf-dist/doc/latex/chemformula/chemformula_en.tex
+++ b/Master/texmf-dist/doc/latex/chemformula/chemformula_en.tex
@@ -93,10 +93,8 @@
accsupp = IUPAC
}
-\chemsetup{
- option/synchronize ,
- chemformula/format = \libertineLF
-}
+\chemsetup{ option/synchronize }
+\setchemformula{ format = \libertineLF }
\sisetup{
detect-mode=false,
@@ -633,6 +631,9 @@ The predefined bond types are shown in table~\vref{tab:bond_types}.
\command{RenewChemBond}[\marg{name}\marg{code}]
Redefine the existing bond type \meta{name}. Issue an error if a bond
\meta{name} doesn't exist.
+ \command{ProvideChemBond}[\marg{name}\marg{code}]
+ \sinceversion{4.12a}Define the new bond type \meta{name} only if it
+ doesn't exist yet.
\command{NewChemBondAlias}[\marg{new name}\marg{old name}]
\sinceversion{4.3}Declare the bond type \meta{new name} to be an alias of
\meta{old name}. Issue an error if a bond \meta{new name} already
@@ -822,11 +823,15 @@ of the following commmands:
\command{NewChemCompoundProperty}[\marg{token}\marg{replacement}]
\meta{token} will be replaced by \meta{replacement} within compounds. The
property is only added if \meta{token} is not yet part the compounds'
- property list.
+ property list. Otherwise an error is issued.
+ \command{ProvideChemCompoundProperty}[\marg{token}\marg{replacement}]
+ \meta{token}\sinceversion{4.12a} will be replaced by \meta{replacement}
+ within compounds. The property is only added if \meta{token} is not yet
+ part the compounds' property list.
\command{RenewChemCompoundProperty}[\marg{token}\marg{replacement}]
\meta{token} will be replaced by \meta{replacement} within compounds. The
property is only added if \meta{token} is already part the compounds'
- property list.
+ property list. Otherwise an error is issued.
\command{DeclareChemCompoundProperty}[\marg{token}\marg{replacement}]
\meta{token} will be replaced by \meta{replacement} within compounds. The
property silently overwrites any previously set \meta{replacement} for
@@ -868,6 +873,10 @@ You can define/redefine your own addition symbols:
\command{NewChemAdditionSymbol}[\marg{name}\marg{input}\marg{output}]
Defines\sinceversion{4.11} the addition symbol \meta{name} with input
symbol \meta{input} and output \meta{output}.
+ \command{ProvideChemAdditionSymbol}[\marg{name}\marg{input}\marg{output}]
+ Defines\sinceversion{4.12a} the addition symbol \meta{name} with input
+ symbol \meta{input} and output \meta{output} only no addition symbol with
+ then name \meta{name} doesn't exist.
\command{RenewChemAdditionSymbol}[\marg{name}\marg{input}\marg{output}]
Redefines\sinceversion{4.11} the addition symbol \meta{name} with input
symbol \meta{input} and output \meta{output}.
@@ -920,6 +929,9 @@ You can define/redefine your own symbols:
\command{NewChemSymbol}[\marg{input}\marg{output}]
Defines\sinceversion{4.11} the addition symbol with input \meta{input} and
output \meta{output}.
+ \command{ProvideChemSymbol}[\marg{input}\marg{output}]
+ Defines\sinceversion{4.12a} the addition symbol with input \meta{input} and
+ output \meta{output} only if no symbol with input \meta{input} exists.
\command{RenewChemSymbol}[\marg{input}\marg{output}]
Redefines\sinceversion{4.11} the addition symbol with input \meta{input}
and output \meta{output}.
@@ -1157,6 +1169,9 @@ The arrows are defined with the commands
\command{NewChemArrow}[\marg{type}\marg{\TikZ}]
Define the new arrow type \meta{type}. Issue an error if an arrow type
\meta{type} already exists.
+ \command{ProvideChemArrow}[\marg{type}\marg{\TikZ}]
+ Define\sinceversion{4.12a} the new arrow type \meta{type} only if it
+ doesn't exist, yet.
\command{DeclareChemArrow}[\marg{type}\marg{\TikZ}]
Define the new arrow type \meta{type} or overwrite it if it already
exists.
@@ -1293,7 +1308,7 @@ mandatory.
In the standard setting \chemformula\ doesn't make any default changes to the
font of the formula output. Let's take a look at a nonsense input which shows
all features:
-\begin{example}[pre-output={\biolinumLF\libertineLF\chemsetup{chemformula/format=}}]
+\begin{example}[pre-output={\biolinumLF\libertineLF\setchemformula{format=}}]
\newcommand*\sample{%
\ch{H2C-C+C-CH=CH+ + CrO4^2-
<=>[x][y]
@@ -1308,7 +1323,7 @@ all features:
}
Now we're going to change different aspects of the font a look what happens:
-\begin{example}[pre-output={\biolinumLF\libertineLF\chemsetup{chemformula/format=}}]
+\begin{example}[pre-output={\biolinumLF\libertineLF\setchemformula{format=}}]
\sffamily Hallo \sample \\
\ttfamily Hallo \sample \normalfont \\
\bfseries Hallo \sample \normalfont \\
@@ -1321,7 +1336,7 @@ If you want to change the default format you need to use this option:
\keyval{format}{anything}\Default
Adds arbitrary code before the output of \cs{ch}.
\end{options}
-\begin{example}[pre-output={\biolinumLF\libertineLF\chemsetup{chemformula/format=}}]
+\begin{example}[pre-output={\biolinumLF\libertineLF\setchemformula{format=}}]
\definecolor{newblue}{rgb}{.1,.1,.5}
\chemsetup[chemformula]{format=\color{newblue}\sffamily}
\sffamily Hallo \sample \\
@@ -1340,7 +1355,7 @@ the output.
\keyval{font-shape}{shape}\Default
Changes the fontshape of the output with \cs*{fontshape}\marg{shape}.
\end{options}
-\begin{example}[pre-output={\biolinumLF\libertineLF\chemsetup{chemformula/format=}}]
+\begin{example}[pre-output={\biolinumLF\libertineLF\setchemformula{format=}}]
\chemsetup[chemformula]{font-series=bx}
Hallo \sample \par
\sffamily Hallo \sample \normalfont \par
diff --git a/Master/texmf-dist/tex/latex/chemformula/chemformula.sty b/Master/texmf-dist/tex/latex/chemformula/chemformula.sty
index a935cd58017..fcd07845edb 100644
--- a/Master/texmf-dist/tex/latex/chemformula/chemformula.sty
+++ b/Master/texmf-dist/tex/latex/chemformula/chemformula.sty
@@ -28,8 +28,8 @@
% --------------------------------------------------------------------------
\RequirePackage{ expl3 , xparse , l3keys2e , tikz , amstext , xfrac , nicefrac, scrlfile }
\usetikzlibrary{arrows.meta}
-\def\chemformula@version{4.12}
-\def\chemformula@date{2015/08/12}
+\def\chemformula@version{4.12a}
+\def\chemformula@date{2015/08/19}
\ProvidesExplPackage
{chemformula}
@@ -74,6 +74,20 @@
exist.
}
+\msg_new:nnn {chemformula} {new-compound-property}
+ {
+ You've~ tried~ to~ define~ the~ compound~ property~ `#1'~ with~
+ \token_to_str:N \NewChemCompoundProperty \c_space_tl but~ a~ property~
+ `#1'~ already~ exists.~ Choose~ another~ symbol.
+ }
+
+\msg_new:nnn {chemformula} {renew-compound-property}
+ {
+ You've~ tried~ to~ redefine~ the~ compound~ property~ `#1'~ with~
+ \token_to_str:N \RenewChemCompoundProperty \c_space_tl but~ a~ property~
+ `#1'~ doesn't~ seem~ to~ exist.
+ }
+
\msg_new:nnn {chemformula} {new-addition-symbol}
{
You've~ tried~ to~ define~ the~ addition~ symbol~ `#1'~ (input~ symbol:~
@@ -118,9 +132,42 @@
}
}
+% #1: deprecated macro
+% #2: replacement macro
+% #3: code
\NewDocumentCommand \DeprecatedFormulaCommand { mmm }
{ \chemformula_define_deprecated:NNn #1 #2 {#3} }
+\cs_new_protected:Npn \chemformula_new_macroset:nnn #1#2#3
+ {
+ \exp_args:Nc \NewDocumentCommand {NewChem#1} {#2}
+ {
+ \cs_if_free:NTF ##1
+ { #3 }
+ { \msg_error:nnn {chemformula} {new-#1} {##1} }
+ }
+ \exp_args:Nc \NewDocumentCommand {RenewChem#1} {#2}
+ {
+ \cs_if_free:NTF ##1
+ { \msg_error:nnn {chemformula} {renew-#1} {##1} }
+ { #3 }
+ }
+ \exp_args:Nc \NewDocumentCommand {DeclareChem#1} {#2} {#3}
+ \exp_args:Nc \NewDocumentCommand {ProvideChem#1} {#2}
+ { \cs_if_free:NT ##1 { #3 } }
+ \msg_new:nnn {chemformula} {new-#1}
+ {
+ You've~ tried~ to~ define~ a~ #1~ with~ \token_to_str:N
+ \NewChem #1 ,~ but~ the~ command~ sequence~ \token_to_str:N ##1
+ \c_space_tl already~ exists.~ Please~ choose~ another~ name.
+ }
+ \msg_new:nnn {chemformula} {renew-#1}
+ {
+ You've~ tried~ to~ renew~ the~ #1~ \token_to_str:N ##1 ,~ but~
+ it~ doesn't~ exist.
+ }
+ }
+
% --------------------------------------------------------------------------
% variants of kernel functions:
\cs_generate_variant:Nn \keys_set:nn { nV }
@@ -131,27 +178,6 @@
\cs_generate_variant:Nn \dim_set:Nn { NV }
% --------------------------------------------------------------------------
-% package options:
-% \bool_new:N \l__chemformula_strict_bool
-% \keys_define:nn { chemmacros / chemformula }
-% {
-% strict .bool_set:N = \l__chemformula_strict_bool ,
-% strict .default:n = true
-% }
-
-% \ProcessKeysOptions{ chemmacros / chemformula }
-
-% \AtBeginDocument
-% {
-% \@ifpackageloaded{ chemmacros }
-% {
-% \bool_if:NT \l_chemmacros_strict_bool
-% { \bool_set_true:N \l__chemformula_strict_bool }
-% }
-% {}
-% }
-
-% --------------------------------------------------------------------------
% VARIABLES
% temporary variables:
\tl_new:N \l__chemformula_tmpa_tl
@@ -481,18 +507,21 @@
{ \mode_if_math:TF { \text { + } } { + } }
}
-\cs_new_protected:Npn \chemformula_plus:
+\cs_new_protected:Npn \chemformula_formal_plus:
{
- \bool_if:NTF \l_chemformula_formal_charges_bool
+ \bool_if:NTF \l_chemformula_formal_chem_bool
+ { \chemformula_fplus: }
{
- \bool_if:NTF \l_chemformula_formal_chem_bool
- { \chemformula_fplus: }
- {
- \mode_if_math:TF
- { \oplus }
- { \c_math_toggle_token \oplus \c_math_toggle_token }
- }
+ \mode_if_math:TF
+ { \oplus }
+ { \c_math_toggle_token \oplus \c_math_toggle_token }
}
+ }
+
+\cs_new_protected:Npn \chemformula_plus:
+ {
+ \bool_if:NTF \l_chemformula_formal_charges_bool
+ { \chemformula_formal_plus: }
{ \chemformula_plain_plus: }
}
@@ -503,18 +532,21 @@
{ \mode_if_math:TF { \text { \textendash } } { \textendash } }
}
-\cs_new_protected:Npn \chemformula_minus:
+\cs_new_protected:Npn \chemformula_formal_minus:
{
- \bool_if:NTF \l_chemformula_formal_charges_bool
+ \bool_if:NTF \l_chemformula_formal_chem_bool
+ { \chemformula_fminus: }
{
- \bool_if:NTF \l_chemformula_formal_chem_bool
- { \chemformula_fminus: }
- {
- \mode_if_math:TF
- { \ominus }
- { \c_math_toggle_token \ominus \c_math_toggle_token }
- }
+ \mode_if_math:TF
+ { \ominus }
+ { \c_math_toggle_token \ominus \c_math_toggle_token }
}
+ }
+
+\cs_new_protected:Npn \chemformula_minus:
+ {
+ \bool_if:NTF \l_chemformula_formal_charges_bool
+ { \chemformula_formal_minus: }
{ \chemformula_plain_minus: }
}
@@ -890,6 +922,16 @@
{ \msg_error:nnn {chemformula} { renew-arrow } {#1} }
}
+\NewDocumentCommand \ProvideChemArrow { mm }
+ {
+ \prop_if_in:NnF \l__chemformula_arrows_code_prop {#1}
+ {
+ % store type in the sequence and code in the property list
+ \seq_put_right:Nn \l__chemformula_arrows_type_seq {#1}
+ \prop_put:Nnn \l__chemformula_arrows_code_prop {#1} {#2}
+ }
+ }
+
\NewDocumentCommand \ShowChemArrow { m }
{
\prop_get:NnN \l__chemformula_arrows_code_prop {#1} \l__chemformula_tmpa_tl
@@ -1248,14 +1290,22 @@
% parsing input
% compounds:
\cs_new_protected:Npn \chemformula_new_compound_property:nn #1#2
- { \prop_put_if_new:Nnn \l__chemformula_cmpd_prop {#1} {#2} }
-
+ {
+ \prop_if_in:NnTF \l__chemformula_cmpd_prop {#1}
+ { \msg_error:nnn {chemformula} {new-compound-property} {#1} }
+ { \prop_put:Nnn \l__chemformula_cmpd_prop {#1} {#2} }
+ }
+
\cs_new_protected:Npn \chemformula_renew_compound_property:nn #1#2
{
- \prop_if_in:NnT \l__chemformula_cmpd_prop {#1}
+ \prop_if_in:NnTF \l__chemformula_cmpd_prop {#1}
{ \prop_put:Nnn \l__chemformula_cmpd_prop {#1} {#2} }
+ { \msg_error:nnn {chemformula} {renew-compound-property} {#1} }
}
+\cs_new_protected:Npn \chemformula_provide_compound_property:nn #1#2
+ { \prop_put_if_new:Nnn \l__chemformula_cmpd_prop {#1} {#2} }
+
\cs_new_protected:Npn \chemformula_declare_compound_property:nn #1#2
{ \prop_put:Nnn \l__chemformula_cmpd_prop {#1} {#2} }
@@ -1268,6 +1318,9 @@
\NewDocumentCommand \RenewChemCompoundProperty { mm }
{ \chemformula_renew_compound_property:nn {#1} {#2} }
+\NewDocumentCommand \ProvideChemCompoundProperty { mm }
+ { \chemformula_provide_compound_property:nn {#1} {#2} }
+
\NewDocumentCommand \DeclareChemCompoundProperty { mm }
{ \chemformula_declare_compound_property:nn {#1} {#2} }
@@ -1401,7 +1454,7 @@
\draw (chemformula-bond-start) ++(\l__chemformula_bond_dim ,0pt)
coordinate (chemformula-bond-end) ;
\tl_if_blank:nTF {#1}
- { \__chemformula_bond_draw:n { single } }
+ { \__chemformula_bond_draw:n {single} }
{ \__chemformula_bond_draw:n {#1} }
}
\group_end:
@@ -1432,6 +1485,12 @@
{ \chemformula_declare_bond:nn {#1} {#2} }
}
+\cs_new_protected:Npn \chemformula_provide_bond:nn #1#2
+ {
+ \cs_if_exist:cF { chemformula_bond_type_#1: }
+ { \chemformula_declare_bond:nn {#1} {#2} }
+ }
+
\cs_new_protected:Npn \chemformula_renew_bond:nn #1#2
{
\cs_if_exist:cTF { chemformula_bond_type_#1: }
@@ -1473,6 +1532,9 @@
\NewDocumentCommand \NewChemBond { mm }
{ \chemformula_new_bond:nn {#1} {#2} }
+\NewDocumentCommand \ProvideChemBond { mm }
+ { \chemformula_provide_bond:nn {#1} {#2} }
+
\NewDocumentCommand \DeclareChemBond { mm }
{ \chemformula_declare_bond:nn {#1} {#2} }
@@ -2407,6 +2469,15 @@
\chemformula_new_addition_symbol:nnn {#1} {#2} {#3}
}
+\NewDocumentCommand \ProvideChemAdditionSymbol {mmm}
+ {
+ \chemformula_is_addition_symbol_name:nF {#1}
+ {
+ \chemformula_is_addition_symbol_input:nF {#2}
+ { \chemformula_new_addition_symbol:nnn {#1} {#2} {#3} }
+ }
+ }
+
\NewDocumentCommand \RenewChemAdditionSymbol {mmm}
{
\chemformula_is_addition_symbol_name:nF {#1}
@@ -2465,6 +2536,12 @@
{ \chemformula_new_symbol:nn {#1} {#2} }
}
+\NewDocumentCommand \ProvideChemSymbol {mm}
+ {
+ \chemformula_is_symbol:nF {#1}
+ { \chemformula_new_symbol:nn {#1} {#2} }
+ }
+
\NewDocumentCommand \RenewChemSymbol {mm}
{
\chemformula_is_symbol:nTF {#1}
@@ -3193,6 +3270,10 @@ VERSION HISTORY
options. They really belong to chemmacros
- change requirement amsmath -> amstext
- shorten definition of double and triple bonds
+2015/08/29 - version 4.12a - \chemformula_formal_plus: ,
+ \chemformula_formal_minus:
+ \ProvideChem... equivalents to all \NewChem...
+ macros
% --------------------------------------------------------------------------
% TODO