diff options
author | Karl Berry <karl@freefriends.org> | 2016-05-02 22:49:31 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-05-02 22:49:31 +0000 |
commit | 9d63d20b395741946482b9029e072ae7ebff21f0 (patch) | |
tree | 26e2e930c4b2f12cf1d8a96c9958ae138d7b5ccd /Master | |
parent | 069503af305d75c1cef7a93d073495529d717229 (diff) |
chemmacros (2may16)
git-svn-id: svn://tug.org/texlive/trunk@40838 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
16 files changed, 1008 insertions, 299 deletions
diff --git a/Master/texmf-dist/doc/latex/chemmacros/README b/Master/texmf-dist/doc/latex/chemmacros/README index 8538206e38c..376b76eff0d 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/README +++ b/Master/texmf-dist/doc/latex/chemmacros/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the CHEMMACROS package v5.5 2016/03/08 +the CHEMMACROS package v5.6 2016/05/02 comprehensive support for typesetting chemistry documents 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 3865ed3c4fc..00457cd1b4b 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 9fa2be7bd79..452990b6d43 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex @@ -50,8 +50,8 @@ abinitio, activatechemgreekmapping, AddRxnDesc, anti, aq, aqi, ba, bond, bridge, cd, ch, changechemgreeksymbol, charrow, chcpd, chemabove, chemalpha, - chembeta, chemgamma, chemdelta, chemDelta, chemformula@bondlength, - ChemModule, + chembeta, ChemCleverefSupport, chemdelta, chemDelta, + ChemFancyrefSupport, chemformula@bondlength, chemgamma, ChemModule, chemomega, chemphi, chemPhi, chemsetup, chlewis, chname , cip, cis, ch, CNMR, data, DeclareChemArrow, DeclareChemBond, DeclareChemBondAlias, @@ -318,6 +318,13 @@ \newcommand*\TikZ{Ti\textit{k}Z} \newcommand*\tablehead[1]{\textrm{\bfseries#1}} +\providecommand*\XyM{% + X\kern-.30em + \smash{\raise.50ex\hbox{\char'7}}% + \kern-.30em M% +} +\providecommand*\XyMTeX{\XyM\kern-.1em\TeX} + % \NewChemPhase{\aqi}{aq,$\infty$}% aqueous solution at infinite dilution % \NewChemPhase{\cd}{cd}% condensed phase % \NewChemPhase{\lc}{lc}% liquid crystal @@ -392,10 +399,16 @@ \newcommand*\TF{\textcolor{red}{\uline{\code{\textcolor{cs}{\textit{TF}}}}}} \makeatletter +\newrobustcmd*\explcsformat[1]{% + \code{\textbackslash\textcolor{cs}{\detokenize{#1}}}% +} +\newidxcmd\explcs{\explcsformat{#1}}[ (expl3)] + +\cnltx@deflistitem{\cnltx@explcommand}{\explcs} \renewenvironment{commands} {% - \cnltx@set@catcode_{12}% \let\command\cnltx@command + \let\explcommand\cnltx@explcommand \cnltxlist } {\endcnltxlist} @@ -589,7 +602,8 @@ important and \emph{breaking} differences: and the starred version has another effect (\keyis{pos}{top}) than the same macro in earlier versions. Now the default behaviour follows \acs{iupac} recommendations. A second change is that the atom is now - treated as a \chemformula\ formula. + treated as a \chemformula\ input (this depends on the setting of the + \option{formula} option, see~\vref{sec:chemformula-module}). \item The syntax of \cs{NewChemReaction} and friends is now different from what it used to be. If you have defined your own reaction environments you need to adapt! @@ -663,7 +677,7 @@ For future versions the aim is not to make such breaking changes again. While we never know what the future actually will bring \chemmacros\ now has the tools for tying code to a version number: \begin{commands} - \expandable\command*{chemmacros_if_compatiblity:nn}[\TF\ \marg{comp} + \expandable\explcommand{chemmacros_if_compatiblity:nn}[\TF\ \marg{comp} \marg{num} \marg{true} \marg{false}] expl3 version of \cs{IfChemCompatibilityTF}. \end{commands} @@ -697,24 +711,24 @@ In modules one can try adding code for a certain version or range of versions: You may refer to the current version of \chemmacros\ with the following tokenlists: \begin{commands} - \command*{c_chemmacros_date_tl} + \explcommand{c_chemmacros_date_tl} The current release date: \enquote{\csname c_chemmacros_date_tl\endcsname}. - \command*{c_chemmacros_version_major_number_tl} + \explcommand{c_chemmacros_version_major_number_tl} The current major version: \enquote{\csname c_chemmacros_version_major_number_tl\endcsname}. - \command*{c_chemmacros_version_minor_number_tl} + \explcommand{c_chemmacros_version_minor_number_tl} The current minor version: \enquote{\csname c_chemmacros_version_minor_number_tl\endcsname}. - \command*{c_chemmacros_version_number_tl} + \explcommand{c_chemmacros_version_number_tl} The current version number: \enquote{\csname c_chemmacros_version_number_tl\endcsname}. - \command*{c_chemmacros_version_subrelease_tl} + \explcommand{c_chemmacros_version_subrelease_tl} The current sub-release: \enquote{\csname c_chemmacros_version_subrelease_tl\endcsname}. - \command*{c_chemmacros_version_tl} + \explcommand{c_chemmacros_version_tl} The current version: \enquote{\csname c_chemmacros_version_tl\endcsname}. - \command*{c_chemmacros_info_tl} + \explcommand{c_chemmacros_info_tl} The package information: \enquote{\csname c_chemmacros_info_tl\endcsname}. \end{commands} @@ -1394,16 +1408,24 @@ nucleophiles. \begin{commands} \command{NewChemParticle}[\marg{cs}\marg{formula}] Defines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\ - compound. Raises an error if \meta{cs} already exists. + input (this depends on the setting of the \option{formula} option, + see~\vref{sec:chemformula-module}). Raises an error if \meta{cs} already + exists. \command{RenewChemParticle}[\marg{cs}\marg{formula}] Redefines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\ - compound. Raises an error if \meta{cs} doesn't exist. + input (this depends on the setting of the \option{formula} option, + see~\vref{sec:chemformula-module}). Raises an error if \meta{cs} doesn't + exist. \command{DeclareChemParticle}[\marg{cs}\marg{formula}] Defines a macro \meta{cs}. \meta{formula} is any valid \chemformula\ - compound. Silently overwrites \meta{cs} if it exists. + input (this depends on the setting of the \option{formula} option, + see~\vref{sec:chemformula-module}). Silently overwrites \meta{cs} if it + exists. \command{ProvideChemParticle}[\marg{cs}\marg{formula}] Defines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\ - compound. Does nothing if \meta{cs} already exists. + input (this depends on the setting of the \option{formula} option, + see~\vref{sec:chemformula-module}). Does nothing if \meta{cs} already + exists. \end{commands} An example of usage is the definition of the existing particle macros: \begin{sourcecode} @@ -1416,20 +1438,24 @@ The following set defines macros like \cs{Nuc} \begin{commands} \command{NewChemNucleophile}[\marg{cs}\marg{formula}] Defines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\ - compound. Note that \meta{formula} will get a trailing negative charge! - Raises an error if \meta{cs} already exists. + input (this depends on the setting of the \option{formula} option, + see~\vref{sec:chemformula-module}). Note that \meta{formula} will get a + trailing negative charge! Raises an error if \meta{cs} already exists. \command{RenewChemNucleophile}[\marg{cs}\marg{formula}] Redefines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\ - compound. Note that \meta{formula} will get a trailing negative charge! - Raises an error if \meta{cs} doesn't exist. + (this depends on the setting of the \option{formula} option, + see~\vref{sec:chemformula-module}). Note that \meta{formula} will get a + trailing negative charge! Raises an error if \meta{cs} doesn't exist. \command{DeclareChemNucleophile}[\marg{cs}\marg{formula}] Defines a macro \meta{cs}. \meta{formula} is any valid \chemformula\ - compound. Note that \meta{formula} will get a trailing negative charge! - Silently overwrites \meta{cs} if it exists. + (this depends on the setting of the \option{formula} option, + see~\vref{sec:chemformula-module}). Note that \meta{formula} will get a + trailing negative charge! Silently overwrites \meta{cs} if it exists. \command{ProvideChemNucleophile}[\marg{cs}\marg{formula}] Defines a new macro \meta{cs}. \meta{formula} is any valid \chemformula\ - compound. Note that \meta{formula} will get a trailing negative charge! - Does nothing if \meta{cs} already exists. + (this depends on the setting of the \option{formula} option, + see~\vref{sec:chemformula-module}). Note that \meta{formula} will get a + trailing negative charge! Does nothing if \meta{cs} already exists. \end{commands} An example of usage is the definition of the existing nucleophile macros: \begin{sourcecode} @@ -1574,40 +1600,40 @@ modules. In the macro descriptions below \TF\ denotes that a \code{T}, an \code{F} and a \code{TF} variant exist. In case of an expandable conditional (\expandablesymbol) also the predicate variant is available. \begin{commands} - \expandable\command*{chemmacros_if_loaded:nn}[\TF\ + \expandable\explcommand{chemmacros_if_loaded:nn}[\TF\ \Marg{package|class} \marg{name} \marg{true} \marg{false}] Checks if package (or class) \meta{name} has been loaded. Also works after begin document. - \expandable\command*{chemmacros_if_package_loaded:n}[\TF\ \marg{name} + \expandable\explcommand{chemmacros_if_package_loaded:n}[\TF\ \marg{name} \marg{true} \marg{false}] Checks if package \meta{name} has been loaded. Also works after begin document. - \expandable\command*{chemmacros_if_class_loaded:n}[\TF\ \marg{name} + \expandable\explcommand{chemmacros_if_class_loaded:n}[\TF\ \marg{name} \marg{true} \marg{false}] Checks if class \meta{name} has been loaded. Also works after begin document. - \command*{chemmacros_leave_vmode:} + \explcommand{chemmacros_leave_vmode:} Equivalent of \cs*{leavevmode}. - \command*{chemmacros_nobreak:} + \explcommand{chemmacros_nobreak:} Inserts a penalty of \num{10000}. - \command*{chemmacros_allow_break:} + \explcommand{chemmacros_allow_break:} Inserts a penalty of \num{0}. - \command*{chemmacros_skip_nobreak:N}[ \meta{skip/length variable}] + \explcommand{chemmacros_skip_nobreak:N}[ \meta{skip/length variable}] Insert a horizontal skip where a linebreak is disallowed. - \expandable\command*{chemmacros_if_is_int:n}[\TF\ \marg{input} \marg{true} + \expandable\explcommand{chemmacros_if_is_int:n}[\TF\ \marg{input} \marg{true} \marg{false}] Checks if \meta{input} is an integer or something else. - \command*{chemmacros_if_bold:}[\TF\ \marg{true} \marg{false}] + \explcommand{chemmacros_if_bold:}[\TF\ \marg{true} \marg{false}] Checks if the current font weight is one of \chemboldchecks{or}. - \command*{chemmacros_bold:n}[ \marg{text}] + \explcommand{chemmacros_bold:n}[ \marg{text}] Checks if the current font weight is bold and if yes places \meta{text} in \cs*{textbf} if in text mode or in \cs*{bm} if in math mode. If no \meta{text} simply is placed in the input stream as is. - \command*{chemmacros_text:n}[ \marg{text}] + \explcommand{chemmacros_text:n}[ \marg{text}] Ensures that \meta{text} is placed in text mode. - \command*{chemmacros_math:n}[ \marg{text}] + \explcommand{chemmacros_math:n}[ \marg{text}] Ensures that \meta{text} is placed in math mode. - \command*{chemmacros_new_macroset:nnn}[ \marg{name} \marg{arg spec} + \explcommand{chemmacros_new_macroset:nnn}[ \marg{name} \marg{arg spec} \marg{internal command call}] \changedversion{5.3b}A command to define a set of macros \cs*{NewChem\meta{name}}, \cs*{RenewChem\meta{name}}, @@ -1620,14 +1646,33 @@ modules. In the macro descriptions below \TF\ denotes that a \code{T}, an checks, \ie, define new macros or redefine existing ones like \cs*{def} does. This macro just should get the arguments passed on to. Have a look at the example below. - \command*{chemmacros_new_environment_macroset:nnn}[ \marg{name} \marg{arg spec} + \explcommand{chemmacros_new_environment_macroset:nnn}[ \marg{name} \marg{arg spec} \marg{internal command call}] - Like \cs*{chemmacros_new_macroset:nnn} but for environments. + Like \explcs{chemmacros_new_macroset:nnn} but for environments. \command{NewChemMacroset}[\sarg\marg{name}\marg{arg spec}\marg{internal command call}] - A non-expl3 version of \cs*{chemmacros_new_macroset:nnn} for \LaTeXe\ + A non-expl3 version of \explcs{chemmacros_new_macroset:nnn} for \LaTeXe\ programmers. The starred version calls - \cs*{chemmacros_new_environment_macroset:nnn}. + \explcs{chemmacros_new_environment_macroset:nnn}. + \explcommand{chemmacros_add_cleveref_support:nnnnn}[ \marg{counter} + \marg{singular} \marg{plural} \marg{uppercase singular} \marg{uppercase + plural}] + A\sinceversion{5.6} command to add suiting names for a counter for the + \pkg{cleveref} package's \cs*{cref} commands. This command acts at the + end of the preamble and only if a user hasn't provided definitions with + \cs*{crefname} already. + \command{ChemCleverefSupport}[\marg{counter}\marg{singular}\oarg{uppercase + singular}\marg{plural}\oarg{uppercase plural}] + \sinceversion{5.6}\LaTeXe-version of + \explcs{chemmacros_add_cleveref_support:nnnnn}. + \explcommand{chemmacros_add_fancyref_support:nnn}[ \marg{prefix} \marg{name} + \marg{uppercase name}] + A\sinceversion{5.6} command to add suiting names for a counter for the + \pkg{fancyref} package's \cs*{fref} commands. This command acts at the + end of the preamble and doesn't override definitions made by the users. + \command{ChemFancyrefSupport}[\marg{prefix}\marg{name}\oarg{uppercase name}] + \sinceversion{5.6}\LaTeXe-version of + \explcs{chemmacros_add_fancyref_support:nnnnn}. \end{commands} This is how the macros \cs{NewChemParticle}, \cs{RenewChemParticle}, \cs{DeclareChemParticle} and \cs{ProvideChemParticle} were defined: @@ -1639,24 +1684,24 @@ This is how the macros \cs{NewChemParticle}, \cs{RenewChemParticle}, The following macros strictly speaking are not provided by the \chemmodule{base} module but this place fits best for their description. \begin{commands} - \expandable\command*{chemmacros_if_module_exist:n}[\TF\ \marg{module} + \expandable\explcommand{chemmacros_if_module_exist:n}[\TF\ \marg{module} \marg{true} \marg{false}] Checks if a file with the correct name for a module \meta{module} can be found. - \expandable\command*{chemmacros_if_module_loaded:n}[\TF\ \marg{module} + \expandable\explcommand{chemmacros_if_module_loaded:n}[\TF\ \marg{module} \marg{true} \marg{false}] Checks if the module \meta{module} has already been loaded or not. - \command*{chemmacros_load_module:n}[ \marg{module}] + \explcommand{chemmacros_load_module:n}[ \marg{module}] Loads module \meta{module} if it hasn't been loaded, yet. - \command*{chemmacros_load_modules:n}[ \marg{csv list of modules}] + \explcommand{chemmacros_load_modules:n}[ \marg{csv list of modules}] Loads every module in \meta{csv list of modules} if they haven't been loaded, yet. This is the code level variant of \cs{usechemmodule}. - \command*{chemmacros_before_module:nn}[ \marg{module} \marg{code}] + \explcommand{chemmacros_before_module:nn}[ \marg{module} \marg{code}] Saves\sinceversion{5.1} \meta{code} and inserts it right before \meta{module} is loaded. If \meta{module} is never loaded then \meta{code} is never inserted. If \meta{module} already is loaded when the command is used then \meta{code} also is never inserted. - \command*{chemmacros_after_module:nn}[ \marg{module} \marg{code}] + \explcommand{chemmacros_after_module:nn}[ \marg{module} \marg{code}] Saves\sinceversion{5.1} \meta{code} and inserts it right after \meta{module} is loaded. If \meta{module} is never loaded then \meta{code} is never inserted. If \meta{module} already is loaded when @@ -1665,28 +1710,51 @@ The following macros strictly speaking are not provided by the \subsection{The \chemmodule*{chemformula} Module}\label{sec:chemformula-module} -The \chemmodule{chemformula} module loads the \pkg{chemformula} -package~\cite{pkg:chemformula} or the \pkg{mhchem} package~\cite{pkg:mhchem} -and the \pkg{amstext} package~\cite{pkg:amstext}. It also loads the -\chemmodule{charges} module. +The \chemmodule{chemformula} module loads the \pkg{amstext} +package~\cite{pkg:amstext} and the \chemmodule{charges} module. \subsubsection{For Users} +There are different packages which provide means for typesetting chemical +formulas: +\begin{itemize} + \item \pkg{chemformula}~\cite{pkg:chemformula}. This is probably well known + to users of \chemmacros. + \item \pkg{mhchem}~\cite{pkg:mhchem}. This is the \enquote{older brother} of + \chemformula. + \item \pkg{chemfig}~\cite{pkg:chemfig}. The easiest and most complete of the + packages for drawing skeletal formulas. + \item \XyMTeX~\cite{pkg:xymtex}. A very comprehensive alternative for + typesetting chemistry. +\end{itemize} +In order to help authors getting a consistent layout \chemmacros\ does not +make a choice which package to use for typesetting formulas. Although +\chemformula\ is well tested and preferred users can choose other packages if +they like. -This module provides a general option: +this is done with the following general option: \begin{options} - \keychoice{formula}{chemformula,mhchem}\Default{chemformula} - This\sinceversion{5.1} option let's you choose if chemical formula's are - typeset using \pkg{chemformula}'s \cs{ch} and \cs{chcpd} or \pkg{mhchem}'s - \cs{ce}. The corresponding package is loaded. + \keyval{formula}{method}\Default{chemformula} + This\sinceversion{5.1} option let's you choose how chemical formulas are + typeset. Available methods are + \begin{itemize} + \item \pkg{chemformula} + \item \pkg{mhchem} + \item \pkg{chemist}\sinceversion{5.6} (from the \XyMTeX\ bundle) + \item \pkg{chemfig}\sinceversion{5.6} + \end{itemize} + The corresponding package with the same name is loaded. \end{options} If you explicitly set this option the corresponding package is loaded -immediately. Otherwise the option is set at the end of the preamble. +immediately and the method is set up. Otherwise the option will be set by +\chemmacros\ at the end of the preamble. -If\sinceversion{5.2} you load either \pkg{mhchem} or \pkg{chemformula} and -haven't set \option{formula} \chemmacros\ will choose the corresponding -package. If you have loaded both \pkg{mhchem} and \pkg{chemformula} -\chemmacros\ will raise a warning and choose \pkg{chemformula}. \emph{All - automatic choices only happen at the end of the preamble}. +If\sinceversion{5.2} you load a method package in a way that a unique choice +is possible then \chemmacros\ will set the method accordingly if you haven't +set the option by yourself. If \emph{no} unique choice is possible +\chemmacros\ will raise a warning and choose \pkg{chemformula} regardless if +the package is loaded or not. In this case if you want to use another method +you'll have to choose manually. \emph{All automatic choices only happen at the + end of the preamble}. \paragraph{Using the \pkg*{chemformula} Package} If you set \keyis{formula}{chemformula} the \chemmodule{chemformula} module @@ -1700,7 +1768,9 @@ Everywhere where \chemmacros\ typesets chemical formulas \chemformula's macros \cs{chcpd} or \cs{ch} are used, for example in the reaction environments provided by the \chemmodule{reactions} module. -\paragraph{Using the \pkg*{mhchem} Package}\label{sec:using-mhchem} +\emph{This method is the recommended choice!} + +\paragraph{Using the \pkg*{mhchem} Package}\sinceversion{5.1}\label{sec:using-mhchem} If you set \keyis{formula}{mhchem} the \chemmodule{chemformula} module makes it possible that you can set all of \pkg{mhchem}'s options via the \cs{chemsetup} command using the module \module{mhchem}, for example: @@ -1712,7 +1782,7 @@ Everywhere where \chemmacros\ typesets chemical formulas \pkg{mhchem}'s macro \cs{ce} is used, for example in the reaction environments provided by the \chemmodule{reactions} module. -There are a few \latin{caveat}s if you use this method: +There are some \latin{caveat}s if you use this method: \begin{itemize} \item This method has not been extensively tested, yet. There may be errors and wrong output at unexpected places. @@ -1727,17 +1797,59 @@ There are a few \latin{caveat}s if you use this method: \chemmacros' mechanism). \end{itemize} +\paragraph{Using the \pkg*{chemfig} Package}\sinceversion{5.6}\label{sec:using-chemfig} +Everywhere where \chemmacros\ typesets chemical formulas \pkg{chemfig}'s macro +\cs{printatom} is used, for example in the reaction environments provided by +the \chemmodule{reactions} module. + +There are some \latin{caveat}s if you use this method: +\begin{itemize} + \item This method has not been extensively tested, yet. There may be errors + and wrong output at unexpected places. + \item Using this method effectively disables the different values of the + \module{particles} option \option{elpair} (see + section~\ref{sec:particles-module}). + \item The different kinds of formal charges provided by the + \chemmodule{charges} module (see section~\ref{sec:ion-charges}) are + disabled. Formal charges always use the math method now. + \item The reaction environments by the \chemmodule{reactions} module may + work only to a limited respect. If you plan to use them consider using + methods \pkg{chemformula} or \pkg{mhchem} instead. +\end{itemize} + +\paragraph{Using the \pkg*{chemist} Package}\sinceversion{5.6}\label{sec:using-chemist} +Everywhere where \chemmacros\ typesets chemical formulas \pkg{chemist}'s macro +\cs{ChemForm} is used, for example in the reaction environments provided by +the \chemmodule{reactions} module. + +There are some \latin{caveat}s if you use this method: +\begin{itemize} + \item This method has not been extensively tested, yet. There may be errors + and wrong output at unexpected places. + \item Using this method effectively disables the different values of the + \module{particles} option \option{elpair} (see + section~\ref{sec:particles-module}). + \item The different kinds of formal charges provided by the + \chemmodule{charges} module (see section~\ref{sec:ion-charges}) are + disabled. Formal charges always use the math method now. + \item The reaction environments by the \chemmodule{reactions} module may + work only to a limited respect. If you plan to use them consider using + methods \pkg{chemformula} or \pkg{mhchem} instead\footnote{On the other + hand \XyMTeX\ (and especially the \pkg{chemist} package) provides quite + a number of chemical reaction environments itself.}. +\end{itemize} + \subsubsection{For Module Writers} -There's are two macros for module writers: +There are two macros for module writers: \begin{commands} - \command*{chemmacros_chemformula:n}[ \marg{formula}] + \explcommand{chemmacros_chemformula:n}[ \marg{formula}] This is only a wrapper for \cs{chcpd} or \cs{ce}. It is recommended that module writers use this macro (or a variant thereof) inside of \chemmacros' macros whenever they want to display a chemical formula. Writers who prefer traditional \LaTeXe\ programming over expl3 should use \cs*{chemmacros@formula}. - \command*{chemmacros_reaction:n}[ \marg{reaction}] + \explcommand{chemmacros_reaction:n}[ \marg{reaction}] This is only a wrapper for \cs{ch} or \cs{ce}. It is recommended that module writers use this macro (or a variant thereof) inside of \chemmacros' macros whenever they want to display a chemical reaction. @@ -1814,18 +1926,38 @@ translation keys are listed in section~\vref{sec:avail-transl-keys}. \subsubsection{Available Translation Keys}\label{sec:avail-transl-keys} Table~\vref{tab:translation-keys} lists (almost) all keys which are predefined -in \chemmacros. A translation key is a key which is understood by the -\pkg{translations} package and its commands like \cs*{GetTranslation}. For -each key at least the English fallback translation is provided, for most also -the German translation is provided. For a few keys also other translations -are provided. If you find that a translation for your language is missing you -can provide it in the preamble: +in \chemmacros. \emph{Some of the translations have changed in + version~5.6\changedversion{5.6}.} The \chemmodule{lang} doesn't provide the +translations themselves -- they are provided by the corresponding modules. A +translation key is a key which is understood by the \pkg{translations} package +and its commands like \cs*{GetTranslation}. For each key at least the English +fallback translation is provided, for most also the German translation is +provided. For a few keys also other translations are provided. If you find +that a translation for your language is missing you can provide it in the +preamble: \begin{commands} - \command*{DeclareTranslation}[\marg{language}\marg{key}\marg{translation}] + \command{DeclareTranslation}[\marg{language}\marg{key}\marg{translation}] Defines a translation of key \meta{key} for the language \meta{language}. No error will be raised if a translation of \meta{key} already exists. This command can only be used in the preamble and is defined by the \pkg{translations} package. + \command{DeclareChemTranslation}[\marg{language}\marg{key}\marg{translation}] + \sinceversion{5.6}A command which makes an abstraction from the + \pkg{translations} package. It should be used in documents for adding + missing translations that are needed. This command can only be used in + the preamble. + \command{DeclareChemTranslations}[\marg{key}\Marg{\meta{language} = + \meta{translation}}] + \sinceversion{5.6}A command rather meant for module writers but can be + used by document authors as well, of course. It gets a csv list of + key\slash value pairs of translations. This command can only be used in + the preamble. + \explcommand{chemmacros_declare_translation:nnn}[\marg{language}\marg{key}% + \marg{translation}] + The expl3 version of \cs{DeclareChemTranslation}. + \explcommand{chemmacros_declare_translations:nn}[\marg{key}\Marg{\meta{language} = + \meta{translation}}] + The expl3 version of \cs{DeclareChemTranslations}. \end{commands} If you send me an email (see section~\vref{sec:sugg-bug-reports}) with the translations for your language I'll gladly add them to the next release of @@ -1850,6 +1982,10 @@ translations for your language I'll gladly add them to the next release of \midrule \showtranslations{scheme-name} \\ \showtranslations{scheme-list} \\ + \showtranslations{Scheme} \\ + \showtranslations{scheme} \\ + \showtranslations{Schemes} \\ + \showtranslations{schemes} \\ \showtranslations{K-acid} \\ \showtranslations{K-base} \\ \showtranslations{K-water} \\ @@ -1858,7 +1994,10 @@ translations for your language I'll gladly add them to the next release of \showtranslations{phase-gas} \\ \showtranslations{phase-aq} \\ \showtranslations{list-of-reactions} \\ + \showtranslations{Reaction} \\ \showtranslations{reaction} \\ + \showtranslations{Reactions} \\ + \showtranslations{reactions} \\ \bottomrule \end{tabular} \end{table} @@ -1866,16 +2005,16 @@ translations for your language I'll gladly add them to the next release of \subsubsection{Information For Module Writers} \begin{commands} - \expandable\command*{chemmacros_translate:n}[ \marg{translation key}] + \expandable\explcommand{chemmacros_translate:n}[ \marg{translation key}] Translates the given key to the language which is detected automatically or given by the user. Should be used in \chemmacros' macros instead of \pkg{translations}' \cs*{GetTranslation}. - \command*{l_chemmacros_language_tl} + \explcommand{l_chemmacros_language_tl} A token list variable that holds the language which is used by - \cs*{chemmacros_translate:n} for translation, \emph{after begin + \explcs{chemmacros_translate:n} for translation, \emph{after begin document}. \command{ChemTranslate}[\marg{translation key}] - A version of \cs*{chemmacros_translate:n} for those who prefer + A version of \explcs{chemmacros_translate:n} for those who prefer traditional \LaTeXe\ programming over expl3. \end{commands} @@ -2283,8 +2422,9 @@ The use of \AmS math's \cs{intertext} is possible: See reaction~\ref{rxn:test}. \end{example} -% \emph{You should not use \cs{mch} and its relatives inside the \env{reaction} -% environments.} +If\sinceversion{5.6} you are using either \pkg{cleveref} or \pkg{fancyref} the +\env{scheme} environment (or rather its captions) are supported already. For +\pkg{fancyref} use the prefix \code{rct}. \subsubsection{Own Reactions} You can create new types of reactions with the command: @@ -2360,6 +2500,13 @@ The output of this list can be modified by two options: Inside of \meta{code} \code{\#1} refers to the actual heading of the list. The default setting is not entirely true: if a macro \cs*{chapter} is defined \code{\cs*{chapter}\sarg\Marg{\#1}} is used. + \keybool{tocbasic}\Module{reactions}\Default{false} + \sinceversion{5.6}If you use a \KOMAScript\ class \emph{or} if you load + the \pkg{tocbasic} package \emph{or} if you set this option to \code{true} + the list of reactions will be set up using the \pkg{tocbasic} package. + This \emph{disables} the \option{list-heading-cmd} option. For a + \KOMAScript\ class this means that the list of reactions obeys + \KOMAScript's \option*{listof} option. \end{options} Instead of using the option \option{list-name} you also could redefine \cs{reactionlistname}. @@ -2412,7 +2559,8 @@ The following command is provided to set oxidation numbers: \command{ox}[\sarg\oarg{options}\Marg{\meta{number},\meta{atom}}] Places \meta{number} as right superscript to \meta{atom}; \meta{number} has to be a (rational) number! \meta{atom} is treated as a \chemformula\ - formula, like it would be in \cs{chcpd}. + formula, like it would be in \cs{chcpd} (this depends on the setting of + the \option{formula} option, see~\vref{sec:chemformula-module}). \end{commands} \begin{example} @@ -2648,6 +2796,10 @@ The list of schemes is printed as expected with \command{listofschemes} \end{commands} +If\sinceversion{5.6} you are using either \pkg{cleveref} or \pkg{fancyref} the +\env{scheme} environment (or rather its captions) are supported already. For +\pkg{fancyref} use the prefix \code{sch}. + \subsection{The \chemmodule*{spectroscopy} Module}\label{sec:spectroscopy-module} The \chemmodule{spectroscopy} module loads the \chemmodule{chemformula} module @@ -2668,7 +2820,9 @@ input. \Darg{\meta{num},\meta{unit}}\oarg{solvent}] Typeset nuclear magnetic resonance data. \meta{num} is a valid \pkg{siunitx} number input, \meta{unit} is a valid \pkg{siunitx} unit - input. \meta{solvent} is any valid \chemformula\ input as in \cs{chcpd}. + input. \meta{solvent} is any valid \chemformula\ input as in \cs{chcpd} + (this depends on the setting of the \option{formula} option, + see~\vref{sec:chemformula-module}). \end{commands} \emph{All} Argument are optional! Without arguments we get: @@ -2813,7 +2967,8 @@ number of options. For historical reasons they all belong to the module Horizontal\sinceversion{5.3} space inserted between number and atom (printed by \cs{\#}). \keybool{parse}\Module{spectroscopy}\Default{true} - Treat the solvent as \chemformula\ formula or not. + Treat the solvent as \chemformula\ formula (this depends on the setting of + the \option{formula} option, see~\vref{sec:chemformula-module}) or not. \keyval{delta}{tokens}\Module{spectroscopy}\Default The \meta{tokens} are added after $\delta$. \keybool{list}\Module{spectroscopy}\Default{false} @@ -3295,28 +3450,26 @@ functions. This allows to use expl3's powerful function variants for expansion control. \begin{commands} - \command*{c_chemmacros_other_colon_tl} + \explcommand{c_chemmacros_other_colon_tl} A constant tokenlist which contains a colon with category code~12 (other). This is useful since \TikZ\ sometimes expects an other colon and in an expl3 programming environment \code{:} has category code~11 (letter). - \command*{chemmacros_tikz_picture:nn}[ \marg{options} \marg{code}] + \explcommand{chemmacros_tikz_picture:nn}[ \marg{options} \marg{code}] Defined as \verbcode+\tikzpicture[{#1}] #2 \endtikzpicture+. - \command*{chemmacros_tikz:nn}[ \marg{options} \marg{code}] + \explcommand{chemmacros_tikz:nn}[ \marg{options} \marg{code}] Defined as \verbcode+\tikz[{#1}]{#2}+. - \command*{chemmacros_tikz_draw:n}[ \marg{options}] + \explcommand{chemmacros_tikz_draw:n}[ \marg{options}] Defined as \verbcode+\draw[{#1}]+. - \command*{chemmacros_tikz_node:n}[ \marg{options}] + \explcommand{chemmacros_tikz_node:n}[ \marg{options}] Defined as \verbcode+\node[{#1}]+. - \command*{chemmacros_tikz_shade:n}[ \marg{options}] + \explcommand{chemmacros_tikz_shade:n}[ \marg{options}] Defined as \verbcode+\shade[{#1}]+. - \command*{chemmacros_tikz_shadedraw:n}[ \marg{options}] + \explcommand{chemmacros_tikz_shadedraw:n}[ \marg{options}] Defined as \verbcode+\shadedraw[{#1}]+. - \command*{chemmacros_tikz_node_in_draw:n}[ \marg{options}] + \explcommand{chemmacros_tikz_node_in_draw:n}[ \marg{options}] Defined as \verbcode+node[{#1}]+. \end{commands} -% TODO - \subsection{The \chemmodule*{xfrac} Module}\label{sec:xfrac-module} The \chemmodule{xfrac} module loads the package @@ -3438,13 +3591,13 @@ options you want to be able to set using \cs{chemsetup}\Oarg{foo}\marg{options} please make sure you define (and set) them with the following macros: \begin{commands} - \command*{chemmacros_define_keys:nn}[ \marg{module} \marg{key definitions}] + \explcommand{chemmacros_define_keys:nn}[ \marg{module} \marg{key definitions}] Define l3keys options for the module \meta{module}. This is a wrapper for - \cs*{keys_define:nn} \Marg{chemmacros/\meta{module}} \marg{key + \explcs*{keys_define:nn} \Marg{chemmacros/\meta{module}} \marg{key definitions}. - \command*{chemmacros_set_keys:nn}[ \marg{module} \marg{input}] + \explcommand{chemmacros_set_keys:nn}[ \marg{module} \marg{input}] Sets l3keys options for the module \meta{module}. This is a wrapper for - \cs*{keys_set:nn} \Marg{chemmacros/\meta{module}} \marg{input}. + \explcs*{keys_set:nn} \Marg{chemmacros/\meta{module}} \marg{input}. \end{commands} Also (\emph{especially if you consider submitting the module, see section~\vref{sec:submitting-module}}) please follow the expl3 naming diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.acid-base.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.acid-base.code.tex index 2bb4a557d6e..28ffe5d485f 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.acid-base.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.acid-base.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{acid-base}{2016/02/04 acid/base} +\ChemModule{acid-base}{2016/04/27 acid/base} \chemmacros_load_modules:n {charges} @@ -137,5 +137,41 @@ } % -------------------------------------------------------------------------- +\ChemCompatibilityTo{5.5} +\DeclareTranslation {English} {K-acid} {\mathrm{a}} +\DeclareTranslation {German} {K-acid} {\mathrm{s}} +\DeclareTranslation {Dutch} {K-acid} {\mathrm{z}} + +\DeclareTranslation {English} {K-base} {\mathrm{b}} + +\DeclareTranslation {English} {K-water} {\mathrm{w}} +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\chemmacros_declare_translations:nn {K-acid} + { + fallback = \mathrm {a} , + English = \mathrm {a} , + German = \mathrm {s} , + Dutch = \mathrm {z} + } + +\chemmacros_declare_translations:nn {K-base} + { + fallback = \mathrm {b} , + English = \mathrm {b} , + German = \mathrm {b} + } + +\chemmacros_declare_translations:nn {K-water} + { + fallback = \mathrm {w} , + English = \mathrm {w} , + German = \mathrm {w} + } +\EndChemCompatibility +% -------------------------------------------------------------------------- \tex_endinput:D + 2016/02/04 - \NewChemEqConstant and family, new option `eq-constant' +2016/04/27 - moved translations from lang module to acid-base module diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.base.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.base.code.tex index 1cfdfaf7a30..158bb962b70 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.base.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.base.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{base}{2016/02/09 basic chemmacros module} +\ChemModule{base}{2016/04/25 basic chemmacros module} % for the document hooks \ChemCompatibilityFrom{5.1} @@ -244,6 +244,121 @@ } \EndChemCompatibility +\ChemCompatibilityFrom{5.6} +\cs_new_protected:Npn \chemmacros_cs_if_free_new:Npn #1 + { + \cs_if_exist:NF #1 + { \cs_new:Npn #1 } + } +\cs_generate_variant:Nn \chemmacros_cs_if_free_new:Npn {c} + +\cs_new_protected:Npn \chemmacros_cs_if_free_new_protected:Npn #1 + { + \cs_if_exist:NF #1 + { \cs_new_protected:Npn #1 } + } +\cs_generate_variant:Nn \chemmacros_cs_if_free_new_protected:Npn {c} + +% #1: counter +% #2: singular +% #3: plural +% #4: Singular +% #5: Plural +\cs_new_protected:Npn \chemmacros_add_cleveref_support:nnnnn #1#2#3#4#5 + { + \AfterEndPreamble + { + \chemmacros_if_package_loaded:nT {cleveref} + { + \cs_if_exist:cF {cref@#1@name} + { + \crefname {#1} {#2} {#3} + \Crefname {#1} {#4} {#5} + } + } + } + } +\cs_generate_variant:Nn \chemmacros_add_cleveref_support:nnnnn {nnnx , nnnxx , nnnnx } + +% #1: counter +% #2: singular +% #3: Singular (optional) +% #4: plural +% #5: Plural (optional) +\NewDocumentCommand \ChemCleverefSupport {mmomo} + { + \IfNoValueTF {#3} + { + \IfNoValueTF {#5} + { + \chemmacros_add_cleveref_support:nnnnn + {#1} + {#2} + {#4} + { \tl_mixed_case:n {#2} } + { \tl_mixed_case:n {#4} } + } + { + \chemmacros_add_cleveref_support:nnnnn + {#1} + {#2} + {#4} + { \tl_mixed_case:n {#2} } + {#5} + } + } + { + \IfNoValueTF {#5} + { + \chemmacros_add_cleveref_support:nnnnn + {#1} + {#2} + {#4} + {#3} + { \tl_mixed_case:n {#4} } + } + { \chemmacros_add_cleveref_support:nnnnn {#1} {#2} {#4} {#3} {#5} } + } + } +\@onlypreamble\ChemCleverefSupport + +% #1: id +% #2: mid sentence +% #3: begin sentence +\cs_new_protected:Npn \chemmacros_add_fancyref_support:nnn #1#2#3 + { + \AfterEndPreamble + { + \chemmacros_if_package_loaded:nT {fancyref} + { + \chemmacros_cs_if_free_new:cpn {fancyref#1labelprefix} {#1} + \chemmacros_cs_if_free_new:cpn {fref#1name} {#2} + \chemmacros_cs_if_free_new:cpn {Fref#1name} {#3} + \exp_args:Nnx \frefformat {vario} { \exp_not:c {fancyref#1labelprefix} } + { \use:c {fref#1name} \fancyrefdefaultspacing ##1##3 } + \exp_args:Nnx \Frefformat {vario} { \exp_not:c {fancyref#1labelprefix} } + { \use:c {Fref#1name} \fancyrefdefaultspacing ##1##3 } + \exp_args:Nnx \frefformat {plain} { \exp_not:c {fancyref#1labelprefix} } + { \use:c {fref#1name} \fancyrefdefaultspacing ##1 } + \exp_args:Nnx \Frefformat {plain} { \exp_not:c {fancyref#1labelprefix} } + { \use:c {Fref#1name} \fancyrefdefaultspacing ##1 } + } + } + } +\cs_generate_variant:Nn \chemmacros_add_fancyref_support:nnn {nnx} + +% #1: id +% #2: mid sentence +% #3: begin sentence (optional) +\NewDocumentCommand \ChemFancyrefSupport {mmo} + { + \IfNoValueTF {#3} + { \chemmacros_add_fancyref_support:nnn {#1} {#2} { \tl_mixed_case:n {#3} } } + { \chemmacros_add_fancyref_support:nnn {#1} {#2} {#3} } + } +\@onlypreamble\ChemFancyrefSupport +\EndChemCompatibility + % -------------------------------------------------------------------------- % some checks at begin document: \bool_new:N \l__chemmacros_in_document_bool @@ -359,3 +474,5 @@ 2015/10/14 - load `errorcheck' module 2016/02/09 - starred version of \NewChemMacroset 2016/03/07 - \chemmacros_define_keys:nn and friends +2016/04/25 - macros for cleveref and fancyref support, \ChemCleverefSupport + \ChemFancyrefSupport diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.chemformula.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.chemformula.code.tex index f9bddf7f04f..e15bc518d6a 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.chemformula.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.chemformula.code.tex @@ -25,15 +25,14 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{chemformula}{2015/10/13 integration of chemical formulas} +\ChemModule{chemformula}{2016/04/27 integration of chemical formulas} \RequirePackage{amstext} \chemmacros_load_module:n {charges} \msg_new:nnn {chemmacros} {unknown-formula-method} { - You~ chose~ the~ formula~ method~ `#1'~ which~ is~ not~ available.~ Valid~ - methods~ are~ (the~ recommended~ choice)~ `chemformula'~ and~ `mhchem'.~ + You~ chose~ the~ formula~ method~ `#1'~ which~ is~ not~ available.~ I'm~ falling~ back~ to~ `chemformula'~ now. } @@ -45,61 +44,156 @@ \msg_new:nnn {chemmacros} {formula-conflict} { - You~ have~ loaded~ both~ `mhchem'~ and~ `chemformula'!~ You~ should~ - decide~ for~ only~ one~ of~ both~ packages~ for~ having~ a~ consistent~ - layout.~ I~ will~ use~ `chemformula'. + You~ have~ loaded~ multiple~ formula~ method~ packages~ but~ haven't~ + chosen~ which~ method~ to~ use!~ I~ will~ use~ `chemformula'. \\ + You~ should~ decide~ for~ only~ one~ of~ the~ packages~ for~ having~ a~ + consistent~ layout. } +% -------------------------------------------------------------------------- +% generic functions for usage in other packages; those are to be set in each +% method setup: +\cs_new_protected:Npn \chemmacros_reaction:n #1 {#1} +\cs_new_protected:Npn \chemmacros_chemformula:n #1 {#1} +\cs_generate_variant:Nn \chemmacros_chemformula:n { x,V } + +\cs_new_protected:Npn \chemmacros@formula #1 { \chemmacros_chemformula:n {#1} } +\cs_new_protected:Npn \chemmacros@reaction #1 { \chemmacros_reaction:n {#1} } + +% -------------------------------------------------------------------------- +% setup, check and define each method: \bool_new:N \l__chemmacros_formula_method_set_bool \tl_new:N \g_chemmacros_formula_method_tl \tl_gset:Nn \g_chemmacros_formula_method_tl {chemformula} -\cs_new_protected:Npn \chemmacros_set_formula_method:n #1 +\prop_new:N \l__chemmacros_method_packages_prop + +% #1: package/method name +% #2: preparations +\cs_new_protected:Npn \chemmacros_add_method_package:nn #1#2 + { \prop_put:Nnn \l__chemmacros_method_packages_prop {#1} {#2} } + +\cs_new_protected:Npn \chemmacros_setup_method_package:n #1 + { + \prop_item:Nn \l__chemmacros_method_packages_prop {#1} + \tl_gset:Nn \g_chemmacros_formula_method_tl {#1} + } + +\prg_new_conditional:Npnn \chemmacros_if_method_package:n #1 {p,T,F,TF} + { + \prop_if_in:NnTF \l__chemmacros_method_packages_prop {#1} + { \prg_return_true: } + { \prg_return_false: } + } + +\cs_new_protected:Npn \chemmacros_check_formula_method: { \bool_if:NF \l__chemmacros_formula_method_set_bool { - \str_case:nnTF {#1} + \bool_set_false:N \l__chemmacros_tmpa_bool + \prop_map_inline:Nn \l__chemmacros_method_packages_prop { - {chemformula} { - \chemmacros_integrate_package:nnn {} {chemformula} {2015/09/08} - \tl_gset:Nn \g_chemmacros_formula_method_tl {chemformula} - } - {mhchem} { - \chemmacros_integrate_package:nnn {version=4} {mhchem} {} - \cs_set_protected:Npn \chemmacros_chemformula:n ##1 { \ce {##1} } - \cs_set_protected:Npn \chemmacros_reaction:n ##1 { \ce {##1} } - \chemmacros_after_module:nn {charges} - { - \cs_set_protected:Npn \chemmacros_elpair:n ##1 { \ce{##1} : } - \cs_set_protected:Npn \chemmacros_plus: { + } - \cs_set_protected:Npn \chemmacros_minus: { - } - \cs_set_protected:Npn \chemmacros_formal_plus: { \ensuremath{\oplus} } - \cs_set_protected:Npn \chemmacros_formal_minus: { \ensuremath{\ominus} } - \cs_set_protected:Npn \fplus { \ensuremath{\oplus} } - \cs_set_protected:Npn \fminus { \ensuremath{\ominus} } - } - \tl_gset:Nn \g_chemmacros_formula_method_tl {mhchem} + \chemmacros_if_package_loaded:nT {##1} + { + \bool_if:NTF \l__chemmacros_tmpa_bool + { + \msg_warning:nn {chemmacros} {formula-conflict} + \chemmacros_set_formula_method:n {chemformula} + } + { \chemmacros_set_formula_method:n {##1} } + \bool_set_true:N \l__chemmacros_tmpa_bool + } } + \bool_if:NF \l__chemmacros_tmpa_bool + { + \msg_info:nn {chemmacros} {default-formula-method} + \chemmacros_set_formula_method:n {chemformula} } - { \bool_set_true:N \l__chemmacros_formula_method_set_bool } - { \bool_set_false:N \l__chemmacros_formula_method_set_bool } } } + +\cs_new_protected:Npn \chemmacros_set_formula_method:n #1 + { + \chemmacros_if_method_package:nTF {#1} + { \chemmacros_setup_method_package:n {#1} } + { + \msg_warning:nnn {chemmacros} {unknown-formula-method} {#1} + \chemmacros_setup_method_package:n {chemformula} + } + \bool_set_true:N \l__chemmacros_formula_method_set_bool + } \cs_generate_variant:Nn \chemmacros_set_formula_method:n {V} % -------------------------------------------------------------------------- -% let's make use of `chemformula' inside some of `chemmacros' commands: -\cs_new_protected:Npn \chemmacros_chemformula:n #1 - { \chemformula_chcpd:nn {} {#1} } -\cs_generate_variant:Nn \chemmacros_chemformula:n { x,V } +% add formula methods: +\chemmacros_add_method_package:nn {chemformula} + { + \chemmacros_integrate_package:nnn {} {chemformula} {2015/09/08} + \cs_set_protected:Npn \chemmacros_chemformula:n #1 + { \chemformula_chcpd:nn {} {#1} } + \cs_set_protected:Npn \chemmacros_reaction:n #1 + { \chemformula_ch:nn {} {#1} } + } + +\chemmacros_add_method_package:nn {mhchem} + { + \chemmacros_integrate_package:nnn {version=4} {mhchem} {} + \cs_set_protected:Npn \chemmacros_chemformula:n #1 { \ce {#1} } + \cs_set_protected:Npn \chemmacros_reaction:n #1 { \ce {#1} } + \chemmacros_after_module:nn {charges} + { + \cs_set_protected:Npn \chemmacros_elpair:n #1 { \ce{#1} : } + \cs_set_protected:Npn \chemmacros_plus: { + } + \cs_set_protected:Npn \chemmacros_minus: { - } + \cs_set_protected:Npn \chemmacros_formal_plus: { \ensuremath{\oplus} } + \cs_set_protected:Npn \chemmacros_formal_minus: { \ensuremath{\ominus} } + \cs_set_protected:Npn \fplus { \ensuremath{\oplus} } + \cs_set_protected:Npn \fminus { \ensuremath{\ominus} } + } + } -\cs_new_protected:Npn \chemmacros_reaction:n #1 - { \chemformula_ch:nn {} {#1} } +\ChemCompatibilityFrom{5.6} +\chemmacros_add_method_package:nn {chemist} + { + \RequirePackage {chemist} + \cs_set_protected:Npn \chemmacros_chemformula:n #1 + { \chemmacros_text:n { \ChemForm {#1} } } + \cs_set_protected:Npn \chemmacros_reaction:n #1 + { \chemmacros_text:n { \ChemForm {#1} } } + \chemmacros_after_module:nn {charges} + { + \cs_set_protected:Npn \chemmacros_elpair:n #1 + { \chemmacros_text:n { \ChemForm {#1} : } } + \cs_set_protected:Npn \chemmacros_plus: { + } + \cs_set_protected:Npn \chemmacros_minus: { - } + \cs_set_protected:Npn \chemmacros_formal_plus: { \ensuremath{\oplus} } + \cs_set_protected:Npn \chemmacros_formal_minus: { \ensuremath{\ominus} } + \cs_set_protected:Npn \fplus { \ensuremath{\oplus} } + \cs_set_protected:Npn \fminus { \ensuremath{\ominus} } + } + } -% for module writers prefering traditional 2e programming: -\cs_new_protected:Npn \chemmacros@formula #1 { \chemmacros_chemformula:n {#1} } -\cs_new_protected:Npn \chemmacros@reaction #1 { \chemmacros_reaction:n {#1} } +\chemmacros_add_method_package:nn {chemfig} + { + \RequirePackage {chemfig} + \cs_set_protected:Npn \chemmacros_chemformula:n #1 + { \printatom {#1} } + \cs_set_protected:Npn \chemmacros_reaction:n #1 + { \printatom {#1} } + \chemmacros_after_module:nn {charges} + { + \cs_set_protected:Npn \chemmacros_elpair:n #1 + { \Lewis { 0: , \printatom {#1} } } + \cs_set_protected:Npn \chemmacros_plus: { + } + \cs_set_protected:Npn \chemmacros_minus: { - } + \cs_set_protected:Npn \chemmacros_formal_plus: { \ensuremath{\oplus} } + \cs_set_protected:Npn \chemmacros_formal_minus: { \ensuremath{\ominus} } + \cs_set_protected:Npn \fplus { \ensuremath{\oplus} } + \cs_set_protected:Npn \fminus { \ensuremath{\ominus} } + } + } +\EndChemCompatibility % -------------------------------------------------------------------------- \ChemCompatibilityTo{5.0} @@ -108,52 +202,25 @@ \ChemCompatibilityFrom{5.1} \chemmacros_define_global_keys:n - { - formula .choices:nn = - { chemformula , mhchem } - { \chemmacros_set_formula_method:V \l_keys_choice_tl } , - formula / unknown .code:n = - \msg_warning:nnn {chemmacros} {unknown-formula-method} {#1} - \tl_gset:Nn \g_chemmacros_formula_method_tl {chemformula} - } + { formula .code:n = \chemmacros_set_formula_method:n {#1} } \EndChemCompatibility -\cs_new_protected:Npn \chemmacros_check_formula_method: +\AtEndPreamble { - \bool_if:nTF - { - \chemmacros_if_package_loaded_p:n {chemformula} && - \chemmacros_if_package_loaded_p:n {mhchem} && - } - { - \msg_warning:nn {chemmacros} {formula-conflict} - \bool_if:NF \l__chemmacros_formula_method_set_bool - { - \msg_info:nn {chemmacros} {default-formula-method} - \chemmacros_set_formula_method:n {chemformula} - } - } + \bool_if:nT { - \chemmacros_if_package_loaded:nTF {mhchem} - { \chemmacros_set_formula_method:n {mhchem} } - { - \chemmacros_if_package_loaded:nF {chemformula} - { \msg_info:nn {chemmacros} {default-formula-method} } - \chemmacros_set_formula_method:n {chemformula} - } + !\l__chemmacros_formula_method_set_bool + && + \chemmacros_if_compatiblity_p:nn {>=} {5.2} + && + \chemmacros_if_compatiblity_p:nn {<} {5.6} } - } - -\AtEndPreamble - { - \bool_if:NF \l__chemmacros_formula_method_set_bool + { \chemmacros_check_formula_method: } { - \chemmacros_if_compatiblity:nnTF {>=} {5.2} - { \chemmacros_check_formula_method: } - { - \msg_info:nn {chemmacros} {default-formula-method} - \chemmacros_set_formula_method:V \g_chemmacros_formula_method_tl - } + \chemmacros_if_compatiblity:nnTF {>=} {5.6} + { \msg_warning:nn {chemmacros} {default-formula-method} } + { \msg_info:nn {chemmacros} {default-formula-method} } + \chemmacros_set_formula_method:n {chemformula} } } @@ -165,3 +232,7 @@ 2015/10/13 - add missing compatibility definitions - check for `mhchem' and `chemformula' and set method accordingly if possible +2016/04/27 - further generalization of the `method' concept, new methods + `chemist' and `chemfig' + - don't automatically load an available method: load `chemformula' + if the users haven't decided for themselves and issue a warning diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.lang.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.lang.code.tex index 6872adaf469..8d0abe1695e 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.lang.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.lang.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{lang}{2016/02/03 language settings for chemmacros} +\ChemModule{lang}{2016/04/27 language settings for chemmacros} \RequirePackage{translations} @@ -93,54 +93,51 @@ } % -------------------------------------------------------------------------- -\DeclareTranslationFallback {scheme-name} {Scheme} -\DeclareTranslation {English} {scheme-name} {Scheme} -\DeclareTranslation {German} {scheme-name} {Schema} - -\DeclareTranslationFallback {scheme-list} {List~ of~ Schemes} -\DeclareTranslation {English} {scheme-list} {List~ of~ Schemes} -\DeclareTranslation {German} {scheme-list} {Verzeichnis~ der~ Schemata} - -% -------------------------------------------------------------------------- -\DeclareTranslation {English} {K-acid} {\mathrm{a}} -\DeclareTranslation {German} {K-acid} {\mathrm{s}} -\DeclareTranslation {Dutch} {K-acid} {\mathrm{z}} - -\DeclareTranslation {English} {K-base} {\mathrm{b}} - -\DeclareTranslation {English} {K-water} {\mathrm{w}} - -% -------------------------------------------------------------------------- -\DeclareTranslation {English} {phase-sld} {s} -\DeclareTranslation {German} {phase-sld} {f} - -\DeclareTranslation {English} {phase-lqd} {l} -\DeclareTranslation {German} {phase-lqd} {f\/l} - -\DeclareTranslation {English} {phase-gas} {g} -\DeclareTranslation {German} {phase-gas} {g} +\ChemCompatibilityFrom{5.6} +\cs_new_protected:Npn \__chemmacros_declare_translation:nw #1#2=#3\q_stop + { + \tl_set:Nx \l__chemmacros_tmpa_tl { \tl_trim_spaces:n {#2} } + \tl_set:Nx \l__chemmacros_tmpb_tl { \tl_trim_spaces:n {#3} } + \use:x + { + \chemmacros_declare_translation:nnn + { \exp_not:V \l__chemmacros_tmpa_tl } + { \exp_not:n {#1} } + { \exp_not:V \l__chemmacros_tmpb_tl } + } + } -\DeclareTranslation {English} {phase-aq} {aq} -\DeclareTranslation {German} {phase-aq} {aq} +% #1: key +% #2: lang +% #3: translation +\cs_new_protected:Npn \chemmacros_declare_translation:nnn #1#2#3 + { \DeclareTranslation {#1} {#2} {#3} } -% -------------------------------------------------------------------------- -\DeclareTranslationFallback {list-of-reactions} {List~ of~ Reactions} -\DeclareTranslation {English} {list-of-reactions} {List~ of~ Reactions} -\DeclareTranslation {German} {list-of-reactions} {Reaktionsverzeichnis} -\DeclareTranslation {Italian} {list-of-reactions} {Elenco~ delle~ reazioni} -\DeclareTranslation {French} {list-of-reactions} {Table~ des~ r\'eactions} -\DeclareTranslation {Dutch} {list-of-reactions} {Lijst~ van~ reacties} +% #1: key +% #2: csv list: { <lang1> = <translation1> , <lang2> = <translation2> } +\cs_new_protected:Npn \chemmacros_declare_translations:nn #1#2 + { + \clist_map_inline:nn {#2} + { \__chemmacros_declare_translation:nw {#1} ##1 \q_stop } + } -\DeclareTranslationFallback {reaction} {Reaction} -\DeclareTranslation {English} {reaction} {Reaction} -\DeclareTranslation {German} {reaction} {Reaktion} -\DeclareTranslation {Italian} {reaction} {Reazione} -\DeclareTranslation {French} {reaction} {R\'eaction} -\DeclareTranslation {Dutch} {reaction} {Reactie} +\NewDocumentCommand \DeclareChemTranslations {mm} + { \chemmacros_declare_translations:nn {#1} {#2} } +\@onlypreamble \DeclareChemTranslations + +\NewDocumentCommand \DeclareChemTranslation {mmm} + { \chemmacros_declare_translation:nnn {#1} {#2} {#3} } +\@onlypreamble \DeclareChemTranslation +\EndChemCompatibility % -------------------------------------------------------------------------- - \tex_endinput:D 2015/11/17 - remove options `german' and `ngerman', starting with v5.3 2016/02/03 - adapt to changes in `acid-base' module +2016/04/27 - additions/changes to reaction and scheme translations + - \chemmacros_declare_translation:nnn and + \chemmacros_declare_translations:nn + - \DeclareChemTranslation and \DeclareChemTranslations + - moved translations from lang module to the corresponding modules + they belong to diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.newman.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.newman.code.tex index 7fbf68463f0..53828dcf71a 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.newman.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.newman.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{newman}{2015/07/13 newman projections} +\ChemModule{newman}{2016/04/23 newman projections} \chemmacros_load_module:n {tikz} @@ -36,7 +36,7 @@ \fp_new:N \l__chemmacros_newman_abs_angle_fp \fp_zero:N \l__chemmacros_newman_abs_angle_fp \fp_new:N \l__chemmacros_newman_scale_fp -\fp_set:Nn \l__chemmacros_newman_scale_fp { 1 } +\fp_set:Nn \l__chemmacros_newman_scale_fp {1} \fp_new:N \l__chemmacros_newman_x_fp \fp_new:N \l__chemmacros_newman_y_fp @@ -62,68 +62,64 @@ } % \newman[<keyval>](<angle>){<1>,<2>,<3>,<4>,<5>,<6>} -\NewDocumentCommand \newman { o d() > { \SplitArgument { 5 } { , } } m } +\NewDocumentCommand \newman {od()m} { \group_begin: - \IfNoValueF { #1 } { \chemmacros_set_keys:nn {newman} { #1 } } - \IfNoValueTF { #2 } - { \chemmacros_newman_atoms:nnnnnnn { } #3 } - { \chemmacros_newman_atoms:nnnnnnn { #2 } #3 } + \IfNoValueF {#1} { \chemmacros_set_keys:nn {newman} {#1} } + \IfNoValueTF {#2} + { \chemmacros_newman:nn { } {#3} } + { \chemmacros_newman:nn {#2} {#3} } \group_end: } +% #1: angle +% #2: csv list of atoms +\cs_new_protected:Npn \chemmacros_newman:nn #1#2 + { \__chemmacros_newman_feed_atoms:nw {#1}#2 ,,,,,, \q_stop } + +\cs_new_protected:Npn \__chemmacros_newman_feed_atoms:nw #1#2,#3,#4,#5,#6,#7,#8 \q_stop + { \chemmacros_newman_atoms:nnnnnnn {#1} {#2} {#3} {#4} {#5} {#6} {#7} } + % place atoms: % #1: angle % #2 - #7: atoms \cs_new_protected:Npn \chemmacros_newman_atoms:nnnnnnn #1#2#3#4#5#6#7 { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \fp_set_eq:NN \l__chemmacros_newman_rel_angle_fp \l__chemmacros_newman_abs_angle_fp } - { \fp_set:Nn \l__chemmacros_newman_rel_angle_fp { #1 } } + { \fp_set:Nn \l__chemmacros_newman_rel_angle_fp {#1} } \chemmacros_tikz_picture:xn { scale = \fp_to_decimal:N \l__chemmacros_newman_scale_fp , chemmacros_newman_atom_front / .style = { - inner~sep=0pt, - outer~sep=0pt, - \tl_use:N \l__chemmacros_newman_tikz_front_tl + inner~sep = 0pt , + outer~sep = 0pt , + \exp_not:V \l__chemmacros_newman_tikz_front_tl }, chemmacros_newman_atom_back / .style = { - inner~sep=0pt, - outer~sep=0pt, + inner~sep = 0pt , + outer~sep = 0pt , \bool_if:NTF \l__chemmacros_newman_tikz_back_bool - { \tl_use:N \l__chemmacros_newman_tikz_back_tl } - { \tl_use:N \l__chemmacros_newman_tikz_front_tl } + { \exp_not:V \l__chemmacros_newman_tikz_back_tl } + { \exp_not:V \l__chemmacros_newman_tikz_front_tl } } } { \chemmacros_tikz_draw:x { \exp_not:V \l__chemmacros_newman_tikz_ring_tl } (0pt,0pt) circle (\fp_to_dim:N \l__chemmacros_newman_scale_fp * 15) ; - \chemmacros_newman_back_node:nn - { 30 } - { \IfNoValueF { #6 } { #6 } } - \chemmacros_newman_back_node:nf - { 150 } - { \IfNoValueF { #7 } { #7 } } - \chemmacros_newman_back_node:nf - { 270 } - { \IfNoValueF { #5 } { #5 } } - \chemmacros_newman_front_node:nf - { 90 } - { \IfNoValueF { #2 } { #2 } } - \chemmacros_newman_front_node:nf - { 210 } - { \IfNoValueF { #3 } { #3 } } - \chemmacros_newman_front_node:nf - { 330 } - { \IfNoValueF { #4 } { #4 } } + \chemmacros_newman_back_node:nn {30} {#6} + \chemmacros_newman_back_node:nn {150} {#7} + \chemmacros_newman_back_node:nn {270} {#5} + \chemmacros_newman_front_node:nn {90} {#2} + \chemmacros_newman_front_node:nn {210} {#3} + \chemmacros_newman_front_node:nn {330} {#4} } } @@ -209,3 +205,8 @@ { #2 } ; } \cs_generate_variant:Nn \chemmacros_newman_front_node:nn { nf } + +% -------------------------------------------------------------------------- +\tex_endinput:D + +2016/04/23 - some changes on how \newman is processed internally diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.nomenclature.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.nomenclature.code.tex index 431129e7482..32fd36fdd52 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.nomenclature.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.nomenclature.code.tex @@ -544,12 +544,14 @@ \NewChemIUPACShorthand ^ \chemmacros_superscript:n \NewChemIUPACShorthand | \chemmacros_break_point: \NewChemIUPACShorthand - \chemmacros_break_point_hyphen: + \ChemCompatibilityFrom{5.1} \NewChemIUPACShorthand ( \chemmacros_break_point_opening_paren: \NewChemIUPACShorthand ) \chemmacros_break_point_closing_paren: \NewChemIUPACShorthand [ \chemmacros_break_point_opening_bracket: \NewChemIUPACShorthand ] \chemmacros_break_point_closing_bracket: \EndChemCompatibility + \ChemCompatibilityFrom{5.3} \NewChemIUPAC \chemprime { \ensuremath {{}^{\prime}} } \NewChemIUPACShorthand ' \chemprime diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.orbital.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.orbital.code.tex index 72622f37f07..f30b71e10b1 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.orbital.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.orbital.code.tex @@ -144,7 +144,8 @@ \tl_set:Nn \l__chemmacros_orbital_s_phase_color_tl { black ! 5 } } - \chemmacros_tikz_picture:xn{ \__chemmacros_orbital_options: } + \chemmacros_tikz_picture:xn + { \__chemmacros_orbital_options: } { \chemmacros_tikz_shade:x { ball~color = \exp_not:V \l__chemmacros_orbital_s_phase_color_tl } @@ -208,7 +209,8 @@ \tl_set:Nn \l__chemmacros_orbital_p_pphase_color_tl { black ! 5 } } - \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: } + \chemmacros_tikz_picture:xn + { \__chemmacros_orbital_options: } { \chemmacros_tikz_shadedraw:x { @@ -302,7 +304,8 @@ \tl_set:Nn \l__chemmacros_orbital_sp_pphase_color_tl { black ! 5 } } - \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: } + \chemmacros_tikz_picture:xn + { \__chemmacros_orbital_options: } { \chemmacros_tikz_shadedraw:x { @@ -393,7 +396,8 @@ \tl_set:Nn \l__chemmacros_orbital_sptwo_pphase_color_tl { black ! 5 } } - \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: } + \chemmacros_tikz_picture:xn + { \__chemmacros_orbital_options: } { \chemmacros_tikz_shadedraw:x { @@ -484,7 +488,8 @@ \tl_set:Nn \l__chemmacros_orbital_spthree_pphase_color_tl { black ! 5 } } - \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: } + \chemmacros_tikz_picture:xn + { \__chemmacros_orbital_options: } { \chemmacros_tikz_shadedraw:x { diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.particles.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.particles.code.tex index a373a0f58d8..fc07911ccc7 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.particles.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.particles.code.tex @@ -25,14 +25,21 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{particles}{2016/01/13 particles} +\ChemModule{particles}{2016/04/02 particles} \chemmacros_load_modules:n {charges,chemformula} % -------------------------------------------------------------------------- % particles \cs_new_protected:Nn \chemmacros_define_particle:Nn - { \cs_set_protected:Npn #1 { \chemmacros_chemformula:n {#2} } } + { + \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl { \ExplSyntaxOff } {#2} + \use:x + { + \cs_set_protected:Npn \exp_not:N #1 + { \chemmacros_chemformula:n { \exp_not:V \l__chemmacros_tmpa_tl } } + } + } \NewChemMacroset {Particle} {mm} { \chemmacros_define_particle:Nn #1 {#2} } @@ -88,7 +95,7 @@ { \skip_horizontal:N \l__chemmacros_nucleophile_dim } \chemmacros_chemformula:n { {}^{-} } } - { \chemmacros_chemformula:n { #2- } } + { \chemmacros_chemformula:n { #2^{-} } } } \DeclareDocumentCommand #1 {o} { @@ -105,19 +112,19 @@ % -------------------------------------------------------------------------- % particles: -\NewChemParticle \el { e- } -\NewChemParticle \prt { p+ } +\NewChemParticle \el { e^- } +\NewChemParticle \prt { p^+ } \NewChemParticle \ntr { n^0 } % ions, molecules % proton, hydroxide, hydronium/oxonium, water: -\NewChemParticle \Hpl { H+ } -\NewChemParticle \Hyd { OH- } -\NewChemParticle \Oxo { H3O+ } -\NewChemParticle \water { H2O } +\NewChemParticle \Hpl { H^+ } +\NewChemParticle \Hyd { OH^- } +\NewChemParticle \Oxo { H_3O^+ } +\NewChemParticle \water { H_2O } % electrophile: -\NewChemParticle \El { E+ } +\NewChemParticle \El { E^+ } % nucleophiles: \NewChemNucleophile \Nuc {Nu} @@ -131,3 +138,4 @@ % -------------------------------------------------------------------------- \tex_endinput:D 2016/01/13 - new option particles/space +2016/04/02 - adapt to formula methods `chemist' and `chemfig' diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex index f2f9e6f0406..38fa658a8f5 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.phases.code.tex @@ -83,3 +83,52 @@ \NewChemPhase \aq {aq} % -------------------------------------------------------------------------- +\ChemCompatibilityTo{5.5} +\DeclareTranslation {English} {phase-sld} {s} +\DeclareTranslation {German} {phase-sld} {f} + +\DeclareTranslation {English} {phase-lqd} {l} +\DeclareTranslation {German} {phase-lqd} {f\/l} + +\DeclareTranslation {English} {phase-gas} {g} +\DeclareTranslation {German} {phase-gas} {g} + +\DeclareTranslation {English} {phase-aq} {aq} +\DeclareTranslation {German} {phase-aq} {aq} +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\chemmacros_declare_translations:nn {phase-sld} + { + fallback = s , + English = s , + German = f + } + +\chemmacros_declare_translations:nn {phase-lqd} + { + fallback = l , + English = l , + German = f\/l + } + +\chemmacros_declare_translations:nn {phase-gas} + { + fallback = g , + English = g , + German = g + } + +\chemmacros_declare_translations:nn {phase-aq} + { + fallback = aq , + English = aq , + German = aq + } +\EndChemCompatibility + +% -------------------------------------------------------------------------- +\tex_endinput:D + +2015/06/09 - first version +2016/04/27 - moved translations from lang module to phases module diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.reactions.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.reactions.code.tex index 8f8a98f8d95..ed8f48cfd5c 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.reactions.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.reactions.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{reactions}{2016/02/09 reaction environments} +\ChemModule{reactions}{2016/04/27 reaction environments} \chemmacros_load_module:n {chemformula} @@ -34,14 +34,14 @@ % -------------------------------------------------------------------------- \cs_new_protected:Npn \__chemmacros_record_for_lor:nnnnn #1#2#3#4#5 { - \tl_if_eq:nnT { #1 } { reaction } + \tl_if_eq:nnT {#1} {reaction} { \group_begin: % we need to prevent \Hy@make@anchor from being written to the lor % file: \bool_if:NT \l__chemmacros_hyperref_bool { \cs_set:Npn \Hy@make@anchor {} } - \addcontentsline { lor } { reaction } + \addcontentsline {lor} {reaction} { \tl_use:N \l__chemmacros_reaction_lorname_tl \tl_use:N \c_space_tl @@ -66,7 +66,7 @@ \maketag@@@{#3\ignorespaces#2{##1}\unskip\@@italiccorr#4} % this is added => this disturbs hyperref: \__chemmacros_record_for_lor:nnnnn - { #1 } { #3 } { #2 } { ##1 } { #4 } + {#1} {#3} {#2} {##1} {#4} } } } @@ -75,12 +75,12 @@ \cs_new_protected:Npn \chemmacros_add_reaction_description:n #1 { - \tl_if_blank:nF { #1 } - { \tl_gset:Nn \g__chemmacros_reaction_description_tl { : ~ #1 } } + \tl_if_blank:nF {#1} + { \tl_gset:Nn \g__chemmacros_reaction_description_tl {:~#1} } } -\NewDocumentCommand \AddRxnDesc { m } - { \chemmacros_add_reaction_description:n { #1 } } +\NewDocumentCommand \AddRxnDesc {m} + { \chemmacros_add_reaction_description:n {#1} } % define \listofreactions \tl_new:N \l__chemmacros_reaction_lorname_tl @@ -88,10 +88,18 @@ \tl_new:N \l__chemmacros_reaction_heading_tl \cs_new:Npn \__chemmacros_reaction_heading:n #1 - { \l__chemmacros_reaction_heading_tl { #1 } } + { \l__chemmacros_reaction_heading_tl {#1} } \cs_generate_variant:Nn \__chemmacros_reaction_heading:n { V } -\tl_set:Nn \l__chemmacros_reaction_lorname_tl { \chemmacros_translate:n {reaction} } +\ChemCompatibilityTo{5.5} +\tl_set:Nn \l__chemmacros_reaction_lorname_tl + { \chemmacros_translate:n {reaction} } +\EndChemCompatibility +\ChemCompatibilityFrom{5.6} +\tl_set:Nn \l__chemmacros_reaction_lorname_tl + { \chemmacros_translate:n {Reaction} } +\EndChemCompatibility + \tl_set:Nn \reactionlistname { \chemmacros_translate:n {list-of-reactions} } \chemmacros_define_keys:nn {reactions} @@ -109,12 +117,20 @@ \cs_if_exist:NTF \chapter { - \chemmacros_set_keys:nn {reactions} - { list-heading-cmd = \chapter* {#1} } + \chemmacros_if_compatiblity:nnTF {>=} {5.2} + { + \chemmacros_set_keys:nn {reactions} + { list-heading-cmd = \chapter* {#1} } + } + { \cs_set_protected:Npn \__chemmacros_reaction_heading:n { \chapter* } } } { - \chemmacros_set_keys:nn {reactions} - { list-heading-cmd = \section* {#1} } + \chemmacros_if_compatiblity:nnTF {>=} {5.2} + { + \chemmacros_set_keys:nn {reactions} + { list-heading-cmd = \section* {#1} } + } + { \cs_set_protected:Npn \__chemmacros_reaction_heading:n { \section* } } } \cs_new_protected:Npn \listofreactions @@ -123,14 +139,53 @@ \@starttoc {lor} } +\ChemCompatibilityTo{5.5} \cs_new_protected:Npn \l@reaction #1#2 - { \@dottedtocline { 1 } { 1.5em } { 2.3em } { #1 } { #2 } } + { \@dottedtocline {1} {1.5em} {2.3em} {#1} {#2} } +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\cs_new_eq:NN \l@reaction \l@figure + +\bool_new:N \l__chemmacros_reactions_tocbasic_bool +\cs_if_exist:NT \KOMAClassName + { \bool_set_true:N \l__chemmacros_reactions_tocbasic_bool } + +\chemmacros_define_keys:nn {reactions} + { tocbasic .bool_set:N = \l__chemmacros_reactions_tocbasic_bool } + +\AtEndPreamble + { + \bool_if:nT + { + \chemmacros_if_package_loaded_p:n {tocbasic} || + \l__chemmacros_reactions_tocbasic_bool + } + { + \RequirePackage {tocbasic} + \addtotoclist [float] {lor} + \cs_set_protected:Npn \listofreactions { \listoftoc {lor} } + \cs_new:Npn \listoflorname { \reactionlistname } + } + } + +\ChemCleverefSupport {reaction} + { \chemmacros_translate:n {reaction} } + [ \chemmacros_translate:n {Reaction} ] + { \chemmacros_translate:n {reactions} } + [ \chemmacros_translate:n {Reactions} ] +\ChemFancyrefSupport {rct} + { \chemmacros_translate:n {reaction} } + [ \chemmacros_translate:n {Reaction} ] +\EndChemCompatibility + % create new tagform \newtagform {reaction} {\{} {\}} \newcounter {chemmacros_save_reaction} \newcounter {reaction} +\ChemCompatibilityTo{5.5} \cs_new_protected:Npn \__chemmacros_begin_reaction: { % create individual names for `hyperref': @@ -146,6 +201,23 @@ \setcounter {equation} { \value {reaction} } \usetagform {reaction} } +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\cs_new_protected:Npn \__chemmacros_begin_reaction: + { + \patchcmd \thereaction {reaction} {equation} {} {} + \cs_set_eq:NN \theequation \thereaction + \cs_set_eq:NN \r@equation \r@reaction + \cs_set_eq:NN \p@equation \p@reaction + \cs_set:Npn \theHequation { R . \theHsection . \theequation } + \setcounter {chemmacros_save_reaction} { \value {equation} } + \setcounter {equation} { \value {reaction} } + \chemmacros_if_package_loaded:nT {cleveref} + { \crefalias {equation} {reaction} } + \usetagform {reaction} + } +\EndChemCompatibility % switch back to equation tags \cs_new_protected:Npn \__chemmacros_end_reaction: @@ -166,14 +238,14 @@ \tl_clear:N \l__chemmacros_reactions_args_tl \int_step_function:nnnN {2} {1} {#3+1} \__chemmacros_reactions_build_args:n } - \chemmacros_reaction_env:nnnV {#1} {#2} {#3} \l__chemmacros_reactions_args_tl + \chemmacros_declare_reaction_env:nnnV {#1} {#2} {#3} \l__chemmacros_reactions_args_tl } % #1: chem % #2: math % #3: args number % #4: argument list ({#2}{#3}...) -\cs_new_protected:Npn \chemmacros_reaction_env:nnnn #1#2#3#4 +\cs_new_protected:Npn \chemmacros_declare_reaction_env:nnnn #1#2#3#4 { \exp_args:Nnx \DeclareDocumentEnvironment {#1} { O{} \prg_replicate:nn {#3+0} {m} } { @@ -186,8 +258,9 @@ \ignorespacesafterend } } -\cs_generate_variant:Nn \chemmacros_reaction_env:nnnn {nnnV} - +\cs_generate_variant:Nn \chemmacros_declare_reaction_env:nnnn {nnnV} + +\ChemCompatibilityTo{5.5} \cs_new_protected:Npn \chemmacros_reaction_read:nnw #1#2#3 \end { \begin{#1}#2 @@ -195,6 +268,45 @@ \end{#1} \end } +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\cs_new_protected:Npn \chemmacros_reaction_read:nnw #1#2#3 \end + { + \tl_clear:N \l__chemmacros_tmpa_tl + \seq_clear:N \l__chemmacros_tmpc_seq + \seq_set_split:Nnn \l__chemmacros_tmpa_seq {\\} {#3} + \int_set:Nn \l__chemmacros_tmpa_int + { \seq_count:N \l__chemmacros_tmpa_seq } + \int_zero:N \l__chemmacros_tmpb_int + \seq_map_inline:Nn \l__chemmacros_tmpa_seq + { + \int_incr:N \l__chemmacros_tmpb_int + \seq_clear:N \l__chemmacros_tmpc_seq + \seq_set_split:Nnn \l__chemmacros_tmpb_seq {&} {##1} + \seq_map_inline:Nn \l__chemmacros_tmpb_seq + { + \seq_put_right:Nn \l__chemmacros_tmpc_seq + { \chemmacros_reaction:n {####1} } + } + \tl_put_right:Nx \l__chemmacros_tmpa_tl + { \seq_use:Nn \l__chemmacros_tmpc_seq {&} } + \int_compare:nF + { \l__chemmacros_tmpa_int = \l__chemmacros_tmpb_int } + { \tl_put_right:Nn \l__chemmacros_tmpa_tl {\\} } + } + \chemmacros_reaction_write:nnV {#1} {#2} \l__chemmacros_tmpa_tl + \end + } + +\cs_new_protected:Npn \chemmacros_reaction_write:nnn #1#2#3 + { + \begin{#1}#2 + #3 + \end{#1} + } +\cs_generate_variant:Nn \chemmacros_reaction_write:nnn { nnV } +\EndChemCompatibility \NewChemMacroset* {Reaction} {mO{}m} { \chemmacros_define_reaction:nnn {#1} {#3} {#2} } @@ -205,9 +317,85 @@ \NewChemReaction {reactions*} {align*} % -------------------------------------------------------------------------- +\ChemCompatibilityTo{5.5} +\DeclareTranslationFallback {list-of-reactions} {List~ of~ Reactions} +\DeclareTranslation {English} {list-of-reactions} {List~ of~ Reactions} +\DeclareTranslation {German} {list-of-reactions} {Reaktionsverzeichnis} +\DeclareTranslation {Italian} {list-of-reactions} {Elenco~ delle~ reazioni} +\DeclareTranslation {French} {list-of-reactions} {Table~ des~ r\'eactions} +\DeclareTranslation {Dutch} {list-of-reactions} {Lijst~ van~ reacties} + +\DeclareTranslationFallback {reaction} {Reaction} +\DeclareTranslation {English} {reaction} {Reaction} +\DeclareTranslation {German} {reaction} {Reaktion} +\DeclareTranslation {Italian} {reaction} {Reazione} +\DeclareTranslation {French} {reaction} {R\'eaction} +\DeclareTranslation {Dutch} {reaction} {Reactie} +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\chemmacros_declare_translations:nn {list-of-reactions} + { + fallback = List~ of~ Reactions , + English = List~ of~ Reactions , + German = Reaktionsverzeichnis , + Italian = Elenco~ delle~ reazioni , + French = Table~ des~ r\'eactions , + Dutch = Lijst~ van~ reacties + } + +\chemmacros_declare_translations:nn {reaction} + { + fallback = reaction , + English = reaction , + German = Reaktion , + Italian = reazione , + French = r\'{e}action , + Dutch = reactie + } + +\chemmacros_declare_translations:nn {reactions} + { + fallback = reactions , + English = reactions , + German = Reaktionen , + Italian = reazioni , + French = r\'{e}actions , + Dutch = reacties + } + +\chemmacros_declare_translations:nn {Reaction} + { + fallback = Reaction , + English = Reaction , + German = Reaktion , + Italian = Reazione , + French = R\'{e}action , + Dutch = Reactie + } + +\chemmacros_declare_translations:nn {Reactions} + { + fallback = Reactions , + English = Reactions , + German = Reaktionen , + Italian = Reazioni , + French = R\'{e}actions , + Dutch = Reacties + } +\EndChemCompatibility +% -------------------------------------------------------------------------- \tex_endinput:D 2015/09/15 - adapt to `method' option => do not use chemformula's macros directly 2015/10/14 - new option `list-heading-cmd' 2016/02/09 - added \ignorespacesafterend to environments +2016/03/17 - tocbasic integration of lor + - add missing compatibility check for the usage of the + `list-heading-cmd' option +2016/04/02 - adapt to new formula methods +2016/04/27 - correct \__chemmacros_begin_reaction: so tags obey \thereaction + - add cleveref support + - add fancyref support + - moved translations from lang module to reactions module diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.redox.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.redox.code.tex index 7d89d2e4ff9..ba4a9959b7a 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.redox.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.redox.code.tex @@ -331,6 +331,7 @@ \NewDocumentCommand \OX { >{\SplitArgument{1}{,}}m } { \chemmacros_redox_partner:nn #1 } +% TODO: add option to make `#2' be parsed as chem formula \cs_new_protected:Npn \chemmacros_redox_partner:nn #1#2 { \chemmacros_tex_if:nnTF {measuring@} {} diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex index 6ea3354fdb8..3545b0663a4 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.scheme.code.tex @@ -25,7 +25,7 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{scheme}{2015/10/23 a scheme floating environment} +\ChemModule{scheme}{2016/04/25 a scheme floating environment} \RequirePackage {chemnum} @@ -164,6 +164,19 @@ } % -------------------------------------------------------------------------- +\ChemCompatibilityFrom{5.6} +\ChemCleverefSupport {scheme} + { \chemmacros_translate:n {scheme} } + [ \chemmacros_translate:n {Scheme} ] + { \chemmacros_translate:n {schemes} } + [ \chemmacros_translate:n {Schemes} ] + +\ChemFancyrefSupport {sch} + { \chemmacros_translate:n {scheme} } + [ \chemmacros_translate:n {Scheme} ] +\EndChemCompatibility + +% -------------------------------------------------------------------------- % #1: env name \cs_new_protected:Npn \chemmacros_define_float:nn #1#2 { @@ -229,12 +242,68 @@ \cs_new_eq:cN {l@#1} \l@figure } } - \cs_set:Npn \schemename {\chemmacros_translate:n {#1-name}} - \cs_set:Npn \listschemename {\chemmacros_translate:n {#1-list}} + \cs_set:cpn {#1name} {\chemmacros_translate:n {#1-name}} + \cs_set:cpn {list#1name} {\chemmacros_translate:n {#1-list}} + } + +% -------------------------------------------------------------------------- +\ChemCompatibilityTo{5.5} +\DeclareTranslationFallback {scheme-name} {Scheme} +\DeclareTranslation {English} {scheme-name} {Scheme} +\DeclareTranslation {German} {scheme-name} {Schema} + +\DeclareTranslationFallback {scheme-list} {List~ of~ Schemes} +\DeclareTranslation {English} {scheme-list} {List~ of~ Schemes} +\DeclareTranslation {German} {scheme-list} {Verzeichnis~ der~ Schemata} +\EndChemCompatibility + +\ChemCompatibilityFrom{5.6} +\chemmacros_declare_translations:nn {scheme-name} + { + fallback = Scheme , + English = Scheme , + German = Schema + } + +\chemmacros_declare_translations:nn {scheme-list} + { + fallback = List~ of~ Schemes , + English = List~ of~ Schemes , + German = Verzeichnis~ der~ Schemata } +\chemmacros_declare_translations:nn {scheme} + { + fallback = scheme , + English = scheme , + German = Schema + } + +\chemmacros_declare_translations:nn {Scheme} + { + fallback = Scheme , + English = Scheme , + German = Schema + } + +\chemmacros_declare_translations:nn {schemes} + { + fallback = schemes , + English = schemes , + German = Schemata + } + +\chemmacros_declare_translations:nn {Schemes} + { + fallback = Schemes , + English = Schemes , + German = Schemata + } +\EndChemCompatibility + \tex_endinput:D % -------------------------------------------------------------------------- 2015/09/19 - make the module compatible with floatrow 2015/10/23 - add info message to float method detection 2016/01/23 - make the module compatible with chemscheme +2016/04/25 - cleveref and fancyref support diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index 31e6f679976..e119d05200c 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -31,9 +31,9 @@ % -------------------------------------------------------------------------- % package information: -\tl_const:Nn \c_chemmacros_date_tl {2016/03/08} +\tl_const:Nn \c_chemmacros_date_tl {2016/05/02} \tl_const:Nn \c_chemmacros_version_major_number_tl {5} -\tl_const:Nn \c_chemmacros_version_minor_number_tl {5} +\tl_const:Nn \c_chemmacros_version_minor_number_tl {6} \tl_const:Nn \c_chemmacros_version_subrelease_tl {} \tl_const:Nx \c_chemmacros_version_number_tl {\c_chemmacros_version_major_number_tl.\c_chemmacros_version_minor_number_tl} @@ -85,7 +85,11 @@ \fp_compare:nTF { floor(#1) = floor(#3) } { \fp_compare:nTF - { (\chemmacros_get_minor:f {#1}) #2 (\chemmacros_get_minor:f {#3}) } + { + ( \chemmacros_get_minor_version:f {#1} ) + #2 + ( \chemmacros_get_minor_version:f {#3} ) + } { \prg_return_true: } { \prg_return_false: } } @@ -96,11 +100,11 @@ } } -\cs_new:Npn \__chemmacros_get_minor:w #1.#2.#3 \q_stop +\cs_new:Npn \__chemmacros_get_minor_version:w #1.#2.#3 \q_stop { \tl_if_blank:nTF {#2} {0} {#2} } -\cs_new:Npn \chemmacros_get_minor:n #1 - { \__chemmacros_get_minor:w #1.. \q_stop } -\cs_generate_variant:Nn \chemmacros_get_minor:n {f} +\cs_new:Npn \chemmacros_get_minor_version:n #1 + { \__chemmacros_get_minor_version:w #1.. \q_stop } +\cs_generate_variant:Nn \chemmacros_get_minor_version:n {f} % check compatibility % #1: relation @@ -506,3 +510,11 @@ Version history (base) - new option `explicit-zero-sign' (redox) 2016/03/08 - version 5.5 - new module `polymers' +2016/04/25 - version 5.6 - generalization of the formula method concept, new + methods `chemist' and `chemfig' (chemformula) + - use `tocbasic' for the list of reactions if + available (reactions) + - fix reaction environments to obey \thereaction + (reactions) + - add cleveref and fancyref support (reactions) + |