texlive[56811] Master/texmf-dist: semantex (30oct20)

commits+karl at tug.org commits+karl at tug.org
Fri Oct 30 22:00:34 CET 2020


Revision: 56811
          http://tug.org/svn/texlive?view=revision&revision=56811
Author:   karl
Date:     2020-10-30 22:00:34 +0100 (Fri, 30 Oct 2020)
Log Message:
-----------
semantex (30oct20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/semantex/semantex.pdf
    trunk/Master/texmf-dist/doc/latex/semantex/semantex.tex
    trunk/Master/texmf-dist/tex/latex/semantex/semantex.sty
    trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty

Modified: trunk/Master/texmf-dist/doc/latex/semantex/semantex.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/semantex/semantex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/semantex/semantex.tex	2020-10-30 21:00:20 UTC (rev 56810)
+++ trunk/Master/texmf-dist/doc/latex/semantex/semantex.tex	2020-10-30 21:00:34 UTC (rev 56811)
@@ -42,7 +42,7 @@
 	
 \usepackage[nameinlink]{cleveref}
 
-\title{Seman\!\TeX: semantic, keyval-based mathematics (v0.461)}
+\title{Seman\!\TeX: semantic, keyval-based mathematics (v0.462)}
 \date{\today}
 \author{Sebastian Ørsted (\href{mailto:sorsted at gmail.com}{sorsted at gmail.com})}
 
@@ -783,7 +783,10 @@
 		{Bigres}{ rightreturn, symbolputright=\Big|, lower={#1} },
 		{biggres}{ rightreturn, symbolputright=\bigg|, lower={#1} },
 		{Biggres}{ rightreturn, symbolputright=\Bigg|, lower={#1} },
-		{autores}{ Otherspar={.}{|}{auto}, lower={#1} },
+		{autores}{ leftreturn, symbolputleft=\kern-\nulldelimiterspace,
+							 Otherspar={.}{|}{auto}, symbolputleft=\bgroup,
+							 symbolputright=\egroup, lower={#1},
+		},
 		% The last key auto-scales the vertical bar. See @\textit{\cref{sec:spar}}@
 		% for information about Otherspar.
 		% Note that Otherspar automatically invokes rightreturn,
@@ -900,8 +903,8 @@
 		{laurent}{
 			par,
 			leftpar=(, rightpar=),
-			prearg={\!\!\mathopen{}\SemantexDelimiterSize(},
-			postarg={\SemantexDelimiterSize)\mathclose{}\!\!},
+			prearg={\!\mathopen{}\SemantexDelimiterSize(},
+			postarg={\SemantexDelimiterSize)\mathclose{}\!},
 			% The "prearg" and "postarg" are printed before after
 			% the argument, if the argument is non-empty.
 			% The command "\SemantexDelimiterSize" is substituted
@@ -926,8 +929,8 @@
 		{laurent}{
 			par,
 			leftpar=(, rightpar=),
-			prearg={\!\!\mathopen{}\SemantexDelimiterSize(},
-			postarg={\SemantexDelimiterSize)\mathclose{}\!\!},
+			prearg={\!\mathopen{}\SemantexDelimiterSize(},
+			postarg={\SemantexDelimiterSize)\mathclose{}\!},
 			% These are printed before and after the argument.
 			% The command "\SemantexDelimiterSize" is substituted
 			% by \big, \Big, ..., or whatever size the
@@ -2198,58 +2201,63 @@
 
 \section{Example: Category theory}
 
-\newcommand\categoryformat[1]{\textsf{#1}}
+\newcommand\categoryformat[1]{{\operatorname{\mathsf{#1}}}}
 	% This means that we write categories with sans-serif fonts;
-	% -- but you can change this to your own liking
-	% We use \textsf rather than \mathsf in order
-	% to allow syntax like $R$-mod
+	% -- but you can change this to your own liking.
+	% We use \operatorname since it will allow us to use ordinary
+	% dashes (rather than minuses) in math mode.
+	% We use an extra pair of braces around \operatorname
+	% in order to make it an ordinary symbol (instead of an operator).
+	% This solution is inspired by an answer by egreg (obviously),
+	% see https://tex.stackexchange.com/a/567886/19809
 
-\NewVariableClass{\Category}[parent=\MyVar,command=\categoryformat]
 
-\NewObject\Category\catset{Set}
-\NewObject\Category\cattop{Top}
-\NewObject\Category\catvect{Vect}
+\NewObject\MyVar\catset{\categoryformat{Set}}
+\NewObject\MyVar\cattop{\categoryformat{Top}}
+\NewObject\MyVar\catvect{\categoryformat{Vect}}
 
 \SemantexRecordObject{\catxmod}
 \newcommand\catxmod[1]{
 	\SemantexRecordSource{\catxmod{#1}}
-	\UseClassInCommand\Category{$#1$-mod}
+	\UseClassInCommand\MyVar{#1\categoryformat{-mod}}
 }
 
 \SemantexRecordObject{\catmodx}
 \newcommand\catmodx[1]{
 	\SemantexRecordSource{\catmodx{#1}}
-	\UseClassInCommand\Category{mod-$#1$}
+	\UseClassInCommand\MyVar{\categoryformat{mod-}#1}
 }
 
 \SemantexRecordObject{\catxmody}
 \newcommand\catxmody[2]{
 	\SemantexRecordSource{\catxmody{#1}{#2}}
-	\UseClassInCommand\Category{$#1$-mod-$#2$}
+	\UseClassInCommand\MyVar{#1\categoryformat{-mod-}#2}
 }
 
 \SemantexRecordObject{\catxmodx}
 \newcommand\catxmodx[1]{
 	\SemantexRecordSource{\catxmodx{#1}}
-	\UseClassInCommand\Category{$#1$-mod-$#1$}
+	\UseClassInCommand\MyVar{#1\categoryformat{-mod-}#1}
 }
 
 The above method can be used to create commands
 for typing categories. First and foremost,
-it is easy to create a class for categories
-and write simple categories like~\( \catset \), \( \cattop \)~and \( \catvect \):
+it is easy to create objects corresponding
+to simple categories like~\( \catset \), \( \cattop \) and~\( \catvect \):
 \begin{lstlisting}
-\newcommand\categoryformat[1]{\textsf{#1}}
+\newcommand\categoryformat[1]{{\operatorname{\mathsf{#1}}}}
 	% This means that we write categories with sans-serif fonts;
 	% -- but you can change this to your own liking.
-	% We use \textsf rather than \mathsf in order
-	% to allow syntax like $R$-mod
+	% We use \operatorname since it will allow us to use ordinary
+	% dashes (rather than minuses) in math mode.
+	% We use an extra pair of braces around \operatorname
+	% in order to make it an ordinary symbol (instead of an operator).
+	% This solution is inspired by an answer by egreg (obviously),
+	% see @\itshape\url{https://tex.stackexchange.com/a/567886/19809}@
 
-\NewVariableClass{\Category}[parent=\MyVar,command=\categoryformat]
-
-\NewObject\Category\catset{Set}
-\NewObject\Category\cattop{Top}
-\NewObject\Category\catvect{Vect}
+\NewObject\MyVar\catset{\categoryformat{Set}}
+\NewObject\MyVar\cattop{\categoryformat{Top}}
+\NewObject\MyVar\catvect{\categoryformat{Vect}}
 \end{lstlisting}
 \begin{LTXexample}
 $ \catset $,
@@ -2264,7 +2272,7 @@
 \SemantexRecordObject{\catxmod}
 \newcommand\catxmod[1]{
 	\SemantexRecordSource{\catxmod{#1}}
-	\UseClassInCommand\Category{$#1$-mod}
+	\UseClassInCommand\MyVar{#1\categoryformat{-mod}}
 }
 \end{lstlisting}
 \begin{LTXexample}
@@ -2281,19 +2289,19 @@
 \SemantexRecordObject{\catmodx}
 \newcommand\catmodx[1]{
 	\SemantexRecordSource{\catmodx{#1}}
-	\UseClassInCommand\Category{mod-$#1$}
+	\UseClassInCommand\MyVar{\categoryformat{mod-}#1}
 }
 
 \SemantexRecordObject{\catxmody}
 \newcommand\catxmody[2]{
 	\SemantexRecordSource{\catxmody{#1}{#2}}
-	\UseClassInCommand\Category{$#1$-mod-$#2$}
+	\UseClassInCommand\MyVar{#1\categoryformat{-mod-}#2}
 }
 
 \SemantexRecordObject{\catxmodx}
 \newcommand\catxmodx[1]{
 	\SemantexRecordSource{\catxmodx{#1}}
-	\UseClassInCommand\Category{$#1$-mod-$#1$}
+	\UseClassInCommand\MyVar{#1\categoryformat{-mod-}#1}
 }
 \end{lstlisting}
 
@@ -2418,6 +2426,16 @@
 		spar,op] $
 \end{LTXexample}
 (here we used the key~\lstinline!op! from \cref{sec:algebra}).
+Alternatively, you can add a new pair of brackets, which will render the object
+and invoke the \lstinline!parse!~routine:
+\begin{LTXexample}
+$\GL[order=\vn,field=\vk][spar,op]$
+\end{LTXexample}
+Note, though, that in this case, the \lstinline!spar! and~\lstinline!op!~keys
+are not being applied to the object~\lstinline!\GL! itself, but
+to the object (of class~\lstinline!\MyVar!) that it outputs. This should not cause
+any issues in practice, as long as the keys you are using
+are already defined on the level of~\lstinline!\MyVar!.
 
 \section{Example: Matrix sets and groups}
 
@@ -3470,9 +3488,9 @@
 	Invokes the parse routine.
 	
 	\item
-	\mylst!texclass={$\<command\>$}!
+	\mylst!mathclass={$\<command\>$}!
 	
-	Sets the \TeX\ character class to be~\<command\>.
+	Sets the \TeX\ math class to be~\<command\>.
 	The intended values are \lstinline!\mathord!, \lstinline!\mathop!, \lstinline!\mathbin!, \lstinline!\mathrel!, \lstinline!\mathopen!, \lstinline!\mathclose!, and~\lstinline!\mathpunct!.
 	
 	\item
@@ -5588,7 +5606,7 @@
 	the parse options, i.e.~the options that are invoked
 	during the parse routine.
 	\item
-	\mylst!texclass!
+	\mylst!mathclass!
 	(token list):
 	the \TeX\ character class command that the final output
 	is evnetually wrapped around;

Modified: trunk/Master/texmf-dist/tex/latex/semantex/semantex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/semantex/semantex.sty	2020-10-30 21:00:20 UTC (rev 56810)
+++ trunk/Master/texmf-dist/tex/latex/semantex/semantex.sty	2020-10-30 21:00:34 UTC (rev 56811)
@@ -1,5 +1,5 @@
 \RequirePackage{xparse,l3keys2e,leftindex,semtex}
-\ProvidesExplPackage{semantex}{2020/10/07}{0.461}{}
+\ProvidesExplPackage{semantex}{2020/10/30}{0.462}{}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %															%
@@ -1555,7 +1555,7 @@
 							\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 } }
+								{ mathclass } { \semantex_data_tl_get_exp_not:nn { #1 } { mathclass } }
 							\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
@@ -1594,7 +1594,7 @@
 							\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 } }
+								{ mathclass } { \semantex_data_tl_get_exp_not:nn { #1 } { mathclass } }
 							\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
@@ -1644,7 +1644,7 @@
 						\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 } }
+							{ mathclass } { \semantex_data_tl_get_exp_not:nn { #1 } { mathclass } }
 						\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
@@ -1655,8 +1655,8 @@
 		}
 		{
 			\semantex_pre_return:n { #1 } % Performs the pre_return routine, i.e. adds all remaining indices and arguments to the symbol
-			\tl_if_blank:xTF { \semantex_data_tl_get_exp_not:nn { #1 } { texclass } }
-			% Checks whether the texclass register has been declared -- this is
+			\tl_if_blank:xTF { \semantex_data_tl_get_exp_not:nn { #1 } { mathclass } }
+			% Checks whether the mathclass register has been declared -- this is
 			% where you store \mathord, \mathbin, \mathrel, etc., if you want
 			% the object to be eventually wrapped in this.
 			{
@@ -1668,7 +1668,7 @@
 			{
 				\tl_set:Nx\l__semantex_render_temp_tl
 				{
-					\semantex_data_tl_get_exp_not:nn { #1 } { texclass }
+					\semantex_data_tl_get_exp_not:nn { #1 } { mathclass }
 						{ \semantex_data_tl_get_exp_not:nn { #1 } { symbol } }
 				}
 			}
@@ -5640,7 +5640,7 @@
 	boolsettrue=par,
 	boolprovide=flexpar,
 	dataprovide=parseoptions,
-	dataprovide=texclass,
+	dataprovide=mathclass,
 	boolprovide=leftargument,
 	dataprovide=heightphantom,
 	dataprovide=slantingphantom,
@@ -5649,7 +5649,7 @@
 		{parent}{ execute={ \semantex_data_parent_set:nn { ##1 } { #1 } } },
 		{class}{ execute={ \semantex_data_class_set:nn { ##1 } { #1 } } },
 		{copy}{ execute={ \semantex_data_copy_object:nn { ##1 } { #1 } } },
-		{texclass}{ execute={ \semantex_data_tl_set:nnn { ##1 } { texclass } { #1 } } },
+		{mathclass}{ execute={ \semantex_data_tl_set:nnn { ##1 } { mathclass } { #1 } } },
 		{symbol}{
 			execute={
 				\semantex_data_tl_set:nnn { ##1 } { symbol } { #1 }

Modified: trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty	2020-10-30 21:00:20 UTC (rev 56810)
+++ trunk/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty	2020-10-30 21:00:34 UTC (rev 56811)
@@ -1,5 +1,5 @@
 \RequirePackage{xparse}
-\ProvidesExplPackage{stripsemantex}{2020/10/07}{0.461}{}
+\ProvidesExplPackage{stripsemantex}{2020/10/30}{0.462}{}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %																		%



More information about the tex-live-commits mailing list.