diff options
author | Karl Berry <karl@freefriends.org> | 2020-10-30 21:00:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-10-30 21:00:34 +0000 |
commit | f0f5647ee3288b1e918e59fa7a715ffcd9b8222d (patch) | |
tree | a33c5ba31eff3752e0782d4e0236496f29ac2bce | |
parent | 714649878de5098cbacc913c8a20731ef364ae97 (diff) |
semantex (30oct20)
git-svn-id: svn://tug.org/texlive/trunk@56811 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/semantex/semantex.pdf | bin | 362033 -> 364165 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/semantex/semantex.tex | 90 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/semantex/semantex.sty | 18 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/semantex/stripsemantex.sty | 2 |
4 files changed, 64 insertions, 46 deletions
diff --git a/Master/texmf-dist/doc/latex/semantex/semantex.pdf b/Master/texmf-dist/doc/latex/semantex/semantex.pdf Binary files differindex 3c1cee8ea0f..766ee647176 100644 --- a/Master/texmf-dist/doc/latex/semantex/semantex.pdf +++ b/Master/texmf-dist/doc/latex/semantex/semantex.pdf diff --git a/Master/texmf-dist/doc/latex/semantex/semantex.tex b/Master/texmf-dist/doc/latex/semantex/semantex.tex index d8d250831de..75282510c11 100644 --- a/Master/texmf-dist/doc/latex/semantex/semantex.tex +++ b/Master/texmf-dist/doc/latex/semantex/semantex.tex @@ -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@gmail.com}{sorsted@gmail.com})} @@ -783,7 +783,10 @@ Some people prefer to be able to scale the vertical line in the restriction nota {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 @@ Adding support for free algebras, power series, and Laurent series is almost as {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 @@ Adding support for free algebras, power series, and Laurent series is almost as {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 @@ Therefore, we do three things: \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 - -\NewVariableClass{\Category}[parent=\MyVar,command=\categoryformat] - -\NewObject\Category\catset{Set} -\NewObject\Category\cattop{Top} -\NewObject\Category\catvect{Vect} + % 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}@ + +\NewObject\MyVar\catset{\categoryformat{Set}} +\NewObject\MyVar\cattop{\categoryformat{Top}} +\NewObject\MyVar\catvect{\categoryformat{Vect}} \end{lstlisting} \begin{LTXexample} $ \catset $, @@ -2264,7 +2272,7 @@ to this chapter: \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 @@ of other situations, like \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 @@ $ \GL[order=\vn,field=\vk,parse, 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 @@ In the following sections, we include the full list. 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 programming keys and commands: 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; diff --git a/Master/texmf-dist/tex/latex/semantex/semantex.sty b/Master/texmf-dist/tex/latex/semantex/semantex.sty index e0ad970aa59..b42e5d7976c 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,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 } diff --git a/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty b/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty index 7e9809b3ff3..e2a9b601c8a 100644 --- a/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty +++ b/Master/texmf-dist/tex/latex/semantex/stripsemantex.sty @@ -1,5 +1,5 @@ \RequirePackage{xparse} -\ProvidesExplPackage{stripsemantex}{2020/10/07}{0.461}{} +\ProvidesExplPackage{stripsemantex}{2020/10/30}{0.462}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % |