Unexpected behavior of \text{TEXT} inside \frac and \sqrt

31 views
Skip to first unread message

Charles M

unread,
May 30, 2026, 11:36:40 AMMay 30
to PreTeXt support
In my statistics book, I had been using \mathrm{} for things such as SS_E and MS_E.  I replaced \mathrm{} by \text{}, and I noticed that the placement of SS_E and MS_E (when inside \text{} braces) caused their top halves to be chopped off or the text to be split by the horizontal bar of the square root symbol.

I fixed it by changing my global command from \newcommand{\sse}{\text{SS}_{\text{E}}} to simply \newcommand{\sse}{SS_E}.

Unrelated amateur tip:
Since I'm unfamiliar with using Visual Studio Code, I use TeXShop to write all my PreTeXt code.  To expedite my coding, I created a new page for my Elgato Stream Deck with buttons to insert ready-to-use code for Tikzpictures, definitions, theorems, etc.  I ran out of available Apple macro commands, so the Stream Deck picks up the slack.  With the press of a single button, I get ready-to-use code snippets.

I've had no success implementing validation with the CLI.  Terminal returns the error that I'm using invalid options in the command.  Is it perhaps related to the fact that I must issue commands in the form python3 -m pretext new book?

As always, I am grateful for any advice.

Regards,
Charles

Rob Beezer

unread,
May 30, 2026, 2:31:37 PMMay 30
to pretext...@googlegroups.com
Dear Charles,

First attempt. Do you just want "upright" Latin letters? The chemists do this
- they like LateX for subscripts and superscripts and chemical equations, but do
not want their elements/atoms to be italic/slanted. I think.

Maybe with MathJax4 the LateX fonts/commands that do this are supported.

Just a couple of hunches, but might send you in the right direction.

The behavior of \text{} has changed from MathJax 3 to MathJax 4, but that sounds
unrelated to your problems here.

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/2f99290f-3f74-499f-bb97-e20ea893bcaan%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-support/2f99290f-3f74-499f-bb97-
> e20ea893bcaan%40googlegroups.com?utm_medium=email&utm_source=footer>.

Charles M

unread,
May 31, 2026, 12:31:15 AMMay 31
to PreTeXt support
I don't know if this helps, but I ran pretext update and pretext upgrade, and my browser (Safari) still says that it is using MathJax 3.2.2.

I tried one other thing as well.  I 'right-clicked' on a rendered equation and changed the math renderer from CHTML to SVG.  This resolved the issue with layout!  All mathematical expressions were beautiful. Now, my question is, 'How can I ensure that my students are seeing properly rendered formulas?'  Walking them through changing their math renderer in their browser may be uncomfortable for some.

In Firefox, SVG displays formulas naturally.  CHTML looks 'clunky' in Firefox, but it looks generally fine in Safari.  Should I add -f svg to my TeXShop engine?

Thank you again.

Charles

Charles M

unread,
May 31, 2026, 12:42:34 AMMay 31
to PreTeXt support
Dear Rob,

I'm sorry, but adding -f svg to the command python3 -m pretext -f svg build web didn't work.  My terminal (Mac) returns the error No such option -f.

Regards,
Charles

OHappyDay

unread,
May 31, 2026, 7:18:50 AMMay 31
to PreTeXt support
Please make sure you have version 2.39.0 of pretext. If this already matches your setup maybe deleting/renaming the .ptx folder in you homedirectory helps.
After building a project's web version you should see that MathJax 4 is included:


Klaus

Oscar Levin

unread,
May 31, 2026, 9:18:51 AMMay 31
to PreTeXt support
It definitely sounds like your version of pretext is out of date.  Try running `pretext --version` in the terminal (or python3 -m pretext --version, if you usually prepend calls to pretext with python3 -m).  If `pretext upgrade` didn't have any effect, you can try `python -m pip install pretext --update`.

It would be helpful if you can post the results of these commands here.  

Note that `-f svg` is only something you would add if you were running the pretext script from core pretext, not the CLI, and that is for producing svg formats of some assets (like tikz pictures).

P.S. You really should give VS Code a try!  At its simplest, it is just a text editor, so will not feel unfamiliar from texshop.  But you get autocomplete a syntax highlighting for pretext files.  Your snippets via stream deck idea (love it) makes me think you would really like the custom snippets you can define there.  You add a config file via vs code that anytime it sees you start typing a particular pattern, it will expand to whatever you set it up for.  There are lots included in the pretext-tools extension, for example, "<!pretext-article" expands to give you the structure of an article.  You don't have to type the entire trigger, since vs code suggest it has an autocomplete.

Charles M

unread,
May 31, 2026, 10:20:59 AMMay 31
to PreTeXt support
Thank you Klaus, Oscar, and Rob for all your help!

Here is the result when I run python3 -m pretext --version.

charlesmorgan@Charless-MacBook-Pro-Home Temp % python3 -m pretext --version

/Users/charlesmorgan/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020

  warnings.warn(

2.20.0


I would be grateful for any advice that you can offer.

Regards,
Charles

Oscar Levin

unread,
May 31, 2026, 11:32:59 AMMay 31
to pretext...@googlegroups.com
Thanks Charles.  You need to upgrade your version of Python.  The newest versions of the cli, everything since 2.20, requires at least python 3.10.  

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/7b35d175-5488-4eb9-8e57-eb1c3e5f147dn%40googlegroups.com.

Charles M

unread,
May 31, 2026, 11:35:47 AMMay 31
to PreTeXt support
I ran an uninstall of pretext with python3.  Then I ran a new install of pretext with python3.  It  installed Version 2.20 when I did this.  Should it be Version 2.39?

Thanks in advance,
Charles

Charles M

unread,
May 31, 2026, 12:26:03 PMMay 31
to PreTeXt support
Dear Oscar et al.:

It worked!  Thank you, Oscar, for suggesting the upgrade of Python3.  I did that.  Then ran an upgrade of PreTeXt to 2.40.2.  Now, my output is using MathJax 4.1.2.

And the equations look beautiful in CHTML!

Thank you, all!

Regards,
Charles

PS I spend my free time in the studios of our local NPR affiliate, operating a few million dollars-worth of broadcast equipment with no problems, but I feel like a three-year-old with Legos when I'm just trying to use Terminal to upgrade something on my Mac.

Reply all
Reply to author
Forward
0 new messages