latex3 / latex2e

The LaTeX2e kernel
https://www.latex-project.org/
LaTeX Project Public License v1.3c
1.94k stars 267 forks source link

Color lost on split footnote #1

Open FrankMittelbach opened 7 years ago

FrankMittelbach commented 7 years ago

Brief outline of the bug

This is a bug (but perhaps impossible to fix) I came across the other day: The color inside a footnote is partially lost if LaTex decides to split the footnote.

Minimal example showing the bug

\RequirePackage{latexbug}
\documentclass{article}

\usepackage{lipsum,color}

\setlength\textheight{16\baselineskip}

\begin{document}

\lipsum*[1]\footnote{\color{blue}\lipsum[2] Color partially lost on a split footnote!}

\lipsum*[3]\footnote{foo}

\end{document}

Log (and possibly PDF) file

colorbug.log

colorbug.pdf

davidcarlisle commented 7 years ago

Yes, I was going to say it's more of a documented feature than a bug (but i couldn't find any documentation of it in color.dtx:-) I remember discussions with Tom Rokicki at the time though...

Heiko has some discussion here

https://tex.stackexchange.com/questions/176276/coloured-footnotes-split-across-multiple-pages

josephwright commented 7 years ago

Probably for the L3 colour experiments I should have multiple stacks built-in :)

josephwright commented 7 years ago

@FrankMittelbach Do we need 'category' in the label? Wouldn't just 'graphics' cover it? BTW, nice use of the 'machine' user (@latexteam) ;)

FrankMittelbach commented 7 years ago

Am 11.11.2017 um 10:15 schrieb Joseph Wright:

@FrankMittelbach https://github.com/frankmittelbach Do we need 'category' in the label? Wouldn't just 'graphics' cover it? BTW, nice use of the 'machine' user (@latexteam https://github.com/latexteam) ;)

my thought was the "category" gets all the categories together and thus separates them from bug, question, enhancement ...

so no not necessary but I think useful

as of use of machine user ... I thought that would be what people might do and and wondered what happened if ... (not much it seems)

ghost commented 7 years ago

Frank Mittelbach notifications@github.com writes:

This is a bug (but perhaps impossible to fix) I came across the other day.


\RequirePackage{latexbug}
\documentclass{article}

\usepackage{lipsum,color}

\setlength\textheight{16\baselineskip}

\begin{document}

\lipsum*[1]\footnote{\color{blue}\lipsum[2] Color partially lost on a
split footnote!}

\lipsum*[3]\footnote{foo}

\end{document}

\usepackage{bigfoot}

But what that package does regarding the color stack is a bit cumbersome.

-- David Kastrup

FrankMittelbach commented 7 years ago

Well, offering the advice to use bigfoot is better than saying tough (or not saying anything :-). For 2e that might be all we ever want to do but going forward I think @josephwright is right that some colorstack model might be in dire need

ghost commented 7 years ago

Frank Mittelbach notifications@github.com writes:

Well, offering the advice to use bigfoot is better than saying tough (or not saying anything :-). For 2e that might be all we ever want to do but going forward I think @josephwright is right that some colorstack model might be in dire need

IIRC, bigfoot implements a color stack of its own and tracks its current state using marks, and when a footnote is broken, it generates the code for unwinding the color stack in the top part and for regenerating it in the bottom part.

This can't really be done much simpler since dvips maintains a full color stack and pdftex only maintains a current color, so you need to be able to deal with either.

Of course, Heiko Oberdiek has some package implementing a full color stack in pdftex. Or was it? There is pdfcol.sty and pdfcolfoot.sty. And pdfcolmk.sty and pdfcolparallel.sty and pdfcolparcolumns.sty ...

-- David Kastrup

josephwright commented 7 years ago

I don't follow the comment about pdfTeX: it has a colour stack in the same way dvips does.

josephwright commented 7 years ago

Or at least, that's my understanding of the fact it has separate stacks ...

josephwright commented 7 years ago

Of course, pdfTeX/LuaTeX in PDF mode is only a subset of what needs to work, so the bigfoot approach is probably the only generally-viable one (at least until/unless stacks work in dvips and (x)dvipdfmx).

FOCCOF commented 6 years ago

@josephwright Yes, I think so. I immediately thought about \marks associated with any color whatsit to be able to track the colour stack and complete it as necessary. Certainly the same sort of "bug" could be shown with the multicols package, although i've not written an example yet ;-(

Anyway, i HATE footnotes that split accross pages ! Some books print footnotes with a footnote rule in the middle of the page. Depending on what sort of book it is, the result is not necessarily ugly...)

josephwright commented 5 years ago

Probably fixable for pdfTeX, maybe not for dvips, etc.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity.

FrankMittelbach commented 3 years ago

It's funny to see all these spurious references. I scratched my head for a moment but the reason is simple: people have replied showing code with arguments from mail so the code got interprreted and @ macros became users (what what they thought getting referenced if they happened to exist :-) ) and the #1 ended up here. Dosn't seem possible to delete thos spurious ones.

Anyway, I think we are finally able to resolve this issue in the fall release of LaTeX (if we get configuration points then), so I tentatively penciled that in now,

josephwright commented 3 years ago

@FrankMittelbach Fix isn't too bad, it's a question partly of if we are happy saying 'works in pdfTeX, LuaTeX, recent-XeTeX/dvipdfmx routes, but not dvips' (I guess 'doesn't even feature' for dvisvgm)

FrankMittelbach commented 3 years ago

But with the coming fall release we will (or should be) able to detect a split footnote stream and thus can handle tagging and color for it regardless of the back end. And given that there will be no fix before that release (or only in a summer "dev") I see not much point in a partial fix, or am I missing something?

josephwright commented 3 years ago

@FrankMittelbach Ah, right, I see how you are imagining a fix. I was thinking of engine colour stacks not of breaking this down at the LaTeX level.

FrankMittelbach commented 3 years ago

@josephwright well, we need the machinery for paragraphs anyway, so yes, color could could be handled differently, but what would we really gain by that? I guess not much, but who knows, it is certainly a possible option we have available.