[pdftex] textcolor, lineno and pdfTeX

Ross Moore ross at ics.mq.edu.au
Thu Jun 13 09:11:00 CEST 2002


> \usepackage{color}
> \usepackage{lineno}
> 
> \begin{document}
> 
> \linenumbers
> 
> Document draft text. \emph{Document draft text. \textcolor{blue}
> {Document draft text. Document draft text. Document draft text. Document
> draft text. Document draft text. Document draft text. Document draft
> text.} Document draft text.} Document draft text. 
> 
> \end{document}
> 
> If I process this document with latex, dvips and ps2pdf everything is -
> more or less - fine but whenever I generate the pdf directly using
> pdflatex (I've tried both 0.13d and 0.14h), only the text up to the
> first linebreak is in color. By removing the line numbering, one can
> reverse the effect but as a matter of fact ... I do need both.
> 
> Any hints what I'm doing wrong or what's going wrong with pdfLaTeX?


A clue to what's happening comes from the documentation within lineno.sty:

%          Put the line numbers to the lines
%                                                                            }
% The line numbers have to be attached by the output
% routine.  We simply set the ~\interlinepenalty~ to -100000.
% The output routine will be called after each line in the
% paragraph,  except the last,  where we trigger by ~\par~.

By calling the output routine, the color has to be attached to
the material being handled at each call.
On the other hand the color-package just puts a color-change at the start,
and an implicit change at the end (via color push/pop \special commands).

For PostScript as the back-end, the push/pop is enough for the color to
apply to all lines. However PDF packages the pieces more tightly;
each line will be on a different branch of a tree, and only the first
branch has the color-change command.


So to use \color along with {lineno}, you will need to restrict your uses
of \textcolor to within single lines only.
Awkward, but a restriction placed by the design of the  lineno  package,
which was written in 1995, before PDF was a viable output format.


Maybe there is an alternative package that does work better with pdfTeX ?


Hope this helps,

	Ross Moore
 
> TIA,
> 
> 	Guenter
> 
> -- 
> Guenter Resch - Salzburg, Austria, European Union
> Mail: GuenterResch at utanet.at - ICQ: Account on request
> Web: members.telering.at/guenter.resch/ - Linux user 181 904
> PGP Fingerprint: 7244 FE0C C216 48F5 6B5C  BFE6 B083 19A3 EFA6 B952
> _______________________________________________
> pdftex mailing list
> pdftex at tug.org
> http://tug.org/mailman/listinfo/pdftex




More information about the pdftex mailing list