Debian Codegraph @

texmf-dist/tex/latex/lwarp/lwarp-chemmacros.sty

raw
1 %%
2 %% This is file `lwarp-chemmacros.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% lwarp.dtx (with options: `chemmacros')
8 %% This is a generated file.
9 %% Copyright 2016-2026 Brian Dunn
10 %%
11 %% This work may be distributed and/or modified under the
12 %% conditions of the LaTeX Project Public License, either version 1.3
13 %% of this license or (at your option) any later version.
14 %% The latest version of this license is in
15 %% http://www.latex-project.org/lppl.txt
16 %% and version 1.3 or later is part of all distributions of LaTeX
17 %% version 2005/12/01 or later.
18
19 \LWR@ProvidesPackagePass{chemmacros}[2022/02/13]
20 \ExplSyntaxOn
21 \prg_set_conditional:Npnn \chemmacros_if_package_loaded:n #1 {p,T,F,TF}
22 {
23 \cs_if_exist:cTF {ver@#1.sty}
24 { \prg_return_true: }
25 {
26 \cs_if_exist:cTF {ver@lwarp-#1.sty}
27 { \prg_return_true: }
28 { \prg_return_false: }
29 }
30 }
31 \hook_gput_code:nnn {begindocument/end} {chemmacros}
32 {
33 \bool_set_false:N \l__chemmacros_hyperref_bool
34 }
35 \DeclareDocumentEnvironment{polymerdelims}{}
36 {\begin{lateximage}[-chemmacros- polymer]}
37 {\end{lateximage}}
38
39 \DeclareDocumentEnvironment{redoxreaction}{m m}
40 {\begin{lateximage}[-chemmacros- redoxreaction]}
41 {\end{lateximage}}
42 \AtBeginDocument{
43 \chemmacros_module_if_loaded:nTF{{acid-base}}{
44 \PackageInfo{lwarp}{Patching~chemmacros~module~acid-base}
45
46 \VerifyCommand[lwarp][chemmacros]{\chemmacros_p:n}
47 {D95080E9783CB80E34C51221236CF370}
48
49 \cs_gset_protected:Npn \chemmacros_p:n #1
50 {
51 \begingroup
52 \boolfalse{mathjax}
53 \LWR@subsingledollar*{
54 \textbackslash{}%
55 p%
56 \{%
57 \LWR@HTMLsanitizedetokenized{\detokenize{#1}}%
58 \}
59 }{
60 chemmacrosp%
61 \protect\LWR@HTMLsanitizedetokenized{\detokenize\expandafter{#1}}%
62 }{
63 \group_begin:
64 \mbox
65 {
66 \chemmacros_p_style:n {p}
67 \ensuremath {#1}
68 }
69 \group_end:
70 }
71 \endgroup
72 }
73
74 \VerifyCommand[lwarp][chemmacros]{\pH}
75 {BA70E24367521CBBF282F40F65758016}
76
77 \RenewDocumentCommand \pH {} {
78 \begingroup
79 \boolfalse{mathjax}
80 \LWR@subsingledollar*{\textbackslash{}pH}{chemmacros}{
81 \chemmacros_p:n { \chemmacros_formula:n {H} }
82 }
83 \endgroup
84 }
85
86 \VerifyCommand[lwarp][chemmacros]{\pOH}
87 {EFBC86417A28B1777F8A783D68225A3C}
88
89 \RenewDocumentCommand \pOH {} {
90 \begingroup
91 \boolfalse{mathjax}
92 \LWR@subsingledollar*{\textbackslash{}pOH}{chemmacros}{
93 \chemmacros_p:n { \chemmacros_formula:n {OH} }
94 }
95 \endgroup
96 }
97
98 \VerifyCommand[lwarp][chemmacros]{\pKa}
99 {C4141E480C360A8EDAE38B65F71F5B1F}
100
101 \RenewDocumentCommand \pKa {O{}}
102 {
103 \begingroup
104 \boolfalse{mathjax}
105 \LWR@subsingledollar*{\textbackslash{}pKa{[}#1{]}}{chemmacros #1}{
106 \chemmacros_p:n
107 {
108 \Ka \ifblank {#1} {}
109 { {} \c_math_subscript_token { \chemmacros_bold:n {#1} } }
110 }
111 }
112 \endgroup
113 }
114
115 \VerifyCommand[lwarp][chemmacros]{\pKb}
116 {00A20E25465C2E0D2E3731634F39B0FA}
117
118 \RenewDocumentCommand \pKb {O{}}
119 {
120 \begingroup
121 \boolfalse{mathjax}
122 \LWR@subsingledollar*{\textbackslash{}pKb{[}#1{]}}{chemmacros #1}{
123 \chemmacros_p:n
124 {
125 \Kb \ifblank {#1} {}
126 { {} \c_math_subscript_token { \chemmacros_bold:n {#1} } }
127 }
128 }
129 \endgroup
130 }
131
132 \LetLtxMacro\LWR@chemmacros@origKa\Ka
133 \renewcommand*{\Ka}{%
134 \begingroup
135 \boolfalse{mathjax}
136 \LWR@subsingledollar*{\textbackslash{}Ka}{chemmacros}{%
137 \LWR@chemmacros@origKa%
138 }%
139 \endgroup
140 }
141
142 \LetLtxMacro\LWR@chemmacros@origKb\Kb
143 \renewcommand*{\Kb}{%
144 \begingroup
145 \boolfalse{mathjax}
146 \LWR@subsingledollar*{\textbackslash{}Kb}{chemmacros}{%
147 \LWR@chemmacros@origKb%
148 }%
149 \endgroup
150 }
151
152 \LetLtxMacro\LWR@chemmacros@origKw\Kw
153 \renewcommand*{\Kw}{%
154 \begingroup
155 \boolfalse{mathjax}
156 \LWR@subsingledollar*{\textbackslash{}Kw}{chemmacros}{
157 \LWR@chemmacros@origKw
158 }
159 \endgroup
160 }
161
162 }{}% module loaded
163 }% AtBeginDocument
164 \AtBeginDocument{
165 \chemmacros_module_if_loaded:nTF{{charges}}{
166 \PackageInfo{lwarp}{Patching~chemmacros~module~charges}
167
168 \VerifyCommand[lwarp][chemmacros]{\fplus}
169 {F6F7137115BC798D4CA779782DCCEB6D}
170
171 \cs_gset_protected:Npn \fplus {
172 \begingroup
173 \boolfalse{mathjax}
174 \LWR@subsingledollar*{\textbackslash{}fplus}{chemmacros}
175 { \LWR@origensuredmath{\chemformula_fplus:} }
176 \endgroup
177 }
178
179 \VerifyCommand[lwarp][chemmacros]{\fminus}
180 {A7ED8520C49A794F33AA6122E2411746}
181
182 \cs_gset_protected:Npn \fminus {
183 \begingroup
184 \boolfalse{mathjax}
185 \LWR@subsingledollar*{\textbackslash{}fminus}{chemmacros}
186 { \LWR@origensuredmath{\chemformula_fminus:} }
187 \endgroup
188 }
189
190 }{}% Module loaded.
191 }% AtBeginDocument
192 \AtBeginDocument{
193 \chemmacros_module_if_loaded:nTF{{nomenclature}}{
194 \PackageInfo{lwarp}{Patching~chemmacros~module~nomenclature}
195
196 \VerifyCommand[lwarp][chemmacros]{\chemmacros_charge:n}
197 {258D97BF6FF3FA5C995D4FDCC44B0E63}
198
199 \cs_gset_protected:Npn \chemmacros_charge:n #1
200 {
201 \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}
202 {\chemmacros_formula:n { {}^{#1} }}
203 {
204 \ifmmode
205 {\chemmacros_formula:n { {}^{#1} }}
206 \else
207 { \textsuperscript{\ensuremath{#1}} }
208 \fi
209 }
210 }
211
212
213 \hook_gput_code:nnn {begindocument/end} {chemmacros}
214 {
215 \protected\def\LWR@HTML@chemprime { \HTMLunicode{2032} }
216 \LWR@formatted{chemprime}
217 }
218 \VerifyCommand[lwarp][chemmacros]{\chemmacros_cip:n}
219 {EEF7D8AF4D975C2D11D879A77ABDFF88}
220
221 \cs_gset_protected:Npn \__chemmacros_cip:n #1
222 {
223 \tl_set:Nn \l__chemmacros_tmpa_tl {#1}
224 \int_step_inline:nnnn {0} {1} {9}
225 {
226 \tl_replace_all:Nnn \l__chemmacros_tmpa_tl
227 {##1}
228 { { \l__chemmacros_cip_number_tl ##1} }
229 }
230 {
231 \l__chemmacros_cip_inner_tl
232 \LWR@textcurrentcolor{\LWR@textcurrentfont{% lwarp
233 \l__chemmacros_tmpa_tl
234 }}% lwarp
235 }
236 }
237 \VerifyCommand[lwarp][chemmacros]{\Sconf}
238 {D7A87543D1C944168CBAC59E9F45DF9A}
239
240 \RenewDocumentCommand \Sconf { O{S} } {
241 \begin{lateximage}[\textbackslash{}Sconf{[}#1{]}]*?%
242 \chemmacros_sconf:n {#1}%
243 \end{lateximage}
244 }
245
246 \VerifyCommand[lwarp][chemmacros]{\Rconf}
247 {AB922016338B2F2C2635E6104311DAF2}
248
249 \RenewDocumentCommand \Rconf { O{R} } {
250 \begin{lateximage}[\textbackslash{}Rconf{[}#1{]}]*?%
251 \chemmacros_rconf:n {#1}%
252 \end{lateximage}
253 }
254 \VerifyCommand[lwarp][chemmacros]{\chemmacros_hapto:n}
255 {FCEEDAB3292A95E65B69F4F8C8849B26}
256
257 \cs_gset_protected:Npn \chemmacros_hapto:n #1
258 {
259 \begingroup
260 \boolfalse{mathjax}
261 \LWR@subsingledollar*{\textbackslash{}hapto\{#1\}}{chemmacros}{
262 \chemmacros_coordination_symbol:nnnn
263 { \l__chemmacros_coord_use_hyphen_bool }
264 {
265 { \c_true_bool }
266 }
267 { \chemeta }
268 {#1}
269 }
270 \endgroup
271 }
272
273 \VerifyCommand[lwarp][chemmacros]{\chemmacros_dento:n}
274 {E85BBDEF5A35F37215EBAD87AFCB99E8}
275
276 \cs_gset_protected:Npn \chemmacros_dento:n #1
277 {
278 \begingroup
279 \boolfalse{mathjax}
280 \LWR@subsingledollar*{\textbackslash{}dento\{#1\}}{chemmacros}{
281 \chemmacros_coordination_symbol:nnnn
282 { \l__chemmacros_coord_use_hyphen_bool }
283 {
284 { \c_true_bool }
285 }
286 { \chemkappa }
287 {#1}
288 }
289 \endgroup
290 }
291
292 \VerifyCommand[lwarp][chemmacros]{\chemmacros_bridge:n}
293 {5E5D0EA9045A41FF30D4AB315E547B25}
294
295 \cs_gset_protected:Npn \chemmacros_bridge:n #1
296 {
297 \begingroup
298 \boolfalse{mathjax}
299 \LWR@subsingledollar*{\textbackslash{}bridge\{#1\}}{chemmacros}{
300 \chemmacros_coordination_symbol:nnnn
301 { \l__chemmacros_coord_use_hyphen_bool }
302 { \l__chemmacros_bridge_super_bool }
303 { \chemmu }
304 {#1}
305 }
306 \endgroup
307 }
308 }{}% Module loaded.
309 }% AtBeginDocument
310 \AtBeginDocument{
311 \chemmacros_module_if_loaded:nTF{{particles}}{
312 \PackageInfo{lwarp}{Patching~chemmacros~module~particles}
313
314 \VerifyCommand[lwarp][chemmacros]{\chemmacros_declare_nucleophile:Nn}
315 {ED9AA7471C8638CEF0757A10A2E3935E}
316
317 \cs_gset_protected:Npn \chemmacros_declare_nucleophile:Nn #1#2
318 {
319 \cs_set_protected:cpn {__chemmacros_ \chemmacros_remove_backslash:N #1:}
320 {
321 \bool_if:NTF \l__chemmacros_nucleophile_elpair_bool
322 {
323 \chemmacros_elpair:n { #2 }
324 { \skip_horizontal:N \l__chemmacros_nucleophile_dim }
325 \chemmacros_formula:n { {}^{-} }
326 }
327 { \chemmacros_formula:n { #2^{-} } }
328 }
329 \DeclareDocumentCommand #1 {o}
330 {%
331 \begin{lateximage}%
332 \group_begin:%
333 \IfNoValueF {##1}%
334 { \chemmacros_set_keys:nn {particles} {##1} }%
335 \use:c {__chemmacros_ \chemmacros_remove_backslash:N #1:}%
336 \group_end:%
337 \end{lateximage}%
338 }
339 }
340
341 \RenewChemNucleophile \Nuc {Nu}
342 \RenewChemNucleophile \ba {ba}
343
344 }{}% Module loaded.
345 }% AtBeginDocument
346 \AtBeginDocument{
347 \chemmacros_module_if_loaded:nTF{{phases}}{
348 \PackageInfo{lwarp}{Patching~chemmacros~module~phases}
349
350 \VerifyCommand[lwarp][chemmacros]{\chemmacros_phase:n}
351 {83788F1FCBEDA21B495E919E36DD90A5}
352
353 \cs_undefine:N \chemmacros_phase:n
354 \cs_new_protected:Npn \chemmacros_phase:n #1
355 {
356 \mode_leave_vertical:
357 \bool_if:NTF \l__chemmacros_phases_sub_bool
358 {
359 \ifnumequal{\value{LWR@lateximagedepth}}{0}
360 {
361 \textsubscript{ (#1) }
362 }
363 {
364 \chemformula_subscript:n { (#1) }
365 }
366 }
367 {
368 \skip_horizontal:N \l__chemmacros_phases_space_dim
369 \chemmacros_text:n { (#1) }
370 }
371 }
372
373 }{}% Module loaded.
374 }% AtBeginDocument
375 \AtBeginDocument{
376 \chemmacros_module_if_loaded:nTF{{mechanisms}}{
377 \PackageInfo{lwarp}{Patching~chemmacros~module~mechanisms}
378
379 \chemmacros_define_keys:nn {textmechanisms}
380 {
381 type .choice: ,
382 type / .code:n =
383 {
384 \__chemmacros_set_mechanisms:nnn { S }
385 {
386 \textsubscript{N}
387 }
388 { }
389 } ,
390 type / 1 .code:n =
391 {
392 \__chemmacros_set_mechanisms:nnn { S }
393 {
394 \textsubscript{N}
395 1
396 }
397 { }
398 } ,
399 type / 2 .code:n =
400 {
401 \__chemmacros_set_mechanisms:nnn { S }
402 {
403 \textsubscript{N}
404 2
405 }
406 { }
407 } ,
408 type / se .code:n =
409 {
410 \__chemmacros_set_mechanisms:nnn { S }
411 {
412 \textsubscript{E}
413 }
414 { }
415 } ,
416 type / 1e .code:n =
417 {
418 \__chemmacros_set_mechanisms:nnn { S }
419 {
420 \textsubscript{E}
421 1
422 }
423 { }
424 } ,
425 type / 2e .code:n =
426 {
427 \__chemmacros_set_mechanisms:nnn { S }
428 {
429 \textsubscript{E}
430 2
431 }
432 { }
433 } ,
434 type / ar .code:n =
435 {
436 \__chemmacros_set_mechanisms:nnn { S }
437 {
438 \textsubscript{E}
439 }
440 { Ar - }
441 } ,
442 type / e .code:n =
443 { \__chemmacros_set_mechanisms:nnn { E } { } { } } ,
444 type / e1 .code:n =
445 { \__chemmacros_set_mechanisms:nnn { E } { 1 } { } } ,
446 type / e2 .code:n =
447 { \__chemmacros_set_mechanisms:nnn { E } { 2 } { } } ,
448 type / cb .code:n =
449 {
450 \__chemmacros_set_mechanisms:nnn { E }
451 {
452 1
453 \textsubscript{cb}
454 }
455 { }
456 } ,
457 type .default:n =
458 }
459
460 \VerifyCommand[lwarp][chemmacros]{\chemmacros_mechanisms:n}
461 {2CF049E0C61235166A36565979D79933}
462
463 \cs_gset_protected:Npn \chemmacros_mechanisms:n #1
464 {
465 \tl_if_blank:nTF {#1}
466 { \chemmacros_set_keys:nn {textmechanisms} { type } }
467 { \chemmacros_set_keys:nn {textmechanisms} { type = #1 } }
468 \mbox
469 {
470 \tl_use:N \l__chemmacros_mechanisms_ar_tl
471 \tl_use:N \l__chemmacros_mechanisms_type_tl
472 \tl_use:N \l__chemmacros_mechanisms_mol_tl
473 }
474 }
475
476 \appto\LWR@restoreorigformatting{%
477 \cs_set_protected:Npn \chemmacros_mechanisms:n #1%
478 {%
479 \tl_if_blank:nTF {#1}%
480 { \chemmacros_set_keys:nn {mechanisms} { type } }%
481 { \chemmacros_set_keys:nn {mechanisms} { type = #1 } }%
482 \mbox%
483 {%
484 \tl_use:N \l__chemmacros_mechanisms_ar_tl%
485 \tl_use:N \l__chemmacros_mechanisms_type_tl%
486 \tl_use:N \l__chemmacros_mechanisms_mol_tl%
487 }%
488 }%
489 }
490
491 }{}% Module loaded.
492 }% AtBeginDocument
493 \AtBeginDocument{
494 \chemmacros_module_if_loaded:nTF{{newman}}{
495 \PackageInfo{lwarp}{Patching~chemmacros~module~newman}
496
497 \VerifyCommand[lwarp][chemmacros]{\newman}
498 {45E815D161E8467A51F5B04150DEC20C}
499
500 \RenewDocumentCommand \newman {od()m}%
501 {
502 \IfValueTF{#2}
503 {\begin{lateximage}[\textbackslash{}newman(#2)\{#3\}]*?}%
504 {\begin{lateximage}[\textbackslash{}newman\{#3\}]*?}%
505 \group_begin:
506 \IfNoValueF {#1} { \chemmacros_set_keys:nn {newman} {#1} }
507 \IfNoValueTF {#2}
508 { \chemmacros_newman:nn { } {#3} }
509 { \chemmacros_newman:nn {#2} {#3} }
510 \group_end:
511 \end{lateximage}
512 }%
513
514 }{}% Module loaded.
515 }% AtBeginDocument
516 \AtBeginDocument{
517 \chemmacros_module_if_loaded:nTF{{orbital}}{
518 \PackageInfo{lwarp}{Patching~chemmacros~module~orbital}
519
520 \VerifyCommand[lwarp][chemmacros]{\orbital}
521 {F8E338F96B2EBF6AFE4A91D37A58CD90}
522
523 \RenewDocumentCommand \orbital {om}
524 {
525 \IfValueTF{#1}
526 {
527 \begin{lateximage}[%
528 \textbackslash{}%
529 orbital{[}%
530 \LWR@HTMLsanitizedetokenized{\detokenize{#1}}%
531 {]}\{#2\}%
532 ]*?[][margin-left: 1em ; margin-right: 1em]%
533 }
534 {
535 \begin{lateximage}[%
536 \textbackslash{}orbital\{#2\}%
537 ]*?[][margin-left: 1em ; margin-right: 1em]%
538 }
539 \group_begin:
540 \chemmacros_set_keys:nn {orbital/type} {#2}
541 \IfNoValueTF {#1}
542 { \chemmacros_orbital:n { } }
543 { \chemmacros_orbital:n {#1} }
544 \group_end:
545 \end{lateximage}
546 }
547
548 }{}% Module loaded.
549 }% AtBeginDocument
550 \AtBeginDocument{
551 \chemmacros_module_if_loaded:nTF{{reactions}}{
552 \PackageInfo{lwarp}{Patching~chemmacros~module~reactions}
553
554 \VerifyCommand[lwarp][chemmacros]{\__chemmacros_declare_reaction_env:nnnn}
555 {E52CE623404E664FD0647E3A874F2702}
556
557 \cs_gset_protected:Npn \__chemmacros_declare_reaction_env:nnnn #1#2#3#4
558 {
559 \exp_args:Nnx \DeclareDocumentEnvironment {#1}
560 { \int_compare:nT { #3+0 = 0 } {!} O{} \prg_replicate:nn {#3+0} {m} }
561 {
562 \boolfalse{mathjax}% lwarp
563 \ifdefvoid{\LWR@ThisAltText}{% lwarp
564 \ThisAltText{-chemmacros-~reaction}% lwarp
565 }{}% lwarp
566 \chemmacros_add_reaction_description:n {##1}
567 \__chemmacros_begin_reaction:
568 \__chemmacros_reaction_read:nnw {#2} {#4}
569 }
570 {
571 \__chemmacros_end_reaction:
572 \gdef\LWR@ThisAltText{}% lwarp
573 \ignorespacesafterend
574 }
575 }
576
577 \cs_generate_variant:Nn \chemmacros_declare_reaction_env:nnnn {nnnV}
578
579 \RenewChemReaction {reaction} {equation}
580 \RenewChemReaction {reaction*} {equation*}
581 \RenewChemReaction {reactions} {align}
582 \RenewChemReaction {reactions*} {align*}
583
584 }{}% Module loaded.
585 }% AtBeginDocument
586 \VerifyCommand[lwarp][chemmacros]{\printreactants}
587 {18AD32DCD3F2F49C0369DA9ED9974CD7}
588
589 \StartDefiningTabulars% lwarp
590
591 \RenewDocumentCommand \printreactants {s}
592 {
593 \group_begin:
594 \chemmacros_set_keys:nn {reactants} { switch = false }
595 \int_step_variable:nNn
596 { \seq_count:N \g_chemnum_initiated_compounds_seq }
597 \l__chemmacros_reactants_tmpa_tl
598 {
599 \seq_put_right:Nx
600 \l__chemmacros_reactants_tmpa_seq
601 {
602 \chemnum_cmpd:nnne { \c_false_bool } { \c_true_bool } {}
603 {
604 \seq_item:NV
605 \g_chemnum_initiated_compounds_seq
606 \l__chemmacros_reactants_tmpa_tl
607 }
608 &
609 \bool_if:nT {#1}
610 {
611 \seq_item:NV
612 \g_chemnum_initiated_compounds_seq
613 \l__chemmacros_reactants_tmpa_tl
614 &
615 }
616 % TODO: expl3-command ??
617 \solvent
618 {
619 \seq_item:NV
620 \g_chemnum_initiated_compounds_seq
621 \l__chemmacros_reactants_tmpa_tl
622 }
623 \tabularnewline
624 }
625 \tl_set:Nx
626 \l__chemmacros_reactants_tmpb_tl
627 {
628 \seq_item:NV
629 \g_chemnum_initiated_compounds_seq
630 \l__chemmacros_reactants_tmpa_tl
631 }
632 \chemmacros_reactants_list_subreactant:Vn
633 \l__chemmacros_reactants_tmpb_tl
634 {#1}
635 }
636 % TODO: longtable ?
637 % table customizable?
638 % first draft of two styles
639 \par
640 \noindent
641 \bool_if:NTF \l__chemmacros_reactants_printreactants_style_bool
642 {
643 \str_case:Vn \l__chemmacros_reactants_printreactants_style_str
644 {
645 {xltabular}
646 {
647 \chemmacros_if_package_loaded:nTF {xltabular}
648 {
649 \bool_if:nTF {#1}
650 {
651 \begin {xltabular}
652 { \textwidth }
653 { @{}ll>{\raggedright\arraybackslash}X@{} }
654 }
655 {
656 \begin {xltabular}
657 { \textwidth }
658 { @{}l>{\raggedright\arraybackslash}X@{} }
659 }
660 \seq_use:Nn \l__chemmacros_reactants_tmpa_seq { }
661 \end{xltabular}
662 }
663 {
664 \msg_expandable_error:nnnn
665 {chemmacros}
666 {package-not-loaded}
667 { \printreactants }
668 {xltabular}
669 }
670 }
671 {longtable}
672 {
673 \chemmacros_if_package_loaded:nTF {longtable}
674 {
675 \bool_if:nTF {#1}
676 {
677 \begin {longtable}[l]
678 { @{}ll>{\raggedright\arraybackslash}p{0.6\textwidth}@{} }
679 }
680 {
681 \begin {longtable}[l]
682 { @{}l>{\raggedright\arraybackslash}p{0.9\textwidth}@{} }
683 }
684 \seq_use:Nn \l__chemmacros_reactants_tmpa_seq { }
685 \end{longtable}
686 }
687 {
688 \msg_expandable_error:nnnn
689 {chemmacros}
690 {package-not-loaded}
691 { \printreactants }
692 {longtable}
693 }
694 }
695 }
696 }
697 {
698 \msg_warning:nn {chemmacros} {missing-printreactants-style}
699 }
700 \group_end:
701 }
702
703 \VerifyCommand[lwarp][chemmacros]{\chemmacros_reactants_list_subreactant:nn}
704 {50553A53C2149BD3ADA8AE0FAB0C79C4}
705
706 \cs_gset_protected:Npn \chemmacros_reactants_list_subreactant:nn #1#2
707 {
708 \chemnum_if_subcompounds:nT {#1}
709 {
710 \int_step_variable:nNn
711 { \chemnum_count_subcompounds:n {#1} }
712 \l__chemmacros_reactants_tmpa_tl
713 {
714 \seq_put_right:Nx
715 \l__chemmacros_reactants_tmpa_seq
716 {
717 \chemnum_cmpd:nnne { \c_false_bool } { \c_true_bool } {}
718 {
719 \exp_not:n {#1}
720 \exp_not:V \l_chemnum_compound_separator_tl
721 \chemnum_get_subcompound:nV
722 {#1}
723 \l__chemmacros_reactants_tmpa_tl
724 }
725 &
726 \bool_if:nT {#2}
727 {
728 #1
729 \l_chemnum_compound_separator_tl
730 \chemnum_get_subcompound:nV
731 {#1}
732 \l__chemmacros_reactants_tmpa_tl
733 &
734 }
735 % TODO: expl3-command ??
736 \solvent
737 {
738 #1
739 \l_chemnum_compound_separator_tl
740 \chemnum_get_subcompound:nV
741 {#1}
742 \l__chemmacros_reactants_tmpa_tl
743 }
744 \tabularnewline
745 }
746 }
747 }
748 }
749 \cs_generate_variant:Nn \chemmacros_reactants_list_subreactant:nn {V}
750
751 \StopDefiningTabulars% lwarp
752 \AtBeginDocument{
753 \chemmacros_module_if_loaded:nTF{{redox}}{
754 \PackageInfo{lwarp}{Patching~chemmacros~module~redox}
755
756 \NewDocumentCommand \LWR@chemmacros@ox { s m >{\SplitArgument{1}{,}}m }
757 {
758 \IfBooleanTF {#1}
759 { \chemmacros_ox:nnnn {#1} {#2} #3 }
760 { \chemmacros_ox:nnnn { } {#2} #3 }
761 }
762
763 \VerifyCommand[lwarp][chemmacros]{\ox}
764 {06B84CC6B38302F75169D5B90D8D29AA}
765
766 \RenewDocumentCommand \ox { s O{} m }
767 {
768 \begingroup
769 \boolfalse{mathjax}
770 \IfBooleanTF {#1}
771 {
772 \LWR@subsingledollar*{% yes hash
773 \textbackslash{}%
774 ox*%
775 \{%
776 \LWR@HTMLsanitizedetokenized{\detokenize{#3}}%
777 \}% alt
778 }{%
779 star \protect\LWR@HTMLsanitizedetokenized{\detokenize\expandafter{#2}}%
780 }{%
781 \LWR@chemmacros@ox* {#2} {#3}% contents
782 }%
783 }
784 {
785 \LWR@subsingledollar*{% yes hash
786 \textbackslash{}%
787 ox%
788 \{%
789 \LWR@HTMLsanitizedetokenized{\detokenize{#3}}%
790 \}% alt
791 }{%
792 \protect\LWR@HTMLsanitizedetokenized{\detokenize\expandafter{#2}}%
793 }{%
794 \LWR@chemmacros@ox {#2} {#3}% contents
795 }%
796 }
797 \endgroup
798 }
799
800 }{}% Module loaded.
801 }% AtBeginDocument
802 \AtBeginDocument{
803 \chemmacros_module_if_loaded:nTF{{scheme}}{
804 \PackageInfo{lwarp}{Patching~chemmacros~module~scheme}
805
806 \ifdefstring{\schemename}{los}{
807 \SetupFloatingEnvironment{scheme}{
808 name = \chemmacros_translate:n {scheme-name}
809 }
810 }{}
811
812 }{}% Module loaded.
813 }% AtBeginDocument
814 \AtBeginDocument{
815 \chemmacros_module_if_loaded:nTF{{spectroscopy}}{
816 \PackageInfo{lwarp}{Patching~chemmacros~module~spectroscopy}
817
818 \VerifyCommand[lwarp][chemmacros]{\__chemmacros_nmr_base:nn}
819 {EDE669CC90B085080E3F96DB754836D5}
820
821 \cs_gset_protected:Npn \__chemmacros_nmr_base:nn #1#2
822 {
823 \group_begin:
824 \tl_use:N \l__chemmacros_nmr_base_format_tl
825 \tl_if_blank:VF \g__chemmacros_nmr_element_coupled_tl
826 {
827 \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl { \{ }
828 \tl_put_right:Nn \g__chemmacros_nmr_element_coupled_tl { \} }
829 }
830 \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl {#2}
831 \textsuperscript{#1}
832 \tl_if_blank:VF \g__chemmacros_nmr_element_coupled_tl
833 {
834 \bool_if:NTF \l__chemmacros_nmr_parse_bool
835 { \chemformula_ch:nV {} \g__chemmacros_nmr_element_coupled_tl }
836 { \chemmacros_formula:V \g__chemmacros_nmr_element_coupled_tl }
837 }
838 \tl_use:N \l__chemmacros_nmr_element_method_connector_tl
839 \tl_use:N \l__chemmacros_nmr_method_tl
840 \group_end:
841 }
842
843 \VerifyCommand[lwarp][chemmacros]{\chemmacros_nmr_position:n}
844 {637FDE0E801CF4052274FF60A12A38F0}
845
846 \cs_gset_protected:Npn \chemmacros_nmr_position:n #1
847 {
848 \chemmacros_formula:x
849 {
850 \exp_not:V \g__chemmacros_nmr_element_tl
851 \bool_if:NF \l__chemmacros_nmr_position_side_bool
852 {
853 \tl_if_eq:NnTF \l__chemmacros_nmr_position_tl {^}% lwarp
854 { \textsuperscript{\exp_not:n { {#1} }} }% lwarp
855 { \textsubscript{\exp_not:n { {#1} }} }% lwarp
856 }
857 }
858 \bool_if:NT \l__chemmacros_nmr_position_side_bool
859 {
860 \tl_use:N \l__chemmacros_nmr_position_tl
861 \__chemmacros_nmr_position:n {#1}
862 }
863 }
864
865 \VerifyCommand[lwarp][chemmacros]{\__chemmacros_nmr_coupling:w}
866 {4D1E7321CA2F8C7EA2E4F56FB3A26EED}
867
868 \cs_gset_protected:Npn \__chemmacros_nmr_coupling:w (#1;#2)
869 {
870 \tl_set:Nn \l__chemmacros_nmr_coupling_bonds_tl
871 {
872 \l__chemmacros_nmr_coupling_bonds_pre_tl
873 #1
874 \l__chemmacros_nmr_coupling_bonds_post_tl
875 }
876 \bool_if:NTF \l__chemmacros_nmr_coupling_nuclei_sub_bool
877 {
878 \tl_set:Nn \l__chemmacros_nmr_coupling_nuclei_tl
879 {
880 \textsubscript% lwarp
881 {
882 \l__chemmacros_nmr_coupling_nuclei_pre_tl
883 \chemmacros_formula:n {#2}
884 \l__chemmacros_nmr_coupling_nuclei_post_tl
885 }
886 }
887 }
888 {
889 \tl_set:Nn \l__chemmacros_nmr_coupling_nuclei_tl
890 {
891 \l__chemmacros_nmr_coupling_nuclei_pre_tl
892 \chemmacros_formula:n {#2}
893 \l__chemmacros_nmr_coupling_nuclei_post_tl
894 }
895 }
896 \__chemmacros_nmr_coupling_aux_i:w
897 }
898 \AfterEndPreamble{% After \AtBeginDocument
899
900 \VerifyCommand[lwarp][chemmacros]{\chemmacros_nmr:nnnn}
901 {FD67505420F044B2CA8E7CBD05B1ECEB}
902
903 \cs_gset_protected:Npn \chemmacros_nmr:nnnn #1#2#3#4
904 {
905 \bool_if:NT \l__chemmacros_nmr_list_bool { \item \scan_stop: }
906 \group_begin:
907 \mode_leave_vertical:
908 \bool_set_false:N \l__chemmacros_nmr_frequency_bool
909 \bool_set_false:N \l__chemmacros_nmr_solvent_bool
910 \tl_if_empty:nF {#3}
911 { \bool_set_true:N \l__chemmacros_nmr_frequency_bool }
912 \tl_if_empty:nF {#4}
913 { \bool_set_true:N \l__chemmacros_nmr_solvent_bool }
914 \bool_if:nT
915 {
916 \l__chemmacros_nmr_frequency_bool
917 ||
918 \l__chemmacros_nmr_solvent_bool
919 }
920 { \bool_set_true:N \l__chemmacros_nmr_delimiters_bool }
921 \bool_if:nT
922 {
923 \l__chemmacros_nmr_frequency_bool
924 &&
925 \l__chemmacros_nmr_solvent_bool
926 }
927 { \bool_set_true:N \l__chemmacros_nmr_comma_bool }
928 \tl_if_empty:nTF {#2}
929 {
930 \__chemmacros_nmr_nucleus:VV
931 \l__chemmacros_nmr_isotope_default_tl
932 \l__chemmacros_nmr_element_default_tl
933 }
934 { \__chemmacros_nmr_nucleus:w #2 \q_stop }
935 \mode_if_math:TF
936 {
937 \text
938 {
939 \group_begin:
940 \tl_use:N \l__chemmacros_nmr_format_tl
941 \LWR@textcurrentcolor{\LWR@textcurrentfont{% lwarp
942 \__chemmacros_nmr_base:VV
943 \g__chemmacros_nmr_isotope_tl
944 \g__chemmacros_nmr_element_tl
945 \bool_if:NT \l__chemmacros_nmr_delimiters_bool
946 { ~ ( }
947 \bool_if:NT \l__chemmacros_nmr_frequency_bool
948 { \__chemmacros_nmr_frequency:n {#3} }
949 \bool_if:NT \l__chemmacros_nmr_comma_bool
950 { , ~ }
951 \bool_if:NT \l__chemmacros_nmr_solvent_bool
952 { \chemmacros_formula:n {#4} }
953 \bool_if:NT \l__chemmacros_nmr_delimiters_bool
954 { ) }
955 \tl_if_blank:nT {#1} {:~}
956 }}% lwarp
957 \group_end:
958 }
959 \tl_if_blank:nT {#1}
960 {
961 \delta
962 \text { \l__chemmacros_nmr_delta_tl }
963 \bool_if:NT \l__chemmacros_nmr_use_equal_bool {=}
964 }
965 }
966 {
967 \group_begin:
968 \tl_use:N \l__chemmacros_nmr_format_tl
969 \LWR@textcurrentcolor{\LWR@textcurrentfont{% lwarp
970 \__chemmacros_nmr_base:VV
971 \g__chemmacros_nmr_isotope_tl
972 \g__chemmacros_nmr_element_tl
973 \bool_if:NT \l__chemmacros_nmr_delimiters_bool
974 {~(}
975 \bool_if:NT \l__chemmacros_nmr_frequency_bool
976 { \__chemmacros_nmr_frequency:n {#3} }
977 \bool_if:NT \l__chemmacros_nmr_comma_bool
978 {,~}
979 \bool_if:NT \l__chemmacros_nmr_solvent_bool
980 {
981 \bool_if:NTF \l__chemmacros_nmr_parse_bool
982 {\ch{#4}}% lwarp
983 {#4}
984 }
985 \bool_if:NT \l__chemmacros_nmr_delimiters_bool
986 {)}
987 }}% lwarp
988 \tl_if_blank:nT {#1} {:}
989 \group_end:
990 \tl_if_blank:nT {#1}
991 {
992 \tl_use:N \c_space_tl
993 \c_math_toggle_token
994 \delta
995 \c_math_toggle_token
996 \l__chemmacros_nmr_delta_tl
997 \bool_if:NT \l__chemmacros_nmr_use_equal_bool {~=}
998 }
999 }
1000 \group_end:
1001 }
1002 }% AfterEndPremble
1003
1004 \VerifyCommand[lwarp][chemmacros]{\chemmacros_data:w}
1005 {30A6134DE00E9850E074854B48644833}
1006
1007 \RenewDocumentCommand \chemmacros_data:w { smo }
1008 {
1009 \bool_if:NT \l__chemmacros_nmr_list_bool { \item }
1010 {
1011 \tl_use:N \l__chemmacros_nmr_format_tl
1012 \LWR@textcurrentcolor{\LWR@textcurrentfont{% lwarp
1013 #2
1014 \IfNoValueF {#3} { ~ ( #3 ) }
1015 \IfBooleanT {#1} { \bool_if:NT \l__chemmacros_nmr_use_equal_bool { : } }
1016 }}% lwarp
1017 }
1018 \IfBooleanF {#1} { \bool_if:NT \l__chemmacros_nmr_use_equal_bool { ~ = } }
1019 }
1020
1021 }{}% Module loaded.
1022 }% AtBeginDocument
1023 \AtBeginDocument{
1024 \chemmacros_module_if_loaded:nTF{{thermodynamics}}{
1025 \PackageInfo{lwarp}{Patching~chemmacros~module~thermodynamics}
1026
1027 \VerifyCommand[lwarp][chemmacros]{\chemmacros_state:nnnnnn}
1028 {C5B35D9405E380ABE9A9CE849F46EE6D}
1029
1030 \cs_gset_protected:Npn \chemmacros_state:nnnnnn #1#2#3#4#5#6
1031 {
1032 \group_begin:
1033 \chemmacros_set_keys:ne {thermodynamics}
1034 {
1035 \exp_not:n {#1} ,
1036 \tl_if_novalue:nF {#2} { subscript-left = \exp_not:n {#2} , }
1037 \tl_if_novalue:nF {#3} { superscript-left = \exp_not:n {#3} , }
1038 \tl_if_novalue:nF {#5} { subscript-right = \exp_not:n {#5} , }
1039 \tl_if_novalue:nF {#6} { superscript-right = \exp_not:n {#6} }
1040 }
1041 \LWR@subsingledollar*{% yes hashing
1042 \textbackslash{}state%
1043 \{\LWR@HTMLsanitizedetokenized{\detokenize{#4}}\}% alt
1044 }{%
1045 chemmacros_state% add'l hashing
1046 #1% options
1047 LSP \tl_use:N \l__chemmacros_state_sp_left_tl% super/subscripts
1048 LSB \tl_use:N \l__chemmacros_state_sb_left_tl
1049 RSP \tl_use:N \l__chemmacros_state_sp_right_tl
1050 RSB \tl_use:N \l__chemmacros_state_sb_right_tl
1051 }
1052 {
1053 \LWR@origensuredmath
1054 {
1055 \chemmacros_text:V \l__chemmacros_state_pre_tl
1056 \c_math_superscript_token
1057 { \chemmacros_text:V \l__chemmacros_state_sp_left_tl }
1058 \tl_if_empty:NTF \l__chemmacros_state_sb_left_tl
1059 {}
1060 {
1061 \c_math_subscript_token
1062 { \chemmacros_text:V \l__chemmacros_state_sb_left_tl }
1063 }
1064 #4
1065 \c_math_superscript_token
1066 { \chemmacros_text:V \l__chemmacros_state_sp_right_tl }
1067 \tl_if_empty:NTF \l__chemmacros_state_sb_right_tl
1068 {}
1069 {
1070 \c_math_subscript_token
1071 { \chemmacros_text:V \l__chemmacros_state_sb_right_tl }
1072 }
1073 \chemmacros_text:V \l__chemmacros_state_post_tl
1074 }
1075 }
1076 \group_end:
1077 }
1078 \cs_generate_variant:Nn \chemmacros_state:nnnnnn { nVVVVV }
1079
1080 \VerifyCommand[lwarp][chemmacros]{\chemmacros_declare_state:Nn}
1081 {3C1386935B85ED732A283627DA403FBE}
1082
1083 \cs_gset_protected:Npn \chemmacros_declare_state:Nn #1#2
1084 {
1085 \chemmacros_define_keys:xn
1086 {thermodynamics/\chemmacros_remove_backslash:N #1}
1087 {
1088 pre .meta:nn = {chemmacros/thermodynamics} { pre = ##1 } ,
1089 post .meta:nn = {chemmacros/thermodynamics} { post = ##1 } ,
1090 superscript-left .meta:nn = {chemmacros/thermodynamics} { superscript-left = ##1 } ,
1091 superscript-right .meta:nn = {chemmacros/thermodynamics} { superscript-right = ##1 } ,
1092 superscript .meta:n = { superscript-right = ##1 } ,
1093 subscript-left .meta:nn = {chemmacros/thermodynamics} { subscript-left = ##1 } ,
1094 subscript-right .meta:nn = {chemmacros/thermodynamics} { subscript-right = ##1 } ,
1095 subscript .meta:n = { subscript-left = ##1 } ,
1096 subscript-pos .choices:nn =
1097 { left , right }
1098 { \tl_set_eq:NN \l__chemmacros_state_sb_pos_tl \l_keys_choice_tl } ,
1099 symbol .tl_set:N = \l__chemmacros_state_symbol_tl ,
1100 unit .tl_set:N = \l__chemmacros_state_unit_tl
1101 }
1102 \DeclareDocumentCommand #1 { sO{}D(){}m }
1103 {
1104 \group_begin:
1105 \chemmacros_set_keys:en
1106 {thermodynamics/\chemmacros_remove_backslash:N #1}
1107 {#2}
1108 \tl_if_blank:nF {##3}
1109 {
1110 \chemmacros_set_keys:ne {thermodynamics}
1111 { subscript-\l__chemmacros_state_sb_pos_tl = \exp_not:n {##3} }
1112 }
1113 \chemmacros_state:nVVVVV
1114 {##2}
1115 \c_novalue_tl
1116 \c_novalue_tl
1117 \l__chemmacros_state_symbol_tl
1118 \c_novalue_tl
1119 \c_novalue_tl
1120 \chemmacros_set_keys_groups:nnn {thermodynamics} {variables} {##2}
1121 \IfBooleanF {##1} { = \qty {##4} { \l__chemmacros_state_unit_tl } }
1122 \group_end:
1123 }
1124 }
1125 \RenewChemState \enthalpy { symbol = H , unit = \kilo\joule\per\mole }
1126 \RenewChemState \entropy { symbol = S , unit = \joule\per\kelvin\per\mole , pre = }
1127 \RenewChemState \gibbs { symbol = G , unit = \kilo\joule\per\mole }
1128
1129 }{}% Module loaded.
1130 }% AtBeginDocument
1131 \ExplSyntaxOff
1132
1133
1134 \endinput
1135 %%
1136 %% End of file `lwarp-chemmacros.sty'.