Skip to main content
Tweeted twitter.com/#!/StackMma/status/211451607190208512
added 35 characters in body; edited title
Source Link

TeX $\TeX$ conversion, support for \hphantom

I'm trying to write some TeX$\TeX$ conversion for a tensor with an upper and a lower index, but I would like the lower index to be displaced to the right by the width of the upper index. In (La)TeX I would write this as W^I_{\hphantom{I} J}W^I_{\hphantom{I} J} ($W^I_{\hphantom{I} J}$). I tried to use the `Invisible'Invisible Mathematica command, which seems to be the counterpart of TeX's \phantom$\TeX$'s \phantom, but instead of getting a space I get the upper index repeated as a lower index.

Here's the code I'm using now, which doesn't quite work:

w /: MakeBoxes[w[i_,j_],fmt_:StandardForm] := (*BUGGY*)
SubsuperscriptBox[MakeBoxes[W,fmt], RowBox[{MakeBoxes[Invisible[i],fmt], MakeBoxes[j,fmt]}], MakeBoxes[i,fmt]]

This does work in the notebook front-end, but not when converting to (La)TeX. What is the best way to achieve the result I'm after?

TeX conversion, support for \hphantom

I'm trying to write some TeX conversion for a tensor with an upper and a lower index, but I would like the lower index to be displaced to the right by the width of the upper index. In (La)TeX I would write this as W^I_{\hphantom{I} J}. I tried to use the `Invisible' Mathematica command, which seems to be the counterpart of TeX's \phantom, but instead of getting a space I get the upper index repeated as a lower index.

Here's the code I'm using now, which doesn't quite work:

w /: MakeBoxes[w[i_,j_],fmt_:StandardForm] := (*BUGGY*)
SubsuperscriptBox[MakeBoxes[W,fmt], RowBox[{MakeBoxes[Invisible[i],fmt], MakeBoxes[j,fmt]}], MakeBoxes[i,fmt]]

This does work in the notebook front-end, but not when converting to (La)TeX. What is the best way to achieve the result I'm after?

$\TeX$ conversion, support for \hphantom

I'm trying to write some $\TeX$ conversion for a tensor with an upper and a lower index, but I would like the lower index to be displaced to the right by the width of the upper index. In (La)TeX I would write this as W^I_{\hphantom{I} J} ($W^I_{\hphantom{I} J}$). I tried to use the Invisible Mathematica command, which seems to be the counterpart of $\TeX$'s \phantom, but instead of getting a space I get the upper index repeated as a lower index.

Here's the code I'm using now, which doesn't quite work:

w /: MakeBoxes[w[i_,j_],fmt_:StandardForm] := (*BUGGY*)
SubsuperscriptBox[MakeBoxes[W,fmt], RowBox[{MakeBoxes[Invisible[i],fmt], MakeBoxes[j,fmt]}], MakeBoxes[i,fmt]]

This does work in the notebook front-end, but not when converting to (La)TeX. What is the best way to achieve the result I'm after?

Source Link

TeX conversion, support for \hphantom

I'm trying to write some TeX conversion for a tensor with an upper and a lower index, but I would like the lower index to be displaced to the right by the width of the upper index. In (La)TeX I would write this as W^I_{\hphantom{I} J}. I tried to use the `Invisible' Mathematica command, which seems to be the counterpart of TeX's \phantom, but instead of getting a space I get the upper index repeated as a lower index.

Here's the code I'm using now, which doesn't quite work:

w /: MakeBoxes[w[i_,j_],fmt_:StandardForm] := (*BUGGY*)
SubsuperscriptBox[MakeBoxes[W,fmt], RowBox[{MakeBoxes[Invisible[i],fmt], MakeBoxes[j,fmt]}], MakeBoxes[i,fmt]]

This does work in the notebook front-end, but not when converting to (La)TeX. What is the best way to achieve the result I'm after?