[Tex/LaTex] Change moderncv cvdoubleitem style

moderncv

I tried editing the \cvdoubleitem in the class moderncv, style banking. I wanted to boldface the categories. I tried the following but it gives a very weird alignment when I do so, although boldfacing the text correctly.

\renewcommand*{\cvdoubleitem}[5][.5em]{%
    \cvitem[#1]{\bfseries#2}{%
        \begin{minipage}[t]{\doubleitemcolumnwidth}#3\end{minipage}%
        \hfill% fill of \separatorcolumnwidth
        \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintstyle{\bfseries#4}\end{minipage}%
        \hspace*{\separatorcolumnwidth}%
        \begin{minipage}[t]{\doubleitemcolumnwidth}#5\end{minipage}}}

However, this produces, on 2 double items (4 items),
Screw up of \cvdoubleitem

I thought editing the code here might help but that original code itself gave me an error so I didn't try.

An MWE is given below:

\documentclass[12pt,letterpaper,sans]{moderncv}
\moderncvstyle{banking}
\name{ieujrghieu}{wirjufhiuryg}

\renewcommand*{\cvdoubleitem}[5][.5em]{%
    \cvitem[#1]{\bfseries#2}{%
        \begin{minipage}[t]{\doubleitemcolumnwidth}#3\end{minipage}%
        \hfill% fill of \separatorcolumnwidth
        \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintstyle{\bfseries#4}\end{minipage}%
        \hspace*{\separatorcolumnwidth}%
        \begin{minipage}[t]{\doubleitemcolumnwidth}#5\end{minipage}}}

\begin{document}
    \cvdoubleitem{TTTTTTT}{doiuehneiuhrigbn3ghbn iurh fg3iuh gi3uh giu43ygh iu3 ghiu3rg3iu}{GGGGGGGGGG}{eihg uegh iuh 39uf h23 948h f924 fu4g fiuf 2iuf g4iuf g}
    \cvdoubleitem{PPPPPPPPP}{rusfhvioehr iughe r}{MMMMMM}{3iurgh re3uygh 3eur}
\end{document}

Best Answer

In the current version of class moderncv 2.0.0 for style banking you will find the correct definition of command \cvdoubleitem in file moderncvbodyiii.sty:

\renewcommand*{\cvdoubleitem}[5][.25em]{%
  \begin{minipage}[t]{\doubleitemcolumnwidth}\hintstyle{#2}: #3\end{minipage}%
  \hfill% fill of \separatorcolumnwidth
  \begin{minipage}[t]{\doubleitemcolumnwidth}\ifthenelse{\equal{#4}{}}{}{\hintstyle{#4}: }#5\end{minipage}%
  \par\addvspace{#1}}

Command \hintstyle defined that text #2 or #4 has to be printed bold. It is defined in the class as \renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}} and \hintfont is defined as \renewcommand*{\hintfont}{\bfseries}

To get rid of printing bold you can define an own new command \mycvdoubleitem and delete there the both commands \hintstyle{}. Now you can change \mycvdoubleitem for your needs.

The following MWE shows the difference of commands \cvdoubleitem and \mycvdoubleitem

\documentclass[12pt,letterpaper,sans]{moderncv}
\moderncvstyle{banking}
\name{ieujrghieu}{wirjufhiuryg}


\newcommand*{\mycvdoubleitem}[5][.25em]{%
  \begin{minipage}[t]{\doubleitemcolumnwidth}#2: #3\end{minipage}%
  \hfill% fill of \separatorcolumnwidth
  \begin{minipage}[t]{\doubleitemcolumnwidth}\ifthenelse{\equal{#4}{}}{}{#4: }#5\end{minipage}%
  \par\addvspace{#1}}


\begin{document}
  \cvdoubleitem{1TTTTTTT}{2doiuehneiuhrigbn3ghbn iurh fg3iuh gi3uh 
    giu43ygh iu3 ghiu3rg3iu}{3GGGGGGGGGG}{4eihg uegh iuh 39uf h23 948h 
    f924 fu4g fiuf 2iuf g4iuf g}
  \cvdoubleitem{1PPPPPPPPP}{2rusfhvioehr iughe r}{3MMMMMM}{43iurgh 
    re3uygh 3eur}

  \mycvdoubleitem{1TTTTTTT}{2doiuehneiuhrigbn3ghbn iurh fg3iuh gi3uh 
    giu43ygh iu3 ghiu3rg3iu}{3GGGGGGGGGG}{4eihg uegh iuh 39uf h23 948h 
    f924 fu4g fiuf 2iuf g4iuf g}
  \mycvdoubleitem{1PPPPPPPPP}{2rusfhvioehr iughe r}{3MMMMMM}{43iurgh 
    re3uygh 3eur}

\end{document}

with the result

resulting pdf