Floating asides

7 views
Skip to first unread message

Jeremy Sylvestre

unread,
Aug 14, 2025, 11:49:45 AMAug 14
to PreTeXt development
(Oh no, another thread about asides from Jeremy.....)

Don't worry, this time I come bearing code.

I've got a branch where I make two small changes to floating asides in HTML output.

Code:

Sample output:

Changes:

1. When the sidebar is hidden, reduce the min screen width that triggers asides to float to the margin.

2. Implement @valign for ASIDE-LIKE.
The (possibly incorrect) assumption here is that generally the content of an aside is related to the immediately preceding content more than it is to the immediately following content. But current vertical placement of floating asides suggest to the reader that the reverse is true, especially when the content of the aside is unfurled.

So I've implemented @valign for ASIDE-LIKE (possible values of top/middle/bottom) that positions the floating aside in the margin near the top/middle/bottom of the preceding paragraph/figure/etc. (Currently the default value is "bottom" but maybe the default value should be "none" and no adjustment is made, so that the current placement of floating asides is the default.)

Before you say "this is about presentation and PreTeXt separates content from presentation," I would argue that this is about content: it gives the author the opportunity to (roughly) link the content of the aside to a more specific portion of the surrounding content.

Note that this is not polished code, as I haven't tested or thought through the various ways this could go awry. (What if an aside is the first element in a division and so has no preceding sibling? What if the preceding sibling of an aside is another aside? What if the preceding content is knowled? What if the aside is part of knowled content? etc.)

Anyway, just thought I would throw this out there to see if there is any interest before pursuing it further.

Cheers,
Jeremy S.

Rob Beezer

unread,
Aug 14, 2025, 1:14:55 PMAug 14
to prete...@googlegroups.com
> "this is about presentation and PreTeXt separates content from presentation,"

You were about a paragraph late. The voice in my head had already said it.
Screamed it.

Well, no, not the screaming part. And no, not a <foreign
xml:kang="VA-lat">prima facie</foreign> objection.

We do make concessions to layout. And sometimes we think of them as "hints",
even if that dilutes your rationale.

Sounds like this would be useful for LaTeX output as well. Sorta like Sean F's
by-hand vertical adjustments.

Rob

On 8/14/25 08:49, Jeremy Sylvestre wrote:
> (Oh no, another thread about asides from Jeremy.....)
>
> Don't worry, this time I come bearing code.
>
> I've got a branch where I make two small changes to floating asides in HTML output.
>
> Code:
> https://github.com/PreTeXtBook/pretext/compare/
> master...jjrsylvestre:pretext:aside-valign <https://github.com/PreTeXtBook/
> pretext/compare/master...jjrsylvestre:pretext:aside-valign>
>
> Sample output:
> https://sites.ualberta.ca/~jsylvest/pretext-dev/aside-valign/section-
> textual.html <https://sites.ualberta.ca/~jsylvest/pretext-dev/aside-valign/
> section-textual.html>
> --
> 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+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/
> CALMYOncmFUY2082SjhwMXwMravB1kZWKFSHV3PVAfAmJyQLOjw%40mail.gmail.com <https://
> groups.google.com/d/msgid/pretext-dev/
> CALMYOncmFUY2082SjhwMXwMravB1kZWKFSHV3PVAfAmJyQLOjw%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

Sean Fitzpatrick

unread,
Aug 14, 2025, 6:59:42 PMAug 14
to PreTeXt development
I'm just glad Jeremy used valign and not vshift or I'd have to run off and redo my custom XSL. 

But I'm cheating by putting what are clearly publisher settings in my ptx source to facilitate print. 

At some point (next summer, maybe?) I should see if I can leverage Alex's pagebreak system to accommodate my margin placement data. 
Then, if two versions of the book needed different adjustments, I just modify each publisher file accordingly, instead of abusing versioning like I am now.

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDAxNy5iZWV6ZXI.1755191692%40pnsh.

Andrew Scholer

unread,
Aug 15, 2025, 1:41:21 AMAug 15
to prete...@googlegroups.com
I like both parts.  The vertical alignment is a big win in terms of aligning the aside.

For the alignment, I wish there the asides could be in the right position before they were rendered so they didn't jump after the initial load. But I don't know that there is a good/clean way to do that. Maybe the bottom aligned case could be placed in a pretty good place with just CSS instead of the ideal place with JS?


Andrew Scholer (he/him/his)
Computer Science Instructor
Chemeketa Community College


Reply all
Reply to author
Forward
0 new messages