It’s not possible to do that correctly without language tagging. The original sin of Unicode was thinking that 16 bits could be enough. To try to make that work, the Unicode Consortium assigned the same codepoints to Chinese characters and Japanese Kanji (and also traditional Korean and Vietnamese forms of the same Chinese characters). Then they had to abandon 16 bits anyway, leaving them with a worst-of-both-worlds compromise.
You can tag multiple ideographic scripts in babel
or polyglossia
. This sample requires you to download the Noto CJK fonts and compile in LuaLaTeX or XeLaTeX.
\documentclass{article}
\tracinglostchars=3 % Make it an error if characters are missing.
\usepackage[english]{babel}
\usepackage{parskip}
\babelprovide[import]{japanese}
\babelprovide[import]{korean}
\babelprovide[import=zh-hant]{chinese} % Or zh-hans for Simplified Chinese
\babelfont{rm}
{Noto Serif}
\babelfont[chinese]{rm}
[Renderer=HarfBuzz]{Noto Serif CJK tc}
\babelfont[japanese]{rm}
[Renderer=HarfBuzz]{Noto Serif CJK jp}
\babelfont[korean]{rm}
[Renderer=HarfBuzz]{Noto Serif CJK kr}
\begin{document}
Japanese: \foreignlanguage{japanese}{フォントはまた、数学的な形態および他の環境で使用することができるフォントはまた、数学的な形態および他の環境で使用することができる}
Chinese: \foreignlanguage{chinese}{关于数学部分}
Korean: \foreignlanguage{korean}{전체 문서에 대한 기본 정보를 소개 단락.}
\end{document}
If you try to auto-detect all three languages, you get this:
\documentclass{article}
\tracinglostchars=3 % Make it an error if characters are missing.
\usepackage[english]{babel}
\usepackage{parskip}
\babelprovide[import, onchar=fonts ids]{japanese}
\babelprovide[import, onchar=fonts ids]{korean}
\babelprovide[import=zh-hant, onchar=fonts ids]{chinese} % Or zh-hans for Simplified Chinese
\babelfont{rm}
{Noto Serif}
\babelfont[chinese]{rm}
[Renderer=HarfBuzz]{Noto Serif CJK tc}
\babelfont[japanese]{rm}
[Renderer=HarfBuzz]{Noto Serif CJK jp}
\babelfont[korean]{rm}
[Renderer=HarfBuzz]{Noto Serif CJK kr}
\begin{document}
Japanese: フォントはまた、数学的な形態および他の環境で使用することができるフォントはまた、数学的な形態および他の環境で使用することができる
Chinese: 关于数学部分
Korean: 전체 문서에 대한 기본 정보를 소개 단락.
\end{document}
If you switch between this image and the one above, you will see that Kanji are displayed in their traditional Chinese forms. If you had loaded Japanese last, the Chinese characters would be displayed in their Japanese forms instead.
texlive-latex-base="2018.20190227-2" texlive-fonts-recommended="2018.20190227-2" texlive-fonts-extra latex-cjk-*
so I guess installing the latest TexLive, would I still need ``texlive-latex-base`?