我刚刚安装了 MacTex2018(因为我遇到了 TexLive2016 的问题)。
我的问题与中文字符有关。请问可以举一个简单的例子吗?
最后,我希望文档中大部分都是英文,但只包含一些中文单词。
我尝试过这个:
\documentclass[UTF8]{ctexart}
\begin{document}
你好
\end{document}
然后得到:
$ pdflatex report.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./report.tex
LaTeX2e <2018-04-01> patch level 2
Babel <3.18> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/ctexart.cls
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3kernel/l3pdfmode.def))
Document Class: ctexart 2018/01/28 v2.4.12 Chinese adapter for class article (C
TEX)
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/ctexhook.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/ctexpatch.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/fix-cm.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/ts1enc.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/ts1enc.dfu)))
(/usr/local/texlive/2018/texmf-dist/tex/latex/ms/everysel.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/config/ctexopts.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.de
f (/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/CJKutf8.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/inputenc.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/CJK.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/mule/MULEenc.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/CJK.enc))
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/fontenc.sty))
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjkpunct/CJKpunct.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjkpunct/CJKpunct.spa))
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/CJKspace.sty)
(/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/ctexspa.def)
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/CJKfntef.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/CJKulem.sty
(/usr/local/texlive/2018/texmf-dist/tex/generic/ulem/ulem.sty))))
(/usr/local/texlive/2018/texmf-dist/tex/latex/zhnumber/zhnumber.sty
(/usr/local/texlive/2018/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg))
(/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-a
rticle.def
(/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg))
(/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/ctex-c5size.clo)
(/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Critical ctex error: "fontset-unavailable"
!
! CTeX fontset `mac' is unavailable in current mode.
!
! See the ctex documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.47 }
?
)) (/usr/local/texlive/2018/texmf-dist/tex/latex/ctex/config/ctex.cfg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/UTF8/UTF8.bdg)
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/UTF8/UTF8.enc)
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/UTF8/UTF8.chr)
(./report.aux) ABD: EverySelectfont initializing macros
(/usr/local/texlive/2018/texmf-dist/tex/latex/cjk/texinput/UTF8/c70song.fd)
[1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./report.aux)
kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 1+32/600 --dpi 632 cyberb59
mktexpk: don't know how to create bitmap font for cyberb59.
mktexpk: perhaps cyberb59 is missing from the map file.
kpathsea: Appending font creation commands to missfont.log.
)
!pdfTeX error: pdflatex (file cyberb59): Font cyberb59 at 632 not found
==> Fatal error occurred, no output PDF file produced!
也许我应该尝试解决关键错误部分Critical ctex error: "fontset-unavailable"
,但它指向我一份中文文档,http://ctan.math.illinois.edu/language/chinese/ctex/ctex.pdf,(如果有英文版就没意义了?)。
答案1
您可以使用xelatex
或lualatex
来编译,而不是pdflatex
。在 macOS 上, 使用的默认中文字体ctex
是 OpenType 字体,而 pdfLaTeX 无法(轻易)使用这些字体。
的开发人员ctex
曾考虑提供文档的英文版本,但由于某些原因,他们没有这样做。但是,您可以通过以下方式直接询问他们GitHub。