summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-10-22 21:14:36 +0000
committerKarl Berry <karl@freefriends.org>2015-10-22 21:14:36 +0000
commit0db4765793f15c3fca3961c57a53cc2caeb2827b (patch)
tree3de2ee7067b03bd667fef6e3511d928a52c32db2 /Master/texmf-dist/tex/latex
parent02510816e82dd0efbec1c2536096e1a8795271a6 (diff)
chemformula (22oct15)
git-svn-id: svn://tug.org/texlive/trunk@38690 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/chemformula/chemformula.sty63
1 files changed, 40 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/latex/chemformula/chemformula.sty b/Master/texmf-dist/tex/latex/chemformula/chemformula.sty
index 8507914cd2c..cea54bf7107 100644
--- a/Master/texmf-dist/tex/latex/chemformula/chemformula.sty
+++ b/Master/texmf-dist/tex/latex/chemformula/chemformula.sty
@@ -31,7 +31,7 @@
\ExplSyntaxOn
\tl_const:Nn \c_chemformula_date_tl {2015/10/01}
-\tl_const:Nn \c_chemformula_version_number_tl {4.13}
+\tl_const:Nn \c_chemformula_version_number_tl {4.14}
\tl_const:Nn \c_chemformula_version_suffix_tl {}
\tl_const:Nx \c_chemformula_version_tl
{ \c_chemformula_version_number_tl \c_chemformula_version_suffix_tl }
@@ -329,6 +329,8 @@
\tl_new:N \l__chemformula_kroegervink_positive_style_tl
\tl_new:N \l__chemformula_kroegervink_neutral_tl
\tl_set:Nn \l__chemformula_kroegervink_neutral_tl { $\times$ }
+\tl_new:N \l__chemformula_adduct_penalty_tl
+\tl_set:Nn \l__chemformula_adduct_penalty_tl { 300 }
% property lists:
\prop_new:N \l__chemformula_arrows_code_prop
@@ -386,13 +388,20 @@
}
\cs_generate_variant:Nn \chemformula_skip_nobreak:N {c}
+\cs_new_protected:Npn \chemformula_skip_nobreak:n #1
+ {
+ \chemformula_nobreak:
+ \skip_horizontal:n {#1}
+ \chemformula_nobreak:
+ }
+
\cs_new_protected:Npn \chemformula_skip_nobreak_penalty:Nn #1#2
{
\chemformula_nobreak:
\skip_horizontal:N #1
\tex_penalty:D #2 \scan_stop:
}
-\cs_generate_variant:Nn \chemformula_skip_nobreak_penalty:Nn {c}
+\cs_generate_variant:Nn \chemformula_skip_nobreak_penalty:Nn {c,NV}
\cs_new_protected:Npn \chemformula_dim_to_width:Nn #1#2
{
@@ -550,7 +559,7 @@
circle (\l__chemformula_radical_radius_dim) ;
}
}
- \skip_horizontal:N \l__chemformula_radical_space_dim
+ \chemformula_skip_nobreak:N \l__chemformula_radical_space_dim
}
\keys_define:nn {chemformula}
@@ -567,9 +576,11 @@
\cs_new_protected:Npn \chemformula_adduct:
{
- \skip_horizontal:N \l__chemformula_adduct_space_dim
+ \chemformula_skip_nobreak:N \l__chemformula_adduct_space_dim
\textperiodcentered
- \skip_horizontal:N \l__chemformula_adduct_space_dim
+ \chemformula_skip_nobreak_penalty:NV
+ \l__chemformula_adduct_space_dim
+ \l__chemformula_adduct_penalty_tl
}
\cs_new_eq:NN \chemformula_star_adduct: \chemformula_adduct:
@@ -604,7 +615,7 @@
circle (\l__chemformula_kroegervink_positive_radius_dim) ;
}
}
- \skip_horizontal:N \l__chemformula_kroegervink_positive_space_dim
+ \chemformula_skip_nobreak:N \l__chemformula_kroegervink_positive_space_dim
}
\cs_new_protected:Npn \chemformula_prime:
@@ -854,9 +865,9 @@
;
\tl_use:N \l__chemformula_tmpc_tl
}
- \chemformula_skip_nobreak_penalty:Nn
+ \chemformula_skip_nobreak_penalty:NV
\c_zero_skip
- { \l__chemformula_arrow_penalty_tl }
+ \l__chemformula_arrow_penalty_tl
}
\cs_generate_variant:Nn \__chemformula_arrow_draw:n { V }
@@ -1431,9 +1442,9 @@
{ \__chemformula_bond_draw:n {#1} }
}
\group_end:
- \chemformula_skip_nobreak_penalty:Nn
+ \chemformula_skip_nobreak_penalty:NV
\l__chemformula_bond_space_dim
- { \l__chemformula_bond_penalty_tl }
+ \l__chemformula_bond_penalty_tl
}
\cs_new_protected:Npn \__chemformula_bond_draw:n #1
@@ -1669,6 +1680,7 @@
\cs_new_protected:Npn \__chemformula_subscript_write:n #1
{
+ \chemformula_nobreak:
\group_begin:
\tl_set_eq:NN \chemformula_subscript:n \use:n
\tl_set_eq:NN \chemformula_superscript:n \use:n
@@ -1791,6 +1803,7 @@
\cs_new_protected:Npn \__chemformula_superscript_write:n #1
{
+ \chemformula_nobreak:
\group_begin:
\tl_set_eq:NN \chemformula_subscript:n \use:n
\tl_set_eq:NN \chemformula_superscript:n \use:n
@@ -1852,8 +1865,8 @@
\dim_compare:nT
{ \l__chemformula_subscript_dim < \l__chemformula_superscript_dim }
{
- \skip_horizontal:n { -\l__chemformula_subscript_dim }
- \skip_horizontal:N \l__chemformula_superscript_dim
+ \chemformula_skip_nobreak:n { -\l__chemformula_subscript_dim }
+ \chemformula_skip_nobreak:N \l__chemformula_superscript_dim
}
}
}
@@ -1864,8 +1877,8 @@
\tl_if_blank:VF \l__chemformula_subscript_tl
{
\bool_if:NTF \l__chemformula_charge_full_shift_bool
- { \skip_horizontal:n { -\l__chemformula_subscript_dim } }
- { \skip_horizontal:N \l__chemformula_charge_shift_dim }
+ { \chemformula_skip_nobreak:n { -\l__chemformula_subscript_dim } }
+ { \chemformula_skip_nobreak:N \l__chemformula_charge_shift_dim }
}
}
}
@@ -1877,15 +1890,15 @@
\tl_if_blank:VF \l__chemformula_subscript_tl
{
\bool_if:NTF \l__chemformula_is_isotope_bool
- { \skip_horizontal:N \l__chemformula_subscript_dim }
+ { \chemformula_skip_nobreak:N \l__chemformula_subscript_dim }
{
- \skip_horizontal:N \l__chemformula_superscript_dim
- \bool_if:NTF \l__chemformula_charge_full_shift_bool
- { \skip_horizontal:N \l__chemformula_subscript_dim }
- {
- \skip_horizontal:n
- { -\l__chemformula_charge_shift_dim }
- }
+ \chemformula_skip_nobreak:N \l__chemformula_superscript_dim
+ \bool_if:NTF \l__chemformula_charge_full_shift_bool
+ { \chemformula_skip_nobreak:N \l__chemformula_subscript_dim }
+ {
+ \chemformula_skip_nobreak:n
+ { -\l__chemformula_charge_shift_dim }
+ }
}
}
}
@@ -1916,7 +1929,7 @@
}
}
\dim_compare:nT { \l__chemformula_tmpa_dim > 0pt }
- { \skip_horizontal:N \l__chemformula_tmpa_dim }
+ { \chemformula_skip_nobreak:N \l__chemformula_tmpa_dim }
}
\group_end:
% clean up
@@ -2810,6 +2823,7 @@
stoich-print .code:n =
\cs_set_eq:NN \chemformula_print_stoich:n #1 ,
adduct-space .dim_set:N = \l__chemformula_adduct_space_dim ,
+ adduct-penalty .tl_set:N = \l__chemformula_adduct_penalty_tl ,
math-space .skip_set:N = \l__chemformula_math_space_skip ,
name-format .tl_set:N = \l__chemformula_name_format_tl ,
name-width .code:n =
@@ -3293,6 +3307,9 @@ VERSION HISTORY
- check for blank input
- drop support for \[ and \]
- new option `atom-format'
+2015/10/21 - version 4.14 - fix issue
+ https://github.com/cgnieder/chemformula/issues/2
+ - new option `adduct-penalty'
% --------------------------------------------------------------------------
% TODO