在 komacv 中用 fontawesome5 代替 fontawesome?

在 komacv 中用 fontawesome5 代替 fontawesome?

在最新版本的fontawesome5when 与 一起使用时komacv,例如与 MWE 的尝试一起使用

\documentclass[11pt,a4paper,sans,,DIV=12]{komacv}%
\usepackage[pro]{fontawesome5}%
\faStyle{light}%
\usepackage{xunicode,xltxtra,refcount,amsmath,amssymb,amsthm}
\usepackage[german]{babel}
\usepackage[languages={english,german}]{komacv-multilang}

\begin{document}
\faIcon{envelope}
\end{document}

引入三个错误

Latex Error: /usr/local/texlive/2019/texmf-dist/tex/latex/fontawesome5/fontawesome5.sty:80 LaTeX3 Error: Command '\faRepeat' already defined!

For immediate help type H .

...

l.80 }

Latex Error: /usr/local/texlive/2019/texmf-dist/tex/latex/fontawesome5/fontawesome5.sty:125 LaTeX3 Error: Command '\faWifi' already defined!

For immediate help type H .

...

l.125 }

Latex Error: /usr/local/texlive/2019/texmf-dist/tex/latex/fontawesome5/fontawesome5.sty:145 LaTeX3 Error: Command '\faSignal' already defined!

For immediate help type H .

...

l.145 }

我认为这可能源于komacv加载fontawesome(令人惊讶的是重叠只有 3 个命令),因为注释掉第 48 行可以komacv.cls解决这个问题。

该怎么办呢?修改 komacv 以加载其中一个包,但不会同时加载两个包?

答案1

最好的解决方法是添加一个选项,例如或fa5 ,这样如果给出此选项,komacv 就会加载而不是。但如果您只是希望文档正常工作而不必等待 的更新,您可以通过假装已经加载来作弊:fontawesome5komacvfontawesome5fontawesomekomacvfontawesome

\expandafter\def\csname [email protected]\endcsname{}% Fake that fontawesome is loaded
\documentclass[11pt,a4paper,sans,,DIV=12]{komacv}%
\expandafter\let\csname [email protected]\endcsname\undefined% No longer fake fontawesome in order not to confuse later packages
\usepackage[pro]{fontawesome5}%
\faStyle{light}%
\usepackage{xunicode,xltxtra,refcount,amsmath,amssymb,amsthm}
\usepackage[german]{babel}
\usepackage[languages={english,german}]{komacv-multilang}

\begin{document}
\faIcon{envelope}
\end{document}

相关内容