Very strange result while writing a trace of matrix

My Jacobian matrix evaluated at the equilibrium is denoted by J_E. I typed for its trace as

tr\textit{J_E}.

And the result is very strange. tr appears good but \textit{J_E} part is unlimitedly repeated with its size gradually decreasing.

It looks something like:

where the J_E part is gradually getting smaller.

What is happening here?

• Welcome to TeX.SE. Not sure what is going on as you did not post a full MWE the reproduces the problem. But you should be using \usepackage{amsmath}\DeclareMathOperator{\trace}{tr} in the preamble and then $\trace J_E$. The underscore to indicate subscript has to be in math mode. Oct 6, 2014 at 3:26
• Could you add a picture, showing this strange result? Now you have enough reputation to do it... Oct 6, 2014 at 3:30
• @Peter Grill thanks so much. My problem is resolved!
– ppp
Oct 6, 2014 at 3:49
• I think your editor is compiling in nonstop mode and it keeps trying to add the missing $ sign since inside \textit an underscore should be in math mode. Oct 6, 2014 at 5:23 1 Answer Why should you type \textit{J_E}? This is wrong for several reasons. 1. _ requires math mode and the argument to \textit is typeset in text mode (as the command name suggests). 2. \textit is the wrong command for typesetting a math variable: math mode should be used. 3. You're right that “tr” for the trace should be in upright type, but typesetting a formula not in math mode just for this is misusing the tool. \documentclass{article} \usepackage{amsmath} \DeclareMathOperator{\tr}{tr} \begin{document}$\tr J_{E}$is the trace of$J_{E}$. \end{document}  Now, why the four repetitions? You first of all get an error message that says ! Missing$ inserted.
<inserted text>
\$
l.8 \textit{J_E}


(the line number can be different, of course). After this the output is unpredictable, because when TeX discovers the error it's too late for doing a sensible fix.