0

MWE:

\documentclass{article}
\usepackage{ctex}
\usepackage[table]{xcolor}
\begin{document}

¥
\end{document}

output:

enter image description here

It only works with XeLaTeX. Doesn't even compile using Latex. Error message:package inputenc error...

I would like a workaround so I can type the Chinese Yuan symbol, but more imporantly I would like someone to use this as an oportunity to explain to me what went wrong. I assuming when I paste the ¥ symbol from the web, I really pasted the UTF8 encoding of ¥, and doesn't Xelatex use UTF-8 coding by default? So is it a prblem with font encoding? I tried to read material online but quite frankly I haven't found one that explains to me in way I understand.

0

1 Answer 1

1

This appears to be an issue with the default fandol font set. You have several options. First, you can load a different font set. This template loads free fonts available on CTAN, and works on either LuaLaTeX or PDFLaTeX:

\tracinglostchars=2
\documentclass{article}
\usepackage[fontset=none]{ctex}
\usepackage[table]{xcolor}

\defaultfontfeatures{ Scale = MatchLowercase, Ligatures = TeX }
\setmainfont{Noto Serif}[Scale = 1.0]
\setCJKmainfont{Noto Serif CJK SC}[
  Script=CJK,
  Language=Chinese Simplified]
\setsansfont{Noto Sans}
\setCJKsansfont{Noto Sans CJK SC}[
  Script=CJK,
  Language=Chinese Simplified]
\setmonofont{Noto Sans Mono}
\setCJKmonofont{Noto Sans Mono CJK SC}[
  Script=CJK,
  Language=Chinese Simplified]

\begin{document}
¥
\end{document}

Alternatively, give ctex (or ctexart, etc.) a different fontset option that’s available on your system, e.g. windows, macnew or ubuntu. See §4.3 of the ctex manual.

Finally, the LaTeX kernel provides \textyen, so you could set the character back to using that:

\usepackage{newunicodechar}
\newunicodechar{¥}{\textyen}

This should work on any engine, if you can get your documents to compile on it.

You must log in to answer this question.

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