I'm using pdfTeX, Version 3.14159-13d from teTeX-1.0,
together with the latest color.sty [just downloaded it again].
I have redefined the section heading commands to switch on color.
The problem is that some of the section headings have the wrong color.
In particular, it seems to be exactly those headings which end up at the
top of the page, except the very first heading.
Below, I have attached a small sample latex file showing the problem.
If I translate exactly the same file with latex/dvips,
then the postscript file is correct.
That seems to me to point at pdftex.
I tried to obtain a newer pdftex, but the binary in
CTAN/.../teTeX/current/distrib/binaries/mips-irix6.tar.gz
is the same version as mine;
The version which The Catalogue refers to is version 0.11;
and I can't download the latest version from
ftp://ftp.cstug.cz/pub/tex/local/cstug/thanh/pdftex
as advertised in pdftex's README.
Did I make a mistake in the redefinition of the \section commands?
[Then why is everything fine with latex, but not with pdflatex?]
All suggestions will be highly appreciated.
Gab.
PS:
If you want you can view the results of my pflatex/latex runs
at http://www.igd.fhg.de/~zach/tmp/qq.ps
and http://www.igd.fhg.de/~zach/tmp/qq.pdf
---- sample tex file; problem are the section headings at the top of the pages
\documentclass[12pt]{article}
\usepackage{color}
\makeatletter
\renewcommand{\subsubsection}{\@startsection
{subsubsection}{3}%
{0pt}%
{-2ex plus -0.5ex minus -1ex}%
{0.1ex plus 0.2ex minus 0.1ex}%
{\normalfont\normalsize\sffamily\color[rgb]{0.4,0.4,0.4}}}
\renewcommand{\subsection}{\@startsection
{subsection}{2}%
{0pt}%
{-3ex plus -1ex minus -1ex}%
{0.7ex plus 0.2ex minus 0.3ex}%
{\normalfont\large\sffamily\color[rgb]{0.0,0.4,0.4}}}
\renewcommand{\section}{\@startsection
{section}{1}%
{0pt}%
{-3ex plus -2ex minus -1ex}%
{2ex plus 0.7ex minus 0.5ex}%
{\normalfont\Large\sffamily\color[rgb]{1.0,0.2,0.2}}}
\makeatother
\begin{document}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\section{Blub} \subsection{Blub}
\end{document}
---- sample tex file
--- output of a pdftex run
pdflatex qq
This is pdfTeX, Version 3.14159-13d (Web2C 7.3.1)
(qq.tex[/igd/a4/software/teTeX-1.0/share/texmf/pdftex/config/pdftex.cfg]
LaTeX2e <1998/12/01> patch level 1
Babel <v3.6x> and hyphenation patterns for american, french, german,
ngerman, n
ohyphenation, loaded.
(/igd/a4/software/teTeX-1.0/share/texmf/tex/latex/base/article.cls
Document Class: article 1999/01/07 v1.4a Standard LaTeX document class
(/igd/a4/software/teTeX-1.0/share/texmf/tex/latex/base/size12.clo))
(/igd/a4/software/teTeX-1.0/share/texmf/tex/latex/graphics/color.sty
(/igd/a4/software/teTeX-1.0/share/texmf/tex/latex/config/color.cfg)
(/igd/a4/software/teTeX-1.0/share/texmf/tex/latex/graphics/pdftex.def))
No file qq.aux.
(/igd/a4/software/teTeX-1.0/share/texmf/tex/context/base/supp-pdf.tex
(/igd/a4/software/teTeX-1.0/share/texmf/tex/context/base/supp-mis.tex
loading : Context Support Macros / Missing
)
loading : Context Support Macros / PDF
) [1[/igd/a4/software/teTeX-1.0/share/texmf/dvips/config/pdftex.map]] [2]
[3] [4] (qq.aux) )<cmr12.pfb><cmss12.pfb><cmss17.pfb>
Output written on qq.pdf (4 pages, 18337 bytes).
Transcript written on qq.log.
--- output of a pdftex run
--- output of a latex run
This is TeX, Version 3.14159 (Web2C 7.3.1)
(qq.tex
LaTeX2e <1998/12/01> patch level 1
Babel <v3.6x> and hyphenation patterns for american, french, german,
ngerman, n
ohyphenation, loaded.
(/igd/a4/software/teTeX/share/texmf/tex/latex/base/article.cls
Document Class: article 1999/01/07 v1.4a Standard LaTeX document class
(/igd/a4/software/teTeX/share/texmf/tex/latex/base/size12.clo))
(/igd/a4/software/teTeX/share/texmf/tex/latex/graphics/color.sty
(/igd/a4/software/teTeX/share/texmf/tex/latex/config/color.cfg)
(/igd/a4/software/teTeX/share/texmf/tex/latex/graphics/dvips.def)
(/igd/a4/software/teTeX/share/texmf/tex/latex/graphics/dvipsnam.def))
(qq.aux)
[1] [2] [3] [4] (qq.aux) )
Output written on qq.dvi (4 pages, 4740 bytes).
Transcript written on qq.log.
--- output of a latex run
--
/---------------------------------------------------------------------\
| What if you slept? And what if, in your sleep, you dreamed? |
| And what if, in your dream, you went to heaven and there plucked a |
| strange and beautiful flower? And what if, when you awoke, |
| you had the flower in your hand? Ah, what then? (Coleridge) |
| |
| za...@igd.fhg.de g...@gab.cx Gabriel....@gmx.net |
| www.igd.fhg.de/~zach/ www.gab.cx __@/' |
\---------------------------------------------------------------------/
There are two problems involved here:
a) pdfTeX, unlike dvips, doesn't maintain a color stack, so if an
automatic page break occurs in a colored area, pdfTeX doesn't know
what color to return to after setting the heading (remember
processing of page material has probably advanced far beyond the
point where the page is actually broken, so TeX has no means to
find out which color is active at the point the page break is
actually placed).
I don't think there's a way to recover from that, short of
completely rewriting the color mechanism of the pdftex.def driver
using marks.
Maybe if your header is empty anyway, LaTeX could be kept from
changing color in there, but the same problem occurs with the
footer of the previous page.
b) The sixth argument of \@startcolor is executed in vertical mode,
where \color inserts something at which a page break can occur,
which is otherwise forbiden in/after a section heading (try your
example text without the \color command, it will all go on one
overfull page).
I tried to hack this by moving the respective argument into a
`horizontal area' within \@sect, like this:
\def\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
\refstepcounter{#1}%
\protected@edef\@svsec{\@seccntformat{#1}\relax}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa>\z@
\begingroup
\@hangfrom{#6\hskip #3\relax\@svsec}%
\interlinepenalty \@M#6#8\@@par
\endgroup
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}%
\else
\def\@svsechd{%
#6{\hskip #3\relax
\@svsec #8}%
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}}%
\fi
\@xsect{#5}}
This _does_ seem to work with your example (even if I put something
between the \section commands so that page breaks are done), but I
don't know whether it breaks anything else.
Anyway, as \color is now executed in horizontal mode, the problem
goes away.
A more systematic solution would be better, but this is the best I can
contribute at the moment.
regards
Stephan
--
Stephan Lehmke Stephan...@cs.uni-dortmund.de
Fachbereich Informatik, LS I Tel. +49 231 755 6434
Universitaet Dortmund FAX 6555
D-44221 Dortmund, Germany
>In article <slrn8qctm3...@schwind.igd.fhg.de>, Gabriel Zachmann writes:
>>
>> Could it be that there is a bug in pdlaftex concerning colors?
>>
>> I'm using pdfTeX, Version 3.14159-13d from teTeX-1.0,
>> together with the latest color.sty [just downloaded it again].
>>
>> I have redefined the section heading commands to switch on color.
>> The problem is that some of the section headings have the wrong color.
>> In particular, it seems to be exactly those headings which end up at the
>> top of the page, except the very first heading.
>
>There are two problems involved here:
>
>a) pdfTeX, unlike dvips, doesn't maintain a color stack, so if an
> automatic page break occurs in a colored area, pdfTeX doesn't know
> what color to return to after setting the heading (remember
> processing of page material has probably advanced far beyond the
> point where the page is actually broken, so TeX has no means to
> find out which color is active at the point the page break is
> actually placed).
> I don't think there's a way to recover from that, short of
> completely rewriting the color mechanism of the pdftex.def driver
> using marks.
Even worse, LaTeX has to be rewritten :-(
After the Dante meeting I have started to experiment with the
eTeX method of a `colour' mark. One of the major problems is
the understanding of the output routine and the need to rewrite
it because of missing hooks. I have appended my very first try
with some tests in onecolumn and twocolumn mode, but without
considering floats.
Limitations:
* eTeX extensions are required.
* LaTeX's output routine is redefinded.
* Changes in the output routine of newer versions
of LaTeX are not detected.
* Packages that change the output routine are not
supported.
* I have only tested some variants of onecolumn/twocolumn,
however no tests with floats/footnotes.
For experiments I have put the code in a package file
"pdfcolmk.sty":
%%% cut %%% pdfcolmk.sty %%% cut %%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{pdfcolmk}[2000/08/27 PDFtex COLor MarK (HO)]
\typeout{*** CAUTION: EXPERIMENTAL ***}
\typeout{This package `pdfcolmk' tries to add a color stack for}
\typeout{pdfTeX based on a mark register of eTeX. It redefines}
\typeout{LaTeX's output routine. Use with care, no warranties.}
\typeout{*****************************}
\@ifpackageloaded{color}{}{\RequirePackage[pdftex]{color}}
\RequirePackage{etex}[1998/03/26]
\newmarks\pec@marks
\def\set@color{%
\pdfliteral{\current@color}%
\marks\pec@marks{\current@color}%
\aftergroup\reset@color
}
\def\reset@color{%
\pdfliteral{\current@color}%
\marks\pec@marks{\current@color}%
}
\def\X@outputpage{%
\begingroup % the \endgroup is put in by \aftergroup
\let \protect \noexpand
\@resetactivechars
\@parboxrestore
\shipout \vbox{%
\expandafter\def\expandafter\current@color\expandafter{\topmarks\pec@marks}%
\set@typeset@protect
\aftergroup \endgroup
\aftergroup \set@typeset@protect
% correct? or just restore by ending
% the group?
\if@specialpage
\global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
\fi
\if@twoside
\ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
\let\@themargin\oddsidemargin
\else \let\@thehead\@evenhead
\let\@thefoot\@evenfoot \let\@themargin\evensidemargin
\fi
\fi
\reset@font
\normalsize
\normalsfcodes
\let\label\@gobble
\let\index\@gobble
\let\glossary\@gobble
\baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
\@begindvi
\vskip \topmargin
\moveright\@themargin \vbox {%
\setbox\@tempboxa \vbox to\headheight{%
\vfil
\color@hbox
\normalcolor
\hb@xt@\textwidth{\@thehead}%
\color@endbox
}% %% 22 Feb 87
\dp\@tempboxa \z@
\box\@tempboxa
\vskip \headsep
\box\@outputbox
\baselineskip \footskip
\color@hbox
\normalcolor
\hb@xt@\textwidth{\@thefoot}%
\color@endbox
}%
}%
\global \@colht \textheight
\stepcounter{page}%
\let\firstmark\botmark
}
\let\pec@outputpage\@outputpage
\def\pec@ScanOutputpage#1\begingroup#2\@nil{%
\ifx\\#2\\%
\PackageWarningNoLine{pdfetexdef}{%
This \noexpand\@outputpage is not supported%
}%
\else
\expandafter\pec@DefOutputpage\@outputpage\@nil
\fi
}
\def\pec@DefOutputpage#1\begingroup#2\@nil{%
\def\@outputpage{%
#1%
\begingroup
\ifpec@left
\let\current@color\pec@leftcolor
\else
\expandafter\def\expandafter\current@color\expandafter{%
\topmarks\pec@marks
}%
\fi
#2%
}%
}
\expandafter\pec@ScanOutputpage\@outputpage\begingroup\@nil
\def\pec@setcolor{%
\expandafter\def\expandafter\current@color\expandafter{%
\topmarks\pec@marks
}%
}
\begingroup
\toks@=\output
\toks@=\expandafter\expandafter\expandafter{%
\expandafter\@firstofone\the\toks@
}%
\toks@=\expandafter{\expandafter\pec@setcolor\the\toks@}
\expandafter
\endgroup
%\expandafter\output\expandafter{\the\toks@}
\gdef \@makecol {%
\ifvoid\footins
\setbox\@outputbox \box\@cclv
\else
\setbox\@outputbox \vbox {%
\boxmaxdepth \@maxdepth
\@tempdima\dp\@cclv
\unvbox \@cclv
\vskip-\@tempdima
\vskip \skip\footins
\color@begingroup
\normalcolor
\footnoterule
\unvbox \footins
\color@endgroup
}%
\fi
\xdef\@freelist{\@freelist\@midlist}%
\global \let \@midlist \@empty
\@combinefloats
\ifvbox\@kludgeins
\@makespecialcolbox
\else
\setbox\@outputbox \vbox to\@colht {%
\@texttop
\dimen@ \dp\@outputbox
\unvbox \@outputbox
\vskip -\dimen@
\@textbottom
}%
\fi
\global \maxdepth \@maxdepth
}
\def\@outputdblcol{%
\if@firstcolumn
\global \@firstcolumnfalse
\global \setbox\@leftcolumn \box\@outputbox
\begingroup
\pec@setcolor
\expandafter\gdef\expandafter\pec@leftcolor\expandafter{\current@color}%
\endgroup
\else
\global \@firstcolumntrue
\setbox\@outputbox \vbox {%
\pec@setcolor
\hb@xt@\textwidth {%
\hb@xt@\columnwidth {%
\box\@leftcolumn \hss}%
\hfil
\vrule \@width\columnseprule
\hfil
\hb@xt@\columnwidth {%
\box\@outputbox \hss}%
}%
}%
\@combinedblfloats
\pec@lefttrue
\@outputpage
\pec@leftfalse
\begingroup
\@dblfloatplacement
\@startdblcolumn
\@whilesw\if@fcolmade \fi
{\@outputpage
\@startdblcolumn}%
\endgroup
\fi
}
\newif\ifpec@left
\endinput
%%% cut %%% pdfcolmk.sty %%% cut %%%
Yours sincerely
Heiko <ober...@ruf.uni-freiburg.de>
I think eTeX's multiple marks are a huge incentive to use eTeX.
But they may not work for color identifiation because marks need
to migrate to the vertical list. Surely linebreaks are possible
in places where the mark won't migrate out. (?)
Donald Arseneau as...@triumf.ca
>In article <4d0jqssl5938g21dh...@4ax.com>, Heiko Oberdiek <ober...@ruf.uni-freiburg.de> writes...
>>After the Dante meeting I have started to experiment with the
>>eTeX method of a `colour' mark.
>
>I think eTeX's multiple marks are a huge incentive to use eTeX.
>But they may not work for color identifiation because marks need
>to migrate to the vertical list. Surely linebreaks are possible
>in places where the mark won't migrate out. (?)
Sorry, I am too silly to understand your problem,
can you make a short example?
I thought, if a page is set, then all marks of
this page are part of the page, so that the
really first and last ones are acessible by
\firstmarks, \topmarks, \botmarks?
Yours sincerely
Heiko <ober...@ruf.uni-freiburg.de>
I tried this by pasting it into a .sty file
and loading it like this
\usepackage{color}
\usepackage{fixpdfcol}
into the sample tex file (included in my earlier post).
but strange things happened:
only one page was produced by pdflatex ....
Cheers,
Gab.
] \def\@sect#1#2#3#4#5#6[#7]#8{%
As I said: This is the _correct_ behaviour if a document contains only
section headings! Try it out in a completely standard setting,
without color commands.
Only your color commands provided the `irregular' break points. In a
working setup, you have to insert content between section headings to
provide break points.
regards
Stephan
PS: My hack doesn't `fix pdf colors', so the name of the package is
misleading. It just moves the color change in the section heading
into horizontal mode, so no page break can occur between the color
command and the colored text.
Color problems will remain with any colored text (other than the
default text color, that is) which is broken across pages (unless
you're using Heikos solution).
> as...@erich.triumf.ca (Donald Arseneau) wrote:
>
> >In article <4d0jqssl5938g21dh...@4ax.com>, Heiko Oberdiek <ober...@ruf.uni-freiburg.de> writes...
> >>After the Dante meeting I have started to experiment with the
> >>eTeX method of a `colour' mark.
> >
> >I think eTeX's multiple marks are a huge incentive to use eTeX.
> >But they may not work for color identifiation because marks need
> >to migrate to the vertical list. Surely linebreaks are possible
> >in places where the mark won't migrate out. (?)
>
> Sorry, I am too silly to understand your problem,
> can you make a short example?
\documentclass{article}
\pagestyle{headings}
\begin{document}
Test $ \markboth{XXX}{YYY} a+b+c+d+e $
\end{document}
This gives a blank page header.
> I thought, if a page is set, then all marks of
> this page are part of the page, so that the
> really first and last ones are acessible by
> \firstmarks, \topmarks, \botmarks?
Nope. See page 259 of The TeXbook.
Marks would be *much* more powerful if every mark was noticed
by TeX.
Marks seem like an attractive way to handle change bars entirely
in LaTeX, but the change limits aren't constrained to appear at
outer levels (one step from the main vertical list).
Preserving color across page breaks comes *much* closer to working
with marks because most of the places that hide marks also prohibit
page breaks. The one exception I can think of is math mode, as
above. I presume a colored equation would translate to something
like:
... $ <set color to blue> \mark{ currentcolor: blue}
a + b + c + d + e + f + g
<set color to black> \mark{ currentcolor: black} $
These marks would not be seen by the output routine, but a
linebreak and page break could occur in the middle of the
math.
This isn't a killer though. You could arrange that color
switching has to be surrounded by { }, so entire equations
could be tinted and allowed to break:
\textcolor{blue}{$a+b+c+d=z$}
but colored math fragments could never break:
$ a+b+ \textcolor{blue}{c-d} =y$
It seems feasible, but needs some care.
Donald Arseneau as...@triumf.ca
I have no experience with etex at all [just heard of it here and there ;-) ].
Does that mean I need to run etex instead of latex?
Which packages does etex support? [see my earlier post for a list]
Can I make custom format files with etex?
TIA,
Gab.
>On Sun, 27 Aug 2000 23:44:24 +0200, Heiko Oberdiek <ober...@ruf.uni-freiburg.de> wrote:
>] Stephan...@cs.uni-dortmund.de (Stephan Lehmke) wrote:
>]
>] >In article <slrn8qctm3...@schwind.igd.fhg.de>, Gabriel Zachmann writes:
>] >> [...]
>]
>] Even worse, LaTeX has to be rewritten :-(
>] [...]
>] Limitations:
>] * eTeX extensions are required.
>
>I have no experience with etex at all [just heard of it here and there ;-) ].
>Does that mean I need to run etex instead of latex?
I do not know your TeX distribution.
In many cases running elatex instead of latex works.
>Which packages does etex support? [see my earlier post for a list]
>Can I make custom format files with etex?
If you make your own formats, then do not forget to
enable the eTeX extensions by a star:
"einitex *myformat" instead of "initex myformat"
Documentation: texmf\doc\etex\base\etex_man.*
Yours sincerely
Heiko <ober...@ruf.uni-freiburg.de>