8

The package moderncv proposes only two available options for the font selection roman & sans. I've seen the following declaration in the source code of the package:

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

Are there any tricks around to overload this inside a .tex file in order to load another font ?

Ketouem
  • 287
  • You can use xelatex of course. Or use some other font like libertine\usepackage{libertine} –  Mar 08 '14 at 23:09
  • The declaration doesn't change the font; it only changes the family of the font to be sans serif, but the font will be the same previously loaded. – Gonzalo Medina Mar 08 '14 at 23:10
  • @HarishKumar I've thought of using xelatex and using a ttf font but I'm using sharelatex and when I'm changing the compilation type and recompiling I get a lot of errors, it seems that the package they're using is not really up to date. – Ketouem Mar 08 '14 at 23:12
  • @GonzaloMedina , so it means that I cannot change the font afterwards as it is loaded by the package itself beforehand. – Ketouem Mar 08 '14 at 23:14
  • Font ant family have different meanings. Font is like say Times New Roman and family can be roman or sans serif. What exactly do you want to change? –  Mar 08 '14 at 23:18
  • Of course you can use different fonts; either T1 fonts (loaded with \usepackage) with pdflatex, or TrueType fonts useing xelatex. – Gonzalo Medina Mar 08 '14 at 23:20
  • With: `\documentclass[10pt,a4paper,sans]{moderncv}

    \usepackage[T1]{fontenc} \usepackage{cyklop}` the font is not loaded and it falls back to the default sans-serif font.

    – Ketouem Mar 08 '14 at 23:28
  • As long as the cyklop T1 font is installed in your system, you can use it without problems. If not, you'll need to install it. – Gonzalo Medina Mar 08 '14 at 23:31
  • OH My... Do you plan to use cyklop font for your CV? You must be kidding :) –  Mar 08 '14 at 23:36
  • Of course I won't use cyklop :) I was messing around with the font settings and I wanted one that was really different from the base one in order to see if my tweaks had really an effect. – Ketouem Mar 09 '14 at 00:02
  • cyklop only affects the default serif font. So you have loaded it for serif but then told moderncv to use sans which is still the default sans. Tell moderncv to use roman rather than sans or pick a font package which redefines the sans family. – cfr Mar 09 '14 at 00:34

1 Answers1

7

OK, here is an example of libertine CV. Change `sans to rmfamily if you want.

\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{john@doe.org}
\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}

enter image description here

With xelatex, options are unlimited. Adding

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

instead of

\usepackage{libertine}    %% or newtxtext for times 

and compiling with xelatex, gives

enter image description here

  • I am not so sure about sharelatex, they seem to be using old texlive some how. –  Mar 09 '14 at 00:37