summaryrefslogtreecommitdiff
path: root/tex/context/base/chem-str.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/chem-str.mkiv')
-rw-r--r--tex/context/base/chem-str.mkiv41
1 files changed, 26 insertions, 15 deletions
diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv
index 9c31a3c14..d9ec1842b 100644
--- a/tex/context/base/chem-str.mkiv
+++ b/tex/context/base/chem-str.mkiv
@@ -317,16 +317,21 @@
% special macros (probably needs some more work)
-\let\chem_box_visual\ruledhbox
-\let\chem_box_visual\hbox
-\let\chem_box_normal\hbox
+\let\chem_box_normal_yes\hbox
+\let\chem_box_visual_yes\hbox
+\let\chem_box_visual_nop\relax
+
+\installtextracker
+ {chemistry.boxes}
+ {\let\chem_box_visual_yes\ruledhbox \let\chem_box_visual_nop\ruledhbox}
+ {\let\chem_box_visual_yes\hbox \let\chem_box_visual_nop\relax }
\def\chem_top_construct#1#2#3#4%
{\hbox\bgroup
\setstrut
- \setbox\scratchboxone\chem_box_visual{\strut#3}%
- \setbox\scratchboxtwo\chem_box_visual{\strut\molecule{#4}}%
- \setbox\scratchboxone\chem_box_normal{\raise\dimexpr\dp\scratchboxone+\ht\scratchboxtwo\relax\hbox to \wd\scratchboxtwo{#1\box\scratchboxone#2}}%
+ \setbox\scratchboxone\chem_box_visual_yes{\strut#3}%
+ \setbox\scratchboxtwo\chem_box_visual_yes{\strut\molecule{#4}}%
+ \setbox\scratchboxone\chem_box_normal_yes{\raise\dimexpr\dp\scratchboxone+\ht\scratchboxtwo\relax\hbox to \wd\scratchboxtwo{#1\box\scratchboxone#2}}%
\smashbox\scratchboxone
\box\scratchboxone
\box\scratchboxtwo
@@ -335,9 +340,9 @@
\def\chem_bottom_construct#1#2#3#4%
{\hbox\bgroup
\setstrut
- \setbox\scratchboxone\chem_box_visual{\strut#3}%
- \setbox\scratchboxtwo\chem_box_visual{\strut\molecule{#4}}%
- \setbox\scratchboxone\chem_box_normal{\lower\dimexpr\dp\scratchboxtwo+\ht\scratchboxone\relax\hbox to \wd\scratchboxtwo{#1\box\scratchboxone#2}}%
+ \setbox\scratchboxone\chem_box_visual_yes{\strut#3}%
+ \setbox\scratchboxtwo\chem_box_visual_yes{\strut\molecule{#4}}%
+ \setbox\scratchboxone\chem_box_normal_yes{\lower\dimexpr\dp\scratchboxtwo+\ht\scratchboxone\relax\hbox to \wd\scratchboxtwo{#1\box\scratchboxone#2}}%
\smashbox\scratchboxone
\box\scratchboxone
\box\scratchboxtwo
@@ -346,15 +351,15 @@
\unexpanded\def\chemicalleft#1#2% redundant boxes thanks to visual
{\hbox\bgroup
\setstrut
- \llap{\chem_box_visual{\strut#1}}%
- \chem_box_visual{\strut#2}%
+ \llap{\chem_box_visual_nop{\strut#1}}%
+ \chem_box_visual_nop{\strut#2}%
\egroup}
\unexpanded\def\chemicalright#1#2% redundant boxes thanks to visual
{\hbox\bgroup
\setstrut
- \chem_box_visual{\strut#2}%
- \rlap{\chem_box_visual{\strut#1}}%
+ \chem_box_visual_yes{\strut#2}%
+ \rlap{\chem_box_visual_nop{\strut#1}}%
\egroup}
\unexpanded\def\chemicaltop {\chem_top_construct \hss \hss }
@@ -390,7 +395,7 @@
{\dontleavehmode
\begingroup
\usechemicalstyleandcolor\c!style\c!color
- \chem_box_visual to \fontcharwd\font`C\bgroup
+ \chem_box_visual_yes to \fontcharwd\font`C\bgroup
\setstrut\strut
#1\molecule{#3}#2%
\egroup
@@ -401,7 +406,7 @@
\begingroup
\scratchcounter\normalmathstyle
\usechemicalstyleandcolor\c!style\c!color
- \chem_box_visual to \fontcharwd\font`C\bgroup
+ \chem_box_visual_yes to \fontcharwd\font`C\bgroup
\setstrut\strut
#1\mathematics{\tf\triggermathstyle\scratchcounter\molecule{#3}}#2%
\egroup
@@ -602,6 +607,9 @@
\definechemicalsymbol[d:gives] [\rightarrowfill] % \chem_arrow_construct\xrightarrow
\definechemicalsymbol[d:equilibrium] [\rightoverleftarrowfill] % \chem_arrow_construct\xrightoverleftarrow
\definechemicalsymbol[d:mesomeric] [\leftarrowfill] % \chem_arrow_construct\xleftrightarrow
+\definechemicalsymbol[d:single] [\chemicalbondrule]
+\definechemicalsymbol[d:double] [\hbox{\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
+\definechemicalsymbol[d:triple] [\hbox{\chemicalbondrule\hskip-1em\lower.5ex\chemicalbondrule\hskip-1em\raise.5ex\chemicalbondrule}]
\definechemicalsymbol[d:opencomplex] [\mathematics{\Bigg[}] % not yet ok
\definechemicalsymbol[d:closecomplex][\mathematics{\Bigg]}] % not yet ok
@@ -611,6 +619,9 @@
\definechemicalsymbol[d:GIVES] [{\chemicalsymbol[d:gives]}]
\definechemicalsymbol[d:EQUILIBRIUM] [{\chemicalsymbol[d:equilibrium]}]
\definechemicalsymbol[d:MESOMERIC] [{\chemicalsymbol[d:mesomeric]}]
+\definechemicalsymbol[d:SINGLE] [{\chemicalsymbol[d:single]}]
+\definechemicalsymbol[d:DOUBLE] [{\chemicalsymbol[d:double]}]
+\definechemicalsymbol[d:TRIPLE] [{\chemicalsymbol[d:triple]}]
\definechemicalsymbol[d:OPENCOMPLEX] [{\chemicalsymbol[d:opencomplex]}]
\definechemicalsymbol[d:CLOSECOMPLEX][{\chemicalsymbol[d:closecomplex]}]