我如何将 LuaLaTeX 用于 `europasscv`?

我如何将 LuaLaTeX 用于 `europasscv`?

我想用europasscv与我其他申请材料等相同的格式编写一个,为此我使用了LuaLaTeX。到目前为止的问题是,我甚至无法使用TeX Gyre Heros无字体,它是 中的主字体europassveuopasscv似乎既不接受LuaLaTex也不接受fontspec

% -- mode: latex; TeX-engine: luatex; coding: utf-8; --
\RequirePackage{xparse}
\documentclass[german,a4paper,heros]{europasscv} %I've defined europasscv_de.def and (inside europasscv.cls) \DeclareOption{heros}{\renewcommand{\rmdefault}{qhv}\renewcommand{\sfdefault}{qhv}} AFTER it failed the first times
\setmainfont{TeX Gyre Heros}% [ItalicFont=TeXGyreHeros-Italic,
%              BoldFont=TeXGyreHeros-Bold,
%              BoldItalicFont=TeXGyreHeros-BoldItalic]
\setromanfont{TeX Gyre Heros}
\setsansfont{TeX Gyre Heros}% [ItalicFont=TeXGyreHeros-Italic,
%              BoldFont=TeXGyreHeros-Bold,
%              BoldItalicFont=TeXGyreHeros-BoldItalic]
\usepackage{polyglossia}
\setmainlanguage[latesthyphen=true,babelshorthands=true]{german}
\setotherlanguage[variant=british]{english}
\ecvname{My Self}
\ecvaddress{Townstreet, D-12345 Town}
\ecvtelephone[(+49) 1234 5689]{(+49) 1234 56789}
\ecvemail{[email protected]}
\ecvnationality{deutsch}
\begin{document}
  \begin{europasscv}
  \ecvpersonalinfo
  \ecvbigitem{Angestrebter Beruf}{Bla}
  \ecvsection{Berufserfahrung}
  \ecvtitle{Oktober 2003 -- Juli 2004}{\emph{teaching fellow}}
  \ecvitem{}{Council\newline 123, Sample Kay, 75023 Smurftown}
  \ecvitem{}{Evaluation of Smurfs}
\end{europasscv}
\end{document}

我尝试了很多方法: ...\renewcommand*{\familydefault}{qhv} \renewcommand*{\sfdefault}{qhv} \renecommand{\rmdefault}{\sfdefault}, texgyreheros-regular.otfTeX Gyre Heros都不起作用。ix.log抱怨


LaTeX Font Warning: Font shape EU2/qhv/m/n' undefined
(Font)              usingEU2/lmr/m/n' instead on input line 20.
[...]
ABD: EveryShipout initializing macros
* you should not be loading the inputenc package
* XeTeX expects the source to be in UTF8 encoding %<--I'm not using XeTeX!
*** some features of other encodings may conflict, resulting in poor output.
LaTeX Font Warning: Font shape EU2/phv/m/n' undefined
(Font)              usingEU2/lmr/m/n' instead on input line 40.
结果我既没有得到Herosas sansfont,也没有使用任何其他 sansfont。相反,它只使用LMRoman。没有fontspecpolyglossia它可以与一起使用LuaLaTeX,但我既不能使用我想要的字体,也不能使用德语的特殊字体。

答案1

europasscv不是真正设计用于与其他字体和xelatex/lualatex编译一起使用。

一种方法是使用蛮力并明确地添加\sffamily到各种\ecv...命令中,最后在europasscv环境内。

%\RequirePackage{xparse}
\documentclass[german,a4paper]{europasscv} %I've defined europasscv_de.def and (inside europasscv.cls) \DeclareOption{heros}{\renewcommand{\rmdefault}{qhv}\renewcommand{\sfdefault}{qhv}} AFTER it failed the first times
    \usepackage{fontspec}
    \setmainfont[
        Extension=.otf,
        UprightFont= *-regular,
        BoldFont=*-bold,
        ItalicFont=*-italic,
        BoldItalicFont=*-bolditalic,
    ]{texgyreheros}

    \setromanfont{texgyreheros}
    \setsansfont[Extension=.otf,
        UprightFont= *-regular,
        BoldFont=*-bold,
        ItalicFont=*-italic,
        BoldItalicFont=*-bolditalic]
    {texgyreheros}% 

    \usepackage{polyglossia}

    \usepackage{xpatch}



    \makeatletter
    \ecvfootnote{\protect\sffamily\textcopyright~\ecv@europeanunionkey, 2002-2014 | http://europass.cedefop.europa.eu }
    \makeatother


    \renewcommand{\ecvcoloredtitle}{\sffamily\textcolor{ecvhighlightcolor}{\ecvcurrvitae}}
    \renewcommand{\ecvsectionstyle}[1]{\textcolor{ecvsectioncolor}{\sffamily\MakeUppercase{\expandafter{#1}}}}
    \renewcommand{\ecvbluenormalstyle}[1]{\sffamily\textcolor{ecvsectioncolor}{#1}}
    \renewcommand{\ecvtitlestyle}[1]{\large{\ecvbluenormalstyle{#1}}}
    \renewcommand{\ecvlargenormalstyle}[1]{\large \sffamily #1}
    \renewcommand{\ecvLargenormalstyle}[1]{\Large \sffamily #1}


    \setmainlanguage[latesthyphen=true,babelshorthands=true]{german}
    \setotherlanguage[variant=british]{english}

    \ecvname{My Self}
    \ecvaddress{Townstreet, D-12345 Town}
    \ecvtelephone[(+49) 1234 5689]{(+49) 1234 56789}
    \ecvemail{[email protected]}
    \ecvnationality{deutsch}

    \begin{document}
      \begin{europasscv}
        \sffamily % Explicitly switch to sans serif
        \ecvpersonalinfo
        \ecvbigitem{Angestrebter Beruf}{Bla}
        \ecvsection{Berufserfahrung}
        \ecvtitle{Oktober 2003 -- Juli 2004}{\emph{teaching fellow}}
        \ecvitem{}{Council\newline 123, Sample Kay, 75023 Smurftown}
        \ecvitem{}{Evaluation of Smurfs}
    \end{europasscv}
    \end{document}

在此处输入图片描述

相关内容