I find strange behavior of TeXUtilities by @jkuczm which I do not understand how to fix.
I find I have to call TeXForm
two times for it to start working. Here is a MWE
This will install the package.
Import["https://raw.githubusercontent.com/jkuczm/MathematicaTeXUtilities/master/BootstrapInstall.m"]
If you do not want to install it, just use it one time, the command is
Import["https://raw.githubusercontent.com/jkuczm/MathematicaTeXUtilities/master/NoInstall.m"]
And now
Needs["TeXUtilities`"]
EllipticF;
Unprotect[EllipticF];
Format[EllipticF, TeXForm] = TeXVerbatim@"\\operatorname{EllipticF}";
Protect[EllipticF];
result1 = EllipticF[ArcSin[x], (-1)^(1/3)]
TeXForm[result1]
(*it does NOT work*)
TeXForm[result1]
(*Now it works!*)
Here is screen shot
Notice how the EllipticF
did not change to \operatorname{EllipticF}
first time. Only on second call it changed.
I think this might be due to caching. But do not know to work around it.
Can this be made to work on first call, without having to call it 2 times?
Version 11.3 on windows 7.
reference is-it-possible-to-change-customize-some-conversions-done-by-texform
why-changing-the-order-of-format-causes-error
Update April 3, 2018
Adding information requested below. Using screen shot, since much better in this case to show the output. Now I get kernel errors when I added the commands as mentioned in comment. Not sure what it going on. I put the notebook also here
FormatValues@EllipticF
line: betweenEllipticF;
andUnprotect[EllipticF];
lines, betweenProtect[EllipticF];
andresult1 = EllipticF[ArcSin[x], (-1)^(1/3)]
lines, and between twoTeXForm
calls, then we could know more about what is happening. I suspect that, as in linked question, it's an issue with autoloading, not directly related to TeXUtilities. $\endgroup$EllipticF[x, m] // TeXForm
before anyFormat
assignments, so that all relevantFormatValues
are pre-loaded. Then assigning format with argumentsFormat[HoldPattern@EllipticF[a_, b_], TeXForm] := TeXVerbatim["\\operatorname{EllipticF}"][a, b]
. Since formatting works differently than standard evaluation, there is no distinction between formatOwnValues
andDownValues
. First format value that matches is used, so if there's formatting for wholeEllipticF[x, m]
expression then specialized formatting forEllipticF
head is not used. $\endgroup$