TransWikia.com

Chinese characters not displayed when using CJK

TeX - LaTeX Asked on May 15, 2021

The following minimal example does not show all the five characters in Chinese. How can I fix that?

documentclass{article}
usepackage[utf8]{inputenc}
usepackage{CJK}
begin{document}
begin{CJK*}{UTF8}{bsmi}你有问题吗?end{CJK*}      
end{document}

The output of file -i is text/x-tex; charset=utf-8 which looks reasonable to me. My file is compiled via pdftex:

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex)
restricted write18 enabled.
entering extended mode
(./sample.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty)
(/usr/share/texmf/tex/latex/CJK/CJK.sty
(/usr/share/texmf/tex/latex/CJK/mule/MULEenc.sty)
(/usr/share/texmf/tex/latex/CJK/CJK.enc))
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)
(./sample.aux) (/usr/share/texmf/tex/latex/CJK/UTF8/UTF8.bdg)
(/usr/share/texmf/tex/latex/CJK/UTF8/UTF8.enc)
(/usr/share/texmf/tex/latex/CJK/UTF8/UTF8.chr)
(/usr/share/texmf/tex/latex/CJK/UTF8/c70bsmi.fd)
(/usr/share/texmf/tex/latex/CJK/UTF8/c70bsmi.fdx) [1{/var/lib/texmf/fonts/map/p
dftex/updmap/pdftex.map}] (./sample.aux) )
(see the transcript file for additional information)</usr/share/texmf/fonts/typ
e1/arphic/bsmiu/bsmiu4f.pfb></usr/share/texmf/fonts/type1/arphic/bsmiu/bsmiu67.
pfb></usr/share/texmf/fonts/type1/arphic/bsmiu/bsmiuff.pfb></usr/share/texlive/
texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on sample.pdf (1 page, 14847 bytes).
Transcript written on sample.log.

I am looking for any means to display Chinese text in Latex file.

One Answer

If you're free to use LuaLaTeX or XeLaTeX, you can use any OpenType that may be installed on your system. E.g., the Noto Serif/Sans CJK TC (tranditional Chinese) or SC (simplified Chinese) fonts, which provide an above average amount of glyphs and can be downloaded free of charge. No need anymoreto switch into and out of CJK or CJK* environments.

enter image description here

documentclass{article}
usepackage{fontspec}
setmainfont{Noto Serif CJK TC}
setsansfont{Noto Sans CJK TC}

begin{document}
Hello. 你有问题吗?

sffamily
Hello. 你有问题吗?
end{document}

Correct answer by Mico on May 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP