# Changing order of TeXForm output

I am creating Taylor polynomials and exporting them using TeXForm. When a polynomial p[x] is displayed in Mathematica, it shows, for instance, 1+x+x^2+x^3. However, TeXForm always reverses the polynomial, giving it with largest power first:

TeXForm[p[x]] = x^3+x^2+x+1.

How can I keep the polynomial in the same order? Taylor polynomials are generally thought of as being constructed from low-to-high powers, so reading them in the generated format is a bit confusing to some.

## 2 Answers

Use HoldForm:

In[]:= TeXForm[HoldForm[1 + x + x^2 + x^3]]

Out[]//TeXForm= 1+x+x^2+x^3


Or for a function p[x] evaluating to a polynomial:

In:= TeXForm[HoldForm[Evaluate[p[x]]]]

Out//TeXForm=
1+x+x^2+x^3

• This works if I copy/paste the output into TeXForm[HoldForm[...]]; I'd rather it be done automatically. Using "TeXForm[HoldForm[p[x]]]" just returns "p(x)". – GregH Dec 18 '12 at 16:48
• How about TeXForm[HoldForm[Evaluate[p[x]]]]? – Joel Klein Dec 18 '12 at 17:19
• Your answer works. If it were a separate answer, I'd accept it; it is more elegant than using an undocumented command. – GregH Dec 18 '12 at 17:45
• Answer edited to add the form for a function p[x]. – Joel Klein Dec 18 '12 at 17:54

You can also use the undocumented (and probably deprecated, so beware!) PolynomialForm.

poly = Expand[(1+x)^10]

TeXForm@PolynomialForm[poly, TraditionalOrder -> False]

(* ==> "1+10 x+45 x^2+120 x^3+210 x^4+252 x^5+210 x^6+120 x^7+45 x^8+10 x^9+x^{10}" *)

• Thanks. This works, but using TeXForm[HoldForm[Evaluate[p[x]]]] is probably better. – GregH Dec 18 '12 at 17:44