%
% some of the old Tbase paragraphing macros (built on Plain TeX)
%
% These macros demonstrate common uses for the
% \hangindent, \hangafter, \indent, \noindent, \everypar,
% \lastbox, and \the commands.
%

\catcode`\@=11\relax            % make @ a letter for use in macro names

%
% N.B. These macros do not set a ``paragraphing mode,'' as
% they used to in Tbase; they apply only to the immediately
% following paragraph.
%
% The right way to use one of the macros is, e.g.,
%
% \ivp This is an inverted paragraph... 
% and so on, and so on...
%
\def\ivp {% inverted paragraph, all but 1st line indented
  \hangindent \parindent
  \hangafter \@ne
  \noindent}

\def\ip {% indented paragraph, all lines indented
  \hangindent \parindent
  \hangafter \@ne
  \indent}

\def\ftp #1{% flush-tagged paragraph, like \ip but with tag on left margin
  \hangindent \parindent
  \hangafter \@ne
  \noindent \hbox to\parindent{#1\hfil}\ignorespaces}

\def\atp #1{% adjoint-tagged par, like \ftp but tag is next to first line
  \hangindent \parindent
  \hangafter \@ne
  \indent \llap{#1\enspace}\ignorespaces}

\def\bpar {% bullet-tagged paragraph
  \ftp{$\bullet$}}


%
% vest paragraphs:
%   After an interruption in the running text (such as a section
% title or in-line illustration), it is customary not to indent
% the first line of the next paragraph.  The macro \vp arranges
% for this to be the case by making sure that \unindent gets
% called as soon as the paragraph starts.  \unindent simply
% removes the \indent box that TeX automatically puts at the
% start of every paragraph (except those which start with
% \noindent).
%
\def\unindent {%
  \setbox0=\lastbox}            % get the indent box and discard it

\def\vp {%
  \everypar{\unindent\everypar{}}}


%
% the \heading macro puts out a bold-faced unindented heading,
% and then calls \vp to insure that the next paragraph does not
% start with an indentation.
% No break is allowed between the heading and the paragraph.
%
\def\heading #1{%
  \vskip 1ex
  {\bf\noindent #1\par}
  \nobreak
  \vskip.5ex
  \vp}


%
% These next two macros are a convenient way of turning
% indentation off and then on again.  The macro \fp
% sets \parindent to 0, but not before defining the macro \pp so
% that it restores \parindent to what it was.  The \edef command
% in conjunction with the \the command actually put the
% value of \parindent into the text of the \pp command.
% Do \fp\show\pp to see what this means.
%
\def\fp {\edef\pp{\parindent=\the\parindent}\parindent=\z@}
\let\pp=\relax


% make @ back into a non-letter
\catcode`\@=12\relax