Prefigure diagrams not fully displaying

45 views
Skip to first unread message

Drew Lewis

unread,
Feb 9, 2026, 12:20:56 PM (22 hours ago) Feb 9
to PreTeXt support
I am seeing some sporadic behavior where a Prefigure image is not displaying all of a <graph> element when it is used in our PreTeXt book.  

An example is here: Item A
The corresponding SVG that is supposed to be displayed appears as intended if I look at it directly.  This suggests to me that the problem is with the Prefigure-PreTeXt integration rather than with Prefigure itself.

There are other examples within that section.  Here is the pull request where this came up in our TBIL repository, in case those are helpful.

Thanks in advance,
Drew

Rob Beezer

unread,
Feb 9, 2026, 1:39:32 PM (20 hours ago) Feb 9
to pretext...@googlegroups.com
I know I could figure this out completely from your complete report, but on fone right now. All the same: it appears from the filenames involved that these have annotations. The embedding is radically different in that case.

On February 9, 2026 9:20:55 AM PST, Drew Lewis <drew....@gmail.com> wrote:
>I am seeing some sporadic behavior where a Prefigure image is not
>displaying all of a <graph> element when it is used in our PreTeXt book.
>
>An example is here: Item A
><https://eb174895.tbil.pages.dev/preview/precalculus/PF3#PF3-3-6-1-3-1>
>The corresponding SVG that is supposed to be displayed appears as intended
>if I look at it directly
><https://eb174895.tbil.pages.dev/preview/precalculus/generated/prefigure/prefigure-PF3-sin-restriction1-diagcess.svg>.
>This suggests to me that the problem is with the Prefigure-PreTeXt
>integration rather than with Prefigure itself.
>
>There are other examples within that section
><https://eb174895.tbil.pages.dev/preview/precalculus/PF3>. Here is the pull
>request <https://github.com/TeamBasedInquiryLearning/library/pull/921>
>where this came up in our TBIL repository
><https://github.com/TeamBasedInquiryLearning/library>, in case those are

David Austin

unread,
Feb 9, 2026, 1:42:35 PM (20 hours ago) Feb 9
to pretext...@googlegroups.com
This isn't a problem with PreFigure proper but rather some problem with an interaction between the diagcess library, which is being used to render the diagrams, and PreTeXt.  As Drew notes, the SVGs themselves are OK.  When I look locally with diagcess, everything also looks OK.  So it seems that this only appears when diagcess is being used within a PreTeXt document.  As Rob just wrote, that's quite different.  I'll reach out to the author of diagcess, but maybe someone here has some idea.

--
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/c7041545-d950-41b5-9c37-4bb7cad970ben%40googlegroups.com.

Andrew Scholer

unread,
Feb 9, 2026, 2:54:24 PM (19 hours ago) Feb 9
to pretext...@googlegroups.com
Are we talking light mode or dark mode?

I think in dark mode there is an issue related to CSS. The svg's are relying on "currentColor" to set the color of text. That should pick up and use the foreground color of the context. In dark mode, the current color is light (light text on dark background). So text is being rendered as light on light.

If desired, I can PR something that uses CSS to force that text to black in the PTX CSS. Though that might be undesired if the goal is for that text to be able to pick up color from the surrounding content. (In which case better background handling is needed.)

As for the edges of the functions getting chopped off, it looks like that is at least somehow related to the clip-path attribute on the <path> that is drawing the function. If you find it in the Chrome inspector panel and delete the clip-path, the entire curve renders. (See screenshot for what to delete)


image.png


David Austin

unread,
Feb 9, 2026, 4:48:17 PM (17 hours ago) Feb 9
to pretext...@googlegroups.com
The value of the @clip-path attribute is appropriate since the inspector shows it to be the rectangle containing the grid, which is what PreFigure intends.  The diagram also looks right when viewed as a separate SVG or when loading it with diagcess directly into an HTML page.  So it seems that there is some interaction between PreTeXt and diagcess that is causing this behavior.  We updated diagcess a few weeks ago, and that update had some changes to the way clipping is handled.  But I can't see into diagcess, and I'm not familiar with what PreTeXt could be doing so it's not clear to me what is going on.  I also see that removing the @clip-path attribute restore the restores the rest of the graph.

David Austin

unread,
6:33 AM (3 hours ago) 6:33 AM
to pretext...@googlegroups.com
While we're waiting to learn more about how diagcess handles the clipping, there is a pretty simple workaround for Drew's examples.  By default, graphs are clipped to the bounding box, but this can be disabled by adding the attribute @cliptobbox="no" to the #graph element.

David
Reply all
Reply to author
Forward
0 new messages