Interaction problem between \mbox and \LaTeX?

300 views
Skip to first unread message

Albert van der Meer

unread,
Apr 12, 2021, 7:39:19 AM4/12/21
to MathJax Users

I have in my HTML file the following startup code for MathJax 2:
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
or for MathJax version 3:
<script>
  window.MathJax = {
    options: {
      ignoreHtmlClass: 'tex2jax_ignore',
      processHtmlClass: 'tex2jax_process'
    },
    tex: {
      packages: ['base','ams']
    },
  };

</script>
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
and further down I have the HTML code:
<p>\(\mbox{\LaTeX}\)</p>
<p>\({\LaTeX}\) </p>

The problem is that the output I get:
mbox.png
instead of twice the the last line.

Do I do something wrong or it this something that is not implemented in MathJax?

Davide Cervone

unread,
Apr 12, 2021, 8:34:58 AM4/12/21
to mathja...@googlegroups.com
The \mbox{} command creates a box that is in text mode, and MathJax has very limited support for text-mode material.  In particular, it does not process macros inside text mode, but it will look for math delimiters and process math-mode material inside the text-mode content.

There is a textmacros extension that does process a limited number of macros inside text-mode (for things like accents, font changes, and so on).  You could load the textmacros extension and include textmacros in your tex packages array to enable them.  But the \LaTeX macro uses \raise and \lower to move the "a" and "E", and those are not supported in text mode even with textmacros.  So the best you could to is \mbox{$\LaTeX$}, which is kind of pointless, since it changes to text mode then immediately changes back to math mode.

Davide

<mbox.png>
instead of twice the the last line.

Do I do something wrong or it this something that is not implemented in MathJax?

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/215098d4-10f8-4eeb-914a-c7b139d40979n%40googlegroups.com.
<mbox.png>

Albert van der Meer

unread,
Apr 12, 2021, 9:26:44 AM4/12/21
to mathja...@googlegroups.com

I think the textmacros way would be the best way to go, what are the chances that the commands \raise and \lower will be implemented?

The problem I'm running into here with the"$" way is that the LaTeX processing doesn't work. In standard LaTeX I could use "$$" but this doesn't work for me in MathJax. Any solution for this?

I'm not 100% sure anymore but I think the "\mbox" was introduced because we wanted to keep certain words together and no split over 2 lines(in standard LaTeX output and conversion to pdf). It might be that this was a bit over cautious for the "\LaTeX" case (as I've not been able to split the word LaTeX over multiple lines).

Virus-free. www.avg.com

You received this message because you are subscribed to a topic in the Google Groups "MathJax Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mathjax-users/mZvhR4zGfBc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/63DD9996-F8C1-4E9C-96E0-873D9E1EDD76%40gmail.com.

Virus-free. www.avg.com

Davide Cervone

unread,
Apr 12, 2021, 9:35:06 AM4/12/21
to mathja...@googlegroups.com
I think the textmacros way would be the best way to go, what are the chances that the commands \raise and \lower will be implemented?

We are planning to allow additional packages to be processed by textmacros in the 3.2 release (but the 3.1.3 release is coming next).

The problem I'm running into here with the"$" way is that the LaTeX processing doesn't work. In standard LaTeX I could use "$$" but this doesn't work for me in MathJax. Any solution for this?

I'm sorry, I don't quite understand.  Can you be more specific about what "LaTeX processing doesn't work" means, here?  And what you mean by "I could use '$$' but this doesn't work for me"?    The double dollar signs should work in MathJax, but of course you don't use double dollars inside an \mbox.  Is that what you are trying to do?

I'm not 100% sure anymore but I think the "\mbox" was introduced because we wanted to keep certain words together and no split over 2 lines(in standard LaTeX output and conversion to pdf). It might be that this was a bit over cautious for the "\LaTeX" case (as I've not been able to split the word LaTeX over multiple lines).

MathJax does not currently allow line breaks within in-line mathematics, so that should not be an issue, here.

Davide


Albert van der Meer

unread,
Apr 12, 2021, 9:41:12 AM4/12/21
to mathja...@googlegroups.com
Dear Davide,

We are planning to allow additional packages to be processed by textmacros in the 3.2 release (but the 3.1.3 release is coming next).
That is positive, any idea when the 3.2 version might come?

I'm sorry, I don't quite understand.  Can you be more specific about what "LaTeX processing doesn't work" means, here?  And what you mean by "I could use '$$' but this doesn't work for me"?    The double dollar signs should work in MathJax, but of course you don't use double dollars inside an \mbox.  Is that what you are trying to do?
Yes I tried in the \mbox. With "LaTeX processing" I meant converting calling pdflatex on the latex files where the code is in (unfortunately I don't have a small example).

MathJax does not currently allow line breaks within in-line mathematics, so that should not be an issue, here.
I was not to afraid about the MathJax results, but more about the "LaTeX" processing.

Virus-free. www.avg.com

Davide Cervone

unread,
Apr 12, 2021, 9:46:11 AM4/12/21
to mathja...@googlegroups.com
That is positive, any idea when the 3.2 version might come? 

We don't yet have a scheduled release time, but I expect sometime in May.


I'm sorry, I don't quite understand.  Can you be more specific about what "LaTeX processing doesn't work" means, here?  And what you mean by "I could use '$$' but this doesn't work for me"?    The double dollar signs should work in MathJax, but of course you don't use double dollars inside an \mbox.  Is that what you are trying to do?
Yes I tried in the \mbox. With "LaTeX processing" I meant converting calling pdflatex on the latex files where the code is in (unfortunately I don't have a small example).

Does \hbox{$\LaTeX$} in place of \mbox{\LaTeX} work for you?

MathJax does not currently allow line breaks within in-line mathematics, so that should not be an issue, here.
I was not to afraid about the MathJax results, but more about the "LaTeX" processing.

I don't think TeX will break the result of \LaTeX.

Davide

Albert van der Meer

unread,
Apr 12, 2021, 9:54:24 AM4/12/21
to mathja...@googlegroups.com
Dear Davide,

We don't yet have a scheduled release time, but I expect sometime in May.
That is very fast, I think I can wait that time.

Does \hbox{$\LaTeX$} in place of \mbox{\LaTeX} work for you?
No same problem.

I don't think TeX will break the result of \LaTeX.
That sounds positive.

All in all, seen the fast possible release with hopefully the \raise and \lower incorporated in textmacros I think I can wait for the time being.
 

Virus-free. www.avg.com

Reply all
Reply to author
Forward
0 new messages