6

I am trying to typeset interviews using lists. I have created environments for questions and answers to style the \items and their contained text.

However, if I try to use these environments within a nested list (or a covington example), all the item labels but the first one suddenly disappear.

The code:

\documentclass[12pt,notitlepage,a4paper]{article}

\newenvironment{question}{\item[Q:]}{}
\newenvironment{answer}{\item[A:]}{}

\begin{document}

\begin{itemize}
\item
\begin{itemize}
\begin{question} Text \end{question}
\begin{answer} Text \end{answer}
\end{itemize}
\end{itemize}

\end{document}

Should produce:

* Q: Text
  A: Text

But A: is missing:

* Q: Text
     Text

If use a plain \item instead of my question environment, all goes well. Does anyone know how to solve this problem?

2
  • 2
    I'm not sure why you don't simply use \newcommand{\question}{\item[Q:]} and similarly for \answer.
    – egreg
    Commented Jul 24, 2013 at 15:06
  • I'd like to have my question text in italics.
    – Tuetschek
    Commented Jul 24, 2013 at 15:11

1 Answer 1

7

The problem is that you are grouping the first item and so an important information doesn't reach the second:

\documentclass[12pt,notitlepage,a4paper]{article}

\makeatletter
\newenvironment{question}{\item[Q:]}{\aftergroup\@noparitemfalse}
\newenvironment{answer}{\item[A:]abc}{}
\makeatother


\begin{document}

\begin{itemize}
\item 
\begin{itemize}
\begin{question} Text \end{question}
\begin{answer} Text \end{answer}
\end{itemize}
\end{itemize}

\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .