Text FormattingRenewenvironment -- Something's wrong...

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
tjaenare
Posts: 30
Joined: Tue Nov 11, 2008 3:49 pm

Renewenvironment -- Something's wrong...

Post by tjaenare »

Hi everybody,
I am trying to define a new way to quote text. The result should be a single-spaced, rightragged, and indented (not only the first line but the whole paragraph) text. As far as the result is concerened, I am satisfied. Nevertheless, every call of the new command causes the engine to report the following error:
LaTeX Error: Something's wrong -- perhaps a missing \item.
See the LaTeX manual ...
I have tried to understand where the error might be, but were unable to find out so far. Do you have an idea?

Code: Select all

\documentclass[a4paper,11pt,final,index=totoc,version=first,headsepline,oneside]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{csquotes}
\usepackage[dutch,ngerman,british]{babel}
\usepackage{setspace}


\begin{document}

\newcommand{\quotepre}{}\let\quotepre=\quote
\renewenvironment{quotepre}{\list{}{\rightmargin0pt\leftmargin4cm}\singlespacing\flushleft\small\item\relax}{\endlist}

\chapter{The UK and the Low Lands}

\begin{quotepre}
\textsl{\textbf{a lot of text}}
\end{quotepre}

\section{Introduction}

\begin{quotepre}
\textsl{God created the world, but the Dutch created Holland} 

British saying
\end{quotepre}

\end{document}
Thank you very much beforehand,
Alexander
Last edited by tjaenare on Thu Nov 11, 2010 11:17 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Renewenvironment -- Something's wrong...

Post by meho_r »

Put \flushleft after \item.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Renewenvironment -- Something's wrong...

Post by localghost »

First of all thanks for the example which allowed working out a solution within a few minutes. Use the \raggedright switch instead. The code below should do what you are aiming at.

Code: Select all

\documentclass[%
  paper=a4,
  fontsize=11pt,
  index=totoc,
  version=first,
  headsepline,
  oneside
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[dutch,ngerman,english]{babel}
\usepackage[onehalfspacing]{setspace}
\usepackage{blindtext}

\newenvironment{quotepre}{%
  \list{}{%
    \rightmargin0pt%
    \leftmargin4cm%
  }
  \singlespacing
  \raggedright
  \small
  \item\relax
}{\endlist}

\begin{document}
  \chapter{The UK and the Low Lands}
    \begin{quotepre}
      \blindtext
    \end{quotepre}

    \section{Introduction}
      \begin{quotepre}
        \blindtext
      \end{quotepre}
\end{document}

Thorsten
tjaenare
Posts: 30
Joined: Tue Nov 11, 2008 3:49 pm

Re: Renewenvironment -- Something's wrong...

Post by tjaenare »

Thanks a lot to both of you!
Both possibilities work out perfectly for me!
And I learned something new again... (though it is still a long way to go seeing what skills people here have!)
Post Reply