diff options
author | Karl Berry <karl@freefriends.org> | 2013-01-29 23:21:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-01-29 23:21:30 +0000 |
commit | 966c0674997ff51e5ea9e4a79e6c873c4d93a9cf (patch) | |
tree | 5be91b484cec2431f63e8717793dcbe83538090c /Master/texmf-dist | |
parent | 13bacf6392e96e4d46c40e1d4b50b9e70055fb18 (diff) |
chemmacros (29jan13)
git-svn-id: svn://tug.org/texlive/trunk@28982 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_de.pdf | bin | 798817 -> 834288 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.tex | 112 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdf | bin | 783086 -> 819978 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex | 124 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.pdf | bin | 788779 -> 823492 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.tex | 117 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemformula.sty | 324 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty | 1095 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def | 2 |
10 files changed, 966 insertions, 812 deletions
diff --git a/Master/texmf-dist/doc/latex/chemmacros/README b/Master/texmf-dist/doc/latex/chemmacros/README index f35f2658692..c0afb66d15b 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/README +++ b/Master/texmf-dist/doc/latex/chemmacros/README @@ -1,10 +1,10 @@ -------------------------------------------------------------------------- -the CHEMMACROS bundle v3.4b +the CHEMMACROS bundle v3.5 -> chemmacros package -> macros and commands for chemists -> chemformula package -> typeset chemical compounds and reactions -> ghsystem package -> typeset H & P statements and pictograms from the globally harmonised system (GHS) -2013/01/04 +2013/01/28 -------------------------------------------------------------------------- This bundle succeeds the chemmacros package which is now part of the bundle diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.pdf b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.pdf Binary files differindex 33f76488e75..1a502a264e6 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.pdf +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.pdf diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.tex b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.tex index e5d245d5261..c426efdf7a9 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.tex +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.tex @@ -53,7 +53,7 @@ code-box = {skipabove=1ex,skipbelow=1ex} } -\usepackage[varioref=false]{chemstyle} +% \usepackage[varioref=false]{chemstyle} \usepackage{chemfig,upgreek,textgreek,booktabs,cancel} \usepackage[version=3]{mhchem} \usepackage{hologo,libertinehologopatch} @@ -65,10 +65,33 @@ \pagestyle{headings} \usepackage{acro} -\DeclareAcronym{ghs}{GHS}{Globally Harmonized System of Classification and - Labelling of Chemicals} -\DeclareAcronym{eu}{EU}{European Union} -\DeclareAcronym{iupac}{IUPAC}{International Union of Pure and Applied Chemistry} +\acsetup{long-format=\scshape} +\DeclareAcronym{ghs}{ + short = GHS , + long = Globally Harmonized System of Classification and Labelling of Chemicals +} +\DeclareAcronym{eu}{ + short = EU , + long = European Union +} +\DeclareAcronym{iupac}{ + short = IUPAC , + long = International Union of Pure and Applied Chemistry +} +\DeclareAcronym{UN}{ + short = UN , + long = United Nations +} +\DeclareAcronym{dvi}{ + short = dvi , + long = device independent file format , + format = \scshape +} +\DeclareAcronym{pdf}{ + short = pdf , + long = portable document file , + format = \scshape +} \chemsetup[option]{synchronize,language=german} \colorlet{chemformula}{darkgray} @@ -149,8 +172,6 @@ \newcommand*\Ghsystem{{\fontspec[Color=cnpkgblue,Scale=1.2]{Linux Biolinum Shadow O}ghsystem}} \renewcommand*\AmS{\hologo{AmS}} -\newcommand*\pdfTeX{\hologo{pdfTeX}} -\renewcommand*\LuaTeX{\hologo{LuaTeX}} \TitlePicture{% \ch[font-spec={[Color=chemformula]Augie}]{ 2 "\OX{o1,\ox{0,Na}}" + "\OX{r1,\ox{0,Cl}}" {}2 -> 2 "\OX{o2,\ox{+1,Na}}" {}+ + 2 "\OX{r2,\ox{-1,Cl}}" {}- } @@ -159,14 +180,14 @@ \addcmds{ a,abinitio,AddRxnDesc,anti,aq,aqi, - b,ba,bottomrule,bridge, + b,ba,bond,bottomrule,bridge, cancel,cd,cdot,ce,cee,celsius,centering,chemabove,Chemalpha,Chembeta,Chemgamma, Chemdelta,ChemDelta,chemfig,chemname,Chemomega,chemsetup,cip,cis,ch,cnsetup, CNMR,color,cstsetup, - d,D,data,DeclareChemArrow,DeclareChemBond,DeclareChemIUPAC,DeclareChemLatin, - DeclareChemNMR,DeclareChemParticle,DeclareChemPhase,DeclareChemReaction, - DeclareChemState,DeclareInstance,DeclareSIUnit,definecolor,delm,delp,Delta, - Dfi,draw, + d,D,data,DeclareChemArrow,DeclareChemBond,DeclareChemBondAlias,DeclareChemIUPAC, + DeclareChemLatin,DeclareChemNMR,DeclareChemParticle,DeclareChemPhase, + DeclareChemReaction,DeclareChemState,DeclareInstance,DeclareSIUnit,definecolor, + delm,delp,Delta,Dfi,draw, E,el,electronvolt,ElPot,endo,Enthalpy,enthalpy,Entropy, footnotesize,fmch,fpch,fscrm,fscrp, g,gas,ghs,ghslistall,ghspic,Gibbs,glqq,gram,grqq, @@ -262,10 +283,10 @@ die \paket{mhchem} nicht bietet. Da \chemformula als Alternative zu \paket{mhche gedacht ist, bietet \chemmacros eine Option, mit der Sie zwischen \paket{mhchem} und \chemformula wählen können. -Als Chemiker wissen Sie vermutlich, dass die \textsc{United Nations} das -\ac{ghs} als weltweiten Ersatz für die zahlreichen ähnlichen aber doch verschiedenen -Systeme der einzelnen Länder entwickelt haben. Obwohl es noch nicht in allen Ländern -umgesetzt wurde \cite{unece:ghsystem_implementation}, ist das nur eine Frage der Zeit. +Als Chemiker wissen Sie vermutlich, dass die \acl{UN} das \ac{ghs} als weltweiten +Ersatz für die zahlreichen ähnlichen aber doch verschiedenen Systeme der einzelnen +Länder entwickelt haben. Obwohl es noch nicht in allen Ländern umgesetzt +wurde~\cite{unece:ghsystem_implementation}, ist das nur eine Frage der Zeit. Das Paket \ghsystem gibt Ihnen nun die Möglichkeit, alle \enquote{hazard and precautionary statements} auf einfache Weise einzugeben und aufzurufen. Die Sätze wurden der EU-Verordnung 1272/2008 entnommen~\cite{eu:ghsystem_regulation}. @@ -369,10 +390,14 @@ dann nur mit dem Setup-Befehl gesetzt werden. Die Einstellung \key{ghs}{false} wird das Laden von \ghsystem unterbinden. Default = \code{true} % greek - \option[option]{greek}{math|textgreek|\default{upgreek}} Diese Option bestimmt, + \option[option]{greek}{auto|math|textgreek|\default{upgreek}} Diese Option bestimmt, wie die Buchstaben \cmd{Chemalpha} und seine Verwandten dargestellt werden. Siehe Seite~\pageref{desc:upgreek} für weitere Informationen. Diese Option - kann nur in der Präambel gesetzt werden. Default = \code{upgreek} + kann nur in der Präambel gesetzt werden. Bitte beachten Sie, dass diese + Option weder \paket{upgreek} noch \paket{textgreek} lädt! Sie bestimmt + lediglich welches verwendet wird, falls es geladen wurde. Wenn Sie beispielsweise + \code{upgreek} wählen, müssen Sie auch das entsprechende Paket laden. + Default = \code{auto} % iupac \option[option]{iupac}{auto|restricted|strict} Einstellen, wie die Nomenklatur-Befehle definiert werden. Siehe Seite~\pageref{desc:iupac}. Default = \code{auto} @@ -657,8 +682,7 @@ einmal umbrechen dürfen. Dabei hilft folgender Befehl: \befehl{iupac}{<IUPAC name>} Innerhalb dieses Befehls werden {\catcode`\|=11\cmd{|}} und \cmd{-} verwendet, um Umbruchstellen oder einen umbrechenden Bindestrich anzugeben. {\catcode`\^=11\cmd{^}} kann als Abkürzung für\\ - \lstinline=\textsuperscript=\footnote{Tatsächlich wird ein anderer Mechanismus - verwendet, das Ergebnis ist jedoch weitestgehend dasselbe.} eingesetzt werden. + \lstinline=\textsuperscript= eingesetzt werden. \end{beschreibung} \begin{beispiel} \begin{minipage}{.4\linewidth} @@ -773,7 +797,7 @@ Kerning nach der schließenden Klammer. Der betrag kann durch folgende Option ge werden: \begin{beschreibung} \option[iupac]{cip-kern}{<dim>} Betrag des Kernings nach der schließenden Klammer. - Default = \code{.1ex} + Default = \code{.075em} \end{beschreibung} \paragraph{Fischer}\index{Fischer}\secidx[Fischer]{IUPAC-Namen} @@ -885,12 +909,7 @@ stellt zusätzlich diese Befehle bereit: Falls das Paket \paket{chemstyle} geladen wurde, wurden sie mit \paket{chemstyle}s Befehl \lstinline+\latin+ definiert. Das bedeutet, dass ihr Erscheinungsbild von -der \paket{chemstyle} Option \code{abbremph} abhängen: -\begin{beispiel} - \insitu, \abinitio\\ - \cstsetup{abbremph=false} - \insitu, \abinitio -\end{beispiel} +der \paket{chemstyle} Option \code{abbremph} abhängen. Die Makros wurden mit folgendem Befehl definiert: \begin{beschreibung} @@ -899,7 +918,7 @@ Die Makros wurden mit folgendem Befehl definiert: \end{beschreibung} \begin{beispiel} \DeclareChemLatin\ltn{latin text} - \ltn \cstsetup{abbremph=false} \ltn + \ltn \end{beispiel} Wenn Sie \paket{chemstyle} \emph{nicht} geladen haben, können Sie das Erscheinungsbild mit dieser Option anpassen: @@ -2060,7 +2079,6 @@ kann: kann Werte zwischen \code{1} (undurchsichtig) bis \code{0} (unsichtbar) annehmen. \end{beschreibung} -\newpage \begin{beispiel}[dist] \hspace{1cm} \chemsetup[orbital]{ @@ -2089,6 +2107,7 @@ kann: \bspmidlength{dist}{7mm} \secidx*{Orbitale}\secidx*{CHEMMACROS} +\newpage \part{\texorpdfstring{\Chemformula}{chemformula}}\label{part:chemformula}\secidx{CHEMFORMULA} \chemsetup[chemformula]{ font-spec = @@ -2210,8 +2229,8 @@ Der Output kann mit diesen Optionen angepasst werden: wird. Default = \code{.} \option{frac-style}{math|xfrac|nicefrac} Bestimmt, wie Brüche dargestellt werden. Default = \code{math} - \option{stoich-space}{<dim>} Der Leerraum nach einem stöchiometrischen Faktor. - Eine \TeX-Länge. Default = \lstinline=.1667em= + \option{stoich-space}{<skip>} Der Leerraum nach einem stöchiometrischen Faktor. + Eine elastische Länge. Default = \code{.1667em plus .0333em minus .0117em} \end{beschreibung} \begin{beispiel} \ch[decimal-marker={,}]{3.5} \ch[decimal-marker={$\cdot$}]{3,5} @@ -2401,6 +2420,9 @@ folgendem Befehl aufgerufen werden können: Die vordefinierten Bindungstypen sind in Tabelle~\ref{tab:bond_types} aufgeführt. \begin{table} + \centering + \caption{Bindungen, die mit \protect\cmd{bond} aufgerufen werden können.} + \label{tab:bond_types} \begin{tabular}{lcl} \toprule \bfseries Name & \bfseries Aussehen & \bfseries Aliase \\ @@ -2415,8 +2437,6 @@ Die vordefinierten Bindungstypen sind in Tabelle~\ref{tab:bond_types} aufgeführ \code{<co} & \bond{<co} & \code{coordleft} \\ \bottomrule \end{tabular} - \caption{Bindungen, die mit \protect\cmd{bond} aufgerufen werden können.} - \label{tab:bond_types} \end{table} \begin{beispiel} @@ -2475,12 +2495,12 @@ Diese Optionen ermöglichen Ihnen, den Output anzupassen: \option{subscript-style}{text|math} Stil, der für die Tiefstellungen verwendet wird. Default = \code{text} \option{charge-hshift}{<dim>} Verschiebung von Hochstellungen, wenn sie einer - Tiefstellung folgen. Default = \code{.5ex}\label{desc:charge-hshift} + Tiefstellung folgen. Default = \code{.25em}\label{desc:charge-hshift} \option{charge-style}{text|math} Stil, der für Hochstellungen verwendet wird. Default = \code{text} \option{adduct-space}{<dim>} Leerraum links und rechts des Addukt-Punktes. Default = \code{.1333em} - \option{bond-length}{<dim>} Die Länge der Bindungen. Default = \code{1.1667ex} + \option{bond-length}{<dim>} Die Länge der Bindungen. Default = \code{.5833em} \option{bond-offset}{<dim>} Der Abstand zwischen Atom und Bindung. Default = \code{.07em} \option{bond-style}{<tikz>} \TikZ-Optionen für die Bindungen. Zunächst @@ -2583,7 +2603,8 @@ Die erste Sorte besteht nur aus einem Token, nämlich einem der folgenden: Der Leerraum links und rechts des Plus kann mit einer Option angepasst werden: \begin{beschreibung} - \option{plus-space}{<dim>} Eine \TeX-Länge. Default = \lstinline+.3em+ + \option{plus-space}{<skip>} Eine elastische Länge. Default = + \code{.3em plus .1em minus .1em} \end{beschreibung} \begin{beispiel} \ch{A + B}\\ @@ -2652,7 +2673,8 @@ darin, dass ihm ein Leerraum folgt. Der Leerraum, der nach dem geschützen Mathe-Input ausgegeben wird, kann angepasst werden. \begin{beschreibung} - \item \key{math-space}{<dim>} Eine \TeX-Länge. Default = \code{.1667em} + \option{math-space}{<skip>} Eine elastische Länge. Default = + \code{.1667em plus .0333em minus .0117em} \end{beschreibung} \begin{beispiel} \ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl} \\ @@ -2734,14 +2756,14 @@ Mit folgenden Optionen können Sie das Erscheinungsbild der Pfeile anpassen: \begin{beschreibung} \option{arrow-offset}{<dim>} Die Länge, die ein Pfeil links und rechts über die Beschriftung hinausragt. Die Länge eines leeren Pfeils beträgt zwei mal - \code{arrow-offset}. Eine \TeX-Länge. Default = \code{1.5ex} + \code{arrow-offset}. Eine \TeX-Länge. Default = \code{.75em} \option{arrow-yshift}{<dim>} Verschiebt einen Pfeil nach oben (positiver Wert) oder nach unten (negativer Wert). Eine \TeX-Länge. Default = \code{0pt} \option{arrow-ratio}{<factor>} Das Verhältnis der Pfeillängen der ver unbalancierten Gleichgewichtspfeile. \code{.4} würde bedeuten, dass der kürzere Pfeil $0.4$ mal so lang ist, wie der längere Pfeil. Default = \code{.6} \option{compound-sep}{<dim>} Der Leerraum zwischen Formeln und Pfeilen. Eine - \TeX-Länge. Default = \code{1ex} + \TeX-Länge. Default = \code{.5em} \option{label-offset}{<dim>} Der Leerraum zwischen Pfeilen und ihrer Beschriftung. Eine \TeX-Länge. Default = \code{2pt} \option{label-style}{<font command>} Die relative Schriftgröße der Beschriftung. @@ -3192,16 +3214,16 @@ das Piktogramm rotieren, verwenden Sie diese Option: \subsection{Der Bildtyp hängt von der Engine ab}\label{ssec:picture_type} Sie wissen vermutlich, dass Sie nicht jeden Bildtyp mit jeder Compiler-Engine -verwenden können. \pdfTeX\ im \textsc{dvi}-Modus verlangt \code{eps}-Dateien, -während \pdfTeX\ im \textsc{pdf}-Modus, \XeTeX\ und \LuaTeX\ \code{eps}-Dateien +verwenden können. \pdfTeX{} im \acs{dvi}-Modus verlangt \code{eps}-Dateien, +während \pdfTeX{} im \acs{pdf}-Modus, \XeTeX{} und \LuaTeX{} \code{eps}-Dateien in \code{pdf}-Dateien konvertieren, vorausgesetzt, der Anwender hat Schreibrechte in dem Verzeichnis, in dem die Bilder gespeichert sind. Die letztgenannten können jedoch \code{jpg}- und \code{png}-Dateien ohne Schwierigkeiten -einbinden, während \pdfTeX\ im \textsc{dvi}-Modus das nicht kann. +einbinden, während \pdfTeX{} im \acs{dvi}-Modus das nicht kann. Um das Problem zu lösen, testet \ghsystem, welche Engine verwendet wird und falls -es \pdfTeX\ ist, in welchem Modus es verwendet wird. Dann wird entwder das +es \pdfTeX{} ist, in welchem Modus es verwendet wird. Dann wird entwder das \code{eps}- oder das \code{png}-Bild für die Piktogramme verwendet. Sie können den Bildtyp über die Option \begin{beschreibung} @@ -3230,7 +3252,7 @@ Ich werde in irgendwann in der Zukunft weitere Sprachen implementieren. Das kann aber eine Weile dauern. Wenn Sie gerne zu \ghsystem beisteuern möchten und die Sätze in einer anderen Sprache tippen wollen, kontaktieren Sie mich\footnote{% \href{mailto:contac@mychemistry.eu}{contact@mychemistry.eu}} gerne. Ich stelle -Ihnen dann eine Template-Datei, ein \code{pdf} mit den offiziellen Übersetzungen +Ihnen dann eine Template-Datei, ein \acs{pdf} mit den offiziellen Übersetzungen sowie jede weitere Hilfe, die sie benötigen. \section{Liste aller Sätze}\secidx{Liste aller Sätze}[Liste aller Saetze] @@ -3321,7 +3343,7 @@ Wert verwendet. Die Optionen der Module \code{\textcolor{module}{chemformula}} u \multicolumn{5}{l}{IUPAC-Befehle:} \\ break-space & iupac & <dim> & .01em & Seite~\pageref{key:iupac_break-space} \\ bridge-number & iupac & sub|super & sub & Seite~\pageref{key:iupac_bridge-number} \\ - cip-kern & iupac & <dim> & .1ex & Seite~\pageref{key:iupac_cip-kern} \\ + cip-kern & iupac & <dim> & .075em & Seite~\pageref{key:iupac_cip-kern} \\ coord-use-hyphen & iupac & \default{true}|false & true & Seite~\pageref{key:iupac_coord-use-hyphen} \\ hyphen-pre-space & iupac & <dim> & .01em & Seite~\pageref{key:iupac_hyphen-pre-space} \\ hyphen-post-space & iupac & <dim> & -.03em & Seite~\pageref{key:iupac_hyphen-post-space} \\ 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 66b24080268..a6099b106f9 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 45a9f081866..2a1f9bd8ac9 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex @@ -1,7 +1,7 @@ % arara: xelatex % arara: biber % arara: xelatex -% arara: xelatex +% !arara: xelatex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ----------------------------------------------------------------------------- % - the CHEMMACROS bundle @@ -52,10 +52,11 @@ code-box = {skipabove=1ex,skipbelow=1ex} } -\usepackage[varioref=false]{chemstyle} +% \usepackage{scrhack} +% \usepackage[varioref=false,floats=float]{chemstyle} \usepackage{chemfig,upgreek,textgreek,booktabs,cancel} \usepackage[version=3]{mhchem} -\usepackage{hologo} +\usepackage{hologo,libertinehologopatch} \usepackage{fnpct} \usepackage[biblatex]{embrac} \ChangeEmph{[}[,.02em]{]}[.055em,-.08em] @@ -64,10 +65,33 @@ \pagestyle{headings} \usepackage{acro} -\DeclareAcronym{ghs}{GHS}{Globally Harmonized System of Classification and - Labelling of Chemicals} -\DeclareAcronym{eu}{EU}{European Union} -\DeclareAcronym{iupac}{IUPAC}{International Union of Pure and Applied Chemistry} +\acsetup{long-format=\scshape} +\DeclareAcronym{ghs}{ + short = GHS , + long = Globally Harmonized System of Classification and Labelling of Chemicals +} +\DeclareAcronym{eu}{ + short = EU , + long = European Union +} +\DeclareAcronym{iupac}{ + short = IUPAC , + long = International Union of Pure and Applied Chemistry +} +\DeclareAcronym{UN}{ + short = UN , + long = United Nations +} +\DeclareAcronym{dvi}{ + short = dvi , + long = device independent file format , + format = \scshape +} +\DeclareAcronym{pdf}{ + short = pdf , + long = portable document file , + format = \scshape +} \chemsetup[option]{synchronize} \colorlet{chemformula}{darkgray} @@ -147,8 +171,8 @@ \newcommand*\Ghsystem{{\fontspec[Color=cnpkgblue,Scale=1.2]{Linux Biolinum Shadow O}ghsystem}} \renewcommand*\AmS{\hologo{AmS}} -\newcommand*\pdfTeX{\hologo{pdfTeX}} -\renewcommand*\LuaTeX{\hologo{LuaTeX}} +% \newcommand*\pdfTeX{\hologo{pdfTeX}} +% \renewcommand*\LuaTeX{\hologo{LuaTeX}} \TitlePicture{% \ch[font-spec={[Color=chemformula]Augie}]{ 2 "\OX{o1,\ox{0,Na}}" + "\OX{r1,\ox{0,Cl}}" {}2 -> 2 "\OX{o2,\ox{+1,Na}}" {}+ + 2 "\OX{r2,\ox{-1,Cl}}" {}- } @@ -157,14 +181,14 @@ \addcmds{ a,abinitio,AddRxnDesc,anti,aq,aqi, - b,ba,bottomrule,bridge, + b,ba,bond,bottomrule,bridge, cancel,cd,cdot,ce,cee,celsius,centering,chemabove,Chemalpha,Chembeta,Chemgamma, Chemdelta,ChemDelta,chemfig,chemname,Chemomega,chemsetup,cip,cis,ch,cnsetup, CNMR,color,cstsetup, - d,D,data,DeclareChemArrow,DeclareChemBond,DeclareChemIUPAC,DeclareChemLatin, - DeclareChemNMR,DeclareChemParticle,DeclareChemPhase,DeclareChemReaction, - DeclareChemState,DeclareInstance,DeclareSIUnit,definecolor,delm,delp,Delta, - Dfi,draw, + d,D,data,DeclareChemArrow,DeclareChemBond,DeclareChemBondAlias,DeclareChemIUPAC, + DeclareChemLatin,DeclareChemNMR,DeclareChemParticle,DeclareChemPhase, + DeclareChemReaction,DeclareChemState,DeclareInstance,DeclareSIUnit,definecolor, + delm,delp,Delta,Dfi,draw, E,el,electronvolt,ElPot,endo,Enthalpy,enthalpy,Entropy, footnotesize,fmch,fpch,fscrm,fscrp, g,gas,ghs,ghslistall,ghspic,Gibbs,glqq,gram,grqq, @@ -258,9 +282,9 @@ not. Since \chemformula is meant as an \emph{alternative} to \paket{mhchem} \chemmacros offers a package option allowing you to choose which one of the two is used. The default however is \chemmacros own way: \chemformula. -As a chemist you are probably aware of the fact that the \textsc{United Nations} -have developed the \ac{ghs} as a global replacement for the various different -systems in different countries. While it has not been implemented by all countries +As a chemist you are probably aware of the fact that the \acl{UN} have developed +the \ac{ghs} as a global replacement for the various different systems in different +countries. While it has not been implemented by all countries yet~\cite{unece:ghsystem_implementation}, it is only a matter of time. The package \ghsystem now enables you to typeset all the hazard and precautionary @@ -357,10 +381,15 @@ be set using the setup command. package. Setting \key{ghs}{false} will prevent \chemmacros from loading \ghsystem. (default = \code{true}) % greek - \option[option]{greek}{math|textgreek|\default{upgreek}} This Options determines + \option[option]{greek}{\default{auto}|math|textgreek|upgreek} This Option determines how the letters \cmd{Chemalpha} and friends are typeset. See page~\pageref{desc:upgreek} for more information. \emph{This option can only be chosen in the preamble}. - (default = \code{upgreek}) + Please note that this options \emph{does not load either \paket{upgreek} nor + \paket{textgreek}}! It only determines which one to choose if available. The + option will detect if either \paket{upgreek} or \paket{textgreek} have been + loaded and use them if available. If you explicitly choose \code{upgreek} or + \code{textgreek} you also have to load the corresponding package. + (default = \code{auto}) % iupac \option[option]{iupac}{auto|restricted|strict} Take care of how \ac{iupac} naming commands are defined, see page~\pageref{desc:iupac} (default = \code{auto}) @@ -634,10 +663,9 @@ long. So long indeed that they span over more than two lines, especially in two-column documents. This means they must be allowed to be broken more than one time. This is what the following command does. \begin{beschreibung} - \item\cmd{iupac}{<IUPAC name>} Inside this command use \cmd{|} and \cmd{-} to - indicate a breaking point or a breaking dash. Use {\catcode`\^=11\relax\cmd{^}} - as a shortcut for \lstinline=\textsuperscript=\footnote{Actually another - mechanism is used, but the effect is essentially the same.}. + \Befehl{iupac}{<IUPAC name>} Inside this command use \cmd{|} and \cmd{-} to + indicate a breaking point or a breaking dash. Use {\catcode`\^=11\relax\cmd{^}} + as a shortcut for \lstinline=\textsuperscript=. \end{beschreibung} \begin{beispiel} @@ -739,7 +767,7 @@ common ones. \iupac{\O\-ethyl hexanethioate} \end{beispiel} -\paragraph{Cahn-Ingold-Prelog}\index{Cahn-Ingold-Prelog}\secidx[Cahn-Ingold-Prelog]{IUPAC Names}\label{par:cip}% TODO Jonas (label neu) +\paragraph{Cahn-Ingold-Prelog}\index{Cahn-Ingold-Prelog}\secidx[Cahn-Ingold-Prelog]{IUPAC Names}\label{par:cip} \begin{beschreibung} \befehl{cip}{<conf>} \eg: \cmd{cip}{R,S} \cip{R,S} \befehl{R} \iupac{\R} @@ -748,13 +776,12 @@ common ones. Since the command \cmd{S} has another meaning already (\S) it is only available inside \cmd{iupac} in the default setting. -% TODO Jonas Both these commands and the entgegen/zusammen descriptors get a small additional amount of kerning after the closing parenthesis. This amount can be changed through the following option: \begin{beschreibung} \option[iupac]{cip-kern}{<dim>} amount of kerning after the closing parenthesis. - Default = \code{.1ex} + Default = \code{.075em} \end{beschreibung} \paragraph{Fischer}\index{Fischer}\secidx[Fischer]{IUPAC Names} @@ -865,12 +892,8 @@ commands: If the package \paket{chemstyle} has been loaded they are defined using \paket{chemstyle}'s \cmd{latin} command. This means that then the appearance -depends on \paket{chemstyle}'s option \code{abbremph}: -\begin{beispiel} - \insitu, \abinitio\\ - \cstsetup{abbremph=false} - \insitu, \abinitio -\end{beispiel} +depends on \paket{chemstyle}'s option \code{abbremph}. + The commands are defined through \begin{beschreibung} \Befehl{DeclareChemLatin}{<cmd>}\ma{<phrase>} @@ -878,7 +901,7 @@ The commands are defined through \end{beschreibung} \begin{beispiel} \DeclareChemLatin\ltn{latin text} - \ltn \cstsetup{abbremph=false} \ltn + \ltn \end{beispiel} If you have \emph{not} loaded \paket{chemstyle} you can change the appearance with this option: @@ -2031,6 +2054,7 @@ Additionally there are two options, with which the \TikZ behaviour can be change \bspmidlength{dist}{7mm} \secidx*{Orbitals}\secidx*{CHEMMACROS} +\newpage \part{\texorpdfstring{\Chemformula}{chemformula}}\secidx{CHEMFORMULA}\label{part:chemformula} \chemsetup[chemformula]{ font-spec = @@ -2143,8 +2167,8 @@ There are a few possibilities to customize the output. \code{.} \option{frac-style}{math|xfrac|nicefrac} determines how fractions are displayed. Default = \code{math} - \option{stoich-space}{<dim>} The space that is placed after the stoichiometric - factor. Default = \code{.1667em} + \option{stoich-space}{<skip>} The space that is placed after the stoichiometric + factor. A rubber length. Default = \code{.1667em plus .0333em minus .0117em} \end{beschreibung} \begin{beispiel} \ch[decimal-marker={,}]{3.5} \ch[decimal-marker={$\cdot$}]{3,5} @@ -2329,6 +2353,9 @@ In addition to the three native bonds there are a few more which can be called b The predefined bond types are shown in table~\ref{tab:bond_types}. \begin{table} + \centering + \caption{Bonds available with \protect\cmd{bond}.} + \label{tab:bond_types} \begin{tabular}{lcl} \toprule \bfseries name & \bfseries appearance & \bfseries aliases \\ @@ -2343,8 +2370,6 @@ The predefined bond types are shown in table~\ref{tab:bond_types}. \code{<co} & \bond{<co} & \code{coordleft} \\ \bottomrule \end{tabular} - \caption{Bonds available with \protect\cmd{bond}.} - \label{tab:bond_types} \end{table} \begin{beispiel} @@ -2401,14 +2426,14 @@ These options allow you to customize the ouptut of the compounds: \option{subscript-style}{text|math} Style that is used to typeset the subscripts. Default = \code{text} \option{charge-hshift}{<dim>} Shift of superscripts when following a subscript. - Default = \code{.5ex}\label{desc:charge-hshift} + Default = \code{.25em}\label{desc:charge-hshift} \option{charge-vshift}{<dim>} Extra vertical shift of the superscripts. Default = \code{0pt} \option{charge-style}{text|math} Style that is used to typeset the superscripts. Default = \code{text} \option{adduct-space}{<dim>} Space to the left and the right of the adduct point. Default = \code{.1333em} - \option{bond-length}{<dim>} The length of the bonds. Default = \code{1.1667ex} + \option{bond-length}{<dim>} The length of the bonds. Default = \code{.5833em} \option{bond-offset}{<dim>} Space between bond and atoms. Default = \code{.07em} \option{bond-style}{<tikz>} \TikZ\ options for the bonds. Initially empty. \option{radical-style}{<tikz>} \TikZ\ options for the radical point. Initially @@ -2511,7 +2536,7 @@ following ones: The space left and right of the plus sign can be set with this option: \begin{beschreibung} - \option{plus-space}{<dim>} Default = \lstinline+.3em+ + \option{plus-space}{<skip>} A rubber length. Default = \code{.3em plus .1em minus .1em} \end{beschreibung} \begin{beispiel} \ch{A + B}\\ @@ -2575,7 +2600,8 @@ This output is different from the escaped text as it is followed by a space. The space that is inserted after a math group can be edited: \begin{beschreibung} - \option{math-space}{<dim>} Default = \code{.1667em} + \option{math-space}{<skip>} A rubber length. Default = + \code{.1667em plus .0333em minus .0117em} \end{beschreibung} \begin{beispiel} \ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl} \\ @@ -2655,14 +2681,14 @@ These are the options which enable you to customize the arrows: \begin{beschreibung} \option{arrow-offset}{<dim>} This is the length that an arrow protrudes a label on both sides. This means an empty arrow's length is two times \code{arrow-offset}. - Default = \code{1.5ex} + Default = \code{.75em} \option{arrow-yshift}{<dim>} Shifts an arrow up (positive value) or down (negative value). Default = \code{0pt} \option{arrow-ratio}{<factor>} The ratio of the arrow lengths of the unbalanced equilibrium. \code{.4} would mean that the length of the shorter arrow is $0.4\times$ the length of the longer arrow. Default = \code{.6} \option{compound-sep}{<dim>} The space between compounds and the arrows. - Default = \code{1ex} + Default = \code{.5em} \option{label-offset}{<dim>} The space between the labels and the arrows. Default = \code{2pt} \option{label-style}{<font command>} The relative font size of the labels. @@ -3094,15 +3120,15 @@ want to rotate the pictogram for some reason, use this option: \subsection{Picture Type Depending on Engine}\label{ssec:picture_type} As you probably know you can't use every picture type with every compiler engine. -\hologo{pdfTeX} in \textsc{dvi} mode \emph{needs} \code{eps} pictures while -\hologo{pdfTeX} in \textsc{pdf} mode, \hologo{XeTeX} and \hologo{LuaTeX} convert +\pdfTeX{} in \acs{dvi} mode \emph{needs} \code{eps} pictures while +\pdfTeX{} in \acs{pdf} mode, \XeTeX{} and \LuaTeX{} convert \code{eps} pictures into \code{pdf} files, given they have the rights to write in the directory the pictures are saved in. However, the latter can include \code{jpg} and \code{png} without any problems, -while \hologo{pdfTeX} in \textsc{dvi} mode can't. +while \pdfTeX{} in \acs{dvi} mode can't. -To resolve this \ghsystem tests which engine is used and if \hologo{pdfTeX} which +To resolve this \ghsystem tests which engine is used and if \pdfTeX{} which mode is used and then chooses either \code{eps} or \code{pdf} for the pictograms. You are free to choose the picture type yourself with the option \begin{beschreibung} @@ -3129,7 +3155,7 @@ You can also choose the language explicitly. I will add other languages some time in future. This may take a while, though. If you would be willing to contribute and write the statements of another language please feel free to contact me\footnote{\href{mailto:contac@mychemistry.eu}{contact@mychemistry.eu}}. -I would provide you with a template file, a \code{pdf} containing the official +I would provide you with a template file, a \acs{pdf} containing the official translations, and help to all your questions. \section{List of All Statements}\secidx{List of All Statements} @@ -3217,7 +3243,7 @@ The options belonging to the modules \code{\textcolor{module}{chemformula}} and \multicolumn{5}{l}{\ac{iupac} commands:} \\ break-space & iupac & <dim> & .01em & page~\pageref{key:iupac_break-space} \\ bridge-number & iupac & sub|super & sub & page~\pageref{key:iupac_bridge-number} \\ - cip-kern & iupac & <dim> & .1ex & page~\pageref{key:iupac_cip-kern} \\ + cip-kern & iupac & <dim> & .075em & page~\pageref{key:iupac_cip-kern} \\ coord-use-hyphen & iupac & \default{true}|false & true & page~\pageref{key:iupac_coord-use-hyphen} \\ hyphen-pre-space & iupac & <dim> & .01em & page~\pageref{key:iupac_hyphen-pre-space} \\ hyphen-post-space & iupac & <dim> & -.03em & page~\pageref{key:iupac_hyphen-post-space} \\ diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.pdf b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.pdf Binary files differindex 3ba501e1294..f59dd575cbe 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.pdf +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.pdf diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.tex b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.tex index 8a97e5d8e42..048132153c9 100644 --- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.tex +++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.tex @@ -52,10 +52,10 @@ code-box = {skipabove=1ex,skipbelow=1ex} } -\usepackage[varioref=false]{chemstyle} +% \usepackage[varioref=false]{chemstyle} \usepackage{chemfig,upgreek,textgreek,booktabs,cancel} \usepackage[version=3]{mhchem} -\usepackage{hologo} +\usepackage{hologo,libertinehologopatch} \usepackage{fnpct} \usepackage[biblatex]{embrac} \ChangeEmph{[}[,.02em]{]}[.055em,-.08em] @@ -64,10 +64,33 @@ \pagestyle{headings} \usepackage{acro} -\DeclareAcronym{ghs}{GHS}{Globally Harmonized System of Classification and - Labelling of Chemicals} -\DeclareAcronym{eu}{EU}{European Union} -\DeclareAcronym{iupac}{IUPAC}{International Union of Pure and Applied Chemistry} +\acsetup{long-format=\scshape} +\DeclareAcronym{ghs}{ + short = GHS , + long = Globally Harmonized System of Classification and Labelling of Chemicals +} +\DeclareAcronym{eu}{ + short = EU , + long = European Union +} +\DeclareAcronym{iupac}{ + short = IUPAC , + long = International Union of Pure and Applied Chemistry +} +\DeclareAcronym{UN}{ + short = UN , + long = Nazioni Unite +} +\DeclareAcronym{dvi}{ + short = dvi , + long = device independent file format , + format = \scshape +} +\DeclareAcronym{pdf}{ + short = pdf , + long = portable document file , + format = \scshape +} \chemsetup[option]{synchronize,language=italian} \colorlet{chemformula}{darkgray} @@ -148,8 +171,8 @@ \newcommand*\Ghsystem{{\fontspec[Color=cnpkgblue,Scale=1.2]{Linux Biolinum Shadow O}ghsystem}} \renewcommand*\AmS{\hologo{AmS}} -\newcommand*\pdfTeX{\hologo{pdfTeX}} -\renewcommand*\LuaTeX{\hologo{LuaTeX}} +% \newcommand*\pdfTeX{\hologo{pdfTeX}} +% \renewcommand*\LuaTeX{\hologo{LuaTeX}} \TitlePicture{% \ch[font-spec={[Color=chemformula]Augie}]{ 2 "\OX{o1,\ox{0,Na}}" + "\OX{r1,\ox{0,Cl}}" {}2 -> 2 "\OX{o2,\ox{+1,Na}}" {}+ + 2 "\OX{r2,\ox{-1,Cl}}" {}- } @@ -158,14 +181,14 @@ \addcmds{ a,abinitio,AddRxnDesc,anti,aq,aqi, - b,ba,bottomrule,bridge, + b,ba,bond,bottomrule,bridge, cancel,cd,cdot,ce,cee,celsius,centering,chemabove,Chemalpha,Chembeta,Chemgamma, Chemdelta,ChemDelta,chemfig,chemname,Chemomega,chemsetup,cip,cis,ch,cnsetup, CNMR,color,cstsetup, - d,D,data,DeclareChemArrow,DeclareChemBond,DeclareChemIUPAC,DeclareChemLatin, - DeclareChemNMR,DeclareChemParticle,DeclareChemPhase,DeclareChemReaction, - DeclareChemState,DeclareInstance,DeclareSIUnit,definecolor,delm,delp,Delta, - Dfi,draw, + d,D,data,DeclareChemArrow,DeclareChemBond,DeclareChemBondAlias,DeclareChemIUPAC, + DeclareChemLatin,DeclareChemNMR,DeclareChemParticle,DeclareChemPhase, + DeclareChemReaction,DeclareChemState,DeclareInstance,DeclareSIUnit,definecolor, + delm,delp,Delta,Dfi,draw, E,el,electronvolt,ElPot,endo,Enthalpy,enthalpy,Entropy, footnotesize,fmch,fpch,fscrm,fscrp, g,gas,ghs,ghslistall,ghspic,Gibbs,glqq,gram,grqq, @@ -266,7 +289,7 @@ contemporaneamente \chemformula offre alcune possibilità di adattare l'output c \paket{mhchem} e \chemformula. Il lettore di formazione chimica probabilmente sarà a conoscenza che le -\textsc{Nazioni Unite} hanno introdotto il \ac{ghs} come sostituto di validità +\acl{UN} hanno introdotto il \ac{ghs} come sostituto di validità globale per i numerosi sistemi dei diversi paesi, simili ma non unitari. Nonostante non sia ancora stato adottato da tutti i paesi \cite{unece:ghsystem_implementation}, questo avverrà ben presto. Il pacchetto \ghsystem offre la possibilità di inserire @@ -377,10 +400,14 @@ impostate con il comando di setup. \ghsystem. L'impostazione \key{ghs}{false} sopprime il caricamento di \ghsystem. Default = \code{true} % greek - \option[option]{greek}{math|textgreek|\default{upgreek}} Questa opzione determina - come vengono rappresentate la lettera \cmd{Chemalpha} e le sue simili (vedi a - pagina~\pageref{desc:upgreek} per ulteriori informazioni). L'opzione può essere - impostata solo nel preambolo. Default = \code{upgreek} + \option[option]{greek}{auto|math|textgreek|\default{upgreek}} Questa opzione + determina come vengono rappresentate la lettera \cmd{Chemalpha} e le sue simili + (vedi a pagina~\pageref{desc:upgreek} per ulteriori informazioni). L'opzione + può essere impostata solo nel preambolo. Nota bene: l'opzione non carica né + \paket{upgreek} né \paket{textgreek}, bensì determina solamente quale dei due + viene utilizzato, se caricato. Scegliendo \code{upgreek}, è necessario + \emph{anche} caricare il pacchetto corrispondente. + Default = \code{auto} % iupac \option[option]{iupac}{auto|restricted|strict} Determina le impostazioni dei comandi di nomenclatura (vedi a pagina~\pageref{desc:iupac}). Default = \code{auto} @@ -660,8 +687,7 @@ metterlo in pratica si può utilizzare il seguente comando: \befehl{iupac}{<IUPAC name>} All'interno di questo comando vengono impiegati {\catcode`\|=11\cmd{|}} e \cmd{-} per segnare punti di divisione oppure un trattino separatore. {\catcode`\^=11\cmd{^}} può essere utilizzato come - abbreviazione per \lstinline=\textsuperscript=\footnote{In realtà viene impiegato - un meccanismo diverso, anche se il risultato è praticamente lo stesso.}. + abbreviazione per \lstinline=\textsuperscript=. \end{beschreibung} \begin{beispiel} \begin{minipage}{.4\linewidth} @@ -773,7 +799,7 @@ kerning aggiuntivo dopo la parentesi chiusa. La sua quantità può essere variat attraverso l'opzione seguente: \begin{beschreibung} \option[iupac]{cip-kern}{<dim>} ammontare del kerning dopo la parentesi chiusa. - Default = \code{.1ex} + Default = \code{.075em} \end{beschreibung} \paragraph{Fischer}\index{Fischer}\secidx[Fischer]{Nomi IUPAC} @@ -883,12 +909,7 @@ mette inoltre a disposizione i seguenti comandi: Nel caso sia caricato il pacchetto \paket{chemstyle}, i comandi sono stati già definiti con il suo comando \lstinline+\latin+; il loro aspetto dipende quindi -dall'opzione \code{abbremph} di \paket{chemstyle}: -\begin{beispiel} - \insitu, \abinitio\\ - \cstsetup{abbremph=false} - \insitu, \abinitio -\end{beispiel} +dall'opzione \code{abbremph} di \paket{chemstyle}. Le macro sono state definite con il comando seguente: \begin{beschreibung} @@ -897,7 +918,7 @@ Le macro sono state definite con il comando seguente: \end{beschreibung} \begin{beispiel} \DeclareChemLatin\ltn{latin text} - \ltn \cstsetup{abbremph=false} \ltn + \ltn \end{beispiel} Nel caso in cui \paket{chemstyle} \emph{non} sia stato caricato è possibile cambiarne l'aspetto tramite l'opzione seguente: @@ -2002,7 +2023,6 @@ di \TikZ: \vspace{7mm} \end{beispiel} -\newpage \bspmidlength{dist}{10mm} \begin{beispiel}[dist] \hspace{2cm} @@ -2020,6 +2040,7 @@ di \TikZ: \bspmidlength{dist}{7mm} \secidx*{Orbitali}\secidx*{CHEMMACROS} +\newpage \part{\texorpdfstring{\Chemformula}{chemformula}}\label{part:chemformula}\secidx{CHEMFORMULA} \chemsetup[chemformula]{ font-spec = @@ -2133,8 +2154,8 @@ L'output può essere adattato utilizzando le opzioni seguenti: Default = \code{.} \option{frac-style}{math|xfrac|nicefrac} Determina in che modo vengono rappresentate le frazioni. Default = \code{math} - \option{stoich-space}{<dim>} La dimensione dello spazio dopo un fattore stechiometrico. - Una dimensione di \TeX. Default = \lstinline=.1667em= + \option{stoich-space}{<skip>} La dimensione dello spazio dopo un fattore stechiometrico. + Una lunghezza elastica. Default = \code{.1667em plus .0333em minus .0117em} \end{beschreibung} \begin{beispiel} \ch[decimal-marker={,}]{3.5} \ch[decimal-marker={$\cdot$}]{3,5} @@ -2326,6 +2347,9 @@ tramite I tipi predefiniti sono mostrati nella tabella~\ref{tab:bond_types}. \begin{table} + \centering + \caption{Legami disponibili con \protect\cmd{bond}.} + \label{tab:bond_types} \begin{tabular}{lcl} \toprule \bfseries Nome & \bfseries Aspetto & \bfseries Alias \\ @@ -2340,8 +2364,6 @@ I tipi predefiniti sono mostrati nella tabella~\ref{tab:bond_types}. \code{<co} & \bond{<co} & \code{coordleft} \\ \bottomrule \end{tabular} - \caption{Legami disponibili con \protect\cmd{bond}.} - \label{tab:bond_types} \end{table} \begin{beispiel} @@ -2398,11 +2420,11 @@ Le seguenti opzioni permettono di adattare l'output: Default = \code{0pt} \option{subscript-style}{text|math} Stile usato per i pedici. Default = \code{text} \option{charge-hshift}{<dim>} Spostamento degli apici seguenti un pedice. Default - = \code{.5ex}\label{desc:charge-hshift} + = \code{.25em}\label{desc:charge-hshift} \option{charge-style}{text|math} Stile usato per gli apici. Default = \code{text} \option{adduct-space}{<dim>} Spazio vuoto ai lati del punto di addotto. Default = \code{.1333em} - \option{bond-length}{<dim>} Lunghezza dei legami. Default = \code{1.1667ex}. + \option{bond-length}{<dim>} Lunghezza dei legami. Default = \code{.5833em}. \option{bond-offset}{<dim>} Distanza tra atomo e legame. Default = \code{.07em} \option{bond-style}{<tikz>} Opzioni di \TikZ\ per i legami. Inizialmente vuoto. \option{radical-style}{<tikz>} Opzioni di \TikZ\ per il punto radicalico. @@ -2501,7 +2523,8 @@ Questo tipo è composto da un singolo token compreso tra i seguenti: Lo spazio a sinistra e destra del più può essere adattato tramite un'opzione: \begin{beschreibung} - \option{plus-space}{<dim>} Una lunghezza di \TeX. Default = \lstinline+.3em+ + \option{plus-space}{<skip>} Una lunghezza elastica. Default = + \code{.3em plus .1em minus .1em} \end{beschreibung} \begin{beispiel} \ch{A + B}\\ @@ -2567,7 +2590,8 @@ anche per la presenza di uno spazio in seguito. Lo spazio seguente l'input matematico protetto può essere adattato. \begin{beschreibung} - \item \key{math-space}{<dim>} Una lunghezza di \TeX. Default = \code{.1667em} + \option{math-space}{<skip>} Una lunghezza elastica. Default = + \code{.1667em plus .0333em minus .0117em} \end{beschreibung} \begin{beispiel} \ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl} \\ @@ -2650,14 +2674,14 @@ Con le opzioni seguenti è possibile adattare la resa grafica delle frecce: \begin{beschreibung} \option{arrow-offset}{<dim>} La lunghezza della freccia eccedente l'etichetta (a sinistra e destra). La lunghezza di una freccia vuota è il doppio di \code{arrow-offset}. - Una lunghezza di \TeX. Default = \code{1.5ex} + Una lunghezza di \TeX. Default = \code{.75em} \option{arrow-yshift}{<dim>} Sposta una freccia verso l'alto (valore positivo) o verso il basso (valore negativo); una dimensione di \TeX. Default = \code{0pt} \option{arrow-ratio}{<factor>} Il rapporto tra le lunghezze delle frecce di equilibrio spostato: \code{.4} significa che la freccia più corta è lunga \num{0.4} volte la freccia più lunga. Default = \code{.6} \option{compound-sep}{<dim>} Lo spazio vuoto tra formule e freccia; una dimensione - di \TeX. Default = \code{1ex} + di \TeX. Default = \code{.5em} \option{label-offset}{<dim>} Lo spazio tra freccia ed etichette; una dimensione di \TeX. Default = \code{2pt} \option{label-style}{<font command>} Il corpo del font dell'etichetta. Default = @@ -3104,15 +3128,15 @@ esempio per ruotare il pittogramma, va usata l'opzione seguente: \subsection{Il tipo dell'immagine dipende dal compilatore}\label{ssec:picture_type} L'utente probabilmente è a conoscenza che non tutti i tipi di immagini sono compatibili -con ciascun compilatore. \pdfTeX\ in modalità \textsc{dvi} richiede file di tipo -\code{eps}, mentre \pdfTeX\ in modalità \textsc{pdf}, \XeTeX\ e \LuaTeX\ convertono +con ciascun compilatore. \pdfTeX{} in modalità \acs{dvi} richiede file di tipo +\code{eps}, mentre \pdfTeX{} in modalità \acs{pdf}, \XeTeX{} e \LuaTeX{} convertono file di tipo \code{eps} in \code{pdf}, ammesso che l'utente abbia diritti di scrittura nella cartella contenente le immagini. Gli ultimi elencati sanno tuttavia includere immagini di tipo \code{jpg} e \code{png} senza problemi, mentre -\pdfTeX\ in modalità \textsc{dvi} non ne è capace. +\pdfTeX{} in modalità \acs{dvi} non ne è capace. Per risolvere il problema \ghsystem verifica quale compilatore viene utilizzato, -e nel caso di \pdfTeX\ anche la modalità di utilizzo; poi sceglie quale immagine +e nel caso di \pdfTeX{} anche la modalità di utilizzo; poi sceglie quale immagine utilizzare tra \code{eps} e \code{png} per i pittogrammi. In ogni caso il tipo di immagine può essere selezionato a piacimento attraverso l'opzione \begin{beschreibung} @@ -3138,8 +3162,9 @@ ma non riconosce (ancora) la lingua impostata con \paket{babel} o \paket{polyglo È mia intenzione implementare ulteriori lingue in futuro; tuttavia potrebbe volerci ancora del tempo. Chi volesse partecipare a \ghsystem e trascrivere le frasi in -un'altra lingua, è invitato a contattarmi\footnote{\href{mailto:contac@mychemistry.eu}{contact@mychemistry.eu}}; -gli metterò a disposizione un file template, un \code{pdf} contenenti le traduzioni +un'altra lingua, è invitato a contattarmi% +\footnote{\href{mailto:contac@mychemistry.eu}{contact@mychemistry.eu}}; +gli metterò a disposizione un file template, un \acs{pdf} contenenti le traduzioni officiali ed ogni ulteriore aiuto necessario. \section{Lista delle frasi}\secidx{Lista delle frasi} @@ -3230,7 +3255,7 @@ sono elencate a parte. \multicolumn{5}{l}{comandi IUPAC:} \\ break-space & iupac & <dim> & .01em & pagina \pageref{key:iupac_break-space} \\ bridge-number & iupac & sub|super & sub & pagina \pageref{key:iupac_bridge-number} \\ - cip-kern & iupac & <dim> & .1ex & pagina \pageref{key:iupac_cip-kern} \\ + cip-kern & iupac & <dim> & .075em & pagina \pageref{key:iupac_cip-kern} \\ coord-use-hyphen & iupac & \default{true}|false & true & pagina \pageref{key:iupac_coord-use-hyphen} \\ hyphen-pre-space & iupac & <dim> & .01em & pagina \pageref{key:iupac_hyphen-pre-space} \\ hyphen-post-space & iupac & <dim> & -.03em & pagina \pageref{key:iupac_hyphen-post-space} \\ diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty index d1ec7350dc8..630992621cd 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty @@ -99,6 +99,7 @@ \int_new:N \l__chemformula_tmpa_int \int_new:N \l__chemformula_tmpb_int \box_new:N \l__chemformula_tmpa_box +\box_new:N \l__chemformula_tmpb_box %-----------------------------------------------------------------------------% % gobble options @@ -291,16 +292,16 @@ \tl_set:Nn \l__chemformula_arrow_ratio_tl { .6 } \dim_new:N \l__chemformula_arrow_offset_dim -\dim_set:Nn \l__chemformula_arrow_offset_dim { 1.5ex } +\dim_set:Nn \l__chemformula_arrow_offset_dim { .75em } \dim_new:N \l__chemformula_compound_sep_dim -\dim_set:Nn \l__chemformula_compound_sep_dim { \medskipamount } +\dim_set:Nn \l__chemformula_compound_sep_dim { .5em } \dim_new:N \l__chemformula_arrow_yshift_dim \dim_set:Nn \l__chemformula_arrow_yshift_dim { 0pt } % determine length in dependency of labels -\cs_new:Npn \chemformula_determine_arrow_length:nn #1#2 +\cs_new:Npn \chemformula_determine_arrow_length:NN #1#2 { \box_set_eq:NN \l__chemformula_tmpa_box #1 \dim_set:Nn \l__chemformula_tmpa_dim { \box_wd:N \l__chemformula_tmpa_box } @@ -330,19 +331,19 @@ %-----------------------------------------------------------------------------% % define arrow types -\tl_new:N \l__chemformula_arrow_head_tl +\tl_new:N \l__chemformula_arrow_head_tl \tl_set:Nn \l__chemformula_arrow_head_tl { cf } -\tl_new:N \l__chemformula_upper_label_tl -\tl_new:N \l__chemformula_lower_label_tl -\tl_new:N \l__chemformula_arrow_style_tl -\tl_new:N \l__chemformula_arrow_label_style_tl +\tl_new:N \l__chemformula_upper_label_tl +\tl_new:N \l__chemformula_lower_label_tl +\tl_new:N \l__chemformula_arrow_style_tl +\tl_new:N \l__chemformula_arrow_label_style_tl \tl_set:Nn \l__chemformula_arrow_label_style_tl { \footnotesize } \prop_new:N \l__chemformula_arrows_code_prop -\seq_new:N \l__chemformula_arrows_type_seq -\tl_new:N \l__chemformula_arrow_type_tl -\box_new:N \l__chemformula_arrow_arg_i_box -\box_new:N \l__chemformula_arrow_arg_ii_box +\seq_new:N \l__chemformula_arrows_type_seq +\tl_new:N \l__chemformula_arrow_type_tl +\box_new:N \l__chemformula_arrow_arg_i_box +\box_new:N \l__chemformula_arrow_arg_ii_box % read optional arguments \cs_new_nopar:Npn \l__chemformula_arrow_read_args:w @@ -392,9 +393,11 @@ % draw the arrows \cs_new_nopar:Npn \chemformula_arrow_draw:n #1 { + \chemmacros_allow_break: % prepare arrow code for drawing: % TODO: flexible Pfeilspitzen, TikZ-Keys ermöglichen - \tl_set_rescan:Nnn \l__chemformula_tmpc_tl { \char_set_catcode_letter:N \_ } { #1 } + \tl_set_rescan:Nnn \l__chemformula_tmpc_tl + { \char_set_catcode_letter:N \_ } { #1 } % determine length of the arrow \chemformula_determine_arrow_length:NN \l__chemformula_arrow_arg_i_box @@ -431,9 +434,9 @@ ; \tl_use:N \l__chemformula_tmpc_tl } + \chemmacros_allow_break: } \cs_generate_variant:Nn \chemformula_arrow_draw:n { V } -\cs_generate_variant:Nn \chemformula_determine_arrow_length:nn { NN } % commands to declare arrows (can also be used by users): % #1: symbol, #2: code @@ -637,10 +640,10 @@ \mode_if_math:TF { \mathchoice - { \hbox:n { #1 } } - { \hbox:n { #1 } } - { \hbox:n { \scriptsize #1 } } - { \hbox:n { \tiny #1 } } + { \text { #1 } } + { \text { #1 } } + { \text { \scriptsize #1 } } + { \text { \tiny #1 } } } { #1 } } @@ -677,6 +680,7 @@ \cs_new:Npn \chemformula_name_cmpd:w { \peek_meaning:NTF ( { \chemformula_name_cmpd_aux:w } { ! } } +% TODO % this is no document command -- but now nesting of brackets is possible \NewDocumentCommand \chemformula_name_cmpd_aux:w {r()r()} { @@ -685,7 +689,7 @@ { \bool_if:NF \l__chemformula_name_width_bool { - \chemformula_width_to_dim:Nn \l__chemformula_name_dim + \chemmacros_dim_to_width:Nn \l__chemformula_name_dim { \l__chemformula_name_format_tl #1 } } \parbox @@ -696,13 +700,6 @@ \) } -\cs_new:Npn \chemformula_width_to_dim:Nn #1#2 - { - \hbox_set:Nn \l__chemformula_tmpa_box { #2 } - \dim_set:Nn #1 { \box_wd:N \l__chemformula_tmpa_box } - \box_clear:N \l__chemformula_tmpa_box - } - \cs_new:Npn \chemformula_generate_name:n #1 { \tl_set:Nn \l__chemformula_tmpa_tl { #1 } @@ -754,67 +751,58 @@ \bool_new:N \l__chemformula_charge_full_shift_bool % token lists: -\tl_new:N \l__chemformula_chemformula_tmpa_tl -\tl_new:N \g__chemformula_options_tl -\tl_new:N \g__chemformula_output_tl -\tl_new:N \l__chemformula_output_tl -\tl_new:N \l__chemformula_input_tl -\tl_new:N \l__chemformula_stoich_tl -\tl_new:N \l__chemformula_decimal_output_tl - \tl_set:Nn \l__chemformula_decimal_output_tl { . } -\tl_new:N \l__chemformula_font_family_tl - \tl_set_eq:NN \l__chemformula_font_family_tl \f@family +\tl_new:N \l__chemformula_chemformula_tmpa_tl +\tl_new:N \g__chemformula_options_tl +\tl_new:N \g__chemformula_output_tl +\tl_new:N \l__chemformula_output_tl +\tl_new:N \l__chemformula_input_tl +\tl_new:N \l__chemformula_stoich_tl +\tl_new:N \l__chemformula_decimal_output_tl +\tl_set:Nn \l__chemformula_decimal_output_tl { . } +\tl_new:N \l__chemformula_font_family_tl +\tl_set_eq:NN \l__chemformula_font_family_tl \f@family \tl_new:N \l__chemformula_font_series_tl - \tl_set_eq:NN \l__chemformula_font_series_tl \f@series +\tl_set_eq:NN \l__chemformula_font_series_tl \f@series \tl_new:N \l__chemformula_font_shape_tl - \tl_set_eq:NN \l__chemformula_font_shape_tl \f@shape -\tl_new:N \l__chemformula_format_tl -\tl_new:N \l__chemformula_fontspec_options_tl -\tl_new:N \l__chemformula_fontspec_argument_tl -\tl_new:N \l__chemformula_name_format_tl - \tl_set:Nn \l__chemformula_name_format_tl { \scriptsize\centering } -\tl_new:N \l_chemormula_sup_super_factor_tl - -\tl_new:N \l__chemformula_bond_style_tl - -% dimensions: -\dim_new:N \l__chemformula_stoich_space_dim - \dim_set:Nn \l__chemformula_stoich_space_dim { .1667em } -\dim_new:N \l__chemformula_math_space_dim - \dim_set:Nn \l__chemformula_math_space_dim { .1667em } -\dim_new:N \l__chemformula_plus_space_dim - \dim_set:Nn \l__chemformula_plus_space_dim { .3em } -\dim_new:N \l__chemformula_cdot_space_dim - \dim_set:Nn \l__chemformula_cdot_space_dim { .1333em } -\dim_new:N \l__chemformula_charge_shift_dim - \dim_set:Nn \l__chemformula_charge_shift_dim { .5ex } -\dim_new:N \l__chemformula_subscript_shift_default_dim - \dim_set:Nn \l__chemformula_subscript_shift_default_dim { -.65ex } -\dim_new:N \l__chemformula_subscript_shift_dim - \dim_set_eq:NN - \l__chemformula_subscript_shift_dim - \l__chemformula_subscript_shift_default_dim -\dim_new:N \l__chemformula_subscript_shift_additional_dim -\dim_new:N \l__chemformula_superscript_shift_default_dim - \dim_set:Nn \l__chemformula_superscript_shift_default_dim { .8ex } -\dim_new:N \l__chemformula_superscript_shift_dim - \dim_set_eq:NN - \l__chemformula_superscript_shift_dim - \l__chemformula_superscript_shift_default_dim -\dim_new:N \l__chemformula_superscript_shift_additional_dim -\dim_new:N \l__chemformula_subscript_dim - \dim_zero:N \l__chemformula_subscript_dim -\dim_new:N \l__chemformula_superscript_dim - \dim_zero:N \l__chemformula_superscript_dim -\dim_new:N \l__chemformula_bond_dim - \dim_set:Nn \l__chemformula_bond_dim { 1.1667ex } +\tl_set_eq:NN \l__chemformula_font_shape_tl \f@shape +\tl_new:N \l__chemformula_format_tl +\tl_new:N \l__chemformula_fontspec_options_tl +\tl_new:N \l__chemformula_fontspec_argument_tl +\tl_new:N \l__chemformula_name_format_tl +\tl_set:Nn \l__chemformula_name_format_tl { \scriptsize\centering } +\tl_new:N \l_chemormula_sup_super_factor_tl +\tl_new:N \l__chemformula_subscript_shift_additional_tl +\tl_set:Nn \l__chemformula_subscript_shift_additional_tl { 0pt } +\tl_new:N \l__chemformula_superscript_shift_additional_tl +\tl_set:Nn \l__chemformula_superscript_shift_additional_tl { 0pt } +\tl_new:N \l__chemformula_bond_style_tl + +% dimensions and skips: +\skip_new:N \l__chemformula_stoich_space_skip +\skip_set:Nn \l__chemformula_stoich_space_skip { .1667em plus .0333em minus .0117em } +\skip_new:N \l__chemformula_math_space_skip +\skip_set:Nn \l__chemformula_math_space_skip { .1667em plus .0333em minus .0117em } +\skip_new:N \l__chemformula_plus_space_skip +\skip_set:Nn \l__chemformula_plus_space_skip { .3em plus .1em minus .1em } +\dim_new:N \l__chemformula_cdot_space_dim +\dim_set:Nn \l__chemformula_cdot_space_dim { .1333em } +\dim_new:N \l__chemformula_charge_shift_dim +\dim_set:Nn \l__chemformula_charge_shift_dim { .5ex } +\dim_new:N \l__chemformula_subscript_shift_dim +\dim_new:N \l__chemformula_superscript_shift_dim +\dim_new:N \l__chemformula_subscript_dim +\dim_zero:N \l__chemformula_subscript_dim +\dim_new:N \l__chemformula_superscript_dim +\dim_zero:N \l__chemformula_superscript_dim +\dim_new:N \l__chemformula_bond_dim +\dim_set:Nn \l__chemformula_bond_dim { .5833em } % integers: \int_new:N \l__chemformula_count_tokens_int % property lists: % behaviour in a compound -\prop_new:N \l__chemformula_cmpd_prop +\prop_new:N \l__chemformula_cmpd_prop \prop_put:Nnn \l__chemformula_cmpd_prop { 0 } { \chemformula_subscript:n { 0 } } \prop_put:Nnn \l__chemformula_cmpd_prop { 1 } { \chemformula_subscript:n { 1 } } \prop_put:Nnn \l__chemformula_cmpd_prop { 2 } { \chemformula_subscript:n { 2 } } @@ -832,7 +820,7 @@ \prop_put:Nnn \l__chemformula_cmpd_prop { + } { \chemformula_triple_bond: } % numbers -\prop_new:N \l__chemformula_numbers_prop +\prop_new:N \l__chemformula_numbers_prop \prop_put:Nnn \l__chemformula_numbers_prop { 0 } { 0 } \prop_put:Nnn \l__chemformula_numbers_prop { 1 } { 1 } \prop_put:Nnn \l__chemformula_numbers_prop { 2 } { 2 } @@ -845,33 +833,23 @@ \prop_put:Nnn \l__chemformula_numbers_prop { 9 } { 9 } % behaviour in a charge -\prop_new:N \l__chemformula_charge_prop -\prop_put:Nnn \l__chemformula_charge_prop { 0 } - { \chemformula_charge_style:n { 0 } } -\prop_put:Nnn \l__chemformula_charge_prop { 1 } - { \chemformula_charge_style:n { 1 } } -\prop_put:Nnn \l__chemformula_charge_prop { 2 } - { \chemformula_charge_style:n { 2 } } -\prop_put:Nnn \l__chemformula_charge_prop { 3 } - { \chemformula_charge_style:n { 3 } } -\prop_put:Nnn \l__chemformula_charge_prop { 4 } - { \chemformula_charge_style:n { 4 } } -\prop_put:Nnn \l__chemformula_charge_prop { 5 } - { \chemformula_charge_style:n { 5 } } -\prop_put:Nnn \l__chemformula_charge_prop { 6 } - { \chemformula_charge_style:n { 6 } } -\prop_put:Nnn \l__chemformula_charge_prop { 7 } - { \chemformula_charge_style:n { 7 } } -\prop_put:Nnn \l__chemformula_charge_prop { 8 } - { \chemformula_charge_style:n { 8 } } -\prop_put:Nnn \l__chemformula_charge_prop { 9 } - { \chemformula_charge_style:n { 9 } } +\prop_new:N \l__chemformula_charge_prop +\prop_put:Nnn \l__chemformula_charge_prop { 0 } { \chemformula_charge_style:n { 0 } } +\prop_put:Nnn \l__chemformula_charge_prop { 1 } { \chemformula_charge_style:n { 1 } } +\prop_put:Nnn \l__chemformula_charge_prop { 2 } { \chemformula_charge_style:n { 2 } } +\prop_put:Nnn \l__chemformula_charge_prop { 3 } { \chemformula_charge_style:n { 3 } } +\prop_put:Nnn \l__chemformula_charge_prop { 4 } { \chemformula_charge_style:n { 4 } } +\prop_put:Nnn \l__chemformula_charge_prop { 5 } { \chemformula_charge_style:n { 5 } } +\prop_put:Nnn \l__chemformula_charge_prop { 6 } { \chemformula_charge_style:n { 6 } } +\prop_put:Nnn \l__chemformula_charge_prop { 7 } { \chemformula_charge_style:n { 7 } } +\prop_put:Nnn \l__chemformula_charge_prop { 8 } { \chemformula_charge_style:n { 8 } } +\prop_put:Nnn \l__chemformula_charge_prop { 9 } { \chemformula_charge_style:n { 9 } } \prop_put:Nnn \l__chemformula_charge_prop { + } { \chemformula_plus: } \prop_put:Nnn \l__chemformula_charge_prop { - } { \chemformula_minus: } \prop_put:Nnn \l__chemformula_charge_prop { . } { \chemformula_radical: } % stoichiometric factors -\prop_new:N \l__chemformula_stoich_prop +\prop_new:N \l__chemformula_stoich_prop \prop_put:Nnn \l__chemformula_stoich_prop { 0 } { 0 } \prop_put:Nnn \l__chemformula_stoich_prop { 1 } { 1 } \prop_put:Nnn \l__chemformula_stoich_prop { 2 } { 2 } @@ -882,10 +860,8 @@ \prop_put:Nnn \l__chemformula_stoich_prop { 7 } { 7 } \prop_put:Nnn \l__chemformula_stoich_prop { 8 } { 8 } \prop_put:Nnn \l__chemformula_stoich_prop { 9 } { 9 } -\prop_put:Nnn \l__chemformula_stoich_prop { . } - { { \l__chemformula_decimal_output_tl } } -\prop_put:Nnn \l__chemformula_stoich_prop { , } - { { \l__chemformula_decimal_output_tl } } +\prop_put:Nnn \l__chemformula_stoich_prop { . } { { \l__chemformula_decimal_output_tl } } +\prop_put:Nnn \l__chemformula_stoich_prop { , } { { \l__chemformula_decimal_output_tl } } \prop_put:Nnn \l__chemformula_stoich_prop { / } { / } \prop_put:Nnn \l__chemformula_stoich_prop { _ } { _ } \prop_put:Nnn \l__chemformula_stoich_prop { ( } { ( } @@ -897,7 +873,8 @@ \dim_set:Nn \l__chemformula_bond_space_dim { .07em } \prop_new:N \l__chemformula_bonds_prop -\cs_new:Npn \chemformula@bondlength { \l__chemformula_bond_dim } +\cs_new:Npn \chemformula@bondlength + { \l__chemformula_bond_dim } \cs_new:Npn \chemformula_single_bond: { @@ -914,7 +891,7 @@ \cs_new:Npn \chemformula_bond:n #1 { - \skip_horizontal:N \l__chemformula_bond_space_dim + \chemmacros_skip_nobreak:N \l__chemformula_bond_space_dim \chemformula_tikz:nn { inner~sep = 0 , @@ -933,7 +910,7 @@ { \chemformula_bond_draw:n { single } } { \chemformula_bond_draw:n { #1 } } } - \skip_horizontal:N \l__chemformula_bond_space_dim + \chemmacros_skip_nobreak:N \l__chemformula_bond_space_dim } \cs_new:Npn \chemformula_bond_draw:n #1 @@ -1123,9 +1100,23 @@ { \chemformula_star_adduct: } { * } } +\cs_new_protected:Npn \chemformula_subscript_raise:N #1 + { + \hbox_set:Nn \l__chemformula_tmpa_box + { $\scriptstyle Hg$ } + \hbox_set:Nn \l__chemformula_tmpb_box { Hg } + \dim_set:Nn #1 + { + - \box_ht:N \l__chemformula_tmpa_box + + .4 \box_ht:N \l__chemformula_tmpb_box + + \l__chemformula_subscript_shift_additional_tl + } + \tex_raise:D #1 + } + \cs_new:Npn \chemformula_subscript_write:n #1 { - \tex_raise:D \l__chemformula_subscript_shift_dim + \chemformula_subscript_raise:N \l__chemformula_subscript_shift_dim \hbox:n { $\scriptstyle @@ -1141,7 +1132,8 @@ { \hbox_set:Nn \l__chemformula_tmpa_box { \chemformula_subscript_write:n { #1 } } - \dim_set:Nn \l__chemformula_subscript_dim { -\box_wd:N \l__chemformula_tmpa_box } + \dim_set:Nn \l__chemformula_subscript_dim + { -\box_wd:N \l__chemformula_tmpa_box } \box_clear:N \l__chemformula_tmpa_box } \cs_generate_variant:Nn \chemformula_measure_subscript:n { V } @@ -1204,9 +1196,23 @@ { . } { \chemformula_radical: } } +\cs_new_protected:Npn \chemformula_superscript_raise:N #1 + { + \hbox_set:Nn \l__chemformula_tmpa_box + { $\scriptstyle Hg$ } + \hbox_set:Nn \l__chemformula_tmpb_box { Hg } + \dim_set:Nn #1 + { + + \box_ht:N \l__chemformula_tmpb_box + - .5 \box_ht:N \l__chemformula_tmpa_box + + \l__chemformula_superscript_shift_additional_tl + } + \tex_raise:D #1 + } + \cs_new:Npn \chemformula_superscript_write:n #1 { - \tex_raise:D \l__chemformula_superscript_shift_dim + \chemformula_superscript_raise:N \l__chemformula_superscript_shift_dim \hbox:n { $\scriptstyle @@ -1497,7 +1503,7 @@ } { \tl_put_right:Nn #2 - { \skip_horizontal:N \l__chemformula_stoich_space_dim } + { \skip_horizontal:N \l__chemformula_stoich_space_skip } \tl_clear:N \l__chemformula_stoich_tl } } @@ -1534,10 +1540,9 @@ \cs_new:Npn \chemformula_fontspec_aux:w [#1]#2 \q_stop { \newfontfamily \chemformula_font: [ #1 ] { #2 } } - -\cs_new:Npn \chemformula_handle_sub_and_superscripts:nN #1#2 +\cs_new:Npn \chemformula_sanitize:Nn #1#2 { - \tl_set_rescan:Nnn \l__chemformula_tmpa_tl + \tl_set_rescan:Nnn #1 { \char_set_catcode_letter:N \_ \char_set_catcode_letter:N \{ @@ -1545,7 +1550,12 @@ \char_set_catcode_letter:N \\ \char_set_catcode_letter:N \# } - { #1 } + { #2 } + } + +\cs_new:Npn \chemformula_handle_sub_and_superscripts:nN #1#2 + { + \chemformula_sanitize:Nn \l__chemformula_tmpa_tl { #1 } % let's see if the compound starts with a sub- or superscript: \exp_args:Nx \tl_if_in:nnT { \tl_head:V \l__chemformula_tmpa_tl } { ^ } { @@ -1628,9 +1638,9 @@ { \tl_put_right:Nn \l__chemformula_input_tl { - \skip_horizontal:N \l__chemformula_plus_space_dim + \skip_horizontal:N \l__chemformula_plus_space_skip + - \skip_horizontal:N \l__chemformula_plus_space_dim + \skip_horizontal:N \l__chemformula_plus_space_skip } } \bool_set_false:N \l__chemformula_is_plus_bool @@ -1706,10 +1716,14 @@ \tl_set_rescan:Nnn \l__chemformula_tmpa_tl { \ExplSyntaxNamesOn \char_set_catcode_other:N \: } { { #1 } } - \tl_replace_all:Nnn \l__chemformula_tmpa_tl { \_ } { chemformulaplaceholder } - \tl_replace_all:Nnn \l__chemformula_tmpa_tl { _ } { \sb } % TODO use \c_math_subscript_token - \tl_replace_all:Nnn \l__chemformula_tmpa_tl { chemformulaplaceholder } { \_ } - \tl_set_rescan:Nno \l__chemformula_tmpa_tl { \ExplSyntaxOff } { \l__chemformula_tmpa_tl } + \tl_replace_all:Nnn \l__chemformula_tmpa_tl + { \_ } { chemformulaplaceholder } + \tl_replace_all:Nnn \l__chemformula_tmpa_tl + { _ } { \sb } % TODO use \c_math_subscript_token + \tl_replace_all:Nnn \l__chemformula_tmpa_tl + { chemformulaplaceholder } { \_ } + \tl_set_rescan:Nno \l__chemformula_tmpa_tl + { \ExplSyntaxOff } { \l__chemformula_tmpa_tl } \tl_put_right:NV \l__chemformula_input_tl \l__chemformula_tmpa_tl } @@ -1718,10 +1732,14 @@ \tl_set_rescan:Nnn \l__chemformula_tmpa_tl { \ExplSyntaxNamesOn \char_set_catcode_other:N \: } { { #1 } } - \tl_replace_all:Nnn \l__chemformula_tmpa_tl { \_ } { chemformulaplaceholder } - \tl_replace_all:Nnn \l__chemformula_tmpa_tl { _ } { \sb } % TODO use \c_math_subscript_token? - \tl_replace_all:Nnn \l__chemformula_tmpa_tl { chemformulaplaceholder } { \_ } - \tl_set_rescan:Nno \l__chemformula_tmpa_tl { \ExplSyntaxOff } { \l__chemformula_tmpa_tl } + \tl_replace_all:Nnn \l__chemformula_tmpa_tl + { \_ } { chemformulaplaceholder } + \tl_replace_all:Nnn \l__chemformula_tmpa_tl + { _ } { \sb } % TODO use \c_math_subscript_token? + \tl_replace_all:Nnn \l__chemformula_tmpa_tl + { chemformulaplaceholder } { \_ } + \tl_set_rescan:Nno \l__chemformula_tmpa_tl + { \ExplSyntaxOff } { \l__chemformula_tmpa_tl } \tl_put_right:NV \l__chemformula_input_tl \l__chemformula_tmpa_tl } @@ -1784,13 +1802,17 @@ \char_set_catcode_letter:N \} } { \mbox { \( #1 \) } } - \tl_replace_all:Nnn \l__chemformula_tmpa_tl { \_ } { chemformulaplaceholder } - \tl_replace_all:Nnn \l__chemformula_tmpa_tl { _ } { \sb } % TODO use \c_math_subscript_token - \tl_replace_all:Nnn \l__chemformula_tmpa_tl { chemformulaplaceholder } { \_ } - \tl_set_rescan:Nno \l__chemformula_tmpa_tl { \ExplSyntaxOff } { \l__chemformula_tmpa_tl } + \tl_replace_all:Nnn \l__chemformula_tmpa_tl + { \_ } { chemformulaplaceholder } + \tl_replace_all:Nnn \l__chemformula_tmpa_tl + { _ } { \sb } % TODO use \c_math_subscript_token + \tl_replace_all:Nnn \l__chemformula_tmpa_tl + { chemformulaplaceholder } { \_ } + \tl_set_rescan:Nno \l__chemformula_tmpa_tl + { \ExplSyntaxOff } { \l__chemformula_tmpa_tl } \tl_put_right:NV \l__chemformula_input_tl \l__chemformula_tmpa_tl \tl_put_right:Nn \l__chemformula_input_tl - { \skip_horizontal:N \l__chemformula_math_space_dim } + { \skip_horizontal:N \l__chemformula_math_space_skip } } \cs_new:Npn \chemformula_first_last_math:n #1 @@ -1826,30 +1848,16 @@ \bool_set_false:N \l__chemformula_charge_full_shift_bool \dim_set:Nn \l__chemformula_charge_shift_dim { #1 } } , - charge-hshift .default:n = .5ex , - charge-vshift .code:n = - { - \dim_set:Nn \l__chemformula_superscript_shift_additional_dim { #1 } - \dim_set:Nn \l__chemformula_superscript_shift_dim - { - \l__chemformula_superscript_shift_default_dim + - \l__chemformula_superscript_shift_additional_dim - } - } , + charge-hshift .default:n = .25em , + charge-vshift .tl_set:N = + \l__chemformula_superscript_shift_additional_tl , charge-style .choice: , charge-style / text .code:n = \bool_set_false:N \l__chemformula_charge_style_math_bool , charge-style / math .code:n = \bool_set_true:N \l__chemformula_charge_style_math_bool , - subscript-vshift .code:n = - { - \dim_set:Nn \l__chemformula_subscript_shift_additional_dim { #1 } - \dim_set:Nn \l__chemformula_subscript_shift_dim - { - \l__chemformula_subscript_shift_default_dim + - \l__chemformula_subscript_shift_additional_dim - } - } , + subscript-vshift .tl_set:N = + \l__chemformula_subscript_shift_additional_tl , subscript-vshift .default:n = 0pt , subscript-style .choice: , subscript-style / text .code:n = @@ -1870,12 +1878,12 @@ \bool_set_false:N \l__chemformula_xfrac_bool \bool_set_true:N \l__chemformula_nicefrac_bool \bool_set_false:N \l__chemformula_mathfrac_bool , - stoich-space .dim_set:N = \l__chemformula_stoich_space_dim , - adduct-space .dim_set:N = \l__chemformula_cdot_space_dim , - plus-space .dim_set:N = \l__chemformula_plus_space_dim , - math-space .dim_set:N = \l__chemformula_math_space_dim , - name-format .tl_set:N = \l__chemformula_name_format_tl , - name-width .code:n = + stoich-space .skip_set:N = \l__chemformula_stoich_space_skip , + adduct-space .dim_set:N = \l__chemformula_cdot_space_dim , + plus-space .skip_set:N = \l__chemformula_plus_space_skip , + math-space .skip_set:N = \l__chemformula_math_space_skip , + name-format .tl_set:N = \l__chemformula_name_format_tl , + name-width .code:n = { \tl_if_eq:nnTF { #1 } { auto } { \bool_set_false:N \l__chemformula_name_width_bool } @@ -1915,7 +1923,7 @@ %-----------------------------------------------------------------------------% % hyperref support \AfterPackage* { hyperref } - { \pdfstringdefDisableCommands { \cs_set:Npn \cn #1 { #1 } } } + { \pdfstringdefDisableCommands { \cs_set:Npn \ch #1 { #1 } } } \tex_endinput:D %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index 26b5fae721b..abab3ca94d1 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty @@ -29,8 +29,8 @@ \RequirePackage{ expl3 , xparse , l3keys2e , xfrac , siunitx } \RequirePackage{ tikz , mathtools , environ , scrlfile , etoolbox , bm } \usetikzlibrary{calc,arrows} -\def\chemmacros@version{3.4b} -\def\chemmacros@date{2013/01/04} +\def\chemmacros@version{3.5} +\def\chemmacros@date{2013/01/28} \ProvidesExplPackage {chemmacros} @@ -126,6 +126,18 @@ \token_to_str:N #2 \c_space_tl instead. } +\cs_new_protected:Npn \chemmacros_define_deprecated:NNn #1#2#3 + { + \cs_new_protected:Npn #1 + { + \chemmacros_msg:nnxx { chemmacros } { command-deprecated } + { #1 } { #2 } + #3 + } + } +\NewDocumentCommand \DeclareChemDeprecated { mmm } + { \chemmacros_define_deprecated:NNn #1 #2 { #3 } } + \msg_set:nnnn { chemmacros } { command-dropped } { The~command~\token_to_str:N #1 \c_space_tl has~been~dropped.~I'm~sorry. } { The~command~\token_to_str:N #1 \c_space_tl has~been~dropped.~I'm~sorry. } @@ -268,6 +280,7 @@ \tl_new:N \l__chemmacros_tmpa_tl \tl_new:N \l__chemmacros_tmpb_tl \int_new:N \l__chemmacros_tmpa_int +\box_new:N \l__chemmacros_tmpa_box % --------------------------------------------------------------------------- % % package options @@ -292,7 +305,7 @@ \bool_new:N \l__chemmacros_use_upgreek_bool \bool_new:N \l__chemmacros_use_textgreek_bool -\bool_new:N \l__chemmacros_option_upgreek_set_bool +\bool_new:N \l__chemmacros_option_greek_set_bool \tl_new:N \l__chemmacros_language_tl \tl_set:Nn \l__chemmacros_language_tl { english } @@ -368,18 +381,22 @@ synchronize .default:n = true , greek .choice: , greek / upgreek .code:n = - \bool_set_true:N \l__chemmacros_use_upgreek_bool - \bool_set_false:N \l__chemmacros_use_textgreek_bool - \bool_set_true:N \l__chemmacros_option_upgreek_set_bool , + \bool_set_true:N \l__chemmacros_use_upgreek_bool + \bool_set_false:N \l__chemmacros_use_textgreek_bool + \bool_set_true:N \l__chemmacros_option_greek_set_bool , greek / textgreek .code:n = \bool_set_false:N \l__chemmacros_use_upgreek_bool \bool_set_true:N \l__chemmacros_use_textgreek_bool - \bool_set_true:N \l__chemmacros_option_upgreek_set_bool , + \bool_set_true:N \l__chemmacros_option_greek_set_bool , greek / math .code:n = \bool_set_false:N \l__chemmacros_use_upgreek_bool - \bool_set_false:N \l__chemmacros_use_textgreek_bool - \bool_set_true:N \l__chemmacros_option_upgreek_set_bool , - greek .default:n = upgreek , + \bool_set_false:N \l__chemmacros_use_textgreek_bool + \bool_set_true:N \l__chemmacros_option_greek_set_bool , + greek / auto .code:n = + \bool_set_false:N \l__chemmacros_use_upgreek_bool + \bool_set_false:N \l__chemmacros_use_textgreek_bool + \bool_set_false:N \l__chemmacros_option_greek_set_bool , + greek .default:n = auto , upgreek .code:n = \chemmacros_msg:nnxx { chemmacros } { option-deprecated } { upgreek } {} , @@ -418,7 +435,7 @@ { \bool_new:c { l__chemmacros_ #2 _bool } } } -\cs_new_nopar:Npn \chemmacros_set_language: +\cs_new_protected:Npn \chemmacros_set_language: { \prop_get:NoNTF \l__chemmacros_language_prop @@ -446,84 +463,70 @@ { \RequirePackage { xspace } } \bool_if:NT \l__chemmacros_use_mhchem_bool { \RequirePackage[ version=3 ]{ mhchem } } - \bool_if:NF \l__chemmacros_option_upgreek_set_bool + \bool_if:NF \l__chemmacros_option_greek_set_bool { \@ifpackageloaded { upgreek } { \bool_set_true:N \l__chemmacros_use_upgreek_bool } { \@ifpackageloaded { textgreek } { \bool_set_true:N \l__chemmacros_use_textgreek_bool } - {} + { } } } \bool_if:NTF \l__chemmacros_use_upgreek_bool { - \cs_set_nopar:Npn \Chemalpha { \ensuremath { \upalpha } } - \cs_set_nopar:Npn \Chembeta { \ensuremath { \upbeta } } - \cs_set_nopar:Npn \Chemgamma { \ensuremath { \upgamma } } - \cs_set_nopar:Npn \Chemdelta { \ensuremath { \updelta } } - \cs_set_nopar:Npn \Chemepsilon { \ensuremath { \upvarepsilon } } - \cs_set_nopar:Npn \Chemeta { \ensuremath { \upeta } } - \cs_set_nopar:Npn \Chemkappa { \ensuremath { \upkappa } } - \cs_set_nopar:Npn \Chemmu { \ensuremath { \upmu } } - \cs_set_nopar:Npn \Chemnu { \ensuremath { \upnu } } - \cs_set_nopar:Npn \Chemrho { \ensuremath { \uprho } } - \cs_set_nopar:Npn \Chempi { \ensuremath { \uppi } } - \cs_set_nopar:Npn \Chemsigma { \ensuremath { \upsigma } } - \cs_set_nopar:Npn \Chemomega { \ensuremath { \upomega } } - \cs_set_nopar:Npn \ChemDelta { \ensuremath { \Updelta } } + \cs_set:Npn \Chemalpha { \ensuremath { \upalpha } } + \cs_set:Npn \Chembeta { \ensuremath { \upbeta } } + \cs_set:Npn \Chemgamma { \ensuremath { \upgamma } } + \cs_set:Npn \Chemdelta { \ensuremath { \updelta } } + \cs_set:Npn \Chemepsilon { \ensuremath { \upvarepsilon } } + \cs_set:Npn \Chemeta { \ensuremath { \upeta } } + \cs_set:Npn \Chemkappa { \ensuremath { \upkappa } } + \cs_set:Npn \Chemmu { \ensuremath { \upmu } } + \cs_set:Npn \Chemnu { \ensuremath { \upnu } } + \cs_set:Npn \Chemrho { \ensuremath { \uprho } } + \cs_set:Npn \Chempi { \ensuremath { \uppi } } + \cs_set:Npn \Chemsigma { \ensuremath { \upsigma } } + \cs_set:Npn \Chemomega { \ensuremath { \upomega } } + \cs_set:Npn \ChemDelta { \ensuremath { \Updelta } } } { \bool_if:NT \l__chemmacros_use_textgreek_bool { - \cs_set_nopar:Npn \Chemalpha - { \ensuremath { \text { \textalpha } } } - \cs_set_nopar:Npn \Chembeta - { \ensuremath { \text { \textbeta } } } - \cs_set_nopar:Npn \Chemgamma - { \ensuremath { \text { \textgamma } } } - \cs_set_nopar:Npn \Chemdelta - { \ensuremath { \text { \textdelta } } } - \cs_set_nopar:Npn \Chemepsilon - { \ensuremath { \text { \textepsilon } } } - \cs_set_nopar:Npn \Chemeta - { \ensuremath { \text { \texteta } } } - \cs_set_nopar:Npn \Chemkappa - { \ensuremath { \text { \textkappa } } } - \cs_set_nopar:Npn \Chemmu - { \ensuremath { \text { \textmu } } } - \cs_set_nopar:Npn \Chemnu - { \ensuremath { \text { \textnu } } } - \cs_set_nopar:Npn \Chemrho - { \ensuremath { \text { \textrho } } } - \cs_set_nopar:Npn \Chempi - { \ensuremath { \text { \textpi } } } - \cs_set_nopar:Npn \Chemsigma - { \ensuremath { \text { \textsigma } } } - \cs_set_nopar:Npn \Chemomega - { \ensuremath { \text { \textomega } } } - \cs_set_nopar:Npn \ChemDelta - { \ensuremath { \text { \textDelta } } } + \cs_set_protected:Npn \Chemalpha { \ensuremath { \text { \textalpha } } } + \cs_set_protected:Npn \Chembeta { \ensuremath { \text { \textbeta } } } + \cs_set_protected:Npn \Chemgamma { \ensuremath { \text { \textgamma } } } + \cs_set_protected:Npn \Chemdelta { \ensuremath { \text { \textdelta } } } + \cs_set_protected:Npn \Chemepsilon { \ensuremath { \text { \textepsilon } } } + \cs_set_protected:Npn \Chemeta { \ensuremath { \text { \texteta } } } + \cs_set_protected:Npn \Chemkappa { \ensuremath { \text { \textkappa } } } + \cs_set_protected:Npn \Chemmu { \ensuremath { \text { \textmu } } } + \cs_set_protected:Npn \Chemnu { \ensuremath { \text { \textnu } } } + \cs_set_protected:Npn \Chemrho { \ensuremath { \text { \textrho } } } + \cs_set_protected:Npn \Chempi { \ensuremath { \text { \textpi } } } + \cs_set_protected:Npn \Chemsigma { \ensuremath { \text { \textsigma } } } + \cs_set_protected:Npn \Chemomega { \ensuremath { \text { \textomega } } } + \cs_set_protected:Npn \ChemDelta { \ensuremath { \text { \textDelta } } } } } } -\cs_new_nopar:Npn \Chemalpha { \ensuremath { \alpha } } -\cs_new_nopar:Npn \Chembeta { \ensuremath { \beta } } -\cs_new_nopar:Npn \Chemgamma { \ensuremath { \gamma } } -\cs_new_nopar:Npn \Chemdelta { \ensuremath { \delta } } -\cs_new_nopar:Npn \Chemepsilon { \ensuremath { \varepsilon } } -\cs_new_nopar:Npn \Chemeta { \ensuremath { \eta } } -\cs_set_nopar:Npn \Chemkappa { \ensuremath { \kappa } } -\cs_new_nopar:Npn \Chemmu { \ensuremath { \mu } } -\cs_new_nopar:Npn \Chemnu { \ensuremath { \nu } } -\cs_new_nopar:Npn \Chemrho { \ensuremath { \rho } } -\cs_new_nopar:Npn \Chempi { \ensuremath { \pi } } -\cs_new_nopar:Npn \Chemsigma { \ensuremath { \sigma } } -\cs_new_nopar:Npn \Chemomega { \ensuremath { \omega } } -\cs_new_nopar:Npn \ChemDelta { \ensuremath { \Delta } } +\cs_new:Npn \Chemalpha { \ensuremath { \alpha } } +\cs_new:Npn \Chembeta { \ensuremath { \beta } } +\cs_new:Npn \Chemgamma { \ensuremath { \gamma } } +\cs_new:Npn \Chemdelta { \ensuremath { \delta } } +\cs_new:Npn \Chemepsilon { \ensuremath { \varepsilon } } +\cs_new:Npn \Chemeta { \ensuremath { \eta } } +\cs_new:Npn \Chemkappa { \ensuremath { \kappa } } +\cs_new:Npn \Chemmu { \ensuremath { \mu } } +\cs_new:Npn \Chemnu { \ensuremath { \nu } } +\cs_new:Npn \Chemrho { \ensuremath { \rho } } +\cs_new:Npn \Chempi { \ensuremath { \pi } } +\cs_new:Npn \Chemsigma { \ensuremath { \sigma } } +\cs_new:Npn \Chemomega { \ensuremath { \omega } } +\cs_new:Npn \ChemDelta { \ensuremath { \Delta } } -\cs_new_nopar:Npn \chemmacros_xspace: +\cs_new:Npn \chemmacros_xspace: { \bool_if:NT \l__chemmacros_xspace_bool { \xspace } @@ -531,44 +534,60 @@ % --------------------------------------------------------------------------- % % TikZ drawings -\cs_new_nopar:Npn \chemmacros_tikz_picture:nn #1#2 +\cs_new:Npn \chemmacros_tikz_picture:nn #1#2 { \tikzpicture[#1] #2 \endtikzpicture } \cs_generate_variant:Nn \chemmacros_tikz_picture:nn { fn,xn } -\cs_new_nopar:Npn \chemmacros_tikz_draw:n #1 +\cs_new:Npn \chemmacros_tikz_draw:n #1 { \draw[#1] } \cs_generate_variant:Nn \chemmacros_tikz_draw:n { f,x } -\cs_new_nopar:Npn \chemmacros_tikz_node:n #1 +\cs_new:Npn \chemmacros_tikz_node:n #1 { \node[#1] } \cs_generate_variant:Nn \chemmacros_tikz_node:n { f,x } -\cs_new_nopar:Npn \chemmacros_tikz_shade:n #1 +\cs_new:Npn \chemmacros_tikz_shade:n #1 { \shade[#1] } \cs_generate_variant:Nn \chemmacros_tikz_shade:n { f,x } -\cs_new_nopar:Npn \chemmacros_tikz_shadedraw:n #1 +\cs_new:Npn \chemmacros_tikz_shadedraw:n #1 { \shadedraw[#1] } \cs_generate_variant:Nn \chemmacros_tikz_shadedraw:n { f,x } -\cs_new_nopar:Npn \chemmacros_tikz_node_in_draw:n #1 +\cs_new:Npn \chemmacros_tikz_node_in_draw:n #1 { node[#1] } \cs_generate_variant:Nn \chemmacros_tikz_node_in_draw:n { f,x } % --------------------------------------------------------------------------- % % general functions -\cs_new_protected_nopar:Npn \chemmacros_leave_vmode: +\cs_new_protected:Npn \chemmacros_leave_vmode: { \hbox_unpack:N \c_empty_box } + \cs_new_eq:NN \chemmacros_ignore_spaces: \tex_ignorespaces:D +\cs_new:Npn \chemmacros_nobreak: + { \tex_penalty:D \c_ten_thousand } + +\cs_new:Npn \chemmacros_allow_break: + { \tex_penalty:D \c_zero } + +\cs_new:Npn \chemmacros_skip_nobreak:N #1 + { + \chemmacros_nobreak: + \skip_horizontal:N #1 + \chemmacros_nobreak: + } + % --------------------------------------------------------------------------- % % circled charge signs -\cs_new_nopar:Npn \chemmacros_fplus: +\cs_new_protected:Npn \chemmacros_fplus: { \ensuremath { \chemmacros_fplus_aux_i: } } -\cs_new_nopar:Npn \chemmacros_fplus_aux_i: + +\cs_new:Npn \chemmacros_fplus_aux_i: { \mathpalette \chemmacros_fplus_aux_ii: \bigcirc } + % TODO: can I rewrite this in a more "expl3-way"? -\cs_new_nopar:Npn \chemmacros_fplus_aux_ii: #1#2 +\cs_new:Npn \chemmacros_fplus_aux_ii: #1#2 { \ooalign { @@ -583,11 +602,13 @@ } } -\cs_new_nopar:Npn \chemmacros_fminus: +\cs_new_protected:Npn \chemmacros_fminus: { \ensuremath { \chemmacros_fminus_aux_i: } } -\cs_new_nopar:Npn \chemmacros_fminus_aux_i: + +\cs_new:Npn \chemmacros_fminus_aux_i: { \mathpalette \chemmacros_fminus_aux_aux_ii: \bigcirc } -\cs_new_nopar:Npn \chemmacros_fminus_aux_aux_ii: #1#2 + +\cs_new:Npn \chemmacros_fminus_aux_aux_ii: #1#2 { \ooalign { @@ -607,7 +628,7 @@ \cs_new_eq:NN \fminus \chemmacros_fminus: % change output depending on circled-option -\cs_new_nopar:Npn \chemmacros_plus: +\cs_new:Npn \chemmacros_plus: { \bool_if:nTF { \l__chemmacros_circled_bool && !\l__chemmacros_circled_formal_bool } @@ -619,7 +640,7 @@ { + } } -\cs_new_nopar:Npn \chemmacros_minus: +\cs_new:Npn \chemmacros_minus: { \bool_if:nTF { \l__chemmacros_circled_bool && !\l__chemmacros_circled_formal_bool } @@ -631,21 +652,25 @@ { - } } -\cs_new_nopar:Npn \chemmacros_formal_plus: +\cs_new_protected:Npn \chemmacros_formal_plus: { - \bool_set_false:N \l__chemmacros_circled_formal_bool - \chemmacros_plus: + \group_begin: + \bool_set_false:N \l__chemmacros_circled_formal_bool + \chemmacros_plus: + \group_end: } -\cs_new_nopar:Npn \chemmacros_formal_minus: +\cs_new_protected:Npn \chemmacros_formal_minus: { - \bool_set_false:N \l__chemmacros_circled_formal_bool - \chemmacros_minus: + \group_begin: + \bool_set_false:N \l__chemmacros_circled_formal_bool + \chemmacros_minus: + \group_end: } % --------------------------------------------------------------------------- % % transition state symbol -\cs_new_nopar:Npn \chemmacros_transition_state_aux: +\cs_new:Npn \chemmacros_transition_state_aux: { \text { @@ -658,7 +683,7 @@ } } -\cs_new_nopar:Npn \transitionstatesymbol +\cs_new_protected:Npn \chemmacros_transition_state: { \ensuremath { @@ -671,6 +696,8 @@ } } +\cs_new_eq:NN \transitionstatesymbol \chemmacros_transition_state: + \cs_new:Nn \chemmacros_atom:n { \mode_if_math:TF @@ -685,17 +712,17 @@ % add a possibility to let chemformula use the chemformula % with method=chemformula, too \tl_new:N \l__chemmacros_chemformula_tl -\cs_new:Npn \chemmacros_chemformula:n #1 +\cs_new_protected:Npn \chemmacros_chemformula:n #1 { \bool_if:NTF \l__chemmacros_use_mhchem_bool { \ce { #1 } } { \group_begin: - \cs_set_eq:NN \chemformula_font_inner: \chemmacros_inner_font: - \chemformula_input_cmpd:nN { #1 } \l__chemmacros_chemformula_tl - \mode_if_math:TF - { \text { \l__chemmacros_chemformula_tl } } - { { \l__chemmacros_chemformula_tl } } + \cs_set_eq:NN \chemformula_font_inner: \chemmacros_inner_font: + \chemformula_input_cmpd:nN { #1 } \l__chemmacros_chemformula_tl + \mode_if_math:TF + { \text { \l__chemmacros_chemformula_tl } } + { { \l__chemmacros_chemformula_tl } } \group_end: } } @@ -706,46 +733,41 @@ \bool_new:N \l__chemmacros_charge_append_bool \bool_set_false:N \l__chemmacros_charge_append_bool +% TODO separate document and module level % \DeclareChemParticle, \RenewChemParticle \bool_if:NTF \l__chemmacros_use_mhchem_bool { \NewDocumentCommand \DeclareChemParticle { mm } { \cs_if_free:NTF #1 - { - \cs_new_nopar:Npn #1 - { \ce { #2 } \chemmacros_xspace: } - } + { \cs_new:Npn #1 { \ce { #2 } \chemmacros_xspace: } } { \chemmacros_msg:nnxx { chemmacros } { declare-particle } { #1 } {} } } \NewDocumentCommand \RenewChemParticle { mm } { \cs_if_free:NTF #1 { \chemmacros_msg:nnxx { chemmacros } { renew-particle } { #1 } {} } - { - \cs_set_nopar:Npn #1 - { \ce { #2 } \chemmacros_xspace: } - } + { \cs_set:Npn #1 { \ce { #2 } \chemmacros_xspace: } } } } { \NewDocumentCommand \DeclareChemParticle { mm } { \cs_if_free:NTF #1 - { \chemmacros_chem_particle:nn #1 { #2 } } + { \chemmacros_chem_particle:Nn #1 { #2 } } { \chemmacros_msg:nnxx { chemmacros } { declare-particle } { #1 } {} } } \NewDocumentCommand \RenewChemParticle { mm } { \cs_if_free:NTF #1 { \chemmacros_msg:nnxx { chemmacros } { renew-particle } { #1 } {} } - { \chemmacros_chem_particle:nn #1 { #2 } } + { \chemmacros_chem_particle:Nn #1 { #2 } } } } -\cs_new_nopar:Nn \chemmacros_chem_particle:nn +\cs_new_protected:Nn \chemmacros_chem_particle:Nn { - \cs_set_nopar:Npn #1 + \cs_set:Npn #1 { \bool_if:NTF \l__chemformula_inside_ch_bool { @@ -771,31 +793,31 @@ \bool_if:NTF \l__chemmacros_use_mhchem_bool { - \cs_new_nopar:Npn \el { \chemmacros_atom:n { e } \mch \chemmacros_xspace: } - \cs_new_nopar:Npn \prt { \chemmacros_atom:n { p } \pch \chemmacros_xspace: } + \cs_new:Npn \el { \chemmacros_atom:n { e } \mch \chemmacros_xspace: } + \cs_new:Npn \prt { \chemmacros_atom:n { p } \pch \chemmacros_xspace: } } { - \DeclareChemParticle \el { e- } + \DeclareChemParticle \el { e- } \DeclareChemParticle \prt { p+ } } \DeclareChemParticle \ntr { n^0 } -\cs_new_nopar:Npn \chemmacros_bm:n #1 +\cs_new:Npn \chemmacros_bm:n #1 { \bool_if:NTF \l__chemmacros_detect_bold_bool { \bm { #1 } } { #1 } } -\cs_new_nopar:Npn \chemmacros_bf:n #1 +\cs_new:Npn \chemmacros_bf:n #1 { \bool_if:NTF \l__chemmacros_detect_bold_bool { { \normalfont \bfseries #1 } } { { \normalfont #1 } } } -\cs_new_nopar:Npn \chemmacros_detect_bold:n #1 +\cs_new:Npn \chemmacros_detect_bold:n #1 { \chemmacros_if_bold:TF { @@ -814,7 +836,7 @@ } % charges -\cs_new_nopar:Npn \chemmacros_charge:n #1 +\cs_new:Npn \chemmacros_charge:n #1 { \bool_if:NTF \l__chemmacros_charge_append_bool { @@ -863,25 +885,25 @@ { \chemmacros_charge:n { #1 \chemmacros_formal_plus: } } } -\cs_new_nopar:Npn \delm +\cs_new:Npn \delm { \mbox { \tiny \( \delta \chemmacros_minus: \) } \chemmacros_xspace: } -\cs_new_nopar:Npn \delp +\cs_new:Npn \delp { \mbox { \tiny \( \delta \chemmacros_plus: \) } \chemmacros_xspace: } -\cs_new_nopar:Npn \fdelm +\cs_new:Npn \fdelm { \mbox { \tiny \( \delta \chemmacros_formal_minus: \) } \chemmacros_xspace: } -\cs_new_nopar:Npn \fdelp +\cs_new:Npn \fdelp { \mbox { \tiny \( \delta \chemmacros_formal_plus: \) } \chemmacros_xspace: } -\cs_new_nopar:Npn \scrm +\cs_new:Npn \scrm { \ensuremath { \scriptstyle \chemmacros_minus: } } -\cs_new_nopar:Npn \scrp +\cs_new:Npn \scrp { \ensuremath { \scriptstyle \chemmacros_plus: } } -\cs_new_nopar:Npn \fscrm +\cs_new:Npn \fscrm { \ensuremath { \scriptstyle \chemmacros_formal_minus: } } -\cs_new_nopar:Npn \fscrp +\cs_new:Npn \fscrp { \ensuremath { \scriptstyle \chemmacros_formal_plus: } } -\cs_new_nopar:Npn \fsscrm +\cs_new:Npn \fsscrm { \ensuremath { \scriptscriptstyle \chemmacros_formal_minus: } } -\cs_new_nopar:Npn \fsscrp +\cs_new:Npn \fsscrp { \ensuremath { \scriptscriptstyle \chemmacros_formal_plus: } } % --------------------------------------------------------------------------- % @@ -889,12 +911,10 @@ % proton, hydroxide, hydronium/oxonium, water, nucleophile, electrophile \bool_if:NTF \l__chemmacros_use_mhchem_bool { - \cs_new_nopar:Npn \Hpl { \chemmacros_atom:n { H } \pch \chemmacros_xspace: } - \cs_new_nopar:Npn \Hyd - { \chemmacros_atom:n { OH } \mch \chemmacros_xspace: } - \cs_new_nopar:Npn \HtO - { \chemmacros_chemformula:n { H3O } \pch \chemmacros_xspace: } - \cs_new_nopar:Npn \El { \chemmacros_atom:n { E } \pch \chemmacros_xspace: } + \cs_new:Npn \Hpl { \chemmacros_atom:n { H } \pch \chemmacros_xspace: } + \cs_new:Npn \Hyd { \chemmacros_atom:n { OH } \mch \chemmacros_xspace: } + \cs_new:Npn \HtO { \chemmacros_chemformula:n { H3O } \pch \chemmacros_xspace: } + \cs_new:Npn \El { \chemmacros_atom:n { E } \pch \chemmacros_xspace: } } { \DeclareChemParticle \Hpl { H+ } @@ -938,7 +958,7 @@ \chemmacros_xspace: } -\cs_new_nopar:Npn \chemmacros_elpair:n #1 +\cs_new:Npn \chemmacros_elpair:n #1 { \bool_if:NTF \l__chemmacros_chemfig_bool { @@ -979,34 +999,40 @@ % IUPAC \prop_new:N \l__chemmacros_iupac_prop -\NewDocumentCommand \DeclareChemIUPAC { mm } +\cs_new_protected:Npn \chemmacros_declare_iupac:Nn #1#2 { - \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } - \tl_set:Nf \l__chemmacros_tmpa_tl { \tl_tail:V \l__chemmacros_tmpa_tl } + \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl + { \char_set_catcode_letter:N \\ } + { #1 } + \tl_set:Nf \l__chemmacros_tmpa_tl + { \tl_tail:V \l__chemmacros_tmpa_tl } \prop_if_in:NoTF \l__chemmacros_iupac_prop { \l__chemmacros_tmpa_tl } { \chemmacros_msg:nnxx { chemmacros } { declare-iupac } { #1 } { } } { \prop_put:Non \l__chemmacros_iupac_prop { \l__chemmacros_tmpa_tl } { #2 } } \chemmacros_make_iupac: } -\NewDocumentCommand \RenewChemIUPAC { mm } +\cs_new_protected:Npn \chemmacros_renew_iupac:Nn #1#2 { - \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } - \tl_set:Nf \l__chemmacros_tmpa_tl { \tl_tail:V \l__chemmacros_tmpa_tl } + \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl + { \char_set_catcode_letter:N \\ } + { #1 } + \tl_set:Nf \l__chemmacros_tmpa_tl + { \tl_tail:V \l__chemmacros_tmpa_tl } \prop_if_in:NoTF \l__chemmacros_iupac_prop { \l__chemmacros_tmpa_tl } { \prop_put:Non \l__chemmacros_iupac_prop { \l__chemmacros_tmpa_tl } { #2 } } { \chemmacros_msg:nnxx { chemmacros } { renew-iupac } { #1 } { } } \chemmacros_make_iupac: } -\cs_new_nopar:Npn \chemmacros_make_iupac: +\cs_new_protected:Npn \chemmacros_make_iupac: { \bool_if:NT \l__chemmacros_in_document_bool { \bool_if:NTF \l__chemmacros_inside_iupac_bool { \prop_map_inline:Nn \l__chemmacros_iupac_prop - { \cs_set_protected_nopar:cpn { ##1 } { ##2 } } + { \cs_set_protected:cpn { ##1 } { ##2 } } } { \bool_if:NF \l__chemmacros_iupac_restricted_bool @@ -1014,13 +1040,13 @@ \bool_if:NTF \l__chemmacros_iupac_strict_bool { \prop_map_inline:Nn \l__chemmacros_iupac_prop - { \cs_set_protected_nopar:cpn { ##1 } { ##2 } } + { \cs_set_protected:cpn { ##1 } { ##2 } } } { \prop_map_inline:Nn \l__chemmacros_iupac_prop { \cs_if_exist:cF { ##1 } - { \cs_set_protected_nopar:cpn { ##1 } { ##2 } } + { \cs_set_protected:cpn { ##1 } { ##2 } } } } } @@ -1030,10 +1056,17 @@ \AtBeginDocument { \chemmacros_make_iupac: } +\NewDocumentCommand \DeclareChemIUPAC { mm } + { \chemmacros_declare_iupac:Nn #1 { #2 } } + +\NewDocumentCommand \RenewChemIUPAC { mm } + { \chemmacros_renew_iupac:Nn #1 { #2 } } + % stereo descriptors and other nomenclature commands % Cahn-Ingold-Prelog -\dim_new:N \l__chemmacros_cip_kern_dim -\dim_set:Nn \l__chemmacros_cip_kern_dim { .05ex } +\dim_new:N \l__chemmacros_cip_kern_dim +\dim_set:Nn \l__chemmacros_cip_kern_dim { .075em } + \keys_define:nn { chemmacros / iupac } { cip-kern .dim_set:N = \l__chemmacros_cip_kern_dim } @@ -1041,22 +1074,13 @@ { \cs_if_exist:NTF \EmbracOff { \textit* { (#1) } } - { \textit { (#1) } } + { \textit { (#1) } } \tex_kern:D \l__chemmacros_cip_kern_dim } -\cs_new_protected_nopar:Npn \Rcip - { - \chemmacros_msg:nnxx { chemmacros } { command-deprecated } - { \Rcip } { \R } - \cip { R } - } -\cs_new_protected_nopar:Npn \Scip - { - \chemmacros_msg:nnxx { chemmacros } { command-deprecated } - { \Scip } { \S } - \cip { S } - } +\DeclareChemDeprecated \Rcip \R { \cip { R } } +\DeclareChemDeprecated \Scip \S { \cip { S } } + \DeclareChemIUPAC \R { \cip { R } } \DeclareChemIUPAC \S { \cip { S } } @@ -1086,23 +1110,14 @@ \DeclareChemIUPAC \Z { \cip { Z } } % cis/trans & tert -\DeclareChemIUPAC \cis { \textit{ cis } } +\DeclareChemIUPAC \cis { \textit{ cis } } \DeclareChemIUPAC \trans { \textit { trans } } -\DeclareChemIUPAC \tert { \textit { tert } } +\DeclareChemIUPAC \tert { \textit { tert } } % Fischer -\cs_set_protected_nopar:Npn \Dfi - { - \chemmacros_msg:nnxx { chemmacros } { command-deprecated } - { \Dfi } { \D } - \textsc { d } - } -\cs_set_protected_nopar:Npn \Lfi - { - \chemmacros_msg:nnxx { chemmacros } { command-deprecated } - { \Lfi } { \L } - \textsc { l } - } +\DeclareChemDeprecated \Dfi \D { \textsc { d } } +\DeclareChemDeprecated \Lfi \L { \textsc { l } } + \DeclareChemIUPAC \D { \textsc { d } } \DeclareChemIUPAC \L { \textsc { l } } @@ -1117,6 +1132,7 @@ % coordination chemistry \bool_new:N \l__chemmacros_bridge_super_bool + \keys_define:nn { chemmacros / iupac } { bridge-number .choice: , @@ -1128,12 +1144,13 @@ coord-use-hyphen .default:n = true } -\cs_new_nopar:Npn \chemformula_hapto:n #1 +\cs_new:Npn \chemformula_hapto:n #1 { \Chemeta \chemformula_superscript:n { #1 } \chemmacros_break_point_hyphen: } -\cs_new_nopar:Npn \chemformula_bridge:n #1 +\cs_new:Npn \chemformula_bridge:n #1 { - \Chemmu \tl_if_blank:nF { #1 } + \Chemmu + \tl_if_blank:nF { #1 } { \bool_if:NTF \l__chemmacros_bridge_super_bool { \chemformula_superscript:n { #1 } } @@ -1146,11 +1163,11 @@ \DeclareChemIUPAC \bridge { \chemformula_bridge:n } % attachments to heteroatoms / added hydrogen -\DeclareChemIUPAC \H { \textit { H } } -\DeclareChemIUPAC \O { \textit { O } } -\DeclareChemIUPAC \N { \textit { N } } +\DeclareChemIUPAC \H { \textit { H } } +\DeclareChemIUPAC \O { \textit { O } } +\DeclareChemIUPAC \N { \textit { N } } \DeclareChemIUPAC \Sf { \textit { S } } -\DeclareChemIUPAC \P { \textit { P } } +\DeclareChemIUPAC \P { \textit { P } } % language specific settings \AtBeginDocument @@ -1180,13 +1197,16 @@ % - add a little space at breaking points if not broken % - enables all naming commands regardless if they're definied otherwise or not \cs_new_protected:Nn \chemmacros_allow_hyphens: - { \tex_penalty:D \c_ten_thousand \skip_horizontal:n { \c_zero_dim } } + { + \chemmacros_nobreak: + \skip_horizontal:n { \c_zero_dim } + } -\dim_new:N \l__chemmacros_iupac_hyphen_pre_dim +\dim_new:N \l__chemmacros_iupac_hyphen_pre_dim \dim_set:Nn \l__chemmacros_iupac_hyphen_pre_dim { .01em } -\dim_new:N \l__chemmacros_iupac_hyphen_post_dim +\dim_new:N \l__chemmacros_iupac_hyphen_post_dim \dim_set:Nn \l__chemmacros_iupac_hyphen_post_dim { -.03em } -\dim_new:N \l__chemmacros_iupac_break_dim +\dim_new:N \l__chemmacros_iupac_break_dim \dim_set:Nn \l__chemmacros_iupac_break_dim { .03em } \keys_define:nn { chemmacros / iupac } @@ -1198,7 +1218,7 @@ \cs_new_protected:Nn \chemmacros_break_point_hyphen: { - \tex_penalty:D \c_ten_thousand + \chemmacros_nobreak: \tex_discretionary:D { - } { } { \tex_kern:D \l__chemmacros_iupac_hyphen_pre_dim @@ -1210,7 +1230,7 @@ \cs_new_protected:Nn \chemmacros_break_point: { - \tex_penalty:D \c_ten_thousand + \chemmacros_nobreak: \tex_discretionary:D { - } { } { \tex_kern:D \l__chemmacros_iupac_break_dim } \chemmacros_allow_hyphens: @@ -1226,21 +1246,23 @@ \chemmacros_ignore_spaces: \cs_set_eq:NN \- \chemmacros_break_point_hyphen: \cs_set_eq:NN \| \chemmacros_break_point: - \cs_set_eq:NN \^ \chemformula_superscript:n + \cs_set_eq:NN \^ \textsuperscript #1 \group_end: } % Thanks to Joseph Wright and Enrico Gregorio for the help on the curious % redefinition of \- and the end of the compilation -\cs_set_protected_nopar:Npx \| { \exp_not:o { \| } } -\cs_set_protected_nopar:Npx \- { \exp_not:o { \- } } +% see http://tex.stackexchange.com/q/42405/5049 for reference +\cs_set_protected:Npx \| { \exp_not:o { \| } } +\cs_set_protected:Npx \- { \exp_not:o { \- } } \cs_set_eq:NN \@dischyph \- -\cs_set_eq:NN \iupac \chemmacros_iupac:n +\NewDocumentCommand \iupac { m } + { \chemmacros_iupac:n { #1 } } % latin phrases -\tl_new:N \l__chemmacros_latin_format_tl +\tl_new:N \l__chemmacros_latin_format_tl \tl_set:Nn \l__chemmacros_latin_format_tl { \itshape } \keys_define:nn { chemmacros / latin } @@ -1250,7 +1272,8 @@ { { \l__chemmacros_latin_format_tl #1 } } \prop_new:N \l__chemmacros_latin_prop -\NewDocumentCommand \DeclareChemLatin { mm } + +\cs_new_protected:Npn \chemmacros_declare_latin:Nn #1#2 { \cs_if_free:NTF #1 { @@ -1260,13 +1283,19 @@ { \chemmacros_msg:nnxx { chemmacros } { declare-latin } { #1 } { } } } -\NewDocumentCommand \RenewChemLatin { mm } +\cs_new_protected:Npn \chemmacros_renew_latin:Nn #1#2 { \prop_if_in:NnTF \l__chemmacros_latin_prop { #1 } { \cs_set:Npn #1 { \chemmacros_latin:n { #2 } \chemmacros_xspace: } } { \chemmacros_msg:nnxx { chemmacros } { renew-latin } { #1 } { } } } +\NewDocumentCommand \DeclareChemLatin { mm } + { \chemmacros_declare_latin:Nn #1 { #2 } } + +\NewDocumentCommand \RenewChemLatin { mm } + { \chemmacros_renew_latin:Nn #1 { #2 } } + \AtBeginDocument { \bool_if:NTF \l__chemmacros_chemstyle_bool @@ -1297,7 +1326,8 @@ \cs_new_eq:NN \chemmacros_p_style:n \textup -\cs_new_nopar:Npn \chemmacros_if_bold:TF #1#2 +% TODO: rewrite in expl3 style +\cs_new:Npn \chemmacros_if_bold:TF #1#2 { \ifx\f@series\l__chemmacros_if_bf_tl \expandafter\@firstoftwo @@ -1307,10 +1337,10 @@ { #1 }{ #2 } } -\tl_new:N \l__chemmacros_if_bf_tl +\tl_new:N \l__chemmacros_if_bf_tl \tl_set:Nn \l__chemmacros_if_bf_tl { bx } -\cs_new_protected_nopar:Npn \Ka +\cs_new_protected:Npn \Ka { \mbox { @@ -1325,7 +1355,7 @@ \chemmacros_xspace: } -\cs_new_protected_nopar:Npn \Kb +\cs_new_protected:Npn \Kb { \mbox { @@ -1337,7 +1367,7 @@ \chemmacros_xspace: } -\cs_new_protected_nopar:Npn \Kw +\cs_new_protected:Npn \Kw { \mbox { @@ -1357,10 +1387,10 @@ \group_end: } -\cs_new_protected_nopar:Npn \pH +\cs_new_protected:Npn \pH { \p { \chemmacros_chemformula:n { H } } \chemmacros_xspace: } -\cs_new_protected_nopar:Npn \pOH +\cs_new_protected:Npn \pOH { \p { \chemmacros_chemformula:n { OH } } \chemmacros_xspace: } \NewDocumentCommand \pKa { o } @@ -1389,6 +1419,7 @@ \DeclareSIUnit { \atmosphere } { atm } \DeclareSIUnit { \calory } { cal } \DeclareSIUnit { \cal } { cal } + \AtBeginDocument { \bool_if:NF \l__chemmacros_chemstyle_bool @@ -1398,6 +1429,7 @@ \DeclareSIUnit { \Molar } { \textsc{m} } } } + \DeclareSIUnit { \moLar } { \mole\per\liter } \DeclareSIUnit { \MolMass } { \gram\per\mole } \DeclareSIUnit { \normal } { \textsc{n} } @@ -1412,7 +1444,7 @@ \tl_new:N \l__chemmacros_mech_mol_tl \tl_new:N \l__chemmacros_mech_ar_tl -\cs_new_nopar:Npn \chemmacros_set_mech:nnn #1#2#3 +\cs_new_protected:Npn \chemmacros_set_mech:nnn #1#2#3 { \tl_set:Nn \l__chemmacros_mech_type_tl { #1 } \tl_set:Nn \l__chemmacros_mech_mol_tl { #2 } @@ -1425,94 +1457,104 @@ type / .code:n = { \chemmacros_set_mech:nnn { S } - { $ \c_math_subscript_token \text {N} $ } {} + { \( \c_math_subscript_token { \text {N} } \) } + { } } , type / 1 .code:n = { \chemmacros_set_mech:nnn { S } - { $ \c_math_subscript_token \text {N} $ 1 } {} + { \( \c_math_subscript_token { \text {N} } \) 1 } + { } } , type / 2 .code:n = { \chemmacros_set_mech:nnn { S } - { $ \c_math_subscript_token \text {N} $ 2 } {} + { \( \c_math_subscript_token { \text {N} } \) 2 } + { } } , type / se .code:n = { \chemmacros_set_mech:nnn { S } - { $ \c_math_subscript_token \text {E} $ } {} + { \( \c_math_subscript_token { \text {E} } \) } + { } } , type / 1e .code:n = { \chemmacros_set_mech:nnn { S } - { $ \c_math_subscript_token \text {E} $ 1 } {} + { \( \c_math_subscript_token { \text {E} } \) 1 } + { } } , type / 2e .code:n = { \chemmacros_set_mech:nnn { S } - { $ \c_math_subscript_token \text {E} $ 2 } {} + { \( \c_math_subscript_token { \text {E} } \) 2 } + { } } , type / ar .code:n = { \chemmacros_set_mech:nnn { S } - { $ \c_math_subscript_token \text {E} $ } { Ar - } + { \( \c_math_subscript_token { \text {E} } \) } + { Ar - } } , type / e .code:n = - { \chemmacros_set_mech:nnn { E } {} {} } , + { \chemmacros_set_mech:nnn { E } { } { } } , type / e1 .code:n = - { \chemmacros_set_mech:nnn { E } { 1 } {} } , + { \chemmacros_set_mech:nnn { E } { 1 } { } } , type / e2 .code:n = - { \chemmacros_set_mech:nnn { E } { 2 } {} } , + { \chemmacros_set_mech:nnn { E } { 2 } { } } , type / cb .code:n = { \chemmacros_set_mech:nnn { E } - { 1 $ \c_math_subscript_token \text {cb} $ } {} + { 1 \( \c_math_subscript_token { \text {cb} } \) } + { } } , type .default:n = } -\NewDocumentCommand \mech { o } +\cs_new_protected:Npn \chemmacros_mech:n #1 { - \IfNoValueTF { #1 } + \tl_if_blank:nTF { #1 } { \keys_set:nn { chemmacros / mech } { type } } { \keys_set:nn { chemmacros / mech } { type = #1 } } - \mbox - { - \tl_use:N \l__chemmacros_mech_ar_tl - \tl_use:N \l__chemmacros_mech_type_tl - \tl_use:N \l__chemmacros_mech_mol_tl - } + \mbox + { + \tl_use:N \l__chemmacros_mech_ar_tl + \tl_use:N \l__chemmacros_mech_type_tl + \tl_use:N \l__chemmacros_mech_mol_tl + } \chemmacros_xspace: } +\NewDocumentCommand \mech { o } + { + \IfNoValueTF { #1 } + { \chemmacros_mech:n { } } + { \chemmacros_mech:n { #1 } } + } + % --------------------------------------------------------------------------- % % oxidation numbers % \ox{<number>,<atom>} \bool_new:N \l__chemmacros_ox_sign_bool \bool_new:N \l__chemmacros_ox_integer_bool - \bool_new:N \l__chemmacros_ox_explicit_sign_bool \bool_set_false:N \l__chemmacros_ox_explicit_sign_bool - \bool_new:N \l__chemmacros_ox_format_roman_bool \bool_set_true:N \l__chemmacros_ox_format_roman_bool - \bool_new:N \l__chemmacros_ox_decimal_marker_comma_bool \bool_set_false:N \l__chemmacros_ox_decimal_marker_comma_bool - \bool_new:N \l__chemmacros_ox_parse_bool \bool_set_true:N \l__chemmacros_ox_parse_bool - -\int_new:N \l__chemmacros_ox_number_int -\fp_new:N \l__chemmacros_ox_number_fp - \bool_new:N \l__chemmacros_ox_side_bool \bool_new:N \l__chemmacros_ox_super_bool \bool_new:N \l__chemmacros_ox_top_bool \bool_set_true:N \l__chemmacros_ox_top_bool \bool_new:N \l__chemmacros_ox_align_center_bool -\cs_new_nopar:Npn \chemmacros_ox_process_number:n #1 +\int_new:N \l__chemmacros_ox_number_int +\fp_new:N \l__chemmacros_ox_number_fp + +\cs_new_protected:Npn \chemmacros_ox_process_number:n #1 { \bool_if:NTF \l__chemmacros_ox_parse_bool { @@ -1536,7 +1578,7 @@ slash-symbol-font = lmr } -\cs_new_nopar:Npn \chemmacros_ox_fraction:n #1/#2 +\cs_new:Npn \chemmacros_ox_fraction:n #1/#2 { \bool_set_false:N \l__chemmacros_ox_format_roman_bool \chemmacros_ox_sign:n { #1 } @@ -1545,7 +1587,7 @@ { \sfrac [ chemmacros-ox-frac ] { \chemmacros_ox_value:n { #1 } } { #2 } } } -\cs_new_nopar:Npn \chemmacros_ox_sign:n #1 +\cs_new:Npn \chemmacros_ox_sign:n #1 { \fp_compare:nNnT { #1 } > { 0 } { \bool_if:NT \l__chemmacros_ox_explicit_sign_bool { $+$ } } @@ -1555,23 +1597,23 @@ { $-$ } } -\cs_new_nopar:Npn \chemmacros_ox_value:n #1 +\cs_new_protected:Npn \chemmacros_ox_value:n #1 { \fp_set:Nn \l__chemmacros_ox_number_fp { #1 } \fp_abs:N \l__chemmacros_ox_number_fp - \chemmacros_ox_is_integer:N \l__chemmacros_ox_number_fp + \chemmacros_ox_is_integer:V \l__chemmacros_ox_number_fp \bool_if:NTF \l__chemmacros_ox_format_roman_bool { - \chemmacros_fp_to_Roman:N \l__chemmacros_ox_number_fp + \chemmacros_fp_to_Roman:V \l__chemmacros_ox_number_fp } { \bool_if:NTF \l__chemmacros_ox_integer_bool - { \chemmacros_fp_to_arabic:N \l__chemmacros_ox_number_fp } - { \chemmacros_fp_show:N \l__chemmacros_ox_number_fp } + { \chemmacros_fp_to_arabic:V \l__chemmacros_ox_number_fp } + { \chemmacros_fp_show:V \l__chemmacros_ox_number_fp } } } -\cs_new_nopar:Npn \chemmacros_ox_is_integer:n #1 +\cs_new_protected:Npn \chemmacros_ox_is_integer:n #1 { \fp_set:Nn \l__chemmacros_tmpa_tl { #1 } \fp_add:Nn \l__chemmacros_tmpa_tl { 1 } @@ -1584,9 +1626,9 @@ \bool_set_false:N \l__chemmacros_ox_format_roman_bool } } -\cs_generate_variant:Nn \chemmacros_ox_is_integer:n { N } +\cs_generate_variant:Nn \chemmacros_ox_is_integer:n { V } -\cs_new_nopar:Npn \chemmacros_fp_to_Roman:n #1 +\cs_new_protected:Npn \chemmacros_fp_to_Roman:n #1 { \group_begin: \fp_set:Nn \l__chemmacros_tmpa_tl { #1 } @@ -1597,18 +1639,18 @@ { \int_to_Roman:n { \int_use:N \l__chemmacros_tmpa_int } } \group_end: } -\cs_generate_variant:Nn \chemmacros_fp_to_Roman:n { N } +\cs_generate_variant:Nn \chemmacros_fp_to_Roman:n { V } -\cs_new_nopar:Npn \chemmacros_fp_to_arabic:n #1 +\cs_new_protected:Npn \chemmacros_fp_to_arabic:n #1 { \group_begin: \fp_set:Nn \l__chemmacros_tmpa_tl { #1 } \fp_to_tl:N \l__chemmacros_tmpa_tl \group_end: } -\cs_generate_variant:Nn \chemmacros_fp_to_arabic:n { N } +\cs_generate_variant:Nn \chemmacros_fp_to_arabic:n { V } -\cs_new_nopar:Npn \chemmacros_fp_show:n #1 +\cs_new_protected:Npn \chemmacros_fp_show:n #1 { \group_begin: \fp_set:Nn \l__chemmacros_tmpa_tl { #1 } @@ -1621,18 +1663,14 @@ { \fp_to_tl:N \l__chemmacros_tmpa_tl } \group_end: } -\cs_generate_variant:Nn \chemmacros_fp_show:n { N } +\cs_generate_variant:Nn \chemmacros_fp_show:n { V } -\cs_new_nopar:Npn \chemmacros_ox:nn #1#2 +\cs_new_protected:Npn \chemmacros_ox_write:nn #1#2 { \tl_if_blank:nT { #1 } - { - \msg_error:nnx { chemmacros } { ox } { oxidation~number~missing } - } + { \msg_error:nnx { chemmacros } { ox } { oxidation~number~missing } } \tl_if_blank:nT { #2 } - { - \msg_error:nnx { chemmacros } { ox } { atom~missing } - } + { \msg_error:nnx { chemmacros } { ox } { atom~missing } } \ensuremath { \bool_if:NT \l__chemmacros_ox_super_bool @@ -1664,21 +1702,21 @@ } } -\cs_new_nopar:Npn \chemmacros_ox_pos_top: +\cs_new_protected:Npn \chemmacros_ox_pos_top: { \bool_set_true:N \l__chemmacros_ox_top_bool \bool_set_false:N \l__chemmacros_ox_super_bool \bool_set_false:N \l__chemmacros_ox_side_bool } -\cs_new_nopar:Npn \chemmacros_ox_pos_super: +\cs_new_protected:Npn \chemmacros_ox_pos_super: { \bool_set_false:N \l__chemmacros_ox_top_bool \bool_set_true:N \l__chemmacros_ox_super_bool \bool_set_false:N \l__chemmacros_ox_side_bool } -\cs_new_nopar:Npn \chemmacros_ox_pos_side: +\cs_new_protected:Npn \chemmacros_ox_pos_side: { \bool_set_false:N \l__chemmacros_ox_top_bool \bool_set_false:N \l__chemmacros_ox_super_bool @@ -1709,36 +1747,47 @@ % \ox[<keyval>]{<num>,<atom>} % \ox*[<keyval>]{<num>,<atom>} => always number on the side -\NewDocumentCommand \ox { s o > { \SplitArgument { 1 } { , } } m } +\cs_new_protected:Npn \chemmacros_ox:nnnn #1#2#3#4 { \group_begin: - \IfBooleanT { #1 } { \chemmacros_ox_pos_super: } + \tl_if_blank:nF { #1 } { \chemmacros_ox_pos_super: } \bool_if:NTF \l__chemmacros_version_one_bool { \keys_set:nn { chemmacros / ox } { parse = false } } - { \IfNoValueF { #2 } { \keys_set:nn { chemmacros / ox } { #2 } } } - \chemmacros_ox:nn #3 + { \tl_if_blank:nF { #2 } { \keys_set:nn { chemmacros / ox } { #2 } } } + \chemmacros_ox_write:nn { #3 } { #4 } \group_end: } +\NewDocumentCommand \ox { s o > { \SplitArgument { 1 } { , } } m } + { + \IfBooleanTF { #1 } + { + \IfNoValueTF { #2 } + { \chemmacros_ox:nnnn { #1 } { } #3 } + { \chemmacros_ox:nnnn { #1 } { #2 } #3 } + } + { + \IfNoValueTF { #2 } + { \chemmacros_ox:nnnn { } { } #3 } + { \chemmacros_ox:nnnn { } { #2 } #3 } + } + } + % --------------------------------------------------------------------------- % % - oxidation arrows -\tl_new:N \l__chemmacros_redox_begin_tl -\tl_new:N \l__chemmacros_redox_end_tl - -\tl_new:N \l__chemmacros_redox_tikz_tl - -\fp_new:N \l__chemmacros_redox_shift_fp -\tl_new:N \l__chemmacros_redox_shift_tl +\tl_new:N \l__chemmacros_redox_begin_tl +\tl_new:N \l__chemmacros_redox_end_tl +\tl_new:N \l__chemmacros_redox_tikz_tl +\tl_new:N \l__chemmacros_redox_shift_tl +\tl_new:N \l__chemmacros_redox_anchor_tl +\tl_new:N \l__chemmacros_redox_side_tl -\tl_new:N \l__chemmacros_redox_anchor_tl +\fp_new:N \l__chemmacros_redox_shift_fp -\tl_new:N \l__chemmacros_redox_side_tl - -\dim_new:N \l__chemmacros_redox_sep_dim -\dim_new:N \l__chemmacros_redox_sep_default_dim +\dim_new:N \l__chemmacros_redox_sep_dim +\dim_new:N \l__chemmacros_redox_sep_default_dim \dim_set:Nn \l__chemmacros_redox_sep_default_dim { .2em } - -\dim_new:N \l__chemmacros_redox_dist_dim +\dim_new:N \l__chemmacros_redox_dist_dim \dim_set:Nn \l__chemmacros_redox_dist_dim {.6em} % place and name nodes: @@ -1746,42 +1795,30 @@ \NewDocumentCommand \OX { > { \SplitArgument { 1 } { , } } m } { \chemmacros_redox_partner:nn #1 } -\cs_new_nopar:Npn \chemmacros_redox_partner:nn #1#2 +\cs_new_protected:Npn \chemmacros_redox_partner:nn #1#2 { \tl_if_blank:nT { #1 } - { - \msg_error:nnx { chemmacros } { OX } { node~name~missing } - } + { \msg_error:nnx { chemmacros } { OX } { node~name~missing } } \tl_if_blank:nT { #2 } - { - \msg_error:nnx { chemmacros } { OX } { atom~missing } - } + { \msg_error:nnx { chemmacros } { OX } { atom~missing } } \tikz[baseline=(#1.base),remember~picture] - { - \node [inner~sep=0] (#1) { #2 } ; - } + { \node [inner~sep=0] (#1) { #2 } ; } } -\cs_new_nopar:Npn \chemmacros_redox_coordinates:nn #1#2 +\cs_new_protected:Npn \chemmacros_redox_coordinates:nn #1#2 { \tl_set:Nn \l__chemmacros_redox_begin_tl { #1 } - \tl_set:Nn \l__chemmacros_redox_end_tl { #2 } + \tl_set:Nn \l__chemmacros_redox_end_tl { #2 } } -\NewDocumentCommand \redox { > { \SplitArgument { 1 } { , } } r() o o G{} } +\cs_new_protected:Npn \chemmacros_redox:nnnnn #1#2#3#4#5 { - \IfNoValueT { #1 } - { - \msg_error:nnx { chemmacros } { redox } - { You~need~to~specify~coordinates } - } \tl_clear:N \l__chemmacros_redox_begin_tl \tl_clear:N \l__chemmacros_redox_end_tl \tl_clear:N \l__chemmacros_redox_tikz_tl - \chemmacros_redox_coordinates:nn #1 - \IfNoValueF { #2 } - { \tl_set:Nn \l__chemmacros_redox_tikz_tl { #2 } } - \IfNoValueTF { #3 } + \chemmacros_redox_coordinates:nn { #1 } { #2 } + \tl_if_empty:nF { #3 } { \tl_set:Nn \l__chemmacros_redox_tikz_tl { #3 } } + \tl_if_blank:nTF { #4 } { \fp_set:Nn \l__chemmacros_redox_shift_fp { 1 } \tl_set:Nn \l__chemmacros_redox_anchor_tl { above } @@ -1791,7 +1828,7 @@ \l__chemmacros_redox_sep_default_dim } { - \fp_compare:nNnTF { #3 } < { 0 } + \fp_compare:nNnTF { #4 } < { 0 } { \tl_set:Nn \l__chemmacros_redox_anchor_tl { below } \tl_set:Nn \l__chemmacros_redox_side_tl { south } @@ -1805,7 +1842,7 @@ \l__chemmacros_redox_sep_dim \l__chemmacros_redox_sep_default_dim } - \fp_set:Nn \l__chemmacros_redox_shift_fp { #3 } + \fp_set:Nn \l__chemmacros_redox_shift_fp { #4 } } \tl_set:Nn \l__chemmacros_redox_shift_tl { \fp_to_tl:N \l__chemmacros_redox_shift_fp } @@ -1818,7 +1855,7 @@ $) -- ++(0,\l__chemmacros_redox_shift_tl * \l__chemmacros_redox_dist_dim) -| - node [pos=.25,\l__chemmacros_redox_anchor_tl] { { #4 } } + node [pos=.25,\l__chemmacros_redox_anchor_tl] { { #5 } } ($ (\l__chemmacros_redox_end_tl . \l__chemmacros_redox_side_tl)+(0,\l__chemmacros_redox_sep_dim) @@ -1826,6 +1863,22 @@ } } +\NewDocumentCommand \redox { > { \SplitArgument { 1 } { , } } r() o o G{} } + { + \IfNoValueT { #1 } + { + \msg_error:nnx { chemmacros } { redox } + { You~need~to~specify~coordinates } + } + \IfNoValueTF { #2 } + { \chemmacros_redox:nnnnn #1 { } { } { #4 } } + { + \IfNoValueTF { #3 } + { \chemmacros_redox:nnnnn #1 { } { } { #4 } } + { \chemmacros_redox:nnnnn #1 { } { #3 } { #4 } } + } + } + % redox-keys \keys_define:nn { chemmacros / redox } { @@ -1847,22 +1900,22 @@ % --------------------------------------------------------------------------- % % spectroscopy -\tl_new:N \g__chemmacros_nmr_isotope_tl -\tl_new:N \l__chemmacros_nmr_isotope_default_tl +\tl_new:N \g__chemmacros_nmr_isotope_tl +\tl_new:N \l__chemmacros_nmr_isotope_default_tl \tl_set:Nn \l__chemmacros_nmr_isotope_default_tl { 1 } - -\tl_new:N \l__chemmacros_nmr_coupling_nuclei_tl -\tl_new:N \l__chemmacros_nmr_coupling_bonds_tl -\tl_new:N \g__chemmacros_nmr_element_coupled_tl - -\tl_new:N \g__chemmacros_nmr_element_tl -\tl_new:N \l__chemmacros_nmr_element_default_tl +\tl_new:N \l__chemmacros_nmr_coupling_nuclei_tl +\tl_new:N \l__chemmacros_nmr_coupling_bonds_tl +\tl_new:N \g__chemmacros_nmr_element_coupled_tl +\tl_new:N \g__chemmacros_nmr_element_tl +\tl_new:N \l__chemmacros_nmr_element_default_tl \tl_set:Nn \l__chemmacros_nmr_element_default_tl { H } -\tl_new:N \l__chemmacros_nmr_format_tl -\tl_new:N \l__chemmacros_nmr_delta_tl -\tl_new:N \l__chemmacros_nmr_coupling_unit_tl +\tl_new:N \l__chemmacros_nmr_format_tl +\tl_new:N \l__chemmacros_nmr_delta_tl +\tl_new:N \l__chemmacros_nmr_coupling_unit_tl \tl_set:Nn \l__chemmacros_nmr_coupling_unit_tl { \hertz } -\tl_new:N \l__chemmacros_nmr_list_setup_tl +\tl_new:N \l__chemmacros_nmr_unit_tl +\tl_set:Nn \l__chemmacros_nmr_unit_tl { \mega\hertz } +\tl_new:N \l__chemmacros_nmr_list_setup_tl \tl_set:Nn \l__chemmacros_nmr_list_setup_tl { \topsep\z@skip \partopsep\z@skip @@ -1885,10 +1938,7 @@ \bool_new:N \l__chemmacros_nmr_custom_command_active_bool \bool_new:N \l__chemmacros_nmr_custom_command_used_bool -\tl_new:N \l__chemmacros_nmr_unit_tl -\tl_set:Nn \l__chemmacros_nmr_unit_tl { \mega\hertz } - -\cs_new_nopar:Npn \chemmacros_nmr_nucleus:w #1,#2 \q_stop +\cs_new_protected:Npn \chemmacros_nmr_nucleus:w #1,#2 \q_stop { \tl_gset:Nn \g__chemmacros_nmr_isotope_tl { #1 } \tl_if_in:nnTF { #2 } { [ } @@ -1899,19 +1949,19 @@ } } -\cs_new_nopar:Npn \chemmacros_nmr_element:w #1[#2] \q_stop +\cs_new_protected:Npn \chemmacros_nmr_element:w #1[#2] \q_stop { \tl_gset:Nn \g__chemmacros_nmr_element_tl { #1 } \tl_gset:Nn \g__chemmacros_nmr_element_coupled_tl { #2 } } -\cs_new:Npn \chemmacros_nmr_default_nucleus:w #1,#2 \q_stop +\cs_new_protected:Npn \chemmacros_nmr_default_nucleus:w #1,#2 \q_stop { \tl_set:Nn \l__chemmacros_nmr_isotope_default_tl { #1 } \tl_set:Nn \l__chemmacros_nmr_element_default_tl { #2 } } -\cs_new_nopar:Npn \chemmacros_nmr_base:nn #1#2 +\cs_new_protected:Npn \chemmacros_nmr_base:nn #1#2 { \tl_if_blank:VF \g__chemmacros_nmr_element_coupled_tl { @@ -1935,15 +1985,17 @@ } \cs_generate_variant:Nn \chemmacros_nmr_base:nn { VV } -\cs_new_nopar:Npn \chemmacros_nmr_frequency:n #1 +\cs_new:Npn \chemmacros_nmr_frequency:n #1 { \tl_if_in:nnTF { #1 } { , } { \chemmacros_nmr_frequency_aux_i:w #1 \q_stop } { \chemmacros_nmr_frequency_aux_ii:n { #1 } } } -\cs_new_nopar:Npn \chemmacros_nmr_frequency_aux_i:w #1,#2 \q_stop + +\cs_new:Npn \chemmacros_nmr_frequency_aux_i:w #1,#2 \q_stop { \SI { #1 } { #2 } } -\cs_new_nopar:Npn \chemmacros_nmr_frequency_aux_ii:n #1 + +\cs_new:Npn \chemmacros_nmr_frequency_aux_ii:n #1 { \SI { #1 } { \tl_use:N \l__chemmacros_nmr_unit_tl } } \keys_define:nn { chemmacros / nmr } @@ -1972,7 +2024,7 @@ \prop_new:N \l__chemmacros_nmr_prop -\NewDocumentCommand \DeclareChemNMR { mm } +\cs_new_protected:Npn \chemmacros_declare_nmr:Nn #1#2 { \prop_if_in:NnTF \l__chemmacros_nmr_prop { #1 } { \chemmacros_msg:nnxx { chemmacros } { declare-nmr } { #1 } { } } @@ -1983,7 +2035,7 @@ } } -\NewDocumentCommand \RenewChemNMR { mm } +\cs_new_protected:Npn \chemmacros_renew_nmr:Nn #1#2 { \prop_if_in:NnTF \l__chemmacros_nmr_prop { #1 } { @@ -1994,6 +2046,12 @@ { \chemmacros_msg:nnxx { chemmacros } { renew-nmr } { #1 } { } } } +\NewDocumentCommand \DeclareChemNMR { mm } + { \chemmacros_declare_nmr:Nn #1 { #2 } } + +\NewDocumentCommand \RenewChemNMR { mm } + { \chemmacros_renew_nmr:Nn #1 { #2 } } + \AtBeginDocument { % \NMR{<num>,<elem>}(<num>,<unit>)[<solvent>] ALL arguments are optional @@ -2109,13 +2167,13 @@ \IfBooleanF { #1 } { \bool_if:NT \l__chemmacros_nmr_use_equal_bool { ~ = } } } -\cs_new_protected_nopar:Npn \chemmacros_val:n #1 +\cs_new_protected:Npn \chemmacros_val:n #1 { \tl_if_in:nnTF { #1 } { -- } { \chemmacros_val_aux:w #1 \q_nil } { \num { #1 } } } -\cs_new_protected_nopar:Npn \chemmacros_val_aux:w #1--#2 \q_nil +\cs_new_protected:Npn \chemmacros_val_aux:w #1--#2 \q_nil { \numrange { #1 } { #2 } } \NewDocumentEnvironment { experimental } { o } @@ -2164,7 +2222,7 @@ } } -\cs_new:Npn \chemmacros_nmr_coupling:w +\cs_new_protected:Npn \chemmacros_nmr_coupling:w { \tl_clear:N \l__chemmacros_nmr_coupling_nuclei_tl \tl_clear:N \l__chemmacros_nmr_coupling_bonds_tl @@ -2173,7 +2231,7 @@ { \chemmacros_nmr_coupling_auxii:w } } -\cs_new:Npn \chemmacros_nmr_coupling_auxi:w (#1;#2) +\cs_new_protected:Npn \chemmacros_nmr_coupling_auxi:w (#1;#2) { \tl_set:Nn \l__chemmacros_nmr_coupling_bonds_tl { #1 } \tl_set:Nn \l__chemmacros_nmr_coupling_nuclei_tl { #2 } @@ -2224,20 +2282,22 @@ % --------------------------------------------------------------------------- % % placing text below atom/molecule -\cs_new_nopar:Npn \dim_to_width:nn #1#2 - { \settowidth { #1 } { #2 } } -\cs_generate_variant:Nn \dim_to_width:nn { Nn } +\cs_new_protected:Npn \chemmacros_dim_to_width:Nn #1#2 + { + \hbox_set:Nn \l__chemmacros_tmpa_box { #2 } + \dim_set:Nn #1 { \box_wd:N \l__chemmacros_tmpa_box } + \box_clear:N \l__chemmacros_tmpa_box + } \bool_new:N \l__chemmacros_mhname_width_bool \bool_set_false:N \l__chemmacros_mhname_width_bool -\dim_new:N \l__chemmacros_mhname_width_dim - -\tl_new:N \l__chemmacros_mhname_align_tl -\tl_set:Nn \l__chemmacros_mhname_align_tl { \centering } +\dim_new:N \l__chemmacros_mhname_width_dim -\tl_new:N \l__chemmacros_mhname_format_tl -\tl_new:N \l__chemmacros_mhname_fontsize_tl -\tl_set:Nn \l__chemmacros_mhname_fontsize_tl { \tiny } +\tl_new:N \l__chemmacros_mhname_align_tl +\tl_set:Nn \l__chemmacros_mhname_align_tl { \centering } +\tl_new:N \l__chemmacros_mhname_format_tl +\tl_new:N \l__chemmacros_mhname_fontsize_tl +\tl_set:Nn \l__chemmacros_mhname_fontsize_tl { \tiny } \keys_define:nn { chemmacros / mhName } { @@ -2267,7 +2327,7 @@ \underset { \bool_if:NF \l__chemmacros_mhname_width_bool - { \dim_to_width:Nn \l__chemmacros_mhname_width_dim { #2 } } + { \chemmacros_dim_to_width:Nn \l__chemmacros_mhname_width_dim { #2 } } \parbox { \dim_use:N \l__chemmacros_mhname_width_dim } { @@ -2286,8 +2346,10 @@ % --------------------------------------------------------------------------- % % - phases \bool_new:N \l__chemmacros_phases_sub_bool -\dim_new:N \l__chemmacros_phases_space_dim +\dim_new:N \l__chemmacros_phases_space_dim \dim_set:Nn \l__chemmacros_phases_space_dim { .1333 em } +\prop_new:N \l__chemmacros_phases_prop +\prop_new:N \l__chemmacros_phases_german_prop \keys_define:nn { chemmacros / phases } { @@ -2297,37 +2359,56 @@ space .dim_set:N = \l__chemmacros_phases_space_dim } -\prop_new:N \l__chemmacros_phases_prop -\prop_new:N \l__chemmacros_phases_german_prop - -\NewDocumentCommand \DeclareChemPhase { mom } +\cs_new_protected:Npn \chemmacros_declare_phase:Nnn #1#2#3 { - \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } + \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl + { \char_set_catcode_letter:N \\ } + { #1 } \tl_set:Nf \l__chemmacros_tmpa_tl { \tl_tail:V \l__chemmacros_tmpa_tl } \cs_if_free:NTF #1 - { \cs_new_nopar:Npn #1 {} } + { \cs_new:Npn #1 {} } { \chemmacros_msg:nnxx { chemmacros } { declare-phase } { #1 } {} } - \IfNoValueTF { #2 } + \tl_if_blank:nTF { #2 } { \prop_put:Non \l__chemmacros_phases_german_prop { \l__chemmacros_tmpa_tl } { #3 } } { \prop_put:Non \l__chemmacros_phases_german_prop { \l__chemmacros_tmpa_tl } { #2 } } - \prop_put:Non \l__chemmacros_phases_prop { \l__chemmacros_tmpa_tl } { #3 } + \prop_put:Non \l__chemmacros_phases_prop + { \l__chemmacros_tmpa_tl } + { #3 } \chemmacros_make_phases: } -\NewDocumentCommand \RenewChemPhase { mom } +\cs_new_protected:Npn \chemmacros_renew_phase:Nnn #1#2#3 { - \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl { \char_set_catcode_letter:N \\ } { #1 } + \tl_set_rescan:Nnn \l__chemmacros_tmpa_tl + { \char_set_catcode_letter:N \\ } + { #1 } \tl_set:Nf \l__chemmacros_tmpa_tl { \tl_tail:V \l__chemmacros_tmpa_tl } \cs_if_free:NT #1 { \chemmacros_msg:nnxx { chemmacros } { renew-phase } { #1 } {} } - \IfNoValueTF { #2 } + \tl_if_blank:nTF { #2 } { \prop_put:Non \l__chemmacros_phases_german_prop { \l__chemmacros_tmpa_tl } { #3 } } { \prop_put:Non \l__chemmacros_phases_german_prop { \l__chemmacros_tmpa_tl } { #2 } } - \prop_put:Non \l__chemmacros_phases_prop { \l__chemmacros_tmpa_tl } { #3 } + \prop_put:Non \l__chemmacros_phases_prop + { \l__chemmacros_tmpa_tl } + { #3 } \chemmacros_make_phases: } -\cs_new_nopar:Npn \chemmacros_make_phases: +\NewDocumentCommand \DeclareChemPhase { mom } + { + \IfNoValueTF { #2 } + { \chemmacros_declare_phase:Nnn #1 { } { #3 } } + { \chemmacros_declare_phase:Nnn #1 { #2 } { #3 } } + } + +\NewDocumentCommand \RenewChemPhase { mom } + { + \IfNoValueTF { #2 } + { \chemmacros_renew_phase:Nnn #1 { } { #3 } } + { \chemmacros_renew_phase:Nnn #1 { #2 } { #3 } } + } + +\cs_new_protected:Npn \chemmacros_make_phases: { \bool_if:NTF \l__chemmacros_german_bool { @@ -2340,9 +2421,9 @@ } } -\cs_new_nopar:Npn \chemmacros_define_phases:nn #1#2 +\cs_new_protected:Npn \chemmacros_define_phases:nn #1#2 { - \cs_set_nopar:cpn { #1 } + \cs_set:cpn { #1 } { \bool_if:NTF \l__chemmacros_phases_sub_bool { @@ -2363,9 +2444,9 @@ \DeclareChemPhase \sld [ f ] { s } \DeclareChemPhase \lqd [ f{}l ] { l } \DeclareChemPhase \gas { g } -\DeclareChemPhase \aq { aq } +\DeclareChemPhase \aq { aq } -\NewDocumentCommand \phase { m } +\cs_new:Npn \chemmacros_phase:n #1 { \bool_if:NTF \l__chemmacros_phases_sub_bool { \ensuremath { \c_math_subscript_token { \text { (#1) } } } } @@ -2378,9 +2459,12 @@ } } +\NewDocumentCommand \phase { m } + { \chemmacros_phase:n { #1 } } + \bool_if:NT \l__chemmacros_version_one_bool { - \cs_new_eq:NN \solid \sld + \cs_new_eq:NN \solid \sld \cs_new_eq:NN \liquid \lqd } @@ -2391,7 +2475,7 @@ % entry to the list of reactions even if the user redefines the reaction tag \AfterPackage* { mathtools } { - \cs_set_nopar:Npn \MT_define_tagform:nwnn #1[#2]#3#4 + \cs_set:Npn \MT_define_tagform:nwnn #1[#2]#3#4 { \@namedef{MT_tagform_#1:n}##1 { @@ -2412,19 +2496,23 @@ } \tl_new:N \g__chemmacros_reaction_description_tl -\NewDocumentCommand \AddRxnDesc { m } + +\cs_new_protected:Npn \chemmacros_add_reaction_description:n #1 { \tl_if_blank:nF { #1 } { \tl_gset:Nn \g__chemmacros_reaction_description_tl { : ~ #1 } } } +\NewDocumentCommand \AddRxnDesc { m } + { \chemmacros_add_reaction_description:n { #1 } } + % define \listofreactions -\tl_new:N \l__chemmacros_reaction_lorname_tl +\tl_new:N \l__chemmacros_reaction_lorname_tl \tl_set:Nn \l__chemmacros_reaction_lorname_tl { Reaction ~ } -\tl_new:N \reactionlistname +\tl_new:N \reactionlistname \tl_set:Nn \reactionlistname { List~of~reactions } -% language settings +% language settings % TODO \AtBeginDocument { \bool_if:NT \l__chemmacros_german_bool @@ -2458,12 +2546,12 @@ \newcounter { reaction } % switch to reaction tags -\cs_new_nopar:Npn \chemmacros_begin_reaction: +\cs_new:Npn \chemmacros_begin_reaction: { % create individual names for `hyperref': \bool_if:NT \l__chemmacros_hyperref_bool { - \cs_set_nopar:Npn \theHequation + \cs_set:Npn \theHequation { R . \theHsection . \arabic { reaction } } } % enable labelformat `reaction': @@ -2477,7 +2565,7 @@ } % switch back to equation tags -\cs_new_nopar:Npn \chemmacros_end_reaction: +\cs_new:Npn \chemmacros_end_reaction: { \setcounter { reaction } { \value { equation } } \setcounter { equation } { \value { chemmacros_save_reaction } } @@ -2498,6 +2586,7 @@ \tl_set:Nn \l__chemmacros_reaction_lorname_tl { #1 ~ } } +% TODO separate document and module level % \DeclareChemReaction[<keyval>]{<name>}{<type>} \bool_if:NF \l__chemmacros_version_one_bool { @@ -2568,7 +2657,7 @@ { \bool_if:NTF \l__chemmacros_use_mhchem_bool { \cee { #1 } } - { \ch { #1 } } + { \ch { #1 } } } \cs_generate_variant:Nn \chemmacros_equation_chemformula:n { o } @@ -2584,11 +2673,11 @@ % \standardstate as defined by the chemstyle package. Thanks to Joseph Wright \cs_if_exist:NF \standardstate { - \cs_new_nopar:Npn \standardstate + \cs_new:Npn \standardstate { \ensuremath { \chemmacros_standardstate: } } - \cs_new_nopar:Npn \chemmacros_standardstate: + \cs_new:Npn \chemmacros_standardstate: { \mathpalette \chemmacros_standardstate_aux: \circ } - \cs_new_nopar:Npn \chemmacros_standardstate_aux: #1#2 + \cs_new:Npn \chemmacros_standardstate_aux: #1#2 { \ooalign { @@ -2606,16 +2695,17 @@ % --------------------------------------------------------------------------- % % \State -\tl_new:N \l__chemmacros_State_delta_tl -\tl_set:Nn \l__chemmacros_State_delta_tl { \Delta } +\tl_new:N \l__chemmacros_State_delta_tl +\tl_set:Nn \l__chemmacros_State_delta_tl { \Delta } +\tl_new:N \l__chemmacros_State_exponent_tl +\tl_set:Nn \l__chemmacros_State_exponent_tl { \standardstate } + \bool_new:N \l__chemmacros_State_delta_bool \bool_set_true:N \l__chemmacros_State_delta_bool \bool_new:N \l__chemmacros_State_subscript_left_bool \bool_set_true:N \l__chemmacros_State_subscript_left_bool \bool_new:N \l__chemmacros_State_exponent_bool \bool_set_true:N \l__chemmacros_State_exponent_bool -\tl_new:N \l__chemmacros_State_exponent_tl -\tl_set:Nn \l__chemmacros_State_exponent_tl { \standardstate } \keys_define:nn { chemmacros / state } { @@ -2647,7 +2737,7 @@ % old syntax (v2.0): % \State[<keyval>]{<Symbol>}{<subscript>} % {<subscript>} is an optional argument! -\cs_new_nopar:Npn \chemmacros_state:nnn #1#2#3 +\cs_new:Npn \chemmacros_state:nnn #1#2#3 { \group_begin: \IfNoValueF { #1 } @@ -2684,19 +2774,16 @@ } % --------------------------------------------------------------------------- % -\tl_new:N \l__chemmacros_thermod_subscript_left_tl -\tl_new:N \l__chemmacros_thermod_subscript_left_default_tl -\tl_new:N \l__chemmacros_thermod_subscript_tl -\tl_new:N \l__chemmacros_thermod_subscript_default_tl - -\tl_new:N \l__chemmacros_thermod_unit_tl - -\tl_new:N \l__chemmacros_thermod_exponent_tl -\tl_new:N \l__chemmacros_thermod_exponent_default_tl +\tl_new:N \l__chemmacros_thermod_subscript_left_tl +\tl_new:N \l__chemmacros_thermod_subscript_left_default_tl +\tl_new:N \l__chemmacros_thermod_subscript_tl +\tl_new:N \l__chemmacros_thermod_subscript_default_tl +\tl_new:N \l__chemmacros_thermod_unit_tl +\tl_new:N \l__chemmacros_thermod_exponent_tl +\tl_new:N \l__chemmacros_thermod_exponent_default_tl \tl_set:Nn \l__chemmacros_thermod_exponent_default_tl { \standardstate } - -\tl_new:N \l__chemmacros_thermod_delta_tl -\tl_new:N \l__chemmacros_thermod_delta_default_tl +\tl_new:N \l__chemmacros_thermod_delta_tl +\tl_new:N \l__chemmacros_thermod_delta_default_tl \tl_set:Nn \l__chemmacros_thermod_delta_default_tl { \Delta } \bool_new:N \l__chemmacros_renewstate_bool @@ -2724,6 +2811,7 @@ \l__chemmacros_thermod_delta_default_tl } +% TODO: separate document and module lavel % \DeclareChemState[<keyval>]{<name>}{<symbol>}{<unit>} \bool_if:NF \l__chemmacros_version_one_bool { @@ -2758,7 +2846,7 @@ } } -\cs_new_nopar:Npn \chemmacros_setnewstate_reset: +\cs_new:Npn \chemmacros_setnewstate_reset: { \tl_set:Nn \l__chemmacros_thermod_subscript_left_default_tl { true } \tl_clear:N \l__chemmacros_thermod_subscript_default_tl @@ -2809,7 +2897,7 @@ \tl_const:cn { l__chemmacros_ #1 _unit_tl } { #3 } - \cs_new_nopar:cpn {chemmacros_ #1 _reset: } + \cs_new:cpn {chemmacros_ #1 _reset: } { \tl_set_eq:Nc \l__chemmacros_thermod_subscript_tl @@ -2827,7 +2915,7 @@ \l__chemmacros_thermod_unit_tl { l__chemmacros_ #1 _unit_tl } } - \cs_new_nopar:cpn { #1 } + \cs_new:cpn { #1 } { \use:c {chemmacros_ #1 _reset: } \peek_meaning:NTF [ @@ -2838,19 +2926,19 @@ { \tl_use:c { #1 _aux_iii:n } } } } - \cs_new_nopar:cpn { #1 _aux_i:n } [##1] + \cs_new:cpn { #1 _aux_i:n } [##1] { \keys_set:nn { chemmacros / State } { ##1 } \peek_meaning:NTF ( { \tl_use:c { #1 _aux_ii:n } } { \tl_use:c { #1 _aux_iii:n } } } - \cs_new_nopar:cpn { #1 _aux_ii:n } (##1) + \cs_new:cpn { #1 _aux_ii:n } (##1) { \tl_set:Nn \l__chemmacros_thermod_subscript_tl { ##1 } \tl_use:c { #1 _aux_iii:n } } - \cs_new_nopar:cpn { #1 _aux_iii:n } ##1 + \cs_new:cpn { #1 _aux_iii:n } ##1 { \ensuremath { @@ -2890,37 +2978,32 @@ % predefined: \bool_if:NF \l__chemmacros_version_one_bool { - \DeclareChemState {Enthalpy} {H} {\kilo\joule\per\mole} + \DeclareChemState {Enthalpy} + {H} {\kilo\joule\per\mole} \DeclareChemState [ delta=false, subscript-left=false ] {Entropy} {S} {\joule\per\kelvin\per\mole} - \DeclareChemState {Gibbs} {G} {\kilo\joule\per\mole} + \DeclareChemState {Gibbs} + {G} {\kilo\joule\per\mole} } % --------------------------------------------------------------------------- % % Newman projections -\fp_new:N \l__chemmacros_newman_rel_angle_fp -\fp_zero:N \l__chemmacros_newman_rel_angle_fp -\fp_new:N \l__chemmacros_newman_tmp_angle_fp -\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 } - -\tl_new:N \l__chemmacros_newman_tikz_ring_tl -\tl_clear:N \l__chemmacros_newman_tikz_ring_tl - -\tl_new:N \l__chemmacros_newman_tikz_front_tl -\tl_clear:N \l__chemmacros_newman_tikz_front_tl - -\tl_new:N \l__chemmacros_newman_tikz_back_tl -\tl_clear:N \l__chemmacros_newman_tikz_back_tl +\fp_new:N \l__chemmacros_newman_rel_angle_fp +\fp_zero:N \l__chemmacros_newman_rel_angle_fp +\fp_new:N \l__chemmacros_newman_tmp_angle_fp +\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_new:N \l__chemmacros_newman_x_fp +\fp_new:N \l__chemmacros_newman_y_fp + +\tl_new:N \l__chemmacros_newman_tikz_ring_tl +\tl_new:N \l__chemmacros_newman_tikz_front_tl +\tl_new:N \l__chemmacros_newman_tikz_back_tl \bool_new:N \l__chemmacros_newman_tikz_back_bool -\fp_new:N \l__chemmacros_newman_x_fp -\fp_new:N \l__chemmacros_newman_y_fp - \keys_define:nn { chemmacros / newman } { ring .tl_set:N = \l__chemmacros_newman_tikz_ring_tl , @@ -2936,6 +3019,7 @@ angle .default:n = 0 } +% TODO separate document and module level % \newman[<keyval>](<angle>){<1>,<2>,<3>,<4>,<5>,<6>} \bool_if:NF \l__chemmacros_version_one_bool { @@ -3002,30 +3086,25 @@ } % provide cartesian coordiantes from polar coordinates -% #1: angle pi #2: radius -\cs_new_nopar:Npn \chemmacros_newman_coordinates:nn #1#2 - { - \fp_set:Nn \l__chemmacros_newman_tmp_angle_fp { #1 } - \fp_div:Nn \l__chemmacros_newman_tmp_angle_fp { 180 } - \fp_mul:Nn \l__chemmacros_newman_tmp_angle_fp { \fp_use:N \c_pi_fp } - \fp_zero:N \l__chemmacros_newman_x_fp - \fp_zero:N \l__chemmacros_newman_y_fp - \fp_cos:Nn \l__chemmacros_newman_x_fp - { \fp_use:N \l__chemmacros_newman_tmp_angle_fp } - \fp_sin:Nn \l__chemmacros_newman_y_fp - { \fp_use:N \l__chemmacros_newman_tmp_angle_fp } - \fp_mul:Nn \l__chemmacros_newman_x_fp { \fp_use:N #2 } - \fp_mul:Nn \l__chemmacros_newman_y_fp { \fp_use:N #2 } - } -\cs_generate_variant:Nn \chemmacros_newman_coordinates:nn { on } +% #1: fp variable for x +% #2: fp variable for y +% #3: angle +% #4: radius +\cs_new:Npn \chemmacros_polar_to_cartesian:NNnn #1#2#3#4 + { + \fp_set:Nn #1 { #4 * cos( #3 / 180 * pi ) }% x + \fp_set:Nn #2 { #4 * sin( #3 / 180 * pi ) }% y + } % place back nodes \cs_new:Npn \chemmacros_newman_back_node:nn #1#2 { \group_begin: \fp_add:Nn \l__chemmacros_newman_rel_angle_fp { #1 } - \chemmacros_newman_coordinates:on - { \fp_to_int:N \l__chemmacros_newman_rel_angle_fp } + \chemmacros_polar_to_cartesian:NNnn + \l__chemmacros_newman_x_fp + \l__chemmacros_newman_y_fp + { \l__chemmacros_newman_rel_angle_fp } { \l__chemmacros_newman_scale_fp } \chemmacros_tikz_draw:f { \tl_use:N \l__chemmacros_newman_tikz_ring_tl } @@ -3038,8 +3117,10 @@ 30 * \fp_to_dim:N \l__chemmacros_newman_x_fp , 30 * \fp_to_dim:N \l__chemmacros_newman_y_fp ) ; - \chemmacros_newman_coordinates:on - { \fp_to_int:N \l__chemmacros_newman_rel_angle_fp } + \chemmacros_polar_to_cartesian:NNnn + \l__chemmacros_newman_x_fp + \l__chemmacros_newman_y_fp + { \l__chemmacros_newman_rel_angle_fp } { \l__chemmacros_newman_scale_fp } \chemmacros_tikz_node:f { @@ -3059,7 +3140,11 @@ % place front nodes: \cs_new:Npn \chemmacros_newman_front_node:nn #1#2 { - \chemmacros_newman_coordinates:nn { #1 } { \l__chemmacros_newman_scale_fp } + \chemmacros_polar_to_cartesian:NNnn + \l__chemmacros_newman_x_fp + \l__chemmacros_newman_y_fp + { #1 } + { \l__chemmacros_newman_scale_fp } \chemmacros_tikz_draw:f { \tl_use:N \l__chemmacros_newman_tikz_ring_tl } (0,0) -- ++ @@ -3067,7 +3152,11 @@ 30 * \fp_to_dim:N \l__chemmacros_newman_x_fp , 30 * \fp_to_dim:N \l__chemmacros_newman_y_fp ) ; - \chemmacros_newman_coordinates:nn { #1 } { \l__chemmacros_newman_scale_fp } + \chemmacros_polar_to_cartesian:NNnn + \l__chemmacros_newman_x_fp + \l__chemmacros_newman_y_fp + { #1 } + { \l__chemmacros_newman_scale_fp } \chemmacros_tikz_node:f { chemmacros_newman_atom_front, anchor = -180 + #1 } at @@ -3087,77 +3176,56 @@ \bool_new:N \l__chemmacros_orbital_type_sp_bool \bool_new:N \l__chemmacros_orbital_type_sptwo_bool \bool_new:N \l__chemmacros_orbital_type_spthree_bool - -\tl_new:N \l__chemmacros_orbital_s_color_tl -\tl_set:Nn \l__chemmacros_orbital_s_color_tl { black } -\tl_new:N \l__chemmacros_orbital_s_phase_color_tl - -\tl_new:N \l__chemmacros_orbital_p_color_tl -\tl_set:Nn \l__chemmacros_orbital_p_color_tl { black } -\tl_new:N \l__chemmacros_orbital_p_pphase_color_tl -\tl_new:N \l__chemmacros_orbital_p_mphase_color_tl - -\tl_new:N \l__chemmacros_orbital_sp_color_tl -\tl_set:Nn \l__chemmacros_orbital_sp_color_tl { black } -\tl_new:N \l__chemmacros_orbital_sp_pphase_color_tl -\tl_new:N \l__chemmacros_orbital_sp_mphase_color_tl - -\tl_new:N \l__chemmacros_orbital_sptwo_color_tl -\tl_set:Nn \l__chemmacros_orbital_sptwo_color_tl { black } -\tl_new:N \l__chemmacros_orbital_sptwo_pphase_color_tl -\tl_new:N \l__chemmacros_orbital_sptwo_mphase_color_tl - -\tl_new:N \l__chemmacros_orbital_spthree_color_tl -\tl_set:Nn \l__chemmacros_orbital_spthree_color_tl { black } -\tl_new:N \l__chemmacros_orbital_spthree_pphase_color_tl -\tl_new:N \l__chemmacros_orbital_spthree_mphase_color_tl - \bool_new:N \l__chemmacros_orbital_s_phase_bool \bool_set_true:N \l__chemmacros_orbital_s_phase_bool - \bool_new:N \l__chemmacros_orbital_p_phase_bool \bool_set_true:N \l__chemmacros_orbital_p_phase_bool - \bool_new:N \l__chemmacros_orbital_sp_phase_bool \bool_set_true:N \l__chemmacros_orbital_sp_phase_bool - \bool_new:N \l__chemmacros_orbital_sptwo_phase_bool \bool_set_true:N \l__chemmacros_orbital_sptwo_phase_bool - \bool_new:N \l__chemmacros_orbital_spthree_phase_bool \bool_set_true:N \l__chemmacros_orbital_spthree_phase_bool +\bool_new:N \l__chemmacros_orbital_p_half_bool +\bool_new:N \l__chemmacros_orbital_overlay_bool +\bool_new:N \l__chemmacros_orbital_opacity_bool -\tl_new:N \l__chemmacros_orbital_s_scale_tl +\tl_new:N \l__chemmacros_orbital_s_color_tl +\tl_set:Nn \l__chemmacros_orbital_s_color_tl { black } +\tl_new:N \l__chemmacros_orbital_s_phase_color_tl +\tl_new:N \l__chemmacros_orbital_p_color_tl +\tl_set:Nn \l__chemmacros_orbital_p_color_tl { black } +\tl_new:N \l__chemmacros_orbital_p_pphase_color_tl +\tl_new:N \l__chemmacros_orbital_p_mphase_color_tl +\tl_new:N \l__chemmacros_orbital_sp_color_tl +\tl_set:Nn \l__chemmacros_orbital_sp_color_tl { black } +\tl_new:N \l__chemmacros_orbital_sp_pphase_color_tl +\tl_new:N \l__chemmacros_orbital_sp_mphase_color_tl +\tl_new:N \l__chemmacros_orbital_sptwo_color_tl +\tl_set:Nn \l__chemmacros_orbital_sptwo_color_tl { black } +\tl_new:N \l__chemmacros_orbital_sptwo_pphase_color_tl +\tl_new:N \l__chemmacros_orbital_sptwo_mphase_color_tl +\tl_new:N \l__chemmacros_orbital_spthree_color_tl +\tl_set:Nn \l__chemmacros_orbital_spthree_color_tl { black } +\tl_new:N \l__chemmacros_orbital_spthree_pphase_color_tl +\tl_new:N \l__chemmacros_orbital_spthree_mphase_color_tl +\tl_new:N \l__chemmacros_orbital_s_scale_tl \tl_set:Nn \l__chemmacros_orbital_s_scale_tl { 1 } - -\tl_new:N \l__chemmacros_orbital_p_scale_tl +\tl_new:N \l__chemmacros_orbital_p_scale_tl \tl_set:Nn \l__chemmacros_orbital_p_scale_tl { 1 } - -\tl_new:N \l__chemmacros_orbital_sp_scale_tl +\tl_new:N \l__chemmacros_orbital_sp_scale_tl \tl_set:Nn \l__chemmacros_orbital_sp_scale_tl { 1 } - -\tl_new:N \l__chemmacros_orbital_sptwo_scale_tl +\tl_new:N \l__chemmacros_orbital_sptwo_scale_tl \tl_set:Nn \l__chemmacros_orbital_sptwo_scale_tl { 1 } - -\tl_new:N \l__chemmacros_orbital_spthree_scale_tl +\tl_new:N \l__chemmacros_orbital_spthree_scale_tl \tl_set:Nn \l__chemmacros_orbital_spthree_scale_tl { 1 } -\fp_new:N \l__chemmacros_orbital_angle_fp +\fp_new:N \l__chemmacros_orbital_angle_fp \fp_set:Nn \l__chemmacros_orbital_angle_fp { 90 } - -\bool_new:N \l__chemmacros_orbital_p_half_bool -\bool_set_false:N \l__chemmacros_orbital_p_half_bool - -\bool_new:N \l__chemmacros_orbital_overlay_bool -\bool_set_false:N \l__chemmacros_orbital_overlay_bool - -\bool_new:N \l__chemmacros_orbital_opacity_bool -\bool_set_false:N \l__chemmacros_opacity_overlay_bool - -\fp_new:N \l__chemmacros_orbital_opacity_fp +\fp_new:N \l__chemmacros_orbital_opacity_fp \fp_set:Nn \l__chemmacros_orbital_opacity_fp { 0.5 } -\cs_new_nopar:Npn \chemmacros_orbital_options: +\cs_new:Npn \chemmacros_orbital_options: { \chemmacros_orbital_overlay: , \chemmacros_orbital_opacity: , inner~sep=0 , outer~sep=0 , line~width=.2pt , @@ -3166,12 +3234,10 @@ minimum~size = 0 } -\cs_new_nopar:Npn \chemmacros_orbital_overlay: - { - \bool_if:NT \l__chemmacros_orbital_overlay_bool { overlay } - } +\cs_new:Npn \chemmacros_orbital_overlay: + { \bool_if:NT \l__chemmacros_orbital_overlay_bool { overlay } } -\cs_new_nopar:Npn \chemmacros_orbital_opacity: +\cs_new:Npn \chemmacros_orbital_opacity: { \bool_if:NT \l__chemmacros_orbital_opacity_bool { opacity = { \fp_use:N \l__chemmacros_orbital_opacity_fp } } @@ -3179,7 +3245,7 @@ % --------------------------------------------------------------------------- % % s-orbitals -\cs_new_nopar:Npn \chemmacros_orbital_type_s: +\cs_new:Npn \chemmacros_orbital_type_s: { \bool_set_true:N \l__chemmacros_orbital_type_s_bool \bool_set_false:N \l__chemmacros_orbital_type_p_bool @@ -3199,7 +3265,7 @@ color .tl_set:N = \l__chemmacros_orbital_s_color_tl } -\cs_new_nopar:Npn \chemmacros_orbital_s_draw:n #1 +\cs_new:Npn \chemmacros_orbital_s_draw:n #1 { \IfNoValueF { #1 } { \keys_set:nn { chemmacros / orbital / s } { #1 } } \bool_if:NTF \l__chemmacros_orbital_s_phase_bool @@ -3228,10 +3294,10 @@ % --------------------------------------------------------------------------- % % p-orbitals -\cs_new_nopar:Npn \chemmacros_orbital_type_p: +\cs_new:Npn \chemmacros_orbital_type_p: { \bool_set_false:N \l__chemmacros_orbital_type_s_bool - \bool_set_true:N \l__chemmacros_orbital_type_p_bool + \bool_set_true:N \l__chemmacros_orbital_type_p_bool \bool_set_false:N \l__chemmacros_orbital_type_sp_bool \bool_set_false:N \l__chemmacros_orbital_type_sptwo_bool \bool_set_false:N \l__chemmacros_orbital_type_spthree_bool @@ -3251,7 +3317,7 @@ half .default:n = true } -\cs_new_nopar:Npn \chemmacros_orbital_p_draw:n #1 +\cs_new:Npn \chemmacros_orbital_p_draw:n #1 { \IfNoValueF { #1 } { \keys_set:nn { chemmacros / orbital / p } { #1 } } \bool_if:NTF \l__chemmacros_orbital_p_phase_bool @@ -3324,11 +3390,11 @@ % --------------------------------------------------------------------------- % % sp-orbitals -\cs_new_nopar:Npn \chemmacros_orbital_type_sp: +\cs_new:Npn \chemmacros_orbital_type_sp: { \bool_set_false:N \l__chemmacros_orbital_type_s_bool \bool_set_false:N \l__chemmacros_orbital_type_p_bool - \bool_set_true:N \l__chemmacros_orbital_type_sp_bool + \bool_set_true:N \l__chemmacros_orbital_type_sp_bool \bool_set_false:N \l__chemmacros_orbital_type_sptwo_bool \bool_set_false:N \l__chemmacros_orbital_type_spthree_bool } @@ -3345,7 +3411,7 @@ color .tl_set:N = \l__chemmacros_orbital_sp_color_tl } -\cs_new_nopar:Npn \chemmacros_orbital_sp_draw:n #1 +\cs_new:Npn \chemmacros_orbital_sp_draw:n #1 { \IfNoValueF { #1 } { \keys_set:nn { chemmacros / orbital / sp } { #1 } } \bool_if:NTF \l__chemmacros_orbital_sp_phase_bool @@ -3415,12 +3481,12 @@ % --------------------------------------------------------------------------- % % sp2-orbitals -\cs_new_nopar:Npn \chemmacros_orbital_type_sptwo: +\cs_new:Npn \chemmacros_orbital_type_sptwo: { \bool_set_false:N \l__chemmacros_orbital_type_s_bool \bool_set_false:N \l__chemmacros_orbital_type_p_bool \bool_set_false:N \l__chemmacros_orbital_type_sp_bool - \bool_set_true:N \l__chemmacros_orbital_type_sptwo_bool + \bool_set_true:N \l__chemmacros_orbital_type_sptwo_bool \bool_set_false:N \l__chemmacros_orbital_type_spthree_bool } @@ -3436,7 +3502,7 @@ color .tl_set:N = \l__chemmacros_orbital_sptwo_color_tl } -\cs_new_nopar:Npn \chemmacros_orbital_sptwo_draw:n #1 +\cs_new:Npn \chemmacros_orbital_sptwo_draw:n #1 { \IfNoValueF { #1 } { \keys_set:nn { chemmacros / orbital / sp2 } { #1 } } \bool_if:NTF \l__chemmacros_orbital_sptwo_phase_bool @@ -3506,13 +3572,13 @@ % --------------------------------------------------------------------------- % % sp3-orbitals -\cs_new_nopar:Npn \chemmacros_orbital_type_spthree: +\cs_new:Npn \chemmacros_orbital_type_spthree: { \bool_set_false:N \l__chemmacros_orbital_type_s_bool \bool_set_false:N \l__chemmacros_orbital_type_p_bool \bool_set_false:N \l__chemmacros_orbital_type_sp_bool \bool_set_false:N \l__chemmacros_orbital_type_sptwo_bool - \bool_set_true:N \l__chemmacros_orbital_type_spthree_bool + \bool_set_true:N \l__chemmacros_orbital_type_spthree_bool } \keys_define:nn { chemmacros / orbital / sp3 } @@ -3527,7 +3593,7 @@ color .tl_set:N = \l__chemmacros_orbital_spthree_color_tl } -\cs_new_nopar:Npn \chemmacros_orbital_spthree_draw:n #1 +\cs_new:Npn \chemmacros_orbital_spthree_draw:n #1 { \IfNoValueF { #1 } { \keys_set:nn { chemmacros / orbital / sp3 } { #1 } } \bool_if:NTF \l__chemmacros_orbital_spthree_phase_bool @@ -3619,6 +3685,7 @@ sp3 .code:n = { \chemmacros_orbital_type_spthree: } } +% TODO separate document and module level \NewDocumentCommand \orbital { o m } { \group_begin: @@ -3730,7 +3797,7 @@ \NewDocumentCommand \chemsetup { o m } { \IfNoValueTF { #1 } - { \keys_set:nn { chemmacros } { #2 } } + { \keys_set:nn { chemmacros } { #2 } } { \keys_set:nn { chemmacros / #1 } { #2 } } \ignorespaces } @@ -3738,9 +3805,7 @@ % --------------------------------------------------------------------------- % % load old definitions: \bool_if:NT \l__chemmacros_version_one_bool - { - \input { chemmacros-version1 . cfg } - } + { \file_input:n { chemmacros-version1 . cfg } } % --------------------------------------------------------------------------- % % hyperref support @@ -3749,7 +3814,7 @@ { \pdfstringdefDisableCommands { - \cs_set:Npn \- { - } + \cs_set:Npn \- { - }% myabe not a good idea... \cs_set:Npn \| { } \cs_set:Npn \iupac #1 { #1 } \cs_set:Npn \pH { pH } @@ -3887,6 +3952,14 @@ Version history and `radical-radius' 2012/10/03 - version 3.4a - bug fix in coupling constant \J 2013/01/04 - version 3.4b - bug fix in the sub- and superscript handling +2013/01/28 - version 3.5 - disallow breaks at bonds + - allow breaks after arrows + - made some spaces in chemformulas stretch- and + shrinkable + - various internal code improvements + - changed defaults for horizontal spaces that have in + set in ex into corresponding values in em. + - improvements to the placement of sub- and superscripts % --------------------------------------------------------------------------- % % TODO: diff --git a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def index 521d0d7cc6c..e4324bc4c71 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def +++ b/Master/texmf-dist/tex/latex/chemmacros/language/ghsystem_english.def @@ -225,7 +225,7 @@ \prop_put:Nnn \l__ghsystem_p_prop { 283 } { Wear~fire/flame~re\-sis\-tant/re\-tar\-dant~clo\-thing. } \prop_put:Nnn \l__ghsystem_p_prop { 284 } { Wear~res\-pi\-ra\-to\-ry~pro\-tec\-tion. } \prop_put:Nnn \l__ghsystem_p_prop { 285 } { In~case~of~in\-ade\-quate~ven\-ti\-la\-tion~wear~res\-pi\-ra\-to\-ry~pro\-tec\-tion. } -\prop_put:Nnn \l__ghsystem_p_prop { 231 + 231 } { Handle~un\-der~inert~gas.~Pro\-tect~from~mois\-ture. } +\prop_put:Nnn \l__ghsystem_p_prop { 231 + 232 } { Handle~un\-der~inert~gas.~Pro\-tect~from~mois\-ture. } \prop_put:Nnn \l__ghsystem_p_prop { 235 + 410 } { Keep~cool.~Pro\-tect~from~sun\-light. } % 3.3 Precautionary Statements — Response |