1

I'm using XeLaTeX on macOS 10.15.4 and the xeCJK package to write text in Japanese. Everything works fine, except for the kanji character "円". When I use this character, it gets rendered as an uppercase "F" with a box around it. When I copy it, it looks like this: �

This is my mwe:

\documentclass[a4paper,12pt]{scrartcl} 
\usepackage{fontspec,xeCJK,graphicx,tikz}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
円
\end{document}

Why does this happen? How can I fix it?

1
  • 1
    The character is likely not in the font being used. I will look.
    – Cicada
    May 16, 2020 at 9:05

2 Answers 2

1

I would use explicit \setCJKmainfont, \setCJKsansfont, and \setCJKsansfont directives to set the "serif", "sans serif", and "monospaced" fonts for the document.

Of course, if your document requires the use of a single "sans serif"-type font, be sure to load it via \setmainfont.

enter image description here

% !TEX TS-program = xelatex
\documentclass{article} 
\usepackage{xeCJK} % loads 'fontspec' automatically
\setCJKmainfont{Noto Serif CJK JP} % just for this example
\setCJKsansfont{Noto Sans CJK JP Light}
\setCJKmonofont{Noto Sans Mono CJK SC}[Language=Japanese]
\begin{document}
円 \textsf{円} \texttt{円}
\end{document}
2
  • That's interesting information, thank you. However, I get the following error: Package fontspec Error: The font "Noto Serif CJK JP" cannot be found.
    – ersbygre1
    May 16, 2020 at 10:52
  • 1
    @Stephan - The Noto fonts are not included by default in most (all?) TeX distributions. However, they may be downloaded and installed free of charge. Seven [7!] font weights each are available for NotoSansCJKjp-* and NotoSerifCJKjp-*, and 2 font weights (Regular and Bold) for NotoSansMonoCJKjp-*.
    – Mico
    May 16, 2020 at 11:45
0

Found the error thanks to the comment: wrong font. Adding

\setCJKmainfont{ipaexm.ttf}

fixes it.

You must log in to answer this question.

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