我正在尝试编译一个简单的乳胶文档:
\documentclass{report}
\usepackage{inconsolata}
\begin{document}
\normalfont\ttfamily
Some text
\end{document}
但我的输出是这样的:
与预期不同:
删除后\usepackage{inconsolata}
我会得到默认的 \ttfamily 字体但我希望能够使用 inconsolas。
我在 Windows 上使用 MiKTeX 发行版,在使用 Lualatex 进行编译时,我得到以下输出:
This is LuaTeX, Version 1.06.2 (MiKTeX 2.9.6530 64-bit)
restricted system commands enabled.
(./testing_tt.tex
LaTeX2e <2017-04-15>
(using cache: C:/Users/XYZ/AppData/Local/MiKTeX/2.9/luatex-cache/generic)
luaotfload | main : initialization completed in 0.493 seconds
Babel <3.15> and hyphenation patterns for 1 language(s) loaded.
("C:/Program Files/MiKTeX 2.9/tex/latex/base/report.cls"
Document Class: report 2014/09/29 v1.4h Standard LaTeX document class
("C:/Program Files/MiKTeX 2.9/tex/latex/base/size10.clo"(load luc: C:/Users/XYZ/AppData/Local/MiKTeX/2.9/luatex-cache/generic/fonts/otl/lmroman10-regular.lu
c))) ("C:/Program Files/MiKTeX 2.9/tex/latex/inconsolata/inconsolata.sty"
`inconsolata-zi4' v1.112, 2017/01/04 Text macros for Inconsolata (msharpe)
("C:/Program Files/MiKTeX 2.9/tex/latex/base/textcomp.sty"
("C:/Program Files/MiKTeX 2.9/tex/latex/base/ts1enc.def"))
("C:/Program Files/MiKTeX 2.9/tex/latex/xkeyval/xkeyval.sty"
("C:/Program Files/MiKTeX 2.9/tex/generic/xkeyval/xkeyval.tex"
("C:/Program Files/MiKTeX 2.9/tex/generic/xkeyval/xkvutils.tex"
("C:/Program Files/MiKTeX 2.9/tex/generic/xkeyval/keyval.tex")))))
(./testing_tt.aux) ("C:/Program Files/MiKTeX 2.9/tex/latex/base/ts1cmr.fd")
("C:/Program Files/MiKTeX 2.9/tex/latex/upquote/upquote.sty")
LaTeX Font Warning: Font shape `TU/zi4/m/n' undefined
(Font) using `TU/lmr/m/n' instead on input line 4.
[1{C:/Users/XYZ/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]
(./testing_tt.aux)
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
)
355 words of node memory still in use:
2 hlist, 1 vlist, 1 rule, 2 glue, 3 attribute, 45 glue_spec, 3 attribute_lis
t, 1 write nodes
avail lists: 2:15,3:2,4:1,5:21,6:1,7:22,8:1,9:6
<c:/program files/miktex 2.9/fonts/opentype/public/lm/lmroman10-regular.otf>
Output written on testing_tt.pdf (1 page, 3672 bytes).
Transcript written on testing_tt.log.
我意识到我收到有关字体不可用的警告(大概是 inconsolata),我不明白为什么。
miktex-makepk.log 显示:
2018-01-03 01:29:03,274+0100 INFO miktex-makepk - starting with command line: miktex-makepk --enable-installer --verbose ot1-zi4r-0 600 600 magstep(0.0)
2018-01-03 01:29:03,276+0100 INFO makepk - Trying to make PK font ot1-zi4r-0 at 600 DPI...
2018-01-03 01:29:03,286+0100 INFO makepk - The METFAONT mode is: ljfour
2018-01-03 01:29:03,293+0100 INFO makepk - Running miktex-makemf.exe...
2018-01-03 01:29:03,296+0100 INFO makepk - running: miktex-makemf.exe --verbose ot1-zi4r-0
2018-01-03 01:29:03,600+0100 INFO makepk - Running miktex-ttf2pk.exe...
2018-01-03 01:29:03,604+0100 INFO makepk - running: miktex-ttf2pk.exe -q -t ot1-zi4r-0
2018-01-03 01:29:03,899+0100 FATAL miktex-makepk - PK font ot1-zi4r-0 could not be created.
我有:
- 通过 MiKTeX 包管理器(以管理员身份)卸载并重新安装 inconsolata 包
- 确保 inconsolata 样式文件存在(据我所知,此消息
'inconsolata-zi4' v1.112, 2017/01/04 Text macros for Inconsolata (msharpe)
表明它也被找到) - 已验证 *.pfb 字体文件是否存在于:C:\Program Files\MiKTeX 2.9\fonts\type1\public\inconsolata
我不知道还能去哪里查找,也许其他人知道可能是什么问题?
答案1
答案2
由于您似乎正在使用 LuaLaTeX,因此不应直接加载该inconsolata
包。相反,请使用以下说明:
\usepackage{fontspec}
\setmonofont{inconsolata}
此设置会加载 OpenType 字体文件。并且,如果您使用和Inconsolatazi4-Regular.otf
的组合,OpenType 字体文件也会自动加载。\ttfamily
\bfseries
Inconsolatazi4-Bold.otf