# Why TeXForm[] do not display to notebook if followed by OutputForm[] in same cell?

Can someone please explain to me the logic of this:

In one cell, when writing

eq = D[y[x], x] + a*y[x] - b*Sin[c*x];
sol = DSolve[eq == 0, y[x], x];
TeXForm[sol]
OutputForm[TeXForm[sol]]


I see only the result of OutputForm:

But in separate cells, then I see both outputs

ps. I was trying to find how to remove the "\" at the end of the OutputForm compared to TeXForm output, and that is why I am doing the above, to compare the outputs.

This happens on both V9 and 10. Should not both output show up, even if in the same cell?

-

## 1 Answer

It seems like OutputForm always is the first output one gets and all previous Out[..] are removed if they are equal. Here equal means that Out[1]==Out[2], and not necessarily that Out[1]/TeXForm==Out[2]/OutputForm.

You can change the order to:

eq = D[y[x], x] + a*y[x] - b*Sin[c*x];
sol = DSolve[eq == 0, y[x], x];
OutputForm[TeXForm[sol]]
TeXForm[sol]


\left{\left{y(x)\to \frac{b (a \sin (c x)-c \cos (c x))}{a^2+c^2}+c_1 e^{-a x}\right}\right}

\left{\left{y(x)\to \frac{b (a \sin (c x)-c \cos (c x))}{a^2+c^2}+c_1 e^{-a x}\right}\right}

Your "\" at the end of the OutputForm is just a linebreak. It will be removed, if you make Mma window wider.

-