Received: by nummer-3.proteosys id <01C19443.ABECDD3C@nummer-3.proteosys>; Thu, 3 Jan 2002 11:44:51 +0100 Return-Path: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C19443.ABECDD3C" x-vm-v5-data: ([nil nil nil nil nil nil nil nil nil][nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil]) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message Subject: LaTeX twocolumn mode and \firstmark: a problem and its solution Date: Sat, 23 May 1992 03:40:56 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Nelson H. F. Beebe" Sender: "Mailing list for the LaTeX3 project" To: "Rainer M. Schoepf" Reply-To: "Mailing list for the LaTeX3 project" Status: R X-Status: X-Keywords: X-UID: 720 This is a multi-part message in MIME format. ------_=_NextPart_001_01C19443.ABECDD3C Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I've spent the day trying to convert a glossary file from one-column mode to two-column mode. I want to have running headers that show the first and last word on each page, like a dictionary does. In one-column mode, I can easily do this. In two-column mode, \firstmark always is set to the first word in the {\em second} column, rather than the first, and \topmark is set to the last word in the {\em first} column. After many hours of failure, while composing a letter to this list about the problem, the exercise of semiliterate programming provided the solution. Because that solution needs a (simple, and useful) change to LaTeX's output routine, it seems worthwhile to request that LaTeX 3.0 provide the facility I need, unless the problem has already been seen and solved in another way. The experiments suggested that \box255 is created twice per page, but the LaTeX output routine only invokes the page header and footer macros on the second column. This in turn suggested that a trap in the LaTeX output routine might be able to save \firstmark and \topmark in the first column. That was the vital clue. A study of the output routine code in latex.tex revealed that \@outputdblcol was the place where the trap was needed, and when I installed it, my problem was solved. A more general solution would be to have \@outputdblcol call a user-defined hook; for this example, I've just written the hook code inline. Leslie Lamport has previously remarked that the LaTeX output routine is an exceedingly delicate piece of code, so I'd like to ask this list if they see a flaw in my solution. The perturbation on the output routine seems quite innocuous, but perhaps I'm overlooking something that sharper eyes will spot. To illustate, the following file with an extract of the UNIX spelling dictionary is provided, together with a preamble of necessary macros. % -*-latex-*- % Document name: /usr/local/plot79/tex/foo3.ltx % Creator: Nelson H. F. Beebe [beebe@solitude.math.utah.edu] % Creation Date: Fri May 22 19:23:19 1992 \documentstyle[twocolumn]{article} \makeatletter \let\firstcolumnfirstmark=3D\relax %% Modify function from LaTeX output routine to preserve %% \firstmark in first column in \firstcolumnfirstmark \def\@outputdblcol{\if@firstcolumn \global\@firstcolumnfalse \global\setbox\@leftcolumn\box\@outputbox \xdef\firstcolumnfirstmark{\firstmark}% [22-May-1992] NEW CODE HERE \message{[FIRST =3D \firstmark; TOP =3D \topmark; BOT =3D = \botmark]}% \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} \newcommand{\wordentry}[1]% {% \subsection*{#1}% \ifx\firstcolumnfirstmark\relax% Capture and save very first mark; \xdef\firstcolumnfirstmark{#1}% TeX doesn't set it on first page \fi \mark{#1}% \index{#1}% } \renewcommand{\@evenhead}{% \hss \underline{\makebox[\textwidth]{{\large\firstcolumnfirstmark} \hfill = {\large \botmark}}}% \hss } \renewcommand{\@oddhead}{% \hss = \underline{\makebox[\textwidth]{{\large\firstcolumnfirstmark}\hfill{\larg= e\b otmark}}}% \hss } \renewcommand{\@evenfoot}{\hfill \rm \thepage \hfill} \renewcommand{\@oddfoot}{\hfill \rm \thepage \hfill} \makeatother \begin{document} Title page goes here \cleardoublepage \wordentry{AAA} \wordentry{AAAS} \wordentry{Aarhus} \wordentry{Aaron} \wordentry{AAU} \wordentry{ABA} \wordentry{Ababa} \wordentry{aback} \wordentry{abacus} \wordentry{abalone} \wordentry{abandon} \wordentry{abase} \wordentry{abash} \wordentry{abate} \wordentry{abater} \wordentry{abbas} \wordentry{abbe} \wordentry{abbey} \wordentry{abbot} \wordentry{Abbott} \wordentry{abbreviate} \wordentry{abc} \wordentry{abdicate} \wordentry{abdomen} \wordentry{abdominal} \wordentry{abduct} \wordentry{Abe} \wordentry{abed} \wordentry{Abel} \wordentry{Abelian} \wordentry{Abelson} \wordentry{Aberdeen} \wordentry{Abernathy} \wordentry{aberrant} \wordentry{aberrate} \wordentry{abet} \wordentry{abetted} \wordentry{abetting} \wordentry{abeyance} \wordentry{abeyant} \wordentry{abhorred} \wordentry{abhorrent} \wordentry{abide} \wordentry{Abidjan} \wordentry{Abigail} \wordentry{abject} \wordentry{ablate} \wordentry{ablaze} \wordentry{able} \wordentry{ablution} \wordentry{Abner} \wordentry{abnormal} \wordentry{Abo} \wordentry{aboard} \wordentry{abode} \wordentry{abolish} \wordentry{abolition} \wordentry{abominable} \wordentry{abominate} \wordentry{aboriginal} \wordentry{aborigine} \wordentry{aborning} \wordentry{abort} \wordentry{abound} \wordentry{about} \wordentry{above} \wordentry{aboveboard} \wordentry{aboveground} \wordentry{abovementioned} \wordentry{abrade} \wordentry{Abraham} \wordentry{Abram} \wordentry{Abramson} \wordentry{abrasion} \wordentry{abrasive} \wordentry{abreact} \wordentry{abreast} \wordentry{abridge} \wordentry{abridgment} \wordentry{abroad} \wordentry{abrogate} \wordentry{abrupt} \wordentry{abscess} \wordentry{abscissa} \wordentry{abscissae} \wordentry{absence} \wordentry{absent} \wordentry{absentee} \wordentry{absenteeism} \wordentry{absentia} \wordentry{absentminded} \wordentry{absinthe} \wordentry{absolute} \wordentry{absolution} \wordentry{absolve} \wordentry{absorb} \wordentry{absorbent} \wordentry{absorption} \wordentry{absorptive} \wordentry{abstain} \wordentry{abstention} \wordentry{abstinent} \wordentry{abstract} \wordentry{abstracter} \wordentry{abstractor} \wordentry{abstruse} \wordentry{absurd} \wordentry{abuilding} \wordentry{abundant} \wordentry{abusable} \wordentry{abuse} \wordentry{abusive} \wordentry{abut} \wordentry{abutted} \wordentry{abutting} \wordentry{abysmal} \wordentry{abyss} \wordentry{Abyssinia} \wordentry{AC} \wordentry{academe} \wordentry{academia} \wordentry{academic} \wordentry{academician} \wordentry{academy} \wordentry{Acadia} \wordentry{acanthus} \wordentry{Acapulco} \wordentry{accede} \wordentry{accelerate} \wordentry{accelerometer} \wordentry{accent} \wordentry{accentual} \wordentry{accentuate} \wordentry{accept} \wordentry{acceptant} \wordentry{acceptor} \wordentry{access} \wordentry{accessible} \wordentry{accession} \wordentry{accessory} \wordentry{accident} \wordentry{accidental} \wordentry{accipiter} \wordentry{acclaim} \wordentry{acclamation} \wordentry{acclimate} \wordentry{accolade} \wordentry{accommodate} \wordentry{accompaniment} \wordentry{accompanist} \wordentry{accompany} \wordentry{accomplice} \wordentry{accomplish} \wordentry{accord} \wordentry{accordant} \wordentry{accordion} \wordentry{accost} \wordentry{account} \wordentry{accountant} \wordentry{Accra} \wordentry{accredit} \wordentry{accreditate} \wordentry{accreditation} \wordentry{accretion} \wordentry{accrual} \wordentry{accrue} \wordentry{acculturate} \end{document} =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Nelson H.F. Beebe Center for Scientific Computing Department of Mathematics 220 South Physics Building University of Utah Salt Lake City, UT 84112 USA Tel: (801) 581-5254 FAX: (801) 581-4148 Internet: beebe@math.utah.edu =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ------_=_NextPart_001_01C19443.ABECDD3C Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable LaTeX twocolumn mode and \firstmark: a problem and its = solution

I've spent the day trying to convert a glossary file = from one-column
mode to two-column mode.  I want to have running = headers that show the
first and last word on each page, like a dictionary = does.

In one-column mode, I can easily do this.

In two-column mode, \firstmark always is set to the = first word in the
{\em second} column, rather than the first, and = \topmark is set to the
last word in the {\em first} column.

After many hours of failure, while composing a letter = to this list
about the problem, the exercise of semiliterate = programming provided
the solution.  Because that solution needs a = (simple, and useful)
change to LaTeX's output routine, it seems worthwhile = to request that
LaTeX 3.0 provide the facility I need, unless the = problem has already
been seen and solved in another way.

The experiments suggested that \box255 is created = twice per page, but
the LaTeX output routine only invokes the page header = and footer
macros on the second column.  This in turn = suggested that a trap in
the LaTeX output routine might be able to save = \firstmark and \topmark
in the first column.

That was the vital clue.  A study of the output = routine code in
latex.tex revealed that \@outputdblcol was the place = where the trap
was needed, and when I installed it, my problem was = solved.

A more general solution would be to have = \@outputdblcol call a
user-defined hook; for this example, I've just = written the hook code
inline.

Leslie Lamport has previously remarked that the LaTeX = output routine
is an exceedingly delicate piece of code, so I'd like = to ask this list
if they see a flaw in my solution.  The = perturbation on the output
routine seems quite innocuous, but perhaps I'm = overlooking something
that sharper eyes will spot.

To illustate, the following file with an extract of = the UNIX spelling
dictionary is provided, together with a preamble of = necessary macros.

% -*-latex-*-
% Document name: = /usr/local/plot79/tex/foo3.ltx
% Creator: Nelson H. F. Beebe = [beebe@solitude.math.utah.edu]
% Creation Date: Fri May 22 19:23:19 1992
\documentstyle[twocolumn]{article}

\makeatletter

\let\firstcolumnfirstmark=3D\relax

%% Modify function from LaTeX output routine to = preserve
%% \firstmark in first column in = \firstcolumnfirstmark

\def\@outputdblcol{\if@firstcolumn = \global\@firstcolumnfalse
    = \global\setbox\@leftcolumn\box\@outputbox

    = \xdef\firstcolumnfirstmark{\firstmark}% [22-May-1992] NEW CODE = HERE
    \message{[FIRST =3D \firstmark; = TOP =3D \topmark; BOT =3D \botmark]}%

  \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}

\newcommand{\wordentry}[1]%
{%
    \subsection*{#1}%
    \ifx\firstcolumnfirstmark\relax% = Capture and save very first mark;
      = \xdef\firstcolumnfirstmark{#1}% TeX doesn't set it on first page
    \fi
    \mark{#1}%
    \index{#1}%
}

\renewcommand{\@evenhead}{%
    \hss
    = \underline{\makebox[\textwidth]{{\large\firstcolumnfirstmark} \hfill = {\large
   \botmark}}}%
    \hss
}

\renewcommand{\@oddhead}{%
    \hss
    = \underline{\makebox[\textwidth]{{\large\firstcolumnfirstmark}\hfill{\larg= e\b
   otmark}}}%
    \hss
}

\renewcommand{\@evenfoot}{\hfill \rm \thepage = \hfill}

\renewcommand{\@oddfoot}{\hfill \rm \thepage = \hfill}

\makeatother

\begin{document}

Title page goes here

\cleardoublepage

\wordentry{AAA}
\wordentry{AAAS}
\wordentry{Aarhus}
\wordentry{Aaron}
\wordentry{AAU}
\wordentry{ABA}
\wordentry{Ababa}
\wordentry{aback}
\wordentry{abacus}
\wordentry{abalone}
\wordentry{abandon}
\wordentry{abase}
\wordentry{abash}
\wordentry{abate}
\wordentry{abater}
\wordentry{abbas}
\wordentry{abbe}
\wordentry{abbey}
\wordentry{abbot}
\wordentry{Abbott}
\wordentry{abbreviate}
\wordentry{abc}
\wordentry{abdicate}
\wordentry{abdomen}
\wordentry{abdominal}
\wordentry{abduct}
\wordentry{Abe}
\wordentry{abed}
\wordentry{Abel}
\wordentry{Abelian}
\wordentry{Abelson}
\wordentry{Aberdeen}
\wordentry{Abernathy}
\wordentry{aberrant}
\wordentry{aberrate}
\wordentry{abet}
\wordentry{abetted}
\wordentry{abetting}
\wordentry{abeyance}
\wordentry{abeyant}
\wordentry{abhorred}
\wordentry{abhorrent}
\wordentry{abide}
\wordentry{Abidjan}
\wordentry{Abigail}
\wordentry{abject}
\wordentry{ablate}
\wordentry{ablaze}
\wordentry{able}
\wordentry{ablution}
\wordentry{Abner}
\wordentry{abnormal}
\wordentry{Abo}
\wordentry{aboard}
\wordentry{abode}
\wordentry{abolish}
\wordentry{abolition}
\wordentry{abominable}
\wordentry{abominate}
\wordentry{aboriginal}
\wordentry{aborigine}
\wordentry{aborning}
\wordentry{abort}
\wordentry{abound}
\wordentry{about}
\wordentry{above}
\wordentry{aboveboard}
\wordentry{aboveground}
\wordentry{abovementioned}
\wordentry{abrade}
\wordentry{Abraham}
\wordentry{Abram}
\wordentry{Abramson}
\wordentry{abrasion}
\wordentry{abrasive}
\wordentry{abreact}
\wordentry{abreast}
\wordentry{abridge}
\wordentry{abridgment}
\wordentry{abroad}
\wordentry{abrogate}
\wordentry{abrupt}
\wordentry{abscess}
\wordentry{abscissa}
\wordentry{abscissae}
\wordentry{absence}
\wordentry{absent}
\wordentry{absentee}
\wordentry{absenteeism}
\wordentry{absentia}
\wordentry{absentminded}
\wordentry{absinthe}
\wordentry{absolute}
\wordentry{absolution}
\wordentry{absolve}
\wordentry{absorb}
\wordentry{absorbent}
\wordentry{absorption}
\wordentry{absorptive}
\wordentry{abstain}
\wordentry{abstention}
\wordentry{abstinent}
\wordentry{abstract}
\wordentry{abstracter}
\wordentry{abstractor}
\wordentry{abstruse}
\wordentry{absurd}
\wordentry{abuilding}
\wordentry{abundant}
\wordentry{abusable}
\wordentry{abuse}
\wordentry{abusive}
\wordentry{abut}
\wordentry{abutted}
\wordentry{abutting}
\wordentry{abysmal}
\wordentry{abyss}
\wordentry{Abyssinia}
\wordentry{AC}
\wordentry{academe}
\wordentry{academia}
\wordentry{academic}
\wordentry{academician}
\wordentry{academy}
\wordentry{Acadia}
\wordentry{acanthus}
\wordentry{Acapulco}
\wordentry{accede}
\wordentry{accelerate}
\wordentry{accelerometer}
\wordentry{accent}
\wordentry{accentual}
\wordentry{accentuate}
\wordentry{accept}
\wordentry{acceptant}
\wordentry{acceptor}
\wordentry{access}
\wordentry{accessible}
\wordentry{accession}
\wordentry{accessory}
\wordentry{accident}
\wordentry{accidental}
\wordentry{accipiter}
\wordentry{acclaim}
\wordentry{acclamation}
\wordentry{acclimate}
\wordentry{accolade}
\wordentry{accommodate}
\wordentry{accompaniment}
\wordentry{accompanist}
\wordentry{accompany}
\wordentry{accomplice}
\wordentry{accomplish}
\wordentry{accord}
\wordentry{accordant}
\wordentry{accordion}
\wordentry{accost}
\wordentry{account}
\wordentry{accountant}
\wordentry{Accra}
\wordentry{accredit}
\wordentry{accreditate}
\wordentry{accreditation}
\wordentry{accretion}
\wordentry{accrual}
\wordentry{accrue}
\wordentry{acculturate}

\end{document}


=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
Nelson H.F. Beebe
Center for Scientific Computing
Department of Mathematics
220 South Physics Building
University of Utah
Salt Lake City, UT 84112
USA
 Tel: (801) 581-5254
 FAX: (801) 581-4148
 Internet: beebe@math.utah.edu
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

------_=_NextPart_001_01C19443.ABECDD3C--