Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 6 down vote accepted
 \colorbox{whatever}{\rlap{\textbf{Objective}}\hspace{\linewidth}\hspace{-2\fboxsep}}
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.