当我尝试在 moderncv 中启用 fontawesome 图标时,日志中出现此错误pdflatex
:
! LaTeX Error: Encoding scheme `TU' unknown.
一个简单的例子:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{babel}
\name{John}{Doe}
\title{C/C++ Development}
\phone[mobile]{+1~xxx-yyyy}
\email{[email protected]}
\homepage{www.tractor.com}
\social[linkedin]{johndoe}
\social[github]{john-doe}
\social[stackoverflow]{012345/johndoe}
\social[orcid]{0000-0001-2345-6778}
\social[researchgate]{John-Doe}
\social[googlescholar]{ADFIE89AD}
\moderncvicons{awesome}
\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}
\begin{document}
\makecvtitle
foo
\end{document}
在fontawesomebrands.fd
和fontawesomepro.fd
中有很多对的引用TU
,所以它似乎是某种核心元素。但是没有来自的任何提示pdflatex
,也没有在谷歌搜索中找到任何信息,我无法找出缺少什么或配置错误的地方。
更新:日志文件中的摘录看起来与 fontawesome 相关(因为无法发布实际的日志文件附件):
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=pdflatex 2023.3.13) 10 AUG 2023 12:33
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**minimal.tex
(./minimal.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-05-07>
(/usr/share/texlive/texmf-dist/tex/latex/moderncv/moderncv.cls
Document Class: moderncv 2021/01/21 v2.1.0 modern curriculum vitae and letter document class
...
(/usr/share/texlive/texmf-dist/tex/latex/fontawesome5/fontawesome5.sty
Package: fontawesome5 2020/03/24 v5.13.0 Font Awesome 5
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
Package: l3keys2e 2021-05-07 LaTeX2e option processing using LaTeX3 keys
)
(/usr/share/texlive/texmf-dist/tex/latex/fontawesome5/fontawesome5-generic-help
er.sty
Package: fontawesome5-generic-helper 2020/03/24 v5.13.0 non-uTeX helper for fon
tawesome5
(/usr/share/texlive/texmf-dist/tex/latex/fontawesome5/fontawesome5-mapping.def)
)) (/usr/share/texlive/texmf-dist/tex/latex/academicons/academicons.sty
Package: academicons 2020/08/14 v1.9.0 Academicons Icons
))
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
Package: hyperref 2021-02-27 v7.00k Hypertext links for LaTeX
...
LaTeX Font Info: Trying to load font information for U+fontawesomefree2 on i
nput line 33.
(/usr/share/texlive/texmf-dist/tex/latex/fontawesome5/ufontawesomefree2.fd)
(/usr/share/texlive/texmf-dist/tex/latex/microtype/mt-cmr.cfg
File: mt-cmr.cfg 2013/05/19 v2.2 microtype config. file: Computer Modern Roman
(RS)
)
LaTeX Font Info: Trying to load font information for TS1+lmr on input line 3
3.
(/usr/share/texlive/texmf-dist/tex/latex/lm/ts1lmr.fd
File: ts1lmr.fd 2015/05/01 v1.6.1 Font defs for Latin Modern
)
LaTeX Font Info: Trying to load font information for U+fontawesomefree1 on i
nput line 33.
(/usr/share/texlive/texmf-dist/tex/latex/fontawesome5/ufontawesomefree1.fd)
LaTeX Font Info: Trying to load font information for U+fontawesomebrands0 on
input line 33.
(/usr/share/texlive/texmf-dist/tex/latex/fontawesome5/ufontawesomebrands0.fd)
LaTeX Font Info: Font shape `U/fontawesomebrands0/solid/n' in size <10> not
available
(Font) Font shape `U/fontawesomebrands0/regular/n' tried instead o
n input line 33.
LaTeX Font Info: Trying to load font information for U+fontawesomebrands1 on
input line 33.
(/usr/share/texlive/texmf-dist/tex/latex/fontawesome5/ufontawesomebrands1.fd)
LaTeX Font Info: Font shape `U/fontawesomebrands1/solid/n' in size <10> not
available
(Font) Font shape `U/fontawesomebrands1/regular/n' tried instead o
n input line 33.
! LaTeX Error: Encoding scheme `TU' unknown.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.33 \end{document}
答案1
未知消息TU
表明您正在尝试在 pdfLaTeX 文档中使用仅适用于 LuaLaTeX 和 XeLaTeX 的字体包。
导致该问题的字体是当选择时academicons
会自动加载moderncv
至版本 2.1.0 的字体。\moderncvicons{awesome}
在moderncv
2.2.0 版本(于 2021-07-28 发布)中,\moderncvicons{awesome}
已更改为不再自动加载academicons
,因此与 pdfLaTeX 兼容。
因此,为了解决这个问题,你需要安装一个更新的moderncv
版本。最新版本 (v2.3.1) 仍然包含在 TeX Live 2021 中,因此您可以通过更新到 TeX Live 2023 或安装现有 TeX Live 2021 的软件包更新来执行此操作。尝试更新现有安装时,请记住,自 TeX Live 2022 发布以来,默认镜像不再包含 TeX Live 2021 的软件包,因此要更新 TeX Live 2021,您必须按照说明进行操作用于更新历史分布。这是假设您手动安装了 TeX Live。如果您从某个分发包中获取了它,则需要按照常规步骤更新您的包。