I am trying the solution given in is-it-possible-to-change-customize-some-conversions-done-by-texform which works very well except changing the order of the Format
command causes an error on some symbols.
I do not know if this is Mathematica own issue with the command Format
or if it is related to the package I am using.
First I installed the nice package MathematicaTeXUtilities
using the command
Get["https://raw.githubusercontent.com/jkuczm/MathematicaTeXUtilities/master/BootstrapInstall.m"]
Here is MWE. Using the following order, with fresh kernel, show no error
Needs["TeXUtilities`"]
Unprotect[Hypergeometric1F1,HypergeometricU];
Format[ Hypergeometric1F1, TeXForm] = TeXVerbatim@"\\operatorname{Hypergeometric1F1}";
Format[ HypergeometricU, TeXForm] = TeXVerbatim@"\\operatorname{HypergeometricU}";
Protect[Hypergeometric1F1,HypergeometricU];
Now, changed the order of Format
command, and using fresh kernel (must restart the kernel to see the error), an error message shows up
Needs["TeXUtilities`"]
Unprotect[Hypergeometric1F1,HypergeometricU];
Format[ HypergeometricU, TeXForm] = TeXVerbatim@"\\operatorname{HypergeometricU}";
Format[ Hypergeometric1F1, TeXForm] = TeXVerbatim@"\\operatorname{Hypergeometric1F1}";
Protect[Hypergeometric1F1,HypergeometricU];
I thought at first that the order of symbols in Protect
has to match the order of Format
commands. But this does not make sense. And I found by trial and error a case where the errors show up even when the order or Protect
match order of Format
. Here it is (fresh kernel)
Needs["TeXUtilities`"]
Unprotect[HypergeometricU,LaguerreL,HermiteH,Hypergeometric1F1,Erf,Erfc];
Format[ HypergeometricU, TeXForm] = TeXVerbatim@"\\operatorname{HypergeometricU}"
Format[ LaguerreL, TeXForm] = TeXVerbatim@"\\operatorname{LaguerreL}"
Format[ HermiteH, TeXForm] = TeXVerbatim@"\\operatorname{HermiteH}"
Format[ Hypergeometric1F1, TeXForm] = TeXVerbatim@"\\operatorname{Hypergeometric1F1}"
Format[ Erfc, TeXForm] = TeXVerbatim@"\\operatorname{Erfc}"
Format[ Erf, TeXForm] = TeXVerbatim@"\\operatorname{Erf}"
Protect[HypergeometricU,LaguerreL,HermiteH,Hypergeometric1F1,Erf,Erfc];
So I am not sure what is going on now. Any ideas?
As a workaround, now I Format
them one by one, instead of the batch mode and error went away
Needs["TeXUtilities`"]
Unprotect[Hypergeometric1F1];
Format[ Hypergeometric1F1, TeXForm] = TeXVerbatim@"\\operatorname{Hypergeometric1F1}";
Protect[Hypergeometric1F1];
Unprotect[HypergeometricU];
Format[ HypergeometricU, TeXForm] = TeXVerbatim@"\\operatorname{HypergeometricU}";
Protect[HypergeometricU];