I have a 'questions and answers' section in my document. I want the answers to be formatted in a special way: italics and blue text.
Example document:
Code: Select all
\documentclass[a4paper,pdftex]{report}
\usepackage{xcolor}
\newcommand{\answer}[1]{\textcolor{blue}{\textit{#1}}}
\begin{document}
\answer{
First sentence of answer.
Second sentence of answer.
\begin{enumerate}
\item Item 1
\item Item 2
\end{enumerate}
}
\end{document}
But if I try to typeset this document using pdfLatex, I get the following error message:
Code: Select all
Runaway argument?
{\textit { First sentence of answer.
! Paragraph ended before \@textcolor was complete.
<to be read again>
\par
l.20 }
I also place a '\\' between Second sentence of answer and \begin{enumerate}.
However, then I get the following error message:
Code: Select all
Runaway argument?
{\textit { First sentence of answer. \\ Second sentence of answer. \\\ETC.
! Paragraph ended before \@textcolor was complete.
<to be read again>
\par
l.20 }
Code: Select all
\begin{enumerate}
\item Item 1
\item Item 2
\end{enumerate}
How can I color all text which might be part of the argument to the \answer command?