diff options
author | Karl Berry <karl@freefriends.org> | 2013-04-23 22:17:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-04-23 22:17:22 +0000 |
commit | ce96f93eee04e6c89a60b819a43ec27e85fce25e (patch) | |
tree | dea2dab0e57066d3db2ceefd7d96364f42ab9b9d /Master/texmf-dist/tex | |
parent | 1ea90739d1ab4cbc99996063321d8d94f05a7ab9 (diff) |
chemmacros (21apr13)
git-svn-id: svn://tug.org/texlive/trunk@30082 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemformula.sty | 76 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty | 17 |
2 files changed, 59 insertions, 34 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty index 715ff06b1ad..12344325e7d 100644 --- a/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty +++ b/Master/texmf-dist/tex/latex/chemmacros/chemformula.sty @@ -302,6 +302,7 @@ \dim_new:N \l__chemformula_arrow_length_dim \dim_new:N \l__chemformula_arrow_label_offset_dim \dim_set:Nn \l__chemformula_arrow_label_offset_dim { 2pt } +\dim_new:N \l__chemformula_arrow_minimum_length_dim \dim_new:N \l__chemformula_arrow_shortage_dim \dim_new:N \l__chemformula_arrow_offset_dim \dim_set:Nn \l__chemformula_arrow_offset_dim { .75em } @@ -328,6 +329,13 @@ { \l__chemformula_arrow_offset_dim } \dim_add:Nn \l__chemformula_arrow_length_dim { \l__chemformula_arrow_offset_dim } + \dim_compare:nF + { \l__chemformula_arrow_length_dim > \l__chemformula_arrow_minimum_length_dim } + { + \dim_set_eq:NN + \l__chemformula_arrow_length_dim + \l__chemformula_arrow_minimum_length_dim + } \dim_set:Nn \l__chemformula_arrow_shortage_dim { \l__chemformula_arrow_length_dim * @@ -351,6 +359,7 @@ \tl_new:N \l__chemformula_arrow_style_tl \tl_new:N \l__chemformula_arrow_label_style_tl \tl_set:Nn \l__chemformula_arrow_label_style_tl { \footnotesize } +\tl_new:N \l__chemformula_arrow_tmp_tl \prop_new:N \l__chemformula_arrows_code_prop \seq_new:N \l__chemformula_arrows_type_seq @@ -535,14 +544,15 @@ % arrow customization \keys_define:nn { chemmacros / chemformula } { - arrow-offset .dim_set:N = \l__chemformula_arrow_offset_dim , - arrow-yshift .dim_set:N = \l__chemformula_arrow_yshift_dim , - arrow-ratio .tl_set:N = \l__chemformula_arrow_ratio_tl , - label-offset .dim_set:N = \l__chemformula_arrow_label_offset_dim , - compound-sep .dim_set:N = \l__chemformula_compound_sep_dim , -% arrow-tips .tl_set:N = \l__chemformula_arrow_head_tl , - arrow-style .tl_set:N = \l__chemformula_arrow_style_tl , - label-style .tl_set:N = \l__chemformula_arrow_label_style_tl + arrow-offset .dim_set:N = \l__chemformula_arrow_offset_dim , + arrow-min-length .dim_set:N = \l__chemformula_arrow_minimum_length_dim , + arrow-yshift .dim_set:N = \l__chemformula_arrow_yshift_dim , + arrow-ratio .tl_set:N = \l__chemformula_arrow_ratio_tl , + label-offset .dim_set:N = \l__chemformula_arrow_label_offset_dim , + compound-sep .dim_set:N = \l__chemformula_compound_sep_dim , +% arrow-tips .tl_set:N = \l__chemformula_arrow_head_tl , + arrow-style .tl_set:N = \l__chemformula_arrow_style_tl , + label-style .tl_set:N = \l__chemformula_arrow_label_style_tl } %-----------------------------------------------------------------------------% @@ -564,12 +574,13 @@ \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 - \tl_set_rescan:Nno \l__chemformula_output_tl +% \tl_set_eq:NN +% \l__chemformula_output_tl +% \l__chemformula_input_tl + \tl_set_rescan:Nno \l__chemformula_input_tl { \ExplSyntaxOn \makeatletter } - { \l__chemformula_output_tl } - \chemformula_write:V \l__chemformula_output_tl + { \l__chemformula_input_tl } + \chemformula_write:V \l__chemformula_input_tl \group_end: } @@ -664,17 +675,17 @@ %-----------------------------------------------------------------------------% % arrow generation & detection -\cs_new:Npn \__chemformula_generate_arrows:n #1 +\cs_new:Npn \__chemformula_generate_arrows:Nn #1#2 { - \tl_set:Nn \l__chemformula_tmpa_tl { #1 } + \tl_set:Nn \l__chemformula_tmpa_tl { #2 } \seq_map_inline:Nn \l__chemformula_arrows_type_seq { \tl_replace_all:Nnn \l__chemformula_tmpa_tl { ##1 } { \__chemformula_arrows_get:n { ##1 } } } - \tl_set_eq:NN \l__chemformula_output_tl \l__chemformula_tmpa_tl + \tl_set_eq:NN #1 \l__chemformula_tmpa_tl } -\cs_generate_variant:Nn \__chemformula_generate_arrows:n { V } +\cs_generate_variant:Nn \__chemformula_generate_arrows:Nn { NV } \cs_new_protected:Npn \__chemformula_detect_arrows:n #1 { @@ -690,6 +701,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % compound names \dim_new:N \l__chemformula_name_dim +\tl_new:N \l__chemformula_name_tmp_tl \cs_new:Npn \__chemformula_name_cmpd:w { \peek_meaning:NTF ( { \__chemformula_name_cmpd_aux:w } { ! } } @@ -714,14 +726,18 @@ \) } -\cs_new_protected:Npn \__chemformula_generate_name:n #1 +\cs_new_protected:Npn \__chemformula_generate_name:Nn #1#2 { - \tl_set:Nn \l__chemformula_tmpa_tl { #1 } + \tl_set:Nn \l__chemformula_tmpa_tl { #2 } \tl_if_in:VnT \l__chemformula_tmpa_tl { ! } - { \tl_replace_all:Nnn \l__chemformula_tmpa_tl { ! } { \__chemformula_name_cmpd:w } } - \tl_set_eq:NN \l__chemformula_output_tl \l__chemformula_tmpa_tl + { + \tl_replace_all:Nnn \l__chemformula_tmpa_tl + { ! } + { \__chemformula_name_cmpd:w } + } + \tl_set_eq:NN #1 \l__chemformula_tmpa_tl } -\cs_generate_variant:Nn \__chemformula_generate_name:n { V } +\cs_generate_variant:Nn \__chemformula_generate_name:Nn { NV } \cs_new_protected:Npn \__chemformula_detect_name:n #1 { @@ -773,7 +789,7 @@ \tl_new:N \l__chemformula_chemformula_tmpa_tl \tl_new:N \g__chemformula_options_tl \tl_new:N \g__chemformula_output_tl -\tl_new:N \l__chemformula_output_tl +% \tl_new:N \l__chemformula_output_tl \tl_new:N \l__chemformula_input_tl \tl_new:N \l__chemformula_stoich_tl \tl_new:N \l__chemformula_decimal_output_tl @@ -1514,8 +1530,9 @@ { \sfrac[chemformula-text-frac]{#1}{#2} } \bool_if:NT \l__chemformula_nicefrac_bool { \nicefrac{#1}{#2} } + % FIXME: why doesn't this work without \textstyle? \bool_if:NT \l__chemformula_mathfrac_bool - { $ \frac{ \text { #1 } } { \text { #2 } } $ } + { $ \textstyle \frac{ \text { #1 } } { \text { #2 } } $ } } \cs_new:Npn \__chemformula_misc_frac:nnn #1#2#3 @@ -1773,7 +1790,10 @@ !\l__chemformula_first_last_text_bool && !\l__chemformula_first_last_math_bool } - { \tl_put_right:Nn \l__chemformula_input_tl { #1 } } + { + \__chemformula_generate_arrows:Nn \l__chemformula_arrow_tmp_tl { #1 } + \tl_put_right:NV \l__chemformula_input_tl \l__chemformula_arrow_tmp_tl + } \bool_set_false:N \l__chemformula_is_arrow_bool } \cs_generate_variant:Nn \chemformula_input_arrow:n { o } @@ -1788,7 +1808,10 @@ !\l__chemformula_first_last_text_bool && !\l__chemformula_first_last_math_bool } - { \tl_put_right:Nn \l__chemformula_input_tl { #1 } } + { + \__chemformula_generate_name:Nn \l__chemformula_name_tmp_tl { #1 } + \tl_put_right:NV \l__chemformula_input_tl \l__chemformula_name_tmp_tl + } \bool_set_false:N \l__chemformula_is_name_bool } @@ -2035,6 +2058,7 @@ see the chemmacros.sty file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO +- Bug: math- und text-escaping schützt nicht vor arrow-Umwandlung: \ch{"->"} - Addukte: Zahlen nach * und . automatisch erkennen? - allow fractions in subscripts: _{$\frac{1}{2}$} ? - optionale Argumente von \\ nach außen weiterreichen? diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.sty index 38b5e573c43..efa0b0d2138 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.6} -\def\chemmacros@date{2013/02/26} +\def\chemmacros@version{3.6b} +\def\chemmacros@date{2013/04/19} \ProvidesExplPackage {chemmacros} @@ -583,6 +583,7 @@ { \mathpalette \__chemmacros_fplus_aux: \bigcirc } % TODO: can I rewrite this in a more "expl3-way"? +% and what about a ``text'' version? \cs_new:Npn \__chemmacros_fplus_aux: #1#2 { \ooalign @@ -1076,12 +1077,7 @@ { \chemmacros_cip:n { #1 } } \cs_new:Npn \chemmacros_cip:n #1 - { - \cs_if_exist:NTF \EmbracOff - { \textit* { (#1) } } - { \textit { (#1) } } - \tex_kern:D \l__chemmacros_cip_kern_dim - } + { (\textit{#1}\tex_kern:D \l__chemmacros_cip_kern_dim) } \DeclareChemDeprecated \Rcip \R { \cip { R } } \DeclareChemDeprecated \Scip \S { \cip { S } } @@ -4004,6 +4000,11 @@ Version history document commands and module level commands - chemformula's !()() syntax now also works with babel's French +2013/02/27 - version 3.6a - bug fix: escaped text and math stays escaped, i.e. + also arrow code like `<=>' +2013/04/19 - version 3.6b - chemformula: new key `arrow-min-length' + - bug fix: stoichiometric fractions correctly displayed + - changed appearance of \cip to use upright parentheses % --------------------------------------------------------------------------- % % TODO: |