# [texhax] space between colorboxes in adjacent lines

José Romildo Malaquias j.romildo at gmail.com
Tue Apr 27 17:08:14 CEST 2010

On Tue, Apr 27, 2010 at 11:14:34AM -0300, José Romildo Malaquias wrote:
> I want to set the background color of a set of consecutive lines. I am
> using the \colorbox command from the color LaTeX package.
>
>   \documentclass[a5paper]{article}
>   \usepackage{color}
>
>   \newcommand{\cbox}[2]{%
>     \colorbox{#1}{\makebox[\linewidth][l]{#2}}}
>
>   \begin{document}
>
>   \noindent
>   \cbox{yellow}{First~line}\newline
>   \cbox{yellow}{Second line}\newline
>   \cbox{yellow}{}\newline
>   \cbox{yellow}{Fourth line}
>
>   \end{document}
>
> The result of running pdflatex with this document is attached.

The pdf file can be found here:

http://www.iceb.ufop.br/decom/prof/romildo/misc/colorbox-test.pdf

> The problem I want to solve is the small blank space between each
> line. How can it be eliminated?
>
> Typesetting the lines in a minipage (or similar) environment is not an
> option, as the sequence of lines should not be restricted to a single
> page.