距离我上次使用 Mactex + Texstudio 已经有一段时间了,当时它们运行良好。现在全新安装后,我收到以下错误:
Package inputenc Error: Unicode character 〖 (U+3016)(inputenc) not set up for use with LaTeX. \end{align}
Package inputenc Error: Unicode character 〗 (U+3017)(inputenc) not set up for use with LaTeX. \end{align}
我尝试过:
- 定义 UTF-8 的设置
这还不够
\usepackage[utf8]{inputenc} \DeclareUnicodeCharacter{3016}{\{} \DeclareUnicodeCharacter{3017}{\}}
这有效。
但我不明白为什么我会收到这个错误,错误指向的特定文件几乎包含相同的“对齐”块:
无错误块:
\begin{align}\label{eq:unixy} \nonumber
F_z(z)&=\mathbb{P}(\max(x,y)\leq z)\\
&=\mathbb{P}[(x\leq z,x>y)\cup(y\leq z,x\leq y)] \nonumber\\
&=\mathbb{P}[(x\leq z,x>y)+(y\leq z),x\leq y]
\end{align}
錯誤阻礙:
\begin{align}\label{eq:minCDF}
F_Z (z)&=\mathbb{P}(\min(x,y)\le z)=\mathbb{P}(-\max(-x,-y)\le z)\nonumber\\
&=\mathbb{P}(\max〖(-x,-y)\geq -z〗 )\nonumber\\
&=1-\mathbb{P}(\max(-x,-y)\leq-z)\nonumber\\
&=1-\mathbb{P}(-x\le-z)\mathbb{P}(-y\le-z)
\end{align}
答案1
使用旧版本的 LaTeX,你不会从这两个 Unicode 字符获得任何输出,但会出现一系列警告
Missing character: There is no <E3> in font cmr10!
Missing character: There is no <80> in font cmr10!
Missing character: There is no <96> in font cmr10!
Missing character: There is no <E3> in font cmr10!
Missing character: There is no <80> in font cmr10!
Missing character: There is no <97> in font cmr10!
Missing character: There is no <E3> in font cmr10!
Missing character: There is no <80> in font cmr10!
Missing character: There is no <96> in font cmr10!
Missing character: There is no <E3> in font cmr10!
Missing character: There is no <80> in font cmr10!
Missing character: There is no <97> in font cmr10!
从 TeX Live 2018 开始,您会收到错误,因为 UTF-8 已成为默认输入编码。
方法\DeclareUnicodeCharacter
就是你所需要的。
在这种情况下,我也会使用split
。
\documentclass{article}
\usepackage{amsmath,amssymb}
\DeclareUnicodeCharacter{3016}{\{}
\DeclareUnicodeCharacter{3017}{\}}
\begin{document}
\begin{equation}\label{eq:minCDF}
\begin{split}
F_Z (z)&=\mathbb{P}(\min(x,y)\le z)=\mathbb{P}(-\max(-x,-y)\le z)\\
&=\mathbb{P}(\max〖(-x,-y)\geq -z〗 )\\
&=1-\mathbb{P}(\max(-x,-y)\leq-z)\\
&=1-\mathbb{P}(-x\le-z)\mathbb{P}(-y\le-z)
\end{split}
\end{equation}
\end{document}
当然,如果你不想输出这两个字符,可以使用
\DeclareUnicodeCharacter{3016}{}
\DeclareUnicodeCharacter{3017}{}