Skip to content

Commit 1772778

Browse files
jensmaurerzygoloid
authored andcommitted
[std] Switch grammar to \sffamily \itshape
Compensate the slightly heavier font by color {gray}{0.2}.
1 parent 029f630 commit 1772778

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
@@ -5725,7 +5725,6 @@
57255725
\end{codeblock}
57265726
\end{example}
57275727
\begin{note}
5728-
\setlength{\emergencystretch}{1em}
57295728
The initialization
57305729
performed by each \grammarterm{mem-initializer}
57315730
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
@@ -6248,7 +6248,7 @@
62486248
A coroutine behaves as if its \grammarterm{function-body} were replaced by:
62496249
\begin{ncsimplebnf}
62506250
\terminal{\{}\br
6251-
\bnfindent promise-type \exposid{promise} promise-constructor-arguments \terminal{;}\br
6251+
\bnfindent \placeholder{promise-type} \exposid{promise} \placeholder{promise-constructor-arguments} \terminal{;}\br
62526252
% FIXME: \bnfindent \exposid{promise}\terminal{.get_return_object()} \terminal{;}
62536253
% ... except that it's not a discarded-value expression
62546254
\bnfindent \terminal{try} \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

@@ -524,16 +525,17 @@
524525
\setlength{\BnfInc}{\BnfIndent}
525526
\newlength{\BnfRest}
526527
\setlength{\BnfRest}{2\BnfIndent}
527-
\newcommand{\BnfNontermshape}{\small\rmfamily\itshape}
528+
\newcommand{\BnfNontermshape}{\small\color{grammar-gray}\sffamily\itshape}
529+
\newcommand{\BnfReNontermshape}{\small\rmfamily\itshape}
528530
\newcommand{\BnfTermshape}{\small\ttfamily\upshape}
529531

530532
\newenvironment{bnfbase}
531533
{
532534
\newcommand{\nontermdef}[1]{{\BnfNontermshape##1\itcorr}\indexgrammar{\idxgram{##1}}\textnormal{:}}
533-
\newcommand{\renontermdef}[1]{{\BnfNontermshape##1\itcorr}\,\textnormal{::}}
534535
\newcommand{\terminal}[1]{{\BnfTermshape ##1}}
535536
\renewcommand{\keyword}[1]{\terminal{##1}\indextext{\idxcode{##1}}}
536-
\renewcommand{\exposid}[1]{\terminal{\placeholder{##1}}}
537+
\renewcommand{\exposid}[1]{\terminal{\textit{##1}}}
538+
\renewcommand{\placeholder}[1]{\textrm{\textit{##1}}}
537539
\newcommand{\descr}[1]{\textnormal{##1}}
538540
\newcommand{\bnfindent}{\hspace*{\bnfindentfirst}}
539541
\newcommand{\bnfindentfirst}{\BnfIndent}
@@ -570,6 +572,19 @@
570572
\end{bnfbase}
571573
}
572574

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

source/regex.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3636,7 +3636,7 @@
36363636
\pnum
36373637
The following productions within the ECMAScript grammar are modified as follows:
36383638

3639-
\begin{ncbnf}
3639+
\begin{ncrebnf}
36403640
\renontermdef{ClassAtom}\br
36413641
\terminal{-}\br
36423642
ClassAtomNoDash\br
@@ -3646,12 +3646,12 @@
36463646

36473647
\renontermdef{IdentityEscape}\br
36483648
SourceCharacter \textnormal{\textbf{but not}} \terminal{c}
3649-
\end{ncbnf}
3649+
\end{ncrebnf}
36503650

36513651
\pnum
36523652
The following new productions are then added:
36533653

3654-
\begin{ncbnf}
3654+
\begin{ncrebnf}
36553655
\renontermdef{ClassAtomExClass}\br
36563656
\terminal{[:} ClassName \terminal{:]}
36573657

@@ -3667,7 +3667,7 @@
36673667

36683668
\renontermdef{ClassNameCharacter}\br
36693669
SourceCharacter \textnormal{\textbf{but not one of}} \terminal{.} \textnormal{\textbf{or}} \terminal{=} \textnormal{\textbf{or}} \terminal{:}
3670-
\end{ncbnf}
3670+
\end{ncrebnf}
36713671

36723672
\pnum
36733673
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)