summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty')
-rw-r--r--Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty226
1 files changed, 119 insertions, 107 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty b/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty
index 72485964f2e..90e387ff1d8 100644
--- a/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty
+++ b/Master/texmf-dist/tex/latex/chemmacros/ghsystem.sty
@@ -98,40 +98,40 @@
\bool_new:N \l__ghsystem_engine_xetex_bool
\bool_new:N \l__ghsystem_engine_luatex_bool
-\tl_new:N \l__ghsystem_number_space_tl
-\tl_new:N \l__ghsystem_celsius_temperature_tl
-\tl_new:N \l__ghsystem_fahrenheit_temperature_tl
-\tl_new:N \l__ghsystem_kg_mass_tl
-\tl_new:N \l__ghsystem_lbs_mass_tl
-\tl_new:N \l__ghsystem_dots_tl
-\tl_set:Nn \l__ghsystem_dots_tl { \ldots }
-\tl_new:N \l__ghsystem_picture_scale_default_tl
-\tl_set:Nn \l__ghsystem_picture_scale_default_tl { .05 }
-\tl_new:N \l__ghsystem_picture_scale_tl
+\tl_new:N \l__ghsystem_number_space_tl
+\tl_new:N \l__ghsystem_celsius_temperature_tl
+\tl_new:N \l__ghsystem_fahrenheit_temperature_tl
+\tl_new:N \l__ghsystem_kg_mass_tl
+\tl_new:N \l__ghsystem_lbs_mass_tl
+\tl_new:N \l__ghsystem_dots_tl
+\tl_set:Nn \l__ghsystem_dots_tl { \ldots }
+\tl_new:N \l__ghsystem_picture_scale_default_tl
+\tl_set:Nn \l__ghsystem_picture_scale_default_tl { .05 }
+\tl_new:N \l__ghsystem_picture_scale_tl
\tl_set_eq:NN \l__ghsystem_picture_scale_tl \l__ghsystem_picture_scale_default_tl
-\tl_new:N \l__ghsystem_picture_includegraphics_tl
-\tl_new:N \l__ghsystem_picture_type_tl
-\tl_new:N \l__ghsystem_identifier_tl
-\tl_new:N \l__ghsystem_table_text_tl
-\tl_new:N \l__ghsystem_table_next_page_tl
-\tl_new:N \l__ghsystem_table_head_rule_tl
-\tl_set:Nn \l__ghsystem_table_head_rule_tl { \hline }
-\tl_new:N \l__ghsystem_table_top_head_rule_tl
-\tl_set:Nn \l__ghsystem_table_top_head_rule_tl { \hline }
-\tl_new:N \l__ghsystem_table_foot_rule_tl
-\tl_set:Nn \l__ghsystem_table_foot_rule_tl { \hline }
-\tl_new:N \l__ghsystem_table_last_foot_rule_tl
-\tl_set:Nn \l__ghsystem_table_last_foot_rule_tl { \hline }
-\tl_new:N \l__ghsystem_table_caption_tl
-\tl_new:N \l__ghsystem_table_caption_short_tl
-\tl_new:N \l__ghsystem_table_label_tl
-\tl_set:Nn \l__ghsystem_table_label_tl { tab : ghs-hp-statements }
-
-\dim_new:N \l__ghsystem_table_line_sep_dim
+\tl_new:N \l__ghsystem_picture_includegraphics_tl
+\tl_new:N \l__ghsystem_picture_type_tl
+\tl_new:N \l__ghsystem_identifier_tl
+\tl_new:N \l__ghsystem_table_text_tl
+\tl_new:N \l__ghsystem_table_next_page_tl
+\tl_new:N \l__ghsystem_table_head_rule_tl
+\tl_set:Nn \l__ghsystem_table_head_rule_tl { \hline }
+\tl_new:N \l__ghsystem_table_top_head_rule_tl
+\tl_set:Nn \l__ghsystem_table_top_head_rule_tl { \hline }
+\tl_new:N \l__ghsystem_table_foot_rule_tl
+\tl_set:Nn \l__ghsystem_table_foot_rule_tl { \hline }
+\tl_new:N \l__ghsystem_table_last_foot_rule_tl
+\tl_set:Nn \l__ghsystem_table_last_foot_rule_tl { \hline }
+\tl_new:N \l__ghsystem_table_caption_tl
+\tl_new:N \l__ghsystem_table_caption_short_tl
+\tl_new:N \l__ghsystem_table_label_tl
+\tl_set:Nn \l__ghsystem_table_label_tl { tab : ghs-hp-statements }
+
+\dim_new:N \l__ghsystem_table_line_sep_dim
\dim_set:Nn \l__ghsystem_table_line_sep_dim { 3pt }
-\fp_new:N \l__ghsystem_picture_scale_fp
-\fp_set:Nn \l__ghsystem_picture_scale_fp { \l__ghsystem_picture_scale_tl }
+\fp_new:N \l__ghsystem_picture_scale_fp
+\fp_set:Nn \l__ghsystem_picture_scale_fp { \l__ghsystem_picture_scale_tl }
\DeclareSIUnit { \GHSfahrenheit } { \SIUnitSymbolDegree F }
\DeclareSIUnit { \GHScelsius } { \SIUnitSymbolDegree C }
@@ -141,6 +141,7 @@
% language settings
\bool_new:N \l__ghsystem_language_file_loaded_bool
\bool_new:N \l__ghsystem_language_directory_bool
+
\file_if_exist:nTF { language / ghsystem_english_def }
{ \bool_set_true:N \l__ghsystem_language_directory_bool }
{ \bool_set_false:N \l__ghsystem_language_directory_bool }
@@ -310,17 +311,17 @@
\cs_new:Nn \ghsystem_read_args:nn
{
- \ghsystem_get_type:nN { #1 } \l__ghsystem_tmpa_tl
+ \__ghsystem_get_type:nN { #1 } \l__ghsystem_tmpa_tl
\prop_get:cnNTF { l__ghsystem_ \l__ghsystem_tmpa_tl _prop } { #2 } \l__ghsystem_tmpb_tl
{
- \ghsystem_is_combination:nn { #1 } { #2 }
+ \__ghsystem_is_combination:nn { #1 } { #2 }
\bool_if:NF \l__ghsystem_hide_statement_bool
{ \tl_use:N \l__ghsystem_tmpb_tl }
}
{ \chemmacros_msg:nnxx { ghsystem } { statements } { #1 } { #2 } }
}
-\cs_new:Nn \ghsystem_get_type:nN
+\cs_new_protected:Nn \__ghsystem_get_type:nN
{
\tl_if_eq:nnT { #1 } { h } { \tl_set:Nn #2 { h } }
\tl_if_eq:nnT { #1 } { H } { \tl_set:Nn #2 { h } }
@@ -336,14 +337,14 @@
\tl_if_eq:nnT { #1 } { P } { \tl_set:Nn #2 { p } }
}
-\cs_new:Nn \ghsystem_is_combination:nn
+\cs_new:Nn \__ghsystem_is_combination:nn
{
\tl_if_in:nnTF { #2 } { + }
- { \ghsystem_is_combination_aux_i:w #1,#2 \q_stop }
- { \ghsystem_is_combination_aux_ii:w #1,#2 \q_stop }
+ { \__ghsystem_is_combination_aux_i:w #1,#2 \q_stop }
+ { \__ghsystem_is_combination_aux_ii:w #1,#2 \q_stop }
}
-\cs_new:Npn \ghsystem_is_combination_aux_i:w #1,#2+#3 \q_stop
+\cs_new:Npn \__ghsystem_is_combination_aux_i:w #1,#2+#3 \q_stop
{
\bool_if:NT \l__ghsystem_show_number_bool
{
@@ -351,7 +352,7 @@
\tl_use:N \l__ghsystem_number_space_tl
#2 ~ + ~
\tl_if_in:nnTF { #3 } { + }
- { \ghsystem_is_combination_aux_iii:w #1,#3 \q_stop }
+ { \__ghsystem_is_combination_aux_iii:w #1,#3 \q_stop }
{
\tl_to_uppercase:n { #1 }
\tl_use:N \l__ghsystem_number_space_tl
@@ -360,7 +361,7 @@
}
}
-\cs_new:Npn \ghsystem_is_combination_aux_ii:w #1,#2 \q_stop
+\cs_new:Npn \__ghsystem_is_combination_aux_ii:w #1,#2 \q_stop
{
\bool_if:NT \l__ghsystem_show_number_bool
{
@@ -370,7 +371,7 @@
}
}
-\cs_new:Npn \ghsystem_is_combination_aux_iii:w #1,#2+#3 \q_stop
+\cs_new:Npn \__ghsystem_is_combination_aux_iii:w #1,#2+#3 \q_stop
{
\bool_if:NT \l__ghsystem_show_number_bool
{
@@ -390,64 +391,70 @@
{
\group_begin:
\IfNoValueF { #1 } { \keys_set:nn { chemmacros / ghsystem } { #1 } }
+ \ghsystem_list_all:
+ \group_end:
+ }
+
+\cs_new_protected:Npn \ghsystem_list_all:
+ {
+ \int_zero:N \l__ghsystem_tmpa_int
+ \int_zero:N \l__ghsystem_tmpb_int
+ \prop_map_inline:Nn \l__ghsystem_p_prop { \int_incr:N \l__ghsystem_tmpa_int }
+ \dim_set_eq:NN \tabulinesep \l__ghsystem_table_line_sep_dim
+ \begin { longtabu } { X[3]X[7,L] }
+ \caption [ \l__ghsystem_table_caption_short_tl ]
+ {
+ \l__ghsystem_table_caption_tl
+ \exp_args:No \label { \l__ghsystem_table_label_tl }
+ } \\
+ \l__ghsystem_table_top_head_rule_tl
+ \textbf { \l__ghsystem_identifier_tl } &
+ \textbf { \l__ghsystem_table_text_tl } \\
+ \l__ghsystem_table_head_rule_tl
+ \endfirsthead
+ \l__ghsystem_table_top_head_rule_tl
+ \textbf { \l__ghsystem_identifier_tl } &
+ \textbf { \l__ghsystem_table_text_tl } \\
+ \l__ghsystem_table_head_rule_tl
+ \endhead
+ \l__ghsystem_table_last_foot_rule_tl
+ \multicolumn{2}{r} { \textit { \l__ghsystem_table_next_page_tl } }
+ \endfoot
+ \l__ghsystem_table_foot_rule_tl \multicolumn{2}{r} { }
+ \endlastfoot
+ \prop_map_inline:Nn \l__ghsystem_h_prop
+ { \__ghsystem_read_number:nn { H } { ##1 } & ##2 \\ }
+ \prop_map_inline:Nn \l__ghsystem_euh_prop
+ { \__ghsystem_read_number:nn { EUH } { ##1 } & ##2 \\ }
\int_zero:N \l__ghsystem_tmpa_int
+ \prop_map_inline:Nn \l__ghsystem_p_prop { \int_gincr:N \l__ghsystem_tmpa_int }
\int_zero:N \l__ghsystem_tmpb_int
- \prop_map_inline:Nn \l__ghsystem_p_prop { \int_incr:N \l__ghsystem_tmpa_int }
- \dim_set_eq:NN \tabulinesep \l__ghsystem_table_line_sep_dim
- \begin { longtabu } { X[3]X[7,L] }
- \caption [ \l__ghsystem_table_caption_short_tl ]
- {
- \l__ghsystem_table_caption_tl
- \exp_args:No \label { \l__ghsystem_table_label_tl }
- } \\
- \l__ghsystem_table_top_head_rule_tl
- \textbf { \l__ghsystem_identifier_tl } &
- \textbf { \l__ghsystem_table_text_tl } \\
- \l__ghsystem_table_head_rule_tl
- \endfirsthead
- \l__ghsystem_table_top_head_rule_tl
- \textbf { \l__ghsystem_identifier_tl } &
- \textbf { \l__ghsystem_table_text_tl } \\
- \l__ghsystem_table_head_rule_tl
- \endhead
- \l__ghsystem_table_last_foot_rule_tl
- \multicolumn{2}{r} { \textit { \l__ghsystem_table_next_page_tl } }
- \endfoot
- \l__ghsystem_table_foot_rule_tl \multicolumn{2}{r} { }
- \endlastfoot
- \prop_map_inline:Nn \l__ghsystem_h_prop
- { \ghsystem_read_number:nn { H } { ##1 } & ##2 \\ }
- \prop_map_inline:Nn \l__ghsystem_euh_prop
- { \ghsystem_read_number:nn { EUH } { ##1 } & ##2 \\ }
- \int_zero:N \l__ghsystem_tmpa_int
- \prop_map_inline:Nn \l__ghsystem_p_prop { \int_gincr:N \l__ghsystem_tmpa_int }
- \int_zero:N \l__ghsystem_tmpb_int
- \prop_map_inline:Nn \l__ghsystem_p_prop
- {
- \int_gincr:N \l__ghsystem_tmpb_int
- \ghsystem_read_number:nn { P } { ##1 } & ##2
- \int_compare:nNnT { \l__ghsystem_tmpb_int } < { \l__ghsystem_tmpa_int } { \\ }
- }
- \end { longtabu }
- \group_end:
+ \prop_map_inline:Nn \l__ghsystem_p_prop
+ {
+ \int_gincr:N \l__ghsystem_tmpb_int
+ \__ghsystem_read_number:nn { P } { ##1 } & ##2
+ \int_compare:nNnT { \l__ghsystem_tmpb_int } < { \l__ghsystem_tmpa_int } { \\ }
+ }
+ \end { longtabu }
}
-\cs_new:Nn \ghsystem_read_number:nn
+\cs_new:Nn \__ghsystem_read_number:nn
{
\tl_if_in:nnTF { #2 } { + }
- { \ghsystem_read_number_aux_i:w #1 , #2 \q_stop }
+ { \__ghsystem_read_number_aux_i:w #1 , #2 \q_stop }
{ #1 \tl_use:N \l__ghsystem_number_space_tl #2 }
}
-\cs_new:Npn \ghsystem_read_number_aux_i:w #1,#2+#3\q_stop
+\cs_new:Npn \__ghsystem_read_number_aux_i:w #1,#2+#3\q_stop
{
#1 \tl_use:N \l__ghsystem_number_space_tl #2 ~+~
\tl_if_in:nnTF { #3 } { + }
- { \ghsystem_read_number_aux_ii:w #1,#3 \q_stop }
+ { \__ghsystem_read_number_aux_ii:w #1,#3 \q_stop }
{ #1#3 }
}
-\cs_new:Npn \ghsystem_read_number_aux_ii:w #1,#2+#3\q_stop { #1#2 ~+~ #1#3 }
+\cs_new:Npn \__ghsystem_read_number_aux_ii:w #1,#2+#3\q_stop
+ { #1#2 ~+~ #1#3 }
% --------------------------------------------------------------------------- %
% the picture command
@@ -455,7 +462,7 @@
%
% test for compilation engine/mode:
\pdftex_if_engine:T { \bool_set_true:N \l__ghsystem_engine_pdftex_bool }
-\xetex_if_engine:T { \bool_set_true:N \l__ghsystem_engine_xetex_bool }
+\xetex_if_engine:T { \bool_set_true:N \l__ghsystem_engine_xetex_bool }
\luatex_if_engine:T { \bool_set_true:N \l__ghsystem_engine_luatex_bool }
\bool_new:N \l__ghsystem_picture_directory_bool
@@ -476,34 +483,39 @@
% the command:
\NewDocumentCommand \ghspic { om }
{
- \file_if_exist:nTF { pictures / ghsystem_ #2 . \l__ghsystem_picture_type_tl }
- { \bool_set_true:N \l__ghsystem_picture_directory_bool }
- { \bool_set_false:N \l__ghsystem_picture_directory_bool }
\group_begin:
\IfNoValueF { #1 } { \keys_set:nn { chemmacros / ghsystem } { #1 } }
- \bool_if:NTF \l__ghsystem_picture_directory_bool
- {
- \ghsystem_includegraphics:xn
- {
- scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp
- \l__ghsystem_picture_includegraphics_tl
- }
- { pictures / ghsystem_ #2 . \l__ghsystem_picture_type_tl }
- }
- {
- \ghsystem_includegraphics:xn
- {
- scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp
- \l__ghsystem_picture_includegraphics_tl
- }
- { ghsystem_ #2 . \l__ghsystem_picture_type_tl }
- }
+ \ghsystem_pic:n { #2 }
\group_end:
}
-\cs_new:Nn \ghsystem_includegraphics:nn
+\cs_new_protected:Npn \ghsystem_pic:n #1
+ {
+ \file_if_exist:nTF { pictures / ghsystem_ #1 . \l__ghsystem_picture_type_tl }
+ { \bool_set_true:N \l__ghsystem_picture_directory_bool }
+ { \bool_set_false:N \l__ghsystem_picture_directory_bool }
+ \bool_if:NTF \l__ghsystem_picture_directory_bool
+ {
+ \__ghsystem_includegraphics:xn
+ {
+ scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp
+ \l__ghsystem_picture_includegraphics_tl
+ }
+ { pictures / ghsystem_ #1 . \l__ghsystem_picture_type_tl }
+ }
+ {
+ \__ghsystem_includegraphics:xn
+ {
+ scale = \fp_to_tl:N \l__ghsystem_picture_scale_fp
+ \l__ghsystem_picture_includegraphics_tl
+ }
+ { ghsystem_ #1 . \l__ghsystem_picture_type_tl }
+ }
+ }
+
+\cs_new:Nn \__ghsystem_includegraphics:nn
{ \includegraphics[#1]{#2} }
-\cs_generate_variant:Nn \ghsystem_includegraphics:nn { xn }
+\cs_generate_variant:Nn \__ghsystem_includegraphics:nn { xn }
\tex_endinput:D
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%