Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I do not know if the Latex code (which is auto-generated is invalid) or if pdflatex is supposed to be able to handle this code, but I need to find the correct package. I looked at this entering-unicode-characters-in-latex and added the package mentioned there. But still get the error. May be I need to define a macro? Do I need to add a smart \DeclareUnicodeCharacter to handle this? Is there a way to use this \DeclareUnicodeCharacter to make these unicodes below which are causing the problem to be just a single white space so that pdflatex and latex can process the file?

Mathematica generates Latex code for one of its expression which uses special Mathematical symbols (small dot above and below letters) as shown in this link

Here is a screen shot from my notebook showing the Latex code generated

Mathematica graphics

When I use this Latex code in my document, pdflatex.exe actually crashed (MikTex) and also texlive on Linux gave the error:

(/usr/local/texlive/2014/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2014/texmf-dist/tex/latex/amsfonts/umsb.fd)
! Undefined control sequence.
l.11 ...to \text{DifferentialRoot}\left(\{\unicode
                                                  {f818},\unicode{f817}\}
? 

The code generated is complicated and I can't edit it by hand, else I will break the Latex code generated if I start moving parts around (I also need to run this many times, so need a one time fix)

Here is a MWE on one actual case. I have many such cases, so looking for a macro I can put at top of the Latex document that solves all these \unicode problems. A solution that removes all those unicodes is just fine as well. The symbols do not have to have those dots above or below, but this is how Mathematica generates them. But for the pdf file, I do not need them really.

\documentclass[12pt]{article}
\usepackage{amsmath,mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[mathletters]{ucs}
\usepackage[utf8]{inputenc} 
\begin{document}

$\left\{\left\{y(x)\to \text{DifferentialRoot}\left(\{\unicode{f818},
  \unicode{f817}\}
  \unicode{f4a1}\left\{\left(a^2 \unicode{f817}^3+a\right) 
  \unicode{f818}(\unicode{f817})+\left(2 \unicode{f817}^3 a-1\right) 
  \unicode{f818}'(\unicode{f817})+\unicode{f817} 
  \unicode{f818}''(\unicode{f817})=0,
  \unicode{f818}(1)=c_1,\unicode{f818}'(1)=c_2\right\}\right)(x)\right\}\right\}$

\end{document} 
share|improve this question
1  
When talking about unicode one has to mention XeTeX and LuaTeX, unicode aware engines. \par But then f818 <- Have a look at the emphasised text. –  Johannes_B Jul 22 '14 at 7:15
    
@Johannes_B I am just set up to use texlive, and on windows I use miktex default setup. I really never used XeTex or LuaTex and do not know how to set them up now. I just need a simple solution to handle these unicodes. Even replacing them with space will work for me. I just do not know how to do this. I also use tex4ht, and want to keep the same setup as is. –  Nasser Jul 22 '14 at 7:18
    
\documentclass{article} \newcommand{\unicode}[1]{} \begin{document} $\unicode{f817} \unicode{f4a1} \unicode{f818}$ \end{document} –  Johannes_B Jul 22 '14 at 7:26
1  
As the unicode char is gone with my definition, a double superscript stays. use \newcommand{\unicode}[1]{\begingroup{ \endgroup} instead. But to be honest, i don't see the point in doing so. The error will disappear, but the whole meaning will drop dead. Not a good idea, imho. –  Johannes_B Jul 22 '14 at 7:39
2  
Can't you setup Mathematica to outout the unicode glyphs directly? –  Johannes_B Jul 22 '14 at 7:39

2 Answers 2

up vote 5 down vote accepted

U+F817, U+F818 and U+F4A1 point to the private use area, so it's impossible to say what they should produce, because it's font dependent.

Looking at your picture, the correspondence seems to be

  • U+F817 is x
  • U+F818 is y
  • U+F4A1 is ,

So you can do

\makeatletter
\newcommand{\unicode}[1]{\@nameuse{unicode@#1}}
\newcommand{\unidef}[2]{\@namedef{unicode@#1}{#2}}
\makeatother

\unidef{f817}{x}
\unidef{f818}{y}
\unidef{f4a1}{,}

Complete code:

\documentclass[12pt]{article}
\usepackage{amsmath,mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[utf8]{inputenc}

\makeatletter
\newcommand{\unicode}[1]{\@nameuse{unicode@#1}}
\newcommand{\unidef}[2]{\@namedef{unicode@#1}{#2}}
\makeatother

\unidef{f817}{x}
\unidef{f818}{y}
\unidef{f4a1}{,}

\begin{document}

$\left\{\left\{y(x)\to \text{DifferentialRoot}\left(\{\unicode{f818},
  \unicode{f817}\}
  \unicode{f4a1}\left\{\left(a^2 \unicode{f817}^3+a\right)
  \unicode{f818}(\unicode{f817})+\left(2 \unicode{f817}^3 a-1\right)
  \unicode{f818}'(\unicode{f817})+\unicode{f817}
  \unicode{f818}''(\unicode{f817})=0,
  \unicode{f818}(1)=c_1,\unicode{f818}'(1)=c_2\right\}\right)(x)\right\}\right\}$

\end{document}

I can show only the start, as the formula is unbreakable due to the wrong usage of \left and \right. Whoever wrote the LaTeX code generator doesn't seem to know much about TeX.

enter image description here

Here is the typeset result after removing all \left and \right:

enter image description here

share|improve this answer

You can add the following code before automatic generated text:

\def\unicode#1{\csname U+#1\endcsname}
\def\unidef#1{\expandafter\def\csname U+#1\endcsname}

\unidef{f818}{{\bdot{\dot y}}}
\unidef{f817}{{\bdot{\dot x}}}
\unidef{f4a1}{,}

\def\bdot#1{\vtop{\offinterlineskip
   \halign{\hfil##\hfil\cr$#1\vphantom y$\cr\noalign{\vskip1pt}.\cr}}}

% the text generated by Mathematica follows:

\documentclass[12pt]{article} 
\usepackage{amsmath,mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[mathletters]{ucs}
\usepackage[utf8]{inputenc}
\begin{document}

$\left\{\left\{y(x)\to \text{DifferentialRoot}\left(\{\unicode{f818},
  \unicode{f817}\}
  \unicode{f4a1}\left\{\left(a^2 \unicode{f817}^3+a\right) 
  \unicode{f818}(\unicode{f817})+\left(2 \unicode{f817}^3 a-1\right) 
  \unicode{f818}'(\unicode{f817})+\unicode{f817} 
  \unicode{f818}''(\unicode{f817})=0,
  \unicode{f818}(1)=c_1,\unicode{f818}'(1)=c_2\right\}\right)(x)\right\}\right\

\end{document}

I mean that you need to print dot above and below of x, y, thus \bdot is defined.

share|improve this answer
    
Those dots seem artifacts; I've never seen such a notation. –  egreg Jul 22 '14 at 9:02
    
@egreg I never seen such notation too. But the question includes: "...which uses special Mathematical symbols (small dot above and below letters) as shown...". IMHO, the problem with \unicode macro in the autogenerated text originates from this. –  wipet Jul 22 '14 at 9:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.