I'm using two columns with the multicol package. I have some text that I put inside a \colorbox
as below, and I use varwidth
to make it include line breaks.
If the lines are short, the box width expands just enough to include the text. Is there a way to make the box have the width of the column?
Below is the command I use for the box.
\newcommand{\songbox}[1]{
\colorbox{light-gray}{
\begin{varwidth}{\textwidth}
\textit{#1}
\end{varwidth}}}
I'm new to latex, so simplicity would be appreciated.
Best Answer
You don't want to use
varwidth
, if your purpose is that the grey box covers the whole column width.The purpose of
varwidth
is to make the enclosing box as wide as necessary to encompass the material inside.The environment form seems better, in my opinion.