8

I was just making my resume and I wanted to highlight the different sections. I used the color package. This is the code:

\usepackage{color}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}


\colorbox{Cyan}{\underline{\textbf{Objective}}}

To work in areas like Embedded systems, Hardware Design in an established firm and to apply the knowledge for personal and professional benefit\

What I get is something like this: enter image description here

What I want is this:

enter image description here

Any ideas?

9
 \colorbox{whatever}{\rlap{\textbf{Objective}}\hspace{\linewidth}\hspace{-2\fboxsep}}
| improve this answer | |
5

Here's a definition of \Colorbox[<width>]{<colour>}{<stuff>} using xparse:

enter image description here

\documentclass{article}
\usepackage{xparse}% http://ctan.org/pkg/xparse
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}% http://ctan.org/pkg/xcolor
\makeatletter
\NewDocumentCommand{\Colorbox}{O{\dimexpr\linewidth-2\fboxsep} m m}{%
  \colorbox{#2}{\makebox[#1][l]{#3}}}
\makeatother
\begin{document}
\noindent\Colorbox{Cyan}{\textbf{Objective}}
\end{document}​

The default width <width> is \linewidth-2\fboxsep, where \fboxsep is the gap between the text and the colour box boundary.

| improve this answer | |

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.