summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-03-25 21:28:55 +0000
committerKarl Berry <karl@freefriends.org>2018-03-25 21:28:55 +0000
commit67a0d74b3ba80ada1c0ae1e1b3fc523bd0136699 (patch)
tree8c0f3bd63b4f10cbc26da1e5e8fe305286e8aa63 /Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty
parentb0d484d66da70017e2f7617211629a579a3b6056 (diff)
lwarp (24mar18)
git-svn-id: svn://tug.org/texlive/trunk@47115 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty')
-rw-r--r--Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty177
1 files changed, 177 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty b/Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty
new file mode 100644
index 00000000000..16017fe39ef
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty
@@ -0,0 +1,177 @@
+%%
+%% This is file `lwarp-chemformula.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx (with options: `chemformula')
+%% This is a generated file.
+%% Copyright 2016-2018 Brian Dunn
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\LWR@ProvidesPackagePass{chemformula}[2017/03/23]
+
+\ExplSyntaxOn
+\RenewDocumentCommand \ch { O{}m }
+ {%
+ \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% lwarp
+ {
+ \chemformula_ch:nn {#1} {#2}% original
+ }
+ {
+ \begingroup%
+ \boolfalse{mathjax}%
+ \LWR@subsingledollar*{% lwarp
+ \textbackslash{}ch\{\LWR@HTMLsanitize{#2}\}% alt text
+ }{%
+ \LWR@HTMLsanitize{#1}% add'l hashing
+ }%
+ {%
+ \chemformula_ch:nn {#1} {#2}% original
+ }%
+ \endgroup%
+ }
+ }
+\cs_gset_protected:Npn \chemformula_chcpd:nn #1#2
+ {
+ \begingroup%
+ \boolfalse{mathjax}%
+ \LWR@subsingledollar*{% lwarp
+ \textbackslash{}chcpd\{\LWR@HTMLsanitize{#2}\}%
+ }{%
+ \LWR@HTMLsanitize{#1}%
+ }{% original
+ \group_begin:
+ \tl_if_blank:nF {#2}
+ {
+ \keys_set:nn {chemformula} {#1}
+ \__chemformula_save_catcodes:
+ \__chemformula_sanitize:Nn
+ \l__chemformula_chemformula_tmpa_tl
+ {#2}
+ \__chemformula_input_compound_no_check:NV
+ \l__chemformula_compound_tl
+ \l__chemformula_chemformula_tmpa_tl
+ \__chemformula_prepare_output:N \l__chemformula_compound_tl
+ \chemformula_write:V \l__chemformula_compound_tl
+ }
+ \group_end:
+ }
+ \endgroup
+ }
+\RenewDocumentCommand \charrow { mO{}O{} }
+{
+ \begin{lateximage}[(charrow)]
+ \group_begin:
+ \__chemformula_draw_arrow:nnn {#1} {#2} {#3}
+ \group_end:
+ \end{lateximage}
+}
+\RenewDocumentCommand \chname { R(){}R(){} }
+ {
+ \begin{lateximage}*[%
+ \textbackslash{}chname(\LWR@HTMLsanitize{#1})(\LWR@HTMLsanitize{#2})
+ ]%
+ \chemformula_chwritebelow:nn {#1} {#2}
+ \end{lateximage}
+ }
+\RenewDocumentCommand \chlewis { O{}mm }
+ {
+ \begingroup%
+ \boolfalse{mathjax}%
+ \LWR@subsingledollar*{\textbackslash{}chlewis\{#2\}\{#3\}}{#1}{
+ \chemformula_lewis:nnn {#1} {#2} {#3}
+ }
+ \endgroup%
+ }
+\bool_new:N \l__chemformula_first_last_LWRdollar_bool
+\cs_gset_protected:Npn \__chemformula_input_escape_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
+ }
+ \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
+ }
+ \bool_if:NT \l__chemformula_first_last_LWRdollar_bool% lwarp
+ {
+ \bool_set_true:N \l__chemformula_first_last_math_bool% lwarp
+ \__chemformula_read_escape_LWRdollar:w #1 \q_nil% lwarp
+ }
+ }
+\begingroup
+\catcode`\$=\active
+
+\cs_new_protected:Npn \__chemformula_read_escape_LWRdollar:w $#1$ \q_nil
+{
+ \__chemformula_read_escape_math:n {#1}
+}
+
+\endgroup
+\cs_new_protected:Npn \__chemformula_bool_cs_set_if_first_last:NnNN #1#2#3#4
+ {
+ \int_zero:N \l__chemformula_tmpa_int
+ \int_zero:N \l__chemformula_tmpb_int
+ \int_set:Nn \l__chemformula_tmpa_int { \tl_count:n {#2} }
+ \tl_map_inline:nn {#2}
+ {
+ \int_incr:N \l__chemformula_tmpb_int
+ \int_compare:nT { \l__chemformula_tmpb_int = 1 }
+ {
+ \ifdefstrequal{##1}{#3}% lwarp
+ {
+ \bool_set_true:N #1
+ }% lwarp
+ {}
+ }
+ \int_compare:nT { \l__chemformula_tmpb_int = \l__chemformula_tmpa_int }
+ {
+ \ifdefstrequal{##1}{#4}
+ {}
+ {
+ \bool_set_false:N #1
+ }
+ }
+ }
+ }
+\cs_gset_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
+ \bool_set_false:N \l__chemformula_first_last_LWRdollar_bool% lwarp
+ \bool_set_false:N \l__chemformula_first_last_mathbraces_bool
+ \__chemformula_bool_set_if_first_last:Nnnn
+ \l__chemformula_first_last_dollar_bool
+ {#1}
+ { $ } { $ }
+ \bool_if:NF \l__chemformula_first_last_dollar_bool
+ {
+ \__chemformula_bool_set_if_first_last:Nnnn
+ \l__chemformula_first_last_mathbraces_bool
+ {#1}
+ { \( } { \) }
+ \bool_if:NF \l__chemformula_first_last_mathbraces_bool% lwarp
+ {
+ \__chemformula_bool_cs_set_if_first_last:NnNN
+ \l__chemformula_first_last_LWRdollar_bool
+ {#1}
+ { \LWR@newsingledollar } { \LWR@newsingledollar }
+ }% lwarp
+ }
+ }
+\ExplSyntaxOff
+\endinput
+%%
+%% End of file `lwarp-chemformula.sty'.