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 playing up with \colorbox for my resume and really loved the way I can create styling for the document.

Anyway I was trying to center align the text but failed to achieve it using the \centering command and if I use \begin{center} to allign the text, \colorbox width increase two fold which I don't want.

\newcommand \reshead [1]{\par \noindent \colorbox{black}{\begin{minipage} 
{\textwidth}{\color{white} \centering \bfseries {#1}} \hfill \end{minipage}}}

Apart from this issue, I wanted to my resume to look like this, the top line should be lesser in length compared to \colorbox

enter image description here

However with my code both are equal, is there a way I can stretch the \colorbox a bit more.? -

%% (c) Shashwat Pant
%% Resume - C.V of Shashwat Pant
%% September 17th 2012

\documentclass[letterpaper,12pt]{article}
%\usepackage[charter]{mathdesign}
% \usepackage{charter}
% \usepackage{mathpazo}
%\usepackage{kpfonts}
%\usepackage{geometry}
\usepackage{palatino}
\usepackage{url}
\usepackage[empty]{fullpage}
\usepackage{color}
%\definecolor{mygrey}{gray}{0.95}
%\usepackage{xcolor}

\newcommand \reshead [1]{\par \noindent \colorbox{black}{\begin{minipage}{\textwidth}{  \color{white} \centering \bfseries {#1}} \hfill \end{minipage}}}


\begin{document}

\begin{center}

\bfseries {\huge {Shashwat Pant}} \\
\bfseries E-Mail - shashwat.pant@gmail.com ~ Voice -    
\hrule \hrule
 \end{center}

\noindent Seeking a challenging career to gain experience in rich evolving computing in the areas of :  
\begin{itemize} 
    \item 
    \item Parallel and Vector computing (Open CL)

\end{itemize}   


\reshead{Professional Profile}



\end{document}

With my code the output look like this

enter image description here

Is there a way to stretch the colorbox and underlying text a bit towards left so that are not in same symmetry?

share|improve this question
    
As an aside if you really want a space before the :, you should use areas of~: instead of areas of : so that the colon does not end up on its own line. –  Peter Grill Sep 18 '12 at 16:04
    
Thanks :) will keep that in mind :) –  Shashwat Sep 18 '12 at 16:07
add comment

2 Answers

up vote 3 down vote accepted

Here is an option that you can use:

enter image description here

\documentclass[letterpaper,12pt]{article}
\usepackage[empty]{fullpage}% http://ctan.org/pkg/fullpage
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{changepage}% http://ctan.org/pkg/changepage

\newcommand\reshead[1]{%
  \par\noindent%
  \colorbox{black}{\makebox[\dimexpr\linewidth-2\fboxrule-2\fboxsep][c]{\textcolor{white}{\bfseries #1}}}}

\begin{document}

\begin{adjustwidth}{2em}{2em}
  \begin{center}
    \bfseries
    {\huge Shashwat Pant} \\
    E-Mail - shashwat.pant@gmail.com ~ Voice - \\
  \end{center}

  \noindent\hspace*{-1em}\rule{\dimexpr\linewidth+2em}{2pt}

  \noindent Seeking a challenging career to gain experience in rich evolving computing in the areas of :  
  \begin{itemize} 
    \item 
    \item Parallel and Vector computing (Open CL)
  \end{itemize}
\end{adjustwidth}

\bigskip

\reshead{Professional Profile}

\end{document}​

Some things I've changed:

  • Instead of \hrule\hrule, use a specified rule width: \rule{\dimexpr\linewidth-2em}{2pt}. With the horizontal movement, this rule overhangs on both sides by 1em;
  • Added chngpage which provides the adjustwidth environment for modifying the margins locally; and
  • Used \makebox instead of minipage to specify the contents of your \reshead. Also updated the width to fix within the margins exactly (\linewidth-2\fboxrule-2\fboxsep).
share|improve this answer
add comment

I wouldn't stretch the \colorbox, but reduce the top rule:

%% (c) Shashwat Pant
%% Resume - C.V of Shashwat Pant
%% September 17th 2012

\documentclass[letterpaper,12pt]{article}
%\usepackage[charter]{mathdesign}
% \usepackage{charter}
% \usepackage{mathpazo}
%\usepackage{kpfonts}
%\usepackage{geometry}
\usepackage{palatino}
\usepackage{url}
\usepackage[empty]{fullpage}
\usepackage{color}
%\definecolor{mygrey}{gray}{0.95}
%\usepackage{xcolor}

\newcommand\reshead[1]{%
  \par\noindent
  \colorbox{black}{%
    \begin{minipage}{\dimexpr\textwidth-2\fboxsep\relax}
    \color{white}\centering\bfseries#1
    \end{minipage}%
  }%
}


\begin{document}

\begin{center}
\bfseries
{\huge Shashwat Pant} \\[1ex]
E-Mail - shashwat.pant@gmail.com ~ Voice -

% Here I reduce the rule by 1in on both sides (adjust to suit)
% The rule thickness is 1pt; it's 2pt from the bottom of the text above it
\nointerlineskip
\moveright 1in \vbox{\hsize=\dimexpr\hsize - 2in \relax
  \vskip 2pt % separation from the text above
  \hrule width \hsize height 1pt % rule thickness
}
\end{center}


\noindent Seeking a challenging career to gain experience 
in rich evolving computing in the areas of:  
\begin{itemize} 
    \item \LaTeX
    \item Parallel and Vector computing (Open CL)

\end{itemize}   


\reshead{Professional Profile}



\end{document}

You have to reduce a bit the width of the minipage, otherwise the \colorbox would be too wide and overflow on the right: this is the purpose of

\dimexpr\textwidth-2\fboxsep\relax

enter image description here

The \moveright trick is a low level one, but once in a while it comes handy. :)

share|improve this answer
add comment

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.