From d88aa33d2c9df0778d2f472ad338f9a0b1f0c962 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 5 May 2019 17:39:35 +0000 Subject: backnaur (15apr19) git-svn-id: svn://tug.org/texlive/trunk@51001 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/backnaur/backnaur.dtx | 164 ++++++++++++--------- .../texmf-dist/source/latex/backnaur/backnaur.ins | 6 +- 2 files changed, 96 insertions(+), 74 deletions(-) (limited to 'Master/texmf-dist/source/latex/backnaur') diff --git a/Master/texmf-dist/source/latex/backnaur/backnaur.dtx b/Master/texmf-dist/source/latex/backnaur/backnaur.dtx index bf04cc42ba0..0a9554899ea 100644 --- a/Master/texmf-dist/source/latex/backnaur/backnaur.dtx +++ b/Master/texmf-dist/source/latex/backnaur/backnaur.dtx @@ -1,17 +1,17 @@ % \iffalse meta-comment % % backnaur.dtx -% 4 December 2012 +% 14 April 2019 % % Documented LaTeX file for the backnaur package. % -% Run LaTeX on backnaur.ini to make the package's +% Run LaTeX on backnaur.ins to make the package's % backnaur.sty file. % % Run LaTeX on this file to produce the package % documentation. % -% Copyright (C) 2012 by Adrian P Robson +% Copyright (C) 2019 by Adrian P Robson % adrian.robson@nepsweb.co.uk % % This work may be distributed and/or modified under the @@ -34,7 +34,7 @@ % \iffalse %\NeedsTeXFormat{LaTeX2e}[2011/06/27] %\ProvidesPackage{backnaur} -%[2012/12/12 1.1 Typesetting for Backus-Naur Form (BNF) definitions] +%[2019/04/14 2.0 Typesetting for Backus-Naur Form (BNF) definitions] %<*driver> \documentclass[10pt,a4paper]{ltxdoc} \usepackage{backnaur} @@ -64,13 +64,15 @@ % {Initial version of the package.} %^^A %^^A 3 December 2012 -%^^A Add tstt option and generally rewrite documentation +%^^A Add tstt option and generally rewrite documentation. % \changes{v1.1}{2012/12/12} -% {Added {\tt tstt} option, and improved documentation.} +% {Improved documentation.} +% %^^A------------------------------------------------------------------- % %^^A \CheckSum{0} %^^A no checksum for development -% \CheckSum{59} +% \CheckSum{62} +% % \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 % Lower-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 @@ -89,13 +91,9 @@ % % \GetFileInfo{backnaur.sty} % -% \title{The \textsf{backnaur} package\thanks{ -% This work replaces \emph{Writing BNF Notation in LaTeX}, -% which described a non-package method of BNF typesetting. -% This document corresponds to \textsf{backnaur}~\fileversion, dated~\filedate.}} -% +% \title{The \texttt{backnaur} package} % \author{Adrian P. Robson\thanks{\texttt{adrian.robson@nepsweb.co.uk}}} -% \date{12 December 2012} +% \date{Version 2.0\\[0.5ex]14 April 2019} % % \maketitle % @@ -105,7 +103,7 @@ % % \section{Introduction} % -% The \textsf{backnaur} package typesets Backus-Naur Form (BNF) definitions. +% The \texttt{backnaur} package typesets Backus-Naur Form (BNF) definitions. % It creates aligned lists of productions, with numbers if required. % It can also print in line BNF expressions using math mode. % @@ -156,7 +154,7 @@ % Each BNF production is defined by a |\bnfprod| command, which has two arguments % giving its left and right sides. % The right hand side of each production is specified with the commands described in -% \S\ref{commandDesc}. +% \S\ref{prodef} below. % Terminal (|\bnfts{;}|) and nonterminal (|\bnfpn{item}|), elements are separated % by spaces (|\bnfsp|) and OR symbols (|\bnfor|). % The |\bnfes| command gives the symbol for the empty string. @@ -181,13 +179,14 @@ % xxxxxxxxx \=\kill % |perp| \>The empty string symbol is $\perp$\\ % |epsilon| \> The empty string symbol is $\epsilon$\\ -% |tstt| \> Terminal string typeface is typewriter +% |tsrm| \> Terminal string typeface is roman\\ +% |tstt| \> Terminal string typeface is typewriter (default) % \end{tabbing} % \vspace{-1ex} % % \noindent % The defaults are: the empty string symbol is $\lambda$, -% and the terminal string typeface is normal (roman). +% and the terminal string typeface is typewriter. % % \subsection{Environments} % @@ -216,7 +215,13 @@ % |\bnfprod{||}{||}| % \end{quote} % -% \subsection{Production definitions} +% \DescribeMacro{\bnfmore} +% A production can be continued on addition lines by |\bnfmore|, which takes one argument: +% \begin{quote} +% |\bnfmore{||}| +% \end{quote} +% +% \subsection{Production definitions}\label{prodef} % % The following commands are used to compose the right hand side of a production. % They are deployed in the second argument of the |\bnfprod| command. @@ -234,12 +239,13 @@ % \end{minipage} % \end{quote} % -% \DescribeMacro{\bnftm} % There are three types of terminal item: a literal string, a descriptive phrase and an empty string. -% \DescribeMacro{\bnftd} +% \DescribeMacro{\bnftm} % A literal terminal string is specified by the |\bnftm| command, which takes a single argument. -% \DescribeMacro{\bnfes} +% By default literal terminal strings are printed in typewriter font, but this can be changed as a package option (see \S\ref{packopts}). +% \DescribeMacro{\bnftd} % The |\bnftd| command generates a descriptive phrase, as an alternative to a literal string. +% \DescribeMacro{\bnfes} % The |\bnfes| command generates a token that represents the empty string. % This is normally $\bnfes$, but it can be changed as a package option (see \S\ref{packopts}). % \begin{quote} @@ -287,6 +293,7 @@ % % \subsection{Inline expressions} % +% \DescribeMacro{\bnfpn} % The package's definition commands can be typeset inline using maths mode, % so the expression |$\bnfpn{name}$| will give $\bnfpn{name}$. % @@ -295,16 +302,6 @@ % can be printed independently from the |bnf| environment if required. % The |\bnfprod| command cannot be used inline. % -% \DescribeMacro{\bnfpo} -% The |\bnfpo| command is provided so that the production operator $\bnfpo$ -% can be printed independently from the |bnf| environment if required. -% The |\bnfprod| command cannot be used inline. -% -% \DescribeMacro{\bnfpo} -% The |\bnfprod| command cannot be used inline. -% So the |\bnfpo| command is provided so that the production operator $\bnfpo$ -% can be printed independently from the |bnf| environment if required. -% % \subsection{Command summary} % % The commands that can be used to define a BNF production in a |bnf| or |bnf*| environment @@ -351,56 +348,57 @@ % \bnfprod{wchar} % {\bnfpn{cchar} \bnfor \bnfpn{ichar} }\\ % \bnfprod{cchar} -% {\bnfts{A} \bnfsk \bnfts{Z} \bnfor \bnfts{a} \bnfsk \bnfts{z} -% \bnfor \bnfts{0} \bnfsk \bnfts{9} \bnfor +% {\bnfts{A} \bnfsk \bnfts{Z} \bnfor \bnfts{a} \bnfsk +% \bnfts{z} \bnfor \bnfts{0} \bnfsk \bnfts{9} \bnfor % \bnfts{\textquotesingle}}\\ % \bnfprod{ichar} % {-}\\ % \bnfprod{schar} % {\bnfts{`\hspace{1em}'} \bnfor \bnfts{!} \bnfor \bnfts{"} -% \bnfor \bnfts{(} \bnfor \bnfts{)} \bnfor \bnfts{\{} \bnfor -% \bnfts{\}} \bnfor \bnfts{:} \bnfor \bnfts{;} \bnfor \bnfts{?} -% \bnfor \bnfts{,}}\\ +% \bnfor \bnfts{(} \bnfor \bnfts{)} \bnfor \bnfts{\{} +% \bnfor \bnfts{\}} \bnfor }\\ +% \bnfmore{\bnfts{:} \bnfor \bnfts{;} \bnfor \bnfts{?} \bnfor +% \bnfts{,} } %\end{bnf*} %\end{verbatim} % \end{samepage} % % \noindent % This creates the following BNF definition: -% \begin{bnf*} -% \bnfprod{sentence} -% {\bnfpn{start} \bnfsp \bnfpn{rest} \bnfsp \bnfts{.}}\\ -% \bnfprod{start} -% {\bnfpn{space} \bnfor \bnfes}\\ -% \bnfprod{rest} -% {\bnfpn{word} \bnfsp \bnfpn{space} \bnfsp \bnfpn{rest} -% \bnfor \bnfpn{word} \bnfor \bnfes }\\ -% \bnfprod{word} -% {\bnfpn{wchar} \bnfsp \bnfpn{word} \bnfor \bnfpn{wchar}}\\ -% \bnfprod{space} -% {\bnfpn{schar} \bnfsp \bnfpn{space} \bnfor \bnfpn{schar}}\\ -% \bnfprod{wchar} -% {\bnfpn{cchar} \bnfor \bnfpn{ichar} }\\ -% \bnfprod{cchar} -% {\bnfts{A} \bnfsk \bnfts{Z} \bnfor \bnfts{a} \bnfsk -% \bnfts{z} \bnfor \bnfts{0} \bnfsk \bnfts{9} \bnfor -% \bnfts{\textquotesingle} }\\ -% \bnfprod{ichar} -% {-}\\ -% \bnfprod{schar} -% {\bnfts{`\hspace{1em}'} \bnfor \bnfts{!} \bnfor \bnfts{"} -% \bnfor \bnfts{(} \bnfor \bnfts{)} \bnfor \bnfts{\{} -% \bnfor \bnfts{\}} \bnfor \bnfts{:} \bnfor \bnfts{;} -% \bnfor \bnfts{?} \bnfor \bnfts{,} } -% \end{bnf*} -% +%\begin{bnf*} +% \bnfprod{sentence} +% {\bnfpn{start} \bnfsp \bnfpn{rest} \bnfsp \bnfts{.}}\\ +% \bnfprod{start} +% {\bnfpn{space} \bnfor \bnfes}\\ +% \bnfprod{rest} +% {\bnfpn{word} \bnfsp \bnfpn{space} \bnfsp \bnfpn{rest} +% \bnfor \bnfpn{word} \bnfor \bnfes }\\ +% \bnfprod{word} +% {\bnfpn{wchar} \bnfsp \bnfpn{word} \bnfor \bnfpn{wchar}}\\ +% \bnfprod{space} +% {\bnfpn{schar} \bnfsp \bnfpn{space} \bnfor \bnfpn{schar}}\\ +% \bnfprod{wchar} +% {\bnfpn{cchar} \bnfor \bnfpn{ichar} }\\ +% \bnfprod{cchar} +% {\bnfts{A} \bnfsk \bnfts{Z} \bnfor \bnfts{a} \bnfsk +% \bnfts{z} \bnfor \bnfts{0} \bnfsk \bnfts{9} \bnfor +% \bnfts{\textquotesingle} }\\ +% \bnfprod{ichar} +% {-}\\ +% \bnfprod{schar} +% {\bnfts{`\hspace{1em}'} \bnfor \bnfts{!} \bnfor \bnfts{"} +% \bnfor \bnfts{(} \bnfor \bnfts{)} \bnfor \bnfts{\{} +% \bnfor \bnfts{\}} \bnfor }\\ +% \bnfmore{\bnfts{:} \bnfor \bnfts{;} \bnfor \bnfts{?} \bnfor +% \bnfts{,} } +%\end{bnf*} % %^^A------------------------------------------------------------------- %^^A Start code implementation %^^A------------------------------------------------------------------- % -% \StopEventually{} -%^^A \StopEventually{\PrintChanges} +%^^A \StopEventually{} +% \StopEventually{\PrintChanges} %^^A -> Run pdfLaTeX backnaur.dtx %^^A makeindex -s gglo.ist -o backnaur.gls backnaur.glo %^^A pdfLaTeX backnaur.dtx @@ -409,6 +407,7 @@ %^^A makeindex -s gind.ist -o backnaur.ind backnaur.idx %^^A pdfLaTeX backnaur.dtx % +% \newpage % \section{Implementation} % % The implementation of |backnaur.sty| uses only \LaTeX{} commands. @@ -474,9 +473,10 @@ % \changes{v1.1}{2012/12/12}{Support for {\tt tstt} option added} % \begin{macro}{\bnf@tsfont} % Terminal string. The font is controlled by the |\bnf@tsfont| macro, -% and this macro can be redefined by the |tstt| option (see \S\ref{codeoptions}). +% and this macro can be redefined by the |tsrm| option (see \S\ref{codeoptions}). +% The default is typewriter font. % \begin{macrocode} -\newcommand\bnf@tsfont[1]{\textrm{#1}} +\newcommand\bnf@tsfont[1]{\texttt{#1}} \newcommand{\bnfts}[1]{\textnormal{\bnf@tsfont{#1}}} % \end{macrocode} % \end{macro} @@ -515,15 +515,37 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\bnfmore} +% \changes{v2.0}{2019/04/07} +% {Added macro.} +% A continuation of a Backus-Naur Form production. +% This command is designed to exploit the behaviour the |equarray| used in +% the |bnf| and |bnf*| environments to correctly align with preceding +% |\bnfprod| and |\bnfmore| macros. +% \begin{macrocode} +\newcommand{\bnfmore}[1]{ & & #1} +% \end{macrocode} +% \end{macro} +% % \subsection{Options}\label{codeoptions} % % \begin{macro}{tstt} -% \changes{v1.1}{2012/12/12}{New option declared} +% \changes{v1.1}{2012/12/12}{New option} +% \changes{v2.0}{2019/04/14}{Changed to be default} +% The |tstt| option is the default, so it does nothing. +% This option is provided for compatibility with previous versions. +% \begin{macrocode} +\DeclareOption{tstt}{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{tsrm} +% \changes{v2.0}{2019/04/14}{New option} % \begin{macro}{\bnf@tsfont} -% The |tstt| option redefines |\bnf@tsfont| to change the -% terminal string font used in the |\bnfts| command (see \S\ref{codebnfts}): +% The |tsrm| option redefines |\bnf@tsfont| to change the +% terminal string font used in the |\bnfts| command (see \S\ref{codebnfts}) to roman font. % \begin{macrocode} -\DeclareOption{tstt}{\renewcommand\bnf@tsfont[1]{\texttt{#1}}} +\DeclareOption{tsrm}{\renewcommand\bnf@tsfont[1]{\textrm{#1}}} % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/backnaur/backnaur.ins b/Master/texmf-dist/source/latex/backnaur/backnaur.ins index ccccd9186f5..a62e0749c56 100644 --- a/Master/texmf-dist/source/latex/backnaur/backnaur.ins +++ b/Master/texmf-dist/source/latex/backnaur/backnaur.ins @@ -1,5 +1,5 @@ % backnaur.ins -% 15 November 2012 +% 7 April 2019 % % Installation file for the backnaur package. % @@ -9,7 +9,7 @@ % Run LaTeX on backnaur.dtx to produce the package % documentation. % -% Copyright (C) 2012 by Adrian P Robson +% Copyright (C) 2019 by Adrian P Robson % adrian.robson@nepsweb.co.uk % % This work may be distributed and/or modified under the @@ -34,7 +34,7 @@ \preamble -Copyright (C) 2012 by Adrian P Robson +Copyright (C) 2019 by Adrian P Robson adrian.robson@nepsweb.co.uk This work may be distributed and/or modified under the -- cgit v1.2.3