2

Firstly, apologies for my ignorance but I have tried all the options given in: this post. However, I still am unable to get it working.

From the above post, I am trying to achieve this:

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

And compiling from either Texmaker or the command line using: xelatex file.tex does not work.

I get the error:

fontspec error: "fond-not-found"!! The font SimSun cannot be found.!! ...

I'm sorry again but I've found the online material regarding this problem to be very difficult to understand.

I am using Ubuntu 16.04

How do I get this to compile properly?

  • Do you have the font SimSun installed? – David Purton Dec 22 '18 at 00:28
  • @DavidPurton I don't know, how do I check / try? – user9506231 Dec 22 '18 at 00:32
  • XeTeX uses system fonts. So can you use SimSun in other applications? (e.g., a Word Processor.) – David Purton Dec 22 '18 at 00:33
  • I don't know how to check if I can use SimSun else where – user9506231 Dec 22 '18 at 00:36
  • If you don't have SimSun (which you might not if you don't own Microsoft products) you can use any font installed on your computer that supports CJK characters. If you don't have any, you could use the Noto fonts which are free. – David Purton Dec 22 '18 at 00:40
  • What Operating System do you use? – David Purton Dec 22 '18 at 00:41
  • I am on Ubuntu 16.04. When you say: you can use any font installed on your computer that supports CJK characters, what do you mean by that? Are you referring to entering the characters into the .tex document? – user9506231 Dec 22 '18 at 00:44
  • 1
    SimSin is the name of a font. (Like Times New Roman is the name of a font.). Your problem is that you don't have SimSun installed on your computer. You don't have to use SimSun, but you do need a font that includes Chinese characters. Installing fonts for your computer is offtopic for this site, so you will need to ask elsewhere. In your tex file you could try changing \setCJKmainfont{SimSun} to \setCJKmainfont{Noto Sans CJK} which you may already have installed on your computer. – David Purton Dec 22 '18 at 00:55
  • Okay, I will try to install a new font. Thank you – user9506231 Dec 22 '18 at 01:00
  • @DavidPurton Could you point me in the right direction for seeking help regarding installing new fonts? I don't understand how / where to install which fonts and can't find instructions / steps online. – user9506231 Dec 22 '18 at 01:25
  • On Ubuntu, you can check whether a font is installed with fc-match. Install a font by copying the files (normally .otf) into /usr/local/share/fonts/ to install them for everyone, or create a directory ~/.fonts/ and copy them there to install only for yourself. – Davislor Dec 22 '18 at 01:32
  • If you dual-boot Windows, you can also use ln -s to add symbolic links from /Windows/Fonts on your Windows partition to your local Linux font directory. – Davislor Dec 22 '18 at 01:34
  • You might also find otfinfo and fc-list helpful for finding information on font files. – Davislor Dec 22 '18 at 01:36
  • I have downloaded several NotoSansSC .otf files and put them in /usr/local/share/fonts and rebooted, however the XeLaTeX complication is still failing due to the "font-not-found" error from using \setCJKmainfont{Noto Sans CJK}. – user9506231 Dec 22 '18 at 01:39
  • By the way, on Ubuntu, use apt search or an online search to figure out if there’s a Ubuntu or Debian package for the font you’re looking for. Let your package manager handle it if possible! – Davislor Dec 22 '18 at 03:36

1 Answers1

0

To fix the issue, I had to follow these steps:

  1. Download the fonts to use (I used Noto Sans CJK)
  2. Put the font files (.otf) in /usr/local/share/fonts
  3. After rebooting, use this line to tell XeLaTeX to get those fonts: \setCJKmainfont{Noto Sans CJK SC}