I'm writing a document in emac's org-mode, which exports both to Latex and to HTML. For the HTML portion, it uses Mathjax.

Now, I have some equation that uses the \textsc{x} command. This works fine within Latex, but not in Mathjax as it is not supported.

I want to tell Mathjax to simply ignore the \textsc commands, and just use whatever is inside "plainly". I.e. \textsc{x} = x. Is this possible?

Edit: to clarify: I want to export to both Latex and HTML. I want the textsc to be in my Latex pdf, but ignored by Mathjax. Removing all textsc therefore is not a solution, as then it will be absent in the Latex pdf as well.

  • 6
    $\begingroup$ Questions about MathJax outside of its use on math.stackexchange.com are off-topic here. Stackoverflow has a mathjax tag and MathJax has an official user group for general support. $\endgroup$ Jan 2 '20 at 17:02
  • 1
    $\begingroup$ @Trevor it's also in LaTeX as easy as \iflatextrue ... \else ...\fi $\endgroup$
    – user645636
    Jan 3 '20 at 20:54

Yes. Do not type the \textsc part into your answer, and if you copy-paste, then remove it.

If you want a less-manual hack, go to the start of your text:

M-x replace-regexp <RET> \\textsc{\([^\}]*\)} <RET> \1 <RET>

This should do the trick.

  • $\begingroup$ I still want to be able to export to Latex pdf with the textsc in place. Removing it therefore is not an option. I have updated my question to reflect this situation $\endgroup$
    – R. Bosman
    Jan 2 '20 at 16:52
  • $\begingroup$ Here's a partial solution for you. $\endgroup$
    – Asaf Karagila Mod
    Jan 2 '20 at 17:16
  • $\begingroup$ why not set a if* up so you can turn it true or false for the document ? you want... $\endgroup$
    – user645636
    Jan 3 '20 at 3:00

Not the answer you're looking for? Browse other questions tagged .