bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Paragraph indentation suppression


From: Simon Law
Subject: Paragraph indentation suppression
Date: Mon, 7 Apr 2003 16:03:47 -0400
User-agent: Mutt/1.3.28i

Here is a first attempt at getting paragraph indentation correct for the
first paragraph.  Notice how it is highly dependent on the next
paragraph actually having @par executed.  I haven't though too hard on
how we can force it to work in all cases; but perhaps someone has ideas
on how to do this.

        The side-effect of this method is that if someone forgets to put
@par or a blank line between the section heading and the paragraph, then
the _second_ paragraph is indented instead.  Or, if he puts two blank
lines in between, the first paragraph gets indented anyway.

Simon

--- texinfo.tex 2002-12-28 15:56:54.000000000 -0500
+++ /home/sfllaw/gnupress/texpress/texinfo.tex  2003-04-01 20:08:26.000000000 
-0500
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2002-12-26.16}
+\def\texinfoversion{2003-04-01.20}
 %
 % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
@@ -818,6 +818,45 @@
   \parindent = \defaultparindent
 }
 
+% We redefine \par here such that it does not indent the first paragraph
+% of a section.  This is controlled by @firstparagraphindent (yes|no) and
+% it defaults to "yes"
+%
+\newdimen\currentparindent
+\currentparindent = \parindent
+\let\parorig=\par
+%
+\def\yesword{yes}
+\def\noword{no}
+\def\firstparagraphindent{\parsearg\dofirstparagraphindent}
+\def\dofirstparagraphindent#1{%
+  \def\temp{#1}%
+  \ifx\temp\yesword
+    \def\par{\parorig}%
+  \else\ifx\temp\noword
+    \def\par{%
+      \iffirstparagraph
+        \currentparindent = \parindent
+        \parindent = 0pt
+        \firstparagraphfalse
+        \secondparagraphtrue
+      \else
+        \ifsecondparagraph
+          \parindent = \currentparindent
+          \secondparagraphfalse
+        \fi
+      \fi
+      \parorig
+    }%
+  \fi\fi
+}
+%
+\newif\iffirstparagraph
+\newif\ifsecondparagraph
+\firstparagraphtrue
+\secondparagraphfalse
+%
+
 % @exampleindent NCHARS
 % We'll use ems for NCHARS like @paragraphindent.
 % It seems @exampleindent asis isn't necessary, but
@@ -2001,10 +2040,11 @@
 \advance \itemmax by -\itemmargin %
 \advance \leftskip by \itemindent %
 \exdentamount=\itemindent
+\secondparagraphfalse%
 \parindent = 0pt %
 \parskip = \smallskipamount %
 \ifdim \parskip=0pt \parskip=2pt \fi%
-\def#2{\endgraf\afterenvbreak\endgroup}%
+\def#2{\secondparagraphtrue\endgraf\afterenvbreak\endgroup}%
 \def\itemcontents{#1}%
 \let\item=\itemizeitem}
 
@@ -3513,6 +3553,7 @@
     \numberedsubsubseczzz{#2}
   \fi
 \fi
+\firstparagraphtrue
 }
 
 % like \numhead, but chooses appendix heading levels
@@ -3532,6 +3573,7 @@
     \appendixsubsubseczzz{#2}
   \fi
 \fi
+\firstparagraphtrue
 }
 
 % like \numhead, but chooses numberless heading levels
@@ -3551,6 +3593,7 @@
     \unnumberedsubsubseczzz{#2}
   \fi
 \fi
+\firstparagraphtrue
 }
 
 % @chapter, @appendix, @unnumbered.
@@ -6504,7 +6547,9 @@
 @textfonts
 @rm
 
-
address@hidden First paragraph should have @noindent
address@hidden
address@hidden
 @c Local variables:
 @c eval: (add-hook 'write-file-hooks 'time-stamp)
 @c page-delimiter: "^\\\\message"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]