MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: variable ordering in TeXForm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104228] Re: variable ordering in TeXForm
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Sat, 24 Oct 2009 02:40:31 -0400 (EDT)
  • References: <hbr50c$rbj$1@smc.vnet.net>

On 2009.10.23. 4:39, pfb wrote:
> Hi all,
>
>   I'm currently using TeXForm to export formulae from Mathematica (5)
> into a LaTeX document. The translation seems pretty good, but I'm
> annoyed by the ordering chosen by Mathematica for sorting e.g the
> monomials of a polynomial.
> I'd like to get what TraditionalForm produces, but instead I get the
> opposite ordering.
> Consider for instance the polynomial 6x^2-7x+2. The usual output of
> Mathematica reverses the order, writing 2-7x+6x^2.
> However, when asked for the TraditionalForm of either polynomial
> above, it gives what I expect, i.e. (a graphically fancy version of)
> the first ordering.
> On the other hand, TexForm reverses the ordering, similar to the usual
> output.
> Is there a simple way to get around this?
>
> By the way, I wonder why this is the (hopefully hackable) default
> behaviour. I thought that pretty much everybody would be happy with a
> latex code reproducing the traditional form when plugged into a latex
> document...
>
> Thanks a lot for any help.

In Mathematica 7 TeXForm[] gives me the same ordering as 
TraditionalForm[], so I assume that you are using an earlier version of 
Mathematica.  You could try using PolynomialForm on the expression and 
setting the TraditionalOrder option.  This seems to allow controlling 
the ordering in Mathematica 7.  Hopefully it will work in your version 
of Mathematica too.

PolynomialForm[6 x^2 - 7 x + 2, TraditionalOrder -> True] // TeXForm


  • Prev by Date: Re: How to print/display symbolic expressions from inside a Module
  • Next by Date: About using hyperlinks in notebook, couple of questions
  • Previous by thread: variable ordering in TeXForm
  • Next by thread: How to print/display symbolic expressions from inside a Module without the $ dollar signs?