[Tex/LaTex] Problems with colorbox in Enumerate Environment

#enumerate

I'm writing solutions to an exam. For one of the multiple-choice problems, I've decided to shade all correct answers using colorbox. By the way, more than one choice for the problem may be correct (not that LaTeX cares).

I have two issues: (1) colorbox makes my text run off the page; (2) Even when breaking the line, there is a thin white space (which should be shaded) between the lines. Moreover, the width of the shaded lines are different.

How can I make my colorbox break lines automatically?
How can I make the entire correct answer (even after a line break) be shaded?
Is there a nicer, prettier way to shade answers to multiple-choice questions?

Below is an example.

\documentclass[11pt]{article}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{color}

\definecolor{SolutionColor}{gray}{0.85}

\begin{document}

Choose all correct statements.
\begin{enumerate}
\item \colorbox{SolutionColor}{\bfseries Here is a true sentence.}
\item \colorbox{SolutionColor}{\bfseries If the rank of a $\boldsymbol{2 \times 2}$ matrix $\boldsymbol{A}$ is 1, then one can always find a vector $\boldsymbol{\mathbf{b} \in \mathbb{R}^2}$ so that $\boldsymbol{A \mathbf{x} = \mathbf{b}}$ does not have a solution.}
\end{enumerate}

Choose all correct statements.
\begin{enumerate}
\item \colorbox{SolutionColor}{\bfseries Here is a true sentence.}
\item \colorbox{SolutionColor}{\bfseries If the rank of a $\boldsymbol{2 \times 2}$ matrix $\boldsymbol{A}$ is 1, then one can always find a vector $\boldsymbol{\mathbf{b} \in \mathbb{R}^2}$} \par \colorbox{SolutionColor}{\bfseries so that $\boldsymbol{A \mathbf{x} = \mathbf{b}}$ does not have a solution.}
\end{enumerate}


\end{document}

enter image description here

Best Answer

A box (here, color box) will not break across lines. You can take shelter inside a parbox for this:

\documentclass[11pt]{article}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{color,linegoal}

\definecolor{SolutionColor}{gray}{0.85}

\begin{document}

Choose all correct statements.
\begin{enumerate}
\item \colorbox{SolutionColor}{\parbox[t]{\linegoal}{\bfseries Here is a true sentence.}}
\item \colorbox{SolutionColor}{\parbox[t]{\linegoal}{\bfseries If the rank of a $\boldsymbol{2 \times 2}$ matrix $\boldsymbol{A}$ is 1, then one can always find a vector $\boldsymbol{\mathbf{b} \in \mathbb{R}^2}$ so that $\boldsymbol{A \mathbf{x} = \mathbf{b}}$ does not have a solution.}}
\end{enumerate}

Choose all correct statements.
\begin{enumerate}
\item \colorbox{SolutionColor}{\parbox[t]{\linegoal}{\bfseries Here is a true sentence.}}
\item \colorbox{SolutionColor}{\parbox[t]{\linegoal}{\bfseries If the rank of a $\boldsymbol{2 \times 2}$ matrix $\boldsymbol{A}$ is 1, then one can always find a vector $\boldsymbol{\mathbf{b} \in \mathbb{R}^2}$ \par so that $\boldsymbol{A \mathbf{x} = \mathbf{b}}$ does not have a solution.}}
\end{enumerate}


\end{document}

enter image description here

Related Question