tcolorbox problem in two-sided layout

265 views
Skip to first unread message

Sean Fitzpatrick

unread,
Aug 9, 2021, 11:07:02 AM8/9/21
to PreTeXt support
I'm running into a weird LaTeX formatting issue.

I've modified the styling a bit on the tcolorbox for Sage input, as follows:

\newtcblisting{sageinput}{sagestyle, colback=sageblue, enhanced, sharp corners, borderline east={0.5pt}{0pt}{black}, borderline west={0.5pt}{0pt}{black},borderline north={0.5pt}{0pt}{black},before skip=10pt, after skip=0pt,frame hidden,}

This works great in a oneside layout.
But when I switch to twoside for printing, some of the input boxes collapse.
(Only some. Others get cut off a bit.)
I get the following:

2021-08-09_08-54.png

This should be:

2021-08-09_09-03.png

I can fix the ones that are misbehaving by modifying the sagestyle to use after skip=10pt
instead of after skip=0pt, but that leaves some undesirable empty space at the bottom of other boxes that aren't misbehaving in the same way.

OK, so I can just locally modify the ones that don't look right.

But I remain confused: why should changing from oneside to twoside (and making no other change in the .tex file) cause vertical space to disappear in some tcolorboxes?


Sean Fitzpatrick

unread,
Aug 9, 2021, 12:15:57 PM8/9/21
to PreTeXt support
OK, problem seems to be that LaTeX is trying to fit things into the page, and is pushing the output box up until it overlaps the input box.
Changing after skip=0pt in the sageinput definition to after skip=0.1pt fixes the problem.

I just wish I understood why this is triggered by two page layout!

Sean Fitzpatrick

unread,
Aug 9, 2021, 12:18:58 PM8/9/21
to PreTeXt support
Might be related to twoside using \flushbottom instead of \raggedbottom.

If we want to guarantee equivalent pagination for color and print, maybe \raggedbottom needs to be specified somewhere?

Rob Beezer

unread,
Aug 9, 2021, 8:20:03 PM8/9/21
to pretext...@googlegroups.com
On 8/9/21 9:18 AM, Sean Fitzpatrick wrote:
> Might be related to twoside using \flushbottom instead of \raggedbottom.

Nice job sleuthing! You'll be the pretext-latex.xsl maintainer before you
know it. ;-)

For the record, concise summary here:
https://www.sascha-frank.com/page-break.html

> If we want to guarantee equivalent pagination for color and print, maybe
> \raggedbottom needs to be specified somewhere?

There is a bit of the page-fitter in me. I enjoy the textblock on a
double-sided page being *identical* when I hold it up to the light. But gross
space and uneven page counts are perhaps a better justification (pun intended).
I suspect it is a simple enough declaration to add in.

Does adding a \raggedbottom fix your problem, with no other changes (like the
after skip)?

Thoughts from other page-fitters?

Rob

Sean Fitzpatrick

unread,
Aug 9, 2021, 8:38:25 PM8/9/21
to pretext...@googlegroups.com
Yes, adding \raggedbottom is sufficient to clear up a number of differences between one side and two side: the tcolorbox squashing, differences in page breaking, etc.

I understand why we like \flushbottom in print though!
If I wanted to keep that aesthetic, my alternative would be to add a very small after skip to stop boxes from overlapping, and live with differences in page breaking.

(When there are a lot of figures in the margin, those differences are a big pain, because I'd have to do manual adjustments twice!)

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/0a8d40e1-8df4-0c7d-553f-bfc44cb47496%40ups.edu.

Rob Beezer

unread,
Nov 5, 2021, 9:34:31 PM11/5/21
to pretext...@googlegroups.com
On 8/9/21 5:38 PM, Sean Fitzpatrick wrote:
> Yes, adding \raggedbottom is sufficient to clear up a number of differences
> between one side and two side: the tcolorbox squashing, differences in page
> breaking, etc.

Ragged bottom, or flush bottom, now you can set your preference and go from
there. See pretext-announce, just now.

(Been on my to-do list for *months*.)

Rob

Sean Fitzpatrick

unread,
Nov 8, 2021, 5:03:08 PM11/8/21
to pretext...@googlegroups.com
Nice! Thanks. I was planning to do some PreTeXt stuff this week (maintenance, mostly) because it's our fall break.
But now I've got a kid at home sick. Sigh.

--

Reply all
Reply to author
Forward
0 new messages