Hi Karl and Jan,
  I hope you don't mind if I cc this to the bug-texinfo list.

On Sat, Jun 11, 2005 at 08:06:03PM -0400, Karl Berry wrote:
> I wanted to get a small verbatim environment, as Jan wrote about back in
> July 2002.  It occurred to me that this might work, and be simpler than
> a new @smallverbatiminclude command:
> 
> @smallformat
> @verbatiminclude somefile.tex
> @end smallformat
> 
> It almost does, but the lines are actually exdented into the left
> margin, and the reason is not immediately apparent to me.
...
> I think all the other environments indent the text (by design), e.g.,
> @example
> @verbatiminclude somefile.tex
> @end smallexample
> has everything pushed over.

And that was the reason: all environments call \nonfillstart, which, among
other things, increases \leftindent.  If the environment doesn't want to
increase \leftindent, it does \let\nonarrowing = t.

Actually, here is a first bug: \nonarrowing stays set for embedded
environments; so an @example inside @format is not narrowed.
Perhaps \nonfillstart should reset \nonarrowing.

But the situation is complicated by @cartouche, which
        "defines \nonarrowing to inhibit narrowing at next level down."
My knowledge of English betrays me here.  "next level down" means
"the next level", or "all levels below?"

If it means "all levels below", then we should set it to "p" (stays for
permanent) and then \nonfillstart (and \quotation) would do:

  \ifx\nonarrowing\relax
    \advance\leftskip by ...
  \else
    \if t\nonarowing
      \let\nonarrowing = \relax
    \fi
  \fi

And now to the original problem: \setupverbatim called \nonfillstart
and then did
                  \advance\leftskip by -\defbodyindent
to restore the original margin.  This was obviously wrong, it should
have set \nonarrowing.

Attached please find texinfo-20050630-setupverbatim.patch, which fixes
the problem described by Karl.  I committed this patch.
Then there is a test file.

And the third attachment, texinfo-20050630-nonarrowing.patch, re-defined
\nonarrowing as explained above.
Not committed yet (and not tested either); I don't know whether I guessed
correctly what should @cartouche do.

2005-06-30  Stepan Kasal  <[EMAIL PROTECTED]>

        * doc/texinfo.tex (\setupverbatim): Use \nonarrowing to declare that
        we don't want to narrow the environment.

Index: doc/texinfo.tex
===================================================================
RCS file: /cvsroot/texinfo/texinfo/doc/texinfo.tex,v
retrieving revision 1.190
diff -u -r1.190 texinfo.tex
--- doc/texinfo.tex     20 Jun 2005 12:42:37 -0000      1.190
+++ doc/texinfo.tex     30 Jun 2005 15:18:45 -0000
@@ -5207,8 +5207,8 @@
   }
 \endgroup
 \def\setupverbatim{%
+  \let\nonarrowing = t%
   \nonfillstart
-  \advance\leftskip by -\defbodyindent
   % Easiest (and conventionally used) font for verbatim
   \tt
   \def\par{\leavevmode\egroup\box0\endgraf}%

Attachment: smallverbatim.texi
Description: TeXInfo document

2005-06-30  Stepan Kasal  <[EMAIL PROTECTED]>

        * doc/texinfo.tex (\nonarrowing): Now a tri-state flag.
        (\nonfillstart, \quotation): Respect it.

Index: doc/texinfo.tex
===================================================================
RCS file: /cvsroot/texinfo/texinfo/doc/texinfo.tex,v
retrieving revision 1.191
diff -u -r1.191 texinfo.tex
--- doc/texinfo.tex     30 Jun 2005 15:19:17 -0000      1.191
+++ doc/texinfo.tex     30 Jun 2005 15:47:41 -0000
@@ -4935,6 +4935,9 @@
 \let\afterenvbreak = \aboveenvbreak
 
 % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
+% If it's set to "p", it'll remain set for all embedded environments,
+% if set to "t", the next environment will clear it, so that its
+% subenvironments are again allowed to do their narrowing.
 \let\nonarrowing=\relax
 
 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
@@ -4971,7 +4974,7 @@
                                % each corner char, and rule thickness
   \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
   % Flag to tell @lisp, etc., not to narrow margin.
-  \let\nonarrowing=\comment
+  \let\nonarrowing=p%
   \vbox\bgroup
       \baselineskip=0pt\parskip=0pt\lineskip=0pt
       \carttop
@@ -5011,11 +5014,13 @@
   \parskip = 0pt
   \parindent = 0pt
   \emergencystretch = 0pt % don't try to avoid overfull boxes
-  % @cartouche defines \nonarrowing to inhibit narrowing
-  % at next level down.
   \ifx\nonarrowing\relax
     \advance \leftskip by \lispnarrowing
     \exdentamount=\lispnarrowing
+  \else
+    \if t\nonarowing
+      \let\nonarrowing = \relax
+    \fi
   \fi
   \let\exdent=\nofillexdent
 }
@@ -5115,7 +5120,7 @@
     \advance\leftskip by \lispnarrowing
     \advance\rightskip by \lispnarrowing
     \exdentamount = \lispnarrowing
-    \let\nonarrowing = \relax
+    % \nonarrowing cannot be t, so there is no need to reset it.
   \fi
   \parsearg\quotationlabel
 }
_______________________________________________
Texinfo home page: http://www.gnu.org/software/texinfo/
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-texinfo

Reply via email to