[comp.text.tex] Indenting first paragraph

tomliew@aix01.aix.rpi.edu (Thomas Liew) (05/17/91)

Sometime ago there was some discussion on whether to indent the 
first paragraph immediately following a section title or header.
I don't remember if anyone illustrated how to do the indentation.
I had no luck with /indent.  Can some one throw some light on 
how it can be done.  Well I have no choice as I need to indent 
that first paragraph to conform to a particular journal style.
I am using LaTeX to write the paper. 

anita@brahms.udel.edu (Anita Marie Hoover) (05/17/91)

In article <_x-hqdm@rpi.edu> tomliew@aix01.aix.rpi.edu (Thomas Liew) writes:
=>Sometime ago there was some discussion on whether to indent the 
=>first paragraph immediately following a section title or header.
=>I don't remember if anyone illustrated how to do the indentation.
=>I had no luck with /indent.  Can some one throw some light on 
=>how it can be done.  Well I have no choice as I need to indent 
=>that first paragraph to conform to a particular journal style.
=>I am using LaTeX to write the paper. 

The definition of all sectioning commands give negative values for
before the skip (except \paragraph and \subparagraph).  According to
the definition of \@startsection which all these macros are defined,
negative values mean, don't indent the first paragraph after the section
command.

Here is the definition from rep12.sty for sections:


\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus
 -.2ex}{2.3ex plus .2ex}{\Large\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus
 -.2ex}{1.5ex plus .2ex}{\large\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
 -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
\def\paragraph{\@startsection
 {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subparagraph{\@startsection
 {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus
 .2ex}{-1em}{\normalsize\bf}}

Here is the explanation of the \@startsection from latex.tex:

%     *****************************************
%     *              SECTIONING               *  
%     *****************************************
%
%
% \@startsection {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE}
%            optional * [ALTHEADING]{HEADING}
%    Generic command to start a section.
%    NAME       : e.g., 'subsection'
%    LEVEL      : a number, denoting depth of section -- e.g., chapter=1,
%                 section = 2, etc.
%    INDENT     : Indentation of heading from left margin
%    BEFORESKIP : Absolute value = skip to leave above the heading.
%                 If negative, then paragraph indent of text following
%                 heading is suppressed.
%    AFTERSKIP  : if positive, then skip to leave below heading, else
%                 negative of skip to leave to right of run-in heading.
%    STYLE      : commands to set style

So if you put the following in the preamble of your document the
paragraph after the sections with be indented.

\makeatletter
\def\section{\@startsection {section}{1}{\z@}{3.5ex plus 1ex minus
 .2ex}{2.3ex plus .2ex}{\Large\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{3.25ex plus 1ex minus
 .2ex}{1.5ex plus .2ex}{\large\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{3.25ex plus
 1ex minus .2ex}{1.5ex plus .2ex}{\normalsize\bf}}
\makeatother

By the way, \z@ is just a macro that expands to 0pt.

woo@ornl.gov (John W. Wooten) (05/17/91)

In article <_x-hqdm@rpi.edu> tomliew@aix01.aix.rpi.edu (Thomas Liew) writes:
> Sometime ago there was some discussion on whether to indent the 
> first paragraph immediately following a section title or header.
> I don't remember if anyone illustrated how to do the indentation.
> I had no luck with /indent.  Can some one throw some light on 
> how it can be done.  Well I have no choice as I need to indent 
> that first paragraph to conform to a particular journal style.
> I am using LaTeX to write the paper. 

My reply may be naive, but I always get an indented paragraph by the following  
set of commands:

\section{Section Title}
\noindent

Textual material that I want indented....

I have no real idea why this works, but it does.

eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (05/17/91)

woo@ornl.gov (John W. Wooten) writes:

>In article <_x-hqdm@rpi.edu> tomliew@aix01.aix.rpi.edu (Thomas Liew) writes:
>> Sometime ago there was some discussion on whether to indent the 
>> first paragraph immediately following a section title or header.

>My reply may be naive, but I always get an indented paragraph by the following  
>set of commands:

>\section{Section Title}
>\noindent

>Textual material that I want indented....

>I have no real idea why this works, but it does.

Very cute. \section sets up conditions so that the first
following paragraph will not be indented, and all after that
will be. Now giving \noindent followed by an empty line (which is
a \par, remember?) gives an empty paragraph (nothing to be seen),
and you next material will be indented.

Unfortunately this is all quite deplorable. The idea behind
documentstyles is that they implement a layout. If you want
a different layout you should not fiddle around but just write a
new document style, or if your change is just small, add an option.

Here is the definition of the primitive command behind sectioning.

% \@startsection {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE} 
%            optional * [ALTHEADING]{HEADING}
%    Generic command to start a section.  
%    NAME       : e.g., 'subsection'
%    LEVEL      : a number, denoting depth of section -- e.g., chapter=1,
%                 section = 2, etc.
%    INDENT     : Indentation of heading from left margin
%    BEFORESKIP : Absolute value = skip to leave above the heading.  
     ^^^^^^^^^
%                 If negative, then paragraph indent of text following 
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
%                 heading is suppressed.
                          ^^^^^^^^^^^^^
%    AFTERSKIP  : if positive, then skip to leave below heading, else 
%                 negative of skip to leave to right of run-in heading.
%    STYLE      : commands to set style

and here is the \section command in the 10pt style

\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
 -.2ex}{2.3ex plus .2ex}{\Large\bf}}

If you change that into
\def\section{\@startsection {section}{1}{\z@}{+3.5ex plus +1ex minus 
 +.2ex}{2.3ex plus .2ex}{\Large\bf}}

the first paragraph will be indented.

Now take this definition and put it in an option file
indpar.sty and give \documentstyle[indpar]{article},
or maybe make a whole new style file.

Victor "always out to edify" Eijkhout.

(maybe I should save this msg and repost it whenever this
topic comes up. Hm. maybe I can even write a Un*x shell script
that will just go ahead and post it every two days :-)

woo@ornl.gov (John W. Wooten) (05/18/91)

In article <1991May17.153059.24466@csrd.uiuc.edu> eijkhout@s41.csrd.uiuc.edu  
(Victor Eijkhout) writes:
...stuff deleted
> Very cute. \section sets up conditions so that the first
> following paragraph will not be indented, and all after that
> will be. Now giving \noindent followed by an empty line (which is
> a \par, remember?) gives an empty paragraph (nothing to be seen),
> and you next material will be indented.
> 
> Unfortunately this is all quite deplorable. The idea behind
> documentstyles is that they implement a layout. If you want
> a different layout you should not fiddle around but just write a
> new document style, or if your change is just small, add an option.
> 
> Here is the definition of the primitive command behind sectioning.
> 
> % \@startsection {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE} 
> %            optional * [ALTHEADING]{HEADING}
> %    Generic command to start a section.  
> %    NAME       : e.g., 'subsection'
> %    LEVEL      : a number, denoting depth of section -- e.g., chapter=1,
> %                 section = 2, etc.
> %    INDENT     : Indentation of heading from left margin
> %    BEFORESKIP : Absolute value = skip to leave above the heading.  
>      ^^^^^^^^^
> %                 If negative, then paragraph indent of text following 
>                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> %                 heading is suppressed.
>                           ^^^^^^^^^^^^^
> %    AFTERSKIP  : if positive, then skip to leave below heading, else 
> %                 negative of skip to leave to right of run-in heading.
> %    STYLE      : commands to set style
> 
> and here is the \section command in the 10pt style
> 
> \def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
>  -.2ex}{2.3ex plus .2ex}{\Large\bf}}
> 
> If you change that into
> \def\section{\@startsection {section}{1}{\z@}{+3.5ex plus +1ex minus 
>  +.2ex}{2.3ex plus .2ex}{\Large\bf}}
> 
> the first paragraph will be indented.
> 
> Now take this definition and put it in an option file
> indpar.sty and give \documentstyle[indpar]{article},
> or maybe make a whole new style file.
> 
> Victor "always out to edify" Eijkhout.
> 
> (maybe I should save this msg and repost it whenever this
> topic comes up. Hm. maybe I can even write a Un*x shell script
> that will just go ahead and post it every two days :-)

I don't entirely agree with you statement about making a new style.  I tend to  
try to always use the standard distributed styles with minor over-rides in the  
document itself.  Then I can send it to someone else and expect it to work.   
When I've tried new styles, etc.  the problem of configuration managment comes  
up.  I don't always remember to send the new styles or remember to reinstall  
them for awhile after a new system installation.  So my comment is, be careful  
about new styles and mods to the standard stuff.  It can bite you later :-)