Re: [PATCH -perfbook 1/2] Define macros for multi-part listings in preamble

Akira Yokosawa <[email protected]> Sat, 27 Jun 2026 14:26:14 +0900
Newsgroups org.kernel.vger.perfbook
Message-ID <[email protected]>
On Fri, 26 Jun 2026 10:59:03 -0700, Paul E. McKenney wrote:
> On Fri, Jun 26, 2026 at 08:34:47PM +0900, Akira Yokosawa wrote:
>> Paul said he has a plan to add listings similar to Listings 9.13
>> and 9.14 [1].
>>
>> Move local definitions in rcuintro.tex for such multi-part listings
>> into preamble so that they can be used elsewhere.  Note that
>> "VerbatimT" and "adjustwidth" envs have vertical spacing tweaks
>> applied.
> 
> Queued, thank you very much!!!
> 
> I queued the following commit on top of these two in order to create
> the first Tools of the Trade triple listing.  Does this make sense,
> or is there a better way?
> 
> 							Thanx, Paul
> 
> ------------------------------------------------------------------------
> 
> commit 72f863e04bf56ec4e95e90a789570a2434caf61e
> Author: Paul E. McKenney <[email protected]>
> Date:   Fri Jun 26 10:44:49 2026 -0700
> 
>     Add definitions of \adjvspace{above,below,bottom}

I removed those definitions in Patch 1/2 because (new) VerbatimT and
adjustwidth envs now have those extra vertical spaces on their own.

diff --git a/perfbook-lt.tex b/perfbook-lt.tex
index 0dc05325..cb8299a5 100644
--- a/perfbook-lt.tex
+++ b/perfbook-lt.tex
@@ -397,6 +397,12 @@
 {numbers=left,numbersep=3pt,xleftmargin=5pt,xrightmargin=5pt,frame=single}
 \DefineVerbatimEnvironment{VerbatimU}{Verbatim}%
 {numbers=none,xleftmargin=5pt,xrightmargin=5pt,samepage=true,frame=single}
+% for multi-part listings with explanation
+\DefineVerbatimEnvironment{VerbatimT}{Verbatim}%
+{numbers=left,numbersep=5pt,frame=single,xrightmargin=5pt}
+\BeforeBeginEnvironment{VerbatimT}{\vspace*{2pt}}
+\AfterEndEnvironment{VerbatimT}{\vspace*{-1pt}}
+\AfterEndEnvironment{adjustwidth}{\vspace*{-2pt}}
 
 \IfLmttForCode{
 \AtBeginEnvironment{verbatim}{\renewcommand{\ttdefault}{lmtt}}

>     
>     Signed-off-by: Paul E. McKenney <[email protected]>
> 
> diff --git a/perfbook-lt.tex b/perfbook-lt.tex
> index f6d6efc2..3c1e15f1 100644
> --- a/perfbook-lt.tex
> +++ b/perfbook-lt.tex
> @@ -407,6 +407,9 @@
>  \newcommand{\myfvline}{\arabic{FancyVerbLine}} % redefine on-the-fly
>  \AtBeginEnvironment{VerbatimT}{%
>    \renewcommand{\theFancyVerbLine}{\rmfamily\tiny \myfvline}}
> +\newcommand{\adjvspaceabove}{\vspace*{2pt}}
> +\newcommand{\adjvspacebelow}{\vspace*{-1pt}}
> +\newcommand{\adjvspacebottom}{\vspace*{-2pt}}
>  
>  \IfLmttForCode{
>  \AtBeginEnvironment{verbatim}{\renewcommand{\ttdefault}{lmtt}}

I think the easiest way forward for both of us is to keep your
change without applying my changes.  I'll rebase my changes after
seeing your new multi-part listing(s) and submit v2.

        Thanks, Akira