aboutsummaryrefslogtreecommitdiff
path: root/fmt/multicol.h
diff options
context:
space:
mode:
Diffstat (limited to 'fmt/multicol.h')
-rw-r--r--fmt/multicol.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/fmt/multicol.h b/fmt/multicol.h
new file mode 100644
index 0000000..1c45047
--- /dev/null
+++ b/fmt/multicol.h
@@ -0,0 +1,35 @@
+% Requires \newdimen\gap, \newcount\cols, adjusts to \newdimen\width
+
+\newdimen\fullhsize\fullhsize=\width \advance\fullhsize by -2in%1 in margin
+\def\fullline{\hbox to \fullhsize}%%modify \makeheadline\makefootline
+\def\widthline{\hbox to \width}
+\def\fullcenter#1{\fullline{\hfil #1\hfil}}
+\def\makeheadline{\vbox to 0pt{\vskip -22.5pt \fullline{%
+ \vbox to 8.5pt{}\the\headline}\vss}\nointerlineskip}
+\def\makefootline{\baselineskip24pt\lineskiplimit0pt \fullline{\the%
+ \footline}}
+\newcount\defs\defs=\cols\advance\defs by -1
+\hsize=\fullhsize \divide\hsize by \cols\advance\hsize by -\gap
+
+\newcount\col
+\let\isnum\ifnum
+\def\newb@x{\alloc@4\box\chardef\insc@unt}
+
+\loop\expandafter\newb@x\csname col\number\col\endcsname\advance\col
+ by 1\isnum\col<\defs\repeat
+\col=0
+\output={%
+\ifnum\col<\defs
+\expandafter\global\expandafter\setbox\csname col\number\col\endcsname\fullbox
+\global\advance\col by 1%
+\else \global\col=0\shipout\vbox{\makeheadline
+ \fullline{%
+ \loop\isnum\col<\defs\expandafter\box\csname col\number\col\endcsname\hfil
+ \advance\col by 1\repeat\fullbox}
+ \makefootline}
+\fi
+\ifnum\outputpenalty>-20000 \else\dosupereject\fi
+}
+\def\fullbox{\hbox{{\expandafter}\expandafter\ifx\csname color\endcsname\relax%is color defined?
+\else\colorbox{colo}{\columnbox}\fi}}
+\def\columnbox{\leftline{\vbox to \vsize{\vfil}\pagebody}}