diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/semantex/semantex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/semantex/semantex.sty | 578 |
1 files changed, 319 insertions, 259 deletions
diff --git a/Master/texmf-dist/tex/latex/semantex/semantex.sty b/Master/texmf-dist/tex/latex/semantex/semantex.sty index e705b068862..dcbf1f9193b 100644 --- a/Master/texmf-dist/tex/latex/semantex/semantex.sty +++ b/Master/texmf-dist/tex/latex/semantex/semantex.sty @@ -1,5 +1,5 @@ \RequirePackage{xparse,l3keys2e,leftindex} -\ProvidesExplPackage{semantex}{2020/09/13}{0.43}{} +\ProvidesExplPackage{semantex}{2020/09/27}{0.44}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % @@ -20,6 +20,7 @@ semtexfile .choice:, semtexfile / true .code:n = \semantex_turn_semtex_file_on:, semtexfile / false .code:n = \semantex_turn_semtex_file_off:, + semtexfile / .code:n = \semantex_turn_semtex_file_on:, semtexfile / unknown .code:n = \msg_error:nnnn { semantex } { semantex_setup_key_value_not_found } { semtexfile } { #1 }, unknown .code:n = \msg_error:nnx { semantex } { semantex_setup_key_not_found } { \l_keys_key_str } } @@ -29,110 +30,23 @@ \keys_set:nn { semantex } { #1 } } -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% THE FOLLOWING SECTION IS IDENTICAL TO THE semtex PACKAGE -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% These are some essential commands that are needed for bullets and parentheses, -% and they are the only ones that will not be stripped by running the -% stripsemantex algorithm. Therefore, they are also available as a standalone -% package, called "semtex". This name is meant to suggest "stripped SemanTeX", -% and at the same time, semtex is the name of a plastic explosive, suggesting -% "blown-up SemanTeX". -% (Mathematicians are not famous for the quality of their humour.) - -% Bullets: - -\box_if_exist:NF \g__semantex_bullet_box -{ - \box_new:N \g__semantex_bullet_box - \hbox_set:Nn \g__semantex_bullet_box { $\cdot$ } - \box_scale:Nnn \g__semantex_bullet_box {1.2} {1.2} - \tl_set:Nn\g_semantex_bullet - { - \box_move_up:nn{-0.25ex}{\box_use:N \g__semantex_bullet_box} - } - - \tl_set:Nn\g_semantex_double_bullet{\g_semantex_bullet \g_semantex_bullet} - - \tl_set_eq:NN\SemantexBullet \g_semantex_bullet - - \tl_set_eq:NN \SemantexDoubleBullet \g_semantex_double_bullet -} - -% Parentheses: - -\cs_set:Npn\SemantexLeft { \mathopen{}\mathclose\bgroup\left } - -\cs_set:Npn\SemantexRight { \aftergroup\egroup\right } - -\tl_set:Nn\SemantexDelimiterSize{} - -\DeclareDocumentCommand\SemantexParentheses { mmmm } -{ - \str_case:nnF { #1 } % This is where \big,\Big, etc. go. - { - { normal } { - \group_begin: - \tl_clear:N \SemantexDelimiterSize - \str_if_eq:nnF { #2 } { . } { \mathopen #2 } - #4 - \str_if_eq:nnF { #3 } { . } { \mathclose #3 } - \group_end: - } - { auto } { - \group_begin: - \tl_set_eq:NN \SemantexDelimiterSize \middle - \SemantexLeft #2 - #4 - \SemantexRight #3 - \group_end: - } - { * } { - \group_begin: - \tl_set_eq:NN \SemantexDelimiterSize \middle - \SemantexLeft #2 - #4 - \SemantexRight #3 - \group_end: - } - } - { - \group_begin: - \tl_set_eq:NN\SemantexDelimiterSize #1 - \mathopen #1 #2 - #4 - \mathclose #1 #3 - \group_end: - } -} - -\DeclareDocumentCommand\SemantexNoParentheses { m } -{ - \group_begin: - \tl_clear:N\SemantexDelimiterSize - #1 - \group_end: -} - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % THE .semtex FILE % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\bool_new:N \g__semantex_semtex_file_was_opened +\bool_new:N \g__semantex_semtex_file_was_opened_bool \iow_new:N \g__semantex_semtex_file_stream_temp_iow \cs_new_protected:Npn \semantex_turn_semtex_file_on: { - \bool_if:NF \g__semantex_semtex_file_was_opened + \bool_if:NF \g__semantex_semtex_file_was_opened_bool { \iow_open:Nn \g__semantex_semtex_file_stream_temp_iow { \jobname.semtex } \iow_now:Nn \g__semantex_semtex_file_stream_temp_iow { \DeclareClass {\SemantexBaseObject } } + \iow_now:Nn \g__semantex_semtex_file_stream_temp_iow { \DeclareObject {\SemantexDelimiterSize } } } \cs_set:Npn\semantex_write_to_semtex_file:n##1 @@ -140,23 +54,38 @@ \iow_now:Nn \g__semantex_semtex_file_stream_temp_iow { ##1 } } - \bool_set_true:N \g__semantex_semtex_file_was_opened + \cs_set:Npn\semantex_write_to_semtex_file_V:N ##1 + { + % We use this command instead of a :V variant + % in order to save time; when semtexfile=false, + % there is no reason to V-expand the argument. + \semantex_write_to_semtex_file:V ##1 + } + + \bool_set_true:N \g__semantex_semtex_file_was_opened_bool } \cs_new_protected:Npn \semantex_turn_semtex_file_off: { - \bool_if:NT \g__semantex_semtex_file_was_opened + \bool_if:NT \g__semantex_semtex_file_was_opened_bool { \iow_close:N \g__semantex_semtex_file_stream_temp_iow } \cs_set:Npn\semantex_write_to_semtex_file:n##1 {} - \bool_set_false:N \g__semantex_semtex_file_was_opened + \cs_set:Npn\semantex_write_to_semtex_file_V:N ##1 {} + % We use this command instead of a :V variant + % in order to save time; when semtexfile=false, + % there is no reason to V-expand the argument. + + \bool_set_false:N \g__semantex_semtex_file_was_opened_bool } \semantex_turn_semtex_file_off: +\cs_generate_variant:Nn \semantex_write_to_semtex_file:n { V } + \cs_new_protected:Npn\semantex_write_original_source_to_semtex_file:n#1 { \semantex_write_to_semtex_file:n { \BeginSource } @@ -170,6 +99,8 @@ \semantex_write_to_semtex_file:n { #1 } } +\cs_set_eq:NN\SemantexAddToRecordedSource\semantex_add_to_existing_original_source_in_semtex_file:n + \cs_new_protected:Npn\semantex_write_output_to_semtex_file:n#1 { \semantex_write_to_semtex_file:n { \EndSource } @@ -178,9 +109,15 @@ \semantex_write_to_semtex_file:n { \EndOutput } } -\cs_generate_variant:Nn\semantex_write_output_to_semtex_file:n { V } +\cs_set_eq:NN\SemantexRecordOutput\semantex_write_output_to_semtex_file:n -\cs_generate_variant:Nn\semantex_write_original_source_to_semtex_file:n { o } +\cs_new_protected:Npn\semantex_write_output_to_semtex_file_V:N#1 +{ + \semantex_write_to_semtex_file:n { \EndSource } + \semantex_write_to_semtex_file:n { \BeginOutput } + \semantex_write_to_semtex_file_V:N #1 + \semantex_write_to_semtex_file:n { \EndOutput } +} \cs_new_protected:Npn\semantex_write_class_declaration_to_semtex_file:n#1 { @@ -199,6 +136,99 @@ \cs_set_eq:NN\SemantexRecordObject\semantex_write_object_declaration_to_semtex_file:n +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% THE FOLLOWING SECTION IS IDENTICAL TO THE semtex PACKAGE +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% These are some essential commands that are needed for bullets and parentheses, +% and they are the only ones that will not be stripped by running the +% stripsemantex algorithm. Therefore, they are also available as a standalone +% package, called "semtex". This name is meant to suggest "stripped SemanTeX", +% and at the same time, semtex is the name of a plastic explosive, suggesting +% "blown-up SemanTeX". +% (Mathematicians are not famous for the quality of their humour.) + +% Bullets: + +\box_if_exist:NF \g__semantex_bullet_box +{ + \box_new:N \g__semantex_bullet_box + \hbox_set:Nn \g__semantex_bullet_box { $\cdot$ } + \box_scale:Nnn \g__semantex_bullet_box {1.2} {1.2} + \tl_set:Nn\g_semantex_bullet + { + \box_move_up:nn{-0.25ex}{\box_use:N \g__semantex_bullet_box} + } + + \tl_set:Nn\g_semantex_double_bullet{\g_semantex_bullet \g_semantex_bullet} + + \tl_set_eq:NN\SemantexBullet \g_semantex_bullet + + \tl_set_eq:NN \SemantexDoubleBullet \g_semantex_double_bullet +} + +% Parentheses: + +\cs_set:Npn\SemantexLeft { \mathopen{}\mathclose\bgroup\left } + +\cs_set:Npn\SemantexRight { \aftergroup\egroup\right } + +\DeclareDocumentCommand\SemantexDelimiterSize { } +{ + \semantex_write_original_source_to_semtex_file:n { \SemantexDelimiterSize } + \semantex_write_output_to_semtex_file_V:N \l_semantex_delimiter_size_temp_tl + \l_semantex_delimiter_size_temp_tl +} + +\DeclareDocumentCommand\RecordSemantexDelimiterSize { } +{ + \semantex_write_output_to_semtex_file_V:N \l_semantex_delimiter_size_temp_tl +} + +\DeclareDocumentCommand\SemantexDelimiterSizeNoRecord { } +{ + \l_semantex_delimiter_size_temp_tl +} + +\DeclareDocumentCommand\SemantexMathOpen { mm } +{ + \group_begin: + \tl_set:Nn\l_semantex_delimiter_size_temp_tl { #1 } + \str_if_eq:nnF { #2 } { . } { \mathopen #1 #2 } +} + +\DeclareDocumentCommand\SemantexMathClose { mm } +{ + \str_if_eq:nnF { #2 } { . } { \mathclose #1 #2 } + \group_end: +} + +\DeclareDocumentCommand\SemantexMathOpenAuto { m } +{ + \group_begin: + \tl_set:Nn\l_semantex_delimiter_size_temp_tl { \middle } + \SemantexLeft #1 +} + +\DeclareDocumentCommand\SemantexMathCloseAuto { m } +{ + \SemantexRight #1 + \group_end: +} + +\DeclareDocumentCommand\SemantexMathOpenNoPar { } +{ + \group_begin: + \tl_clear:N\l_semantex_delimiter_size_temp_tl +} + +\DeclareDocumentCommand\SemantexMathCloseNoPar { } +{ + \group_end: +} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % USER COMMANDS FOR CREATING NEW CLASSES @@ -1572,20 +1602,6 @@ \semantex_data_bool_get:nnTF { #1 } { output } % Checks if the register is supposed to output { \semantex_inner_return:n { #1 } - \semantex_data_int_if_positive:nnTF { #1 } { numberofarguments } % Checks if more than one argument has been received, i.e. whether we want to render any argument - { - \semantex_data_bool_get:nnTF { #1 } { leftargument } % Checks if left or right argument - { - \semantex_left_return:n { #1 } - } - { - \semantex_right_return:n { #1 } - } - } - { - % do nothing - } - \tl_set:Nx\l__semantex_render_symbol_temp_tl { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } % Stores the symbol in a temporary command \tl_set:Nx \l__semantex_render_output_class_temp_tl { \semantex_data_tl_get:nn { #1 } { output } } % The output class \exp_args:NNx\cs_set:Nn\l__semantex_render_outputoptions_temp_cs:n { \semantex_data_tl_get_exp_not:nn { #1 } { outputoptions } } @@ -1602,51 +1618,130 @@ { \l__semantex_render_outputoptions_temp_tl } % This was necessary, trust me. - \tl_set:Nx \l__semantex_render_temp_tl - { - \exp_not:c { - __semantex_make_object_of_\l__semantex_render_output_class_temp_tl _with_options:nnw - } - % This is for outputting -- the command - % \__semantex_make_object_of_class_???_with_options:nnw - % makes a one-time object of class ??? and allows us to - % immediately pass options to it - { - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { upperputleft } { \semantex_data_tl_get_exp_not:nn { #1 } { upper } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { lowerputleft } { \semantex_data_tl_get_exp_not:nn { #1 } { lower } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { upperleftputright } { \semantex_data_tl_get_exp_not:nn { #1 } { upperleft } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { lowerleftputright } { \semantex_data_tl_get_exp_not:nn { #1 } { lowerleft } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { preupper } { \semantex_data_tl_get_exp_not:nn { #1 } { preupper } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { postupper } { \semantex_data_tl_get_exp_not:nn { #1 } { postupper } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { prelower } { \semantex_data_tl_get_exp_not:nn { #1 } { prelower } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { postlower } { \semantex_data_tl_get_exp_not:nn { #1 } { postlower } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { preupperleft } { \semantex_data_tl_get_exp_not:nn { #1 } { preupperleft } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { postupperleft } { \semantex_data_tl_get_exp_not:nn { #1 } { postupperleft } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { prelowerleft } { \semantex_data_tl_get_exp_not:nn { #1 } { prelowerleft } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { postlowerleft } { \semantex_data_tl_get_exp_not:nn { #1 } { postlowerleft } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { heightphantom } { \semantex_data_tl_get_exp_not:nn { #1 } { heightphantom } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { slantingphantom } { \semantex_data_tl_get_exp_not:nn { #1 } { slantingphantom } } - \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } - { texclass } { \semantex_data_tl_get_exp_not:nn { #1 } { texclass } } - \exp_not:V \l__semantex_render_outputoptions_temp_tl - % These are the options we pass to the output class so that it - % can eventually render it - } - { \exp_not:V \l__semantex_render_symbol_temp_tl } + \semantex_data_int_if_positive:nnTF { #1 } { numberofarguments } % Checks if more than one argument has been received, i.e. whether we want to render any argument + { + \semantex_data_bool_get:nnTF { #1 } { leftargument } % Checks if left or right argument + { + \semantex_left_pre_return:n { #1 } + \tl_set:Nx\l__semantex_render_symbol_temp_tl { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } % Stores the symbol in a temporary command + \tl_set:Nx \l__semantex_render_temp_tl + { + \exp_not:c { + __semantex_make_object_of_\l__semantex_render_output_class_temp_tl _with_options:nnw + } + % This is for outputting -- the command + % \__semantex_make_object_of_class_???_with_options:nnw + % makes a one-time object of class ??? and allows us to + % immediately pass options to it + { + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { upperputleft } { \semantex_data_tl_get_exp_not:nn { #1 } { upper } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { lowerputleft } { \semantex_data_tl_get_exp_not:nn { #1 } { lower } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { preupper } { \semantex_data_tl_get_exp_not:nn { #1 } { preupper } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postupper } { \semantex_data_tl_get_exp_not:nn { #1 } { postupper } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { prelower } { \semantex_data_tl_get_exp_not:nn { #1 } { prelower } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postlower } { \semantex_data_tl_get_exp_not:nn { #1 } { postlower } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { texclass } { \semantex_data_tl_get_exp_not:nn { #1 } { texclass } } + \exp_not:V \l__semantex_render_outputoptions_temp_tl + % These are the options we pass to the output class so that it + % can eventually render it + } + { \exp_not:V \l__semantex_render_symbol_temp_tl } + } + } + { + \semantex_right_pre_return:n { #1 } + \tl_set:Nx\l__semantex_render_symbol_temp_tl { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } % Stores the symbol in a temporary command + \tl_set:Nx \l__semantex_render_temp_tl + { + \exp_not:c { + __semantex_make_object_of_\l__semantex_render_output_class_temp_tl _with_options:nnw + } + % This is for outputting -- the command + % \__semantex_make_object_of_class_???_with_options:nnw + % makes a one-time object of class ??? and allows us to + % immediately pass options to it + { + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { upperleftputright } { \semantex_data_tl_get_exp_not:nn { #1 } { upperleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { lowerleftputright } { \semantex_data_tl_get_exp_not:nn { #1 } { lowerleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { preupperleft } { \semantex_data_tl_get_exp_not:nn { #1 } { preupperleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postupperleft } { \semantex_data_tl_get_exp_not:nn { #1 } { postupperleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { prelowerleft } { \semantex_data_tl_get_exp_not:nn { #1 } { prelowerleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postlowerleft } { \semantex_data_tl_get_exp_not:nn { #1 } { postlowerleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { heightphantom } { \semantex_data_tl_get_exp_not:nn { #1 } { heightphantom } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { slantingphantom } { \semantex_data_tl_get_exp_not:nn { #1 } { slantingphantom } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { texclass } { \semantex_data_tl_get_exp_not:nn { #1 } { texclass } } + \exp_not:V \l__semantex_render_outputoptions_temp_tl + % These are the options we pass to the output class so that it + % can eventually render it + } + { \exp_not:V \l__semantex_render_symbol_temp_tl } + } + } + } + { + \tl_set:Nx\l__semantex_render_symbol_temp_tl { \semantex_data_tl_get_exp_not:nn { #1 } { symbol } } % Stores the symbol in a temporary command + \tl_set:Nx \l__semantex_render_temp_tl + { + \exp_not:c { + __semantex_make_object_of_\l__semantex_render_output_class_temp_tl _with_options:nnw + } + % This is for outputting -- the command + % \__semantex_make_object_of_class_???_with_options:nnw + % makes a one-time object of class ??? and allows us to + % immediately pass options to it + { + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { upperputleft } { \semantex_data_tl_get_exp_not:nn { #1 } { upper } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { lowerputleft } { \semantex_data_tl_get_exp_not:nn { #1 } { lower } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { upperleftputright } { \semantex_data_tl_get_exp_not:nn { #1 } { upperleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { lowerleftputright } { \semantex_data_tl_get_exp_not:nn { #1 } { lowerleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { preupper } { \semantex_data_tl_get_exp_not:nn { #1 } { preupper } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postupper } { \semantex_data_tl_get_exp_not:nn { #1 } { postupper } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { prelower } { \semantex_data_tl_get_exp_not:nn { #1 } { prelower } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postlower } { \semantex_data_tl_get_exp_not:nn { #1 } { postlower } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { preupperleft } { \semantex_data_tl_get_exp_not:nn { #1 } { preupperleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postupperleft } { \semantex_data_tl_get_exp_not:nn { #1 } { postupperleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { prelowerleft } { \semantex_data_tl_get_exp_not:nn { #1 } { prelowerleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { postlowerleft } { \semantex_data_tl_get_exp_not:nn { #1 } { postlowerleft } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { heightphantom } { \semantex_data_tl_get_exp_not:nn { #1 } { heightphantom } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { slantingphantom } { \semantex_data_tl_get_exp_not:nn { #1 } { slantingphantom } } + \exp_not:N\semantex_base_object_valuekey:nnn { \l__semantex_render_output_class_temp_tl } + { texclass } { \semantex_data_tl_get_exp_not:nn { #1 } { texclass } } + \exp_not:V \l__semantex_render_outputoptions_temp_tl + % These are the options we pass to the output class so that it + % can eventually render it + } + { \exp_not:V \l__semantex_render_symbol_temp_tl } + } } } { @@ -1669,7 +1764,7 @@ } } \group_begin: - \semantex_write_output_to_semtex_file:V \l__semantex_render_temp_tl + \semantex_write_output_to_semtex_file_V:N \l__semantex_render_temp_tl % Adds the output to the .semtex file, if this has been turned on, % which it is not by default. \group_end: @@ -1703,113 +1798,78 @@ \cs_new_protected:Npn \semantex_parentheses_store:nN#1#2 { \semantex_data_tl_get_store:nnN { #1 } { parsize } \l__semantex_parentheses_store_temp_tl - \semantex_data_bool_get:nnTF { #1 } { allowSemantexDelimiterSize } + \str_case:VnF { \l__semantex_parentheses_store_temp_tl } % This is where \big,\Big, etc. go. { - \tl_set:Nn#2 { \SemantexParentheses } - \tl_put_right:Nx#2 - { - { \exp_not:V \l__semantex_parentheses_store_temp_tl } - { \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } } - { \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } } + { normal } { + \tl_set:Nx #2 { + \exp_not:N \SemantexMathOpen { } + \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } \semantex_data_tl_get_exp_not:nn { #1 } { prearg } \semantex_data_tl_get_exp_not:nn { #1 } { arg } \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + \exp_not:N \SemantexMathClose { } + \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } } } - } - { - \str_case:VnF { \l__semantex_parentheses_store_temp_tl } % This is where \big,\Big, etc. go. - { - { normal } { - \tl_set:Nx#2 - { - \semantex_data_tl_get_exp_not:nn { #1 } { prearg } - \semantex_data_tl_get_exp_not:nn { #1 } { arg } - \semantex_data_tl_get_exp_not:nn { #1 } { postarg } - } - \str_if_eq:xnF { \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } } { . } - { - \tl_put_left:Nx#2 - { - \exp_not:N \mathopen \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } - } - } - \str_if_eq:xnF { \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } } { . } - { - \tl_put_right:Nx#2 - { - \exp_not:N \mathclose \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } - } - } - } - { auto } { - \tl_set:Nx#2 - { - \exp_not:N \SemantexLeft \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } - \semantex_data_tl_get_exp_not:nn { #1 } { prearg } - \semantex_data_tl_get_exp_not:nn { #1 } { arg } - \semantex_data_tl_get_exp_not:nn { #1 } { postarg } - \exp_not:N \SemantexRight \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } - } - } - { * } { - \tl_set:Nx#2 - { - \exp_not:N \SemantexLeft \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } - \semantex_data_tl_get_exp_not:nn { #1 } { prearg } - \semantex_data_tl_get_exp_not:nn { #1 } { arg } - \semantex_data_tl_get_exp_not:nn { #1 } { postarg } - \exp_not:N \SemantexRight \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } - } - } - } - { - \tl_set:Nx#2 + { auto } { + \tl_set:Nx #2 { - \exp_not:N \mathopen - \exp_not:V \l__semantex_parentheses_store_temp_tl + \exp_not:N \SemantexMathOpenAuto \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } \semantex_data_tl_get_exp_not:nn { #1 } { prearg } \semantex_data_tl_get_exp_not:nn { #1 } { arg } \semantex_data_tl_get_exp_not:nn { #1 } { postarg } - \exp_not:N \mathclose - \exp_not:V \l__semantex_parentheses_store_temp_tl + \exp_not:N \SemantexMathCloseAuto \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } } } - } -} - -\cs_generate_variant:Nn \str_case:nnF { VnF } - -\cs_generate_variant:Nn \str_if_eq:nnF { xnF } - -\cs_new_protected:Npn \semantex_no_parentheses_store:nN#1#2 -% The central command for handling the rendering of arguments with no parentheses around -{ - \semantex_data_bool_get:nnTF { #1 } { allowSemantexDelimiterSize } - { - \tl_set:Nn#2 { \SemantexNoParentheses } - \tl_put_right:Nx#2 - { + { * } { + \tl_set:Nx #2 { + \exp_not:N \SemantexMathOpenAuto + \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } \semantex_data_tl_get_exp_not:nn { #1 } { prearg } \semantex_data_tl_get_exp_not:nn { #1 } { arg } \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + \exp_not:N \SemantexMathCloseAuto + \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } } } } { - \tl_set:Nx#2 + \tl_set:Nx #2 { + \exp_not:N \SemantexMathOpen + \exp_not:V \l__semantex_parentheses_store_temp_tl + \semantex_data_tl_get_exp_not:nn { #1 } { leftpar } \semantex_data_tl_get_exp_not:nn { #1 } { prearg } \semantex_data_tl_get_exp_not:nn { #1 } { arg } \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + \exp_not:N \SemantexMathClose + \exp_not:V \l__semantex_parentheses_store_temp_tl + \semantex_data_tl_get_exp_not:nn { #1 } { rightpar } } } } +\cs_generate_variant:Nn \str_case:nnF { VnF } + +\cs_generate_variant:Nn \str_if_eq:nnF { xnF } + +\cs_new_protected:Npn \semantex_no_parentheses_store:nN#1#2 +% The central command for handling the rendering of arguments with no parentheses around +{ + \tl_set:Nx#2 + { + \exp_not:N\SemantexMathOpenNoPar + \semantex_data_tl_get_exp_not:nn { #1 } { prearg } + \semantex_data_tl_get_exp_not:nn { #1 } { arg } + \semantex_data_tl_get_exp_not:nn { #1 } { postarg } + \exp_not:N\SemantexMathCloseNoPar + } +} + \cs_new_protected:Npn \__semantex_symbol_parentheses_store:nnnnN#1#2#3#4#5 % The central command handling the rendering of symbol parentheses { @@ -2188,7 +2248,6 @@ \cs_new_protected:Npn \_semantex_arg_return_store:nN#1#2 { - \semantex_data_tl_get_store:nnN { #1 } { parsize } \l__arg_return_store_parsize_temp_tl \semantex_data_bool_get:nnTF { #1 } { par } { \semantex_data_int_if_positive:nnTF { #1 } { numberofarguments } @@ -5621,8 +5680,6 @@ dataprovide=parseoptions, dataprovide=texclass, boolprovide=leftargument, - boolprovide=allowSemantexDelimiterSize, - boolsettrue=allowSemantexDelimiterSize, dataprovide=heightphantom, dataprovide=slantingphantom, execute={ \semantex_data_seq_provide:nn { \semantex_this: } { commands_sequence } }, @@ -5692,21 +5749,6 @@ }, }, }, - {allowSemantexDelimiterSize}{ - strifeqTF={#1}{true} - { - boolsettrue={allowSemantexDelimiterSize}, - } - { - strifeqTF={#1}{false} - { - boolsetfalse={allowSemantexDelimiterSize}, - } - { - ERRORkeyvaluenotfound={allowSemantexDelimiterSize}{#1}, - } - }, - }, {default}{si={#1}}, {degreedefault}{sd={#1}}, {arg}{ execute={ \semantex_arg_singlekeys_set:nn { ##1 } { #1 } } }, @@ -5893,7 +5935,9 @@ }, }, {parsize}{ - execute={ \semantex_data_tl_set:nnn { ##1 } { parsize } { #1 } }, + execute={ + \semantex_data_tl_set:nnn { ##1 } { parsize } { #1 } + }, }, {leftpar}{ execute={ \semantex_data_tl_set:nnn { ##1 } { leftpar } { #1 } }, @@ -6023,12 +6067,16 @@ }, {preupper}{ execute={ - \semantex_data_tl_put_left:nnn { ##1 } { preupper } { #1 } + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_left:nnn { ##1 } { preupper } { #1 } + } }, }, {postupper}{ execute={ - \semantex_data_tl_put_right:nnn { ##1 } { postupper } { #1 } + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_right:nnn { ##1 } { postupper } { #1 } + } }, }, {upperputleft}{ @@ -6203,12 +6251,16 @@ }, {prelower}{ execute={ - \semantex_data_tl_put_left:nnn { ##1 } { prelower } { #1 } + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_left:nnn { ##1 } { prelower } { #1 } + } }, }, {postlower}{ execute={ - \semantex_data_tl_put_right:nnn { ##1 } { postlower } { #1 } + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_right:nnn { ##1 } { postlower } { #1 } + } }, }, {lowerputleft}{ @@ -6383,12 +6435,16 @@ }, {preupperleft}{ execute={ - \semantex_data_tl_put_left:nnn { ##1 } { preupperleft } { #1 } + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_left:nnn { ##1 } { preupperleft } { #1 } + } }, }, {postupperleft}{ execute={ - \semantex_data_tl_put_right:nnn { ##1 } { postupperleft } { #1 } + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_right:nnn { ##1 } { postupperleft } { #1 } + } }, }, {upperleftputright}{ @@ -6563,12 +6619,16 @@ }, {prelowerleft}{ execute={ - \semantex_data_tl_put_left:nnn { ##1 } { prelowerleft } { #1 } + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_left:nnn { ##1 } { prelowerleft } { #1 } + } }, }, {postlowerleft}{ execute={ - \semantex_data_tl_put_right:nnn { ##1 } { postlowerleft } { #1 } + \tl_if_blank:nF{#1}{ + \semantex_data_tl_put_right:nnn { ##1 } { postlowerleft } { #1 } + } }, }, {lowerleftputright}{ |