# TeXForm errors “TeXForm ofTemplateSlotSequence[1, ] is not supported” and “TeXForm of 0.78492 +1.30714 I is not supported” in 12

Reported to WRI. CASE:4250134

Update: Thanks for the smaller example by Chip Hurst in comment, it seems it comes down to this simpler example

 TeXForm[Root[1 + 2 # + #^5 &, 1]]


Which gives in V 12 the following

 \text{NumericalApproximation}\left[\text{Root},,\text{Root}
\left[\text{$$\#$$1}^5+2\text{$$\#$$1}+1\&,1\right],\right]


With messages in console

 TeXForm::unspt: TeXForm of TemplateSlotSequence[1,] is not supported.
TeXForm::unspt: TeXForm of -0.486389 is not supported.


Which compiles to in Latex as

While in Version 11.3, same input gives

 \text{Root}\left[\text{$$\#$$1}^5+2 \text{$$\#$$1}+1\&,1\right]


With no warning messages. which compiles to

So it seems Latex output in 11.3 would have been better to keep as is.

Original question

I am seeing some TeXForm errors or new messages in the console in V12 which do not show in V 11.3.

What do these errors mean when calling TeXForm on a result returned from DSolve in version 12? No such errors come out in 11.3

ClearAll[y,x];
ode = -2 x^3 + Log[x] - y[x] + 2 x y'[x] + x^2 y''[x] + x^3 y'''[x] == 0;
sol = DSolve[ode, y[x], x];
TeXForm[sol]


Is this a bug? Or just warning message? Is there a way around it? The full Latex expression is too long to show.

btw, I am able to compile the latex generated in Tex Live. So I am not sure what these messages mean. The first part of the output compiles to

The rest goes over the edge of page since it is too long.

• Seems that TeXForm isn't playing nicely with Root objects. For example try TeXForm[Root[1 + 2# + #^5&, 1]]. – Chip Hurst Apr 22 '19 at 11:51
• What do you want the TeXForm of a Root object to be? – Carl Woll Apr 22 '19 at 14:52
• @CarlWoll may be if it was kept as it worked in version 11.3 would be OK. – Nasser Apr 22 '19 at 15:37
• Root objects are new in 12, but it looks like they were not implemented in TeXForm. Have you reported this to support? – ktm Apr 22 '19 at 16:14
• Root objects are not new, nor have they changed, as a language feature, in V12. All that has changed is how they are displayed. So the information on the reference page is quite correct – Itai Seggev Apr 23 '19 at 7:06

Assuming you never want to try to create TeX of the new numerical approximations output, you could do:

Unprotect[ConvertTeXExpressionToTeX];
ConvertTeXExpressionToTeX[expr_, o___?OptionQ] /; !TrueQ@$$TeX := Block[ {$$TeX=True, BoxFormUseApproximations=False},
ConvertTeXExpressionToTeX[expr,o]
]
Protect[ConvertTeXExpressionToTeX];


Then:

Root[#^3 + # + 1&, 2] //TeXForm


$$\text{Root}\left[\text{\#1}^3+\text{\#1}+1\&,2\right]$$

If desired, a more targeted version that only affects Root object is also possible.

Here's a better fix, which is essentially the one I made to our nightly development version:

ConvertTeXExpressionToTeX;
SystemConvertTeXFormDumpStripIdentityBoxes[SystemConvertCommonDumpboxes_]:=
SystemConvertCommonDumpboxes  //. {
RowBox[{SystemConvertCommonDumpx_}]:>SystemConvertCommonDumpx,
InterpretationBox[TemplateBox[_,"NumericalApproximation",___],SystemConvertCommonDumpx_,___] :>
Block[{BoxFormUseApproximations=False},MakeBoxes[SystemConvertCommonDumpx,TraditionalForm]],
(AdjustmentBox|InterpretationBox|TagBox|DynamicBox|TooltipBox)[SystemConvertCommonDumpx_,___]:>SystemConvertCommonDumpx
}


This version will work not just with TeXForm but also with $$\TeX$$-Export` and the various other ways $$\TeX$$ can be generated.

• TeXForm is really overdue for a big update. I hope you are considering it for 12.1. – Szabolcs Apr 28 '19 at 9:03