X-Git-Url: https://git.distorted.org.uk/~mdw/mdwtools/blobdiff_plain/88ddb950817e0413117789eaaee3752e9630453d..af8af7ebae9718c35b8661bfdef3b4e2af56144d:/syntax.dtx diff --git a/syntax.dtx b/syntax.dtx index cbe09df..d25e5f4 100644 --- a/syntax.dtx +++ b/syntax.dtx @@ -1,17 +1,7 @@ -% \begin{meta-comment} -% -% syntax.dtx -% -% Syntax typesetting package for LaTeX 2e -% -% (c) 2003 Mark Wooding -% -% \end{meta-comment} -% % \begin{meta-comment} %% %% syntax package -- typesetting syntax descriptions -%% Copyright (c) 2003 Mark Wooding +%% Copyright (c) 1996, 2002, 2015, 2020 Mark Wooding %% %% This program is free software; you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published by @@ -32,10 +22,10 @@ % \begin{meta-comment} %<+package>\NeedsTeXFormat{LaTeX2e} %<+package>\ProvidesPackage{syntax} -%<+package> [2003/08/25 1.08 Syntax typesetting (MDW)] +%<+package> [2020/09/06 1.14.0 Syntax typesetting] % \end{meta-comment} % -% \CheckSum{1627} +% \CheckSum{1628} %% \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 @@ -313,7 +303,7 @@ % % You can modify the appearance of grammars using three length parameters: % -% \begin{description} \def\makelabel{\hskip\labelsep\cmd} +% \begin{description} \setdescriptionlabel{\cmd{#1}} % % \item [\grammarparsep] is the amount of space inserted between production % rules. It is a rubber length whose default value is 8\,pt, with @@ -406,17 +396,17 @@ % ^^A took to get the table below to look right: __6. Hmm... not as bad % ^^A as I expected. Most of them were fine-tuning things. % -% \medskip ^^A Leave a vertical gap -% \hbox to\columnwidth{\hfil\vbox{\tabskip=0pt ^^A Centre it horizontally -% \sdsize \csname sd@setsize\endcsname ^^A Position syntdiag arrows -% \halign to .5\columnwidth{ ^^A Set the table width +% \medskip ^^A Leave a vertical gap +% \hbox to\columnwidth{\hfil\vbox{\tabskip=0pt ^^A Centre it horizontally +% \sdsize \csname sd@setsize\endcsname ^^A Position syntdiag arrows +% \halign to .5\columnwidth{ ^^A Set the table width % &\ttfamily\ignorespaces#\unskip\hfil\tabskip=0pt ^^A Typeset the name -% &\quad\csname sd@arr@#\endcsname\hfil ^^A Typeset the arrow -% &\setbox0=\hbox{#}\tabskip=0pt plus 1fil\cr ^^A Stretch between columns +% &\quad\csname sd@arr@#\endcsname\hfil ^^A Typeset the arrow +% &\setbox0=\hbox{#}\tabskip=0pt plus 1fil\cr ^^A Stretch between columns % >>-&>>-& &>-&>-& &->&->\cr % -><&-><& &...&...& &-&-\cr -% }}\hfil} ^^A Close the boxing -% \medskip ^^A And leave another gap +% }}\hfil} ^^A Close the boxing +% \medskip ^^A And leave another gap % % These declarations should be used only in the optional argument to the % \env{syntdiag$*$} command. The second optional argument to the @@ -562,7 +552,7 @@ % % The following length parameters may be altered: % -% \begin{description} \def\makelabel{\hskip\labelsep\cmd} +% \begin{description} \setdescriptionlabel{\cmd{#1}} % % \item [\sdstartspace] The length of the rule between the arrows which % begin each line of the syntax diagram and the first item on the line. @@ -623,11 +613,11 @@ % |\lit| and |\lit*|) has two style commands associated with it, as shown % in the table below. % -% \begin{tab}{lll} \hline -% \bf Syntax item & \bf Left command & \bf Right command \\ \hline -% Nonterminals & |\syntleft| & |\syntright| \\ -% Quoted terminals & |\litleft| & |\litright| \\ -% Unquoted terminals & |\ulitleft| & |\ulitright| \\ \hline +% \begin{tab}{lll} \hline +% \bf Syntax item & \bf Left command & \bf Right command \\ \hline +% Nonterminals & |\syntleft| & |\syntright| \\ +% Quoted terminals & |\litleft| & |\litright| \\ +% Unquoted terminals & |\ulitleft| & |\ulitright| \\ \hline % \end{tab} % % It's not too hard to see how this works. For example, if you look at @@ -778,7 +768,7 @@ % % There's some extra cunningness here, because I'd like to be able to % hyphenate after underscores usually, but not when there's another one -% following. And then, because \env{tabbing} redefines |\_|, there's some +% following. And then, because \env{tabbing} redefines |\-|, there's some % more yukkiness to handle that: the usual |\@tabacckludge| mechanism doesn't % cope with this particular case. % @@ -1102,6 +1092,7 @@ \bgroup% \verb@eol@error% \let\do\@makeother\dospecials% + \@noligs% #2% \catcode`#1\active% \lccode`\~`#1%