summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/misc/paragraphs.tex
blob: c618c54cfb2b77bedf7e5f522b68b42140e1f2b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
%
% 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