Refactoring LaTeX conversions

19 views
Skip to first unread message

Rob Beezer

unread,
Jul 8, 2026, 11:28:12 AMJul 8
to prete...@googlegroups.com
* With my assistant, we have done a big refactor so that
"pretext-latex-common.xsl" really looks more like a set of "common" templates to
be shared across the LaTeX conversions: "regular", classic, and Beamer. For
Oscar: the "pretext-classic" stylesheet was not touched in this branch/PR.
https://github.com/PreTeXtBook/pretext/pull/3017

* The LaTeX conversions define a handful of "internal, semantic macros" (well,
66 of them it seems). \mono{} is a good example. Just a useful device to
isolate definitions in the LaTeX preamble. Our \alert, was conflucting with
Beamer's "theme-aware" \alert. So we undertook the long-mooted crude
"name-spacing" of prefixing these macros with \ptx. So we now have \ptxmono and
\ptxalert. The latter allows us to defer to Beamer in this situation.

These macros are not a public API, so we can (and just did) change them at will.
But perhaps you have messed with them via some addition to your preamble? So,
the courtesy of a heads-up.

For Oscar: a few cosmetic changes
https://github.com/PreTeXtBook/pretext/pull/3015


@Oscar - I'm going to send you some questions off-list, since they barely make
sense to me and likely won't add any value here publicly.

Rob

Sean Fitzpatrick

unread,
Jul 15, 2026, 3:37:18 PMJul 15
to PreTeXt development
Greg is reporting problems building APEX to PDF due to \ptxsetparstyle.
I am guessing that if we are using XSL to set tcolorbox styles, we need to replace instances of \setparstyle with \ptxsetparstyle?

Rob Beezer

unread,
Jul 15, 2026, 3:50:04 PMJul 15
to prete...@googlegroups.com
On 7/15/26 12:37, Sean Fitzpatrick wrote:
> Greg is reporting problems building APEX to PDF due to \ptxsetparstyle.

Does APEX set/use a custom LaTeX style?

> I am guessing that if we are using XSL to set tcolorbox styles, we need to
> replace instances of \setparstyle with \ptxsetparstyle?

Sounds right, see https://github.com/PreTeXtBook/pretext/pull/3015

The \ptx* series are meant to be *internal*. But, of course, LaTeX gives us
very few tools to enforce that. Other than what just happened. ;-)

Rob

>
> On Wednesday, July 8, 2026 at 9:28:12 AM UTC-6 Rob Beezer wrote:
>
> * With my assistant, we have done a big refactor so that
> "pretext-latex-common.xsl" really looks more like a set of "common"
> templates to
> be shared across the LaTeX conversions: "regular", classic, and Beamer. For
> Oscar: the "pretext-classic" stylesheet was not touched in this branch/PR.
> https://github.com/PreTeXtBook/pretext/pull/3017 <https://github.com/
> PreTeXtBook/pretext/pull/3017>
>
> * The LaTeX conversions define a handful of "internal, semantic macros" (well,
> 66 of them it seems). \mono{} is a good example. Just a useful device to
> isolate definitions in the LaTeX preamble. Our \alert, was conflucting with
> Beamer's "theme-aware" \alert. So we undertook the long-mooted crude
> "name-spacing" of prefixing these macros with \ptx. So we now have \ptxmono and
> \ptxalert. The latter allows us to defer to Beamer in this situation.
>
> These macros are not a public API, so we can (and just did) change them at
> will.
> But perhaps you have messed with them via some addition to your preamble? So,
> the courtesy of a heads-up.
>
> For Oscar: a few cosmetic changes
> https://github.com/PreTeXtBook/pretext/pull/3015 <https://github.com/
> PreTeXtBook/pretext/pull/3015>
>
>
> @Oscar - I'm going to send you some questions off-list, since they barely make
> sense to me and likely won't add any value here publicly.
>
> Rob
>
> --
> 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/
> b05f9298-269f-4930-b60d-ae12ab039264n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/b05f9298-269f-4930-b60d-
> ae12ab039264n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Rob Beezer

unread,
Jul 15, 2026, 3:50:04 PMJul 15
to prete...@googlegroups.com
On 7/15/26 12:37, Sean Fitzpatrick wrote:
> Greg is reporting problems building APEX to PDF due to \ptxsetparstyle.

Does APEX set/use a custom LaTeX style?

> I am guessing that if we are using XSL to set tcolorbox styles, we need to
> replace instances of \setparstyle with \ptxsetparstyle?

Sounds right, see https://github.com/PreTeXtBook/pretext/pull/3015

The \ptx* series are meant to be *internal*. But, of course, LaTeX gives us
very few tools to enforce that. Other than what just happened. ;-)

Rob

>
> On Wednesday, July 8, 2026 at 9:28:12 AM UTC-6 Rob Beezer wrote:
>
> * With my assistant, we have done a big refactor so that
> "pretext-latex-common.xsl" really looks more like a set of "common"
> templates to
> be shared across the LaTeX conversions: "regular", classic, and Beamer. For
> Oscar: the "pretext-classic" stylesheet was not touched in this branch/PR.
> https://github.com/PreTeXtBook/pretext/pull/3017 <https://github.com/
> PreTeXtBook/pretext/pull/3017>
>
> * The LaTeX conversions define a handful of "internal, semantic macros" (well,
> 66 of them it seems). \mono{} is a good example. Just a useful device to
> isolate definitions in the LaTeX preamble. Our \alert, was conflucting with
> Beamer's "theme-aware" \alert. So we undertook the long-mooted crude
> "name-spacing" of prefixing these macros with \ptx. So we now have \ptxmono and
> \ptxalert. The latter allows us to defer to Beamer in this situation.
>
> These macros are not a public API, so we can (and just did) change them at
> will.
> But perhaps you have messed with them via some addition to your preamble? So,
> the courtesy of a heads-up.
>
> For Oscar: a few cosmetic changes
> https://github.com/PreTeXtBook/pretext/pull/3015 <https://github.com/
> PreTeXtBook/pretext/pull/3015>
>
>
> @Oscar - I'm going to send you some questions off-list, since they barely make
> sense to me and likely won't add any value here publicly.
>
> Rob
>

Sean Fitzpatrick

unread,
Jul 15, 2026, 3:57:59 PMJul 15
to PreTeXt development
I've got 5-600 lines of extra xsl for styling in APEX (margin figures and all that).

We set tcolorbox styles for theorem, definition, etc. Various templates using tcb-style mode.
Most of these have the option "before upper app={\setparstyle}" 

I don't recall why. Most of these were originally copied from other style files. 

Greg was worried that he broke something because the .tex compilation suddenly started failing on the \setparstyle command.

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/MTAwMDAzdW9udFptTlc.1784145001%40pnsh.

Rob Beezer

unread,
Jul 15, 2026, 8:02:27 PMJul 15
to prete...@googlegroups.com
That macro is designed to solve some problems with minipage and parbox
enviroments, which I think tcolorbox builds on.

mode="tcb-style" is the public interface, but I do not think this macro has a
place there. But it is not on the list of macros supported for style writing
(yes, this list is buried in the code). And I don't think it is used in any of
the (copious) examples.

Now, if you are re-defining the environments themselves (which is where
\setparstyle is normally used) then you are coloring outside the lines. Changes
to those are not supported as part of style writing. I have tried to do it for
historical aspects of FCLA and it is a really bad idea.

If you can find mis-leading documentation, we can see about adjustments.

Thanks,
Rob

On 7/15/26 12:57, Sean Fitzpatrick wrote:
> I've got 5-600 lines of extra xsl for styling in APEX (margin figures and all that).
>
> We set tcolorbox styles for theorem, definition, etc. Various templates using
> tcb-style mode.
> Most of these have the option "before upper app={\setparstyle}"
>
> I don't recall why. Most of these were originally copied from other style files.
>
> Greg was worried that he broke something because the .tex compilation suddenly
> started failing on the \setparstyle command.
>
> On Wed, Jul 15, 2026, 2:50 p.m. 'Rob Beezer' via PreTeXt development <pretext-
> d...@googlegroups.com <mailto:prete...@googlegroups.com>> wrote:
>
> On 7/15/26 12:37, Sean Fitzpatrick wrote:
> > Greg is reporting problems building APEX to PDF due to \ptxsetparstyle.
>
> Does APEX set/use a custom LaTeX style?
>
> > I am guessing that if we are using XSL to set tcolorbox styles, we need to
> > replace instances of \setparstyle with \ptxsetparstyle?
>
> Sounds right, see https://github.com/PreTeXtBook/pretext/pull/3015 <https://
> github.com/PreTeXtBook/pretext/pull/3015>
>
> The \ptx* series are meant to be *internal*.  But, of course, LaTeX gives us
> very few tools to enforce that.  Other than what just happened.  ;-)
>
> Rob
>
> >
> > On Wednesday, July 8, 2026 at 9:28:12 AM UTC-6 Rob Beezer wrote:
> >
> >     * With my assistant, we have done a big refactor so that
> >     "pretext-latex-common.xsl" really looks more like a set of "common"
> >     templates to
> >     be shared across the LaTeX conversions: "regular", classic, and
> Beamer. For
> >     Oscar: the "pretext-classic" stylesheet was not touched in this
> branch/PR.
> > https://github.com/PreTeXtBook/pretext/pull/3017 <https://github.com/
> PreTeXtBook/pretext/pull/3017> <https://github.com/ <https://github.com/>
> >     PreTeXtBook/pretext/pull/3017>
> >
> >     * The LaTeX conversions define a handful of "internal, semantic
> macros" (well,
> >     66 of them it seems). \mono{} is a good example. Just a useful device to
> >     isolate definitions in the LaTeX preamble. Our \alert, was
> conflucting with
> >     Beamer's "theme-aware" \alert. So we undertook the long-mooted crude
> >     "name-spacing" of prefixing these macros with \ptx. So we now have
> \ptxmono and
> >     \ptxalert. The latter allows us to defer to Beamer in this situation.
> >
> >     These macros are not a public API, so we can (and just did) change
> them at
> >     will.
> >     But perhaps you have messed with them via some addition to your
> preamble? So,
> >     the courtesy of a heads-up.
> >
> >     For Oscar: a few cosmetic changes
> > https://github.com/PreTeXtBook/pretext/pull/3015 <https://github.com/
> PreTeXtBook/pretext/pull/3015> <https://github.com/ <https://github.com/>
> >     PreTeXtBook/pretext/pull/3015>
> >
> >
> >     @Oscar - I'm going to send you some questions off-list, since they
> barely make
> >     sense to me and likely won't add any value here publicly.
> >
> >     Rob
> >
> > --
> > 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%2Bunsu...@googlegroups.com> <mailto:pretext- <mailto:pretext->
> > dev+uns...@googlegroups.com
> <mailto:dev%2Bunsu...@googlegroups.com>>.
> > To view this discussion visit https://groups.google.com/d/msgid/pretext-
> dev/ <https://groups.google.com/d/msgid/pretext-dev/>
> > b05f9298-269f-4930-b60d-ae12ab039264n%40googlegroups.com
> <http://40googlegroups.com> <https://
> > groups.google.com/d/msgid/pretext-dev/b05f9298-269f-4930-b60d- <http://
> groups.google.com/d/msgid/pretext-dev/b05f9298-269f-4930-b60d->
> > ae12ab039264n%40googlegroups.com?utm_medium=email&utm_source=footer
> <http://40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> 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%2Bunsu...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/
> MTAwMDAzdW9udFptTlc.1784145001%40pnsh <https://groups.google.com/d/msgid/
> pretext-dev/MTAwMDAzdW9udFptTlc.1784145001%40pnsh>.
>
> --
> 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
> CAH%2BNcPYkk0Csq%3DPgDnf3_dngfQEbqXRi90SAp6Mh%3DbiiE4_%3DaA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pretext-dev/
> CAH%2BNcPYkk0Csq%3DPgDnf3_dngfQEbqXRi90SAp6Mh%3DbiiE4_%3DaA%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

Sean Fitzpatrick

unread,
Jul 15, 2026, 8:50:02 PMJul 15
to PreTeXt development
I've got some blocks in my xsl like the following: 

<xsl:template match="&DEFINITION-LIKE;" mode="tcb-style">
    <xsl:text>before upper app={\setparstyle}, fonttitle=\normalfont\bfseries, before skip = \baselineskip, colbacktitle=yellow!90!black!30, colframe=yellow!95!black!60, colback=white!95!yellow, coltitle=black, titlerule=-0.3pt,</xsl:text>
</xsl:template>

Comments suggest that I borrowed from Sound Writing, ORCCA, and CLP, as well as the PreTeXt guide. But this part of my code is at least 5 years old.

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/MTAwMDAxZzBLUjBYTmk.1784160144%40pnsh.

Rob Beezer

unread,
Jul 16, 2026, 11:39:55 AMJul 16
to prete...@googlegroups.com
> borrowed from Sound Writing, ORCCA, and CLP

A rogue's gallery of projects that like to go off-road! ;-)

You are using "tcb-style" mostly as intended.

Style directives like "colbacktitle=yellow!90!black!30" are exactly the intended
use.

A directive like "before upper app={\setparstyle}" is procedularly correct, but
you won't see it anywhere in the examples in xsl/latex/. And \ptxsetparstyle
(nee \setparstyle) is idempotent, so you are not accomplishing anything when
this is already being set, as it appears to be for most all environments. The
list in "tcb-style" is like CSS, it piles on to whatever is present by default,
and can override those directives.

"before skip = \baselineskip" may be accomplishing something - I'd review a
sample with and without, using an on-screen ruler, to see what you think of the
effect.

Rob

PS I read "5-600" lines of extra XSL as "5,600" when I first glanced at this.
And it didn't even surpise me. ;-)

On 7/15/26 17:49, Sean Fitzpatrick wrote:
> I've got some blocks in my xsl like the following:
>
> <xsl:template match="&DEFINITION-LIKE;" mode="tcb-style">
>     <xsl:text>before upper app={\setparstyle}, fonttitle=\normalfont\bfseries,
> before skip = \baselineskip, colbacktitle=yellow!90!black!30, colframe=yellow!
> 95!black!60, colback=white!95!yellow, coltitle=black, titlerule=-0.3pt,</xsl:text>
> </xsl:template>
>
> Comments suggest that I borrowed from Sound Writing, ORCCA, and CLP, as well as
> the PreTeXt guide. But this part of my code is at least 5 years old.
>
> On Wed, Jul 15, 2026, 7:02 p.m. 'Rob Beezer' via PreTeXt development <pretext-
> > d...@googlegroups.com <mailto:d...@googlegroups.com> <mailto:pretext-
> d...@googlegroups.com <mailto:prete...@googlegroups.com>>> wrote:
> >
> >     On 7/15/26 12:37, Sean Fitzpatrick wrote:
> >      > Greg is reporting problems building APEX to PDF due to
> \ptxsetparstyle.
> >
> >     Does APEX set/use a custom LaTeX style?
> >
> >      > I am guessing that if we are using XSL to set tcolorbox styles, we
> need to
> >      > replace instances of \setparstyle with \ptxsetparstyle?
> >
> >     Sounds right, see https://github.com/PreTeXtBook/pretext/pull/3015
> <https://github.com/PreTeXtBook/pretext/pull/3015> <https://
> > github.com/PreTeXtBook/pretext/pull/3015 <http://github.com/PreTeXtBook/
> pretext/pull/3015>>
> >
> >     The \ptx* series are meant to be *internal*.  But, of course, LaTeX
> gives us
> >     very few tools to enforce that.  Other than what just happened.  ;-)
> >
> >     Rob
> >
> >      >
> >      > On Wednesday, July 8, 2026 at 9:28:12 AM UTC-6 Rob Beezer wrote:
> >      >
> >      >     * With my assistant, we have done a big refactor so that
> >      >     "pretext-latex-common.xsl" really looks more like a set of
> "common"
> >      >     templates to
> >      >     be shared across the LaTeX conversions: "regular", classic, and
> >     Beamer. For
> >      >     Oscar: the "pretext-classic" stylesheet was not touched in this
> >     branch/PR.
> >      > https://github.com/PreTeXtBook/pretext/pull/3017 <https://
> github.com/PreTeXtBook/pretext/pull/3017> <https://github.com/ <https://
> github.com/>
> >     PreTeXtBook/pretext/pull/3017> <https://github.com/ <https://
> github.com/> <https://github.com/ <https://github.com/>>
> >      >     PreTeXtBook/pretext/pull/3017>
> >      >
> >      >     * The LaTeX conversions define a handful of "internal, semantic
> >     macros" (well,
> >      >     66 of them it seems). \mono{} is a good example. Just a useful
> device to
> >      >     isolate definitions in the LaTeX preamble. Our \alert, was
> >     conflucting with
> >      >     Beamer's "theme-aware" \alert. So we undertook the long-mooted
> crude
> >      >     "name-spacing" of prefixing these macros with \ptx. So we now have
> >     \ptxmono and
> >      >     \ptxalert. The latter allows us to defer to Beamer in this
> situation.
> >      >
> >      >     These macros are not a public API, so we can (and just did) change
> >     them at
> >      >     will.
> >      >     But perhaps you have messed with them via some addition to your
> >     preamble? So,
> >      >     the courtesy of a heads-up.
> >      >
> >      >     For Oscar: a few cosmetic changes
> >      > https://github.com/PreTeXtBook/pretext/pull/3015 <https://
> github.com/PreTeXtBook/pretext/pull/3015> <https://github.com/ <https://
> github.com/>
> >     PreTeXtBook/pretext/pull/3015> <https://github.com/ <https://
> github.com/> <https://github.com/ <https://github.com/>>
> >      >     PreTeXtBook/pretext/pull/3015>
> >      >
> >      >
> >      >     @Oscar - I'm going to send you some questions off-list, since they
> >     barely make
> >      >     sense to me and likely won't add any value here publicly.
> >      >
> >      >     Rob
> >      >
> >      > --
> >      > 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%2Bunsu...@googlegroups.com> <mailto:pretext- <mailto:pretext->
> > dev%2Bunsu...@googlegroups.com
> <mailto:dev%252Buns...@googlegroups.com>> <mailto:pretext-
> <mailto:pretext-> <mailto:pretext- <mailto:pretext->>
> >      > dev+uns...@googlegroups.com
> <mailto:dev%2Bunsu...@googlegroups.com>
> >     <mailto:dev%2Bunsu...@googlegroups.com
> <mailto:dev%252Buns...@googlegroups.com>>>.
> >      > To view this discussion visit https://groups.google.com/d/msgid/
> pretext- <https://groups.google.com/d/msgid/pretext->
> >     dev/ <https://groups.google.com/d/msgid/pretext-dev/ <https://
> groups.google.com/d/msgid/pretext-dev/>>
> >      > b05f9298-269f-4930-b60d-ae12ab039264n%40googlegroups.com
> <http://40googlegroups.com>
> >     <http://40googlegroups.com <http://40googlegroups.com>> <https://
> >      > groups.google.com/d/msgid/pretext-dev/b05f9298-269f-4930-b60d-
> <http://groups.google.com/d/msgid/pretext-dev/b05f9298-269f-4930-b60d-> <http://
> > groups.google.com/d/msgid/pretext-dev/b05f9298-269f-4930-b60d- <http://
> groups.google.com/d/msgid/pretext-dev/b05f9298-269f-4930-b60d->>
> >      > ae12ab039264n%40googlegroups.com?
> utm_medium=email&utm_source=footer <http://40googlegroups.com?
> utm_medium=email&utm_source=footer>
> >     <http://40googlegroups.com?utm_medium=email&utm_source=footer
> <http://40googlegroups.com?utm_medium=email&utm_source=footer>>>.
> >
> >     --
> >     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%2Bunsu...@googlegroups.com> <mailto:pretext- <mailto:pretext->
> > dev%2Bunsu...@googlegroups.com
> <mailto:dev%252Buns...@googlegroups.com>>.
> >     To view this discussion visit https://groups.google.com/d/msgid/
> pretext-dev/ <https://groups.google.com/d/msgid/pretext-dev/>
> >     MTAwMDAzdW9udFptTlc.1784145001%40pnsh <https://groups.google.com/d/
> msgid/ <https://groups.google.com/d/msgid/>
> >     pretext-dev/MTAwMDAzdW9udFptTlc.1784145001%40pnsh>.
> >
> > --
> > 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-
> CAH%2BNcPYkk0Csq%3DPgDnf3_dngfQEbqXRi90SAp6Mh%3DbiiE4_%3DaA%40mail.gmail.com
> <http://40mail.gmail.com>
> > <https://groups.google.com/d/msgid/pretext-dev/ <https://
> groups.google.com/d/msgid/pretext-dev/>
> >
> CAH%2BNcPYkk0Csq%3DPgDnf3_dngfQEbqXRi90SAp6Mh%3DbiiE4_%3DaA%40mail.gmail.com
> <http://40mail.gmail.com>?
> > utm_medium=email&utm_source=footer>.
>
> --
> 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
> MTAwMDAxZzBLUjBYTmk.1784160144%40pnsh <https://groups.google.com/d/msgid/
> pretext-dev/MTAwMDAxZzBLUjBYTmk.1784160144%40pnsh>.
>
> --
> 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/
> CAH%2BNcPZfX5-Jon5qKwyhCHz_PJ3m6jsfHS-JaYhWeJ--T70djw%40mail.gmail.com <https://
> groups.google.com/d/msgid/pretext-dev/CAH%2BNcPZfX5-Jon5qKwyhCHz_PJ3m6jsfHS-
> JaYhWeJ--T70djw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Sean Fitzpatrick

unread,
Jul 16, 2026, 12:50:59 PMJul 16
to PreTeXt development
Ok, so maybe I can remove the \setparstyle with no effect.

The before skip is there because there were some instances where preceding text was colliding with a theorem or definition. This ensures a bit of a gap.

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/MTAwMDAwLjkuSVltT00.1784216392%40pnsh.
Reply all
Reply to author
Forward
0 new messages