summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/semantex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/semantex')
-rw-r--r--macros/latex/contrib/semantex/semantex.pdfbin385165 -> 389783 bytes
-rw-r--r--macros/latex/contrib/semantex/semantex.sty1095
-rw-r--r--macros/latex/contrib/semantex/semantex.tex206
-rw-r--r--macros/latex/contrib/semantex/stripsemantex.lua34
-rw-r--r--macros/latex/contrib/semantex/stripsemantex.sty18
5 files changed, 323 insertions, 1030 deletions
diff --git a/macros/latex/contrib/semantex/semantex.pdf b/macros/latex/contrib/semantex/semantex.pdf
index 7bbf5313c2..2ed542a06f 100644
--- a/macros/latex/contrib/semantex/semantex.pdf
+++ b/macros/latex/contrib/semantex/semantex.pdf
Binary files differ
diff --git a/macros/latex/contrib/semantex/semantex.sty b/macros/latex/contrib/semantex/semantex.sty
index 325f2dbec5..8cdbecc789 100644
--- a/macros/latex/contrib/semantex/semantex.sty
+++ b/macros/latex/contrib/semantex/semantex.sty
@@ -1,5 +1,5 @@
\RequirePackage{xparse,l3keys2e,leftindex,semtex}
-\ProvidesExplPackage{semantex}{2021/08/23}{0.513}{}
+\ProvidesExplPackage{semantex}{2022/06/22}{0.520}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
@@ -10,7 +10,7 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\tl_set:Nn\SemantexVersion{0.513}
+\tl_set:Nn\SemantexVersion{0.520}
\cs_set_eq:NN \semantex_keyval_parse:NNn \keyval_parse:NNn
\cs_set:Npn \semantex_singlekey_parse:Nn#1#2 { \clist_map_function:nN { #2 } #1 }
@@ -50,8 +50,8 @@
\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 } }
+ \iow_now:Nn \g__semantex_semtex_file_stream_temp_iow { \RegisterClass {\SemantexBaseObject } }
+ \iow_now:Nn \g__semantex_semtex_file_stream_temp_iow { \RegisterObject {\SemantexDelimiterSize } }
}
\cs_set:Npn\semantex_write_to_semtex_file:n##1
@@ -126,17 +126,17 @@
\cs_new_protected:Npn\semantex_write_class_declaration_to_semtex_file:n#1
{
- \semantex_write_to_semtex_file:n { \DeclareClass{#1} }
+ \semantex_write_to_semtex_file:n { \RegisterClass{#1} }
}
\cs_new_protected:Npn\semantex_write_object_declaration_to_semtex_file:n#1
{
- \semantex_write_to_semtex_file:n { \DeclareObject{#1} }
+ \semantex_write_to_semtex_file:n { \RegisterObject{#1} }
}
-\cs_new_protected:Npn\SemantexIDcommand#1
+\cs_new_protected:Npn\SemantexID#1
{
- \semantex_write_to_semtex_file:n { \SemantexID{#1} }
+ \semantex_write_to_semtex_file:n { \RegisterID{#1} }
}
\cs_set_eq:NN\SemantexRecordObject\semantex_write_object_declaration_to_semtex_file:n
@@ -148,11 +148,9 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\DeclareDocumentCommand\semantex_new_simple_class:Nw{mO{}} % new simple-type class
+\cs_new_protected:Npn\semantex_declare_simple_class:N#1 % new simple-type class
{
% #1 = class name
- % #2 = options
- \semantex_new_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } }
\DeclareDocumentCommand{#1}{m}
{
% the actual \#1 command
@@ -169,7 +167,7 @@
##1
}
}
- \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}}
+ \exp_args:Nc\DeclareDocumentCommand{__semantex_declare_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}}
{
% the command for creating a new object of class #1
% ##1 = command name, with backslash
@@ -177,13 +175,13 @@
% ##3 = options
\IfValueTF{##2}
{
- \semantex_new_object:NNn #1 ##1 {
+ \semantex_declare_object:NNn #1 ##1 {
\semantex_object_set_symbol:Nn ##1 { ##2 }
\semantex_object_set_keys:Nn ##1 { ##3 }
}
}
{
- \semantex_new_object:NNn #1 ##1 {
+ \semantex_declare_object:NNn #1 ##1 {
\semantex_object_set_keys:Nn ##1 { ##3 }
}
}
@@ -197,13 +195,23 @@
}
}
-\tl_set_eq:NN\NewSimpleClass\semantex_new_simple_class:Nw
+\NewDocumentCommand\DeclareSimpleClass{ m O{} }
+{
+ \semantex_declare_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } }
+ \semantex_declare_simple_class:N #1
+}
+
+\NewDocumentCommand\NewSimpleClass { m O{} }
+{
+ \semantex_new_class_and_do:NNnn #1 \DeclareSimpleClass { \semantex_class_set_keys:Nn #1 { #2 } }
+ {
+ \semantex_declare_simple_class:N #1
+ }
+}
-\DeclareDocumentCommand\semantex_new_symbol_class:Nw{mO{}} % new symbol-type class
+\cs_new_protected:Npn\semantex_declare_symbol_class:N #1 % new symbol-type class
{
% #1 = class name
- % #2 = options
- \semantex_new_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } }
\DeclareDocumentCommand{#1}{mo}
{
% the actual \#1 command
@@ -243,7 +251,7 @@
}
}
}
- \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}}
+ \exp_args:Nc\DeclareDocumentCommand{__semantex_declare_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}}
{
% the command for creating a new object of class #1
% ##1 = command name, with backslash
@@ -251,13 +259,13 @@
% ##3 = options
\IfValueTF{##2}
{
- \semantex_new_object:NNn #1 ##1 {
+ \semantex_declare_object:NNn #1 ##1 {
\semantex_object_set_symbol:Nn ##1 { ##2 }
\semantex_object_set_keys:Nn ##1 { ##3 }
}
}
{
- \semantex_new_object:NNn #1 ##1 {
+ \semantex_declare_object:NNn #1 ##1 {
\semantex_object_set_keys:Nn ##1 { ##3 }
}
}
@@ -281,14 +289,23 @@
}
}
-\tl_set_eq:NN\NewSymbolClass\semantex_new_symbol_class:Nw
+\NewDocumentCommand\DeclareSymbolClass{ m O{} }
+{
+ \semantex_declare_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } }
+ \semantex_declare_symbol_class:N #1
+}
-\DeclareDocumentCommand\semantex_new_variable_class:Nw{mO{}} % new variable-type class
+\NewDocumentCommand\NewSymbolClass { m O{} }
+{
+ \semantex_new_class_and_do:NNnn #1 \DeclareSymbolClass { \semantex_class_set_keys:Nn #1 { #2 } }
+ {
+ \semantex_declare_symbol_class:N #1
+ }
+}
+
+\cs_new_protected:Npn\semantex_declare_variable_class:N#1 % new variable-type class
{
% #1 = class name
- % #2 = options
- \semantex_new_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } }
- %\semantex_new_class:Nn #1 { #2 }
\DeclareDocumentCommand{#1}{mog}
{
% the actual \#1 command
@@ -375,7 +392,7 @@
}
}
}
- \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}}
+ \exp_args:Nc\DeclareDocumentCommand{__semantex_declare_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}}
{
% the command for creating a new object of class #1
% ##1 = command name, with backslash
@@ -383,13 +400,13 @@
% ##3 = options
\IfValueTF{##2}
{
- \semantex_new_object:NNn #1 ##1 {
+ \semantex_declare_object:NNn #1 ##1 {
\semantex_object_set_symbol:Nn ##1 { ##2 }
\semantex_object_set_keys:Nn ##1 { ##3 }
}
}
{
- \semantex_new_object:NNn #1 ##1 {
+ \semantex_declare_object:NNn #1 ##1 {
\semantex_object_set_keys:Nn ##1 { ##3 }
}
}
@@ -444,796 +461,20 @@
}
}
-\cs_set_eq:NN\NewVariableClass\semantex_new_variable_class:Nw
-
-\DeclareDocumentCommand\semantex_new_cohomology_class:Nw{mO{}} % new cohomology-type class
+\NewDocumentCommand\DeclareVariableClass{ m O{} }
{
- % #1 = class name
- % #2 = options
- \semantex_new_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } }
- \DeclareDocumentCommand{#1}{mogg}{
- % the actual \#1 command
- \IfValueTF{##2}
- {
- \IfValueTF { ##3 }
- {
- \str_if_eq:nnTF { ##3 }{ * }
- {
- \IfValueTF { ##4 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } [ ##2 ] { * } { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##2 }
- \semantex_object_associated_to_class_use_bullet:N #1
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##4 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } [ ##2 ] { * } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##2 }
- \semantex_object_associated_to_class_use_bullet:N #1
- }
- }
- }
- {
- \str_if_eq:nnTF { ##3 }{ ** }
- {
- \IfValueTF { ##4 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } [ ##2 ] { ** } { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##2 }
- \semantex_object_associated_to_class_use_double_bullet:N #1
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##4 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } [ ##2 ] { ** } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##2 }
- \semantex_object_associated_to_class_use_double_bullet:N #1
- }
- }
- }
- {
- \IfValueTF { ##4 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } [ ##2 ] { ##3 } { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##2 }
- \semantex_object_associated_to_class_set_degree_default:Nn #1 { ##3 }
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##4 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } [ ##2 ] { ##3 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##2 }
- \semantex_object_associated_to_class_set_degree_default:Nn #1 { ##3 }
- }
- }
- }
- }
- }
- {
- \IfValueTF { ##4 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } [ ##2 ] { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##2 }
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##4 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } [ ##2 ] }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##2 }
- }
- }
- }
- }
- {
- \IfValueTF { ##3 }
- {
- \str_if_eq:nnTF { ##3 }{ * }
- {
- \IfValueTF { ##4 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } { * } { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_use_bullet:N #1
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##4 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } { * } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_use_bullet:N #1
- }
- }
- }
- {
- \str_if_eq:nnTF { ##3 }{ ** }
- {
- \IfValueTF { ##4 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } { ** } { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_use_double_bullet:N #1
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##4 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } { ** } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_use_double_bullet:N #1
- }
- }
- }
- {
- \IfValueTF { ##4 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } { ##3 } { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_degree_default:Nn #1 { ##3 }
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##4 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } { ##3 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_degree_default:Nn #1 { ##3 }
- }
- }
- }
- }
- }
- {
- \IfValueTF { ##4 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##4 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- }
- }
- }
- }
- }
- \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_\semantex_class_to_register:N #1_with_options:nnw}{mmogg}
- {
- \IfValueTF{##3}
- {
- \IfValueTF { ##4 }
- {
- \str_if_eq:nnTF { ##4 }{ * }
- {
- \IfValueTF { ##5 }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { [ ##3 ] { * } { ##5 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##3 }
- \semantex_object_associated_to_class_use_bullet:N #1
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##5 }
- }
- }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { [ ##3 ] { * } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##3 }
- \semantex_object_associated_to_class_use_bullet:N #1
- }
- }
- }
- {
- \str_if_eq:nnTF { ##4 }{ ** }
- {
- \IfValueTF { ##5 }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { [ ##3 ] { ** } { ##5 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##3 }
- \semantex_object_associated_to_class_use_double_bullet:N #1
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##5 }
- }
- }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { [ ##3 ] { ** } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##3 }
- \semantex_object_associated_to_class_use_double_bullet:N #1
- }
- }
- }
- {
- \IfValueTF { ##5 }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { [ ##3 ] { ##4 } { ##5 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##3 }
- \semantex_object_associated_to_class_set_degree_default:Nn #1 { ##4 }
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##5 }
- }
- }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { [ ##3 ] { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##3 }
- \semantex_object_associated_to_class_set_degree_default:Nn #1 { ##4 }
- }
- }
- }
- }
- }
- {
- \IfValueTF { ##5 }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { [ ##3 ] { ##5 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##3 }
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##5 }
- }
- }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { [ ##3 ] }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##3 }
- }
- }
- }
- }
- {
- \IfValueTF { ##4 }
- {
- \str_if_eq:nnTF { ##4 }{ * }
- {
- \IfValueTF { ##5 }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { { * } { ##5 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_use_bullet:N #1
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##5 }
- }
- }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { { * } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_use_bullet:N #1
- }
- }
- }
- {
- \str_if_eq:nnTF { ##4 }{ ** }
- {
- \IfValueTF { ##5 }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { { ** } { ##5 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_use_double_bullet:N #1
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##5 }
- }
- }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { { ** } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_use_double_bullet:N #1
- }
- }
- }
- {
- \IfValueTF { ##5 }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { { ##4 } { ##5 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_degree_default:Nn #1 { ##4 }
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##5 }
- }
- }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_degree_default:Nn #1 { ##4 }
- }
- }
- }
- }
- }
- {
- \IfValueTF { ##5 }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { { ##5 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##5 }
- }
- }
- {
- % \semantex_add_to_existing_original_source_in_semtex_file:n { } % write nothing to file
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- }
- }
- }
- }
- }
- \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mgO{}}
- {
- % the command for creating a new object of class #1
- % ##1 = command name, with backslash
- % ##2 = symbol
- % ##3 = options
- \IfValueTF{##2}
- {
- \semantex_new_object:NNn #1 { ##1 }{
- \semantex_object_set_symbol:Nn ##1 { ##2 }
- \semantex_object_set_keys:Nn ##1 { ##3 }
- }
- }
- {
- \semantex_new_object:NNn #1 { ##1 }{
- \semantex_object_set_keys:Nn ##1 { ##3 }
- }
- }
- % creates the object with name ##1
- \DeclareDocumentCommand{##1}{ogg}
- {
- % the actual \##1 command
- \IfValueTF{####1}
- {
- \IfValueTF{####2}
- {
- \str_if_eq:nnTF { ####2 } { * }
- {
- \IfValueTF{####3}
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 [ ####1 ] { * } { ####3 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_keys:Nn ##1 { ####1 }
- \semantex_object_use_bullet:N ##1
- \semantex_object_set_arg:Nn ##1 { ####3 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 [ ####1 ] { * } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_keys:Nn ##1 { ####1 }
- \semantex_object_use_bullet:N ##1
- }
- }
- }
- {
- \str_if_eq:nnTF { ####2 } { ** }
- {
- \IfValueTF{####3}
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 [ ####1 ] { ** } { ####3 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_keys:Nn ##1 { ####1 }
- \semantex_object_use_double_bullet:N ##1
- \semantex_object_set_arg:Nn ##1 { ####3 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 [ ####1 ] { ** } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_keys:Nn ##1 { ####1 }
- \semantex_object_use_double_bullet:N ##1
- }
- }
- }
- {
- \IfValueTF{####3}
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 [ ####1 ] { ####2 } { ####3 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_keys:Nn ##1 { ####1 }
- \semantex_object_set_degree_default:Nn ##1 { ####2 }
- \semantex_object_set_arg:Nn ##1 { ####3 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 [ ####1 ] { ####2 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_keys:Nn ##1 { ####1 }
- \semantex_object_set_degree_default:Nn ##1 { ####2 }
- }
- }
- }
- }
- }
- {
- \IfValueTF{####3}
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 [ ####1 ] { ####3 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_keys:Nn ##1 { ####1 }
- \semantex_object_set_arg:Nn ##1 { ####3 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 [ ####1 ] }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_keys:Nn ##1 { ####1 }
- }
- }
- }
- }
- {
- \IfValueTF{####2}
- {
- \str_if_eq:nnTF { ####2 } { * }
- {
- \IfValueTF{####3}
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 { * } { ####3 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_use_bullet:N ##1
- \semantex_object_set_arg:Nn ##1 { ####3 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 { * } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_use_bullet:N ##1
- }
- }
- }
- {
- \str_if_eq:nnTF { ####2 } { ** }
- {
- \IfValueTF{####3}
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 { ** } { ####3 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_use_double_bullet:N ##1
- \semantex_object_set_arg:Nn ##1 { ####3 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 { ** } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_use_double_bullet:N ##1
- }
- }
- }
- {
- \IfValueTF{####3}
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 { ####2 } { ####3 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_degree_default:Nn ##1 { ####2 }
- \semantex_object_set_arg:Nn ##1 { ####3 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 { ####2 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_degree_default:Nn ##1 { ####2 }
- }
- }
- }
- }
- }
- {
- \IfValueTF{####3}
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 { ####3 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_arg:Nn ##1 { ####3 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 }
- \semantex_render_object:Nn ##1 { }
- }
- }
- }
- }
- }
+ \semantex_declare_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } }
+ \semantex_declare_variable_class:N #1
}
-\cs_set_eq:NN\NewCohomologyClass\semantex_new_cohomology_class:Nw
-
-\DeclareDocumentCommand\semantex_new_delimiter_class:Nw{mO{}} % new delimiter-type class
+\NewDocumentCommand\NewVariableClass { m O{} }
{
- % #1 = class name
- % #2 = options
- \semantex_new_class:Nn { #1 } { \semantex_class_set_keys:Nn #1 { #2 } }
- \DeclareDocumentCommand{#1}{mog} % maybe this does not even make sense for delimiters
- {
- \IfValueTF { ##2 }
- {
- \IfValueTF { ##3 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } [ ##2 ] { ##3 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##2 }
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##3 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } [ ##2 ] }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##2 }
- }
- }
- }
- {
- \IfValueTF { ##3 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } { ##3 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##3 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { #1 { ##1 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##1 }
- }
- }
- }
- }
- % the actual \#1 command
- \exp_args:Nc\DeclareDocumentCommand{__semantex_make_object_of_\semantex_class_to_register:N #1_with_options:nnw}{mmog}
- {
- \IfValueTF { ##3 }
- {
- \IfValueTF { ##4 }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { [ ##3 ] { ##4 } }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##3 }
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##4 }
- }
- }
- {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { [ ##3 ] }
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_keys:Nn #1 { ##3 }
- }
- }
- }
- {
- \IfValueTF { ##4 }
- {
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_add_to_existing_original_source_in_semtex_file:n
- { { ##4 } }
- \semantex_object_associated_to_class_do_output:N #1
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- \semantex_object_associated_to_class_set_arg:Nn #1 { ##4 }
- }
- }
- {
- % \semantex_add_to_existing_original_source_in_semtex_file:n { } % write nothing to file
- \semantex_render_object_associated_to_class:Nn #1 {
- \semantex_object_associated_to_class_set_symbol:Nn #1 { ##2 }
- ##1
- }
- }
- }
- }
- \exp_args:Nc\DeclareDocumentCommand{__semantex_new_object_of_\semantex_class_to_register:N #1:Nw}{mmmO{}}
+ \semantex_new_class_and_do:NNnn #1 \DeclareVariableClass { \semantex_class_set_keys:Nn #1 { #2 } }
{
- % the command for creating a new object of class #1
- % ##1 = command name, with backslash
- % ##2 = symbol
- % ##3 = options
- \semantex_new_object:NNn #1 { ##1 }{
- \semantex_object_set_left_par:Nn ##1 { ##2 }
- \semantex_object_set_right_par:Nn ##1 { ##3 }
- \semantex_object_set_keys:Nn ##1 { ##4 }
- }
- % creates the object with name ##1
- \DeclareDocumentCommand{##1}{og}
- {
- % the actual \##1 command
- \IfValueTF { ####1 }
- {
- \IfValueTF { ####2 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 [ ####1] { ####2 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_keys:Nn ##1 { ####1 }
- \semantex_object_set_arg:Nn ##1 { ####2 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 [ ####1] }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_keys:Nn ##1 { ####1 }
- }
- }
- }
- {
- \IfValueTF { ####2 }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 { ####2 } }
- \semantex_render_object:Nn ##1 {
- \semantex_object_do_output:N ##1
- \semantex_object_set_arg:Nn ##1 { ####2 }
- }
- }
- {
- \semantex_write_original_source_to_semtex_file:n
- { ##1 }
- \semantex_render_object:Nn ##1 { }
- }
- }
- }
+ \semantex_declare_variable_class:N #1
}
}
-\cs_set_eq:NN\NewDelimiterClass\semantex_new_delimiter_class:Nw
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% COMMANDS FOR CREATING AND HANDLING CLASSES AND OJBECTS
@@ -1251,33 +492,48 @@
\cs_new:Npn\semantex_class_to_register:N#1
{
% #1 = name of class
- class_\cs_to_str:N #1
+ class_\token_to_str:N #1
}
\cs_new:Npn\semantex_class_to_associated_object_register:N#1
{
% #1 = name of class
- object_associated_to_class_\cs_to_str:N #1
+ object_associated_to_class_\token_to_str:N #1
}
\cs_new:Npn\semantex_object_to_register:N#1
{
% #1 = name of object
- object_\cs_to_str:N #1
+ object_\token_to_str:N #1
}
-\DeclareDocumentCommand\NewObject { m }
+\tl_new:N \g_semantex_class_SemantexBaseObject_register_tl
+
+\tl_set:Nx \g_semantex_class_SemantexBaseObject_register_tl { \semantex_class_to_register:N \SemantexBaseObject }
+
+\DeclareDocumentCommand\DeclareObject { m m }
{
% #1 = name of object
\semantex_class_if_exist:NTF #1
{
- \use:c { __semantex_new_object_of_\semantex_class_to_register:N #1:Nw }
+ \use:c { __semantex_declare_object_of_\semantex_class_to_register:N #1:Nw } #2
}
{
\msg_error:nnn { semantex } { created_object_of_unknown_class } { #1 }
}
}
+\DeclareDocumentCommand\NewObject { m m }
+{
+ \cs_if_exist:NTF #2
+ {
+ \msg_error:nnn { semantex } { created_object_with_already_defined_name } { #2 }
+ }
+ {
+ \DeclareObject #1 #2
+ }
+}
+
\DeclareDocumentCommand\UseClassInCommand { mo }
{
\semantex_class_if_exist:NTF #1
@@ -1306,7 +562,7 @@
\semantex_data_tl_provide:nn { #1 } { parent }
- \semantex_data_tl_set:nnn { #1 } { parent } { class_SemantexBaseObject }
+ \semantex_data_tl_set:nno { #1 } { parent } { \g_semantex_class_SemantexBaseObject_register_tl }
% The parent class by default is \SemantexBaseObject
\cs_set:cpn { __semantex_data_cs_#1_valuekey:nn } ##1##2 % command controlling valuekeys
@@ -1339,7 +595,7 @@
\cs_generate_variant:Nn \semantex_new_register:nn { xn }
-\cs_new_protected:Npn \semantex_new_class:Nn#1#2
+\cs_new_protected:Npn \semantex_declare_class:Nn#1#2
{
% create a new class
% #1 = name of class
@@ -1357,7 +613,24 @@
}
}
-\cs_set_protected:Npn \semantex_new_object:NNn#1#2#3
+\cs_new_protected:Npn \semantex_new_class_and_do:NNnn#1#2#3#4
+{
+ % create a new class
+ % #1 = name of class
+ % #2 = name of \Declare...Class variant of command, for error messages
+ % #3 = standard keyval setup
+ % #4 = code to execute if successful
+ \cs_if_exist:NTF #1
+ {
+ \msg_error:nnnn { semantex } { created_class_with_already_defined_name } { #1 } { #2 }
+ }
+ {
+ \semantex_declare_class:Nn #1 { #3 }
+ #4
+ }
+}
+
+\cs_set_protected:Npn \semantex_declare_object:NNn#1#2#3
{
% create a new object
% #1 = name of class
@@ -1427,56 +700,6 @@
\semantex_valuekey:nnn { \semantex_object_to_register:N #1 } { arg } { #2 }
}
-\cs_new_protected:Npn\semantex_object_associated_to_class_set_degree_default:Nn#1#2
-{
- \semantex_valuekey:nnn { \semantex_class_to_associated_object_register:N #1 } { degree~default } { #2 }
-}
-
-\cs_new_protected:Npn\semantex_object_set_degree_default:Nn#1#2
-{
- \semantex_valuekey:nnn { \semantex_object_to_register:N #1 } { degree~default } { #2 }
-}
-
-\cs_new_protected:Npn\semantex_object_associated_to_class_use_bullet:N#1
-{
- \semantex_singlekey:nn { \semantex_class_to_associated_object_register:N #1 } { * }
-}
-
-\cs_new_protected:Npn\semantex_object_use_bullet:N#1
-{
- \semantex_singlekey:nn { \semantex_object_to_register:N #1 } { * }
-}
-
-\cs_new_protected:Npn\semantex_object_associated_to_class_use_double_bullet:N#1
-{
- \semantex_singlekey:nn { \semantex_class_to_associated_object_register:N #1 } { * }
-}
-
-\cs_new_protected:Npn\semantex_object_use_double_bullet:N#1
-{
- \semantex_singlekey:nn { \semantex_object_to_register:N #1 } { * }
-}
-
-\cs_new_protected:Npn\semantex_object_associated_to_class_set_left_par:Nn#1#2
-{
- \semantex_data_tl_set:nnn { \semantex_class_to_associated_object_register:N #1 } { left~par } { #2 }
-}
-
-\cs_new_protected:Npn\semantex_object_set_left_par:Nn#1#2
-{
- \semantex_data_tl_set:nnn { \semantex_object_to_register:N #1 } { left~par } { #2 }
-}
-
-\cs_new_protected:Npn\semantex_object_associated_to_class_set_right_par:Nn#1#2
-{
- \semantex_data_tl_set:nnn { \semantex_class_to_associated_object_register:N #1 } { right~par } { #2 }
-}
-
-\cs_new_protected:Npn\semantex_object_set_right_par:Nn#1#2
-{
- \semantex_data_tl_set:nnn { \semantex_object_to_register:N #1 } { right~par } { #2 }
-}
-
\cs_new_protected:Npn\semantex_object_associated_to_class_set_class:Nn#1#2
{
\semantex_data_class_set:nn { \semantex_class_to_associated_object_register:N #1 } { #2 }
@@ -2449,7 +1672,7 @@
\use:c { g__semantex_data_tl_#1_#2 }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_msg_error:nnx { #3 } { data_tl_not_found } { #2 }
}
@@ -2478,7 +1701,7 @@
\exp_not:v { g__semantex_data_tl_#1_#2 }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_msg_error:nnx { #3 } { data_tl_not_found } { #2 }
}
@@ -2509,7 +1732,7 @@
\tl_set_eq:Nc #3 { g__semantex_data_tl_#1_#2 }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_msg_error:nnx { #4 } { data_tl_not_found } { #2 }
}
@@ -2553,7 +1776,7 @@
\tl_set:cn { g__semantex_data_tl_#1_#2 } { #3 }
}
-\cs_generate_variant:Nn \semantex_data_tl_set:nnn { nnx }
+\cs_generate_variant:Nn \semantex_data_tl_set:nnn { nno, nnx }
\cs_new_protected:Npn \semantex_data_tl_put_right:nnn#1#2#3
{
@@ -2632,7 +1855,7 @@
\int_use:c { g__semantex_data_int_#1_#2 }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_msg_error:nnx { #3 } { data_int_not_found } { #2 }
}
@@ -2642,7 +1865,7 @@
}
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_msg_error:nnx { #3 } { data_int_not_found } { #2 }
}
@@ -2673,7 +1896,7 @@
\int_set_eq:Nc#3 { g__semantex_data_int_#1_#2 }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_msg_error:nnx { #4 } { data_int_not_found } { #2 }
}
@@ -2683,7 +1906,7 @@
}
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_msg_error:nnx { #4 } { data_int_not_found } { #2 }
}
@@ -2821,7 +2044,7 @@
\bool_if:cTF { g__semantex_data_bool_#1_if_#2 } { #3 } { #4 }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
#4
}
@@ -2831,7 +2054,7 @@
}
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_msg_error:nnx { #5 } { data_bool_not_found } { #2 }
}
@@ -3003,7 +2226,7 @@
\use:c { __semantex_data_cs_custom_valuekey_#1_#2:nn } { #4 } { #3 }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_msg_error:nnn { #4 } { valuekey_not_found } { #2 }
}
@@ -3027,7 +2250,7 @@
% #1 = register
% #2 = key
% #3 = value
- \use:c { __semantex_data_cs_custom_valuekey_class_SemantexBaseObject_#2:nn } { #1 } { #3 }
+ \use:c { __semantex_data_cs_custom_valuekey_\g_semantex_class_SemantexBaseObject_register_tl _#2:nn } { #1 } { #3 }
}
\cs_new_protected:Npn\semantex_singlekey:nn#1#2
@@ -3050,7 +2273,7 @@
\use:c { __semantex_data_cs_custom_singlekey_#1_#2:n } { #3 }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_valuekey:nnn { #3 } { default } { #2 }
}
@@ -3080,7 +2303,7 @@
% the name of the register
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_valuekey:nnx { #3 } { default } { #2 }
}
@@ -3104,7 +2327,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_valuekey_#1_\tl_trim_spaces:n{#2}:nn } { ##1 } { ##2 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3127,7 +2350,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_singlekey_#1_\tl_trim_spaces:n{#2}:n } { ##1 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3151,7 +2374,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_two_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnn } { ##1 } { ##2 } { ##3 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3175,7 +2398,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_three_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnn } { ##1 } { ##2 } { ##3 } { ##4 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3199,7 +2422,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_four_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3223,7 +2446,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_five_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3247,7 +2470,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_six_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3271,7 +2494,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_seven_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3295,7 +2518,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_eight_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } { ##9 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3319,7 +2542,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_nine_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } { ##9 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3349,7 +2572,7 @@
\use:c { __semantex_data_cs_custom_arg_valuekey_#1_#2:nn } { #4 } { #3 }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_msg_error:nnn { #1 } { arg_valuekey_not_found } { #2 }
}
@@ -3379,7 +2602,7 @@
\use:c { __semantex_data_cs_custom_arg_singlekey_#1_#2:n } { #3 }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_arg_valuekey:nnn { #3 } { default } { #2 }
}
@@ -3409,7 +2632,7 @@
% the name of the register
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\semantex_arg_valuekey:nnx { #3 } { default } { #2 }
}
@@ -3443,7 +2666,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_arg_valuekey_#1_\tl_trim_spaces:n{#2}:nn } { ##1 } { ##2 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3466,7 +2689,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_arg_singlekey_#1_\tl_trim_spaces:n{#2}:n } { ##1 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3490,7 +2713,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_arg_two_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnn } { ##1 } { ##2 } { ##3 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3514,7 +2737,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_arg_three_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnn } { ##1 } { ##2 } { ##3 } { ##4 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3538,7 +2761,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_arg_four_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3562,7 +2785,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_arg_five_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3586,7 +2809,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_arg_six_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3610,7 +2833,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_arg_seven_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3634,7 +2857,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_arg_eight_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } { ##9 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -3658,7 +2881,7 @@
\exp_args:NNNo \exp_args:NNo\tl_set:No#3 { \use:c { __semantex_data_cs_custom_arg_nine_valuekey_#1_\tl_trim_spaces:n{#2}_auxiliary:nnnnnnnnn } { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } { ##6 } { ##7 } { ##8 } { ##9 } }
}
{
- \str_if_eq:nnTF { #1 } { class_SemantexBaseObject }
+ \str_if_eq:nVTF { #1 } \g_semantex_class_SemantexBaseObject_register_tl
{
\tl_set:Nn #3 {}
}
@@ -7050,49 +6273,53 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\msg_new:nnnn { semantex } { semantex_setup_key_not_found } { Unknown~key~#1~passed~to~\SemantexSetup~on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { semantex_setup_key_not_found } { Unknown~key~#1~passed~to~\token_to_str:N\SemantexSetup~on~line~\msg_line_number: } {}
+
+\msg_new:nnnn { semantex } { semantex_setup_key_value_not_found } { Unknown~value~#2~passed~to~key~#1~in~\token_to_str:N\SemantexSetup~on~line~\msg_line_number: } {}
+
+\msg_new:nnnn { semantex } { valuekey_not_found } { Unknown~key~#2~passed~to~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { semantex_setup_key_value_not_found } { Unknown~value~#2~passed~to~key~#1~in~\SemantexSetup~on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { arg_valuekey_not_found } { Unknown~argument~key~#2~passed~to~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { valuekey_not_found } { Unknown~key~#2~passed~to~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { data_tl_not_found } { Unknown~data~#2~requested~from~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { arg_valuekey_not_found } { Unknown~argument~key~#2~passed~to~#1on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { data_int_not_found } { Unknown~integer~#2~requested~from~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { data_tl_not_found } { Unknown~data~#2~requested~from~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { data_bool_not_found } { Unknown~boolean~#2~requested~from~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { data_int_not_found } { Unknown~integer~#2~requested~from~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { data_cs_not_found } { Unknown~command~sequence~#2~requested~from~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { data_bool_not_found } { Unknown~boolean~#2~requested~from~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { data_prop_not_found } { Unknown~property~list~#2~requested~from~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { data_cs_not_found } { Unknown~command~sequence~#2~requested~from~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { key_value_not_found } { Unknown~value~#3~passed~to~key~#2~in~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { data_prop_not_found } { Unknown~property~list~#2~requested~from~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { arg_key_value_not_found } { Unknown~value~#3~passed~to~argument~key~#2~in~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { key_value_not_found } { Unknown~value~#3~passed~to~key~#2~in~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { class_already_defined } { Class~#1~already~defined;~you~tried~defining~it~again~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { arg_key_value_not_found } { Unknown~value~#3~passed~to~argument~key~#2~in~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { object_already_defined } { Object~#1~already~defined;~you~tried~defining~it~again~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { class_already_defined } { Class~#1 already~defined;~you~tried~defining~it~again~on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { class_not_found } { Unknown~class~#3~declared~as~#2~of~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { object_already_defined } { Object~#1 already~defined;~you~tried~defining~it~again~on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { object_not_found } { You~set~#1~as~#2~of~unknown~object~#3~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { class_not_found } { Unknown~class~#3 declared~as~#2~of~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { created_object_of_unknown_class } { Unknown~class~#1~declared~as~class~of~#2~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { object_not_found } { You~set~#1 as~#2~of~unknown~object~#3 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { created_object_with_already_defined_name } { Command~#1~already~defined;~you~can~use~\token_to_str:N\DeclareObject~to~override~existing~commands. } {}
-\msg_new:nnnn { semantex } { created_object_of_unknown_class } { Unknown~class~#1 declared~as~class~of~#2 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { created_class_with_already_defined_name } { Command~#1~already~defined;~you~can~use~\token_to_str:N #2~to~override~existing~commands. } {}
-\msg_new:nnnn { semantex } { used_unknown_class } { Unknown~class~#1 received~by~\token_to_str:N\UseClassInCommand~on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { used_unknown_class } { Unknown~class~#1~received~by~\token_to_str:N\UseClassInCommand~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { setup_unknown_class } { You~tried~setting~up~an~unknown~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { setup_unknown_class } { You~tried~setting~up~an~unknown~#1~on~line~\msg_line_number: } {}
-\msg_new:nnnn { semantex } { setup_unknown_object } { You~tried~setting~up~an~unknown~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { setup_unknown_object } { You~tried~setting~up~an~unknown~#1~on~line~\msg_line_number: } {}
\msg_new:nnnn { semantex } { created_a_SemantexBaseObject } { Never~create~objects~of~class~\token_to_str:N\SemantexBaseObject;~create~a~new~class~yourself~instead.~You~created~the~object~#1 on~line~\msg_line_number: } {}
\msg_new:nnnn { semantex } { SemantexThis_in_input_stream } { The~command~\token_to_str:N\SemantexThis~was~found~outside~a~class~or~object~on~line~\msg_line_number:;~did~you~forget~to~use~set~keys~x={...}? } {}
-\msg_new:nnnn { semantex } { generic_error } { #2~#1 on~line~\msg_line_number: } {}
+\msg_new:nnnn { semantex } { generic_error } { #2~#1~on~line~\msg_line_number: } {}
\cs_generate_variant:Nn \msg_error:nnnn { nnnx }
@@ -7101,10 +6328,9 @@
\cs_new_protected:Npn\semantex_error_output_format:nN#1#2
{
\tl_set:Nn \l__semantex_error_output_format_temp { #1 }
- \tl_replace_all:Nnn \l__semantex_error_output_format_temp { object_associated_to_class_ } { object~of~class~\cs:w }
- \tl_replace_all:Nnn \l__semantex_error_output_format_temp { object_ } { object~\cs:w }
- \tl_replace_all:Nnn \l__semantex_error_output_format_temp { class_ } { class~\cs:w }
- \tl_put_right:Nn \l__semantex_error_output_format_temp { \cs_end: }
+ \tl_replace_all:Nnn \l__semantex_error_output_format_temp { object_associated_to_class_ } { object~of~class~ }
+ \tl_replace_all:Nnn \l__semantex_error_output_format_temp { object_ } { object~ }
+ \tl_replace_all:Nnn \l__semantex_error_output_format_temp { class_ } { class~ }
\tl_trim_spaces:N \l__semantex_error_output_format_temp
\tl_set_eq:NN #2 \l__semantex_error_output_format_temp
}
@@ -7172,7 +6398,7 @@
{define~keys[1]}{execute={ \semantex_define_valuekeys:nn { ##1 } { #1 } }},
}
-\semantex_new_simple_class:Nw \SemantexBaseObject [
+\NewSimpleClass \SemantexBaseObject [
define~keys[1]={
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -7686,7 +6912,6 @@
},
},
{default}{sep~i={#1}},
- {degree~default}{sep~d={#1}},
{arg}{ execute={ \semantex_arg_singlekeys_set:nn { ##1 } { #1 } } },
{*~with~other~sep}{
d~*~with~other~sep={#1},
@@ -9456,12 +8681,12 @@
},
]
-\cs_set_eq:NN\__semantex_old_version_of_semantex_new_object_of_class_SemantexBaseObject:Nw \__semantex_new_object_of_class_SemantexBaseObject:Nw
+\cs_set_eq:cc { __semantex_old_version_of_semantex_declare_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw } { __semantex_declare_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw }
-\cs_set_protected:Npn \__semantex_new_object_of_class_SemantexBaseObject:Nw#1
+\cs_set_protected:Npn \__semantex_declare_object_of_class_SemantexBaseObject:Nw#1
{
\msg_error:nnn { semantex } { created_a_SemantexBaseObject } { #1 }
- \__semantex_old_version_of_semantex_new_object_of_class_SemantexBaseObject:Nw #1
+ \use:c { __semantex_old_version_of_semantex_declare_object_of_\g_semantex_class_SemantexBaseObject_register_tl :Nw } #1
}
diff --git a/macros/latex/contrib/semantex/semantex.tex b/macros/latex/contrib/semantex/semantex.tex
index 3b2630da08..a377e0f217 100644
--- a/macros/latex/contrib/semantex/semantex.tex
+++ b/macros/latex/contrib/semantex/semantex.tex
@@ -42,19 +42,6 @@
\usepackage[nameinlink]{cleveref}
-\title{Seman\!\TeX: semantic, keyval-based mathematics (v0.513)}
-\date{\today}
-\author{Sebastian Ørsted (\href{mailto:sorsted@gmail.com}{sorsted@gmail.com})}
-
-\hypersetup{
- pdfauthor={Sebastian Ørsted},
- pdftitle={SemanTeX: semantic, keyval-based mathematics},
- %pdfsubject={},
- %pdfkeywords={},
- %pdfproducer={Latex with hyperref, or other system},
- %pdfcreator={pdflatex, or other tool},
-}
-
\usepackage{showexpl}
\lstset{%
@@ -103,6 +90,19 @@
\usepackage{semantex}
+\title{Seman\!\TeX: semantic, keyval-based mathematics (v\SemantexVersion)}
+\date{\today}
+\author{Sebastian Ørsted (\href{mailto:sorsted@gmail.com}{sorsted@gmail.com})}
+
+\hypersetup{
+ pdfauthor={Sebastian Ørsted},
+ pdftitle={SemanTeX: semantic, keyval-based mathematics (v\SemantexVersion)},
+ %pdfsubject={},
+ %pdfkeywords={},
+ %pdfproducer={Latex with hyperref, or other system},
+ %pdfcreator={pdflatex, or other tool},
+}
+
\SemantexSetup{
semtex file=true,
}
@@ -1761,7 +1761,7 @@ by default, so we shall have to turn them on first:
}
\end{lstlisting}
The key \lstinline!other sep! is a key that controls the separator
-between the current argument and the previous argument (it will only be printed if there was a previous argument). By default, this separator is a comma. So in the syntax~\lstinline!\co{*}{\vX,coef=\vR}!,
+between the current argument and the previous argument (it will only be printed if there was a previous argument). By default, this separator is a comma. So in the syntax~\lstinline!\co[*]{\vX,coef=\vR}!,
there are two arguments, \lstinline!\vX! and~\lstinline!\vR!, and the separator is a semicolon.
We shall later (see~\cref{ch:parse_coho_coef})
see another, possibly more natural way to write cohomology with coefficients, and which avoids turning on keyval syntax in the argument.
@@ -1867,7 +1867,9 @@ $ \vP[command=\overline,return,
upper left=*] $
\end{LTXexample}
-\chapter{The \texorpdfstring{\texttt{Symbol}}{Symbol} class type (Example: Derived tensor products and fibre products)}
+\chapter{The \texorpdfstring{\texttt{Symbol}}{Symbol} class type (Example: Derived tensor products and fibre products)}\label{chap:symbol_class}
+
+\begingroup
\NewSymbolClass\MyBinaryOperator[
define keys={
@@ -1933,6 +1935,12 @@ $\vX[*] \tensor[\vR] \vY[*]$
$\vk \tensor[\vA,der] \vk$,
$\vX \fibre[\vY,der] \vX$
\end{LTXexample}
+Later (in~\cref{sec:smart_binary_operators}), we shall see another, more advanced
+solution for binary operators which also allows us to express the application of the operator
+on \( \vn \)~elements.
+
+
+\endgroup
\chapter{Paired delimiters}
@@ -1977,12 +1985,12 @@ $\norm[\infty]{\vx}$
We can also create for more complicated constructions, like sets.
The following is inspired from the \pack{mathtools} package where a similar construction is created using the commands from that package. My impression is that Lars Madsen is the main mastermind behind the code I use for the \lstinline!\where!~construction:
\begin{lstlisting}
-\newcommand\wherecommand[1]{
- \nonscript\:
+\newcommand\wherecommand[1]{%
+ \nonscript\:%
#1\vert
\allowbreak
- \nonscript\:
- \mathopen{}
+ \nonscript\:%
+ \mathopen{}%
}
\NewObject\MyVar\where{ \wherecommand{\SemantexDelimiterSize} }
@@ -1995,12 +2003,12 @@ The following is inspired from the \pack{mathtools} package where a similar cons
% this turns off all keyval syntax in the argument
]
\end{lstlisting}
-\newcommand\wherecommand[1]{
- \nonscript\:
+\newcommand\wherecommand[1]{%
+ \nonscript\:%
#1\vert
\allowbreak
- \nonscript\:
- \mathopen{}
+ \nonscript\:%
+ \mathopen{}%
}
\NewObject\MyVar\where{ \wherecommand{\SemantexDelimiterSize} }
@@ -2848,6 +2856,104 @@ As you see, we use the \lstinline!d!~key to tell the command what superscript it
\]
\end{LTXexample}
+\section{Example: Smart binary operators}\label{sec:smart_binary_operators}
+
+\begingroup
+
+\NewVariableClass\MyBinaryOperator[
+ set arg dots=\dotsb,
+ never par,
+ prepend keys[1]={
+ {arg}{
+ return,
+ set keys x={
+ set arg sep=\SemantexDataGetExpNot{symbol},
+ },
+ },
+ },
+ parse options={
+ int if greater T={ \SemantexIntGet{number of arguments} } { 0 }
+ {
+ symbol={},
+ output=\MyVar,
+ },
+ },
+]
+
+\NewObject\MyBinaryOperator\mult{\cdot}
+\NewObject\MyBinaryOperator\tensor{\otimes}
+
+\NewVariableClass\InvisibleBinaryOperator[parent=\MyBinaryOperator, set arg dots=\dotsm]
+\NewObject\InvisibleBinaryOperator\invmult{}
+\NewObject\InvisibleBinaryOperator\spacemult{\,}
+
+In~\cref{chap:symbol_class}, we saw a simple solution for binary operators using the \lstinline!Symbol!~class.
+But that solution only printed the operator itself. However, in semantic markup systems, it is ofen desirable
+to also be able to explicitly typeset applications of the operator on \( \vn \)~arguments, like this:
+\begin{LTXexample}
+Applying the tensor product~$\tensor$ to $\vn$~elements, we get
+\[
+ \tensor{ \vx[1], \vx[2], ...,
+ \vx[\vn] }.
+\]
+Applying the multiplication operator~$\mult$ to $\vn$~elements, we get
+\[
+ \mult{ \vx[1], \vx[2], ...,
+ \vx[\vn] }.
+\]
+\end{LTXexample}
+
+This can be accomplished using the \lstinline!parse!~routine as follows:
+
+\begin{lstlisting}
+\NewVariableClass\MyBinaryOperator[
+ set arg dots=\dotsb,
+ never par,
+ prepend keys[1]={
+ {arg}{
+ return,
+ set keys x={
+ set arg sep=\SemantexDataGetExpNot{symbol},
+ },
+ },
+ },
+ parse options={
+ int if greater T={ \SemantexIntGet{number of arguments} } { 0 }
+ {
+ symbol={},
+ output=\MyVar,
+ },
+ },
+]
+
+\NewObject\MyBinaryOperator\tensor{\otimes}
+\NewObject\MyBinaryOperator\mult{\cdot}
+\end{lstlisting}
+
+In mathematical texts, the multiplication symbols in that last equation would usually be omitted.
+However, if we want to make the syntax fully semantic, we should also type these multiplication operators explicitly, even if they will be invisible in the final output.
+We do this by changing the argument dots and creating an object with an empty symbol.
+Alternatively, if we want to insert a space between the variables being multiplied,
+we can set the symbol to~\lstinline!\,!:
+\begin{lstlisting}
+\NewVariableClass\InvisibleBinaryOperator[parent=\MyBinaryOperator,
+ set arg dots=\dotsm]
+\NewObject\InvisibleBinaryOperator\invmult{}
+\NewObject\InvisibleBinaryOperator\spacemult{\,}
+\end{lstlisting}
+\begin{LTXexample}
+In mathematical texts, we denote the product of \( \vn \)~elements simply by
+\[
+ \invmult{ \vx[1], \vx[2], ...,
+ \vx[\vn] }
+ =
+ \spacemult{ \vx[1], \vx[2], ...,
+ \vx[\vn] }.
+\]
+\end{LTXexample}
+
+\endgroup
+
\chapter{\texorpdfstring{\texttt{stripsemantex}}{stripsemantex} -- stripping your document of \texorpdfstring{\semantex}{SemanTeX} markup}
\semantex{} is a big, heavy package, and it might raise eyebrows if you try using it in submissions to journals. On top of that, \url{arXiv.org}
@@ -2993,7 +3099,7 @@ Let us take a look at the commands defined by \pack{semtex}:
\mylst!\SemantexDoubleBullet!
The commands that contain the bullets we use in \semantex,
- i.e.~the superscript in~\( \co{*} \).
+ i.e.~the superscript in~\( \co[*] \).
These bullets are smaller (and prettier, in my opinion)
than the standard \lstinline!\bullet! command from~\LaTeX.
@@ -3053,8 +3159,8 @@ Suppose in the following that you \TeX\ document is called~\texttt{mydoc.tex}.
After this step, another document will have been created in the same
folder, called~\lstinline!mydoc_prestripped.tex!. It will look just like \texttt{mydoc.tex},
- but in the document body, each \semantex{} markup command will now
- have a command \mylst!\SemantexIDcommand{$\<a unique ID\>$}!
+ but in the document body, each command defined using \semantex{} will now
+ have an expression of the form~\mylst!\SemantexID{$\<a unique ID\>$}!
preceding it.
\item\label{pt:pre_strip_point}
@@ -3079,6 +3185,9 @@ Suppose in the following that you \TeX\ document is called~\texttt{mydoc.tex}.
left. You will then have to remove these few commands from your document manually.
\end{enumerate}
+\newpage
+\section{Stripping comments from the document}
+
Apart from the machinery for stripping \semantex{} markup from documents,
the package \pack{stripsemantex} also provides the command~\lstinline!\StripSemantexStripComments!,
which is in principle completely unrelated to \semantex{} itself.
@@ -3583,14 +3692,6 @@ In the following sections, we include the full list.
e.g.~the~\lstinline!1! in~\lstinline!\vf[1]!.
By default, this keys has been set to be equal to~\lstinline!sep i!,
but it is meant to be changeable by the user.
-
- \item
- \mylst!degree default={$\<value\>$}!
-
- This is the key where the grading goes.
- It is the one used by the (now deprecated) \lstinline!Cohomology! class type.
- By default, this key has been set to be equal to~\lstinline!sep d!,
- but it is meant to be changeable by the user.
\item
\mylst!*!
@@ -5701,39 +5802,6 @@ Let me add that \semantex{} uses a very clear separation between the input synta
The last class type, called \lstinline!Simple!,
is the class type of the class~\lstinline!\SemantexBaseObject!. This class is pretty useless as all it does is print its symbol, without allowing any keyval syntax. So you simply should not use it.
-There are also a few extra class types which are now deprecated, as their syntax will only cause confusion.
-They are still included for backwards compatibility, but I highly discourage their use:
-
-\begin{itemize}
- \item \lstinline!Cohomology!:
- A new class is declared with the
- syntax
- \begin{lstlisting}
- \NewCohomologyClass@\usercommand\<Class\>@[@\<options\>@]
- \end{lstlisting}
- A new object is declared by
- \begin{lstlisting}
- \NewObject@\usercommand\<Class\>@@\usercommand\<object\>@{@\<symbol\>@}[@\<options\>@]
- \end{lstlisting}
- The syntax for this object is
- \begin{lstlisting}
- @\usercommand\<object\>@[@\<options\>@]{@\<degree\>@}{@\<argument\>@}
- \end{lstlisting}
- \item \lstinline!Delimiter!:
- A new class is declared with the syntax
- \begin{lstlisting}
- \NewDelimiterClass@\usercommand\<Class\>@[@\<options\>@]
- \end{lstlisting}
- A new object is declared by
- \begin{lstlisting}
- \NewObject@\usercommand\<Class\>@@\usercommand\<object\>@{@\<left bracket\>@}{@\<right bracket\>@}[@\<options\>@]
- \end{lstlisting}
- The syntax for this object is
- \begin{lstlisting}
- @\usercommand\<object\>@[@\<options\>@]{@\<argument\>@}
- \end{lstlisting}
-\end{itemize}
-
\section{The predefined data}
By default, the following data are defined for each class or object and are accessible via
@@ -5773,7 +5841,7 @@ the programming keys and commands:
\lstinline!par size!
(token list):
the size of the argument parentheses.
- Here, the value~\lstinline!normal! means normal size
+ The value~\lstinline!normal! means normal size
parentheses,
\lstinline!auto! and~\lstinline!*!
mean auto-scaled parentheses using~\lstinline!\left ...\right!.
@@ -5796,7 +5864,7 @@ the programming keys and commands:
\lstinline!spar size!
(token list):
the size of the symbol parentheses (for use with the \lstinline!spar!~routine).
- Here, the value~\lstinline!normal! means normal size
+ The value~\lstinline!normal! means normal size
parentheses,
\lstinline!auto! and~\lstinline!*!
mean auto-scaled parentheses using~\lstinline!\left ...\right!.
diff --git a/macros/latex/contrib/semantex/stripsemantex.lua b/macros/latex/contrib/semantex/stripsemantex.lua
index f50648dd23..30d4c58be6 100644
--- a/macros/latex/contrib/semantex/stripsemantex.lua
+++ b/macros/latex/contrib/semantex/stripsemantex.lua
@@ -55,7 +55,7 @@ end
addIDsToRegisters = function(str)
str = removeStricttexFormatting(str)
- content = content:gsub('\\' .. str .. '([^%a])' ,'\\SemantexIDcommand{}\\' .. str .. '%1')
+ content = content:gsub('\\' .. str .. '([^%a])' ,'\\SemantexID{}\\' .. str .. '%1')
-- '%f[^%a]' does not work here, as it will not react if the last character of str is a number,
-- which stricttex allows.
-- Because of this choice, there will be an issue if you use stricttex and let
@@ -64,33 +64,33 @@ addIDsToRegisters = function(str)
end
removeSuperfluousIDs = function()
- local p = content:find('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)')
+ local p = content:find('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)')
while p do
- content = content:gsub('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)','%1%2')
- p = content:find('([^\\]%%[^\n]-)\\SemantexIDcommand{}([^\n]-\n)')
+ content = content:gsub('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)','%1%2')
+ p = content:find('([^\\]%%[^\n]-)\\SemantexID{}([^\n]-\n)')
end
- content = content:gsub('parent(%s*)=(%s*)\\SemantexIDcommand{}','parent%1=%2')
- content = content:gsub('class(%s*)=(%s*)\\SemantexIDcommand{}','class%1=%2')
- content = content:gsub('clone(%s*)=(%s*)\\SemantexIDcommand{}','clone%1=%2')
- content = content:gsub('copy(%s*)=(%s*)\\SemantexIDcommand{}','copy%1=%2')
- content = content:gsub('\\New(%w+)Class(%s*{?)\\SemantexIDcommand{}','\\New%1Class%2')
- content = content:gsub('\\NewObject(%s*{?%s*)\\SemantexIDcommand{}(\\%w+%s*}?%s*{?%s*)\\SemantexIDcommand{}', '\\NewObject%1%2')
- content = content:gsub('\\SetupClass(%s*{?%s*)\\SemantexIDcommand{}', '\\SetupClass%1')
- content = content:gsub('\\SetupObject(%s*{?%s*)\\SemantexIDcommand{}', '\\SetupObject%1')
+ content = content:gsub('parent(%s*)=(%s*)\\SemantexID{}','parent%1=%2')
+ content = content:gsub('class(%s*)=(%s*)\\SemantexID{}','class%1=%2')
+ content = content:gsub('clone(%s*)=(%s*)\\SemantexID{}','clone%1=%2')
+ content = content:gsub('copy(%s*)=(%s*)\\SemantexID{}','copy%1=%2')
+ content = content:gsub('\\New(%w+)Class(%s*{?)\\SemantexID{}','\\New%1Class%2')
+ content = content:gsub('\\NewObject(%s*{?%s*)\\SemantexID{}(\\%w+%s*}?%s*{?%s*)\\SemantexID{}', '\\NewObject%1%2')
+ content = content:gsub('\\SetupClass(%s*{?%s*)\\SemantexID{}', '\\SetupClass%1')
+ content = content:gsub('\\SetupObject(%s*{?%s*)\\SemantexID{}', '\\SetupObject%1')
end
addNumbersToIDs = function()
local n = 0
- local p,q = string.find(content,'\\SemantexIDcommand{}')
+ local p,q = string.find(content,'\\SemantexID{}')
while q do
n = n + 1
content = content:sub(1,q-1) .. n .. content:sub(q,-1)
- p, q = string.find(content,'\\SemantexIDcommand{}')
+ p, q = string.find(content,'\\SemantexID{}')
end
end
semantexIDluacommand = function(id, source, output)
- local p, q = string.find(content, '\\SemantexIDcommand{' .. id .. '}')
+ local p, q = string.find(content, '\\SemantexID{' .. id .. '}')
while p do
content = content:sub(1,p-1) .. content:sub(q+1,-1)
@@ -228,12 +228,12 @@ semantexIDluacommand = function(id, source, output)
else
content = content:sub(1,p-1) .. output .. content:sub(p,-1)
end
- p, q = string.find(content, '\\SemantexIDcommand{' .. id .. '}')
+ p, q = string.find(content, '\\SemantexID{' .. id .. '}')
end
end
stripRemainingSemantexIDs = function()
- content = content:gsub('\\SemantexIDcommand{%d+}', '')
+ content = content:gsub('\\SemantexID{%d+}', '')
end
removeParenthesisCommands = function()
diff --git a/macros/latex/contrib/semantex/stripsemantex.sty b/macros/latex/contrib/semantex/stripsemantex.sty
index 4e5dafc2ee..1dd814689c 100644
--- a/macros/latex/contrib/semantex/stripsemantex.sty
+++ b/macros/latex/contrib/semantex/stripsemantex.sty
@@ -1,5 +1,5 @@
\RequirePackage{xparse}
-\ProvidesExplPackage{stripsemantex}{2021/08/23}{0.513}{}
+\ProvidesExplPackage{stripsemantex}{2022/09/22}{0.530}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
@@ -40,12 +40,12 @@
openFile('\lua_escape:e{#1}_prestripped.tex')
}
- \cs_set:Npn\DeclareObject##1
+ \cs_set:Npn\RegisterObject##1
{
\lua_now:e { addIDsToRegisters ( '\cs_to_str:N ##1' ) }
}
- \cs_set:Npn\DeclareClass##1{
+ \cs_set:Npn\RegisterClass##1{
\lua_now:e { addIDsToRegisters ( '\cs_to_str:N ##1' ) }
}
@@ -76,7 +76,7 @@
openFile('\lua_escape:e{#1}_prestripped.tex')
}
- \DeclareDocumentCommand\SemantexID{ m t{\BeginSource} }
+ \DeclareDocumentCommand\RegisterID{ m t{\BeginSource} }
{
\IfBooleanT{##2}
{
@@ -94,9 +94,9 @@
}
}
- \cs_set:Npn\DeclareObject##1{}
+ \cs_set:Npn\RegisterObject##1{}
- \cs_set:Npn\DeclareClass##1{}
+ \cs_set:Npn\RegisterClass##1{}
\cs_set:Npn\BeginSource##1\EndSource\BeginOutput##2\EndOutput{}
@@ -109,17 +109,17 @@
\bool_if:NTF \g_stripsemantex_something_left_to_strip_bool
{
- \cs_set:Npn\DeclareObject##1
+ \cs_set:Npn\RegisterObject##1
{
\lua_now:e { addIDsToRegisters ( '\cs_to_str:N ##1' ) }
}
- \cs_set:Npn\DeclareClass##1
+ \cs_set:Npn\RegisterClass##1
{
\lua_now:e { addIDsToRegisters ( '\cs_to_str:N ##1' ) }
}
- \cs_set:Npn\SemantexID##1 {}
+ \cs_set:Npn\RegisterID##1 {}
\cs_set:Npn\BeginSource##1\EndSource\BeginOutput##2\EndOutput {}