Are the PreTeXt gods going to smite me?

20 views
Skip to first unread message

Peter Seibel

unread,
Jul 31, 2025, 10:59:10 AM7/31/25
to pretext...@googlegroups.com
Somewhat by accident I discovered that I can achieve an effect in CSAwesome of putting a decorative image in the left margin like this:

image.png
By using a <sidebyside> like this:

<sidebyside widths="15% 100%" margins="-20% 0%">

where the image is the first element and the paragraph (or a stack) is the second)

However, I get a bunch of errors from PreTeXt like this:

error: * PTX:ERROR:   left margin of a <sidebyside> ("-20%") is outside the interval [0%, 100%], (this may be computed, check consistency of "@margins" and "@widths")

I see where those errors are coming from but in a layout where there is space outside the margins of the text this actually seems fine. How worried should I be about these?

--
BHS Bell Schedule app: https://gigamonkeys.com/misc/bhs/


Andrew Scholer

unread,
Jul 31, 2025, 11:51:57 AM7/31/25
to pretext...@googlegroups.com
The PDF version will likely have issues.

I'm kind of surprised those values don't get clamped. Given that warning you should be prepared for some future update to silently break the trick.

Andrew Scholer

--
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 visit https://groups.google.com/d/msgid/pretext-support/CAMiqbmm55jGxa3hW0hP4Jh5rz1-vZVUCeVFDrOxrzkY1iYXr%2BA%40mail.gmail.com.

Rob Beezer

unread,
Jul 31, 2025, 12:03:43 PM7/31/25
to pretext...@googlegroups.com
On 7/31/25 08:51, Andrew Scholer wrote:
> The PDF version will likely have issues.

Right.

> I'm kind of surprised those values don't get clamped.

There are panel widths, left/right margins, and "gaps" between the panels.

You have a lot of flexibility to specify some of these and the rest get defaults
or get computed to fill out 100% width. Not clear to me how easy it would be to
adjust when one of these parameters is given incorrectly (present case) or gets
computed to be out-of-bounds. It is already a lot of work to accomodate the
flexibility, and error-check the final scenario.

But all that code is in one place (for all formats) so it is obvious where to
experiment.

Rob

Peter Seibel

unread,
Jul 31, 2025, 2:01:37 PM7/31/25
to PreTeXt support
Would it make sense to have some kind of first class <marginalia> element for putting things in the left and right margins rather than relying on abuses of <sidebyside>?

Rob Beezer

unread,
Jul 31, 2025, 2:15:00 PM7/31/25
to pretext...@googlegroups.com
It would definitely be better. But witness the current thread on #aside into
the right margin.

And it is way, way more difficult in PDF/LaTeX. Ask Sean F about that.

#aside are content (rather than decorations), so in PDF/LaTeX they pretty much
look like any other block (not in the margin).

Decoations could be easier, but also (IMHO) less important.

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-
> support+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> support/382d0347-2c58-435b-97f6-dec98830d233n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-support/382d0347-2c58-435b-97f6-
> dec98830d233n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Alex Jordan

unread,
Jul 31, 2025, 2:17:49 PM7/31/25
to pretext...@googlegroups.com
We have struggled to make things like this reliably work for PDF output. And we've tried, because of the #aside element. I have something that works in my largest book project (here's a page where it comes up), but it's not 100% stable. Occasionally it doesn't work as intended and I have to adjust my source in small ways to get it to "work". It would help if there were a PDF solution to the basic issue first (laying out something like an "aside" in the margin).


--
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.

Rob Beezer

unread,
Jul 31, 2025, 2:18:34 PM7/31/25
to pretext...@googlegroups.com
On 7/31/25 08:51, Andrew Scholer wrote:
> I'm kind of surprised those values don't get clamped.

On further thought, I guess we could just provide a default look: 0% margins,
equal panel widths, sensible gaps; whenever a parameter is out-of-bounds, and
the error message could have a warning, "You might not like what you are going
to get..."

Rob

Sean Fitzpatrick

unread,
Jul 31, 2025, 6:45:44 PM7/31/25
to pretext...@googlegroups.com
APEX has about 600 lines of extra XSL, over half of which are to handle marginalia.

The original LaTeX version of APEX had a quite sophisticated setup for this: a very lengthy LaTeX style file that created a bunch of environments specifically for margin placement. It used absolute placement: a number between 0 and 1 indicated where on the page an object should be. This has certain advantages, but it wasn't compatible with PreTeXt. 

An easy way is to use the marginnote package. It's good for asides but I don't think it can handle images (definitely not TikZ images).

I ended up using a LaTeX package called "xcoffins". I have something that works, after a *lot* of effort. Maybe someone else could find a way to do it with tcolorbox.

--
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.
Reply all
Reply to author
Forward
0 new messages