diff options
author | Karl Berry <karl@freefriends.org> | 2015-02-08 21:52:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-02-08 21:52:12 +0000 |
commit | 0ab502f9af9ef6849cd94d45fe17d88bda544056 (patch) | |
tree | 20ecd1d3557c395ea01ef049366d5b672848a928 /Master/texmf-dist | |
parent | 577b2be3d7993050f549228cad438967d786a2ab (diff) |
chemmacros (8feb15)
git-svn-id: svn://tug.org/texlive/trunk@36234 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdf | bin | 908905 -> 842434 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex | 57 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty | 192 |
4 files changed, 147 insertions, 106 deletions
diff --git a/Master/texmf-dist/doc/latex/chemmacros/README b/Master/texmf-dist/doc/latex/chemmacros/README index befadaf28f7..ecd8835def6 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/README +++ b/Master/texmf-dist/doc/latex/chemmacros/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the CHEMMACROS package v4.6 2014/08/08 +the CHEMMACROS package v4.7 2015/02/08 macros and commands for chemists @@ -8,7 +8,7 @@ Clemens Niederberger Web: https://github.com/cgnieder/chemmacros/ E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- -Copyright 2011-2014 Clemens Niederberger +Copyright 2011-2015 Clemens Niederberger This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdf b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdf Binary files differindex 6d9e5a9ddfa..603eafab494 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdf +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdf diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex index cb611113813..511935388ea 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex @@ -16,7 +16,7 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -% Copyright 2011-2014 Clemens Niederberger +% Copyright 2011-2015 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -429,6 +429,16 @@ With version~4.0 some changes have been made: dropped eventually. \end{itemize} +\subsection{Version 4.7} +\begin{itemize} + \item Fix broken \cs{iupac}. + \item Change the default subscripts of the equilibrium constants to match + the usage in the \acs{iupac} Green Book. + \item Allow \cs{NewChemPhase} and friends after \verbcode+\begin{document}+. + \item New optional argument to phase commands. + \item New \module{nmr} options n\option{method} and \option{connector}. +\end{itemize} + \section{Package Options}\label{sec:options} \chemmacros\ has several package options. They all are used as key/value pairs like @@ -577,9 +587,9 @@ non-English translations are provided. \normalfont\bfseries \pkg{translations} key & \bfseries English default \\ \midrule - K-acid & \GetTranslation{K-acid} \\ - K-base & \GetTranslation{K-base} \\ - K-water & \GetTranslation{K-water} \\ + K-acid & $\GetTranslation{K-acid}$ \\ + K-base & $\GetTranslation{K-base}$ \\ + K-water & $\GetTranslation{K-water}$ \\ \midrule phase-sld & \GetTranslation{phase-lqd} \\ phase-lqd & \GetTranslation{phase-sld} \\ @@ -595,7 +605,7 @@ non-English translations are provided. Currently this includes the following translations: \begin{sourcecode} % subscript used in \Ka: - \DeclareTranslation{German}{K-acid}{S} + \DeclareTranslation{German}{K-acid}{\mathrm{s}} % the phases \sld and \lqd: \DeclareTranslation{German}{phase-sld}{f} \DeclareTranslation{German}{phase-lqd}{f{}l} @@ -1177,15 +1187,15 @@ There is one option which changes the style the \p{} is typeset: \begin{options} \keychoice{p-style}{italics,slanted,upright}\Module{acid-base}\Default{upright} Set the style of the \p{} operator. - \keyval{K-acid}{text}\Module{acid-base}\Default{A} + \keyval{K-acid}{text}\Module{acid-base}\Default{\cs*{mathrm}\Marg{a}} The subscript to \cs{Ka} and \cs{pKa}. - \keyval{K-base}{text}\Module{acid-base}\Default{B} + \keyval{K-base}{text}\Module{acid-base}\Default{\cs*{mathrm}\Marg{b}} The subscript to \cs{Kb} and \cs{pKb}. - \keyval{K-water}{text}\Module{acid-base}\Default{W} + \keyval{K-water}{text}\Module{acid-base}\Default{\cs*{mathrm}\Marg{w}} The subscript to \cs{Kw}. - \keychoice{subscript}{lowercase,uppercase}\Module{acid-base}\Default{uppercase} - Choose\sinceversion{4.5} if the default subscript is written in lower- or - uppercase. + % \keychoice{subscript}{lowercase,uppercase}\Module{acid-base}\Default{uppercase} + % Choose\sinceversion{4.5} if the default subscript is written in lower- or + % uppercase. \end{options} \begin{example} \pH, \pKa \par @@ -1193,24 +1203,25 @@ There is one option which changes the style the \p{} is typeset: \chemsetup[acid-base]{p-style=italics} \pH, \pKa \end{example} -As\sinceversion{4.2d} you can see the default subscripts of \cs{Kw}, \cs{Ka} -and \cs{Kb} are uppercase letters. The literature is inconclusive about if -this is the right way or if lowercase letters should be preferred. In +As\changedversion{4.7} you can see the default subscripts of \cs{Kw}, \cs{Ka} +and \cs{Kb} are lowercase letters. The literature is inconclusive about if +this is the right way or if uppercase letters should be preferred. In textbooks the uppercase variant usually seems to be used while journals seem -to prefer the lowercase variant. Since I like the uppercase version better -this is the default. If you want to change this you have two possibilities: +to prefer the lowercase variant. \chemmacros' default follows the usage +in~\cite{iupac:greenbook}. If you want to change this you have two +possibilities: \begin{example} % this works only in the preamble: - % \DeclareTranslation{English}{K-acid}{a}% use your language here + % \DeclareTranslation{English}{K-acid}{\mathrm{A}}% use your language here % alternative: - \chemsetup{acid-base/K-acid=a}% overwrites language dependent settings + \chemsetup{acid-base/K-acid=\mathrm{A}}% overwrites language dependent settings \pKa \end{example} \section{Oxidation Numbers, Real and Formal Charges}\label{sec:ladungen} -\chemmacros\ distinguishes between real ($+$/$-$) and formal (\fplus/\fminus) +\chemmacros{} distinguishes between real ($+$/$-$) and formal (\fplus/\fminus) charge symbols, also see section~\ref{sec:options}. All commands using formal charge symbols start with a \code{f}. @@ -1786,6 +1797,10 @@ number of options. For historical reasons they all belong to the module The used default unit. \keychoice{nucleus}{\Marg{\meta{num},\meta{atom}}}\Module{nmr}\Default{\Marg{1,H}} The used default nucleus. + \keyval{connector}{code}\Default{-} + \sinceversion{4.7}Places \meta{code} between the nucleus and the method. + \keyval{method}{code}\Default{NMR} + \sinceversion{4.7}The measuring method. \keyval{format}{commands}\Module{nmr}\Default For example \cs*{bfseries}. \keychoice{pos-number}{side,sub,super}\Module{nmr}\Default{side} @@ -2285,6 +2300,10 @@ There are two options to customize the output: To make it complete: NaCl\aq. \end{example} +All those phase commands have an optional argument\sinceversion{4.7}: +\begin{example}[side-by-side] + \ch{H2O "\lqd[\SI{5}{\celsius}]"} +\end{example} \subsection{Define Own Phases} Depending on the subject of your document you might need to indicate other diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index c1a37af5dcd..d6d1a07b195 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -12,7 +12,7 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -% Copyright 2011-2014 Clemens Niederberger +% Copyright 2011-2015 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -27,8 +27,8 @@ % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- \RequirePackage{ expl3 , xparse , l3keys2e } -\def\chemmacros@version{4.6} -\def\chemmacros@date{2014/08/08} +\def\chemmacros@version{4.7} +\def\chemmacros@date{2015/02/08} \ProvidesExplPackage {chemmacros} @@ -1253,7 +1253,7 @@ \cs_new_protected:Nn \chemmacros_allow_hyphens: { \chemmacros_nobreak: - \skip_horizontal:n { \c_zero_dim } + \skip_horizontal:N \c_zero_dim } \dim_new:N \l__chemmacros_iupac_hyphen_pre_dim @@ -1310,25 +1310,30 @@ \char_set_catcode_active:N \| \char_set_catcode_active:N \^ -\cs_new_protected:Npn \chemmacros_iupac:n +\cs_new_protected:Npn \chemmacros_iupac:n #1 { \group_begin: \bool_set_true:N \l__chemmacros_inside_iupac_bool \chemmacros_make_iupac: \chemmacros_ignore_spaces: \cs_set_eq:NN \- \chemmacros_break_point_hyphen: - \char_set_catcode_active:N \| - \char_set_catcode_active:N \^ \chemmacros_define_deprecated:NN \| | \chemmacros_define_deprecated:NN \^ ^ - \chemmacros_iupac_aux:n - } - -\cs_new_protected:Npn \chemmacros_iupac_aux:n #1 - { - #1 + \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl + { + \char_set_catcode_active:N \| + \char_set_catcode_active:N \^ + } + {#1} + \l__chemmacros_tmpa_tl \group_end: } + +% \cs_new_protected:Npn \chemmacros_iupac_aux:n #1 +% { +% #1 +% \group_end: +% } \group_end: % Thanks to Joseph Wright and Enrico Gregorio for the help on the curious @@ -1420,31 +1425,16 @@ \tl_new:N \l__chemmacros_k_base_tl \tl_new:N \l__chemmacros_k_water_tl -\bool_new:N \l__chemmacros_subscript_lowercase_bool +% \bool_new:N \l__chemmacros_subscript_lowercase_bool \tl_set:Nn \l__chemmacros_k_acid_tl - { - \bool_if:NTF \l__chemmacros_subscript_lowercase_bool - { \tl_to_lowercase:f } - { \use:n } - { \chemmacros_translate:n { K-acid } } - } + { \chemmacros_translate:n {K-acid} } \tl_set:Nn \l__chemmacros_k_base_tl - { - \bool_if:NTF \l__chemmacros_subscript_lowercase_bool - { \tl_to_lowercase:f } - { \use:n } - { \chemmacros_translate:n { K-base } } - } + { \chemmacros_translate:n {K-base} } \tl_set:Nn \l__chemmacros_k_water_tl - { - \bool_if:NTF \l__chemmacros_subscript_lowercase_bool - { \tl_to_lowercase:f } - { \use:n } - { \chemmacros_translate:n { K-water } } - } + { \chemmacros_translate:n {K-water} } \keys_define:nn { chemmacros / acid-base } { @@ -1455,11 +1445,11 @@ K-acid .tl_set:N = \l__chemmacros_k_acid_tl , K-base .tl_set:N = \l__chemmacros_k_base_tl , K-water .tl_set:N = \l__chemmacros_k_water_tl , - subscript .choice: , - subscript / lowercase .code:n = - \bool_set_true:N \l__chemmacros_subscript_lowercase_bool , - subscript / uppercase .code:n = - \bool_set_false:N \l__chemmacros_subscript_lowercase_bool + subscript .code:n = \chemmacros_option_deprecated:n {#1} + % subscript / lowercase .code:n = + % \bool_set_true:N \l__chemmacros_subscript_lowercase_bool , + % subscript / uppercase .code:n = + % \bool_set_false:N \l__chemmacros_subscript_lowercase_bool } \cs_new_eq:NN \chemmacros_p_style:n \textup @@ -2122,6 +2112,10 @@ \leftmargin\z@ } \tl_new:N \l__chemmacros_nmr_position_tl +\tl_new:N \l__chemmacros_nmr_element_method_connector_tl +\tl_set:Nn \l__chemmacros_nmr_element_method_connector_tl {-} +\tl_new:N \l__chemmacros_nmr_method_tl +\tl_set:Nn \l__chemmacros_nmr_method_tl {NMR} \bool_new:N \l__chemmacros_nmr_coupling_nuclei_sub_bool \bool_new:N \l__chemmacros_nmr_frequency_bool @@ -2137,6 +2131,18 @@ \bool_new:N \l__chemmacros_nmr_custom_command_active_bool \bool_new:N \l__chemmacros_nmr_custom_command_used_bool +\cs_new_protected:Npn \__chemmacros_nmr_nucleus:nn #1#2 + { + \tl_gset:Nn \g__chemmacros_nmr_isotope_tl { #1 } + \tl_if_in:nnTF { #2 } { [ } + { \__chemmacros_nmr_element:w #2 \q_stop } + { + \tl_gset:No \g__chemmacros_nmr_element_tl { #2 } + \tl_gclear:N \g__chemmacros_nmr_element_coupled_tl + } + } +\cs_generate_variant:Nn \__chemmacros_nmr_nucleus:nn { VV } + \cs_new_protected:Npn \__chemmacros_nmr_nucleus:w #1,#2 \q_stop { \tl_gset:Nn \g__chemmacros_nmr_isotope_tl { #1 } @@ -2168,11 +2174,12 @@ \tl_put_right:Nn \g__chemmacros_nmr_element_coupled_tl { \} } } \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl { #2 } - \iupac { \chemmacros_superscript: { #1 } } + \iupac { ^ { #1 } } \bool_if:NTF \l__chemmacros_nmr_parse_bool { \chemformula_ch:nV {} \g__chemmacros_nmr_element_coupled_tl } { \chemmacros_atom:V \g__chemmacros_nmr_element_coupled_tl } - - NMR + \tl_use:N \l__chemmacros_nmr_element_method_connector_tl + \tl_use:N \l__chemmacros_nmr_method_tl } \cs_generate_variant:Nn \__chemmacros_nmr_base:nn { VV } @@ -2200,6 +2207,8 @@ { \__chemmacros_nmr_default_nucleus:w #1 \q_stop } , nucleus .default:n = { 1,H } , format .tl_set:N = \l__chemmacros_nmr_format_tl , + method .tl_set:N = \l__chemmacros_nmr_method_tl , + connector .tl_set:N = \l__chemmacros_nmr_element_method_connector_tl , pos-number .choice: , pos-number / sub .code:n = \tl_set:Nn \l__chemmacros_nmr_position_tl { _ } @@ -2335,9 +2344,9 @@ { \bool_set_true:N \l__chemmacros_nmr_comma_bool } \tl_if_empty:nTF { #2 } { - \__chemmacros_nmr_nucleus:w - \l__chemmacros_nmr_isotope_default_tl , - \l__chemmacros_nmr_element_default_tl \q_stop + \__chemmacros_nmr_nucleus:VV + \l__chemmacros_nmr_isotope_default_tl + \l__chemmacros_nmr_element_default_tl } { \__chemmacros_nmr_nucleus:w #2 \q_stop } \mode_if_math:TF @@ -2456,20 +2465,20 @@ \cs_new_protected:Npn \chemmacros_nmr_position:n #1 { - \chemmacros_chemformula:x - { - \exp_not:V \g__chemmacros_nmr_element_tl - \bool_if:NF \l__chemmacros_nmr_position_side_bool - { - \exp_not:V \l__chemmacros_nmr_position_tl - \exp_not:n { {#1} } - } - } - \bool_if:NT \l__chemmacros_nmr_position_side_bool + \chemmacros_chemformula:x + { + \exp_not:V \g__chemmacros_nmr_element_tl + \bool_if:NF \l__chemmacros_nmr_position_side_bool { - \tl_use:N \l__chemmacros_nmr_position_tl - \__chemmacros_nmr_position:n { #1 } + \exp_not:V \l__chemmacros_nmr_position_tl + \exp_not:n { {#1} } } + } + \bool_if:NT \l__chemmacros_nmr_position_side_bool + { + \tl_use:N \l__chemmacros_nmr_position_tl + \__chemmacros_nmr_position:n { #1 } + } } \cs_new_protected:Npn \chemmacros_nmr_coupling:w @@ -2576,9 +2585,9 @@ \tl_set:Nx \l__chemmacros_tmpa_tl { \chemmacros_remove_backslash:N #1 } \cs_if_free:NF #1 - { \msg_error:nnn { chemmacros } { new-phase } { #1 } } - \exp_args:Nx \DeclareTranslationFallback - { phase-\l__chemmacros_tmpa_tl } { #2 } + { \msg_error:nnn {chemmacros} {new-phase} {#1} } + \exp_args:Nx \@trnslt@declare@translation + { phase-\l__chemmacros_tmpa_tl } {fallback} {#2} \__chemmacros_define_phase:Nx #1 { \exp_not:N \chemmacros_translate:n @@ -2590,8 +2599,8 @@ { \tl_set:Nx \l__chemmacros_tmpa_tl { \chemmacros_remove_backslash:N #1 } - \exp_args:Nx \DeclareTranslationFallback - { phase-\l__chemmacros_tmpa_tl } { #2 } + \exp_args:Nx \@trnslt@declare@translation + { phase-\l__chemmacros_tmpa_tl } {fallback} {#2} \__chemmacros_define_phase:Nx #1 { \exp_not:N \chemmacros_translate:n @@ -2603,10 +2612,10 @@ { \tl_set:Nx \l__chemmacros_tmpa_tl { \chemmacros_remove_backslash:N #1 } - \cs_if_free:NT #1 - { \msg_error:nnn { chemmacros } { renew-phase } { #1 } } - \exp_args:Nx \DeclareTranslationFallback - { phase-\l__chemmacros_tmpa_tl } { #2 } + \cs_if_exist:NF #1 + { \msg_error:nnn {chemmacros} {renew-phase} {#1} } + \exp_args:Nx \@trnslt@declare@translation + { phase-\l__chemmacros_tmpa_tl } {fallback} {#2} \__chemmacros_define_phase:Nx #1 { \exp_not:N \chemmacros_translate:n @@ -2615,40 +2624,46 @@ } \NewDocumentCommand \NewChemPhase { mom } - { \chemmacros_new_phase:Nn #1 { #3 } } + { \chemmacros_new_phase:Nn #1 {#3} } \NewDocumentCommand \DeclareChemPhase { mom } - { \chemmacros_define_phase:Nn #1 { #3 } } + { \chemmacros_define_phase:Nn #1 {#3} } \NewDocumentCommand \RenewChemPhase { mom } - { \chemmacros_renew_phase:Nn #1 { #3 } } + { \chemmacros_renew_phase:Nn #1 {#3} } \cs_new_protected:Npn \__chemmacros_define_phase:Nn #1#2 { - \cs_if_free:NT #1 { \cs_new:Npn #1 {} } - \cs_set_protected:Npn #1 + \cs_if_exist:NF #1 { \cs_new:Npn #1 {} } + \DeclareDocumentCommand #1 { o } { \bool_if:NTF \l__chemmacros_phases_sub_bool { \bool_if:NTF \l_chemformula_inside_ch_bool - { \chemformula_subscript:n { ( #2 ) } } - { \ensuremath { \c_math_subscript_token { \text { (#2) } } } } + { \chemformula_subscript:n { ( #2 \IfNoValueF {##1} {,~##1} ) } } + { + \ensuremath + { + \c_math_subscript_token + { \text { ( #2 \IfNoValueF {##1} {,~##1} ) } } + } + } } { \ensuremath { \skip_horizontal:N \l__chemmacros_phases_space_dim - \text { (#2) } + \text { ( #2 \IfNoValueF {##1} {,~##1} ) } } } } - } + } \cs_generate_variant:Nn \__chemmacros_define_phase:Nn { Nx } -\NewChemPhase\sld{ s } -\NewChemPhase\lqd{ l } -\NewChemPhase\gas{ g } -\NewChemPhase\aq { aq } +\NewChemPhase \sld {s} +\NewChemPhase \lqd {l} +\NewChemPhase \gas {g} +\NewChemPhase \aq {aq} \cs_new_protected:Npn \chemmacros_phase:n #1 { @@ -2664,7 +2679,7 @@ } \NewDocumentCommand \phase { m } - { \chemmacros_phase:n { #1 } } + { \chemmacros_phase:n {#1} } % -------------------------------------------------------------------------- % reaction environments @@ -4063,15 +4078,14 @@ % -------------------------------------------------------------------------- % language support -- provided through `translations' % equilibrium constants: -\DeclareTranslationFallback {K-acid} {A} -\DeclareTranslation{German} {K-acid} {S} -\DeclareTranslation{Dutch} {K-acid} {Z} +\DeclareTranslationFallback {K-acid} {\mathrm{a}} +\DeclareTranslation{German} {K-acid} {\mathrm{s}} +\DeclareTranslation{Dutch} {K-acid} {\mathrm{z}} + +\DeclareTranslationFallback {K-base} {\mathrm{b}} -\DeclareTranslationFallback {K-base} {B} -% \DeclareTranslation{Dutch} {K-base} {B} +\DeclareTranslationFallback {K-water} {\mathrm{w}} -\DeclareTranslationFallback {K-water} {W} -% \DeclareTranslation{Dutch} {K-water} {W} % phases: \DeclareTranslation{German}{phase-sld}{ f } \DeclareTranslation{German}{phase-lqd}{ f{}l } @@ -4352,10 +4366,18 @@ Version history 2014/08/08 - version 4.6 - from bundle to packages: packages `chemformula', `ghsystem' and `chemgreek' no longer belong to the bundle but now are packages of their own. +2015/02/08 - version 4.7 - fix \iupac so active letters like | still work + inside other macros (\section, ...) + - Change the default subscripts of the equilibrium + constants to match the usage in the IUPAC Green + Book + - allow \NewChemPhase and friends after \begin{document} + - new optional argument to phase commands + - new options `nmr/method' and `nmr/connector' % --------------------------------------------------------------------------- % % TODO: - add d-orbitals - make electron movement arrow tips (`el', `left el' and `right el') public -- make | and ^ active inside \iupac and use them instead of \| and \^ +- phase commands with arguments (see http://texwelt.de/wissen/fragen/9264) |