Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

Re: TeXForm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg132022] Re: TeXForm
  • From: Itai Seggev <itais at wolfram.com>
  • Date: Sun, 17 Nov 2013 18:23:15 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20131115114057.804706A43@smc.vnet.net>

On Fri, Nov 15, 2013 at 06:40:57AM -0500, Themis Matsoukas wrote:
> TeXForm seems to apply additional transformations to expressions before exporting into latex. Here is an example:
> 
> ((-1 + n + \[Phi] - n \[Phi]) a + (1 + (-1 + n) \[Phi]) b)/((-1 + 
>      n + \[Phi]) a + b - \[Phi] b) // TeXForm
> 
> \frac{a (n (-\phi )+n+\phi -1)+b ((n-1) \phi +1)}{a
>    (n+\phi -1)+b (-\phi )+b}
> 
> The exported expression has been manipulated by some unknown rules. The  (-\phi) in particular is especially annoying. Is there a way to export the expression in the form that pretty much matches the original expression?

You have two issues.  One is not at all related to TeXForm, but the fact that
Plus and Times evaluated even for symbolic inputs.  If you did that input
without the //TeXForm, you'd see that it is not the same as your input.  

The other is that TeXForm by default emulates TraditionalForm (makes sense,
right?) and its notion of polynomial ordering.  To combat this second issue,
use

PolynomialForm[((-1 + n + \[Phi] - n \[Phi]) a + (1 + (-1 + n) \[Phi]) b)/((-1
        + n + \[Phi]) a + b - \[Phi] b), TraditionalOrder -> False] // TeXForm

To make the output 100% faithful to your input, use

HoldForm @ PolynomialForm[((-1 + n + \[Phi] - n \[Phi]) a + (1 + (-1 +n)\[Phi]) 
 b)/((-1 + n + \[Phi]) a + b - \[Phi] b), TraditionalOrder -> False] // TeXForm


--
Itai Seggev
Mathematica Algorithms R&D
217-398-0700 



  • References:
    • TeXForm
      • From: Themis Matsoukas <tmatsoukas@me.com>
  • Prev by Date: Animate cannot be combined?
  • Next by Date: Re: Plot InverseSurvivalFunction
  • Previous by thread: TeXForm
  • Next by thread: Re: TeXForm