PDF with images on top of paragraphs

24 views
Skip to first unread message

Rob Beezer

unread,
Aug 23, 2023, 2:21:07 PM8/23/23
to prete...@googlegroups.com
Alerting folks to a LaTeX bug, also in hopes of getting some testing along the
way. Original report came from a colleague off-list. I have a vague idea this
might have been reported before?

Begin with a block implemented as a tcolorbox, which is not obvious, but is most
things, a divisional "exercise" in the original report. Author a single "p",
followed by a bare "image" (which is in an interior tcolorbox). Rendered in a
PDF, the image will overwrite a little bit of the bottom of the "p". May also
affect an "image" in a "figure" but seems rarer? Oscar can provoke it an
"example" rather than an "exercise".

Great debugging and Googling session with Oscar at yesterday's drop-in. A fix
may be to adjust how tcolorbox uses "parboxes" and restore indentation of
paragraphs. But it'll be delicate and I'd like to do it in waves, not all at once.

If you see the problem in your PDF output and you are comfortable with the CLI
nightlies, please volunteer to help test (once I actually try something, which
I'll report here).

Thanks,
Rob

Rob Beezer

unread,
Aug 24, 2023, 2:35:23 PM8/24/23
to prete...@googlegroups.com
I've just pushed a fix/change for "exercise" within an "exercises" (and not in
an "exercisegroup"). Feel free to build a PDF and make sure these exercises
look OK. Placement of the number itself, and indentation, took the most
attention. Website is re-building now.

Rob

Rob Beezer

unread,
Aug 24, 2023, 2:47:41 PM8/24/23
to prete...@googlegroups.com
Really just for Oscar. tcolorbox has a "hooks" library. The key "before upper
app" will append code to whatever else is in "before upper", as I understand it.
In any event, setting the parindent that way seems to have been the only
change necessary (which is giving me some confidence, since this might have been
the trickiest situation). Seems to work for EXAMPLE-LIKE too (not released yet).

What PDF image were you testing with on Tuesday? If it is not in the repo, can
you send it to me off-list? I am suspecting the PDFs built by the original
non-poster are partly to blame (but we should support them anyway).

Alex Jordan

unread,
Aug 24, 2023, 5:07:13 PM8/24/23
to prete...@googlegroups.com
Your recent commits may have this covered. In the past when I
encountered this while producing a final PDF for sending to the
printer, I would correct the issue by inserting \leavevmode in the
right places (written into my post-processing script, of course). Just
mentioning that in case it is relevant and an alternative solution is
needed at some point.
> --
> You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDAwOS5iZWV6ZXI.1692902859%40quikprotect.

Rob Beezer

unread,
Aug 25, 2023, 2:46:35 PM8/25/23
to prete...@googlegroups.com
OK, seven changes this time to the LaTeX conversion. This should cover
"exercise" in "exercises", including in "exercisegroup" and including in columns
of an exercisegroup. Plus "hint", "answer", and "solution" of same.

Look for overlaps with prior material, bad/missing indentation, overall
alignment at a left margin.

Maybe I'll do the full collection of blocks next...

Testing with the nightlies is appreciated before this goes too far. Thanks.

Rob

Rob Beezer

unread,
Aug 25, 2023, 2:54:02 PM8/25/23
to prete...@googlegroups.com
On 8/24/23 14:06, Alex Jordan wrote:
> I would correct the issue by inserting \leavevmode in the
> right places (written into my post-processing script, of course).

Or use/dependence on \leavevmode has always made me nervous.

With the push a few minutes ago, every aspect of divisional exercises has had
"parbox=false" turned off, and paragraph indentation of the resulting "true"
parbox has been restored through a tcolorbox hook.

If you were able to disable a \leavevmode in one of those situations (or in
upcoming situations) and get good results, that would be useful information.

My secret desire is to finish disabling the (experimental) faux parbox and then
go hunting the \leavevmode we routinely add in. But I think we were adding
\leavevmode from before the move to tcolorbox. git history (carefully curated!)
could answer that question.

Thanks for the input on this one.

Rob


Rob Beezer

unread,
Aug 25, 2023, 3:00:19 PM8/25/23
to prete...@googlegroups.com
On 8/25/23 11:53, Rob Beezer wrote:
> My secret desire is to finish disabling the (experimental) faux parbox and then
> go hunting the \leavevmode we routinely add in.  But I think we were adding
> \leavevmode from before the move to tcolorbox.  git history (carefully curated!)
> could answer that question.

Three paces in the code where we routinely write out a \leavevmode :

- image
- sage
- sidebyside

All three are consumers of tcolorbox, and the first is implicated by the
original non-poster.

Rob

Rob Beezer

unread,
Aug 28, 2023, 12:52:13 PM8/28/23
to prete...@googlegroups.com
And the original non-poster reports off-list that the pervasive problem of PDFs
overlapping an initial paragraph has been fixed.

So look for more of this to come.

Rob

Rob Beezer

unread,
Aug 30, 2023, 11:33:33 AM8/30/23
to prete...@googlegroups.com
Some miscellaneous structures have now been changed in the same ways as before.
Most popular: inline exercises, and proofs. Structures that do not have inline
titles, such as "assemblage", will look slightly different as their first
paragraph will now have indentation.

@Sean: "aside" is an affected item. Not sure if that will impact your work with
those.

Rob

Rob Beezer

unread,
Sep 1, 2023, 1:57:51 PM9/1/23
to prete...@googlegroups.com
Slowly coming to appreciate that these vertical overlaps and mis-alignments are
maybe more a function of the containers, not the items inside them. So we have
falsely accused things like "sage" or "image" as being problems, when it was
maybe more the fault of things like "listing" or "figure". As a practical
matter, deleting some LaTeX \leavevmode after the tcolorbox/parbox changes has
had good results. (These were just experiments, not pushed yet.) Refreshing
website samples now.

Latest update affects "program", "console", "sage", "figure", "table",
"listing", and "list", so be on the lookout for side-effects there.

One more change to do, but it is big, affecting all of the blocks in the
majority of the *-LIKE series; THEOREM-LIKE, EXAMPLE-LIKE, REMARK-LIKE, ....

Rob Beezer

unread,
Sep 4, 2023, 8:00:14 PM9/4/23
to prete...@googlegroups.com
And finally, a whole pile of "popular" blocks. Again, you are looking for
vertical overlaps, vertical misalignment, weird (paragraph) indentation.

THEOREM-LIKE
AXIOM-LIKE
REMARK-LIKE
COMPUTATION-LIKE
OPENPROBLEM-LIKE
PROJECT-LIKE
inline exercise ("Checkpoint")
ASIDE-LIKE
DEFINITION-LIKE
EXAMPLE-LIKE

@Jeremy - time to test?

@Alex - try relieving some \leavevmode? (I'm going to experiment too.)

Rebuilding website samples right now.

Rob

Jeremy Sylvestre

unread,
Sep 5, 2023, 10:15:25 AM9/5/23
to prete...@googlegroups.com
Fixes #2029. (Closed that issue.)

Also appears to fix #746. (Not my issue so can't close.)

Thanks!!!

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.

Rob Beezer

unread,
Sep 5, 2023, 11:21:39 AM9/5/23
to prete...@googlegroups.com
Thanks for the check! Sorry it took so long...it was definitely non-trivial.

Rob
> <mailto:pretext-dev%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-dev/MTAwMDAxMS5iZWV6ZXI.1693872012%40quikprotect <https://groups.google.com/d/msgid/pretext-dev/MTAwMDAxMS5iZWV6ZXI.1693872012%40quikprotect>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com
> <mailto:pretext-dev...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-dev/CALMYOncGhfqXxMNYEMDM1Hx5JS0_-7r97bbhukyCcUH1UOVgmw%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-dev/CALMYOncGhfqXxMNYEMDM1Hx5JS0_-7r97bbhukyCcUH1UOVgmw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Rob Beezer

unread,
Sep 5, 2023, 8:28:37 PM9/5/23
to prete...@googlegroups.com
OK, done changing the behavior of tcolorboxes, hopefully for the better. Now
moving on to removing solutions to problems that are no longer problems.
Specifically, use of the dreaded LaTeX \leavevmode.

Of the three uses that remain, I think two of them involve a Sage cell first in
a "paragraphs", and a "sidebyside" first in a "paragraphs". And I suspect the
"run-in" title is the culprit.

I've removed the defensive \leavevmode for Sage cells, so look for bad placement
of those, perhaps only when first in a "paragraphs".

The other two uses will need more work. So this thread is still alive. ;-)

Rob

Sean Fitzpatrick

unread,
Sep 5, 2023, 10:05:05 PM9/5/23
to PreTeXt development
I finished my week-long fight with PDF last month and will be trying to avoid looking at it for another year...

I'm all right with indentation in an aside.

The biggest issue I have with those: I need to remove 'breakable' as an attribute, or I get really weird line spacing. (Like a paragraph, then a two line gap, then a line of text then a three line gap, more text etc.)

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.

Rob Beezer

unread,
Sep 6, 2023, 11:13:48 AM9/6/23
to prete...@googlegroups.com
On 9/5/23 19:04, Sean Fitzpatrick wrote:
> I'm all right with indentation in an aside.

I think it has always been there. We are just achieving with a
less-experimental tcolorbox procedure.

> The biggest issue I have with those: I need to remove 'breakable' as an
> attribute, or I get really weird line spacing. (Like a paragraph, then a two
> line gap, then a line of text then a three line gap, more text etc.)

Only when they go to the margins? Have you tried with the latest changes?

Rob

Sean Fitzpatrick

unread,
Sep 6, 2023, 7:05:23 PM9/6/23
to PreTeXt development
I think only in the margins, but I haven't tried otherwise.
And I have not had a chance to try the recent changes (and probably won't until the summer).

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages