summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/misc/paragraphs.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/plain/contrib/misc/paragraphs.tex
Initial commit
Diffstat (limited to 'macros/plain/contrib/misc/paragraphs.tex')
-rw-r--r--macros/plain/contrib/misc/paragraphs.tex91
1 files changed, 91 insertions, 0 deletions
diff --git a/macros/plain/contrib/misc/paragraphs.tex b/macros/plain/contrib/misc/paragraphs.tex
new file mode 100644
index 0000000000..c618c54cfb
--- /dev/null
+++ b/macros/plain/contrib/misc/paragraphs.tex
@@ -0,0 +1,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