有没有办法将自定义字体与 moderncv 一起使用?

有没有办法将自定义字体与 moderncv 一起使用?

该软件包moderncv仅提供了两种字体选择roman& sans。我在该软件包的源代码中看到了以下声明:

\DeclareOption{sans}{\AtBeginDocument{\renewcommand{\familydefault}{\sfdefault}}}

是否有任何技巧可以在 .tex 文件内部重载它以便加载另一种字体?

答案1

好的,这是 CV 的示例libertine。如果需要,请将 `sans 更改为 rmfamily。

\documentclass[11pt,a4paper]{moderncv}
\usepackage{libertine}    %% or newtxtext for times 
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}

\name{John}{Doe}
\title{Title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{[email protected]}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}
\photo[64pt][0.4pt]{picture}
\quote{Some quote}


\begin{document}
\makecvtitle

\section{Education}

\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  \cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\section{Experience}
\subsection{Vocational}
\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\begin{itemize}%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \begin{itemize}%
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \begin{itemize}
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
    \end{itemize}
  \item Sub-achievement (c);
  \end{itemize}
\item Achievement 3.
\end{itemize}}

\end{document}

在此处输入图片描述

有了xelatex,选择就变得无限了。添加

\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Calibri}    %% change to any available .ttf or .otf font

代替

\usepackage{libertine}    %% or newtxtext for times 

并用编译xelatex,得到

在此处输入图片描述

相关内容