Skip to content

Instantly share code, notes, and snippets.

@bbinet
Created August 26, 2012 07:09
Show Gist options
  • Save bbinet/3475534 to your computer and use it in GitHub Desktop.
Save bbinet/3475534 to your computer and use it in GitHub Desktop.
moderncv \section patch
% BBI edition %%%%%%%%%%%%%%%%%%%%%%%%%%
% add:
\newlength{\argtextwidth}%
\newlength{\freespace}%
\newcommand*{\calcfreespace}[1]{%
\settowidth{\argtextwidth}{#1}%
\setlength{\freespace}{\maincolumnwidth}%
\addtolength{\freespace}{-\argtextwidth}%
\addtolength{\freespace}{-\separatorcolumnwidth}%
}
% end BBI edition %%%%%%%%%%%%%%%%%%%%%%%
\newlength{\baseletterheight}
\settoheight{\baseletterheight}{\sectionstyle{o}}
\setlength{\baseletterheight}{\baseletterheight-0.95ex}
\renewcommand*{\section}[1]{%
\par\addvspace{2.5ex}%
\phantomsection{}% reset the anchor for hyperrefs
\addcontentsline{toc}{section}{#1}%
\parbox[t]{\hintscolumnwidth}{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}%
\hspace{\separatorcolumnwidth}%
% BBI edition %%%%%%%%%%%%%%%%%%%%%%%%%%
% replace:
% \parbox[t]{\maincolumnwidth}{\strut\sectionstyle{#1}}%
% by:
\parbox[t]{\maincolumnwidth}{\strut\sectionstyle{#1}
\hspace{\separatorcolumnwidth}%
\calcfreespace{\sectionstyle{#1}}%
\raisebox{\baseletterheight}{\color{color1}\rule{\freespace}{0.95ex}}}
% end BBI edition %%%%%%%%%%%%%%%%%%%%%%%
\par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment