# Strange compilation problem using adjustwidth environment from changepage package

The following code gives a compilation error.

\documentclass{report}

\usepackage{changepage}

\begin{document}

\chapter{Text1}

\section{Text2}

Text3

\begin{quote}
Text4
\end{quote}

\end{document}


The error says: "Something's wrong--perhaps a missing \item." in the line of \begin{quote}. The error disappears when I remove either of

• the line \chapter{Text1}
• the line \section{Text2}
• the line Text3
• the adjustwidth environment

How can this be?

-
Add \leavevemode before you set the section: \begin{adjustwidth}{1cm}{2cm} \leavevmode –  Marco Daniel Jun 24 '12 at 7:50
Thanks, that works. However, it introduces a blank line. Do you know how this can be avoided? Negative \vspace would not work, because I want to number the lines. –  Niels Lohmann Jun 24 '12 at 10:50

The nesting fails. I don't know why but the following works:

The relevant part is:

\nointerlineskip\leavevmode


It's the classic 'a lot of stuff is implemented by LaTeX as a trivlist, even though this results in weird error messages' business. As a result, you need something to deal with the \par tokens correctly, which \leavevmode does. Here the complete MWE:

\documentclass{report}

\usepackage{changepage}

\begin{document}

\chapter{Text1}

\nointerlineskip\leavevmode
\section{Text2}

Text3

\begin{quote}
Text4
\end{quote}