2 added 240 characters in body
source | link

Why does this happen? Because Mathematica interprets both x/y and x y^-1 as the same expression.

FullForm@HoldForm[x/y]
(* HoldForm[Times[x,Power[y,-1]]] *)

FullForm@HoldForm[x y^-1]
(* HoldForm[Times[x,Power[y,-1]]] *)

This happens during the parsing step, not evaluation. It cannot be prevented with HoldForm.

You can achieve your goal, but it requires some manual intervention. Here are a few ways to trick TeXForm into producing different output than the default by inserting HoldForm into the expression at strategic positions:

TeXForm[x y^-1]
(* \frac{x}{y} *)

TeXForm[x y^HoldForm[-1]]
(* x y^{-1} *)

TeXForm[x/y^a]
(* x y^{-a} *)

TeXForm[x/HoldForm[y^a]]
(* \frac{x}{y^a} *)

TeXForm[HoldForm@Divide[x,y^a]]
(* \frac{x}{y^a} *)

Note: Divide[x,y] is distinct from x/y/x y^-1. It evaluates immediately to x y^-1, but since this is now evaluation and not parsing, it can be prevented with HoldForm.

In certain cases it will be possible to insert HoldForm using ReplaceAll. Otherwise it may be easier to just edit the $\TeX$ code manually ... That is what I usually do.

Why does this happen? Because Mathematica interprets both x/y and x y^-1 as the same expression.

FullForm@HoldForm[x/y]
(* HoldForm[Times[x,Power[y,-1]]] *)

FullForm@HoldForm[x y^-1]
(* HoldForm[Times[x,Power[y,-1]]] *)

This happens during the parsing step, not evaluation. It cannot be prevented with HoldForm.

You can achieve your goal, but it requires some manual intervention. Here are a few ways to trick TeXForm into producing different output than the default by inserting HoldForm into the expression at strategic positions:

TeXForm[x y^-1]
(* \frac{x}{y} *)

TeXForm[x y^HoldForm[-1]]
(* x y^{-1} *)

TeXForm[x/y^a]
(* x y^{-a} *)

TeXForm[x/HoldForm[y^a]]
(* \frac{x}{y^a} *)

TeXForm[HoldForm@Divide[x,y^a]]
(* \frac{x}{y^a} *)

Note: Divide[x,y] is distinct from x/y/x y^-1. It evaluates immediately to x y^-1, but since this is now evaluation and not parsing, it can be prevented with HoldForm.

Why does this happen? Because Mathematica interprets both x/y and x y^-1 as the same expression.

FullForm@HoldForm[x/y]
(* HoldForm[Times[x,Power[y,-1]]] *)

FullForm@HoldForm[x y^-1]
(* HoldForm[Times[x,Power[y,-1]]] *)

This happens during the parsing step, not evaluation. It cannot be prevented with HoldForm.

You can achieve your goal, but it requires some manual intervention. Here are a few ways to trick TeXForm into producing different output than the default by inserting HoldForm into the expression at strategic positions:

TeXForm[x y^-1]
(* \frac{x}{y} *)

TeXForm[x y^HoldForm[-1]]
(* x y^{-1} *)

TeXForm[x/y^a]
(* x y^{-a} *)

TeXForm[x/HoldForm[y^a]]
(* \frac{x}{y^a} *)

TeXForm[HoldForm@Divide[x,y^a]]
(* \frac{x}{y^a} *)

Note: Divide[x,y] is distinct from x/y/x y^-1. It evaluates immediately to x y^-1, but since this is now evaluation and not parsing, it can be prevented with HoldForm.

In certain cases it will be possible to insert HoldForm using ReplaceAll. Otherwise it may be easier to just edit the $\TeX$ code manually ... That is what I usually do.

1
source | link

Why does this happen? Because Mathematica interprets both x/y and x y^-1 as the same expression.

FullForm@HoldForm[x/y]
(* HoldForm[Times[x,Power[y,-1]]] *)

FullForm@HoldForm[x y^-1]
(* HoldForm[Times[x,Power[y,-1]]] *)

This happens during the parsing step, not evaluation. It cannot be prevented with HoldForm.

You can achieve your goal, but it requires some manual intervention. Here are a few ways to trick TeXForm into producing different output than the default by inserting HoldForm into the expression at strategic positions:

TeXForm[x y^-1]
(* \frac{x}{y} *)

TeXForm[x y^HoldForm[-1]]
(* x y^{-1} *)

TeXForm[x/y^a]
(* x y^{-a} *)

TeXForm[x/HoldForm[y^a]]
(* \frac{x}{y^a} *)

TeXForm[HoldForm@Divide[x,y^a]]
(* \frac{x}{y^a} *)

Note: Divide[x,y] is distinct from x/y/x y^-1. It evaluates immediately to x y^-1, but since this is now evaluation and not parsing, it can be prevented with HoldForm.