# Class moderncv, style casual: title on 2 lines

Is it possible to write the title of a resume on two lines on the right of the page. I explain myself:

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{casual}
\moderncvcolor{blue}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
\name{John}{Doe}
\title{Resumé title\\ Second part of title}


This doesn't work because it goes on the next line at the begin and not right. Can someone help me?

You can align the stacked title artificially using the following:

\title{Resumé title \\ \mbox{}\hfill Second part of title}


You'll get some warnings from hyperref complaining about non-PDF tokens (like \\ and \hfill), but you can safely ignore these.

\documentclass{moderncv}

\moderncvstyle{casual}
\moderncvcolor{blue}

\usepackage[utf8]{inputenc}

\name{John}{Doe}
\title{Resumé title \\ \mbox{}\hfill Second part of title}

\begin{document}

\makecvtitle

\end{document}


If you don't have any descenders in the top part of the \title (like in the example above), add \strut on the first line:

\title{Resumé title \strut \\ \mbox{}\hfill Second part of title}


In command \makecvhead you can find the definition for the title:

  % optional title
\ifthenelse{\equal{\@title}{}}{}{%
\\[1.25em]\null% \null is required as there is no box on the line after \\, so glue such as \hfill (and leaders) disappear; this is in contrast to after \par, where the next line starts with an indent box (even after \noindent)
\if@right\hfill\fi%
\if@alternate%
\titlestyle{\MakeLowercase\@title}%
\else%
\titlestyle{\@title}\fi%
}\\[2.5em]%


To be able to use in your cv the commands

\title{Resumé title}
\titleb{Second part of title}


we need to add a mechanismn for \titleb.

In the following MWE I did that (see marking <====== for important code changes):

\documentclass{moderncv}

\moderncvstyle{casual}
\moderncvcolor{blue}

\usepackage[utf8]{inputenc}

\makeatletter
\newcommand*{\titleb}[1]{\def\@titleb{#1}} % <==========================

\renewcommand*{\makecvhead}{% TODO: use \@initializecommand, which requires modifying its definition to handle \par
% recompute lengths (in case we are switching from letter to resume, or vice versa)
\recomputecvlengths%
% optional picture (pre-rendering)
\ifthenelse{\isundefined{\@photo}}%
{}%
{%
\setlength\fboxrule{\@photoframewidth}%
\ifdim\@photoframewidth=0pt%
\setlength{\fboxsep}{0pt}\fi%
{\color{color1}\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}}%
% name (pre-rendering)
\if@left\raggedright\fi%
\if@right\raggedleft\fi%
\namefont%
\if@alternate% alternate design: first- and lastname in lowercase with no space in between (distinction is made by color difference)
{\color{color2!50}\MakeLowercase\@firstname}{\color{color2}\MakeLowercase\@lastname}%
\else% default design: first- and lastname as given with a space in between
{\color{color2!50}\@firstname} {\color{color2}\@lastname}\fi}}%
% rendering
\if@left%
\if@right%
{\color{color2!50}\rule{\textwidth}{.25ex}}%
% optional detailed information
\if@details{%
\\\null%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
\flushmakeheaddetails}\fi% need to force a \par after this to avoid weird spacing bug at the first section if no blank line is left after \makehead
% optional title
\ifthenelse{\equal{\@title}{}}{}{%
\\[1.25em]\null% \null is required as there is no box on the line after \\, so glue such as \hfill (and leaders) disappear; this is in contrast to after \par, where the next line starts with an indent box (even after \noindent)
\if@right\hfill\fi%
\if@alternate%
\titlestyle{\MakeLowercase\@title}%
\else%
\titlestyle{\@title}\fi%
}%\\%[2.5em]% <=====================================================
\ifthenelse{\isundefined{\@titleb}}{}{% <=============================
\\[.25em]\null% \null is required as there is no box on the line after \\, so glue such as \hfill (and leaders) disappear; this is in contrast to after \par, where the next line starts with an indent box (even after \noindent)
\if@right\hfill\fi%
\if@alternate%
\titlestyle{\MakeLowercase\@titleb}%
\else%
\titlestyle{\@titleb}\fi%
}\\[2.5em]% <=======================================================
% optional quote
\ifthenelse{\isundefined{\@quote}}%
{}%
{{\null\hfill%
\begin{minipage}{\quotewidth}%
\centering%
\quotestyle{\@quote}%
\end{minipage}\hfill\null\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \maketitle

\makeatother

\name{John}{Doe}

\title{Resumé title}
\titleb{Second part of title}

\begin{document}

\makecvtitle

\end{document}


with the following result:

The advantage is that you will get the usual layout without or with \titleb and without any warnings from hyperref about wrong tokens like \\ ...