2

How to put a subscript in a superscript Shows hows to write simple subscript to a superscript like this \sum_{w=0}^{w_i}f(x) and that works.

What I need is a complex subscript. Like \sum_{w=0}^{w_max}f(x) which will only subscript the m in the max.

Then I tried the obvious fix of nested curly braces, \sum_{w=0}^{w_{max}}f(x) but that fails to render anything. The whole expression disappears.

I'm trying it on mediawiki math markup (which uses LaTeX as the engine).

Is there any way to achieve this?

Found some more info.

The issue seems to be with using MathML. On MediaWikis if you go to Preferences->Appearance and pick PNG as the backend instead of MathML, then it shows up properly. Unfortunately in a not so smooth not-antialiased PNG picture.

Sigur actually answered my question! sum_{w=0}^{w_{\max}}fx seems to fix it! Notice the added slash \.

  • If you notice I did try using braces. I don't have any operator, do I need \operatorname? – Spundun Feb 10 '15 at 18:27
  • Sorry. You want a non TeX. – Sigur Feb 10 '15 at 18:28
  • Thanks @Sigur, using slash worked for me. I did want a Tex solution, Mediawiki takes TeX input and converts it to different browser friendly backends. – Spundun Feb 10 '15 at 18:33
  • 2
    That should be \sum_{w=0}^{w_{\mathrm{max}}} (using \max is a bit stretched, but it works). But something like \sum_{w=0}^{w_{ij}} in TeX will definitely work; if it doesn't in MediaWiki, it's their problem and it's not solvable on the TeX side, because the syntax is correct. – egreg Feb 10 '15 at 18:49
5

If you don't want "max" to appear in italic, simply enclose it in \text{}

\documentclass[preview]{standalone}
\usepackage{mathtools}

\begin{document}

    \begin{equation*}
        \sum_{w=0}^{w_{\text{max}}}f(x) 
    \end{equation*}

\end{document}

enter image description here

  • Note that \text{max} sets the word “max” in the same style as the surrounding text; thus, for instance, inside the statement of a theorem, which is typically typeset in italic, the subscript “max” will be italicized as well. In a situation like this, I’d rather recommend \sum_{w=0}^{w_{\mathrm{max}}} f(x). Edit: Also, you do not need mathtools in order to use \text{...}: the amsmath package (or, for that matter, the amstext package) suffices for this. – GuM Mar 23 '17 at 19:53
1

I ran the following successfully:

\documentclass{article}
\begin{document}
$$ \sum_{w=0}^{w_{max}}f(x) $$
\end{document}

(I know, never use $$, but it was quickest for the example.)

This does result in max being italicized, which may not be what you want; but it should compile. As you say, MathML sounds like it's the issue here. Using the \ gives you a roman-type max, because that makes it a keyword like \sin and the like. I'm glad to hear that this worked for you.

  • Thanks! Yes I did notice I was getting roman one was and italics the other. I guess at this point I don't care so much about that so it's close enough. But it does seem like an issue with either MathML itself or the MathML backend in MediaWiki – Spundun Feb 10 '15 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.