chirun-ncl / chirun

A Python package providing the command line interface for building flexible and accessible content with Chirun.
https://chirun.org.uk/
Other
29 stars 4 forks source link

MathJax doesn't process LaTeX inside say `\text{}`, `\textrm{}`, `\mbox{}` #101

Closed prowlett closed 2 years ago

prowlett commented 2 years ago

I have this:

Suppose we have the following propositions.
\begin{align*}
    p &: \text{``It is cold''}\\
    q &: \text{``It is raining''}\\
    r &: \text{``It is cold and raining''}
\end{align*}

In LaTeX it looks like this:

image

In coursebuilder's web view it looks like this:

image

Notice that the opening `` isn't rendered as a curly quote mark.

The makecourse HTML is

<p>
Suppose we have the following propositions. 
</p>
<span><script type="math/tex; mode=display">\begin{align*}  p & : \text{``It is cold''}\\ q & : \text{``It is raining''}\\ r & : \text{``It is cold and raining''} \end{align*}</script></span>

I think this looks okay, which made me think it might be MathJax's problem. I tried swapping the \text{} for \textrm{} and \mbox{} and the effect is the same.

@christianp says this is because MathJax doesn't do anything with plain text and wonders if coursebuilder can do some processing. So I guess there may be broader issues than just this curly quote issue.

georgestagg commented 2 years ago

I've tweaked the MathJax settings in the default theme to load the textmacros MathJax extension[1]. That should hopefully help. With textmacros loaded, your example now looks like this in the web output:

Screenshot of example with quotes working

[1] http://docs.mathjax.org/en/latest/input/tex/extensions/textmacros.html

prowlett commented 2 years ago

Perfect, thanks!