# Section like moderncv template?

I'm writing an article and would like to section it with the same style of modernCV, but cannot find any suggestion.

Can someone help me? =)

• Welcome to TeX.SX! Please help us and add a minimal working example (MWE) that shows a basic document and your attempts at solving the question. The horizontal bar can be done with a \rule – ienissei Apr 27 '16 at 8:37
• Package titlesec can do that. – Bernard Apr 27 '16 at 9:59
• If your question is answered, please mark a solution. – MaestroGlanz Apr 30 '16 at 18:35

I found this in the sources of moderncv

\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}


it creates the box. The full definition for the section is

\RenewDocumentCommand{\section}{sm}{%
\phantomsection{}% reset the anchor for hyperrefs
\cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}%


You just have to replace the cvitem and all the variables.

Edit(This includes all the necessary lengths, you have to insert the color yourself):

\usepackage{xparse}
\makeatletter
\newlength{\hintscolumnwidth} \setlength{\hintscolumnwidth}{0.175\textwidth}
\newlength{\baseletterheight} \settoheight{\baseletterheight}{o}
\newlength{\separatorcolumnwidth} \setlength{\separatorcolumnwidth}{0.025\textwidth}
% fonts
\newcommand*{\sectionfont}{\Large\mdseries\upshape}
% styles
\newcommand*{\sectionstyle}[1]{{\sectionfont{#1}}}
\RenewDocumentCommand{\section}{sm}{%