Japanese / CJK support

Hi

I followed the steps mentioned in the following post, but cant make it work.
Also I see that tectonic is based on XeTex, and should have been able to support all utf8 stuff out of the box.


Thanks

cant make it work

What errors are you getting?

Tectonic internally uses the XeTeX engine so any code for XeTeX should just work. It supports UTF-8 out of the box, but you have to specify the fonts for the latex engine to use. I myself use the following on Ubuntu:

\usepackage{xeCJK}
\setCJKmainfont{Noto Serif CJK JP}
\setCJKsansfont{Noto Sans CJK JP}

For the fonts to work, they must be installed on the system. Noto Serif CJK JP is installed by default on Ubuntu 17.10. MS Mincho suggested in the linked posts are installed on Windows. macOS has Hiragino I think.

1 Like

Thanks this works…
The code given in the stackoverflow doesnt work… no errors; it just doesn’t render anything…

I think it depends on which StackOverflow example you use — some of them will explicitly error out with a missing font file. Here’s another option that worked for me that uses a file provided in the default Tectonic bundle, which means that it should work regardless of what fonts you have installed on your system:

\documentclass{article}
\usepackage{xeCJK}
\setCJKmainfont{FandolSong-Regular.otf}
\begin{document}

\section{日本語}
お早う

\textsf{こんにちわ}

\end{document}

Oh, a good find, thanks! Just a word of caution though, these seem to be Chinese fonts and therefore some characters might not look as they are usually written in Japan.