[Tex/LaTex] ModernCV long name and title on the same line

moderncvtitleswidth

Is it possible to have a long title and name on the same line in moderncv?
Currently, it looks like this:
enter image description here

The ideal would be that there is no line break after Juantostos. I tried to uncomment the \setlength{\makecvtitlenamewidth}{12cm} but it's for the 'classic' style and it also gives a compile error
(Undefined control sequence).

I'm using Overleaf.

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}                            
\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}
%\setlength{\makecvtitlenamewidth}{10cm}           % for the 'classic' style, if you want to force the width allocated to your name and avoid line breaks. be careful though, the length is normally calculated to avoid any overlap with your personal info; use this at your own typographical risks...
\usepackage{upgreek}
\usepackage{import}

% personal data
\name{John}{Juanostos Buenos}
\title{Curriculum Vitae} 

\address{Something}{Stuff 34 more stuff here}{}
\phone[mobile]{+34 342453533}
\extrainfo{FNAC.: 07/19/1985} 

\email{herecomstheemail@mymail.com}                             

\begin{document}

\makecvtitle


\end{document}

Best Answer

Here is one option:

enter image description here

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry}

\usepackage{etoolbox,changepage}
\patchcmd{\makehead}% <cmd>
  {0.8\textwidth}% <search>
  {\linewidth}% <replace>
  {}{}% <success><failure>

% personal data
\name{John}{Juanostos Buenos}
\title{Curriculum Vitae} 

\address{Something}{Stuff 34 more stuff here}{}
\phone[mobile]{+34 342453533}
\extrainfo{FNAC.: 07/19/1985}

\email{herecomstheemail@mymail.com}

\begin{document}

% Increase block width by 1cm on both sides
\begin{adjustwidth}{-1cm}{-1cm}
\makecvtitle
X\dotfill X
\end{adjustwidth}

Y\dotfill Y

\end{document}

We do two things:

  1. Patch \makehead to increase the width of the header from 0.8\textwidth to \linewidth. In the very least, this will set it at \textwidth. However, since \textwidth is rigid (or fixed) we can...

  2. ...use adjustwidth (from changepage) to increase the width temporarily just for the title.

In the above example X.....X represents the width used for the title, and Y.....Y the width of the subsequent text block.