summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-03-02 01:13:28 +0000
committerKarl Berry <karl@freefriends.org>2013-03-02 01:13:28 +0000
commite77fff9dbd365d2a2cf838b2a1f3d71ef5ecfad7 (patch)
treeca85b1713d99d96141cdba28d336ada6e762b581
parentb979b6977fcd5d334404b254bba05601f4fd0bcb (diff)
chemmacros (28feb13)
git-svn-id: svn://tug.org/texlive/trunk@29263 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/chemmacros/README4
-rw-r--r--Master/texmf-dist/doc/latex/chemmacros/chemformula_test_sub_and_superscripts.tex34
-rw-r--r--Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.pdfbin829839 -> 828677 bytes
-rw-r--r--Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.tex52
-rw-r--r--Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdfbin813811 -> 816311 bytes
-rw-r--r--Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex51
-rw-r--r--Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.pdfbin816900 -> 820074 bytes
-rw-r--r--Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.tex52
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemformula.sty326
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty452
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty226
11 files changed, 694 insertions, 503 deletions
diff --git a/Master/texmf-dist/doc/latex/chemmacros/README b/Master/texmf-dist/doc/latex/chemmacros/README
index c0afb66d15b..8342f05b70d 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.5
+the CHEMMACROS bundle v3.6
-> 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/28
+2013/02/26
--------------------------------------------------------------------------
This bundle succeeds the chemmacros package which is now part of the
bundle
diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemformula_test_sub_and_superscripts.tex b/Master/texmf-dist/doc/latex/chemmacros/chemformula_test_sub_and_superscripts.tex
index 82e0636e67b..d7119b1e199 100644
--- a/Master/texmf-dist/doc/latex/chemmacros/chemformula_test_sub_and_superscripts.tex
+++ b/Master/texmf-dist/doc/latex/chemmacros/chemformula_test_sub_and_superscripts.tex
@@ -108,19 +108,21 @@ no shift:\chemsetup[chemformula]{charge-hshift=0pt}\\
\verb|\ch{NH4+}| \ch{NH4+} \\
\verb|\ch{SO4^2-}| \ch{SO4^2-}
- \ch{A^{x-}} \\
- \ch{A^x-} \\
- \ch{A^{x}-} \\
- \ch{A^{$x-$}} \\
- \ch{RNO2^{-.}} \\
- \ch{^31H} \\
- \ch{^{14}6C} \\
- \ch{^{58}_{26}Fe} \\
- \ch{NO^*} \\
- \ch{SO4^2-} \ch{Ca^2+ SO4^2-}
+Other tests:
+
+\ch{A^{x-}} \\
+\ch{A^x-} \\
+\ch{A^{x}-} \\
+\ch{A^{$x-$}} \\
+\ch{RNO2^{-.}} \\
+\ch{^31H} \\
+\ch{^{14}6C} \\
+\ch{^{58}_{26}Fe} \\
+\ch{NO^*} \\
+\ch{SO4^2-} \ch{Ca^2+ SO4^2-}
\chemsetup[option]{circled=all}
- \ch{H+ + OH- <=> H2O}
+\ch{H+ + OH- <=> H2O}
\chemsetup{option/circled=formal,chemformula/charge-hshift=.5ex}
\ch{H^2} \ch[charge-vshift=.2ex]{H^2} H$^2$
@@ -131,10 +133,10 @@ no shift:\chemsetup[chemformula]{charge-hshift=0pt}\\
$ A^{\ch{SO4^2-}}$
- \ch{!(water)(H2O)} \quad
- \ch{!( "\textcolor{blue}{water}" )( H2O )} \quad
- \ch{!( $2n-1$ )( H2O )} \quad
- \ch{!( H2O )( H2O )} \quad
- \ch{!(oxonium)( H3O+ )}
+\ch{!(water)(H2O)} \quad
+\ch{!( "\textcolor{blue}{water}" )( H2O )} \quad
+\ch{!( $2n-1$ )( H2O )} \quad
+\ch{!( H2O )( H2O )} \quad
+\ch{!(oxonium)( H3O+ )}
\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.pdf b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.pdf
index 00043c24734..f5b8f369199 100644
--- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.pdf
+++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.tex b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.tex
index 93ac08a9092..0fd1dcf1fab 100644
--- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.tex
+++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_de.tex
@@ -550,6 +550,21 @@ Bei der Sprachwahl \code{italian} werden zusätzliche IUPAC-Befehle definiert:
\item ein paar Änderungen am Aussehen des Radikalpunktes und neue Optionen, um es
anzupassen, siehe Abschnitt~\ref{ssec:compounds:customization}.
\end{itemize}
+
+\subsection{Versionen 3.5 und 3.6}
+\begin{itemize}
+ \item Zeilenumbrüche vor und nach Bindungen in Formeln sind nicht mehr möglich.
+ \item Zeilenumbrüche nach Pfeilen in Formeln sind erlaubt.
+ \item Einige der horizontalen Leerräume in Formeln haben jetzt dehnbare Anteile.
+ \item In Formeln ist geschützte Methe-EIngabe jetzt auch mit \cmd*{(} und
+ \cmd*{)} möglich.
+ \item Neue Optionen: \key{radical-vshift}, \key{radical-hshift} und
+ \key{radical-space} erlauben Feinkontrolle über den Radikalpunkt.
+ \item In stöchiometrischen Faktoren wird eine führende Null hinzugefügt, wenn
+ sie fehlt.
+ \item Neue Option: \key{stoich-paren-parse}.
+ \item Zahlreiche interne Änderungen am Code.
+\end{itemize}
\secidx*{Neues}\secidx*{BEVOR ES LOS GEHT}
\part{\texorpdfstring{\Chemmacros}{chemmacros}}\secidx{CHEMMACROS}
@@ -1240,6 +1255,7 @@ den Abstand zwischen Atom und Anfang der Linie zu verändern.
\OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox}
\end{beispiel}
+\newpage
Beispiele:% TODO: watch pagebreaks!
\begin{beispiel}[dist]
\ch{ 2 "\OX{o1,Na}" + "\OX{r1,Cl}" {}2 -> 2 "\OX{o2,Na}" \pch{} + 2
@@ -1274,6 +1290,7 @@ Beispiele:% TODO: watch pagebreaks!
\end{beispiel}
\secidx*{Redoxreaktionen}
+\newpage % TODO: watch pagebreaks
\section{(Standard) Zustand, Thermodynamik}\label{sec:standardstate}\secidx{Thermodynamik}
\subsection{Thermodynamische Größen}\label{ssec:siunitx}
Die folgenden Befehle verwenden \paket{siunitx}:
@@ -2203,14 +2220,20 @@ bestehen.
\ch{12}
% decimals:
- \ch{3.5} \\
+ \ch{.5} \\
\ch{5,75}
% fractions:
\ch{3/2} \\
\ch{1_1/2}
+
+ % ``iupac'':
+ \ch{(1/2)}
\end{beispiel}
+Wie Sie sehen können, wird bei Dezimalbrüchen eine führende Null ergänzt, wenn
+sie in der Eingabe fehlt.
+
Sie müssen bei dem Input ein wenig auf die richtige Syntax achten, aber ich denke,
sie ist recht intuitiv.
\begin{beispiel}[code only]
@@ -2218,7 +2241,8 @@ sie ist recht intuitiv.
\end{beispiel}
Wenn die stöchiometrischen Faktoren in Klammern geschrieben werden, werden die Brüche
-nicht umgewandelt. Was in den Klammern steht, wird genauso geschrieben.
+nicht umgewandelt und führende Nullen nicht ergänzt. Was in den Klammern steht,
+wird genauso geschrieben.
\begin{beispiel}
\ch{(1/2) H2O} \ch{1/2 H2O} \ch{0.5 H2O}
\end{beispiel}
@@ -2236,6 +2260,10 @@ Der Output kann mit diesen Optionen angepasst werden:
Default = \code{math}
\option{stoich-space}{<skip>} Der Leerraum nach einem stöchiometrischen Faktor.
Eine elastische Länge. Default = \code{.1667em plus .0333em minus .0117em}
+ \option{stoich-paren-parse}{\default{true}|false} Wenn die Option auf
+ \code{true} gesetzt ist, werden auch stöchiometrische Faktoren, die in Klammern
+ stehen, verarbeitet, d.h. Brüche umgewandelt und führende Nullen ergänzt.
+ Default = \code{false}
\end{beschreibung}
\begin{beispiel}
\ch[decimal-marker={,}]{3.5} \ch[decimal-marker={$\cdot$}]{3,5}
@@ -2514,6 +2542,12 @@ Diese Optionen ermöglichen Ihnen, den Output anzupassen:
undefiniert.
\option{radical-radius}{<dim>} Der Radius des Radikalpunktes. Default =
\code{.2ex}
+ \option{radical-hshift}{<dim>} Horizontaler Leerraum vor dem Radikalpunkt.
+ Default = \code{.15em}
+ \option{radical-vshift}{<dim>} Vertikale Position des Radikalpunktes relativ zur
+ aktuellen Grundlinie. Default = \code{.5ex}
+ \option{radical-space}{<dim>} Horizontaler Leerraum nach dem Radikalpunkt.
+ Default = \code{.15em}
\end{beschreibung}
Vielleicht ist Ihnen aufgefallen, dass bei manchen Ionen die Ladungen nach rechts
@@ -2663,15 +2697,19 @@ einen Befehl innerhalb von \cmd{ch} zu verwenden, versuchen Sie die geschützte
Methode.
\subsection{Mathematik}\secidx[math]{Geschützter Input}[Geschuetzter Input]
-Wenn Sie speziell Mathematik-Input haben, setzen Sie ihn einfach zwischen \lstinline+$ $+.
-Der Output unterscheidet sich vom geschützten Text (abgesehen von Mathe-Layout)
-darin, dass ihm ein Leerraum folgt.
-\begin{beschreibung}\catcode`\$=11
- \Befehl{ch}{ $<escaped math>$ }
+Wenn Sie speziell Mathematik-Input haben, setzen Sie ihn einfach zwischen
+\lstinline+$ $+. Der Output unterscheidet sich vom geschützten Text (abgesehen
+von Mathe-Layout) darin, dass ihm ein Leerraum folgt. Der Grund dafür ist, dass
+ich davon ausgehe, das Mathe-Eingabe vor allem an Stelle von stöchiometrischen
+Faktoren eingesetzt wird.
+\begin{beschreibung}
+ \Befehl{ch}{ \string$<escaped math>\string$ }
+ \Befehl{ch}{ \string\(<escaped math>\string\) }
\end{beschreibung}
\begin{beispiel}
escaped text: \ch{"$x$" H2O} \\
escaped math: \ch{$x$ H2O} \\
+ also escaped math: \ch{\(x\) H2O} \\
\ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl}
\end{beispiel}
diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdf b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdf
index 1a7e2f67837..f93f05024fe 100644
--- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdf
+++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex
index 45d723691b3..b1743cf1432 100644
--- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex
+++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_en.tex
@@ -530,12 +530,24 @@ Choosing the language \code{italian} defines two additional \ac{iupac} commands:
\item \chemmacros got an Italian manual, many thanks to Jonas Rivetti who
volunteered to not only translate the H \&\ P statements but also this
documentation!
- \item the command \cmd{bond} which allows to use other bonds than single, double
+ \item The command \cmd{bond} which allows to use other bonds than single, double
and triple, see section~\ref{ssec:bonds}. I wanted to add this for a long time!
- \item a few changes to the looks of the radical point and new options to customize
+ \item A few changes to the looks of the radical point and new options to customize
it, see section~\ref{ssec:compounds:customization}.
\end{itemize}
+\subsection{Versions 3.5 and 3.6}
+\begin{itemize}
+ \item Line breaks at bonds in formulas are no longer possible.
+ \item Line breaks after arrows in formulas are possible.
+ \item Some of the horizontal spaces in formulas are now stretch- and shrinkable.
+ \item In formulas math escaping is also via \cmd*{(} and \cmd*{)} possible.
+ \item New options: \key{radical-vshift}, \key{radical-hshift} and
+ \key{radical-space} allow finer control over the radical dot.
+ \item In stoichiometric factors a leading 0 is added if missing.
+ \item New option: \key{stoich-paren-parse}.
+ \item Various internal changes to the code.
+\end{itemize}
\secidx*{News}\secidx*{PRELIMINARIES}
\part{\texorpdfstring{\Chemmacros}{chemmacros}}\secidx{CHEMMACROS}\label{part:chemmacros}
@@ -1224,11 +1236,13 @@ Examples:% TODO: watch pagebreaks!
\end{beispiel}
\begin{beispiel}[dist]
\ch{ 2 "\OX{o1,\ox{0,Na}}" + "\OX{r1,\ox{0,Cl}}" {}2 -> 2 "\OX{o2,\ox{+1,Na}}"
-\pch{} + 2 "\OX{r2,\ox{-1,Cl}}" \mch }
+ \pch{} + 2 "\OX{r2,\ox{-1,Cl}}" \mch }
\redox(o1,o2){\small OX: $- 2\el$}
\redox(r1,r2)[][-1]{\small RED: $+ 2\el$}
\vspace{7mm}
\end{beispiel}
+
+\newpage
\bspmidlength{dist}{15mm}
\begin{beispiel}[dist]
\ch{ 2 "\OX{o1,\ox{0,Na}}" + "\OX{r1,\ox{0,Cl}}" {}2 -> 2 "\OX{o2,\ox{+1,Na}}"
@@ -1237,11 +1251,10 @@ Examples:% TODO: watch pagebreaks!
\redox(r1,r2)[draw=blue,->]{\small RED: $+ 2\el$}
\end{beispiel}
-\newpage
\bspmidlength{dist}{7mm}
\begin{beispiel}[dist]
\ch{ 2 "\OX{o1,\ox{0,Na}}" + "\OX{r1,\ox{0,Cl}}" {}2 -> 2 "\OX{o2,\ox{+1,Na}}"
-\pch{} + 2 "\OX{r2,\ox{-1,Cl}}" \mch }
+ \pch{} + 2 "\OX{r2,\ox{-1,Cl}}" \mch }
\redox(o1,o2)[green,-stealth]{\small OX}
\redox(r1,r2)[purple,-stealth][-1]{\small RED}
\vspace{7mm}
@@ -2142,14 +2155,19 @@ A stoichiometric factor may only contain of numbers and the signs \lstinline+.,_
\ch{12}
% decimals:
- \ch{3.5} \\
+ \ch{.5} \\
\ch{5,75}
% fractions:
\ch{3/2} \\
\ch{1_1/2}
+
+ % ``iupac'':
+ \ch{(1/2)}
\end{beispiel}
+As you can see if you input decimal numbers a missing leading zero is added.
+
You have to be a little bit careful with the right syntax but I believe it is
rather intuitive.
\begin{beispiel}[code only]
@@ -2157,7 +2175,8 @@ rather intuitive.
\end{beispiel}
If stoichiometric factors are enclosed with parentheses the fractions are not
-recognized. What's inside the parenthesis is typeset as is.
+recognized and missing leading zeros are not added. What's inside the parentheses
+is typeset as is.
\begin{beispiel}
\ch{(1/2) H2O} \ch{1/2 H2O} \ch{0.5 H2O}
\end{beispiel}
@@ -2175,6 +2194,8 @@ There are a few possibilities to customize the output.
Default = \code{math}
\option{stoich-space}{<skip>} The space that is placed after the stoichiometric
factor. A rubber length. Default = \code{.1667em plus .0333em minus .0117em}
+ \option{stoich-paren-parse}{\default{true}|false} If set to true stoichiometric
+ factors enclosed by parentheses also are parsed. Default = \code{false}
\end{beschreibung}
\begin{beispiel}
\ch[decimal-marker={,}]{3.5} \ch[decimal-marker={$\cdot$}]{3,5}
@@ -2446,6 +2467,12 @@ These options allow you to customize the ouptut of the compounds:
empty.
\option{radical-radius}{<dim>} The radius of the radical point. Default =
\code{.2ex}
+ \option{radical-hshift}{<dim>} Horizontal shift before the radical point is
+ drawn. Default = \code{.15em}
+ \option{radical-vshift}{<dim>} Vertical shift relative to the current baseline.
+ Default = \code{.5ex}
+ \option{radical-space}{<dim>} Horizontal shift after the radical point is
+ drawn. Default = \code{.15em}
\end{beschreibung}
Maybe you have noticed that charges of certain ions are shifted to the right.\secidx[charges!shift]{Compounds}
@@ -2594,13 +2621,17 @@ when using a command inside \cmd{ch} try hiding it.
\subsection{Math}\secidx[math]{Escaped Input}
If you especially want to input math you just enclose it with \lstinline+$ $+.
-This output is different from the escaped text as it is followed by a space.
-\begin{beschreibung}\catcode`\$=11
- \Befehl{ch}{ $<escaped math>$ }
+This output is different from the escaped text as it is followed by a space. The
+reasoning behind this is that I assume math will mostly be used to replace
+stoichiometric factors.
+\begin{beschreibung}
+ \Befehl{ch}{ \string$<escaped math>\string$ }
+ \Befehl{ch}{ \string\(<escaped math>\string\) }
\end{beschreibung}
\begin{beispiel}
escaped text: \ch{"$x$" H2O} \\
escaped math: \ch{$x$ H2O} \\
+ also escaped math: \ch{\(x\) H2O} \\
\ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl}
\end{beispiel}
diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.pdf b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.pdf
index 7e405f77614..4e3e48c6081 100644
--- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.pdf
+++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.tex b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.tex
index d0649f7bba5..39b8ded627e 100644
--- a/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.tex
+++ b/Master/texmf-dist/doc/latex/chemmacros/chemmacros_it.tex
@@ -555,6 +555,23 @@ Selezionando come lingua \code{italian} vengono definiti ulteriori comandi \ac{i
\item Alcuni cambiamenti all'aspetto del punto radicalico e nuove opzioni per la
sua personalizzazione (vedi il sottoparagrafo~\ref{ssec:compounds:customization}).
\end{itemize}
+
+\subsection{Versioni 3.5 e 3.6}
+\begin{itemize}
+ \item Le interruzioni di riga che precedono o seguono i legami nelle formule non
+ sono più possibili.
+ \item Le interruzioni di riga seguenti le frecce di reazione nelle formule sono
+ ora permesse.
+ \item Alcuni degli spazi orizzontali nelle formule ora hanno dei componenti
+ elastici.
+ \item È ora possibile inserire un ambiente matematico protetto all'interno
+ delle formule anche con \cmd*{(} e \cmd*{)}.
+ \item Le nuove opzioni \key{radical-vshift}, \key{radical-hshift} e
+ \key{radical-space} permettono un controllo fine sul punto di radicale.
+ \item Nei fattori stechiometrici viene inserito uno zero iniziale quando mancante.
+ \item Nuova opzione \key{stoich-paren-parse}.
+ \item Numerose variazioni interne del codice.
+\end{itemize}
\secidx*{Novità}\secidx*{PRIMA DI COMINCIARE}
\part{\texorpdfstring{\Chemmacros}{chemmacros}}\secidx{CHEMMACROS}
@@ -1239,6 +1256,8 @@ permette di variare la distanza tra atomo e inizio della linea.
\OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b)[->,red]{ox}
\end{beispiel}
+% TODO: watch pagebreaks!
+\newpage
Esempi:
\begin{beispiel}[dist]
\ch{ 2 "\OX{o1,Na}" + "\OX{r1,Cl}" {}2 -> 2 "\OX{o2,Na}" \pch{} + 2
@@ -1273,6 +1292,8 @@ Esempi:
\end{beispiel}
\secidx*{Reazioni redox}
+% TODO: watch pagebreaks!
+\newpage
\section{Stati (standard), termodinamica}\label{sec:standardstate}\secidx{Termodinamica}
\subsection{Grandezze termodinamiche}\label{ssec:siunitx}
I comandi seguenti impiegano \paket{siunitx}:
@@ -2128,14 +2149,20 @@ Un fattore stechiometrico deve contenere solo cifre e simboli tra i seguenti: \l
\ch{12}
% decimals:
- \ch{3.5} \\
+ \ch{.5} \\
\ch{5,75}
% fractions:
\ch{3/2} \\
\ch{1_1/2}
+
+ % ``iupac'':
+ \ch{(1/2)}
\end{beispiel}
+Come nell'esempio per le frazioni decimali viene introdotto uno zero iniziale
+quando manca nell'input.
+
Nell'input è necessario badare alla sintassi giusta, anche se ritengo che sia
piuttosto intuitiva.
\begin{beispiel}[code only]
@@ -2143,7 +2170,8 @@ piuttosto intuitiva.
\end{beispiel}
Quando i fattori stechiometrici sono scritti tra parentesi le frazioni non vengono
-convertite. Il testo inserito tra parentesi viene reso allo stesso modo.
+convertite e gli eventuali zeri iniziali non vengono aggiunti.
+Il testo inserito tra parentesi viene reso allo stesso modo dell'input.
\begin{beispiel}
\ch{(1/2) H2O} \ch{1/2 H2O} \ch{0.5 H2O}
\end{beispiel}
@@ -2162,6 +2190,10 @@ L'output può essere adattato utilizzando le opzioni seguenti:
le frazioni. Default = \code{math}
\option{stoich-space}{<skip>} La dimensione dello spazio dopo un fattore stechiometrico.
Una lunghezza elastica. Default = \code{.1667em plus .0333em minus .0117em}
+ \option{stoich-paren-parse}{\default{true}|false} Quando l'opzione è impostata
+ a \code{true} anche i fattori stechiometrici compresi tra parentesi vengono
+ elaborati, cioè le frazioni convertite e gli zeri iniziali inseriti.
+ Default = \code{false}
\end{beschreibung}
\begin{beispiel}
\ch[decimal-marker={,}]{3.5} \ch[decimal-marker={$\cdot$}]{3,5}
@@ -2436,6 +2468,12 @@ Le seguenti opzioni permettono di adattare l'output:
\option{radical-style}{<tikz>} Opzioni di \TikZ\ per il punto radicalico.
Inizialmente vuoto.
\option{radical-radius}{<dim>} Il raggio del punto radicalico. Default = \code{.2ex}
+ \option{radical-hshift}{<dim>} Spazio orizzontale precedente il punto
+ radicalico. Default = \code{.15em}
+ \option{radical-vshift}{<dim>} Posizione verticale del punto radicalico
+ riferita all'attuale linea di base. Default = \code{.5ex}
+ \option{radical-space}{<dim>} Spazio orizzontale seguente il punto radicalico.
+ Default = \code{.15em}
\end{beschreibung}
Forse l'utente si sarà accorto che per alcuni ioni le cariche sono spostate a
@@ -2584,13 +2622,17 @@ impiegare un comando all'interno di \cmd{ch} può essere utile applicare il modo
\subsection{Matematica}\secidx[math]{Input protetto}
Quando si ha dell'input matematico, è sufficiente porlo tra \lstinline+$ $+.
L'output si distingue dal testo protetto (oltre che per il modo matematico)
-anche per la presenza di uno spazio in seguito.
-\begin{beschreibung}\catcode`\$=11
- \Befehl{ch}{ $<escaped math>$ }
+anche per la presenza di uno spazio in seguito. Il motivo è che suppongo che
+l'input matematico venga utilizzato soprattutto in luogo dei fattori
+stechiometrici.
+\begin{beschreibung}
+ \Befehl{ch}{ \string$<escaped math>\string$ }
+ \Befehl{ch}{ \string\(<escaped math>\string\) }
\end{beschreibung}
\begin{beispiel}
escaped text: \ch{"$x$" H2O} \\
escaped math: \ch{$x$ H2O} \\
+ also escaped math: \ch{\(x\) H2O} \\
\ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl}
\end{beispiel}
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty
index c8c81b62add..715ff06b1ad 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty
@@ -156,13 +156,13 @@
\dim_new:N \l__chemformula_radical_radius_dim
\dim_set:Nn \l__chemformula_radical_radius_dim { .2ex }
\dim_new:N \l__chemformula_radical_hshift_dim
-\dim_set:Nn \l__chemformula_radical_hshift_dim { .3ex }
+\dim_set:Nn \l__chemformula_radical_hshift_dim { .15em }
\dim_new:N \l__chemformula_radical_vshift_dim
-\dim_set:Nn \l__chemformula_radical_vshift_dim { .7ex }
+\dim_set:Nn \l__chemformula_radical_vshift_dim { .5ex }
\dim_new:N \l__chemformula_radical_space_dim
-\dim_set:Nn \l__chemformula_radical_space_dim { .3ex }
+\dim_set:Nn \l__chemformula_radical_space_dim { .15em }
-\cs_new:Npn \chemformula_radical:
+\cs_new_protected:Npn \chemformula_radical:
{
\chemformula_tikz:xn
{
@@ -314,7 +314,7 @@
\tl_set:Nn \l__chemformula_arrow_ratio_tl { .6 }
% determine length in dependency of labels
-\cs_new_protected:Npn \chemformula_determine_arrow_length:NN #1#2
+\cs_new_protected: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 }
@@ -359,59 +359,59 @@
\box_new:N \l__chemformula_arrow_arg_ii_box
% read optional arguments
-\cs_new:Npn \l__chemformula_arrow_read_args:w
+\cs_new:Npn \__chemformula_arrow_read_args:w
{
\peek_meaning:NTF [
- { \l__chemformula_arrow_read_args_aux_i:w }
- { \l__chemformula_arrow_read_args_aux_iii: }
+ { \__chemformula_arrow_read_args_aux_i:w }
+ { \__chemformula_arrow_read_args_aux_iii: }
}
-\cs_new_protected:Npn \l__chemformula_arrow_read_args_aux_i:w [#1]
+\cs_new_protected:Npn \__chemformula_arrow_read_args_aux_i:w [#1]
{
\hbox_set:Nn \l__chemformula_arrow_arg_i_box
{ \tl_use:N \l__chemformula_arrow_label_style_tl #1 }
\peek_meaning:NTF [
- { \l__chemformula_arrow_read_args_aux_ii:w }
- { \l__chemformula_arrow_read_args_aux_iii: }
+ { \__chemformula_arrow_read_args_aux_ii:w }
+ { \__chemformula_arrow_read_args_aux_iii: }
}
-\cs_new_protected:Npn \l__chemformula_arrow_read_args_aux_ii:w [#1]
+\cs_new_protected:Npn \__chemformula_arrow_read_args_aux_ii:w [#1]
{
\hbox_set:Nn \l__chemformula_arrow_arg_ii_box
{ \tl_use:N \l__chemformula_arrow_label_style_tl #1 }
- \l__chemformula_arrow_read_args_aux_iii:
+ \__chemformula_arrow_read_args_aux_iii:
}
-\cs_new:Npn \l__chemformula_arrow_read_args_aux_iii:
+\cs_new:Npn \__chemformula_arrow_read_args_aux_iii:
{
% now we have both arguments do the actual drawing:
\prop_get:NVN \l__chemformula_arrows_code_prop
\l__chemformula_arrow_type_tl
\l__chemformula_tmpb_tl
- \chemformula_arrow_draw:V \l__chemformula_tmpb_tl
+ \__chemformula_arrow_draw:V \l__chemformula_tmpb_tl
}
% get arrows (for the use in \ch to replace the symbol)
% #1: symbol
-\cs_new_protected:Npn \chemformula_arrows_get:n #1
+\cs_new_protected:Npn \__chemformula_arrows_get:n #1
{
% first clear the arguments
\box_clear:N \l__chemformula_arrow_arg_i_box
\box_clear:N \l__chemformula_arrow_arg_ii_box
% then get the arrow type
\tl_set:Nn \l__chemformula_arrow_type_tl { #1 }
- \l__chemformula_arrow_read_args:w
+ \__chemformula_arrow_read_args:w
}
% draw the arrows
-\cs_new:Npn \chemformula_arrow_draw:n #1
+\cs_new:Npn \__chemformula_arrow_draw:n #1
{
\chemmacros_allow_break:
% prepare arrow code for drawing:
\tl_set_rescan:Nnn \l__chemformula_tmpc_tl
{ \char_set_catcode_letter:N \_ } { #1 }
% determine length of the arrow
- \chemformula_determine_arrow_length:NN
+ \__chemformula_determine_arrow_length:NN
\l__chemformula_arrow_arg_i_box
\l__chemformula_arrow_arg_ii_box
\chemformula_tikz:nf
@@ -448,7 +448,7 @@
}
\chemmacros_allow_break:
}
-\cs_generate_variant:Nn \chemformula_arrow_draw:n { V }
+\cs_generate_variant:Nn \__chemformula_arrow_draw:n { V }
% commands to declare arrows (can also be used by users):
% #1: symbol, #2: code
@@ -548,7 +548,7 @@
%-----------------------------------------------------------------------------%
\seq_new:N \l__chemformula_input_seq
% MAIN COMMAND
-\cs_new_protected:Npn \chemformula_ch_main:n #1
+\cs_new_protected:Npn \__chemformula_ch_main:n #1
{
\group_begin:
\seq_set_split:Nnn \l__chemformula_input_seq { ~ } { #1 }
@@ -564,8 +564,8 @@
\seq_map_function:NN
\l__chemformula_input_seq
\chemformula_input:n
- \chemformula_generate_arrows:V \l__chemformula_input_tl
- \chemformula_generate_name:V \l__chemformula_output_tl
+ \__chemformula_generate_arrows:V \l__chemformula_input_tl
+ \__chemformula_generate_name:V \l__chemformula_output_tl
\tl_set_rescan:Nno \l__chemformula_output_tl
{ \ExplSyntaxOn \makeatletter }
{ \l__chemformula_output_tl }
@@ -573,6 +573,7 @@
\group_end:
}
+% internal version of \ch command:
\cs_new_protected:Npn \chemformula_ch:nn #1#2
{
\group_align_safe_begin:
@@ -580,7 +581,7 @@
\IfNoValueTF { #1 }
{ \tl_gclear:N \g__chemformula_options_tl }
{ \tl_gset:Nn \g__chemformula_options_tl { #1 } }
- \chemformula_ch_aux_i:w #2 \\ \q_no_value \q_stop
+ \__chemformula_ch_aux_i:w #2 \\ \q_no_value \q_stop
\group_align_safe_end:
\tl_use:N \g__chemformula_output_tl
\tl_gclear:N \g__chemformula_output_tl
@@ -588,58 +589,58 @@
% Trickery to use \ch inside align environment:
% bypass \\:
-\cs_new_protected:Npn \chemformula_ch_aux_i:w #1 \\ #2 \q_stop
+\cs_new_protected:Npn \__chemformula_ch_aux_i:w #1 \\ #2 \q_stop
{
- \chemformula_ch_aux_ii:w #1 & \q_no_value \q_stop
+ \__chemformula_ch_aux_ii:w #1 & \q_no_value \q_stop
\quark_if_no_value:nF { #2 }
{
\tl_gput_right:Nn \g__chemformula_output_tl { \\ }
- \chemformula_ch_aux_i:w #2 \q_stop
+ \__chemformula_ch_aux_i:w #2 \q_stop
}
}
% bypass &:
-\cs_new_protected:Npn \chemformula_ch_aux_ii:w #1 & #2 \q_stop
+\cs_new_protected:Npn \__chemformula_ch_aux_ii:w #1 & #2 \q_stop
{
- \chemformula_ch_aux_iii:w #1 \label{} \q_no_value \q_stop
+ \__chemformula_ch_aux_iii:w #1 \label{} \q_no_value \q_stop
\quark_if_no_value:nF { #2 }
{
\tl_gput_right:Nn \g__chemformula_output_tl { & }
- \chemformula_ch_aux_ii:w #2 \q_stop
+ \__chemformula_ch_aux_ii:w #2 \q_stop
}
}
% bypass \label:
-\cs_new_protected:Npn \chemformula_ch_aux_iii:w #1 \label#2 #3 \q_stop
+\cs_new_protected:Npn \__chemformula_ch_aux_iii:w #1 \label#2 #3 \q_stop
{
- \chemformula_ch_aux_iv:w #1 \tag{} \q_no_value \q_stop
+ \__chemformula_ch_aux_iv:w #1 \tag{} \q_no_value \q_stop
\quark_if_no_value:nF { #3 }
{
\tl_gput_right:Nn \g__chemformula_output_tl { \label{#2} }
- \chemformula_ch_aux_iii:w #3 \q_stop
+ \__chemformula_ch_aux_iii:w #3 \q_stop
}
}
% bypass \tag:
-\cs_new_protected:Npn \chemformula_ch_aux_iv:w #1 \tag#2 #3 \q_stop
+\cs_new_protected:Npn \__chemformula_ch_aux_iv:w #1 \tag#2 #3 \q_stop
{
- \chemformula_ch_aux_v:w #1 \intertext{} \q_no_value \q_stop
+ \__chemformula_ch_aux_v:w #1 \intertext{} \q_no_value \q_stop
\quark_if_no_value:nF { #3 }
{
\tl_gput_right:Nn \g__chemformula_output_tl { \tag{#2} }
- \chemformula_ch_aux_iv:w #3 \q_stop
+ \__chemformula_ch_aux_iv:w #3 \q_stop
}
}
% bypass \intertext:
-\cs_new_protected:Npn \chemformula_ch_aux_v:w #1 \intertext#2 #3 \q_stop
+\cs_new_protected:Npn \__chemformula_ch_aux_v:w #1 \intertext#2 #3 \q_stop
{
\tl_gput_right:Nn \g__chemformula_output_tl
- { \chemformula_ch_main:n { #1 } }
+ { \__chemformula_ch_main:n { #1 } }
\quark_if_no_value:nF { #3 }
{
\tl_gput_right:Nn \g__chemformula_output_tl { \intertext{#2} }
- \chemformula_ch_aux_v:w #3 \q_stop
+ \__chemformula_ch_aux_v:w #3 \q_stop
}
}
@@ -663,19 +664,19 @@
%-----------------------------------------------------------------------------%
% arrow generation & detection
-\cs_new:Npn \chemformula_generate_arrows:n #1
+\cs_new:Npn \__chemformula_generate_arrows:n #1
{
\tl_set:Nn \l__chemformula_tmpa_tl { #1 }
\seq_map_inline:Nn \l__chemformula_arrows_type_seq
{
\tl_replace_all:Nnn \l__chemformula_tmpa_tl
- { ##1 } { \chemformula_arrows_get:n { ##1 } }
+ { ##1 } { \__chemformula_arrows_get:n { ##1 } }
}
\tl_set_eq:NN \l__chemformula_output_tl \l__chemformula_tmpa_tl
}
-\cs_generate_variant:Nn \chemformula_generate_arrows:n { V }
+\cs_generate_variant:Nn \__chemformula_generate_arrows:n { V }
-\cs_new_protected:Npn \chemformula_detect_arrows:n #1
+\cs_new_protected:Npn \__chemformula_detect_arrows:n #1
{
\bool_set_false:N \l__chemformula_is_arrow_bool
\prop_map_inline:Nn \l__chemformula_arrows_code_prop
@@ -690,12 +691,12 @@
% compound names
\dim_new:N \l__chemformula_name_dim
-\cs_new:Npn \chemformula_name_cmpd:w
- { \peek_meaning:NTF ( { \chemformula_name_cmpd_aux:w } { ! } }
+\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()}
+\NewDocumentCommand \__chemformula_name_cmpd_aux:w {r()r()}
{
\(
\underset
@@ -713,16 +714,16 @@
\)
}
-\cs_new_protected:Npn \chemformula_generate_name:n #1
+\cs_new_protected:Npn \__chemformula_generate_name:n #1
{
\tl_set:Nn \l__chemformula_tmpa_tl { #1 }
\tl_if_in:VnT \l__chemformula_tmpa_tl { ! }
- { \tl_replace_all:Nnn \l__chemformula_tmpa_tl { ! } { \chemformula_name_cmpd:w } }
+ { \tl_replace_all:Nnn \l__chemformula_tmpa_tl { ! } { \__chemformula_name_cmpd:w } }
\tl_set_eq:NN \l__chemformula_output_tl \l__chemformula_tmpa_tl
}
-\cs_generate_variant:Nn \chemformula_generate_name:n { V }
+\cs_generate_variant:Nn \__chemformula_generate_name:n { V }
-\cs_new_protected:Npn \chemformula_detect_name:n #1
+\cs_new_protected:Npn \__chemformula_detect_name:n #1
{
\bool_set_false:N \l__chemformula_is_name_bool
\tl_set:Nn \l__chemformula_tmpa_tl { #1 }
@@ -737,11 +738,13 @@
\bool_new:N \l__chemformula_options_bool
\bool_new:N \l__chemformula_is_option_bool
\bool_new:N \l__chemformula_stoich_bool
+\bool_new:N \l__chemformula_no_stoich_bool
\bool_new:N \l__chemformula_is_plus_bool
\bool_new:N \l__chemformula_is_up_bool
\bool_new:N \l__chemformula_is_down_bool
\bool_new:N \l__chemformula_is_arrow_bool
\bool_new:N \l__chemformula_is_name_bool
+\bool_new:N \l__chemformula_stoich_is_iupac_bool
\bool_new:N \l__chemformula_stoich_parse_iupac_bool
\bool_new:N \l__chemformula_first_last_text_bool
\bool_new:N \l__chemformula_first_last_double_bool
@@ -850,16 +853,16 @@
% 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_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: }
@@ -883,6 +886,14 @@
\prop_put:Nnn \l__chemformula_stoich_prop { ( } { ( }
\prop_put:Nnn \l__chemformula_stoich_prop { ) } { ) }
+\prop_new:N \l__chemformula_no_stoich_prop
+\prop_put:Nnn \l__chemformula_no_stoich_prop { . } { }
+\prop_put:Nnn \l__chemformula_no_stoich_prop { , } { }
+\prop_put:Nnn \l__chemformula_no_stoich_prop { / } { }
+\prop_put:Nnn \l__chemformula_no_stoich_prop { _ } { }
+\prop_put:Nnn \l__chemformula_no_stoich_prop { ( } { }
+\prop_put:Nnn \l__chemformula_no_stoich_prop { ) } { }
+
%-----------------------------------------------------------------------------%
% bonds:
\dim_new:N \l__chemformula_bond_space_dim
@@ -923,13 +934,13 @@
\draw (chemformula-bond-start) ++(\l__chemformula_bond_dim ,0)
coordinate (chemformula-bond-end) ;
\tl_if_blank:nTF { #1 }
- { \chemformula_bond_draw:n { single } }
- { \chemformula_bond_draw:n { #1 } }
+ { \__chemformula_bond_draw:n { single } }
+ { \__chemformula_bond_draw:n { #1 } }
}
\chemmacros_skip_nobreak:N \l__chemformula_bond_space_dim
}
-\cs_new_protected:Npn \chemformula_bond_draw:n #1
+\cs_new_protected:Npn \__chemformula_bond_draw:n #1
{
\tl_set_rescan:Nnn \l__chemformula_tmpa_tl {} { #1 }
\exp_args:NNo \prop_get:Nn \l__chemformula_bonds_prop
@@ -1046,20 +1057,20 @@
%-----------------------------------------------------------------------------%
% sub- and superscripts
-\cs_new:Npn \chemformula_number_style:n #1
+\cs_new:Npn \__chemformula_number_style:n #1
{
\bool_if:NTF \l__chemformula_number_style_math_bool
{ \ensuremath { #1 } }
{ \ensuremath { \text { #1 } } }
}
-\cs_new:Npn \chemformula_charge_style:n #1
+\cs_new:Npn \__chemformula_charge_style:n #1
{
\bool_if:NTF \l__chemformula_charge_style_math_bool
{ \ensuremath { #1 } }
{ \ensuremath { \text { #1 } } }
}
-\cs_generate_variant:Nn \chemformula_charge_style:n { V }
+\cs_generate_variant:Nn \__chemformula_charge_style:n { V }
% subscripts
\tl_new:N \l__chemformula_subscript_tl
@@ -1069,26 +1080,26 @@
\cs_new_protected:Npn \chemformula_subscript:n #1
{
\tl_if_eq:nnTF { #1 }{ \chemformula_superscript:n }
- { \chemformula_subscript_aux:n }
+ { \__chemformula_subscript:n }
{
\tl_if_eq:nnTF { #1 }{ \chemformula_subscript:n }
- { \chemformula_subscript_aux:n }
+ { \__chemformula_subscript:n }
{
\tl_set:Nn \l__chemformula_tmpc_tl { #1 }
\tl_if_in:nnT { #1 } { \chemformula_subscript:n }
{ \tl_remove_all:Nn \l__chemformula_tmpc_tl { \chemformula_subscript:n } }
\tl_if_in:nnT { #1 } { \chemformula_superscript:n }
{ \tl_remove_all:Nn \l__chemformula_tmpc_tl { \chemformula_superscript:n } }
- \chemformula_subscript_aux:V \l__chemformula_tmpc_tl
+ \__chemformula_subscript:V \l__chemformula_tmpc_tl
}
}
}
% handle subscripts
-\cs_new_protected:Npn \chemformula_subscript_aux:n #1
+\cs_new_protected:Npn \__chemformula_subscript:n #1
{
\tl_put_right:Nn \l__chemformula_subscript_tl { #1 }
- \chemformula_clean_subscript:
+ \__chemformula_clean_subscript:
% if a subscript follows just store and do nothing else
\peek_meaning:NF \chemformula_subscript:n
{
@@ -1096,15 +1107,15 @@
% if something else follows both sub- and superscript
\peek_meaning:NF \chemformula_superscript:n
{
- \chemformula_measure_subscript:V \l__chemformula_subscript_tl
- \chemformula_measure_superscript:V \l__chemformula_superscript_tl
- \chemformula_use_sub_and_superscript:
+ \__chemformula_measure_subscript:V \l__chemformula_subscript_tl
+ \__chemformula_measure_superscript:V \l__chemformula_superscript_tl
+ \__chemformula_use_sub_and_superscript:
}
}
}
-\cs_generate_variant:Nn \chemformula_subscript_aux:n { o,V }
+\cs_generate_variant:Nn \__chemformula_subscript:n { o,V }
-\cs_new_protected:Npn \chemformula_clean_subscript:
+\cs_new_protected:Npn \__chemformula_clean_subscript:
{
\tl_replace_all:Nnn \l__chemformula_subscript_tl
{ \chemformula_single_bond: } { \chemformula_minus: }
@@ -1116,7 +1127,7 @@
{ \chemformula_star_adduct: } { * }
}
-\cs_new_protected:Npn \chemformula_subscript_raise:N #1
+\cs_new_protected:Npn \__chemformula_subscript_raise:N #1
{
\hbox_set:Nn \l__chemformula_tmpa_box
{ $\scriptstyle Hg$ }
@@ -1130,29 +1141,29 @@
\tex_raise:D #1
}
-\cs_new:Npn \chemformula_subscript_write:n #1
+\cs_new:Npn \__chemformula_subscript_write:n #1
{
- \chemformula_subscript_raise:N \l__chemformula_subscript_shift_dim
+ \__chemformula_subscript_raise:N \l__chemformula_subscript_shift_dim
\hbox:n
{
$\scriptstyle
\prop_get:NoNTF \l__chemformula_numbers_prop
{ #1 } \l__chemformula_tmpa_tl
- { \chemformula_number_style:n { \l__chemformula_tmpa_tl } }
- { \chemformula_number_style:n { #1 } }$
+ { \__chemformula_number_style:n { \l__chemformula_tmpa_tl } }
+ { \__chemformula_number_style:n { #1 } }$
}
}
-\cs_generate_variant:Nn \chemformula_subscript_write:n { V }
+\cs_generate_variant:Nn \__chemformula_subscript_write:n { V }
-\cs_new_protected:Npn \chemformula_measure_subscript:n #1
+\cs_new_protected:Npn \__chemformula_measure_subscript:n #1
{
\hbox_set:Nn \l__chemformula_tmpa_box
- { \chemformula_subscript_write:n { #1 } }
+ { \__chemformula_subscript_write:n { #1 } }
\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 }
+\cs_generate_variant:Nn \__chemformula_measure_subscript:n { V }
% superscripts
\tl_new:N \l__chemformula_superscript_tl
@@ -1162,39 +1173,39 @@
\cs_new_protected:Npn \chemformula_superscript:n #1
{
\tl_if_eq:nnTF { #1 } { \chemformula_superscript:n }
- { \chemformula_superscript_aux:n }
+ { \__chemformula_superscript:n }
{
\tl_if_eq:nnTF { #1 } { \chemformula_subscript:n }
- { \chemformula_superscript_aux:n }
+ { \__chemformula_superscript:n }
{
\tl_set:Nn \l__chemformula_tmpc_tl { #1 }
\tl_if_in:nnT { #1 } { \chemformula_subscript:n }
{ \tl_remove_all:Nn \l__chemformula_tmpc_tl { \chemformula_subscript:n } }
\tl_if_in:nnT { #1 } { \chemformula_superscript:n }
{ \tl_remove_all:Nn \l__chemformula_tmpc_tl { \chemformula_superscript:n } }
- \chemformula_superscript_aux:V \l__chemformula_tmpc_tl
+ \__chemformula_superscript:V \l__chemformula_tmpc_tl
}
}
}
% handle superscripts
-\cs_new_protected:Npn \chemformula_superscript_aux:n #1
+\cs_new_protected:Npn \__chemformula_superscript:n #1
{
\tl_put_right:Nn \l__chemformula_superscript_tl { #1 }
- \chemformula_clean_superscript:
+ \__chemformula_clean_superscript:
\peek_meaning:NF \chemformula_superscript:n
{
\peek_meaning:NF \chemformula_subscript:n
{
- \chemformula_measure_subscript:V \l__chemformula_subscript_tl
- \chemformula_measure_superscript:V \l__chemformula_superscript_tl
- \chemformula_use_sub_and_superscript:
+ \__chemformula_measure_subscript:V \l__chemformula_subscript_tl
+ \__chemformula_measure_superscript:V \l__chemformula_superscript_tl
+ \__chemformula_use_sub_and_superscript:
}
}
}
-\cs_generate_variant:Nn \chemformula_superscript_aux:n { o,V }
+\cs_generate_variant:Nn \__chemformula_superscript:n { o,V }
-\cs_new_protected:Npn \chemformula_clean_superscript:
+\cs_new_protected:Npn \__chemformula_clean_superscript:
{
\tl_replace_all:Nnn \l__chemformula_superscript_tl
{ \chemformula_single_bond: } { \chemformula_minus: }
@@ -1212,7 +1223,7 @@
{ . } { \chemformula_radical: }
}
-\cs_new_protected:Npn \chemformula_superscript_raise:N #1
+\cs_new_protected:Npn \__chemformula_superscript_raise:N #1
{
\hbox_set:Nn \l__chemformula_tmpa_box
{ $\scriptstyle Hg$ }
@@ -1226,32 +1237,32 @@
\tex_raise:D #1
}
-\cs_new:Npn \chemformula_superscript_write:n #1
+\cs_new:Npn \__chemformula_superscript_write:n #1
{
- \chemformula_superscript_raise:N \l__chemformula_superscript_shift_dim
+ \__chemformula_superscript_raise:N \l__chemformula_superscript_shift_dim
\hbox:n
{
$\scriptstyle
\prop_get:NoNTF \l__chemformula_charge_prop
{ #1 } \l__chemformula_tmpa_tl
- { \chemformula_charge_style:V \l__chemformula_tmpa_tl }
- { \chemformula_charge_style:n { #1 } }$
+ { \__chemformula_charge_style:V \l__chemformula_tmpa_tl }
+ { \__chemformula_charge_style:n { #1 } }$
}
}
-\cs_generate_variant:Nn \chemformula_superscript_write:n { V }
+\cs_generate_variant:Nn \__chemformula_superscript_write:n { V }
-\cs_new_protected:Npn \chemformula_measure_superscript:n #1
+\cs_new_protected:Npn \__chemformula_measure_superscript:n #1
{
\hbox_set:Nn \l__chemformula_tmpa_box
- { \chemformula_superscript_write:n { #1 } }
+ { \__chemformula_superscript_write:n { #1 } }
\dim_set:Nn \l__chemformula_superscript_dim
{ -\box_wd:N \l__chemformula_tmpa_box }
\box_clear:N \l__chemformula_tmpa_box
}
-\cs_generate_variant:Nn \chemformula_measure_superscript:n { V }
+\cs_generate_variant:Nn \__chemformula_measure_superscript:n { V }
% typeset both sub- and superscripts
-\cs_new_protected:Npn \chemformula_use_sub_and_superscript:
+\cs_new_protected:Npn \__chemformula_use_sub_and_superscript:
{
\group_begin:
% No shift for excited state
@@ -1288,7 +1299,7 @@
% typeset superscript
\tl_if_blank:VF \l__chemformula_superscript_tl
{
- \chemformula_superscript_write:V \l__chemformula_superscript_tl
+ \__chemformula_superscript_write:V \l__chemformula_superscript_tl
% skip back for the subscript
\tl_if_blank:VF \l__chemformula_subscript_tl
{
@@ -1307,7 +1318,7 @@
}
% typeset subscript
\tl_if_blank:VF \l__chemformula_subscript_tl
- { \chemformula_subscript_write:V \l__chemformula_subscript_tl }
+ { \__chemformula_subscript_write:V \l__chemformula_subscript_tl }
\bool_if:NF \l__chemformula_is_isotope_bool
{
\dim_zero:N \l__chemformula_tmpa_dim
@@ -1356,7 +1367,7 @@
\chemformula_input_escape_text:V \l__chemformula_chemformula_tmpa_tl
\chemformula_input_escape_math:n { #1 }
\chemformula_input_stoich:n { #1 }
- \chemformula_clean_chem_macros:V \l__chemformula_chemformula_tmpa_tl
+ \__chemformula_clean_chem_macros:V \l__chemformula_chemformula_tmpa_tl
\chemformula_input_cmpd:VN
\l__chemformula_chemformula_tmpa_tl \l__chemformula_input_tl
\chemformula_input_arrow:n { #1 }
@@ -1390,24 +1401,34 @@
\cs_new_protected:Npn \chemformula_input_stoich:n #1
{
\bool_set_true:N \l__chemformula_stoich_bool
- \tl_put_right:Nn \l__chemformula_stoich_tl { \chemformula_font_inner: }
+ % the factor consists only of a parenthesis or a decimal marcer:
+ \bool_set_true:N \l__chemformula_no_stoich_bool
\tl_map_inline:nn { #1 }
{
- \prop_get:NnNTF \l__chemformula_stoich_prop { ##1 } \l__chemformula_tmpa_tl
+ \prop_get:NnNF \l__chemformula_no_stoich_prop { ##1 } \l__chemformula_tmpa_tl
+ { \bool_set_false:N \l__chemformula_no_stoich_bool }
+ }
+ \bool_if:NF \l__chemformula_no_stoich_bool
+ {
+ \tl_map_inline:nn { #1 }
{
- \bool_if:NT \l__chemformula_stoich_bool
- { \tl_put_right:Nx \l__chemformula_stoich_tl { \l__chemformula_tmpa_tl } }
+ \prop_get:NnNTF \l__chemformula_stoich_prop { ##1 } \l__chemformula_tmpa_tl
+ {
+ \bool_if:NT \l__chemformula_stoich_bool
+ { \tl_put_right:NV \l__chemformula_stoich_tl \l__chemformula_tmpa_tl }
+ }
+ { \bool_set_false:N \l__chemformula_stoich_bool }
}
- { \bool_set_false:N \l__chemformula_stoich_bool }
}
\bool_if:NTF \l__chemformula_stoich_bool
{
\tl_if_blank:VF \l__chemformula_stoich_tl
{
+ \tl_put_left:Nn \l__chemformula_stoich_tl { \chemformula_font_inner: }
\tl_set_rescan:Nno \l__chemformula_stoich_tl
{ \ExplSyntaxOn }
{ \l__chemformula_stoich_tl }
- \chemformula_parse_stoich:V
+ \__chemformula_parse_stoich:V
\l__chemformula_stoich_tl
}
}
@@ -1416,14 +1437,16 @@
\cs_new:Npn \chemformula_bm:n #1 { #1 }
-\cs_new_protected:Npn \chemformula_parse_stoich:n #1
+\cs_new_protected:Npn \__chemformula_parse_stoich:n #1
{ \__chemformula_parse_stoich:w #1 \q_nil }
-\cs_generate_variant:Nn \chemformula_parse_stoich:n { V }
+\cs_generate_variant:Nn \__chemformula_parse_stoich:n { V }
\cs_new:Npn \__chemformula_parse_stoich:w \chemformula_font_inner: #1 \q_nil
{
\tl_put_right:Nn \l__chemformula_input_tl { \chemformula_font_inner: }
- \tl_if_in:nnTF { #1 } { ( }
+ \__chemformula_bool_set_if_first_last:Nnnn
+ \l__chemformula_stoich_is_iupac_bool { #1 } { ( } { ) }
+ \bool_if:NTF \l__chemformula_stoich_is_iupac_bool
{ \__chemformula_parse_stoich_iupac:n { #1 } }
{ \__chemformula_parse_stoich_regular:n { #1 } }
}
@@ -1445,7 +1468,7 @@
{
% get head:
\tl_set:Nx \l__chemformula_tmpa_tl { \tl_head:n { #1 } }
- \tl_set:Nx \l__chemformula_tmpb_tl { \l__chemformula_decimal_output_tl }
+ \tl_set:Nn \l__chemformula_tmpb_tl { \l__chemformula_decimal_output_tl }
% check if stoich starts with decimal-marker and add leading 0 if so:
\tl_if_eq:NNTF \l__chemformula_tmpa_tl \l__chemformula_tmpb_tl
{ \tl_put_right:Nn \l__chemformula_input_tl { 0#1 } }
@@ -1462,13 +1485,13 @@
\cs_new_protected:Npn \__chemformula_parse_stoich_frac:w #1/#2 \q_nil
{
\tl_put_right:Nn \l__chemformula_input_tl
- { \chemformula_frac:nn { #1 } { #2 } }
+ { \__chemformula_frac:nn { #1 } { #2 } }
}
\cs_new_protected:Npn \__chemformula_parse_stoich_misc_frac:w #1_#2/#3 \q_nil
{
\tl_put_right:Nn \l__chemformula_input_tl
- { \chemformula_misc_frac:nnn { #1 } { #2 } { #3 } }
+ { \__chemformula_misc_frac:nnn { #1 } { #2 } { #3 } }
}
\cs_new_protected:Npn \__chemformula_parse_stoich_iupac:n #1
@@ -1485,7 +1508,7 @@
\tl_put_right:Nn \l__chemformula_input_tl { ) }
}
-\cs_new:Npn \chemformula_frac:nn #1#2
+\cs_new:Npn \__chemformula_frac:nn #1#2
{
\bool_if:NT \l__chemformula_xfrac_bool
{ \sfrac[chemformula-text-frac]{#1}{#2} }
@@ -1495,7 +1518,7 @@
{ $ \frac{ \text { #1 } } { \text { #2 } } $ }
}
-\cs_new:Npn \chemformula_misc_frac:nnn #1#2#3
+\cs_new:Npn \__chemformula_misc_frac:nnn #1#2#3
{
\bool_if:NT \l__chemformula_xfrac_bool
{ #1\sfrac[chemformula-text-frac]{#2}{#3} }
@@ -1517,8 +1540,8 @@
{ \bool_set_true:N \l__chemformula_is_down_bool }
\tl_if_eq:nnT { #1 } { ^ }
{ \bool_set_true:N \l__chemformula_is_up_bool }
- \chemformula_detect_arrows:n { #1 }
- \chemformula_detect_name:n { #1 }
+ \__chemformula_detect_arrows:n { #1 }
+ \__chemformula_detect_name:n { #1 }
\chemformula_input_options:n { #1 }
\bool_if:NT \l__chemformula_is_option_bool
{
@@ -1543,7 +1566,7 @@
{
\tl_put_right:Nn #2
{ \chemformula_font_inner: }
- \chemformula_handle_sub_and_superscripts:nN { #1 } #2
+ \__chemformula_handle_sub_and_superscripts:nN { #1 } #2
\bool_if:NT \l__chemformula_options_bool
{
\tl_put_right:Nn #2
@@ -1584,34 +1607,39 @@
}
\cs_new:Npn \chemformula_font: {}
-\cs_new:Npn \chemformula_fontspec:n #1
+\cs_new:Npn \__chemformula_fontspec:n #1
{
\tl_if_in:nnTF { #1 } { [ }
- { \chemformula_fontspec_aux:w #1 \q_stop }
- { \chemformula_fontspec_aux:w [] #1 \q_stop }
+ { \__chemformula_fontspec_aux:w #1 \q_stop }
+ { \__chemformula_fontspec_aux:w [] #1 \q_stop }
}
-\cs_new:Npn \chemformula_fontspec_aux:w [#1]#2 \q_stop
+\cs_new:Npn \__chemformula_fontspec_aux:w [#1]#2 \q_stop
{ \newfontfamily \chemformula_font: [ #1 ] { #2 } }
-\cs_new_protected:Npn \chemformula_sanitize:Nn #1#2
+\cs_new_protected:Npn \__chemformula_sanitize:Nn #1#2
{
\tl_set_rescan:Nnn #1
{
+ % expl3 catcodes:
\char_set_catcode_letter:N \_
\char_set_catcode_math_superscript:N \^
+ % disable some of the specials:
\char_set_catcode_letter:N \{
\char_set_catcode_letter:N \}
\char_set_catcode_letter:N \\
\char_set_catcode_letter:N \#
+ % make the naming work with babel languages like French that make
+ % ! active:
+ \char_set_catcode_other:N \!
}
{ #2 }
}
\cs_generate_variant:Nn \tl_if_in:nnT { x }
-\cs_new_protected:Npn \chemformula_handle_sub_and_superscripts:nN #1#2
+\cs_new_protected:Npn \__chemformula_handle_sub_and_superscripts:nN #1#2
{
- \chemformula_sanitize:Nn \l__chemformula_tmpa_tl { #1 }
+ \__chemformula_sanitize:Nn \l__chemformula_tmpa_tl { #1 }
% let's see if the compound starts with a sub- or superscript:
\tl_if_in:xnT { \tl_head:V \l__chemformula_tmpa_tl } { ^ }
{
@@ -1674,7 +1702,7 @@
%-----------------------------------------------------------------------------%
% clean up chemmacros commands:
-\cs_new_protected:Npn \chemformula_clean_chem_macros:n #1
+\cs_new_protected:Npn \__chemformula_clean_chem_macros:n #1
{
\cs_set:Nn \chemmacros_text:n
{
@@ -1684,7 +1712,7 @@
}
\cs_set:Npn \chemmacros_xspace: {}
}
-\cs_generate_variant:Nn \chemformula_clean_chem_macros:n { V }
+\cs_generate_variant:Nn \__chemformula_clean_chem_macros:n { V }
%-----------------------------------------------------------------------------%
% input "and" sign
@@ -1710,7 +1738,7 @@
\group_begin:
% ensure ^ has catcode 7
% (else chemmacros wouldn't work with e.g. `breqn')
- \chemformula_sanitize:Nn \g__chemformula_input_up_tl { #1 }
+ \__chemformula_sanitize:Nn \g__chemformula_input_up_tl { #1 }
\char_set_catcode_math_superscript:N \^
\__chemformula_input_up:V \g__chemformula_input_up_tl
}
@@ -1790,16 +1818,16 @@
\cs_new_protected:Npn \chemformula_input_escape_text:n #1
{
- \chemformula_first_last_text:n { #1 }
+ \__chemformula_first_last_text:n { #1 }
\bool_if:NT \l__chemformula_first_last_double_bool
{
\bool_set_true:N \l__chemformula_first_last_text_bool
- \chemformula_read_escape_double:w #1 \q_nil
+ \__chemformula_read_escape_double:w #1 \q_nil
}
\bool_if:NT \l__chemformula_first_last_single_bool
{
\bool_set_true:N \l__chemformula_first_last_text_bool
- \chemformula_read_escape_single:w #1 \q_nil
+ \__chemformula_read_escape_single:w #1 \q_nil
}
}
\cs_generate_variant:Nn \chemformula_input_escape_text:n { V }
@@ -1824,13 +1852,13 @@
\tl_put_right:NV \l__chemformula_input_tl \l__chemformula_tmpa_tl
}
-\cs_new:Npn \chemformula_read_escape_double:w "#1" \q_nil
+\cs_new:Npn \__chemformula_read_escape_double:w "#1" \q_nil
{ \__chemformula_read_escape_text:n { #1 } }
-\cs_new:Npn \chemformula_read_escape_single:w '#1' \q_nil
+\cs_new:Npn \__chemformula_read_escape_single:w '#1' \q_nil
{ \__chemformula_read_escape_text:n { #1 } }
-\cs_new_protected:Npn \chemformula_first_last_text:n #1
+\cs_new_protected:Npn \__chemformula_first_last_text:n #1
{
\bool_set_false:N \l__chemformula_first_last_double_bool
\bool_set_false:N \l__chemformula_first_last_single_bool
@@ -1852,16 +1880,16 @@
% input escaped math
\cs_new_protected:Npn \chemformula_input_escape_math:n #1
{
- \chemformula_first_last_math:n { #1 }
+ \__chemformula_first_last_math:n { #1 }
\bool_if:NT \l__chemformula_first_last_dollar_bool
{
\bool_set_true:N \l__chemformula_first_last_math_bool
- \chemformula_read_escape_dollar:w #1 \q_nil
+ \__chemformula_read_escape_dollar:w #1 \q_nil
}
\bool_if:NT \l__chemformula_first_last_mathbraces_bool
{
\bool_set_true:N \l__chemformula_first_last_math_bool
- \chemformula_read_escape_mathbraces:w #1 \q_nil
+ \__chemformula_read_escape_mathbraces:w #1 \q_nil
}
}
@@ -1887,13 +1915,13 @@
{ \skip_horizontal:N \l__chemformula_math_space_skip }
}
-\cs_new:Npn \chemformula_read_escape_dollar:w $#1$ \q_nil
+\cs_new:Npn \__chemformula_read_escape_dollar:w $#1$ \q_nil
{ \__chemformula_read_escape_math:n { #1 } }
-\cs_new:Npn \chemformula_read_escape_mathbraces:w \(#1\) \q_nil
+\cs_new:Npn \__chemformula_read_escape_mathbraces:w \(#1\) \q_nil
{ \__chemformula_read_escape_math:n { #1 } }
-\cs_new_protected:Npn \chemformula_first_last_math:n #1
+\cs_new_protected:Npn \__chemformula_first_last_math:n #1
{
\bool_set_false:N \l__chemformula_first_last_math_bool
\bool_set_false:N \l__chemformula_first_last_dollar_bool
@@ -1952,7 +1980,7 @@
\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-iupac-parse .bool_set:N = \l__chemformula_stoich_parse_iupac_bool ,
+ stoich-paren-parse .bool_set:N = \l__chemformula_stoich_parse_iupac_bool ,
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 ,
@@ -1988,7 +2016,7 @@
font-spec .code:n =
\bool_set_false:N \l__chemformula_fss_bool
\bool_set_true:N \l__chemformula_fontspec_bool
- \chemformula_fontspec:n { #1 } ,
+ \__chemformula_fontspec:n { #1 } ,
format .code:n =
\bool_set_false:N \l__chemformula_fss_bool
\bool_set_false:N \l__chemformula_fontspec_bool
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty
index e8212bf0bff..38b5e573c43 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.5a}
-\def\chemmacros@date{2013/02/19}
+\def\chemmacros@version{3.6}
+\def\chemmacros@date{2013/02/26}
\ProvidesExplPackage
{chemmacros}
@@ -302,7 +302,6 @@
\bool_new:N \l__chemmacros_strict_bool
\bool_new:N \l__chemmacros_detect_bold_bool
\bool_set_true:N \l__chemmacros_detect_bold_bool
-
\bool_new:N \l__chemmacros_use_upgreek_bool
\bool_new:N \l__chemmacros_use_textgreek_bool
\bool_new:N \l__chemmacros_option_greek_set_bool
@@ -578,13 +577,13 @@
% --------------------------------------------------------------------------- %
% circled charge signs
\cs_new_protected:Npn \chemmacros_fplus:
- { \ensuremath { \chemmacros_fplus_aux_i: } }
+ { \ensuremath { \__chemmacros_fplus: } }
-\cs_new:Npn \chemmacros_fplus_aux_i:
- { \mathpalette \chemmacros_fplus_aux_ii: \bigcirc }
+\cs_new:Npn \__chemmacros_fplus:
+ { \mathpalette \__chemmacros_fplus_aux: \bigcirc }
% TODO: can I rewrite this in a more "expl3-way"?
-\cs_new:Npn \chemmacros_fplus_aux_ii: #1#2
+\cs_new:Npn \__chemmacros_fplus_aux: #1#2
{
\ooalign
{
@@ -600,12 +599,12 @@
}
\cs_new_protected:Npn \chemmacros_fminus:
- { \ensuremath { \chemmacros_fminus_aux_i: } }
+ { \ensuremath { \__chemmacros_fminus: } }
-\cs_new:Npn \chemmacros_fminus_aux_i:
- { \mathpalette \chemmacros_fminus_aux_aux_ii: \bigcirc }
+\cs_new:Npn \__chemmacros_fminus:
+ { \mathpalette \__chemmacros_fminus_aux_aux: \bigcirc }
-\cs_new:Npn \chemmacros_fminus_aux_aux_ii: #1#2
+\cs_new:Npn \__chemmacros_fminus_aux_aux: #1#2
{
\ooalign
{
@@ -667,7 +666,7 @@
% --------------------------------------------------------------------------- %
% transition state symbol
-\cs_new:Npn \chemmacros_transition_state_aux:
+\cs_new:Npn \__chemmacros_transition_state:
{
\text
{
@@ -689,7 +688,7 @@
{ \textstyle }
{ \scriptstyle }
{ \scriptscriptstyle }
- \chemmacros_transition_state_aux:
+ \__chemmacros_transition_state:
}
}
@@ -941,9 +940,8 @@
{ \cs_set_eq:NN \Nu \chemmacros_Nu:w }
}
-\NewDocumentCommand \ba { o }
+\cs_new:Npn \chemmacros_ba:
{
- \IfNoValueF { #1 } { \keys_set:nn { chemmacros / particle } { #1 } }
\bool_if:NTF \l__chemmacros_particle_elpair_bool
{ \chemmacros_elpair:n { ba } \mch }
{
@@ -954,6 +952,14 @@
\chemmacros_xspace:
}
+\NewDocumentCommand \ba { o }
+ {
+ \group_begin:
+ \IfNoValueF { #1 } { \keys_set:nn { chemmacros / particle } { #1 } }
+ \chemmacros_ba:
+ \group_end:
+ }
+
\cs_new:Npn \chemmacros_elpair:n #1
{
\bool_if:NTF \l__chemmacros_chemfig_bool
@@ -1067,6 +1073,9 @@
{ cip-kern .dim_set:N = \l__chemmacros_cip_kern_dim }
\NewDocumentCommand \cip { m }
+ { \chemmacros_cip:n { #1 } }
+
+\cs_new:Npn \chemmacros_cip:n #1
{
\cs_if_exist:NTF \EmbracOff
{ \textit* { (#1) } }
@@ -1082,7 +1091,7 @@
% TikZ needs : to be other
\ExplSyntaxOff
-\NewDocumentCommand\Sconf{O{S}}
+\def\chemmacros@sconf#1%
{%
\tikz[baseline=(a.base),text height=1.5ex,text depth=.25ex]
{
@@ -1091,7 +1100,7 @@
}%
}
-\NewDocumentCommand\Rconf{O{R}}
+\def\chemmacros@rconf#1%
{%
\tikz[baseline=(a.base),text height=1.5ex,text depth=.25ex]
{
@@ -1101,6 +1110,9 @@
}
\ExplSyntaxOn
+\NewDocumentCommand \Sconf { O{S} } { \chemmacros@sconf { #1 } }
+\NewDocumentCommand \Rconf { O{R} } { \chemmacros@rconf { #1 } }
+
% E(ntgegen)/Z(usammen)
\DeclareChemIUPAC \E { \cip { E } }
\DeclareChemIUPAC \Z { \cip { Z } }
@@ -1375,7 +1387,7 @@
\chemmacros_xspace:
}
-\NewDocumentCommand \p { m }
+\cs_new:Npn \chemmacros_p:n #1
{
\group_begin:
\chemmacros_p_style:n { p }
@@ -1383,15 +1395,24 @@
\group_end:
}
+\NewDocumentCommand \p { m }
+ { \chemmacros_p:n { #1 } }
+
\cs_new_protected:Npn \pH
- { \p { \chemmacros_chemformula:n { H } } \chemmacros_xspace: }
+ {
+ \chemmacros_p:n { \chemmacros_chemformula:n { H } }
+ \chemmacros_xspace:
+ }
\cs_new_protected:Npn \pOH
- { \p { \chemmacros_chemformula:n { OH } } \chemmacros_xspace: }
+ {
+ \chemmacros_p:n { \chemmacros_chemformula:n { OH } }
+ \chemmacros_xspace:
+ }
\NewDocumentCommand \pKa { o }
{
- \p
+ \chemmacros_p:n
{
\Ka \IfNoValueF { #1 }
{ \c_math_subscript_token { \chemmacros_detect_bold:n { #1 } } }
@@ -1401,7 +1422,7 @@
\NewDocumentCommand \pKb { o }
{
- \p
+ \chemmacros_p:n
{
\Kb \IfNoValueF { #1 }
{ \c_math_subscript_token { \chemmacros_detect_bold:n { #1 } } }
@@ -1440,7 +1461,7 @@
\tl_new:N \l__chemmacros_mech_mol_tl
\tl_new:N \l__chemmacros_mech_ar_tl
-\cs_new_protected: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 }
@@ -1452,55 +1473,55 @@
type .choice: ,
type / .code:n =
{
- \chemmacros_set_mech:nnn { S }
+ \__chemmacros_set_mech:nnn { S }
{ \( \c_math_subscript_token { \text {N} } \) }
{ }
} ,
type / 1 .code:n =
{
- \chemmacros_set_mech:nnn { S }
+ \__chemmacros_set_mech:nnn { S }
{ \( \c_math_subscript_token { \text {N} } \) 1 }
{ }
} ,
type / 2 .code:n =
{
- \chemmacros_set_mech:nnn { S }
+ \__chemmacros_set_mech:nnn { S }
{ \( \c_math_subscript_token { \text {N} } \) 2 }
{ }
} ,
type / se .code:n =
{
- \chemmacros_set_mech:nnn { S }
+ \__chemmacros_set_mech:nnn { S }
{ \( \c_math_subscript_token { \text {E} } \) }
{ }
} ,
type / 1e .code:n =
{
- \chemmacros_set_mech:nnn { S }
+ \__chemmacros_set_mech:nnn { S }
{ \( \c_math_subscript_token { \text {E} } \) 1 }
{ }
} ,
type / 2e .code:n =
{
- \chemmacros_set_mech:nnn { S }
+ \__chemmacros_set_mech:nnn { S }
{ \( \c_math_subscript_token { \text {E} } \) 2 }
{ }
} ,
type / ar .code:n =
{
- \chemmacros_set_mech:nnn { S }
+ \__chemmacros_set_mech:nnn { S }
{ \( \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 }
+ \__chemmacros_set_mech:nnn { E }
{ 1 \( \c_math_subscript_token { \text {cb} } \) }
{ }
} ,
@@ -1550,15 +1571,15 @@
\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
+\cs_new_protected:Npn \__chemmacros_ox_process_number:n #1
{
\bool_if:NTF \l__chemmacros_ox_parse_bool
{
\tl_if_in:nnTF { #1 } { / }
- { \chemmacros_ox_fraction:n #1 }
+ { \__chemmacros_ox_fraction:n #1 }
{
- \chemmacros_ox_sign:n { #1 }
- \chemmacros_ox_value:n { #1 }
+ \__chemmacros_ox_sign:n { #1 }
+ \__chemmacros_ox_value:n { #1 }
}
}
{ #1 }
@@ -1574,16 +1595,16 @@
slash-symbol-font = lmr
}
-\cs_new: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 }
+ \__chemmacros_ox_sign:n { #1 }
\bool_if:NTF \l__chemmacros_ox_side_bool
- { \sfrac { \chemmacros_ox_value:n { #1 } } { #2 } }
- { \sfrac [ chemmacros-ox-frac ] { \chemmacros_ox_value:n { #1 } } { #2 } }
+ { \sfrac { \__chemmacros_ox_value:n { #1 } } { #2 } }
+ { \sfrac [ chemmacros-ox-frac ] { \__chemmacros_ox_value:n { #1 } } { #2 } }
}
-\cs_new: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 { $+$ } }
@@ -1593,23 +1614,23 @@
{ $-$ }
}
-\cs_new_protected: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:V \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:V \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:V \l__chemmacros_ox_number_fp }
- { \chemmacros_fp_show:V \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_protected: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 }
@@ -1622,9 +1643,9 @@
\bool_set_false:N \l__chemmacros_ox_format_roman_bool
}
}
-\cs_generate_variant:Nn \chemmacros_ox_is_integer:n { V }
+\cs_generate_variant:Nn \__chemmacros_ox_is_integer:n { V }
-\cs_new_protected: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 }
@@ -1635,18 +1656,18 @@
{ \int_to_Roman:n { \int_use:N \l__chemmacros_tmpa_int } }
\group_end:
}
-\cs_generate_variant:Nn \chemmacros_fp_to_Roman:n { V }
+\cs_generate_variant:Nn \__chemmacros_fp_to_Roman:n { V }
-\cs_new_protected: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 { V }
+\cs_generate_variant:Nn \__chemmacros_fp_to_arabic:n { V }
-\cs_new_protected: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 }
@@ -1659,9 +1680,9 @@
{ \fp_to_tl:N \l__chemmacros_tmpa_tl }
\group_end:
}
-\cs_generate_variant:Nn \chemmacros_fp_show:n { V }
+\cs_generate_variant:Nn \__chemmacros_fp_show:n { V }
-\cs_new_protected:Npn \chemmacros_ox_write: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 } }
@@ -1674,13 +1695,13 @@
\chemmacros_text:n
{
#2
- $ ^ { \text { \tiny \chemmacros_ox_process_number:n { #1 } } } $
+ $ ^ { \text { \tiny \__chemmacros_ox_process_number:n { #1 } } } $
}
}
\bool_if:NT \l__chemmacros_ox_side_bool
{
\chemmacros_text:n
- { #2 ( \text { \chemmacros_ox_process_number:n { #1 } } ) }
+ { #2 ( \text { \__chemmacros_ox_process_number:n { #1 } } ) }
}
\bool_if:NT \l__chemmacros_ox_top_bool
{
@@ -1690,7 +1711,7 @@
{ \clap } { \rlap }
{
\chemmacros_text:n
- { \tiny \chemmacros_ox_process_number:n { #1 } }
+ { \tiny \__chemmacros_ox_process_number:n { #1 } }
}
}
{ \chemmacros_text:n { #2 } }
@@ -1698,21 +1719,21 @@
}
}
-\cs_new_protected: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_protected: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_protected: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
@@ -1722,9 +1743,9 @@
\keys_define:nn { chemmacros / ox }
{
pos .choice: ,
- pos / top .code:n = \chemmacros_ox_pos_top: ,
- pos / super .code:n = \chemmacros_ox_pos_super: ,
- pos / side .code:n = \chemmacros_ox_pos_side: ,
+ pos / top .code:n = \__chemmacros_ox_pos_top: ,
+ pos / super .code:n = \__chemmacros_ox_pos_super: ,
+ pos / side .code:n = \__chemmacros_ox_pos_side: ,
roman .bool_set:N = \l__chemmacros_ox_format_roman_bool ,
roman .default:n = true ,
parse .bool_set:N = \l__chemmacros_ox_parse_bool ,
@@ -1746,11 +1767,11 @@
\cs_new_protected:Npn \chemmacros_ox:nnnn #1#2#3#4
{
\group_begin:
- \tl_if_blank:nF { #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 } }
{ \tl_if_blank:nF { #2 } { \keys_set:nn { chemmacros / ox } { #2 } } }
- \chemmacros_ox_write:nn { #3 } { #4 }
+ \__chemmacros_ox_write:nn { #3 } { #4 }
\group_end:
}
@@ -1801,7 +1822,7 @@
{ \node [inner~sep=0] (#1) { #2 } ; }
}
-\cs_new_protected: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 }
@@ -1812,8 +1833,9 @@
\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 } { #2 }
- \tl_if_empty:nF { #3 } { \tl_set:Nn \l__chemmacros_redox_tikz_tl { #3 } }
+ \__chemmacros_redox_coordinates:nn { #1 } { #2 }
+ \tl_if_blank: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 }
@@ -1870,8 +1892,8 @@
{ \chemmacros_redox:nnnnn #1 { } { } { #4 } }
{
\IfNoValueTF { #3 }
- { \chemmacros_redox:nnnnn #1 { } { } { #4 } }
- { \chemmacros_redox:nnnnn #1 { } { #3 } { #4 } }
+ { \chemmacros_redox:nnnnn #1 { #2 } { } { #4 } }
+ { \chemmacros_redox:nnnnn #1 { #2 } { #3 } { #4 } }
}
}
@@ -1934,30 +1956,30 @@
\bool_new:N \l__chemmacros_nmr_custom_command_active_bool
\bool_new:N \l__chemmacros_nmr_custom_command_used_bool
-\cs_new_protected:Npn \chemmacros_nmr_nucleus: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 } { [ }
- { \chemmacros_nmr_element:w #2 \q_stop }
+ { \__chemmacros_nmr_element:w #2 \q_stop }
{
\tl_gset:No \g__chemmacros_nmr_element_tl { #2 }
\tl_gclear:N \g__chemmacros_nmr_element_coupled_tl
}
}
-\cs_new_protected: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_protected: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_protected: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
{
@@ -1979,19 +2001,19 @@
- NMR
}
}
-\cs_generate_variant:Nn \chemmacros_nmr_base:nn { VV }
+\cs_generate_variant:Nn \__chemmacros_nmr_base:nn { VV }
-\cs_new: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 } }
+ { \__chemmacros_nmr_frequency_aux_i:w #1 \q_stop }
+ { \__chemmacros_nmr_frequency_aux_ii:n { #1 } }
}
-\cs_new: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: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 }
@@ -1999,7 +2021,7 @@
unit .tl_set:N = \l__chemmacros_nmr_unit_tl ,
unit .default:n = \mega\hertz ,
nucleus .code:n =
- { \chemmacros_nmr_default_nucleus:w #1 \q_stop } ,
+ { \__chemmacros_nmr_default_nucleus:w #1 \q_stop } ,
nucleus .default:n = { 1,H } ,
format .tl_set:N = \l__chemmacros_nmr_format_tl ,
pos-number .choice: ,
@@ -2048,6 +2070,7 @@
\NewDocumentCommand \RenewChemNMR { mm }
{ \chemmacros_renew_nmr:Nn #1 { #2 } }
+% TODO: separate document and module level
\AtBeginDocument
{
% \NMR{<num>,<elem>}(<num>,<unit>)[<solvent>] ALL arguments are optional
@@ -2079,24 +2102,24 @@
{ \bool_set_true:N \l__chemmacros_nmr_comma_bool }
\IfNoValueTF { #2 }
{
- \chemmacros_nmr_nucleus:w
+ \__chemmacros_nmr_nucleus:w
\l__chemmacros_nmr_isotope_default_tl ,
\l__chemmacros_nmr_element_default_tl \q_stop
}
- { \chemmacros_nmr_nucleus:w #2 \q_stop }
+ { \__chemmacros_nmr_nucleus:w #2 \q_stop }
\mode_if_math:TF
{
\text
{
\group_begin:
\tl_use:N \l__chemmacros_nmr_format_tl
- \chemmacros_nmr_base:VV
+ \__chemmacros_nmr_base:VV
\g__chemmacros_nmr_isotope_tl
\g__chemmacros_nmr_element_tl
\bool_if:NT \l__chemmacros_nmr_delimiters_bool
{ ~ ( }
\bool_if:NT \l__chemmacros_nmr_frequency_bool
- { \chemmacros_nmr_frequency:n { #3 } }
+ { \__chemmacros_nmr_frequency:n { #3 } }
\bool_if:NT \l__chemmacros_nmr_comma_bool
{ , ~ }
\bool_if:NT \l__chemmacros_nmr_solvent_bool
@@ -2116,13 +2139,13 @@
{
\group_begin:
\tl_use:N \l__chemmacros_nmr_format_tl
- \chemmacros_nmr_base:VV
+ \__chemmacros_nmr_base:VV
\g__chemmacros_nmr_isotope_tl
\g__chemmacros_nmr_element_tl
\bool_if:NT \l__chemmacros_nmr_delimiters_bool
{ ~ ( }
\bool_if:NT \l__chemmacros_nmr_frequency_bool
- { \chemmacros_nmr_frequency:n { #3 } }
+ { \__chemmacros_nmr_frequency:n { #3 } }
\bool_if:NT \l__chemmacros_nmr_comma_bool
{ , ~ }
\bool_if:NT \l__chemmacros_nmr_solvent_bool
@@ -2177,11 +2200,11 @@
\group_begin:
\IfNoValueF { #1 } { \keys_set:nn { chemmacros / nmr } { #1 } }
\bool_set_true:N \l__chemmacros_nmr_inner_bool
- \cs_set_eq:NN \# \chemmacros_nmr_number:n
- \cs_set_eq:NN \pos \chemmacros_nmr_position:n
- \cs_set_eq:NN \J \chemmacros_nmr_coupling:w
+ \cs_set_eq:NN \# \chemmacros_nmr_number:n
+ \cs_set_eq:NN \pos \chemmacros_nmr_position:n
+ \cs_set_eq:NN \J \chemmacros_nmr_coupling:w
\cs_set_eq:NN \data \chemmacros_data:w
- \cs_set_eq:NN \val \chemmacros_val:n
+ \cs_set_eq:NN \val \chemmacros_val:n
\bool_if:NT \l__chemmacros_nmr_list_bool
{ \list {} { \l__chemmacros_nmr_list_setup_tl } }
}
@@ -2223,27 +2246,27 @@
\tl_clear:N \l__chemmacros_nmr_coupling_nuclei_tl
\tl_clear:N \l__chemmacros_nmr_coupling_bonds_tl
\peek_meaning:NTF (
- { \chemmacros_nmr_coupling_auxi:w }
- { \chemmacros_nmr_coupling_auxii:w }
+ { \__chemmacros_nmr_coupling:w }
+ { \__chemmacros_nmr_coupling_aux_i:w }
}
-\cs_new_protected:Npn \chemmacros_nmr_coupling_auxi:w (#1;#2)
+\cs_new_protected:Npn \__chemmacros_nmr_coupling:w (#1;#2)
{
\tl_set:Nn \l__chemmacros_nmr_coupling_bonds_tl { #1 }
\tl_set:Nn \l__chemmacros_nmr_coupling_nuclei_tl { #2 }
\tl_put_right:Nn \l__chemmacros_nmr_coupling_nuclei_tl { ) }
\tl_put_left:Nn \l__chemmacros_nmr_coupling_nuclei_tl { ( }
- \chemmacros_nmr_coupling_auxii:w
+ \__chemmacros_nmr_coupling_aux_i:w
}
-\cs_new:Npn \chemmacros_nmr_coupling_auxii:w
+\cs_new:Npn \__chemmacros_nmr_coupling_aux_i:w
{
\peek_meaning:NTF [
- { \chemmacros_nmr_coupling_auxiii:w }
- { \chemmacros_nmr_coupling_auxiv:n }
+ { \__chemmacros_nmr_coupling_aux_ii:w }
+ { \__chemmacros_nmr_coupling_aux_iii:n }
}
-\cs_new:Npn \chemmacros_nmr_coupling_auxiii:w [#1]#2
+\cs_new:Npn \__chemmacros_nmr_coupling_aux_ii:w [#1]#2
{
\group_begin:
\sisetup
@@ -2259,7 +2282,7 @@
\group_end:
}
-\cs_new:Npn \chemmacros_nmr_coupling_auxiv:n #1
+\cs_new:Npn \__chemmacros_nmr_coupling_aux_iii:n #1
{
\group_begin:
\sisetup
@@ -2409,15 +2432,15 @@
\bool_if:NTF \l__chemmacros_german_bool
{
\prop_map_function:NN \l__chemmacros_phases_german_prop
- \chemmacros_define_phases:nn
+ \__chemmacros_define_phases:nn
}
{
\prop_map_function:NN \l__chemmacros_phases_prop
- \chemmacros_define_phases:nn
+ \__chemmacros_define_phases:nn
}
}
-\cs_new_protected:Npn \chemmacros_define_phases:nn #1#2
+\cs_new_protected:Npn \__chemmacros_define_phases:nn #1#2
{
\cs_set:cpn { #1 }
{
@@ -2542,7 +2565,7 @@
\newcounter { reaction }
% switch to reaction tags
-\cs_new:Npn \chemmacros_begin_reaction:
+\cs_new:Npn \__chemmacros_begin_reaction:
{
% create individual names for `hyperref':
\bool_if:NT \l__chemmacros_hyperref_bool
@@ -2561,7 +2584,7 @@
}
% switch back to equation tags
-\cs_new:Npn \chemmacros_end_reaction:
+\cs_new:Npn \__chemmacros_end_reaction:
{
\setcounter { reaction } { \value { equation } }
\setcounter { equation } { \value { chemmacros_save_reaction } }
@@ -2601,19 +2624,19 @@
{
\NewEnviron { #2 } [ 2 ] []
{
- \chemmacros_begin_reaction:
+ \__chemmacros_begin_reaction:
\AddRxnDesc { ##1 }
\begin { #3 } { ##2 }
- \chemmacros_equation_chemformula:o { \BODY }
+ \chemmacros_equation_chemformula:V \BODY
\end{ #3 }
- \chemmacros_end_reaction:
+ \__chemmacros_end_reaction:
}
\bool_if:NT \l__chemmacros_reactions_star_bool
{
\NewEnviron { #2* } [ 1 ]
{
\begin { #3* } { ##1 }
- \chemmacros_equation_chemformula:o { \BODY }
+ \chemmacros_equation_chemformula:V \BODY
\end { #3* }
}
}
@@ -2621,19 +2644,19 @@
{
\NewEnviron { #2 } [ 1 ] []
{
- \chemmacros_begin_reaction:
+ \__chemmacros_begin_reaction:
\AddRxnDesc { ##1 }
\begin { #3 }
- \chemmacros_equation_chemformula:o { \BODY }
+ \chemmacros_equation_chemformula:V \BODY
\end { #3 }
- \chemmacros_end_reaction:
+ \__chemmacros_end_reaction:
}
\bool_if:NT \l__chemmacros_reactions_star_bool
{
\NewEnviron { #2* }
{
\begin { #3* }
- \chemmacros_equation_chemformula:o { \BODY }
+ \chemmacros_equation_chemformula:V \BODY
\end { #3* }
}
}
@@ -2655,7 +2678,7 @@
{ \cee { #1 } }
{ \ch { #1 } }
}
-\cs_generate_variant:Nn \chemmacros_equation_chemformula:n { o }
+\cs_generate_variant:Nn \chemmacros_equation_chemformula:n { V }
% predefined:
\bool_if:NF \l__chemmacros_version_one_bool
@@ -2807,26 +2830,25 @@
\l__chemmacros_thermod_delta_default_tl
}
-% TODO: separate document and module level
% \DeclareChemState[<keyval>]{<name>}{<symbol>}{<unit>}
\bool_if:NF \l__chemmacros_version_one_bool
{
\cs_new:Npn \DeclareChemState
{
\bool_set_false:N \l__chemmacros_renewstate_bool
- \chemmacros_setnewstate_reset:
+ \__chemmacros_setnewstate_reset:
\peek_meaning:NTF [
- { \setnewstate_aux_i:n }
- { \setnewstate_aux_ii:nnn }
+ { \__chemmacros_setnewstate:n }
+ { \__chemmacros_setnewstate_aux:nnn }
}
% \RenewChemState[<keyval>]{<name>}{<symbol>}{<unit>}
\cs_new:Npn \RenewChemState
{
\bool_set_true:N \l__chemmacros_renewstate_bool
- \chemmacros_setnewstate_reset:
+ \__chemmacros_setnewstate_reset:
\peek_meaning:NTF [
- { \setnewstate_aux_i:n }
- { \setnewstate_aux_ii:nnn }
+ { \__chemmacros_setnewstate:n }
+ { \__chemmacros_setnewstate_aux:nnn }
}
\cs_set:Npn \setnewstate
{
@@ -2842,21 +2864,21 @@
}
}
-\cs_new:Npn \chemmacros_setnewstate_reset:
+\cs_new:Npn \__chemmacros_setnewstate_reset:
{
- \tl_set:Nn \l__chemmacros_thermod_subscript_left_default_tl { true }
+ \tl_set:Nn \l__chemmacros_thermod_subscript_left_default_tl { true }
\tl_clear:N \l__chemmacros_thermod_subscript_default_tl
- \tl_set:Nn \l__chemmacros_thermod_exponent_default_tl { \standardstate }
- \tl_set:Nn \l__chemmacros_thermod_delta_default_tl { \Delta }
+ \tl_set:Nn \l__chemmacros_thermod_exponent_default_tl { \standardstate }
+ \tl_set:Nn \l__chemmacros_thermod_delta_default_tl { \Delta }
}
-\cs_new:Npn \setnewstate_aux_i:n [#1]
+\cs_new:Npn \__chemmacros_setnewstate:n [#1]
{
\keys_set:nn { chemmacros / setnewstate } { #1 }
- \setnewstate_aux_ii:nnn
+ \__chemmacros_setnewstate_aux:nnn
}
-\cs_new:Npn \setnewstate_aux_ii:nnn #1#2#3
+\cs_new:Npn \__chemmacros_setnewstate_aux:nnn #1#2#3
{
\bool_if:NTF \l__chemmacros_renewstate_bool
{
@@ -2942,25 +2964,25 @@
{ \tl_use:N \l__chemmacros_thermod_subscript_left_tl } { true }
{
\chemmacros_state:fnn
- {
- subscript-left = true ,
- exponent =
- { \tl_use:N \l__chemmacros_thermod_exponent_tl } ,
- delta =
- { \tl_use:N \l__chemmacros_thermod_delta_tl }
- }
- { #2 }
+ {
+ subscript-left = true ,
+ exponent =
+ { \tl_use:N \l__chemmacros_thermod_exponent_tl } ,
+ delta =
+ { \tl_use:N \l__chemmacros_thermod_delta_tl }
+ }
+ { #2 }
}
{
\chemmacros_state:fnn
- {
- subscript-left = false ,
- exponent =
- { \tl_use:N \l__chemmacros_thermod_exponent_tl } ,
- delta =
- { \tl_use:N \l__chemmacros_thermod_delta_tl }
- }
- { #2 }
+ {
+ subscript-left = false ,
+ exponent =
+ { \tl_use:N \l__chemmacros_thermod_exponent_tl } ,
+ delta =
+ { \tl_use:N \l__chemmacros_thermod_delta_tl }
+ }
+ { #2 }
}
{ \tl_use:N \l__chemmacros_thermod_subscript_tl }
=
@@ -3015,7 +3037,6 @@
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
{
@@ -3024,20 +3045,24 @@
\group_begin:
\IfNoValueF { #1 } { \keys_set:nn { chemmacros / newman } { #1 } }
\IfNoValueTF { #2 }
- {
- \fp_set_eq:NN
- \l__chemmacros_newman_rel_angle_fp
- \l__chemmacros_newman_abs_angle_fp
- }
- { \fp_set:Nn \l__chemmacros_newman_rel_angle_fp { #2 } }
- \chemmacros_newman_atoms:nnnnnn #3
+ { \chemmacros_newman_atoms:nnnnnnn { } #3 }
+ { \chemmacros_newman_atoms:nnnnnnn { #2 } #3 }
\group_end:
}
}
% place atoms:
-\cs_new:Npn \chemmacros_newman_atoms:nnnnnn #1#2#3#4#5#6
+% #1: angle
+% #2 - #7: atoms
+\cs_new:Npn \chemmacros_newman_atoms:nnnnnnn #1#2#3#4#5#6#7
{
+ \tl_if_blank:nTF { #1 }
+ {
+ \fp_set_eq:NN
+ \l__chemmacros_newman_rel_angle_fp
+ \l__chemmacros_newman_abs_angle_fp
+ }
+ { \fp_set:Nn \l__chemmacros_newman_rel_angle_fp { #1 } }
\chemmacros_tikz_picture:xn
{
scale = \fp_to_tl:N \l__chemmacros_newman_scale_fp ,
@@ -3060,24 +3085,24 @@
\chemmacros_tikz_draw:f
{ \tl_use:N \l__chemmacros_newman_tikz_ring_tl }
(0,0) circle (\fp_to_dim:N \l__chemmacros_newman_scale_fp * 15) ;
- \chemmacros_newman_back_node:nf
+ \chemmacros_newman_back_node:nn
{ 30 }
- { \IfNoValueF { #5 } { #5 } }
+ { \IfNoValueF { #6 } { #6 } }
\chemmacros_newman_back_node:nf
{ 150 }
- { \IfNoValueF { #6 } { #6 } }
+ { \IfNoValueF { #7 } { #7 } }
\chemmacros_newman_back_node:nf
{ 270 }
- { \IfNoValueF { #4 } { #4 } }
+ { \IfNoValueF { #5 } { #5 } }
\chemmacros_newman_front_node:nf
{ 90 }
- { \IfNoValueF { #1 } { #1 } }
+ { \IfNoValueF { #2 } { #2 } }
\chemmacros_newman_front_node:nf
{ 210 }
- { \IfNoValueF { #2 } { #2 } }
+ { \IfNoValueF { #3 } { #3 } }
\chemmacros_newman_front_node:nf
{ 330 }
- { \IfNoValueF { #3 } { #3 } }
+ { \IfNoValueF { #4 } { #4 } }
}
}
@@ -3221,19 +3246,19 @@
\fp_new:N \l__chemmacros_orbital_opacity_fp
\fp_set:Nn \l__chemmacros_orbital_opacity_fp { 0.5 }
-\cs_new:Npn \chemmacros_orbital_options:
+\cs_new:Npn \__chemmacros_orbital_options:
{
- \chemmacros_orbital_overlay: , \chemmacros_orbital_opacity: ,
+ \__chemmacros_orbital_overlay: , \__chemmacros_orbital_opacity: ,
inner~sep=0 , outer~sep=0 , line~width=.2pt ,
rotate = { \fp_use:N \l__chemmacros_orbital_angle_fp - 90 } ,
baseline ,
minimum~size = 0
}
-\cs_new:Npn \chemmacros_orbital_overlay:
+\cs_new:Npn \__chemmacros_orbital_overlay:
{ \bool_if:NT \l__chemmacros_orbital_overlay_bool { overlay } }
-\cs_new: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 } }
@@ -3241,7 +3266,7 @@
% --------------------------------------------------------------------------- %
% s-orbitals
-\cs_new: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
@@ -3261,9 +3286,9 @@
color .tl_set:N = \l__chemmacros_orbital_s_color_tl
}
-\cs_new: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 } }
+ \keys_set:nn { chemmacros / orbital / s } { #1 }
\bool_if:NTF \l__chemmacros_orbital_s_phase_bool
{
\tl_if_in:NnTF \l__chemmacros_orbital_s_color_tl { ! }
@@ -3280,7 +3305,7 @@
\tl_set:Nn \l__chemmacros_orbital_s_phase_color_tl
{ black ! 5 }
}
- \chemmacros_tikz_picture:xn{ \chemmacros_orbital_options: }
+ \chemmacros_tikz_picture:xn{ \__chemmacros_orbital_options: }
{
\chemmacros_tikz_shade:f
{ ball~color = \l__chemmacros_orbital_s_phase_color_tl }
@@ -3290,7 +3315,7 @@
% --------------------------------------------------------------------------- %
% p-orbitals
-\cs_new: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
@@ -3313,9 +3338,9 @@
half .default:n = true
}
-\cs_new: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 } }
+ \keys_set:nn { chemmacros / orbital / p } { #1 }
\bool_if:NTF \l__chemmacros_orbital_p_phase_bool
{
\tl_if_in:NnTF \l__chemmacros_orbital_p_color_tl { ! }
@@ -3344,7 +3369,7 @@
\tl_set:Nn \l__chemmacros_orbital_p_pphase_color_tl
{ black ! 5 }
}
- \chemmacros_tikz_picture:xn { \chemmacros_orbital_options: }
+ \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: }
{
\chemmacros_tikz_shadedraw:f
{
@@ -3386,7 +3411,7 @@
% --------------------------------------------------------------------------- %
% sp-orbitals
-\cs_new: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
@@ -3407,9 +3432,9 @@
color .tl_set:N = \l__chemmacros_orbital_sp_color_tl
}
-\cs_new: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 } }
+ \keys_set:nn { chemmacros / orbital / sp } { #1 }
\bool_if:NTF \l__chemmacros_orbital_sp_phase_bool
{
\tl_if_in:NnTF \l__chemmacros_orbital_sp_color_tl { ! }
@@ -3438,7 +3463,7 @@
\tl_set:Nn \l__chemmacros_orbital_sp_pphase_color_tl
{ black ! 5 }
}
- \chemmacros_tikz_picture:xn { \chemmacros_orbital_options: }
+ \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: }
{
\chemmacros_tikz_shadedraw:f
{
@@ -3477,7 +3502,7 @@
% --------------------------------------------------------------------------- %
% sp2-orbitals
-\cs_new: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
@@ -3498,9 +3523,9 @@
color .tl_set:N = \l__chemmacros_orbital_sptwo_color_tl
}
-\cs_new: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 } }
+ \keys_set:nn { chemmacros / orbital / sp2 } { #1 }
\bool_if:NTF \l__chemmacros_orbital_sptwo_phase_bool
{
\tl_if_in:NnTF \l__chemmacros_orbital_sptwo_color_tl { ! }
@@ -3529,7 +3554,7 @@
\tl_set:Nn \l__chemmacros_orbital_sptwo_pphase_color_tl
{ black ! 5 }
}
- \chemmacros_tikz_picture:xn { \chemmacros_orbital_options: }
+ \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: }
{
\chemmacros_tikz_shadedraw:f
{
@@ -3568,7 +3593,7 @@
% --------------------------------------------------------------------------- %
% sp3-orbitals
-\cs_new: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
@@ -3589,9 +3614,9 @@
color .tl_set:N = \l__chemmacros_orbital_spthree_color_tl
}
-\cs_new: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 } }
+ \keys_set:nn { chemmacros / orbital / sp3 } { #1 }
\bool_if:NTF \l__chemmacros_orbital_spthree_phase_bool
{
\tl_if_in:NnTF \l__chemmacros_orbital_spthree_color_tl { ! }
@@ -3620,7 +3645,7 @@
\tl_set:Nn \l__chemmacros_orbital_spthree_pphase_color_tl
{ black ! 5 }
}
- \chemmacros_tikz_picture:xn { \chemmacros_orbital_options: }
+ \chemmacros_tikz_picture:xn { \__chemmacros_orbital_options: }
{
\chemmacros_tikz_shadedraw:f
{
@@ -3674,28 +3699,34 @@
\keys_define:nn { chemmacros / orbital / type }
{
- s .code:n = { \chemmacros_orbital_type_s: } ,
- p .code:n = { \chemmacros_orbital_type_p: } ,
- sp .code:n = { \chemmacros_orbital_type_sp: } ,
- sp2 .code:n = { \chemmacros_orbital_type_sptwo: } ,
- sp3 .code:n = { \chemmacros_orbital_type_spthree: }
+ s .code:n = { \__chemmacros_orbital_type_s: } ,
+ p .code:n = { \__chemmacros_orbital_type_p: } ,
+ sp .code:n = { \__chemmacros_orbital_type_sp: } ,
+ sp2 .code:n = { \__chemmacros_orbital_type_sptwo: } ,
+ sp3 .code:n = { \__chemmacros_orbital_type_spthree: }
+ }
+
+\cs_new:Npn \chemmacros_orbital:n #1
+ {
+ \bool_if:NT \l__chemmacros_orbital_type_s_bool
+ { \__chemmacros_orbital_s_draw:n { #1 } }
+ \bool_if:NT \l__chemmacros_orbital_type_p_bool
+ { \__chemmacros_orbital_p_draw:n { #1 } }
+ \bool_if:NT \l__chemmacros_orbital_type_sp_bool
+ { \__chemmacros_orbital_sp_draw:n { #1 } }
+ \bool_if:NT \l__chemmacros_orbital_type_sptwo_bool
+ { \__chemmacros_orbital_sptwo_draw:n { #1 } }
+ \bool_if:NT \l__chemmacros_orbital_type_spthree_bool
+ { \__chemmacros_orbital_spthree_draw:n { #1 } }
}
-% TODO separate document and module level
\NewDocumentCommand \orbital { o m }
{
\group_begin:
\keys_set:nn { chemmacros / orbital / type } { #2 }
- \bool_if:NT \l__chemmacros_orbital_type_s_bool
- { \chemmacros_orbital_s_draw:n { #1 } }
- \bool_if:NT \l__chemmacros_orbital_type_p_bool
- { \chemmacros_orbital_p_draw:n { #1 } }
- \bool_if:NT \l__chemmacros_orbital_type_sp_bool
- { \chemmacros_orbital_sp_draw:n { #1 } }
- \bool_if:NT \l__chemmacros_orbital_type_sptwo_bool
- { \chemmacros_orbital_sptwo_draw:n { #1 } }
- \bool_if:NT \l__chemmacros_orbital_type_spthree_bool
- { \chemmacros_orbital_spthree_draw:n { #1 } }
+ \IfNoValueTF { #1 }
+ { \chemmacros_orbital:n { } }
+ { \chemmacros_orbital:n { #1 } }
\group_end:
}
@@ -3956,16 +3987,23 @@ Version history
- changed defaults for horizontal spaces that have in
set in ex into corresponding values in em.
- improvements to the placement of sub- and superscripts
-2012/02/19 - version 3.5a - bug fix: `ghsystem' recognizes language again
-2013/??/?? - version 3.6 - support for use with the `breqn' package
+2013/02/19 - version 3.5a - bug fix: `ghsystem' recognizes language again
+2013/02/26 - version 3.6 - support for use with the `breqn' package
- chemformula: math escaping also via \(\)
- - chemformula: clearer escaping macros
+ - chemformula internal: clearer escaping macros
- new options: `radical-vshift', `radical-hshift'
and `radical-space'
- bug fix: `radical-...' options are now correctly set
- stoichiometric factors: add leading 0 if missing
+ - new option: `stoich-paren-parse'
- internal changes: be way more rigid about protected
and expandable macros
+ - internal changes: clearer distinction between
+ private macros and accessable module macros
+ - internal changes: clearer distinction between
+ document commands and module level commands
+ - chemformula's !()() syntax now also works with babel's
+ French
% --------------------------------------------------------------------------- %
% TODO:
diff --git a/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty b/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty
index 72485964f2e..90e387ff1d8 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty
@@ -98,40 +98,40 @@
\bool_new:N \l__ghsystem_engine_xetex_bool
\bool_new:N \l__ghsystem_engine_luatex_bool
-\tl_new:N \l__ghsystem_number_space_tl
-\tl_new:N \l__ghsystem_celsius_temperature_tl
-\tl_new:N \l__ghsystem_fahrenheit_temperature_tl
-\tl_new:N \l__ghsystem_kg_mass_tl
-\tl_new:N \l__ghsystem_lbs_mass_tl
-\tl_new:N \l__ghsystem_dots_tl
-\tl_set:Nn \l__ghsystem_dots_tl { \ldots }
-\tl_new:N \l__ghsystem_picture_scale_default_tl
-\tl_set:Nn \l__ghsystem_picture_scale_default_tl { .05 }
-\tl_new:N \l__ghsystem_picture_scale_tl
+\tl_new:N \l__ghsystem_number_space_tl
+\tl_new:N \l__ghsystem_celsius_temperature_tl
+\tl_new:N \l__ghsystem_fahrenheit_temperature_tl
+\tl_new:N \l__ghsystem_kg_mass_tl
+\tl_new:N \l__ghsystem_lbs_mass_tl
+\tl_new:N \l__ghsystem_dots_tl
+\tl_set:Nn \l__ghsystem_dots_tl { \ldots }
+\tl_new:N \l__ghsystem_picture_scale_default_tl
+\tl_set:Nn \l__ghsystem_picture_scale_default_tl { .05 }
+\tl_new:N \l__ghsystem_picture_scale_tl
\tl_set_eq:NN \l__ghsystem_picture_scale_tl \l__ghsystem_picture_scale_default_tl
-\tl_new:N \l__ghsystem_picture_includegraphics_tl
-\tl_new:N \l__ghsystem_picture_type_tl
-\tl_new:N \l__ghsystem_identifier_tl
-\tl_new:N \l__ghsystem_table_text_tl
-\tl_new:N \l__ghsystem_table_next_page_tl
-\tl_new:N \l__ghsystem_table_head_rule_tl
-\tl_set:Nn \l__ghsystem_table_head_rule_tl { \hline }
-\tl_new:N \l__ghsystem_table_top_head_rule_tl
-\tl_set:Nn \l__ghsystem_table_top_head_rule_tl { \hline }
-\tl_new:N \l__ghsystem_table_foot_rule_tl
-\tl_set:Nn \l__ghsystem_table_foot_rule_tl { \hline }
-\tl_new:N \l__ghsystem_table_last_foot_rule_tl
-\tl_set:Nn \l__ghsystem_table_last_foot_rule_tl { \hline }
-\tl_new:N \l__ghsystem_table_caption_tl
-\tl_new:N \l__ghsystem_table_caption_short_tl
-\tl_new:N \l__ghsystem_table_label_tl
-\tl_set:Nn \l__ghsystem_table_label_tl { tab : ghs-hp-statements }
-
-\dim_new:N \l__ghsystem_table_line_sep_dim
+\tl_new:N \l__ghsystem_picture_includegraphics_tl
+\tl_new:N \l__ghsystem_picture_type_tl
+\tl_new:N \l__ghsystem_identifier_tl
+\tl_new:N \l__ghsystem_table_text_tl
+\tl_new:N \l__ghsystem_table_next_page_tl
+\tl_new:N \l__ghsystem_table_head_rule_tl
+\tl_set:Nn \l__ghsystem_table_head_rule_tl { \hline }
+\tl_new:N \l__ghsystem_table_top_head_rule_tl
+\tl_set:Nn \l__ghsystem_table_top_head_rule_tl { \hline }
+\tl_new:N \l__ghsystem_table_foot_rule_tl
+\tl_set:Nn \l__ghsystem_table_foot_rule_tl { \hline }
+\tl_new:N \l__ghsystem_table_last_foot_rule_tl
+\tl_set:Nn \l__ghsystem_table_last_foot_rule_tl { \hline }
+\tl_new:N \l__ghsystem_table_caption_tl
+\tl_new:N \l__ghsystem_table_caption_short_tl
+\tl_new:N \l__ghsystem_table_label_tl
+\tl_set:Nn \l__ghsystem_table_label_tl { tab : ghs-hp-statements }
+
+\dim_new:N \l__ghsystem_table_line_sep_dim
\dim_set:Nn \l__ghsystem_table_line_sep_dim { 3pt }
-\fp_new:N \l__ghsystem_picture_scale_fp
-\fp_set:Nn \l__ghsystem_picture_scale_fp { \l__ghsystem_picture_scale_tl }
+\fp_new:N \l__ghsystem_picture_scale_fp
+\fp_set:Nn \l__ghsystem_picture_scale_fp { \l__ghsystem_picture_scale_tl }
\DeclareSIUnit { \GHSfahrenheit } { \SIUnitSymbolDegree F }
\DeclareSIUnit { \GHScelsius } { \SIUnitSymbolDegree C }
@@ -141,6 +141,7 @@
% language settings
\bool_new:N \l__ghsystem_language_file_loaded_bool
\bool_new:N \l__ghsystem_language_directory_bool
+
\file_if_exist:nTF { language / ghsystem_english_def }
{ \bool_set_true:N \l__ghsystem_language_directory_bool }
{ \bool_set_false:N \l__ghsystem_language_directory_bool }
@@ -310,17 +311,17 @@
\cs_new:Nn \ghsystem_read_args:nn
{
- \ghsystem_get_type:nN { #1 } \l__ghsystem_tmpa_tl
+ \__ghsystem_get_type:nN { #1 } \l__ghsystem_tmpa_tl
\prop_get:cnNTF { l__ghsystem_ \l__ghsystem_tmpa_tl _prop } { #2 } \l__ghsystem_tmpb_tl
{
- \ghsystem_is_combination:nn { #1 } { #2 }
+ \__ghsystem_is_combination:nn { #1 } { #2 }
\bool_if:NF \l__ghsystem_hide_statement_bool
{ \tl_use:N \l__ghsystem_tmpb_tl }
}
{ \chemmacros_msg:nnxx { ghsystem } { statements } { #1 } { #2 } }
}
-\cs_new:Nn \ghsystem_get_type:nN
+\cs_new_protected:Nn \__ghsystem_get_type:nN
{
\tl_if_eq:nnT { #1 } { h } { \tl_set:Nn #2 { h } }
\tl_if_eq:nnT { #1 } { H } { \tl_set:Nn #2 { h } }
@@ -336,14 +337,14 @@
\tl_if_eq:nnT { #1 } { P } { \tl_set:Nn #2 { p } }
}
-\cs_new:Nn \ghsystem_is_combination:nn
+\cs_new:Nn \__ghsystem_is_combination:nn
{
\tl_if_in:nnTF { #2 } { + }
- { \ghsystem_is_combination_aux_i:w #1,#2 \q_stop }
- { \ghsystem_is_combination_aux_ii:w #1,#2 \q_stop }
+ { \__ghsystem_is_combination_aux_i:w #1,#2 \q_stop }
+ { \__ghsystem_is_combination_aux_ii:w #1,#2 \q_stop }
}
-\cs_new:Npn \ghsystem_is_combination_aux_i:w #1,#2+#3 \q_stop
+\cs_new:Npn \__ghsystem_is_combination_aux_i:w #1,#2+#3 \q_stop
{
\bool_if:NT \l__ghsystem_show_number_bool
{
@@ -351,7 +352,7 @@
\tl_use:N \l__ghsystem_number_space_tl
#2 ~ + ~
\tl_if_in:nnTF { #3 } { + }
- { \ghsystem_is_combination_aux_iii:w #1,#3 \q_stop }
+ { \__ghsystem_is_combination_aux_iii:w #1,#3 \q_stop }
{
\tl_to_uppercase:n { #1 }
\tl_use:N \l__ghsystem_number_space_tl
@@ -360,7 +361,7 @@
}
}
-\cs_new:Npn \ghsystem_is_combination_aux_ii:w #1,#2 \q_stop
+\cs_new:Npn \__ghsystem_is_combination_aux_ii:w #1,#2 \q_stop
{
\bool_if:NT \l__ghsystem_show_number_bool
{
@@ -370,7 +371,7 @@
}
}
-\cs_new:Npn \ghsystem_is_combination_aux_iii:w #1,#2+#3 \q_stop
+\cs_new:Npn \__ghsystem_is_combination_aux_iii:w #1,#2+#3 \q_stop
{
\bool_if:NT \l__ghsystem_show_number_bool
{
@@ -390,64 +391,70 @@
{
\group_begin:
\IfNoValueF { #1 } { \keys_set:nn { chemmacros / ghsystem } { #1 } }
+ \ghsystem_list_all:
+ \group_end:
+ }
+
+\cs_new_protected:Npn \ghsystem_list_all:
+ {
+ \int_zero:N \l__ghsystem_tmpa_int
+ \int_zero:N \l__ghsystem_tmpb_int
+ \prop_map_inline:Nn \l__ghsystem_p_prop { \int_incr:N \l__ghsystem_tmpa_int }
+ \dim_set_eq:NN \tabulinesep \l__ghsystem_table_line_sep_dim
+ \begin { longtabu } { X[3]X[7,L] }
+ \caption [ \l__ghsystem_table_caption_short_tl ]
+ {
+ \l__ghsystem_table_caption_tl
+ \exp_args:No \label { \l__ghsystem_table_label_tl }
+ } \\
+ \l__ghsystem_table_top_head_rule_tl
+ \textbf { \l__ghsystem_identifier_tl } &
+ \textbf { \l__ghsystem_table_text_tl } \\
+ \l__ghsystem_table_head_rule_tl
+ \endfirsthead
+ \l__ghsystem_table_top_head_rule_tl
+ \textbf { \l__ghsystem_identifier_tl } &
+ \textbf { \l__ghsystem_table_text_tl } \\
+ \l__ghsystem_table_head_rule_tl
+ \endhead
+ \l__ghsystem_table_last_foot_rule_tl
+ \multicolumn{2}{r} { \textit { \l__ghsystem_table_next_page_tl } }
+ \endfoot
+ \l__ghsystem_table_foot_rule_tl \multicolumn{2}{r} { }
+ \endlastfoot
+ \prop_map_inline:Nn \l__ghsystem_h_prop
+ { \__ghsystem_read_number:nn { H } { ##1 } & ##2 \\ }
+ \prop_map_inline:Nn \l__ghsystem_euh_prop
+ { \__ghsystem_read_number:nn { EUH } { ##1 } & ##2 \\ }
\int_zero:N \l__ghsystem_tmpa_int
+ \prop_map_inline:Nn \l__ghsystem_p_prop { \int_gincr:N \l__ghsystem_tmpa_int }
\int_zero:N \l__ghsystem_tmpb_int
- \prop_map_inline:Nn \l__ghsystem_p_prop { \int_incr:N \l__ghsystem_tmpa_int }
- \dim_set_eq:NN \tabulinesep \l__ghsystem_table_line_sep_dim
- \begin { longtabu } { X[3]X[7,L] }
- \caption [ \l__ghsystem_table_caption_short_tl ]
- {
- \l__ghsystem_table_caption_tl
- \exp_args:No \label { \l__ghsystem_table_label_tl }
- } \\
- \l__ghsystem_table_top_head_rule_tl
- \textbf { \l__ghsystem_identifier_tl } &
- \textbf { \l__ghsystem_table_text_tl } \\
- \l__ghsystem_table_head_rule_tl
- \endfirsthead
- \l__ghsystem_table_top_head_rule_tl
- \textbf { \l__ghsystem_identifier_tl } &
- \textbf { \l__ghsystem_table_text_tl } \\
- \l__ghsystem_table_head_rule_tl
- \endhead
- \l__ghsystem_table_last_foot_rule_tl
- \multicolumn{2}{r} { \textit { \l__ghsystem_table_next_page_tl } }
- \endfoot
- \l__ghsystem_table_foot_rule_tl \multicolumn{2}{r} { }
- \endlastfoot
- \prop_map_inline:Nn \l__ghsystem_h_prop
- { \ghsystem_read_number:nn { H } { ##1 } & ##2 \\ }
- \prop_map_inline:Nn \l__ghsystem_euh_prop
- { \ghsystem_read_number:nn { EUH } { ##1 } & ##2 \\ }
- \int_zero:N \l__ghsystem_tmpa_int
- \prop_map_inline:Nn \l__ghsystem_p_prop { \int_gincr:N \l__ghsystem_tmpa_int }
- \int_zero:N \l__ghsystem_tmpb_int
- \prop_map_inline:Nn \l__ghsystem_p_prop
- {
- \int_gincr:N \l__ghsystem_tmpb_int
- \ghsystem_read_number:nn { P } { ##1 } & ##2
- \int_compare:nNnT { \l__ghsystem_tmpb_int } < { \l__ghsystem_tmpa_int } { \\ }
- }
- \end { longtabu }
- \group_end:
+ \prop_map_inline:Nn \l__ghsystem_p_prop
+ {
+ \int_gincr:N \l__ghsystem_tmpb_int
+ \__ghsystem_read_number:nn { P } { ##1 } & ##2
+ \int_compare:nNnT { \l__ghsystem_tmpb_int } < { \l__ghsystem_tmpa_int } { \\ }
+ }
+ \end { longtabu }
}
-\cs_new:Nn \ghsystem_read_number:nn
+\cs_new:Nn \__ghsystem_read_number:nn
{
\tl_if_in:nnTF { #2 } { + }
- { \ghsystem_read_number_aux_i:w #1 , #2 \q_stop }
+ { \__ghsystem_read_number_aux_i:w #1 , #2 \q_stop }
{ #1 \tl_use:N \l__ghsystem_number_space_tl #2 }
}
-\cs_new:Npn \ghsystem_read_number_aux_i:w #1,#2+#3\q_stop
+\cs_new:Npn \__ghsystem_read_number_aux_i:w #1,#2+#3\q_stop
{
#1 \tl_use:N \l__ghsystem_number_space_tl #2 ~+~
\tl_if_in:nnTF { #3 } { + }
- { \ghsystem_read_number_aux_ii:w #1,#3 \q_stop }
+ { \__ghsystem_read_number_aux_ii:w #1,#3 \q_stop }
{ #1#3 }
}
-\cs_new:Npn \ghsystem_read_number_aux_ii:w #1,#2+#3\q_stop { #1#2 ~+~ #1#3 }
+\cs_new:Npn \__ghsystem_read_number_aux_ii:w #1,#2+#3\q_stop
+ { #1#2 ~+~ #1#3 }
% --------------------------------------------------------------------------- %
% the picture command
@@ -455,7 +462,7 @@
%
% test for compilation engine/mode:
\pdftex_if_engine:T { \bool_set_true:N \l__ghsystem_engine_pdftex_bool }
-\xetex_if_engine:T { \bool_set_true:N \l__ghsystem_engine_xetex_bool }
+\xetex_if_engine:T { \bool_set_true:N \l__ghsystem_engine_xetex_bool }
\luatex_if_engine:T { \bool_set_true:N \l__ghsystem_engine_luatex_bool }
\bool_new:N \l__ghsystem_picture_directory_bool
@@ -476,34 +483,39 @@
% the command:
\NewDocumentCommand \ghspic { om }
{
- \file_if_exist:nTF { pictures / ghsystem_ #2 . \l__ghsystem_picture_type_tl }
- { \bool_set_true:N \l__ghsystem_picture_directory_bool }
- { \bool_set_false:N \l__ghsystem_picture_directory_bool }
\group_begin:
\IfNoValueF { #1 } { \keys_set:nn { chemmacros / ghsystem } { #1 } }
- \bool_if:NTF \l__ghsystem_picture_directory_bool
- {
- \ghsystem_includegraphics:xn
- {
- scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp
- \l__ghsystem_picture_includegraphics_tl
- }
- { pictures / ghsystem_ #2 . \l__ghsystem_picture_type_tl }
- }
- {
- \ghsystem_includegraphics:xn
- {
- scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp
- \l__ghsystem_picture_includegraphics_tl
- }
- { ghsystem_ #2 . \l__ghsystem_picture_type_tl }
- }
+ \ghsystem_pic:n { #2 }
\group_end:
}
-\cs_new:Nn \ghsystem_includegraphics:nn
+\cs_new_protected:Npn \ghsystem_pic:n #1
+ {
+ \file_if_exist:nTF { pictures / ghsystem_ #1 . \l__ghsystem_picture_type_tl }
+ { \bool_set_true:N \l__ghsystem_picture_directory_bool }
+ { \bool_set_false:N \l__ghsystem_picture_directory_bool }
+ \bool_if:NTF \l__ghsystem_picture_directory_bool
+ {
+ \__ghsystem_includegraphics:xn
+ {
+ scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp
+ \l__ghsystem_picture_includegraphics_tl
+ }
+ { pictures / ghsystem_ #1 . \l__ghsystem_picture_type_tl }
+ }
+ {
+ \__ghsystem_includegraphics:xn
+ {
+ scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp
+ \l__ghsystem_picture_includegraphics_tl
+ }
+ { ghsystem_ #1 . \l__ghsystem_picture_type_tl }
+ }
+ }
+
+\cs_new:Nn \__ghsystem_includegraphics:nn
{ \includegraphics[#1]{#2} }
-\cs_generate_variant:Nn \ghsystem_includegraphics:nn { xn }
+\cs_generate_variant:Nn \__ghsystem_includegraphics:nn { xn }
\tex_endinput:D
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%