From 217df5a9ed85e2abcc98ed4b1b47b731c411c4da Mon Sep 17 00:00:00 2001 From: "Kevin M. Godby" Date: Sun, 27 Sep 2020 15:14:26 -0500 Subject: [PATCH] Add new note* and example* environments to suppress paragraph break. The new note* and example* environments will suppress the trailing paragraph break. This is useful when the environment is followed by a punctuation mark. --- source/classes.tex | 4 ++-- source/expressions.tex | 8 ++++---- source/macros.tex | 15 ++++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index 7865118232..2e4e19b476 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -746,10 +746,10 @@ \item every static data member of class \tcode{T}; \item every member function of class \tcode{T} -\begin{note} +\begin{note*} This restriction does not apply to constructors, which do not have names\iref{class.ctor} -\end{note}% +\end{note*}% ; \item every member of class \tcode{T} that is itself a type; diff --git a/source/expressions.tex b/source/expressions.tex index 9ed419311b..b9405a9eb0 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -6893,10 +6893,10 @@ \item an invocation of a non-constexpr function -\begin{note} +\begin{note*} Overload resolution\iref{over.match} is applied as usual. -\end{note}% +\end{note*}% ; \item @@ -6922,12 +6922,12 @@ \item an operation that would have undefined behavior as specified in \ref{intro} through \ref{cpp} -\begin{note} +\begin{note*} including, for example, signed integer overflow\iref{expr.prop}, certain pointer arithmetic\iref{expr.add}, division by zero\iref{expr.mul}, or certain shift operations\iref{expr.shift} -\end{note}% +\end{note*}% ; \item diff --git a/source/macros.tex b/source/macros.tex index 13f1a4e55f..0168bd43d3 100644 --- a/source/macros.tex +++ b/source/macros.tex @@ -275,12 +275,17 @@ % ending with END TEXT. A counter with name ENVIRON indicates the % number of this kind of note / example that has occurred in this % subclause. -\newcommand{\newnoteenvironment}[3]{ -\newsubclausecounter{#1} -\newenvironment{#1} -{\def\noteend{#3}\par\small\stepcounter{#1}\noteintro{#2}} -{\noteoutro{\noteend}\par} +\ExplSyntaxOn +\NewDocumentCommand \newnoteenvironment { m m m } { + \newsubclausecounter{#1} + \NewDocumentEnvironment {#1*} { } + {\def\noteend{#3}\par\small\stepcounter{#1}\noteintro{#2}} + {\noteoutro{\noteend}} + \NewDocumentEnvironment {#1} { } + {\begin{#1*}} + {\end{#1*}\par} } +\ExplSyntaxOff \newnoteenvironment{note}{Note \arabic{note}}{end note} \newnoteenvironment{example}{Example \arabic{example}}{end example}