[comp.text.tex] My question yesterday

barr@TRIPLES.MATH.MCGILL.CA (06/08/91)

Since I got no helpful responses to my question, I finally did it
myself.  If you didn't see it, the problem was that in the latex
twocolumn style, the marks aren't properly set so that \firstmark is the
first mark set in the SECOND column.  It happens this way, because latex
has each column a page, instead of using \vsplit.  Frank Mittelbach's
multicol does it the other way, but it moves stuff to the next page
after the marks are set so that, while \firstmark is correct, \botmark
is usually wrong.  I played with both, but in the end I was able to get
the latex version working, but not Mittelbach's.  This is a shame, for
the latter is much more flexible.

I got one reply, suggesting I use the fancyheadings style.  Although
that style is quite nice (and I am using it, in fact) the response
failed to address the main problem, that being that the marks were not
being properly set.  Or more precisely, there was no way of getting the
previous page (that is, the first column)'s marks.  So I finally
rummaged through the latex source to find out how the columns and found
the CS \if@firstcolumn.  Then I searched where that was being tested and
found a CS \@outputdblcolumn and added a line to as shown below.   For
the ten page list I had, this seems to work perfectly.  What it does is
a global edef of a new CS \firstcolmark to be the \firstmark, but only
in the first column.  By doing an \edef, it is made equal to
\firstmark's value at the time, not later.

Michael Barr

\documentstyle[12pt,twoside,fancyhed]{article}
 \oddsidemargin .2in \evensidemargin -.2in
\textwidth 6.5in
\headheight 15pt \headsep 20pt
\textheight 8.5in

\makeatletter

\let\firstcolmark=\relax

\def\@outputdblcol{\if@firstcolumn
\xdef\firstcolmark{\firstmark}%%%%%%%%%% Added line %%%%%%%%%%
\global\@firstcolumnfalse
    \global\setbox\@leftcolumn\box\@outputbox
  \else \global\@firstcolumntrue
    \setbox\@outputbox\vbox{\hbox to\textwidth{\hbox to\columnwidth
      {\box\@leftcolumn \hss}\hfil \vrule width\columnseprule\hfil
       \hbox to\columnwidth{\box\@outputbox \hss}}}\@combinedblfloats
       \@outputpage \begingroup \@dblfloatplacement \@startdblcolumn
       \@whilesw\if@fcolmade \fi{\@outputpage\@startdblcolumn}\endgroup
    \fi}
\pagestyle{fancy}
\thispagestyle{empty}
\lhead[{\sl \firstcolmark}]{}
\rhead[]{\sl \botmark}
\chead{\rm\thepage}
\lfoot{}\cfoot{}\rfoot{}

\begin{document}
\twocolumn
[\LARGE
\begin{center}
LIST OF PARTICIPANTS
\end{center}
\vskip20pt
]

\catcode`\^^M=13
\parindent=0pt
\let^^M=\par

\def\addressbox#1[#2]%
{\vskip 10pt plus 1fil
\parbox{\hsize}{#1}\mark{#2}}

and then there is a list of names and addresses in the form

\addressbox{
Prof. Michael Barr
Dept of Mathematics
McGill University
Montreal, Quebec
CANADA H3A 2K6
barr@triples.math.mcgill.ca
}[Barr]


Michael Barr