5

I have upgraded Windows from 7 to 10. When I am compiling some latex files, which were already built in Windows 7 and used to work fine - now in Windows 10 I am getting this error message for some equations:

! Package ucs Error: Unknown Unicode character 8289 = U+2061,
(ucs)                possibly declared in uni-32.def.
(ucs)                Type H to see if it is available with options.

Using XeLaTex works well, but I prefer compiling tex files, to do any online edits.

Here is an example... When compiling the below tex file, eq1 and eq2 are fine, while eq3 and eq4 are not. Why and how can this tex file be compiled "in windows 10" without getting a Unicode error?

\documentclass[12pt,a4paper]{article} 
\usepackage[utf8x]{inputenc}
\usepackage{ucs}

\begin{document}

\begin{equation}\label{eq 1}
F=W_{A}*M_{A}+W_{B}*M_{B}+..+W_{N}*M_{N}
\end{equation}

\begin{equation}\label{eq 2}
RR=\frac{dP(t)}{dt}=\frac{P(t)-P(t-D)}{D}
\end{equation}

\begin{equation}\label{eq_3}
X_{Scaled}=a+ \frac{[x-min⁡(X)]}{[max⁡(X)-min⁡(X)]}*\{b-a\}
\end{equation}

\begin{equation}\label{eq_4}
 X_{Standardized}= \frac{[x-mean⁡(X)]}{std(X)}
 \end{equation}

 \end{document}
  • 2
    This will be unrelated to the operating system, also it is generally better to avoid \usepackage[utf8x]{inputenc}\usepackage{ucs} unless you know you need that version and use the standard utf8 inputenc option (which is enabled by default in recent releases, so you don't need inputenc at all) How are you producing the file, why do you have U+2061 characters in the input? – David Carlisle Dec 11 '18 at 20:54
  • 2
    "Using XeLaTex works well, but I prefer compiling tex files, to do any online edits." I don't really understand this statement, your TeX distribution should presumably supply Xe(La)TeX, Lua(La)TeX, and pdf(La)TeX, so you shouldn't need to go to an online system to make use of XeLaTeX. – aoi Dec 11 '18 at 20:55
  • 1
    @mhdella you never answered the question of where the U+2061 character came from, it is rather hard to type this invisible character by accident, is this tex converted from some other format? – David Carlisle Dec 11 '18 at 22:20
  • 1
    @mhdella no the windows version does not affect this at all, the error comes from the tex macros and they are not dependent on the operating system – David Carlisle Dec 11 '18 at 23:02
  • 1
    @mhdella I quite understand that the file works on one and not the other but the version of windows won't be the cause, you may have older package version or the file might be in different encoding or ... – David Carlisle Dec 12 '18 at 0:43
10

Compiling your code under LuaLaTeX (while also loading the unicode-math package) yields the following screenshot for equations 3 and 4:

enter image description here

I've highlighted the four occurrences of U+2061. Why is this character in your tex file to begin with?

I believe you should re-write your code using \min and \max along the following lines (to be compiled under pdfLaTeX):

enter image description here

\documentclass[12pt,a4paper]{article} 
\usepackage{ucs}   % is this really needed?
\usepackage{amsmath}
\DeclareMathOperator{\mean}{mean}
\DeclareMathOperator{\std}{std}

\begin{document}
\begin{equation}\label{eq 1}
F=W_{A}*M_{A}+W_{B}*M_{B}+\dots+W_{N}*M_{N}
\end{equation}

\begin{equation}\label{eq 2}
RR=\frac{dP(t)}{dt}=\frac{P(t)-P(t-D)}{D}
\end{equation}

\begin{equation}\label{eq_3}
X_{\mathrm{Scaled}}=a+ \frac{[x-\min(X)]}{[\max(X)-\min(X)]}*\{b-a\}
\end{equation}

\begin{equation}\label{eq_4}
 X_{\mathrm{Standardized}}= \frac{[x-\mean(X)]}{\std(X)}
\end{equation}
\end{document}
  • 2
    I guess the OP is using some equation editor and the new version adds that Unicode invisible character (which makes sense for translations to MathML, I believe). – egreg Dec 11 '18 at 22:13
  • Thanks Mico for your response and correcting the tex file. Thanks egreg for the comment. I managed the Unicode error by just adding \usepackage[utf8x]{inputenc} and \DeclareUnicodeCharacter{"2061}{} – mhdella Dec 11 '18 at 22:45
  • 2
    @mhdella - Glad you found a workaround. A separate issue: I would hope you’ll still do your readers a favor and start writing \mib, \max, etc. That’ll make it much easier for them to notice what’s an operator and what’s a string of one-letter variable names. – Mico Dec 12 '18 at 3:56
6

Your file contains hidden characters that LaTeX can't deal with, copy-paste in a good editor to see it. The following image shows these hidden characters shown as f() after min, max, and mean, remove these and recompile. Also min and max are typset in up roman, also mean and std.

enter image description here

\documentclass[12pt,a4paper]{article} 
\usepackage[utf8x]{inputenc}
\usepackage{ucs,amsmath}

\begin{document}

\begin{equation}\label{eq 1}
F=W_{A}*M_{A}+W_{B}*M_{B}+..+W_{N}*M_{N}
\end{equation}

\begin{equation}\label{eq 2}
RR=\frac{dP(t)}{dt}=\frac{P(t)-P(t-D)}{D}
\end{equation}

\begin{equation}\label{eq_3}
X_\text{Scaled}=a+ \frac{[x-\min(X)]}{[\max(X)-\min(X)]}*\{b-a\}
\end{equation}

\begin{equation}\label{eq_4}
 X_\text{Standardized}= \frac{[x-\mathrm{mean}(X)]}{\mathrm{std}(X)}
 \end{equation}

 \end{document}

The correct output:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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