5

As a continuation of this question moderncv banking style: How to move the title block all the way to the left?, I would like to bring in the contents, one in each line like :
street and number
city -postcode
country
ph no 1
ph no 2
email
web page

The bullet points are to be removed. the code is:

\documentclass[12pt,letterpaper]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage{libertine}
\usepackage[scale=0.75]{geometry}

\makeatletter
\renewcommand*{\flushmaketitle}{%
  \strut\usebox{\maketitlebox}%
  \savebox{\maketitlebox}{}%
  \savebox{\maketitletempbox}{}%
  \setlength{\maketitleboxwidth}{0pt}}
\renewcommand*{\maketitle}{%
%  \setlength{\maketitlewidth}{0.8\textwidth}% ORIGINAL
  \setlength{\maketitlewidth}{\textwidth}% NEW
  %\hfil% ORIGINAL
  \parbox{\maketitlewidth}{%
%    \centering% ORIGINAL
    \raggedright% NEW
    % name and title
    \namestyle{\@firstname~\@lastname}%
    \\% \isundefined doesn't work on \@title, as LaTeX itself defines \@title (before it possibly gets redefined by \title)
    % detailed information
    \addressfont\color{color2}%
    \ifthenelse{\isundefined{\@addressstreet}}{}{\addtomaketitle{\addresssymbol\@addressstreet}%
      \ifthenelse{\equal{\@addresscity}{}}{}{\addtomaketitle{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
      \ifthenelse{\equal{\@addresscountry}{}}{}{\addtomaketitle{\@addresscountry}}%
      \flushmaketitle\@firstmaketitleelementtrue\\}%
    \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
      \addtomaketitle{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
    \ifthenelse{\isundefined{\@email}}{}{\addtomaketitle{\emailsymbol\emaillink{\@email}}}%
    \ifthenelse{\isundefined{\@homepage}}{}{\addtomaketitle{\homepagesymbol\httplink{\@homepage}}}%
    \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
      \addtomaketitle{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
    \ifthenelse{\isundefined{\@extrainfo}}{}{\addtomaketitle{\@extrainfo}}%
    \flushmaketitle}\\[2.5em]}% need to force a \par after this to avoid weird spacing bug at the first section if no blank line is left after \maketitle
\makeatother


\name{John}{Doe}
\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}
\quote{Some quote}

\begin{document}
\makecvtitle

\section{A test section}
Some test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text
\end{document} 

enter image description here

2 Answers 2

2

Just use some extra

\flushmaketitle\@firstmaketitleelementtrue\\        %%% <--- HK here

at appropriate places:

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

\makeatletter
%\renewcommand*{\maketitlesymbol}{}%
%
\renewcommand*{\flushmaketitle}{%
  \strut\usebox{\maketitlebox}%
  \savebox{\maketitlebox}{}%
  \savebox{\maketitletempbox}{}%
  \setlength{\maketitleboxwidth}{0pt}}
\renewcommand*{\maketitle}{%
%  \setlength{\maketitlewidth}{0.8\textwidth}% ORIGINAL
  \setlength{\maketitlewidth}{\textwidth}% NEW
  %\hfil% ORIGINAL
  \parbox{\maketitlewidth}{%
%    \centering% ORIGINAL
    \raggedright% NEW
    % name and title
    \namestyle{\@firstname~\@lastname}%
    \ifthenelse{\equal{\@title}{}}{}{\titlestyle{~|~\@title}}\\% \isundefined doesn't work on \@title, as LaTeX itself defines \@title (before it possibly gets redefined by \title)
    % detailed information
    \addressfont\color{color2}%
    \ifthenelse{\isundefined{\@addressstreet}}{}{\addtomaketitle{\addresssymbol\@addressstreet}%
    \flushmaketitle\@firstmaketitleelementtrue\\       %%% <--- HK here
      \ifthenelse{\equal{\@addresscity}{}}{}{\addtomaketitle[~--~]{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
      \flushmaketitle\@firstmaketitleelementtrue\\     %%% <--- HK here
      \ifthenelse{\equal{\@addresscountry}{}}{}{\addtomaketitle[~--~]{\@addresscountry}}%
      \flushmaketitle\@firstmaketitleelementtrue\\}%
    \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
      \addtomaketitle{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}
      \flushmaketitle\@firstmaketitleelementtrue\\}%           %% <--- HK here
    \ifthenelse{\isundefined{\@email}}{}{\addtomaketitle{\emailsymbol\emaillink{\@email}}}%
    \flushmaketitle\@firstmaketitleelementtrue\\           %% <--- HK here    
    \ifthenelse{\isundefined{\@homepage}}{}{\addtomaketitle{\homepagesymbol\httplink{\@homepage}}}%
    \flushmaketitle\@firstmaketitleelementtrue\\           %% <--- HK here
    \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
      \addtomaketitle{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}
      \flushmaketitle\@firstmaketitleelementtrue\\}           %% <--- HK here}% 
    \ifthenelse{\isundefined{\@extrainfo}}{}{\addtomaketitle{\@extrainfo}}%
    \flushmaketitle}\\[2.5em]}% need to force a \par after this to avoid weird spacing bug at the first section if no blank line is left after \maketitle
\makeatother


\name{John}{Doe}
\title{Resume title}
\address{street and number}{city postcode}{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} 
\quote{Some quote}

\begin{document}
\makecvtitle

\section{A test section}
Some test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text
\end{document}

enter image description here

Answer to the comment:

You can use additional parboxes:

\makeatletter
%\renewcommand*{\maketitlesymbol}{}%
%
\renewcommand*{\flushmaketitle}{%
  \strut\usebox{\maketitlebox}%
  \savebox{\maketitlebox}{}%
  \savebox{\maketitletempbox}{}%
  \setlength{\maketitleboxwidth}{0pt}}
\renewcommand*{\maketitle}{%
%  \setlength{\maketitlewidth}{0.8\textwidth}% ORIGINAL
  \setlength{\maketitlewidth}{\textwidth}% NEW
  %\hfil% ORIGINAL
  \parbox{\maketitlewidth}{%
%    \centering% ORIGINAL
    \raggedright% NEW
    % name and title
    \namestyle{\@firstname~\@lastname}%
    \ifthenelse{\equal{\@title}{}}{}{\titlestyle{~|~\@title}}\\% \isundefined doesn't work on \@title, as LaTeX itself defines \@title (before it possibly gets redefined by \title)
    % detailed information
    \addressfont\color{color2}%
    \parbox[t]{0.45\maketitlewidth}{%
    \ifthenelse{\isundefined{\@addressstreet}}{}{\addtomaketitle{\addresssymbol\@addressstreet}%
    \flushmaketitle\@firstmaketitleelementtrue\\       %%% <--- HK here
      \ifthenelse{\equal{\@addresscity}{}}{}{\addtomaketitle[~--~]{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
      \flushmaketitle\@firstmaketitleelementtrue\\     %%% <--- HK here
      \ifthenelse{\equal{\@addresscountry}{}}{}{\addtomaketitle[~--~]{\@addresscountry}}%
  \flushmaketitle\@firstmaketitleelementtrue\\     %%% <--- HK here
      }}%
      \hfill
    \parbox[t]{0.45\maketitlewidth}{%
    \raggedleft%    %% optional  
    \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
      \addtomaketitle{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}
      \flushmaketitle\@firstmaketitleelementtrue\\}%           %% <--- HK here
    \ifthenelse{\isundefined{\@email}}{}{\addtomaketitle{\emailsymbol\emaillink{\@email}}}%
    \flushmaketitle\@firstmaketitleelementtrue\\           %% <--- HK here    
    \ifthenelse{\isundefined{\@homepage}}{}{\addtomaketitle{\homepagesymbol\httplink{\@homepage}}}%
    \flushmaketitle\@firstmaketitleelementtrue\\           %% <--- HK here
    \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
      \addtomaketitle{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}
      \flushmaketitle\@firstmaketitleelementtrue\\}           %% <--- HK here 
    \ifthenelse{\isundefined{\@extrainfo}}{}{\addtomaketitle{\@extrainfo}}%
    \flushmaketitle}}\\[2.5em]}% need to force a \par after this to avoid weird spacing bug at the first section if no blank line is left after \maketitle
\makeatother

enter image description here

2
  • Now, a little modification, name, the street and number, city postcode, country on left side and the rest on the right side. How to do that? Apr 25, 2014 at 5:56
  • Hi, i would like to do this but with a newer version of moderncv.... Unfortunately it breaks. Would you have a hint how to patch aboe code?
    – NorrinRadd
    Feb 2, 2021 at 0:19
3

The following is a simplified version of \maketitle that avoid adding contents to a box and only setting it at the end. Instead, the contents is set sequentially as it is inspected. I think it makes for code that is a little (shorter and) easier to understand/modify:

enter image description here

\documentclass[12pt,letterpaper]{moderncv}
\moderncvstyle{banking}
\moderncvcolor{blue}
\usepackage{libertine}
\usepackage[scale=0.75]{geometry}

\makeatletter
\renewcommand*{\maketitle}{%
  \setlength{\maketitlewidth}{\textwidth}%
  \parbox{\maketitlewidth}{%
    \raggedright% NEW
    \namestyle{\@firstname~\@lastname}% name and title
    \\% \isundefined doesn't work on \@title, as LaTeX itself defines \@title (before it possibly gets redefined by \title)
    % detailed information
    \addressfont\color{color2}%
    \begin{tabular}{@{}p{\linewidth}@{}}
      \ifthenelse{\isundefined{\@addressstreet}}{}{\addresssymbol\@addressstreet \par}%
      \ifthenelse{\equal{\@addresscity}{}}{}{\@addresscity \par}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
      \ifthenelse{\equal{\@addresscountry}{}}{}{\@addresscountry \par}%
      \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
        \csname\collectionloopkey phonesymbol\endcsname\collectionloopitem \endgraf}%
      \ifthenelse{\isundefined{\@email}}{}{\emailsymbol\emaillink{\@email} \par}%
      \ifthenelse{\isundefined{\@homepage}}{}{\homepagesymbol\httplink{\@homepage}}%
    \end{tabular}}\\[2.5em]}% need to force a \par after this to avoid weird spacing bug at the first section if no blank line is left after \maketitle
\makeatother

\name{John}{Doe}
\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}
\quote{Some quote}

\begin{document}
\makecvtitle

\section{A test section}
Some test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text test text
\end{document}

The following version of \maketitle provides a left-and-right alignment of the details:

enter image description here

\makeatletter
\renewcommand*{\maketitle}{%
  \setlength{\maketitlewidth}{\textwidth}%
  \parbox{\maketitlewidth}{%
    \raggedright% NEW
    \namestyle{\@firstname~\@lastname}% name and title
    \\% \isundefined doesn't work on \@title, as LaTeX itself defines \@title (before it possibly gets redefined by \title)
    % detailed information
    \addressfont\color{color2}%
    \begin{tabular}{@{}p{.5\linewidth}@{}p{.5\linewidth}@{}}
      \ifthenelse{\isundefined{\@addressstreet}}{}{\addresssymbol\@addressstreet \par}%
      \ifthenelse{\equal{\@addresscity}{}}{}{\@addresscity \par}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
      \ifthenelse{\equal{\@addresscountry}{}}{}{\@addresscountry} &%
      \raggedleft% For right-aligned content
      \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
        \csname\collectionloopkey phonesymbol\endcsname\collectionloopitem \endgraf}%
      \ifthenelse{\isundefined{\@email}}{}{\emailsymbol\emaillink{\@email} \par}%
      \ifthenelse{\isundefined{\@homepage}}{}{\homepagesymbol\httplink{\@homepage}}%
    \end{tabular}}\\[2.5em]}% need to force a \par after this to avoid weird spacing bug at the first section if no blank line is left after \maketitle
\makeatother
4
  • Now, a little modification, name, the street and number, city postcode, country on left side and the rest on the right side. How to do that? Apr 25, 2014 at 5:59
  • @subhamsoni: Note that I've left out all of the \social and \extrainfo stuff, since it didn't seem needed in the original request. In terms of the follow-up question, what should the alignment of "the rest on the right side" be? Right-aligned or left-aligned?
    – Werner
    Apr 25, 2014 at 6:06
  • right aligned... Apr 25, 2014 at 6:07
  • @subhamsoni: I've added two columns to the inner tabular to easily separate the content into a left- and right-hand side.
    – Werner
    Apr 25, 2014 at 6:12

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.