Multiple TeXForm returns just single output



I have several expressions for which I need the LaTex output. If I put them one after another with TeXForm, only the last one is shown (see picture).

This is different to for example "TraditionalForm" behavior which prints all three inputs. Am I missing something or the behavior of TeXForm and TraditionalForm (or actually any other *Form) is simply different? I can circumvent it by appending \\Print after \\TeXForm, but it is not always desired (namely, having each output in a different cell allows to refer to that as %number; either form can be saved to a variable, but it would be best if the behaviour was the same for both cases).

enter image description here enter image description here


Posted 2017-03-01T09:06:10.713


This happens with version 10: Which version are you using? – mattiav27 – 2017-03-01T09:45:15.190

11.0.1, but this existed for as long as I remember. – None – 2017-03-01T13:36:02.453

Indeed the issue almost certainly has the same root cause. Especially given Szabolcs answer – None – 2017-03-10T13:41:22.703

Did you ask Wolfram about this? If yes, what did they say? Is it by design or a bug? – Szabolcs – 2018-01-24T11:18:27.257



This is just a long comment.

I see the same behaviour in several versions between 9.0–11.0.

Looking at what is actually being sent to the FE with LinkSnooper, we see that the kernel does send all results back, however, the front end only displays the last one. Based on a few experiments, it seems that:

  • When the result is sent as a ReturnExpressionPacket (i.e. it comes as boxes: StandardForm, TraditionalForm, FullForm, etc.) or ReturnTextPacket (OutputForm), then all results are displayed.
  • When the result is sent as ReturnInputFormPacket (InputForm, TeXForm, CForm, etc.), then only the last result is displayed.

I would report this behaviour to Wolfram Support.

As a workaround you can do this (which I think is a better approach anyway):

TeXForm /@ {Sqrt[1 + x^2 + x^4], Sqrt[1 + x^2 + x^5], Sqrt[1 + x^2 + x^6]}


Posted 2017-03-01T09:06:10.713

Reputation: 213 047


Another workaround is to tack on an "invisible" wrapper such as SequenceForm:

Sqrt[1 + x^2 + x^4] //TeXForm //Defer
Sqrt[1 + x^2 + x^5] //TeXForm //SequenceForm
Sqrt[1 + x^2 + x^6] //TeXForm //HoldForm




Carl Woll

Posted 2017-03-01T09:06:10.713

Reputation: 112 778