| 1 |
%% |
| 2 |
%% This is file `lwarp-chemformula.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% lwarp.dtx (with options: `chemformula') |
| 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{chemformula}[2022/01/23] |
| 20 |
|
| 21 |
\ExplSyntaxOn |
| 22 |
\VerifyCommand[lwarp][chemformula]{\ch}{6D4331F95E9FF2E011E310B1F8C5487E} |
| 23 |
|
| 24 |
\RenewDocumentCommand \ch { O{}m } |
| 25 |
{% |
| 26 |
\ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% lwarp |
| 27 |
{% |
| 28 |
\chemformula_ch:nn {#1} {#2}% original |
| 29 |
}% |
| 30 |
{% |
| 31 |
\begingroup% |
| 32 |
\boolfalse{mathjax}% |
| 33 |
\LWR@subsingledollar*{% lwarp |
| 34 |
\textbackslash{}% |
| 35 |
ch% |
| 36 |
\{% |
| 37 |
\LWR@HTMLsanitizedetokenized{\detokenize{#2}}% |
| 38 |
\}% alt text |
| 39 |
}{% |
| 40 |
\protect\LWR@HTMLsanitizedetokenized{% |
| 41 |
\detokenize\expandafter{#1}% |
| 42 |
}% add'l hashing |
| 43 |
}% |
| 44 |
{% |
| 45 |
\chemformula_ch:nn {#1} {#2}% original |
| 46 |
}% |
| 47 |
\endgroup% |
| 48 |
}% |
| 49 |
} |
| 50 |
\IfPackageAtLeastTF{chemformula}{2019/10/13}{ |
| 51 |
|
| 52 |
\VerifyCommand[lwarp][chemformula]{\chemformula_chcpd:nn} |
| 53 |
{C1E882F2C1137D429AE4F789C84E7428} |
| 54 |
|
| 55 |
\cs_gset_protected:Npn \chemformula_chcpd:nn #1#2 |
| 56 |
{ |
| 57 |
\begingroup% |
| 58 |
\boolfalse{mathjax}% |
| 59 |
\LWR@subsingledollar*{% lwarp |
| 60 |
\textbackslash{}% alt tag |
| 61 |
chcpd% |
| 62 |
\{% |
| 63 |
\LWR@HTMLsanitizedetokenized{\detokenize{#2}}% |
| 64 |
\}% |
| 65 |
}{% |
| 66 |
\protect\LWR@HTMLsanitizedetokenized{\detokenize\expandafter{#1}}% |
| 67 |
}{% original |
| 68 |
\group_begin: |
| 69 |
\tl_if_blank:nF {#2} |
| 70 |
{ |
| 71 |
\keys_set:nn {chemformula} {#1} |
| 72 |
\__chemformula_save_catcodes: |
| 73 |
\__chemformula_sanitize:Nn |
| 74 |
\l__chemformula_chemformula_tmpa_tl |
| 75 |
{#2} |
| 76 |
\__chemformula_input_compound_no_check:NV |
| 77 |
\l__chemformula_compound_tl |
| 78 |
\l__chemformula_chemformula_tmpa_tl |
| 79 |
\__chemformula_prepare_output:NV |
| 80 |
\l__chemformula_compound_tl |
| 81 |
\l__chemformula_catcodes_tl |
| 82 |
\chemformula_write:V \l__chemformula_compound_tl |
| 83 |
} |
| 84 |
\group_end: |
| 85 |
} |
| 86 |
\endgroup |
| 87 |
} |
| 88 |
}% later than 2019/10/13 |
| 89 |
{% earlier than 2019/10/13 |
| 90 |
\cs_gset_protected:Npn \chemformula_chcpd:nn #1#2 |
| 91 |
{ |
| 92 |
\begingroup% |
| 93 |
\boolfalse{mathjax}% |
| 94 |
\LWR@subsingledollar*{% lwarp |
| 95 |
\textbackslash{}% alt tag |
| 96 |
chcpd% |
| 97 |
\{% |
| 98 |
\LWR@HTMLsanitizedetokenized{\detokenize{#2}}% |
| 99 |
\}% |
| 100 |
}{% |
| 101 |
\protect\LWR@HTMLsanitizedetokenized{\detokenize\expandafter{#1}}% |
| 102 |
}{% original |
| 103 |
\group_begin: |
| 104 |
\tl_if_blank:nF {#2} |
| 105 |
{ |
| 106 |
\keys_set:nn {chemformula} {#1} |
| 107 |
\__chemformula_save_catcodes: |
| 108 |
\__chemformula_sanitize:Nn |
| 109 |
\l__chemformula_chemformula_tmpa_tl |
| 110 |
{#2} |
| 111 |
\__chemformula_input_compound_no_check:NV |
| 112 |
\l__chemformula_compound_tl |
| 113 |
\l__chemformula_chemformula_tmpa_tl |
| 114 |
\__chemformula_prepare_output:N \l__chemformula_compound_tl |
| 115 |
\chemformula_write:V \l__chemformula_compound_tl |
| 116 |
} |
| 117 |
\group_end: |
| 118 |
} |
| 119 |
\endgroup |
| 120 |
} |
| 121 |
}% earlier than 2019/10/13 |
| 122 |
\VerifyCommand[lwarp][chemformula]{\charrow} |
| 123 |
{31D2B3405541C0B128504C94C5046713} |
| 124 |
|
| 125 |
\RenewDocumentCommand \charrow { mO{}O{} } |
| 126 |
{ |
| 127 |
\begin{lateximage}[-chemformula- charrow] |
| 128 |
\group_begin: |
| 129 |
\__chemformula_draw_arrow:nnn {#1} {#2} {#3} |
| 130 |
\group_end: |
| 131 |
\end{lateximage} |
| 132 |
} |
| 133 |
\VerifyCommand[lwarp][chemformula]{\chname} |
| 134 |
{3C697C09415EE601DE035EEDD6D3BA4D} |
| 135 |
|
| 136 |
\RenewDocumentCommand \chname { R(){}R(){} } |
| 137 |
{ |
| 138 |
\begin{lateximage}*[% |
| 139 |
\textbackslash{}% |
| 140 |
chname% |
| 141 |
(\LWR@HTMLsanitizedetokenized{\detokenize{#1}})% |
| 142 |
(\LWR@HTMLsanitizedetokenized{\detokenize{#2}})% |
| 143 |
]*?% |
| 144 |
\chemformula_chwritebelow:nn {#1} {#2}% |
| 145 |
\end{lateximage}% |
| 146 |
} |
| 147 |
\VerifyCommand[lwarp][chemformula]{\chlewis} |
| 148 |
{371F2DD32AA98170F43CFDA71177226B} |
| 149 |
|
| 150 |
\RenewDocumentCommand \chlewis { O{}mm } |
| 151 |
{ |
| 152 |
\begingroup% |
| 153 |
\boolfalse{mathjax}% |
| 154 |
\LWR@subsingledollar*{\textbackslash{}chlewis\{#2\}\{#3\}}% |
| 155 |
{ |
| 156 |
\protect\LWR@HTMLsanitizedetokenized{\detokenize\expandafter{#1}}% |
| 157 |
}{ |
| 158 |
\chemformula_lewis:nnn {#1} {#2} {#3} |
| 159 |
} |
| 160 |
\endgroup% |
| 161 |
} |
| 162 |
\bool_new:N \l__chemformula_first_last_LWRdollar_bool |
| 163 |
\VerifyCommand[lwarp][chemformula]{\__chemformula_input_escape_math:n} |
| 164 |
{5318E84E9168C2F123781D2EA8CFA871} |
| 165 |
|
| 166 |
\cs_gset_protected:Npn \__chemformula_input_escape_math:n #1 |
| 167 |
{ |
| 168 |
\__chemformula_first_last_math:n {#1} |
| 169 |
\bool_if:NT \l__chemformula_first_last_dollar_bool |
| 170 |
{ |
| 171 |
\bool_set_true:N \l__chemformula_first_last_math_bool |
| 172 |
\__chemformula_read_escape_dollar:w #1 \q_nil |
| 173 |
} |
| 174 |
\bool_if:NT \l__chemformula_first_last_mathbraces_bool |
| 175 |
{ |
| 176 |
\bool_set_true:N \l__chemformula_first_last_math_bool |
| 177 |
\__chemformula_read_escape_mathbraces:w #1 \q_nil |
| 178 |
} |
| 179 |
\bool_if:NT \l__chemformula_first_last_LWRdollar_bool% lwarp |
| 180 |
{ |
| 181 |
\bool_set_true:N \l__chemformula_first_last_math_bool% lwarp |
| 182 |
\__chemformula_read_escape_LWRdollar:w #1 \q_nil% lwarp |
| 183 |
} |
| 184 |
} |
| 185 |
\begingroup |
| 186 |
\catcode`\$=\active |
| 187 |
|
| 188 |
\cs_new_protected:Npn \__chemformula_read_escape_LWRdollar:w $#1$ \q_nil |
| 189 |
{ |
| 190 |
\__chemformula_read_escape_math:n {#1} |
| 191 |
} |
| 192 |
|
| 193 |
\endgroup |
| 194 |
\cs_new_protected:Npn \__chemformula_bool_cs_set_if_first_last:NnNN #1#2#3#4 |
| 195 |
{ |
| 196 |
\int_zero:N \l__chemformula_tmpa_int |
| 197 |
\int_zero:N \l__chemformula_tmpb_int |
| 198 |
\int_set:Nn \l__chemformula_tmpa_int { \tl_count:n {#2} } |
| 199 |
\tl_map_inline:nn {#2} |
| 200 |
{ |
| 201 |
\int_incr:N \l__chemformula_tmpb_int |
| 202 |
\int_compare:nT { \l__chemformula_tmpb_int = 1 } |
| 203 |
{ |
| 204 |
\ifdefstrequal{##1}{#3}% lwarp |
| 205 |
{ |
| 206 |
\bool_set_true:N #1 |
| 207 |
}% lwarp |
| 208 |
{} |
| 209 |
} |
| 210 |
\int_compare:nT { \l__chemformula_tmpb_int = \l__chemformula_tmpa_int } |
| 211 |
{ |
| 212 |
\ifdefstrequal{##1}{#4} |
| 213 |
{} |
| 214 |
{ |
| 215 |
\bool_set_false:N #1 |
| 216 |
} |
| 217 |
} |
| 218 |
} |
| 219 |
} |
| 220 |
\VerifyCommand[lwarp][chemformula]{\__chemformula_first_last_math:n} |
| 221 |
{B464BC6E81CAC84BE00FEE988970CE96} |
| 222 |
|
| 223 |
\cs_gset_protected:Npn \__chemformula_first_last_math:n #1 |
| 224 |
{ |
| 225 |
\bool_set_false:N \l__chemformula_first_last_math_bool |
| 226 |
\bool_set_false:N \l__chemformula_first_last_dollar_bool |
| 227 |
\bool_set_false:N \l__chemformula_first_last_LWRdollar_bool% lwarp |
| 228 |
\bool_set_false:N \l__chemformula_first_last_mathbraces_bool |
| 229 |
\__chemformula_bool_set_if_first_last:Nnnn |
| 230 |
\l__chemformula_first_last_dollar_bool |
| 231 |
{#1} |
| 232 |
{ $ } { $ } |
| 233 |
\bool_if:NF \l__chemformula_first_last_dollar_bool |
| 234 |
{ |
| 235 |
\__chemformula_bool_set_if_first_last:Nnnn |
| 236 |
\l__chemformula_first_last_mathbraces_bool |
| 237 |
{#1} |
| 238 |
{ \( } { \) } |
| 239 |
\bool_if:NF \l__chemformula_first_last_mathbraces_bool% lwarp |
| 240 |
{ |
| 241 |
\__chemformula_bool_cs_set_if_first_last:NnNN |
| 242 |
\l__chemformula_first_last_LWRdollar_bool |
| 243 |
{#1} |
| 244 |
{ \LWR@newsingledollar } { \LWR@newsingledollar } |
| 245 |
}% lwarp |
| 246 |
} |
| 247 |
} |
| 248 |
\ExplSyntaxOff |
| 249 |
|
| 250 |
\endinput |
| 251 |
%% |
| 252 |
%% End of file `lwarp-chemformula.sty'. |