Skip to content

Commit 0965859

Browse files
committed
Update std macros
1 parent 4df8ae3 commit 0965859

File tree

4 files changed

+51
-24
lines changed

4 files changed

+51
-24
lines changed

papers/P2988/common.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
\usepackage{color} % define colors for strikeouts and underlines
2525
\usepackage{amsmath} % additional math symbols
2626
\usepackage{mathrsfs} % mathscr font
27+
\usepackage{bm}
2728
\usepackage[final]{microtype}
2829
\usepackage[splitindex,original]{imakeidx}
2930
\usepackage{multicol}
@@ -54,6 +55,7 @@
5455
% pdflang={English}]{hyperref}
5556

5657
\usepackage{memhfixc} % fix interactions between hyperref and memoir
58+
\usepackage{environ}
5759
\usepackage{expl3}
5860
\usepackage{xparse}
5961
\usepackage{xstring}

papers/P2988/stdtex/layout.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
%%--------------------------------------------------
1111
%% set header and footer positions and sizes
1212

13-
\setheadfoot{\onelineskip}{4\onelineskip}
13+
\setheadfoot{3\onelineskip}{4\onelineskip}
1414
\setheaderspaces{*}{2\onelineskip}{*}
1515

1616
%%--------------------------------------------------

papers/P2988/stdtex/macros.tex

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,17 @@
3939
\newenvironment{addedblock}{\color{addclr}}{\color{black}}
4040
\newenvironment{removedblock}{\color{remclr}}{\color{black}}
4141

42-
%% %%--------------------------------------------------
43-
%% %% Grammar extraction.
44-
%% %%--------------------------------------------------
45-
%% \def\gramSec[#1]#2{}
42+
%%-------------------------------------------------------------
43+
%% Grammar extraction.
44+
%% Assumes that the output file \gramout is managed externally.
45+
%%-------------------------------------------------------------
46+
\makeatletter
47+
\newcommand{\gramWrite}[1]{\protected@write\gramout{}{#1}}
48+
\newcommand{\meaningbody}[1]{\expandafter\strip@prefix\meaning#1}
49+
\makeatother
4650

47-
%% \makeatletter
48-
%% \newcommand{\FlushAndPrintGrammar}{%
49-
%% \immediate\closeout\XTR@out%
50-
%% \immediate\openout\XTR@out=std-gram-dummy.tmp%
51-
%% \def\gramSec[##1]##2{\rSec1[##1]{##2}}%
52-
%% \input{std-gram.ext}%
53-
%% }
54-
%% \makeatother
51+
\newcommand{\gramSec}[2][]{\gramWrite{%
52+
\string\rSec1\string[\string#1\string]\string{\string#2\string}}}
5553

5654
%%--------------------------------------------------
5755
% Escaping for index entries. Replaces ! with "! throughout its argument.
@@ -237,14 +235,19 @@
237235
%%--------------------------------------------------
238236
\newcommand{\CodeStyle}{\ttfamily}
239237
\newcommand{\CodeStylex}[1]{\texttt{\protect\frenchspacing #1}}
238+
\makeatletter
239+
% Append `\@` to restore proper sentence spacing in text mode. This insertion
240+
% happens only during normal typesetting; it is suppressed for .idx generation.
241+
\newcommand{\CodeStylexGuarded}[1]{\CodeStylex{#1\ifmmode\else\ifx\protect\@typeset@protect\@\fi\fi}}
242+
\makeatother
240243

241244
\definecolor{grammar-gray}{gray}{0.2}
242245

243246
% General grammar style
244247
\newcommand{\GrammarStylex}[1]{\textcolor{grammar-gray}{\textsf{\textit{#1}}}}
245248

246249
% Code and definitions embedded in text.
247-
\newcommand{\tcode}[1]{\CodeStylex{#1}}
250+
\newcommand{\tcode}[1]{\CodeStylexGuarded{#1}}
248251
\newcommand{\term}[1]{\textit{#1}}
249252
\newcommand{\gterm}[1]{\GrammarStylex{#1}}
250253
\newcommand{\fakegrammarterm}[1]{\gterm{#1}}
@@ -294,7 +297,7 @@
294297
\newcommand{\CppXXIII}{\Cpp{} 2023}
295298
\newcommand{\CppXXVI}{\Cpp{} 2026}
296299
\newcommand{\IsoCUndated}{ISO/IEC 9899}
297-
\newcommand{\IsoC}{\IsoCUndated{}:2018}
300+
\newcommand{\IsoC}{\IsoCUndated{}:2024}
298301
\newcommand{\IsoFloatUndated}{ISO/IEC 60559}
299302
\newcommand{\IsoPosixUndated}{ISO/IEC/IEEE 9945}
300303
\newcommand{\IsoPosix}{\IsoPosixUndated{}:2009}
@@ -365,6 +368,7 @@
365368
\newcommand{\required}{\Fundesc{Required behavior}}
366369
\newcommand{\constraints}{\Fundesc{Constraints}}
367370
\newcommand{\mandates}{\Fundesc{Mandates}}
371+
\newcommand{\constantwhen}{\Fundesc{Constant When}}
368372
\newcommand{\expects}{\Fundesc{Preconditions}}
369373
\newcommand{\hardexpects}{\Fundesc{Hardened preconditions}}
370374
\newcommand{\effects}{\Fundesc{Effects}}
@@ -464,9 +468,15 @@
464468
\newcommand{\unspecbool}{\UNSP{unspecified-bool-type}}
465469
\newcommand{\seebelow}{\UNSP{see below}} % macro length: 0
466470
\newcommand{\seebelownc}{\UNSPnc{see below}} % macro length: 2
471+
\newcommand{\seeabove}{\UNSP{see above}} % macro length: 0
472+
\newcommand{\seeabovenc}{\UNSPnc{see above}} % macro length: 2
467473
\newcommand{\unspecuniqtype}{\UNSP{unspecified unique type}}
468474
\newcommand{\unspecalloctype}{\UNSP{unspecified allocator type}}
469475

476+
%% Convenience macro for double carets in expressions,
477+
%% particularly within \tcode.
478+
\newcommand{\reflexpr}[1]{\caret\caret#1}
479+
470480
%% Manual insertion of italic corrections, for aligning in the presence
471481
%% of the above annotations.
472482
\newlength{\itcorrwidth}
@@ -587,7 +597,7 @@
587597
\lstset{escapechar=@, aboveskip=\parskip, belowskip=0pt,
588598
midpenalty=500, endpenalty=-50,
589599
emptylinepenalty=-250, semicolonpenalty=0,upquote=true}%
590-
\renewcommand{\tcode}[1]{\textup{\CodeStylex{##1}}}
600+
\renewcommand{\tcode}[1]{\textup{\CodeStylexGuarded{##1}}}
591601
\renewcommand{\term}[1]{\textit{##1}}%
592602
\renewcommand{\grammarterm}[1]{\gterm{##1}}%
593603
}
@@ -645,7 +655,7 @@
645655
belowskip=0ex % leave this alone: it keeps these things out of the
646656
% footnote area
647657
}%
648-
\renewcommand{\tcode}[1]{\textup{\CodeStylex{##1}}}
658+
\renewcommand{\tcode}[1]{\textup{\CodeStylexGuarded{##1}}}
649659
}
650660
{
651661
}
@@ -701,7 +711,12 @@
701711
\nonfrenchspacing
702712
}
703713
704-
\newenvironment{simplebnf}
714+
% "ncbnf" is the non-copied "base" versions of the bnf environment;
715+
% instances of the full "bnf" environment is copied to the grammar
716+
% extraction file.
717+
% (Similarly for "ncsimplebnf", though in fact we never extract any
718+
% hypothetical "simplebnf" environments.)
719+
\newenvironment{ncsimplebnf}
705720
{
706721
\begin{bnfbase}
707722
\BnfNontermshape
@@ -712,7 +727,7 @@
712727
\end{bnfbase}
713728
}
714729
715-
\newenvironment{bnf}
730+
\newenvironment{ncbnf}
716731
{
717732
\begin{bnfbase}
718733
\begin{bnflist}
@@ -724,6 +739,7 @@
724739
\end{bnfbase}
725740
}
726741
742+
% The regex grammar is never copied.
727743
\newenvironment{ncrebnf}
728744
{
729745
\begin{bnfbase}
@@ -737,11 +753,10 @@
737753
\end{bnfbase}
738754
}
739755
740-
% non-copied versions of bnf environments
741-
\let\ncsimplebnf\simplebnf
742-
\let\endncsimplebnf\endsimplebnf
743-
\let\ncbnf\bnf
744-
\let\endncbnf\endbnf
756+
\NewEnviron{bnf}{\begin{ncbnf}%
757+
\BODY%
758+
\gramWrite{\string\begin{ncbnf}\meaningbody\BODY\string\end{ncbnf}}%
759+
\end{ncbnf}}{}
745760
746761
%%--------------------------------------------------
747762
%% Environment for imported graphics

papers/P2988/stdtex/tables.tex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,16 @@
243243
\end{LongTable}
244244
}
245245

246+
\newenvironment{libreqtab2b}[2]
247+
{
248+
\begin{LongTable}
249+
{#1}{#2}
250+
{x{.35\hsize}x{.59\hsize}}
251+
}
252+
{
253+
\end{LongTable}
254+
}
255+
246256
\newenvironment{libreqtab3}[2]
247257
{
248258
\begin{LongTable}

0 commit comments

Comments
 (0)