Footnotes and tcolorbox

559 views
Skip to first unread message

Mitch Keller

unread,
Dec 18, 2018, 3:18:59 PM12/18/18
to pretext...@googlegroups.com
I think I warned about this at some point previously, but tcolorbox and footnotes do not play well together. This is problematic because authors should not be expected to know where tcolorbox is being used (particularly when the box is invisible in PDF output) in order to avoid what you can see in the attached file. (Two pages from Matt Boelkins’ forthcoming Active Preparation for Calculus.) This demonstrates that a footnote inside an example can wind up (a) on the next page (after the end of the example) and (b) in the middle of the next page (at the end of the tcolorbox and before the next one starts).

I know footnotes are tricky to deal with on the programming side, but they are both common and reasonable for authors to use. From my perspective, the current state of affairs makes footnotes essentially unusable in LaTeX output because publishers may not be able to hack together a way to get them to appear at the bottom of the correct page. Perhaps that is by design, given how much footnotes are detested. If so, I think we need to have a viable alternative *that plays nicely with tcolorbox*.

Mitch Keller
mi...@rellek.net
apc-extract-for-ptx-list.pdf

Rob Beezer

unread,
Dec 18, 2018, 6:53:59 PM12/18/18
to pretext...@googlegroups.com
Not purposely breaking footnotes. There is a package that may better force them to the bottom. Maybe Andrew R has found a solution?

Mitch Keller

unread,
Dec 19, 2018, 1:02:35 PM12/19/18
to pretext...@googlegroups.com
I did some looking and saw a few suggestions that would rely heavily on manual cleanup after the fact. (Most involve \footnotemark and \footnotetext and sometimes needing to put the \footnotetext in an odd place before the mark appears in order to get it out of the tcolorbox and on the right page.

This feels like a high priority issue to resolve, so hopefully someone has a solution.

-- 
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To post to this group, send email to pretext...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/MTAwMDA0Ni5iZWV6ZXI.1545177236%40quikprotect.
For more options, visit https://groups.google.com/d/optout.

— 
Mitch Keller

Andrew Rechnitzer

unread,
Dec 20, 2018, 2:06:28 PM12/20/18
to PreTeXt support
Hi Mitch
I share your footnote induced frustrations... <sigh>

After some hackery I think I have something that works based on this solution combined with some counter setting and increments and a little tcolorbox code.
It does not require modifications to the latex inside the tcolorbox and only on adding some misc stuff to the header.
Of course - it does require a good thorough test.

See the attached file.
Andrew



footnotehack.tex

Mitch Keller

unread,
Jan 2, 2019, 5:42:56 PM1/2/19
to pretext...@googlegroups.com
OK, back after being AWOL for the holidays.

One issue I’ve found (see attached sample, which is only a minor modification of what Andrew sent) is that when a breakable tcolorbox seems to push all of its contained footnotes onto the next page. Better than the default? Sure, but would like to see it even better.

Note that Andrew’s code left some \popftn commands in after \end{tcolorbox}. When I removed them, it didn’t work correctly. I had to change after lower={\popftn} to just after={\popftn}. I am so far away from even knowledgeable about tcolorbox that I’m just going to leave that comment there and walk away slowly to see what an expert can do.
footnotehack.tex

Rob Beezer

unread,
Jan 2, 2019, 6:02:55 PM1/2/19
to pretext...@googlegroups.com
Dear Mitch,

Welcome back. I'm still catching up, after taking a *real vacation*.

I spent a long time looking hard at Andrew's solution, plus alternatives. I
plan to give Andrew's code a workout (no real testing yet, just been looking).
I strongly suspect there is no way to insert footnote-text at the place where
tcolorbox breaks a box across pages. The manual has boatloads of veiled threats
about the box-breaking algorithm. ;-)

So if you have a 4-page proof, your footnote could be 3 or 4 pages away. I
think that is as good as it is going to get. We'll want to do a bit of
education so as authors create material they can think about placement of footnotes.

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To post to this group, send email to pretext...@googlegroups.com
> <mailto:pretext...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/20006AE2-618C-4DE9-9D2C-F01071072376%40rellek.net
> <https://groups.google.com/d/msgid/pretext-support/20006AE2-618C-4DE9-9D2C-F01071072376%40rellek.net?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>> On Dec 20, 2018, at 1:06 PM, Andrew Rechnitzer <arech...@gmail.com
>> <mailto:arech...@gmail.com>> wrote:
>>
>> Hi Mitch
>> I share your footnote induced frustrations... <sigh>
>>
>> After some hackery I think I have something that works based on this solution
>> <https://tex.stackexchange.com/questions/43692/footnotetext-numbering-for-many-footnotemark-automatic-solution>
>> combined with some counter setting and increments and a little tcolorbox code.
>> It does not require modifications to the latex inside the tcolorbox and only
>> on adding some misc stuff to the header.
>> Of course - it does require a good thorough test.
>>
>> See the attached file.
>> Andrew
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "PreTeXt support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pretext-suppo...@googlegroups.com
>> <mailto:pretext-suppo...@googlegroups.com>.
>> To post to this group, send email to pretext...@googlegroups.com
>> <mailto:pretext...@googlegroups.com>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pretext-support/97e4b774-dadd-41f4-9fcc-b256c5b7315d%40googlegroups.com
>> <https://groups.google.com/d/msgid/pretext-support/97e4b774-dadd-41f4-9fcc-b256c5b7315d%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout.
>> <footnotehack.tex>
>
> —
> Mitch Keller
> mi...@rellek.net <mailto:mi...@rellek.net>
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To post to this group, send email to pretext...@googlegroups.com
> <mailto:pretext...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/20006AE2-618C-4DE9-9D2C-F01071072376%40rellek.net
> <https://groups.google.com/d/msgid/pretext-support/20006AE2-618C-4DE9-9D2C-F01071072376%40rellek.net?utm_medium=email&utm_source=footer>.

Mitch Keller

unread,
Jan 3, 2019, 11:50:02 AM1/3/19
to pretext...@googlegroups.com

> So if you have a 4-page proof, your footnote could be 3 or 4 pages away. I think that is as good as it is going to get. We'll want to do a bit of education so as authors create material they can think about placement of footnotes.

This is where I really start to wonder if we’re overusing tcolorbox in a way that will drive some people away. I think people will understand the idea that if they have something that is visually rendered in a box, footnotes will be held until after the end of the visual box. However, a proof generally doesn’t have the visual appearance of being in a box (other than the Halmos marking the end of the proof).

I had a thought of suggesting that maybe the default use of tcolorbox be minimized and that it only be used for an environment when styling was desired, but (a) that’s probably a pain to implement and (b) doesn’t really make sense with author and publisher being separate roles. If the author is not the publisher, then the author might not realize that the publisher’s subsequent styling choice will force a critical footnote to appear four pages later.

Sounds like there’s a need for copious education/documentation at a minimum. For anyone who is thinking about doing something better with aside in LaTeX, the interaction with tcolorbox is also something that should be thought about. I think there’s a lot of times that footnotes are used where aside might be better. Once there’s an option for aside as marginalia in LaTeX, that might be a good alternative if we can keep it from drifting onto another page.
> To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
> To post to this group, send email to pretext...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/677cafbe-4c53-7850-3f04-9b6696ae118b%40ups.edu.
> For more options, visit https://groups.google.com/d/optout.


Mitch Keller
mi...@rellek.net

Rob Beezer

unread,
Jan 3, 2019, 2:13:51 PM1/3/19
to pretext...@googlegroups.com
Once I gave up on the Procrustean 1.5-arguments-constraint of the traditional
environments (AMS theorem variants), then I went all-in on tcolorbox. It solves
*a lot of problems* in reliable and dependable ways. Styling and layout are so
much easier. I could make a list.

I agree that moving footnotes to a different page (if we even are successful at
that) is pretty bad. But as I have said many times, footnotes are the farthest
thing away from structured authoring that I can think of. I agree that we
should make progess on asides as they are often a better alternative.

There are intermediate mode="environment" templates which create the LaTeX to
implement a "block". So, for example,

<xsl:template match="proof" mode="environment">

could create something other than a tcolorbox. But then all the styling options
go away. I have not been advertising these "environment" templates as a public
interface since I'm not wedded to the exact nature of the arguments. Many of
them use xparse (iirc) which is the other big improvement (under the hood), so
that could replace tcolorbox in places. So a typical block goes

authored in PTX -> isolate title, etc in xparse/tcolorbox -> style if tcolorbox

There is no way I can open a new front right now to enable a wholesale set of
variations in the LaTeX conversion. I'm not even done with styling (fonts right
now, figures and tables soon). But I am willing to assist with any effort to
move any conversion to a better place. I have invested a lot into pushing many
aspects of all the conversions down into the -common template, in hopes of
making the tricky bits easily reusable for others.

Copious documentation takes time, too. Up late last night writing about fonts
in preparation for styling. Not done yet.

Rob

Rob Beezer

unread,
Jan 3, 2019, 2:27:37 PM1/3/19
to pretext...@googlegroups.com
Thought du jour. I might be able to accomplish Andrew's approach in XSL. Maybe
drop a mark at footnote location, place text just after box-content finishes.

On 1/2/19 2:36 PM, Mitch Keller wrote:
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To post to this group, send email to pretext...@googlegroups.com
> <mailto:pretext...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/20006AE2-618C-4DE9-9D2C-F01071072376%40rellek.net
> <https://groups.google.com/d/msgid/pretext-support/20006AE2-618C-4DE9-9D2C-F01071072376%40rellek.net?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>> On Dec 20, 2018, at 1:06 PM, Andrew Rechnitzer <arech...@gmail.com
>> <mailto:arech...@gmail.com>> wrote:
>>
>> Hi Mitch
>> I share your footnote induced frustrations... <sigh>
>>
>> After some hackery I think I have something that works based on this solution
>> <https://tex.stackexchange.com/questions/43692/footnotetext-numbering-for-many-footnotemark-automatic-solution>
>> combined with some counter setting and increments and a little tcolorbox code.
>> It does not require modifications to the latex inside the tcolorbox and only
>> on adding some misc stuff to the header.
>> Of course - it does require a good thorough test.
>>
>> See the attached file.
>> Andrew
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "PreTeXt support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to pretext-suppo...@googlegroups.com
>> <mailto:pretext-suppo...@googlegroups.com>.
>> To post to this group, send email to pretext...@googlegroups.com
>> <mailto:pretext...@googlegroups.com>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pretext-support/97e4b774-dadd-41f4-9fcc-b256c5b7315d%40googlegroups.com
>> <https://groups.google.com/d/msgid/pretext-support/97e4b774-dadd-41f4-9fcc-b256c5b7315d%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout.
>> <footnotehack.tex>
>
> —
> Mitch Keller
> mi...@rellek.net <mailto:mi...@rellek.net>
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To post to this group, send email to pretext...@googlegroups.com
> <mailto:pretext...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/20006AE2-618C-4DE9-9D2C-F01071072376%40rellek.net
> <https://groups.google.com/d/msgid/pretext-support/20006AE2-618C-4DE9-9D2C-F01071072376%40rellek.net?utm_medium=email&utm_source=footer>.

Rob Beezer

unread,
Jan 4, 2019, 7:17:16 PM1/4/19
to pretext...@googlegroups.com
OK, I've used XSL to drop a footnote mark (only) within blocks presently
implemented via tcolorbox. Then as the processing of the block concludes, all
the footnotes are processed again, accumulating their footnote text immediately
after the "\end{}" of the block. No additional packages or other changes to the
preamble necessary (with one small exception).

Numbering looks good, though the numbers such footnote text needed to be
hard-coded. The footnotes will appear at the bottom of the pages, but as
observed, they could be on a later page. Linking mark to text in an electronic
PDF breaks, so I turned that off universally. Cross-references to footnote
texts should not be affected (not tested).

Sub-optimal, I know. Perhaps tcolorbox will solve the problem and we can rip
all this out later. See LaTeX conversion notes in the Publisher's Guide
(Chapter 5) for a bit of attitude and a bit more detail.

A pile of test footnotes in Section 5 of the sample article, some trapped within
a "remark". Careful testing that other footnotes did not break. If you love
footnotes, and care about PDF/print, maybe you can do some testing? Yes, Andrew
R, I'm looking at you. ;-)

Thanks, Mitch, for advocating for this one. I wish we could do better. Thanks
to Andrew for the LaTeX hackery, which inspired this XSL approach.

Rob
Reply all
Reply to author
Forward
0 new messages