Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The following code gives a compilation error.

\documentclass{report}

\usepackage{changepage}

\begin{document}

\chapter{Text1}

\begin{adjustwidth}{1cm}{2cm}

\section{Text2}

Text3

\begin{quote}
Text4
\end{quote}

\end{adjustwidth}

\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?

share|improve this question
2  
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
add comment

1 Answer

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}

\begin{adjustwidth}{1cm}{2cm}
\nointerlineskip\leavevmode
\section{Text2}

Text3

\begin{quote}
Text4
\end{quote}

\end{adjustwidth}

\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.