I have created a new command using colorbox as follow:

\newcommand{\resheading}[1]{{\small \colorbox{mygrey}{\begin{minipage}{0.975\textwidth}{\textbf{#1 \vphantom{p\^{E}}}}\end{minipage}}}}


This is how it looks:

Is there a way to increase the spacing between resheading and the bullet point? Any help is greatly appreciated.

• Also, a newline is just too much – subtleseeker Jul 6 '19 at 13:51

\documentclass[]{article}

\overfullrule5pt
\usepackage{xcolor}

\definecolor{mygrey}{gray}{.85}

{%
{%
\colorbox{mygrey}
{%
\begin{minipage}{\dimexpr\linewidth-2\fboxsep\relax}
\small
\bfseries
\strut#1\strut
\end{minipage}%
}%
}%
}

\begin{document}
something else
\end{document}


How it works:

1. we set the results of the \colorbox command into a box, it is not directly printed (\sbox\resheadingbox{...}).
2. we enlarge this box by 5pt to the bottom (\dp\resheadingbox=\dimexpr\dp\resheadingbox+5pt\relax, I left out the optional =), for this enlargement TeX pads whitespace.
3. we output the contents of the box register (\usebox\resheadingbox)

I also changed the width of your minipage, such that the \colorbox will be as wide as possible without sticking into the margin (a \colorbox adds an \fboxsep on both sides as padding, we use the width of a full line minus those 2\fboxsep). Also I used \strut as vertical padding inside the \colorbox instead of your \vphantom{...} construct, a \strut has zero width and the height and depth such that it is as big as your fontsize.

• It works exactly as needed! Could you explain what is happening here? For what I can understand is that you added a box to create some whitespace. I am new to LaTeX. – subtleseeker Jul 6 '19 at 14:16
• @subtleseeker I've added a small explanation. Anything else you don't understand? – Skillmon Jul 6 '19 at 14:31
• Thanks, this helped! – subtleseeker Jul 6 '19 at 14:35
• To whomever downvoted my answer: Do you want to explain why you downvoted this and what you want me to improve? – Skillmon Jul 7 '19 at 6:38

I propose this simple code, based on the shaded* environment from the framed package:

\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}

\usepackage[svgnames]{xcolor}
\usepackage{framed}

{%
\setlength{\OuterFrameSep}{1pt}
\setlength{\FrameSep}{5pt}