Skip to content

Commit 33bd777

Browse files
committed
[std] Switch grammar to \sffamily \itshape
Compensate the slightly heavier font by color {gray}{0.2}.
1 parent ee28791 commit 33bd777

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

source/classes.tex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5740,7 +5740,6 @@
57405740
\end{codeblock}
57415741
\end{example}
57425742
\begin{note}
5743-
\setlength{\emergencystretch}{1em}
57445743
The initialization
57455744
performed by each \grammarterm{mem-initializer}
57465745
constitutes a full-expres\-sion\iref{intro.execution}.

source/declarations.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6251,7 +6251,7 @@
62516251
A coroutine behaves as if its \grammarterm{function-body} were replaced by:
62526252
\begin{ncsimplebnf}
62536253
\terminal{\{}\br
6254-
\bnfindent promise-type \exposid{promise} promise-constructor-arguments \terminal{;}\br
6254+
\bnfindent \placeholder{promise-type} \exposid{promise} \placeholder{promise-constructor-arguments} \terminal{;}\br
62556255
% FIXME: \bnfindent \exposid{promise}\terminal{.get_return_object()} \terminal{;}
62566256
% ... except that it's not a discarded-value expression
62576257
\bnfindent \terminal{co_await} \terminal{\exposid{promise}.initial_suspend()} \terminal{;}\br

source/macros.tex

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,10 @@
202202
\newcommand{\CodeStyle}{\ttfamily}
203203
\newcommand{\CodeStylex}[1]{\texttt{#1}}
204204

205+
\definecolor{grammar-gray}{gray}{0.2}
206+
205207
% General grammar style
206-
\newcommand{\GrammarStyle}{\itfamily}
207-
\newcommand{\GrammarStylex}[1]{\textit{#1}}
208+
\newcommand{\GrammarStylex}[1]{\textcolor{grammar-gray}{\textsf{\textit{#1}}}}
208209

209210
% Code and definitions embedded in text.
210211
\newcommand{\tcode}[1]{\CodeStylex{#1}}
@@ -214,7 +215,7 @@
214215
\newcommand{\keyword}[1]{\tcode{#1}\indextext{\idxcode{#1}}}
215216
\newcommand{\grammarterm}[1]{\indexgram{\idxgram{#1}}\gterm{#1}}
216217
\newcommand{\grammartermnc}[1]{\indexgram{\idxgram{#1}}\gterm{#1\nocorr}}
217-
\newcommand{\regrammarterm}[1]{\gterm{#1}}
218+
\newcommand{\regrammarterm}[1]{\textit{#1}}
218219
\newcommand{\placeholder}[1]{\textit{#1}}
219220
\newcommand{\placeholdernc}[1]{\textit{#1\nocorr}}
220221
\newcommand{\exposid}[1]{\tcode{\placeholder{#1}}}
@@ -240,7 +241,7 @@
240241
\newcommand{\CppXI}{\Cpp{} 2011}
241242
\newcommand{\CppXIV}{\Cpp{} 2014}
242243
\newcommand{\CppXVII}{\Cpp{} 2017}
243-
\newcommand{\opt}[1]{#1\ensuremath{_\mathit{opt}}}
244+
\newcommand{\opt}[1]{#1\ensuremath{_\mathit{\color{black}opt}}}
244245
\newcommand{\dcr}{-{-}}
245246
\newcommand{\bigoh}[1]{\ensuremath{\mathscr{O}(#1)}}
246247

@@ -526,16 +527,17 @@
526527
\setlength{\BnfInc}{\BnfIndent}
527528
\newlength{\BnfRest}
528529
\setlength{\BnfRest}{2\BnfIndent}
529-
\newcommand{\BnfNontermshape}{\small\rmfamily\itshape}
530+
\newcommand{\BnfNontermshape}{\small\color{grammar-gray}\sffamily\itshape}
531+
\newcommand{\BnfReNontermshape}{\small\rmfamily\itshape}
530532
\newcommand{\BnfTermshape}{\small\ttfamily\upshape}
531533

532534
\newenvironment{bnfbase}
533535
{
534536
\newcommand{\nontermdef}[1]{{\BnfNontermshape##1\itcorr}\indexgrammar{\idxgram{##1}}\textnormal{:}}
535-
\newcommand{\renontermdef}[1]{{\BnfNontermshape##1\itcorr}\,\textnormal{::}}
536537
\newcommand{\terminal}[1]{{\BnfTermshape ##1}}
537538
\renewcommand{\keyword}[1]{\terminal{##1}\indextext{\idxcode{##1}}}
538-
\renewcommand{\exposid}[1]{\terminal{\placeholder{##1}}}
539+
\renewcommand{\exposid}[1]{\terminal{\textit{##1}}}
540+
\renewcommand{\placeholder}[1]{\textrm{\textit{##1}}}
539541
\newcommand{\descr}[1]{\textnormal{##1}}
540542
\newcommand{\bnfindent}{\hspace*{\bnfindentfirst}}
541543
\newcommand{\bnfindentfirst}{\BnfIndent}
@@ -572,6 +574,19 @@
572574
\end{bnfbase}
573575
}
574576

577+
\newenvironment{ncrebnf}
578+
{
579+
\begin{bnfbase}
580+
\newcommand{\renontermdef}[1]{{\BnfReNontermshape##1\itcorr}\,\textnormal{::}}
581+
\begin{bnflist}
582+
\BnfReNontermshape
583+
\item\relax
584+
}
585+
{
586+
\end{bnflist}
587+
\end{bnfbase}
588+
}
589+
575590
% non-copied versions of bnf environments
576591
\let\ncsimplebnf\simplebnf
577592
\let\endncsimplebnf\endsimplebnf

source/regex.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3680,7 +3680,7 @@
36803680
\pnum
36813681
The following productions within the ECMAScript grammar are modified as follows:
36823682

3683-
\begin{ncbnf}
3683+
\begin{ncrebnf}
36843684
\renontermdef{ClassAtom}\br
36853685
\terminal{-}\br
36863686
ClassAtomNoDash\br
@@ -3690,12 +3690,12 @@
36903690

36913691
\renontermdef{IdentityEscape}\br
36923692
SourceCharacter \textnormal{\textbf{but not}} \terminal{c}
3693-
\end{ncbnf}
3693+
\end{ncrebnf}
36943694

36953695
\pnum
36963696
The following new productions are then added:
36973697

3698-
\begin{ncbnf}
3698+
\begin{ncrebnf}
36993699
\renontermdef{ClassAtomExClass}\br
37003700
\terminal{[:} ClassName \terminal{:]}
37013701

@@ -3711,7 +3711,7 @@
37113711

37123712
\renontermdef{ClassNameCharacter}\br
37133713
SourceCharacter \textnormal{\textbf{but not one of}} \terminal{.} \textnormal{\textbf{or}} \terminal{=} \textnormal{\textbf{or}} \terminal{:}
3714-
\end{ncbnf}
3714+
\end{ncrebnf}
37153715

37163716
\pnum
37173717
The productions \regrammarterm{ClassAtomExClass}, \regrammarterm{ClassAtomCollatingElement}

source/std.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
\usepackage[final]{microtype}
2727
\usepackage{multicol}
2828
\usepackage{lmodern}
29+
\usepackage{xcolor}
2930
\usepackage[T1]{fontenc}
3031
\usepackage[pdftex, final]{graphicx}
3132
\usepackage[pdftex,

0 commit comments

Comments
 (0)