Skip to main content
added 868 characters in body
Source Link
Rojo
  • 43.1k
  • 7
  • 100
  • 196

Please let me know if I didn't understand correctly. What if you used a Subscript wrapping a Superscript instead of a Subsuperscript?

Subscript[Superscript[x, 4], 2] 

Mathematica graphics

Its TeXForm gives x^4{}_2. Does that render as you want?

EDIT

Does this work?

yourTeXForm[expr_] := Convert`TeX`BoxesToTeX[ToBoxes[expr], "BoxRules" -> {StyleBox[t_, op : OptionsPattern[]] /; (ShowContents /. FilterRules[{op}, ShowContents]) === False :> "\\hphantom{" <> Convert`TeX`BoxesToTeX[t] <> "}" }] parseIndices[ind_List] := Apply[Sequence, Row /@ Riffle @@@ Transpose@ ReplaceList[ Partition[ind, 2]\[Transpose], {b___, i : {__}, a___} :> {b, Invisible /@ i, a}]] ssp= Subsuperscript[x, parseIndices[Range[10]]] 

Mathematica graphics

yourTeXForm[ssp] 

"x_{\hphantom{1}1\hphantom{3}3\hphantom{5}5\hphantom{7}7\
hphantom{9}9}^{2\hphantom{2}4\hphantom{4}6\hphantom{6}8\hphantom{
8}10\hphantom{10}}"

Please let me know if I didn't understand correctly. What if you used a Subscript wrapping a Superscript instead of a Subsuperscript?

Subscript[Superscript[x, 4], 2] 

Mathematica graphics

Its TeXForm gives x^4{}_2. Does that render as you want?

Please let me know if I didn't understand correctly. What if you used a Subscript wrapping a Superscript instead of a Subsuperscript?

Subscript[Superscript[x, 4], 2] 

Mathematica graphics

Its TeXForm gives x^4{}_2. Does that render as you want?

EDIT

Does this work?

yourTeXForm[expr_] := Convert`TeX`BoxesToTeX[ToBoxes[expr], "BoxRules" -> {StyleBox[t_, op : OptionsPattern[]] /; (ShowContents /. FilterRules[{op}, ShowContents]) === False :> "\\hphantom{" <> Convert`TeX`BoxesToTeX[t] <> "}" }] parseIndices[ind_List] := Apply[Sequence, Row /@ Riffle @@@ Transpose@ ReplaceList[ Partition[ind, 2]\[Transpose], {b___, i : {__}, a___} :> {b, Invisible /@ i, a}]] ssp= Subsuperscript[x, parseIndices[Range[10]]] 

Mathematica graphics

yourTeXForm[ssp] 

"x_{\hphantom{1}1\hphantom{3}3\hphantom{5}5\hphantom{7}7\
hphantom{9}9}^{2\hphantom{2}4\hphantom{4}6\hphantom{6}8\hphantom{
8}10\hphantom{10}}"

Source Link
Rojo
  • 43.1k
  • 7
  • 100
  • 196

Please let me know if I didn't understand correctly. What if you used a Subscript wrapping a Superscript instead of a Subsuperscript?

Subscript[Superscript[x, 4], 2] 

Mathematica graphics

Its TeXForm gives x^4{}_2. Does that render as you want?