[texhax] twocolumn with lineno per page centered and only once for both columns

Dieter Studer dieterstuder at yahoo.com
Wed Dec 14 15:44:41 CET 2011


For the sake of completeness, here my reply to Uwe Lück's kind reply.
--------------------------------

Dear Uwe,
many thanks for your
reply, I appreciate it a lot and I don't take it for granted at all.
 
> Why don't you ask
the package authors?
 
I wanted to address a
more general audience first because I wanted to avoid the possibility that
there is an article out there on the topic that I simply missed.
Moreover, the user
documentation of lineno (ulineno.pdf) in my TeXlive distribution 2011 is rather
old (2001) so I wasn't sure whether package maintenance is still active.
But now that I look at
lineno.pdf I realize that the package author... is you! ::blush::prostrating::
 
>> (except for
another person asking the same question
>> without getting
an answer).
 
>Where was that?
 
http://compgroups.net/comp.text.tex/Using-lineno-with-twocolumn-trying-to-get-line-numbers-only-in-center
 
The question seems to
cover the exact same idea that I would like to implement, but it's two years
old and I couldn't find a reply.
 
>Although Stephan
applied a trick to achieve compatibility
>with multicol, a
little trying after another request indicated
>that multicol
columns cannot be numbered with lineno.
 
I'm not completely sure
if I understand you correctly.
The packages lineno and
multicol work together in the following minimal example (but maybe this is just
a case of getting lucky and it might no longer work if more packages are
loaded).
In any case, some of the
options did not show the expected behaviour when I used multicol (such as
[columnwise]).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{memoir}
\usepackage{lipsum}
\usepackage{lineno}
\setlength{\columnsep}{4em}%necessary
to have enough space for
%the line numbers
between the columns
\usepackage{multicol}
\begin{document}
\begin{multicols}{2}
\begin{linenumbers}
\lipsum
\end{linenumbers}
\end{multicols}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
>I have received a
little grant from the TeX Development Fund
>for updating lineno
and something more, let's see what I can 
>do with this (when I
am not busy with customers).
 
Great!
 
>Did Word number the
lines?
 
Actually, I'm told now,
it wasn't Word but WordPerfect. And apparently the line numbering was added by
means of a script.
 
>An idea (I may try
myself a little later):
>1. Use packge
options [columnwise,switch*] (unfortunately, package options
>seem not to be dealt
with in a salient way in TFM, see Section 6.4),
>or use
\columnwiselinenumbers and \switchlinenumbers*.
>The order of the
commands may matter, those tricks are too much for me
>right now.
Without the dirty trick following, such tricks should produce
>right-hand line
numbers for the left-hand column and left-hand line numbers
>for the right-hand
column.
 
Thanks for that idea! I
didn't know the starred switch option. It already gets devilishly close to what
I would like to achieve, but the line number is still added twice.
 
>2. Dirty trick:
\let\makeLineNumberLeft\relax.
 
I think that's the hint
I needed.
No change is apparent
when I add this line (neither before nor after \begin{document}), though. I
assume it is meant to suppress the left column line numbers, right? But it does
not do the trick, for some reason.
However, when I use
\let\makeLineNumberEven\relax I do get the right effect.
 
>3. Adjust
\linenumbersep for "centering" the line numbers.
 
\setlength{\linenumbersep}{15pt}
seems to be just about right (the two line numbers are exactly on top of each
other if I leave \let\makeLineNumberEven\relax away).
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[twocolumn]{memoir}
\usepackage{lipsum}
%just for blindtext
\usepackage[columnwise,switch*,modulo]{lineno}
\setlength{\columnsep}{4em}
\setlength{\linenumbersep}{15pt}
%15pt seems to be the centering value
%\let\makeLineNumberLeft\relax
%no effect
\let\makeLineNumberEven\relax
%does the job
\begin{document}
\thispagestyle{empty}
%no headers when a new letter starts
\twocolumn[\section{A}]\par
%new letter starts
\begin{linenumbers}
\lipsum\lipsum\lipsum
%creates some blindtext
\end{linenumbers}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
Problem solved, thank
you very much!
 
Best wishes,
Dieter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20111214/63803208/attachment-0001.html>


More information about the texhax mailing list