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.

I understand that there is a \quote (correct me if I'm wrong) macro to do this; but I'm using this for something else (not prose). I also want it to obey the right margin. My minimal working example below requires me to guess the \parbox width, which is not a best practice. See the line with the \newcommand{\myquote}...

\documentclass{article}

\newcommand{\myquote}[1]{\vskip6pt\noindent\hangindent=5em\hangafter=0\parbox{4in}{#1}\vskip6pt}

\begin{document}

The quick brown fox jumps over the lazy dog.

\myquote{The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.

The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.}

The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.

$E=mc^2$ by Einstein

\end{document}
share|improve this question
2  
Quick hack {\leftskip30pt\noindent your text............. (Just have a blank line at the end or a \par} –  Yiannis Lazarides Nov 6 '10 at 19:13
add comment

6 Answers 6

up vote 8 down vote accepted

I've always found it rather counter-intuitive that the various quote environments are implemented via the generic list environment (IIRC, the adjustwidth from memoir is also implemented that way). Recently, I had trouble combining adjustwidth with \obeylines (and some other stuff), giving me a "missing \item" error. Then I found \leftskip and \rightskip in the TeXbook. I think this is what you want:

\documentclass{article}
\usepackage{lipsum}

\newenvironment{blockquote}{%
  \par%
  \medskip
  \leftskip=4em\rightskip=2em%
  \noindent\ignorespaces}{%
  \par\medskip}

\begin{document}

\lipsum[1]

\begin{blockquote}
  \lipsum[2]

  \lipsum[3]
\end{blockquote}

\lipsum[4]

\end{document}

If you want the first paragraph of the quote indented, just remove the \noindent. If you don't want the first paragraph after the quote to be indented, insert \aftergroup\@afterindentfalse\aftergroup\@afterheading after the last \medskip, and put a \makeatletter / \makeatother pair before/after the \newenvironment.

share|improve this answer
add comment

Internally, quote is defined using the list environment, you can define your own by copying and modifying its original definition

\newenvironment{myquote}{%
   \list{}{\rightmargin\leftmargin}\item\relax
   % and maybe do more stuff
}{\endlist}
share|improve this answer
    
You have been a little bit faster. –  Thorsten Donig Nov 5 '10 at 11:40
add comment

It's easier to take the according code for the quote environment from the class file, modify it slightly and create a new environment.

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{blindtext}

\newenvironment{lquote}{%
  \list{}{%
    \rightmargin0pt}%
    \item\relax
  }
{\endlist}

\begin{document}
  \blindtext
  \begin{lquote}
    \blindtext
  \end{lquote}
  \blindtext
\end{document}

Note that the blindtext package is only use for producing dummy text thus not part of the solution.

share|improve this answer
add comment

You can also just delete \parbox{4in} (and leave {} around #1) in your code; then it'll work. And no, guessing the \parbox width is definitely not best practice.

share|improve this answer
add comment

Old question, but I thought I'd mention \narrower, which increases the \left- and \rightskip by \parindent so things stay consistent. In the TeXbook exercise 14.15, it is used with a \smallskip before and after, as well as an initial \noindent:

\documentclass{article}
\usepackage{lipsum}
\newcommand{\blockquote}[1]{%
  {\narrower\smallskip\noindent#1\smallskip}}
\begin{document}
\lipsum[41]
\blockquote{\lipsum[34]}
\lipsum[12]
\end{document}
share|improve this answer
add comment

By using the changepage package, one could achieve the same result:

enter image description here

\documentclass{article}
\usepackage{lipsum}
\usepackage{changepage}

\begin{document}

\lipsum[1]

\begin{adjustwidth*}{4em}{2em}
  \lipsum[2]

  \lipsum[3]
\end{adjustwidth*}

\lipsum[4]

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