Skip to content

Commit

Permalink
v5.0 reached (finally)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgnieder committed Sep 11, 2015
1 parent bc15a49 commit 94048ed
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 99 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------
the CHEMMACROS package v5.0beta 2015/09/08
the CHEMMACROS package v5.0 2015/09/11

comprehensive support for typesetting chemistry documents

Expand Down
2 changes: 1 addition & 1 deletion chemmacros.module.base.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
{ #1 { \prg_return_true: } { \prg_return_false: } }

% this is used at least in the `isotope' module
\prg_new_conditional:Npnn \chemmacros_is_int:n #1 {p,T,F,TF}
\prg_new_conditional:Npnn \chemmacros_if_is_int:n #1 {p,T,F,TF}
{
\if_charcode:w ! \if_int_compare:w 9 < 1#1 ! \else: _ \fi:
\prg_return_true:
Expand Down
2 changes: 1 addition & 1 deletion chemmacros.module.isotopes.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
% #2: tokenlist variable
\cs_new_protected:Npn \chemmacros_get_atom_number:nN #1#2
{
\chemmacros_is_int:nTF {#1}
\chemmacros_if_is_int:nTF {#1}
{ \tl_set:Nn #2 {#1} }
{
\cs_if_exist:cTF { @elements@atom@number@ \str_lower_case:n {#1} }
Expand Down
55 changes: 41 additions & 14 deletions chemmacros.module.nomenclature.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -314,32 +314,55 @@
break-space .dim_set:N = \l__chemmacros_iupac_break_dim
}

\cs_new_protected:Npn \__chemmacros_break_point_insert:n #1
% #1: pre break
% #2: post break
% #3: no break
\cs_new_protected:Npn \__chemmacros_break_point_insert:nnn #1#2#3
{
\chemmacros_nobreak:
\tex_discretionary:D { - } { } {#1}
\chemmacros_allow_hyphens:
\mode_if_math:TF
{#3}
{
\chemmacros_nobreak:
\tex_discretionary:D {#1} {#2} {#3}
\chemmacros_allow_hyphens:
}
}
\cs_new_protected:Npn \chemmacros_break_point_hyphen:
{
\mode_if_math:TF
{ - }
\__chemmacros_break_point_insert:nnn
{-}
{ }
{
\__chemmacros_break_point_insert:n
{
\tex_kern:D \l__chemmacros_iupac_hyphen_pre_dim
-
\tex_kern:D \l__chemmacros_iupac_hyphen_post_dim
}
\tex_kern:D \l__chemmacros_iupac_hyphen_pre_dim
-
\tex_kern:D \l__chemmacros_iupac_hyphen_post_dim
}
}

\cs_new_protected:Npn \chemmacros_break_point:
{
\__chemmacros_break_point_insert:n
{ \tex_kern:D \l__chemmacros_iupac_break_dim }
\__chemmacros_break_point_insert:nnn
{-}
{ }
{
\mode_if_math:TF
{ | }
{ \tex_kern:D \l__chemmacros_iupac_break_dim }
}
}

\cs_new_protected:Npn \chemmacros_break_point_opening_paren:
{ \__chemmacros_break_point_insert:nnn { - } { ( } { ( } }

\cs_new_protected:Npn \chemmacros_break_point_closing_paren:
{ \__chemmacros_break_point_insert:nnn { )- } { } { ) } }

\cs_new_protected:Npn \chemmacros_break_point_opening_bracket:
{ \__chemmacros_break_point_insert:nnn { - } { [ } { [ } }

\cs_new_protected:Npn \chemmacros_break_point_closing_bracket:
{ \__chemmacros_break_point_insert:nnn { ]- } { } { ] } }

\cs_new_protected:Npn \chemmacros_superscript:n #1
{ \mode_if_math:TF { \sp {#1} } { \textsuperscript {#1} } }

Expand Down Expand Up @@ -423,6 +446,10 @@

\NewChemIUPACShorthand | \chemmacros_break_point:
\NewChemIUPACShorthand - \chemmacros_break_point_hyphen:
\NewChemIUPACShorthand ( \chemmacros_break_point_opening_paren:
\NewChemIUPACShorthand ) \chemmacros_break_point_closing_paren:
\NewChemIUPACShorthand [ \chemmacros_break_point_opening_bracket:
\NewChemIUPACShorthand ] \chemmacros_break_point_closing_bracket:
\NewChemIUPACShorthand ^ \chemmacros_superscript:n

% Thanks to Joseph Wright and Enrico Gregorio for the help on the curious
Expand Down
24 changes: 12 additions & 12 deletions chemmacros.module.redox.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
\ChemModule{redox}{2015/09/09 oxidation numbers, redox reactions}
\ChemModule{redox}{2015/09/11 oxidation numbers, redox reactions}

\chemmacros_load_modules:n {tikz,xfrac}

Expand All @@ -38,16 +38,16 @@
% --------------------------------------------------------------------------
% oxidation numbers
% \ox{<number>,<atom>}
\bool_new:N \l__chemmacros_ox_sign_bool
\bool_new:N \l__chemmacros_ox_integer_bool
\bool_new:N \l__chemmacros_ox_explicit_sign_bool
\bool_new:N \l__chemmacros_ox_format_roman_bool
\bool_new:N \l__chemmacros_ox_decimal_marker_comma_bool
\bool_new:N \l__chemmacros_ox_parse_bool
\bool_new:N \l__chemmacros_ox_side_bool
\bool_new:N \l__chemmacros_ox_super_bool
\bool_new:N \l__chemmacros_ox_top_bool
\bool_new:N \l__chemmacros_ox_align_center_bool
\bool_new:N \l__chemmacros_ox_sign_bool
\bool_new:N \l__chemmacros_ox_integer_bool
\bool_new:N \l__chemmacros_ox_explicit_sign_bool
\bool_new:N \l__chemmacros_ox_format_roman_bool
\bool_new:N \l__chemmacros_ox_decimal_marker_comma_bool
\bool_new:N \l__chemmacros_ox_parse_bool
\bool_new:N \l__chemmacros_ox_side_bool
\bool_new:N \l__chemmacros_ox_super_bool
\bool_new:N \l__chemmacros_ox_top_bool
\bool_new:N \l__chemmacros_ox_align_center_bool

\int_new:N \l__chemmacros_ox_number_int
\fp_new:N \l__chemmacros_ox_number_fp
Expand Down Expand Up @@ -175,7 +175,7 @@
{
\chemmacros_text:n
{
#2
\box_use:N \l__chemmacros_tmpb_box
\tl_use:N \l__chemmacros_ox_side_connect_tl
( \__chemmacros_ox_process_number:n {#1} )
}
Expand Down
51 changes: 43 additions & 8 deletions chemmacros.sty
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@

% --------------------------------------------------------------------------
% package information:
\tl_const:Nn \c_chemmacros_date_tl {2015/09/02}
\tl_const:Nn \c_chemmacros_version_number_tl {5.0}
\tl_const:Nn \c_chemmacros_version_suffix_tl {beta}
\tl_const:Nn \c_chemmacros_date_tl {2015/09/11}
\tl_const:Nn \c_chemmacros_version_major_number_tl {5}
\tl_const:Nn \c_chemmacros_version_minor_number_tl {0}
\tl_const:Nn \c_chemmacros_version_subrelease_tl {}
\tl_const:Nx \c_chemmacros_version_number_tl
{\c_chemmacros_version_major_number_tl.\c_chemmacros_version_minor_number_tl}
\tl_const:Nx \c_chemmacros_version_tl
{ \c_chemmacros_version_number_tl \c_chemmacros_version_suffix_tl }
{ \c_chemmacros_version_number_tl \c_chemmacros_version_subrelease_tl }
\tl_const:Nn \c_chemmacros_info_tl
{comprehensive support for typesetting chemistry documents}
{comprehensive~ support~ for~ typesetting~ chemistry~ documents}

\ProvidesExplPackage
{chemmacros}
Expand Down Expand Up @@ -76,17 +79,49 @@
\ProcessKeysPackageOptions {chemmacros/compatibility}

% --------------------------------------------------------------------------
% compare version numbers
% #1: number
% #2: relation
% #3: number
% #4: true
% #5: false
\prg_new_conditional:Npnn \chemmacros_if_version:nnn #1#2#3 {p,T,F,TF}
{
\fp_compare:nTF { floor(#1) = floor(#3) }
{
\fp_compare:nTF
{ (\chemmacros_get_minor:f {#1}) #2 (\chemmacros_get_minor:f {#3}) }
{ \prg_return_true: }
{ \prg_return_false: }
}
{
\fp_compare:nTF { (#1) #2 (#3) }
{ \prg_return_true: }
{ \prg_return_false: }
}
}

\cs_new:Npn \__chemmacros_get_minor:w #1.#2.#3 \q_stop
{ \tl_if_blank:nTF {#2} {0} {#2} }
\cs_new:Npn \chemmacros_get_minor:n #1
{ \__chemmacros_get_minor:w #1.. \q_stop }
\cs_generate_variant:Nn \chemmacros_get_minor:n {f}

% check compatibility
% #1: relation
% #2: number
% #3: true
% #4: false
\prg_new_conditional:Npnn \chemmacros_if_compatiblity:nn #1#2 {p,T,F,TF}
{
\fp_compare:nTF { \l__chemmacros_compatibility_version_fp #1#2 }
\chemmacros_if_version:nnnTF
{ \fp_to_decimal:N \l__chemmacros_compatibility_version_fp }
{#1}
{#2}
{ \prg_return_true: }
{ \prg_return_false: }
}
\cs_generate_variant:Nn \chemmacros_if_compatiblity:nnT {nV}

% user checks:
\NewDocumentCommand \IfChemCompatibilityTF {mm+m+m}
Expand Down Expand Up @@ -123,7 +158,7 @@
\chemmacros_if_compatiblity:nnT {>} { \c_chemmacros_version_number_tl }
{
\fp_set:Nn \l__chemmacros_compatibility_version_fp
{\c_chemmacros_version_number_tl}
{ \c_chemmacros_version_number_tl }
}

% --------------------------------------------------------------------------
Expand Down Expand Up @@ -412,7 +447,7 @@ Version history
- allow \NewChemPhase and friends after \begin{document}
- new optional argument to phase commands
- new options `nmr/method' and `nmr/connector'
2015/08/31 - version 5.0 - the former chemmacros.sty is now chemmacros4.sty
2015/09/11 - version 5.0 - the former chemmacros.sty is now chemmacros4.sty
and can be loaded through the `compatibility'
option
- chemmacros is now organized in separate modules
Expand Down
Binary file modified chemmacros_en.pdf
Binary file not shown.
Loading

0 comments on commit 94048ed

Please sign in to comment.