0

Dealing with multiple language (such as the many translation of Frozen: this is Japanese):

降り始めた雪は 足跡消して
真っ白な世界に一人の私

I got a message for each character will flag "Unicode character X (U+xxxx) not setup for use with Latex" e.g. "Unicode character 降 (U+964D) not setup for use with Latex". I need to deal with Chinese as well (e.g. Frozen has 3 Chinese translation for mainland China, Hong Kong and Taiwan).

For example some Chinese character (not Japanese Hans) like I (我 U+6211) still no good.

The other answers use

-space it out or -one-by-one i.e. via

"\DeclareUnicodeCharacter{00A0}{\nobreakspace}" etc.

But I obviously cannot define the whole Japanese Hans (2000 characters) or even the Chinese Hans character (200,000 characters) one-by-one.

Another option is to use texlive extra. No installation other than using ports (I use brew) and hence I am not sure I can go that path as it totally redefine my systems. In fact one Taiwan site said you can install MacTex and it is ok for UNICODE. I have full MacTex. Does not seems to work

How to solve this problem? Somehow I missed some solution here, as I were distracted by other path. But if one insists on pdflatex, the solution is still there. Hence it can be closed.

6
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Sep 19, 2022 at 4:48
  • You say you have MacTeX -- MacTeX2022, right? -- installed on your computer. If I understand your setup correctly, the following test program should compile just fine under LuaLaTeX if a suitable Opentype font that supports Japanese characters -- Google's Noto Sans JP or Noto Serif JP, say -- is installed on your computer. \documentclass{article} \usepackage{fontspec} \setmainfont{Noto Sans JP} \begin{document} 降り始めた雪は 足跡消して 真っ白な世界に一人の私 \end{document}.
    – Mico
    Sep 19, 2022 at 5:21
  • note @Mico example should be run with lualatex or xelatex not pdflatex all three are part of the texlive you have installed you are using pdftex which has very limited unicode support and requires 8bit fonts in legacy formats Sep 19, 2022 at 6:22
  • 2
    if you want to stick to pdflatex you can use the cjkutf8 package, e.g. tex.stackexchange.com/a/285836/2388, but the unicode engines are a better choice imho. Sep 19, 2022 at 7:21
  • I use this solution to solve the Chinese Hans issue. tex.stackexchange.com/questions/581342/… But the Japanese still not ok. Hence I will dig further based on the solution here. In particular the pdflatex (I use both texShop and texStudio) solution in tex.stackexchange.com/questions/285792/… does not work for me. As I have both Japanese and Chinese lyrics to analysis and compare, it is not going to work if the whole environment (in the preamble part) would not work.
    – Dennis Ng
    Sep 19, 2022 at 9:51

2 Answers 2

1

If you need short passages in multiple East Asian languages, you could switch between them using Babel in LuaLaTeX. (Or any combination of Babel or Polyglossia in LuaLaTeX or XeLaTeX.)

Legacy 8-bit TeX fonts are the wrong tool for multilingual text. Some publishers still make you use PDFTeX in 2022, but that’s not the case here.

Here is a MWE using the Noto fonts, from Google and a pair of Chinese translations from this site. I apologize for any errors, but you can compare the character 雪 in all three versions and see that it displays correctly.

\documentclass{article}
\tracinglostchars=3
\usepackage[english]{babel}
\usepackage{fontspec}
\usepackage{parskip}

\babelprovide[import]{japanese}
\babelprovide[import]{chinese-simplified}
\babelprovide[import]{chinese-traditional}

\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX, Renderer=HarfBuzz }

\babelfont{rm}
          [Scale=1.0]{Noto Serif}
\babelfont[japanese]{rm}
          {Noto Serif CJK jp}
\babelfont[chinese-simplified]{rm}
          {Noto Serif CJK sc}
\babelfont[chinese-traditional]{rm}
          {Noto Serif CJK tc}

\begin{document}
\subsection*{English}
The snow glows white on the mountain tonight

Not a footprint to be seen

\subsection*{Japanese}
\begin{otherlanguage}{japanese}
降り始めた雪は 足跡消して

真っ白な世界に一人の私
\end{otherlanguage}

\subsection*{Chinese (Simplified)}
\begin{otherlanguage}{chinese-simplified}
今晚山上的雪发出白光看不见脚印
\end{otherlanguage}

\subsection*{Chinese (Traditional)}
\begin{otherlanguage}{chinese-traditional}
嶺上積雪今夜泛著白光

不見蹤跡的地方
\end{otherlanguage}

\end{document}

Noto Fonts sample

1
  • Thanks and would look into it, after temporarily solve the issue. Definitely not the final solution. CHeers
    – Dennis Ng
    Sep 27, 2022 at 6:21
0

The solution is based on https://tex.stackexchange.com/a/285836/2388 and Writing Japanese in Latex2e with a focus on multiple language switching under latexPDF. I myself will listen to some of the comments and try other solution (except not livened extra as I cannot use Port). But given my current environment is latexPDF, I stick on this.

%...
\usepackage{CJKutf8}
%...
\begin{CJK}{UTF8}{min}
降り始めた雪は 足跡消して
真っ白な世界に一人の
\end{CJK}
%...
\begin{CJK*}{UTF8}{gbsn}你有问题吗?\end{CJK*}

\begin{CJK*}{UTF8}{gkai}你有问题吗?\end{CJK*}

\begin{CJK*}{UTF8}{bsmi}你有問題嗎?\end{CJK*}
    
\begin{CJK*}{UTF8}{bkai}你有問題嗎?\end{CJK*} 
%...

The key is the use of CJK and CJK*. Still not sure why but it works. BTW, does not include {verbatim}, it does not work with the Japanese CJK min option.

You must log in to answer this question.

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