4

I am trying to make the second example from the answer here work. It is copied here below:

% Compile with xelatex
% UTF-8 encoding
\documentclass{article}
\usepackage{xeCJK}
\setCJKmainfont{SimSun}
\begin{document}
文章内容
\end{document}

When I compile with xelatex Test.tex, I get the following error indicating that it cannot find the font.

The font "SimSun" cannot be found.

I can think of two possible solutions, but I am unclear about how to proceed with either of them, and Google has not been helpful.

1) Install SimSun. What is the correct command in Ubuntu 13.10 to do this so that xelatex can see it?

2) Change to a different Chinese font that xelatex will work with. I can type Chinese in my Ubuntu install, so I must have some kind of Chinese font on my system. How can I find out the names of all fonts which are valid arguments to \setCJKmainfont?

Note that I already have msttcorefonts package installed.

  • In which applications can you type Chinese? Try using one of those to identify the font. Or see which font packages you have installed using apt etc. Else try typing fc-match SimSun in your terminal programme. I get Heuristica-Regular.otf: "Heuristica" "Regular", for example, which means fontconfig will use Heuristica-Regular in place of SimSun if SimSun is requested. I doubt my config supports Chinese, but you are likely to get something rather more useful. That is, if fontconfig is well configured, you are likely to get the name of a font which supports Chinese. – cfr Feb 15 '14 at 23:55
  • I can type Chinese in Firefox, Vim, and pretty much all other text-editing applications – merlin2011 Feb 16 '14 at 0:31
  • Output of fc-match SimSun is DejaVuSerif.ttf: "DejaVu Serif" "Book" – merlin2011 Feb 16 '14 at 0:32
  • Did you try substituting it, then? – cfr Feb 16 '14 at 0:47
  • Yes, I tried \setCJKmainfont{DejaVuSerif} and the output changed into a bunch of square boxes, instead of throwing an error. – merlin2011 Feb 16 '14 at 1:06
3

As you said, there are two options. Both involve downloading a font. You can double-click to install or move/copy them to ~/.fonts.

Just check the name of the font and then include it in your Latex document as your example. You can download Chinese fonts using your package manager.

There are some fonts you can download if you have Adobe Reader at:

http://www.adobe.com/support/downloads/product.jsp?product=10&platform=Unix

Search for Chinese.

If you want to know the name of the font to use with XeLaTeX, the easiest way is to open LibreOffice and scroll down the font menu. LibreOffice will show Chinese characters (or any other non-Latin characters) next to the name of the font if it is supported.

Here, for instance, I get: AR PL SungtiL GB and others (Chinese), IPAPGothic and IPAPMincho for Japanese, and NanumMyeongjo etc. for Korean.

A MWE:

\documentclass{article}
\usepackage{xeCJK}
\setCJKmainfont{AR PL SungtiL GB}

\begin{document}

\Huge 

文章内容


\end{document}
| improve this answer | |
  • Possibly due to edited question, this isn't correct. If @merlin2011 has Chinese fonts already installed, it is probably possible to use them directly using XeLaTeX without downloading anything additional. – cfr Feb 15 '14 at 23:49
  • See my updated answer. – BlackBird Feb 16 '14 at 10:22

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.