1

For the following MWE,

\RequirePackage{luatex85}
\documentclass[12pt,sans]{moderncv}
\usepackage[tuenc]{fontspec}
\usepackage{xcolor}

\moderncvstyle{banking}
\moderncvcolor{blue}

\name{Diaa}{}
\begin{document}
    \makecvtitle
    \section{Education}
    \cvitem{Title}{Some Title}
    \subsection{Philosophy of Doctor}
    \cventry{year}{Ph.D.}{University}{City}{}{}
\end{document}

the output is

enter image description here

However, when changing the font to roman in the class options, the blue and black colors fade in addition to the loss of boldness of the headers and the output becomes

enter image description here

Therefore, my first question is how to change the font to Roman without losing the colors saturation and headers boldness?

Additionally, how to customize the color in \moderncvcolor{blue} to be, for example, black!20!blue without getting errors?

1
  • 2
    I measured the colors in the two cases and I get, in RGB, (56,115,178) in both cases: the problem is simply that the sans serif has thicker strokes. – egreg Jun 17 '18 at 8:53
3

The colors are actually the same, but in the sans example the strokes are thicker.

When roman is used, moderncv wants to use Pagella, leading to

LaTeX Font Warning: Font shape `TU/qpl/b/it' undefined
(Font)              using `TU/qpl/b/n' instead on input line 19.

You need to countermand this by declaring your main font and also to remove the request for a (non existing) semibold font.

\documentclass[12pt,roman]{moderncv}
\usepackage{fontspec}
\usepackage{xcolor}

\moderncvstyle{banking}
\moderncvcolor{blue}

\setmainfont{TeX Gyre Pagella}

\renewcommand*{\sectionfont}{\Large\bfseries\upshape}
\renewcommand*{\subsectionfont}{\large\bfseries\itshape}
\renewcommand*{\hintfont}{\bfseries}

\name{Diaa}{}

\begin{document}
    \makecvtitle
    \section{Education}
    \cvitem{Title}{Some Title}
    \subsection{Philosophy of Doctor}
    \cventry{year}{Ph.D.}{University}{City}{}{}
\end{document}

enter image description here

Declare a different main font, if you so wish.

In order to change the base color, use \colorlet:

\documentclass[12pt,roman]{moderncv}
\usepackage{fontspec}
\usepackage{xcolor}

\moderncvstyle{banking}
\moderncvcolor{blue}

%\colorlet{color1}{black!20!blue}
\colorlet{color1}{red}

\renewcommand*{\sectionfont}{\Large\bfseries\upshape}
\renewcommand*{\subsectionfont}{\large\bfseries\itshape}
\renewcommand*{\hintfont}{\bfseries}
\setmainfont{TeX Gyre Pagella}


\name{Diaa}{}
\begin{document}
    \makecvtitle
    \section{Education}
    \cvitem{Title}{Some Title}
    \subsection{Philosophy of Doctor}
    \cventry{year}{Ph.D.}{University}{City}{}{}
\end{document}

Here I have used red to give a very distinctive example.

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.