summaryrefslogtreecommitdiff
path: root/macros/latex/contrib
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-11-16 03:00:59 +0000
committerNorbert Preining <norbert@preining.info>2021-11-16 03:00:59 +0000
commitf57760f92d28c76b8efac9994495070b37777bea (patch)
tree5879435266355c325e3c42399f94fcbc6cdab690 /macros/latex/contrib
parent1d7778a221f2dd8bd3945013798f8089b8dc1706 (diff)
CTAN sync 202111160300
Diffstat (limited to 'macros/latex/contrib')
-rw-r--r--macros/latex/contrib/exesheet/exesheet.dtx17
-rw-r--r--macros/latex/contrib/exesheet/exesheet.pdfbin234318 -> 234368 bytes
-rw-r--r--macros/latex/contrib/formal-grammar/README.md6
-rw-r--r--macros/latex/contrib/formal-grammar/formal-grammar.dtx101
-rw-r--r--macros/latex/contrib/formal-grammar/formal-grammar.pdfbin187407 -> 191738 bytes
5 files changed, 77 insertions, 47 deletions
diff --git a/macros/latex/contrib/exesheet/exesheet.dtx b/macros/latex/contrib/exesheet/exesheet.dtx
index 94b786c75e..a90d6da6b7 100644
--- a/macros/latex/contrib/exesheet/exesheet.dtx
+++ b/macros/latex/contrib/exesheet/exesheet.dtx
@@ -23,7 +23,7 @@
%<class>\ProvidesClass{exesheet}
%<package>\ProvidesPackage{exesheet}
%<*class|package>
-[2021/09/18 v1.2 .dtx exesheet file]
+[2021/11/15 v1.3 .dtx exesheet file]
%</class|package>
%
%<*driver>
@@ -90,7 +90,7 @@
%</driver>
% \fi
%
-% \CheckSum{609}
+% \CheckSum{613}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -115,6 +115,7 @@
% \changes{v1.1}{2021/08/30}{Macro tablenum replaced by tablenum1, small modifications due
% to changes in tasks package}
% \changes{v1.2}{2021/09/18}{Bug correction in macros tablenum1 and tablenuma, using the translations package for internationalization}
+%\changes{v1.3}{2021/11/15}{Bad spacing in the exe macro and bug correction in the starred version of this macro}
%
% \GetFileInfo{exesheet.dtx}
%
@@ -195,7 +196,7 @@
% The word \emph{\exercisename} has automatic translation
% in a few languages\footnote{Translation
% is currently integrated into the package for the following languages: French,
-% German, Spanish, Italian, Portuguese.}
+% German, Spanish, Italian, Portuges.}
% according to the loaded language (by \textsf{babel} or \textsf{polyglossia}).
% It can be redefined, with |\renewcommand|,
% or else we can use macros from the \textsf{translations}
@@ -1083,11 +1084,11 @@
% \begin{macrocode}
\newcommand{\exlabel}{\exname.~\theexercise}
\newcommand{\exsepmark}{---}
-\newcommand{\@exe}{\textbf{\exlabel~\exsepmark}~}
-\newcommand{\@@exe}{\textbf{\exlabel}~}
-\newcommand{\exe}{\bigskip\par\noindent\refstepcounter{exercise}
- \@ifstar{\@@exe}{\@exe}
-}
+\newcommand{\@exe}{\bigskip\refstepcounter{exercise}
+ \par\noindent\textbf{\exlabel~\exsepmark}~}
+\newcommand{\@@exe}{\bigskip\refstepcounter{exercise}
+ \par\noindent\textbf{\exlabel}~}
+\newcommand{\exe}{\@ifstar{\@@exe}{\@exe}}
% \end{macrocode}
% \end{macro}
diff --git a/macros/latex/contrib/exesheet/exesheet.pdf b/macros/latex/contrib/exesheet/exesheet.pdf
index 19dce9c5ec..78e61ad984 100644
--- a/macros/latex/contrib/exesheet/exesheet.pdf
+++ b/macros/latex/contrib/exesheet/exesheet.pdf
Binary files differ
diff --git a/macros/latex/contrib/formal-grammar/README.md b/macros/latex/contrib/formal-grammar/README.md
index 9a8e13b030..4f02b0b895 100644
--- a/macros/latex/contrib/formal-grammar/README.md
+++ b/macros/latex/contrib/formal-grammar/README.md
@@ -17,6 +17,12 @@ references), which is the documentation for the package.
This package is provided under the terms of the LaTeX Project Public License,
version 1.3 or later.
+# Author
+
+The initial author of this package is Martin Vassor.
+
+Thanks to Enrico Gregorio (egreg) for suggesting improvements.
+
# See also
- [**simplebnf**](https://www.ctan.org/pkg/simplebnf): this package provides an
diff --git a/macros/latex/contrib/formal-grammar/formal-grammar.dtx b/macros/latex/contrib/formal-grammar/formal-grammar.dtx
index 92bf02e871..da5f2bdae1 100644
--- a/macros/latex/contrib/formal-grammar/formal-grammar.dtx
+++ b/macros/latex/contrib/formal-grammar/formal-grammar.dtx
@@ -16,9 +16,9 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}
-%<package>\ProvidesPackage{formal-grammar}[2021/11/10 v1.0 A package to typeset formal grammars]
+%<package>\ProvidesPackage{formal-grammar}[2021/11/15 v1.1 A package to typeset formal grammars]
%<package>\RequirePackage{xparse}
-%<package>\RequirePackage{float}
+%<package>\RequirePackage{newfloat}
%<package>\RequirePackage{xcolor}
%<package>\RequirePackage{colortbl}
%<package>\RequirePackage{array}
@@ -26,6 +26,7 @@
%<*driver>
\documentclass{ltxdoc}
\usepackage{formal-grammar}
+\usepackage[hidelinks]{hyperref}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -35,7 +36,7 @@
%</driver>
% \fi
%
-% \CheckSum{83}
+% \CheckSum{97}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -54,7 +55,8 @@
% Right brace \} Tilde \~}
%
%
-% \changes{v1.0}{2021/11/21}{Initial version for publication}
+% \changes{v1.1}{2021/11/15}{Use Coloneqq if defined, internal changes, typos}
+% \changes{v1.0}{2021/11/10}{Initial version for publication}
%
% \GetFileInfo{formal-grammar.sty}
%
@@ -75,7 +77,7 @@
% \section{Introduction}
%
% This package provides a new environment (|grammar|) and associated commands to
-% typeset BNF grammars. It allows to easily write formal grammars, for instance
+% typeset BNF grammars. It allows to easily write formal grammars. For instance,
% the syntax of the \(\lambda\) calculus is given in Grammar~\ref{gr:lambda}.
%
%\begin{grammar}[\(\lambda\) calculus syntax][][gr:lambda]
@@ -99,7 +101,7 @@
% optional arguments: the first one is a possible caption; the second is a
% positionning option; and the third is a label.
%
-% If none of the optional arguments is provided, the grammar is inlined (i.e.
+% If none of the optional arguments are provided, the grammar is inlined (i.e.
% not in a float environment. If the first argument is set (the optional
% caption), the grammar is typeset in a float, captionned with the provided
% caption.
@@ -131,7 +133,7 @@
% \otherform{\{\}}{Curly brackets}
% \end{grammar}
%
-% \paragraph{Referencing non-terminals}
+% \paragraph{Referencing non-terminals.}
%
% \DescribeMacro{\nonterm}
% This allows you to typeset a symbol as a non-terminal. In the current version,
@@ -167,8 +169,8 @@
% \begin{verbatim}
% \firstcase{B}{(\nonterm{B})\gralt \{\nonterm{B}\}}{Nested parenthesis or brackets}
% \end{verbatim}
-% \paragraph{Subtle typesetting of non-terminals}
-% Since nonterminal are, by default, typeset using \verb+\mathcal+, it can lead
+% \paragraph{Subtle typesetting of non-terminals.}
+% Since nonterminals are, by default, typeset using \verb+\mathcal+, it can lead
% to the usual issues of \verb+\mathcal+ (typically, for lowercases). Therefore, we provide \emph{subtle}
% variants of |\firstcase| and |\nonterm|, in which the non-terminal symbol is
% not typeset (i.e. as the user, you have to typeset it manually).
@@ -182,7 +184,7 @@
% \verb+\(\nontermsubtil{\nonterm{C}_1}\)+
%
% \DescribeMacro{\firstcasesubtil}
-% The subtil variant of |\firstcase|. Works similarly, except that the
+% The subtle variant of |\firstcase|. It works similarly, except that the
% non-terminal (i.e. the first argument) is not embedded in a \verb+\mathcal+
% macro. For instance, the \(\nontermsubtil{\nonterm{C}_1}\) in
% Grammar~\ref{gr:advanced_grammar} is typeset with the following command:
@@ -190,8 +192,8 @@
% \firstcasesubtil{\(\nonterm{C}_1\)}{\nonterm{B}}{Example of subtil non-terminal}
% \end{verbatim}
%
-% \paragraph{Highlighting and downplaying variants}
-% Three commands are provided to highlight or downplay some part of a grammar.
+% \paragraph{Highlighting and downplaying variants.}
+% Three commands are provided to highlight or downplay some parts of a grammar.
% |\highlight| highlights a whole line, |\loghighlight| highlights a part of a
% line, while |\downplay| downplays a line.
%
@@ -219,6 +221,15 @@
% \gralt \nonterm{A}}{Important item}
% \end{verbatim}
%
+% \paragraph{Customizing the \(::=\) symbol.}
+% At the end of the preamble (i.e. before the \verb+\begin{document}+), the
+% package checks if a command \verb+\Coloneqq+ is defined. If that is the case,
+% it is used instead of \(::=\). Typically, packages
+% \href{https://www.ctan.org/pkg/mathtools}{mathtools},
+% \href{https://www.ctan.org/pkg/txfonts}{txfonts} and
+% \href{https://www.ctan.org/pkg/pxfonts}{pxfonts} define this command, but you
+% can also define it manually if you use the symbol elsewhere in the document.
+%
% \StopEventually{\PrintIndex}
%
% \section{Implementation}
@@ -227,8 +238,11 @@
% This is a new float that contains floating grammars. This is needed so that
% they are labeled with 'Grammar'.
% \begin{macrocode}
-\newfloat{floatgrammar}{t b h p}{.gram}
-\floatname{floatgrammar}{Grammar}
+ \DeclareFloatingEnvironment[
+ name=Grammar,
+ listname={List of Grammars},
+ placement=tbhp,
+ ]{floatgrammar}
% \end{macrocode}
% \end{environment}
%
@@ -236,31 +250,34 @@
%% Taken from https://tex.stackexchange.com/a/26364/107341
%\fi
%
-% \begin{macro}{\@rowstyle}
+% \begin{macro}{\formal@rowstyle}
% The default \verb+rowstyle+ is empty.
% \begin{macrocode}
-\newcommand*{\@rowstyle}{}
+\newcommand*{\formal@rowstyle}{}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rowstyle}
-% An internal command used to set the style of a row. In addition, we add column
+% An command used to set the style of a row. In addition, we add column
% types to reset the style (\verb:=:) and to keep the style from one column to
% the other (\verb:+:).
+% As of today, it is not advised for the user to use \verb+\rowstyle+ to define
+% their own style (i.e.\ I have not tested it), although I hope it will someday
+% be possible.
% \begin{macrocode}
\newcommand*{\rowstyle}[1]{% sets the style of the next row
- \gdef\@rowstyle{#1}%
- \@rowstyle\ignorespaces%
+ \gdef\formal@rowstyle{#1}%
+ \formal@rowstyle\ignorespaces%
}
% \end{macrocode}
% \begin{macrocode}
-\newcolumntype{=}{% resets the row style
- >{\gdef\@rowstyle{}}%
+\newcolumntype{\formal@reset}{% resets the row style
+ >{\gdef\formal@rowstyle{}}%
}
-\newcolumntype{+}{% adds the current row style to the next column
- >{\@rowstyle}%
+\newcolumntype{\formal@add}{% adds the current row style to the next column
+ >{\formal@rowstyle}%
}
% \end{macrocode}
% \end{macro}
@@ -274,33 +291,27 @@
% we embed the grammar into a \verb+floatgrammar+; then if the second argument
% is provided, we use it as the position, (otherwise, we use \verb+p+). Finally,
% if the third argument is provided, we use it as a label.
+% Notice that, if the grammar is not a float (is inline), we do \emph{not}
+% break line before and after the grammar.
% \begin{macrocode}
\ExplSyntaxOn
%% 1st argument: caption (makes it float)
%% 2nd argument: positionning option (`p` by default)
%% 3rd argument: label
- \NewDocumentEnvironment{grammar} {o o o}
+ \NewDocumentEnvironment{grammar} {o O{p} o}
{
- \IfNoValueTF{#1} {
- }{
- \IfNoValueTF{#2}{
- \begin{floatgrammar}[p]
- } {
- \begin{floatgrammar}[#2]
- }
+ \IfNoValueF{#1}{
+ \begin{floatgrammar}[#2]
\centering
}
- \begin{tabular}{=l +r +l +l}
+ \begin{tabular}{\formal@reset l \formal@add r \formal@add l \formal@add l}
}{
\end{tabular}
- \IfNoValueTF{#1} {
- \linebreak
- } {
+ \IfNoValueF{#1}{
\caption{#1}
- \IfNoValueTF{#3}{
- } {
+ \IfNoValueF{#3}{
\label{#3}
}
\end{floatgrammar}
@@ -316,7 +327,7 @@
% cell is the rule (it is directly printed, without any modification), and the
% last cell is the description of the rule, in greyish color.
% \begin{macrocode}
-\newcommand{\firstcase}[3]{\(\mathcal{#1}\) & \(::=\) & \(#2\) & {\itshape \color{gray!90!black} #3}\\}
+\newcommand{\firstcase}[3]{\(\mathcal{#1}\) & \(\formal@Coloneqq\) & \(#2\) & {\itshape \color{gray!90!black} #3}\\}
% \end{macrocode}
% \end{macro}
%
@@ -324,7 +335,7 @@
% The |\firstcasesubtil| is implemented similarly to |\firstcase|, except that
% the first argument is not surrounded by \verb+\mathcal+.
% \begin{macrocode}
-\newcommand{\firstcasesubtil}[3]{#1 & \(::=\) & \(#2\) & {\itshape \color{gray!90!black} #3}\\}
+\newcommand{\firstcasesubtil}[3]{#1 & \(\formal@Coloneqq\) & \(#2\) & {\itshape \color{gray!90!black} #3}\\}
% \end{macrocode}
% \end{macro}
@@ -379,6 +390,18 @@
% \end{macrocode}
% \end{macro}
%
+% Finally, we check, at the end of the preamble, if there already exist a
+% \verb+::=+ symbol. We search for a command called \verb+Coloneqq+, e.g.
+% defined in the \href{https://www.ctan.org/pkg/mathtools}{mathtools}.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \ifdefined\Coloneqq
+ \let\formal@Coloneqq\Coloneqq
+ \else
+ \newcommand{\formal@Coloneqq}{::=}
+ \fi
+}
+% \end{macrocode}
%
% \Finale
\endinput
diff --git a/macros/latex/contrib/formal-grammar/formal-grammar.pdf b/macros/latex/contrib/formal-grammar/formal-grammar.pdf
index ae8320e09a..f68c90ae4b 100644
--- a/macros/latex/contrib/formal-grammar/formal-grammar.pdf
+++ b/macros/latex/contrib/formal-grammar/formal-grammar.pdf
Binary files differ