1

This is Latex auto-generated by Mathematica. It fails to compile under lualatex in TL 2023.

Is there a workaround to make it compile or is this is a bug in the generated Latex.

First will show screen shot showing the code, followed by MWE. I just copied the Latex generated, pasted it into my latex file and add \[ ... \] around it.

Here is the Mathematica V 14 code

SetSystemOptions["PolynomialAlgebraOptions"->"UseFLINT"->False];
ode=y''[x]+\[Lambda]*y[x]==0;
ic={y'[0]==0,y'[Pi]==0};
sol=DSolve[{ode,ic},y[x],x]

The output is

enter image description here

Here is the Latex of the above

TeXForm[sol]

gives

\left\{\left\{y(x)\to 
\begin{array}{cc}
 \{ & 
\begin{array}{cc}
 c_1 \cos \left(x \sqrt{\lambda }\right) & \unicode{f80d}\in \mathbb{Z}\land \unicode{f80d}\geq 0\land \lambda =\unicode{f80d}^2 \\
 0 & \text{True} \\
\end{array}
 \\
\end{array}
\right\}\right\}

Here is MWE

\documentclass[12pt]{article}
\usepackage{amsmath}

\begin{document}

\[
\left\{\left\{y(x)\to 
\begin{array}{cc}
 \{ & 
\begin{array}{cc}
 c_1 \cos \left(x \sqrt{\lambda }\right) & \unicode{f80d}\in \mathbb{Z}\land \unicode{f80d}\geq 0\land \lambda =\unicode{f80d}^2 \\
 0 & \text{True} \\
\end{array}
 \\
\end{array}
\right\}\right\}
\]

\end{document}

Compiled the above using lualatex A.tex

/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)
(./A.aux) (/usr/local/texlive/2023/texmf-dist/tex/latex/base/ts1cmr.fd)
! Undefined control sequence.
l.12 ...os \left(x \sqrt{\lambda }\right) & \unicode
                                                  {f80d}\in \mathbb{Z}\land ...

I have to use lualatex.

Is there something I can add in preamble to workaround this? Could I redefine the offending commands to something else to make it compile?

It looks like \unicode{f80d} is meant to represent the n with dot below it.

enter image description here

So may be I can just replace \unicode{f80d} by n in the preamble using renewcommand ?

TL 2023 on Linux

2
  • 1
    You could of course define \unicode probably \def\unicode#1{\symbol{"#1}} will work (ie the standard \symbol but taking hex by default) but U+F80D is a private use area character so unless you have access to the mathematica fonts who knows what character you will get, there is no defined character for that Unicode number Commented May 9 at 20:36
  • 1
    You should fix the mathematica TeXForm to use a more sensible definition such as U+1E47 Commented May 9 at 20:40

1 Answer 1

1

There's nothing that can be said in general, because U+F80D is in the Private Use Area.

If you can guess what's meant, then you can supplement the definition of \unicode given below.

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{accents}

\ExplSyntaxOn
\NewDocumentCommand{\unicode}{m}
 {
  \str_case:nnF { #1 }
   {
    {f80d}{\underaccent{\dot}{n}}
    % add here in a similar way for other \unicode commands
   }
   {???}% for uncovered cases
 }
\ExplSyntaxOff

\begin{document}

\[
\left\{\left\{y(x)\to 
\begin{array}{cc}
 \{ & 
\begin{array}{cc}
 c_1 \cos \left(x \sqrt{\lambda }\right) & \unicode{f80d}\in \mathbb{Z}\land \unicode{f80d}\geq 0\land \lambda =\unicode{f80d}^2 \\
 0 & \text{True} \\
\end{array}
 \\
\end{array}
\right\}\right\}
\]

\end{document}

The output is painful, though, and not for the “n with dot under” part.

You can clearly see that the code must be cleaned up to avoid unscrutable and meaningless output.

enter image description here

A less painful output:

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage{accents}

\ExplSyntaxOn
\NewDocumentCommand{\unicode}{m}
 {
  \str_case:nnF { #1 }
   {
    {f80d}{\underaccent{\dot}{n}}
    % add here in a similar way for other \unicode commands
   }
   {???}% for uncovered cases
 }
\ExplSyntaxOff

\begin{document}

\[
\left\{\!\left\{y(x)\to
\begin{cases}
 c_1 \cos (x \sqrt{\lambda }\,) & \unicode{f80d}\in \mathbb{Z}\land
                                  \unicode{f80d}\geq 0\land \lambda =\unicode{f80d}^2 \\
 0 & \text{True} \\
\end{cases}
\right\}\!\right\}
\]

\end{document}

enter image description here

3
  • yes you could do this, but as I commented under the question, the Private use area character is in user-controllable output so I think @nasser should fix the generated latex rather than make latex cope with U+F80D Commented May 9 at 22:11
  • @DavidCarlisle You know that the OP's idea is to get things automagically well-typeset. The LaTeX code generated by Wolfram has much bigger problems than \unicode{...}.
    – egreg
    Commented May 9 at 22:51
  • I can but try:-) Commented May 9 at 22:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .