From f0f5647ee3288b1e918e59fa7a715ffcd9b8222d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 30 Oct 2020 21:00:34 +0000 Subject: semantex (30oct20) git-svn-id: svn://tug.org/texlive/trunk@56811 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/semantex/semantex.pdf | Bin 362033 -> 364165 bytes Master/texmf-dist/doc/latex/semantex/semantex.tex | 90 +++++++++++++--------- 2 files changed, 54 insertions(+), 36 deletions(-) (limited to 'Master/texmf-dist/doc') diff --git a/Master/texmf-dist/doc/latex/semantex/semantex.pdf b/Master/texmf-dist/doc/latex/semantex/semantex.pdf index 3c1cee8ea0f..766ee647176 100644 Binary files a/Master/texmf-dist/doc/latex/semantex/semantex.pdf and b/Master/texmf-dist/doc/latex/semantex/semantex.pdf differ 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={$\$}! + \mylst!mathclass={$\$}! - Sets the \TeX\ character class to be~\. + Sets the \TeX\ math class to be~\. 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; -- cgit v1.2.3