i'm trying to get a gray background for an entire multicols environment and get errors with this "minimal" working example:
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[table,dvipsnames]{xcolor}
\usepackage{color}
\usepackage{listings}
\usepackage{multicol}
\usepackage[left=2.5cm,right=2.5cm]{geometry}
\begin{document}
\setlength{\parindent}{0mm}
\setlength{\parskip}{11pt}
\begin{titlepage}
\begin{center}
\colorbox{gray}{
\begin{multicols}{2}
\begin{description}
\item[xyz] \hfill \\
description
\item[xyz] \hfill \\
description
\columnbreak
\item[xyz] \hfill \\
description
\item[xyz] \hfill \\
description
\end{description}
\end{multicols}
}
\end{center}
\end{titlepage}
\end{document}
This generates a lot of errors on the closing "}" from the colorbox that make no sense for me.
If I comment the colorbox out it compiles without problems.
Something I guess is similar I hit while going through the suggestions:
A version of colorbox that works inside math environments
Since one of the errormessages states that it's automatically creating a math environment/symbol i guess my problem is similar, though the answer to the question is just codesalad i don't understand and thus can't really use.
Any explained solution to either prevent LaTex to create a math-environment or getting a grey background under the multicol is highly appreciated.
Btw. i just started using LaTeX, so explanations are also highly appreciated.
Best Answer
\colorbox
is anLR
box like\mbox
. You can not nest vertical material directly in such a box, use