[Doc] Add subsections to Section 2, Defining notation.

This commit is contained in:
Gaetano Geck 2018-04-29 13:00:47 +02:00
parent fa83015aa9
commit afb16f8ef4
1 changed files with 16 additions and 10 deletions

View File

@ -122,9 +122,14 @@ then $\interpretation+paren(x_2)=1$ or $\interpretation+paren(x_1) \neq
Disregarding the possible definition of a default value, this results in a total of four variants of the \verb#\newnotation# command. The general scheme Disregarding the possible definition of a default value, this results in a total of four variants of the \verb#\newnotation# command. The general scheme
\begin{Verbatim}[tabsize=4,commandchars=+()] \begin{Verbatim}[tabsize=4,commandchars=+()]
+decorate(\newnotation)[class]{macro name}[number of arguments] +decorate(\newnotation)
[default value]{replacement} [class] % 1
[description][argument description] {macro name} % 2
[number of arguments] % 3
[default value] % 4
{replacement} % 5
[description] % 6
[argument description] % 7
\end{Verbatim} \end{Verbatim}
is illustrated by the four commands from the introductory example: is illustrated by the four commands from the introductory example:
\begin{enumerate} \begin{enumerate}
@ -142,7 +147,7 @@ then $\interpretation+paren(x_2)=1$ or $\interpretation+paren(x_1) \neq
\verb+ [OR-clause containing literals 1, 2 and 3]+ \verb+ [OR-clause containing literals 1, 2 and 3]+
\end{enumerate} \end{enumerate}
\paragraph*{Starred and non-starred version.} \subsection{Starred and non-starred version}
Every replacement text is wrapped in an \verb#\ensuremath#, with an \verb#\xspace# appended. Therefore you can, for instance, safely write Every replacement text is wrapped in an \verb#\ensuremath#, with an \verb#\xspace# appended. Therefore you can, for instance, safely write
\begin{Verbatim}[tabsize=4] \begin{Verbatim}[tabsize=4]
Interpretation~\interpretation satisfies \dots Interpretation~\interpretation satisfies \dots
@ -150,13 +155,14 @@ then $\interpretation+paren(x_2)=1$ or $\interpretation+paren(x_1) \neq
resulting in resulting in
\textcolor{teal}{Interpretation~\interpretation satisfies \dots}. \textcolor{teal}{Interpretation~\interpretation satisfies \dots}.
Using the non-starred version \verb#\newnotation#, an additional pair of curly braces added to the replacment allows the command to be used in a sub- or superscript. For example, writing \verb#$a_\pair{i}{j}$# results in \textcolor{teal}{$a_\pair{i}{j}$}. Using the non-starred version \verb#\newnotation#, an additional pair of curly braces added to the replacement allows the command to be used in a sub- or superscript. For example, writing \verb#$a_\pair{i}{j}$# results in \textcolor{teal}{$a_\pair{i}{j}$}.
\newcommand{\badpair}[2]{\ensuremath{}\xspace} \newcommand{\badpair}[2]{\ensuremath{}\xspace}
Note, however, that this wrapping prevents extra spaces (like those surrounding relation or operator symbols, defined by \verb#\mathrel# or \verb#\mathop#, for example). If you want these extra spaces, you can avoid the additional pair of braces by using the starred version \cverb#\newnotation*#; like for the binary satisfaction relation \verb#\satisfies# above. Note, however, that this wrapping prevents extra spaces (like those surrounding relation or operator symbols, defined by \verb#\mathrel# or \verb#\mathop#, for example). If you want these extra spaces, you can avoid the additional pair of braces by using the starred version \cverb#\newnotation*#; like for the binary satisfaction relation \verb#\satisfies# above.
\paragraph*{Default value for first argument.} As for \verb#\newcommand#, you can specify a default value for the first argument, which will be considered as an optional argument then. \subsection{Default value for first argument}
As for \verb#\newcommand#, you can specify a default value for the first argument, which will be considered as an optional argument then.
For example, the definition For example, the definition
\begin{Verbatim}[tabsize=4,commandchars=+()] \begin{Verbatim}[tabsize=4,commandchars=+()]
\newnotation{\myfunc}[2]+decorate([\mathbb{R}]){#2: #1 \to #1} \newnotation{\myfunc}[2]+decorate([\mathbb{R}]){#2: #1 \to #1}
@ -168,7 +174,7 @@ then $\interpretation+paren(x_2)=1$ or $\interpretation+paren(x_1) \neq
\item \textcolor{teal}{$\myfunc[\mathbb{N}]{g}$} when using \verb#\myfunc[\mathbb{N}]{g}#. \item \textcolor{teal}{$\myfunc[\mathbb{N}]{g}$} when using \verb#\myfunc[\mathbb{N}]{g}#.
\end{itemize} \end{itemize}
\paragraph*{Redefinition.} \subsection{Redefinition}
Of course, you can also redefine a command, whether previously defined via \verb#\newnotation# or not. If you want the new definition to be contained in the table of notation, simply use \cverb#\renewnotation# in one of the flavors described above. Of course, you can also redefine a command, whether previously defined via \verb#\newnotation# or not. If you want the new definition to be contained in the table of notation, simply use \cverb#\renewnotation# in one of the flavors described above.
For the purpose of illustration, we redefine our \verb#\myfunc# macro. This time, we interpret the first argument as the optional mapping's name (default name $f$) and the following two arguments restrict the mapping's domain and range: For the purpose of illustration, we redefine our \verb#\myfunc# macro. This time, we interpret the first argument as the optional mapping's name (default name $f$) and the following two arguments restrict the mapping's domain and range:
@ -183,11 +189,11 @@ then $\interpretation+paren(x_2)=1$ or $\interpretation+paren(x_1) \neq
\item \textcolor{teal}{$\myfunc[f^{-1}]{Z}{X \times Y}$} when using \verb#\myfunc[f^{-1}]{Z}{X \times Y}#. \item \textcolor{teal}{$\myfunc[f^{-1}]{Z}{X \times Y}$} when using \verb#\myfunc[f^{-1}]{Z}{X \times Y}#.
\end{itemize} \end{itemize}
\paragraph*{Remark.} \subsection{Further remarks}
Indeed, there's a sixth argument that can optionally be supplied to both \verb#\newnotation# and \verb#\renewnotation#. This argument, which is explained in detail in Section~\ref{sec:listing}, specifies the replacement for potential arguments of a macro in the table of notation. Indeed, there's a sixth argument that can optionally be supplied to both \verb#\newnotation# and \verb#\renewnotation#. This argument, which is explained in detail in Section~\ref{sec:listing}, specifies the replacement for potential arguments of a macro in the table of notation.
\paragraph*{Classes.} \subsection{Classes}
Often, entitites of a certain type are formatted in a particular way, just to indicate that type. For instance, set names may always be bold, problem names in small caps \dots It is desirable to separate the choice of layout for some type from the choice of type for the entity (or its denotation, more precisely). To this end, the \cverb#\newnotation# command supports classes. Often, entitites of a certain type are formatted in a particular way, just to indicate that type. For instance, set names may always be bold, problem names in small caps \dots It is desirable to separate the choice of layout for some type from the choice of type for the entity (or its denotation, more precisely). To this end, the \cverb#\newnotation# command supports classes.
They can be used like in the following example. They can be used like in the following example.
@ -240,7 +246,7 @@ then $\interpretation+paren(x_2)=1$ or $\interpretation+paren(x_1) \neq
\end{itemize} \end{itemize}
When defining notation for an entity that should belong to a specific class, the name of this class can be passed to the \cverb#\newnotation# command as a first optional argument (right before the name of the new macro). When defining notation for an entity that should belong to a specific class, the name of this class can be passed to the \cverb#\newnotation# command as a first optional argument (right before the name of the new macro).
\paragraph*{Relation symbols.} \subsection{Relation symbols}
Relation symbols require some extra space around them. Using \cverb#\newcommand# this can be achieved with \cverb#\mathrel#. This is done implicitly, when \cverb#\newrelation# (or \cverb#\newrelation*#) is used instead of \cverb#\newnotation#. Relation symbols require some extra space around them. Using \cverb#\newcommand# this can be achieved with \cverb#\mathrel#. This is done implicitly, when \cverb#\newrelation# (or \cverb#\newrelation*#) is used instead of \cverb#\newnotation#.
\newpage \newpage