From dc612812fbda1ab7fc28a6c80576bb1e8aae6ff2 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 4 Feb 2023 03:02:04 +0000 Subject: CTAN sync 202302040302 --- macros/latex/contrib/naive-ebnf/naive-ebnf.dtx | 19 +++++++++++++------ macros/latex/contrib/naive-ebnf/naive-ebnf.pdf | Bin 542463 -> 542835 bytes 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'macros/latex/contrib/naive-ebnf') diff --git a/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx b/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx index cdd047a30f..a69bc2f578 100644 --- a/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx +++ b/macros/latex/contrib/naive-ebnf/naive-ebnf.dtx @@ -50,7 +50,7 @@ %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{naive-ebnf} %<*package> -[2023-01-30 0.0.3 EBNF in Plain Text] +[2023-02-03 0.0.4 EBNF in Plain Text] % %<*driver> \documentclass{ltxdoc} @@ -90,7 +90,7 @@ % \usepackage{mathtools} % \begin{document} % \begin{ebnf} -% := +% <$\lambda$-Expr> := % | "$\lambda$" "." % | "$\lparen$" "$\rparen$" % \end{ebnf} @@ -136,14 +136,15 @@ % \end{document} % \end{docshot} % It's possible to use them in math-mode too, for example: -% \docshotOptions{firstline=6,lastline=8} +% \docshotOptions{firstline=6,lastline=9} % \begin{docshot} % \documentclass{article} % \pagestyle{empty} % \usepackage[paperwidth=3in]{geometry} % \usepackage{naive-ebnf} % \begin{document} -% If $\terminal{(} f_1 \nonterminal{Var} +% If $\terminal{(} f_1 +% \nonterminal{$\lambda$-Var} % \terminal{)}$ is always true, then % $f_1$ is a tautology. % \end{document} @@ -243,6 +244,11 @@ \tl_set_rescan:Nno \l_ebnf_tl { } { #1 } \terminal{\l_ebnf_tl} } +\newcommand\ebnf@nonterminal[1]{ + \tl_set:Nn \l_ebnf_tl { } + \tl_set_rescan:Nno \l_ebnf_tl { } { #1 } + \nonterminal{\l_ebnf_tl} +} \ExplSyntaxOff \newcommand\ebnf@to {\ebnf@color{gray}{\(\to\)}} @@ -253,6 +259,7 @@ % \end{macrocode} % \begin{macro}{ebnf} +% \changes{0.0.4}{2023/02/03}{Any symbols are allowed inside \texttt{\char`\\nonterminal} commands and inside the \texttt{ebnf} environment, where non-terminals are mentioned.} % Then, we define the |ebnf| environment: % \begin{macrocode} \ExplSyntaxOn @@ -267,8 +274,8 @@ {\c{ebnf@grouping}{\1}} \l__ebnf_tmp_tl \regex_replace_all:nnN { \[([^\]]+?)\] } {\c{ebnf@optional}{\1}} \l__ebnf_tmp_tl - \regex_replace_all:nnN { <([A-Za-z][a-z-]+)> } - {\c{nonterminal}{\1}} \l__ebnf_tmp_tl + \regex_replace_all:nnN { <([^>]+)> } + {\c{ebnf@nonterminal}{\1}} \l__ebnf_tmp_tl \regex_replace_all:nnN { "([^"]+)" } {\c{ebnf@terminal}{\1}} \l__ebnf_tmp_tl \regex_replace_all:nnN { \^^M\s*\| } diff --git a/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf b/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf index cfb0270b4c..cd63e8dc84 100644 Binary files a/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf and b/macros/latex/contrib/naive-ebnf/naive-ebnf.pdf differ -- cgit v1.2.3