0

I have searched the web but did not find a solution yet. I am using the cover letter template of the moderncv package in banking style. Currently, my modification of the cover letter looks like enter image description here

where it can be seen that the address line is not aligned with the phone number. My goal is to align the two symbols, the address symbol and the phone symbol, such that it looks cleaner.

Does anyone have a solution at hand?

I am thankful for any hints and tips!

1 Answer 1

0

Ok, I finally found a solution, not the prettiest one but it works.

I copied the following block of code from the moderncvheadiii.sty file from github into the file I am using. That is, if you saved your .sty file in your folder, then adjust it there. If you didn't save the file in your folder, as me, just insert this block of code before \begin{document} and adjust it there. So, the changes I made are marked with %CHANGED:

\makeatletter
%   internal command to flush the makehead
\@initializecommand{\flushmakeheaddetails}{%
  \ifnum\makeheaddetailsboxwidth>0%
    \strut\usebox{\makeheaddetailsbox}%
    \savebox{\makeheaddetailsbox}{}%
    \savebox{\makeheaddetailstempbox}{}%
    \setlength{\makeheaddetailsboxwidth}{0pt}\fi}
\@initializecommand{\makehead}{%
  \setlength{\makeheaddetailswidth}{0.8\textwidth}%
  \hfil%
  \parbox{\makeheaddetailswidth}{%
    \centering%
    % 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) 
    % optional detailed information
    \vspace{0.2cm} % CHANGED: introduce some vertical space between title and address block
    \if@details{%
      \\%
      \raggedright % CHANGED: left-align address block
      \hspace{1.6cm} % CHANGED: adjust the horizontal space manually such that the address and phone symbol are aligned
      \addressfont\color{color2}%
      \ifthenelse{\isundefined{\@addressstreet}}{}{\addtomakeheaddetails{\addresssymbol\@addressstreet}%
        \ifthenelse{\equal{\@addresscity}{}}{}{\addtomakeheaddetails[~--~]{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
        \ifthenelse{\equal{\@addresscountry}{}}{}{\addtomakeheaddetails[~--~]{\@addresscountry}}%
        \flushmakeheaddetails\@firstmakeheaddetailselementtrue\\}%
      \ifthenelse{\isundefined{\@born}}{}{\addtomakeheaddetails{\bornsymbol\@born}}%
      \vspace{0.2cm} %CHANGED: introduce some vertical space between address and rest of additional information
      \centering % CHANGED: center the rest of the additional information
      \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
        \addtomakeheaddetails{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
      \ifthenelse{\isundefined{\@email}}{}{\addtomakeheaddetails{\emailsymbol\emaillink{\@email}}}%
      \ifthenelse{\isundefined{\@homepage}}{}{\addtomakeheaddetails{\homepagesymbol\httpslink{\@homepage}}}%
      \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
        \addtomakeheaddetails{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
      \ifthenelse{\isundefined{\@extrainfo}}{}{\addtomakeheaddetails{\@extrainfo}}%
      \flushmakeheaddetails}\fi}\\[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 \makehead
\makeatother

I am hoping that this might be helpful for others too. Maybe someone else knows a prettier solution where nothing needs to be adjusted manually by hand. If so, please post the answer here!

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.