4

I'm transferring my CV from Word to LaTeX format. I would like to replicate a feature shown below of a horizontal black bar with two sections of embedded text justified to the left and to the right.

enter image description here

How can I achieve the same effect with LaTeX?

0

3 Answers 3

5

You could use tcolorbox.

\documentclass{article}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}[colback=black!50,colframe=black,colupper=white,
  arc=0pt,outer arc=0pt,top=1mm,bottom=1mm,left=1mm,right=1mm]
  Gap year \hfill July 2011--October 2012
\end{tcolorbox}
\end{document}

enter image description here

3

Tikz example:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[draw=black,fill=black!50!gray, text=white, text width=12cm](box){\textbf{Gap Year\hfill July 2011 - July 2012}};
\end{tikzpicture}
\end{document}

enter image description here

2

Here are 3 ways to do that:

\documentclass{article}
\usepackage[x11names, table]{xcolor}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{framed}
\definecolor{shadecolor}{named}{LightSteelBlue4}
\setlength\FrameSep{3pt}
\usepackage{array, tabularx} 

\begin{document}

\noindent\fcolorbox{SlateGray4!80}{SlateGray3}{\sffamily\color{white}%
\makebox[\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax]{Gap year\hfill July 2011--October 2012}}
\vskip\topsep
Some text some text some text some text some text some text some text some text some text

\begin{shaded*}\sffamily\color{NavajoWhite1!50}
\noindent Gap year\hfill July 2011--October 2012
\end{shaded*}
\color{black}
Some text some text some text some text some text some text some text some text some text

{\vskip\topsep\sffamily\color{white}\setlength\extrarowheight{1pt} \noindent\begin{tabularx}{\dimexpr\linewidth}{lXr}
\rowcolor{lightgray}Gap year & & July 2011--October 2012%
\end{tabularx}}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .