14

I would like to create a new environment which will behave similar to quote, but with quotes added. I tried something like this:

\newenvironment{newquote}{\itshape\color{blue!20!black!30!green}\begin{quote}“}{”\end{quote}}

But that produces space beetween quotes and text which I don't want.

Unwanted space beetween quotes and text

2 Answers 2

13

I'd be tempted to look at the csquotes package to do what you want. However, for the matter in hand I suspect you are using input such as

\begin{newquote}
  He who plants a garden plants happiness.
\end{newquote}

which means there is a space added at the end of the line. Try

\newenvironment{newquote}
 {\itshape\color{blue!20!black!30!green}\begin{quote}“\ignorespaces}
 {\unskip”\end{quote}}

or add a % to kill the end of the line in your source:

\begin{newquote}%
  He who plants a garden plants happiness.%
\end{newquote}
8
  • There's also a space at the beginning. I tried \xspace but that didn't work, \ignorespaces did, though. Commented Feb 24, 2011 at 9:01
  • @Andrew Stacey: I was about to write about the space at the beginning as well. @Joseph Wright: Could you add the \ignorespaces to your answer. That makes it possible to use the desired input \begin{newquote} He who plants a garden plants happiness \end{newquote}
    – ipavlic
    Commented Feb 24, 2011 at 9:03
  • @Andrew: Oh yes, so there is. @ipavlic: done
    – Joseph Wright
    Commented Feb 24, 2011 at 9:12
  • @Joseph: For your last piece of code you'd also need a % after \begin{newquote}, wouldn't you? Commented Feb 24, 2011 at 9:14
  • @Hendrik: Hmm, yes. I'll sort that.
    – Joseph Wright
    Commented Feb 24, 2011 at 9:21
11

Perhaps this is overkill. Some time ago I was looking for something simular. I wrote a small script that was able to show small quotes to introduce a chapter in a book I am writing. The code:

\newcommand{\chapterquote}[2]{
  \begin{figure*}[htb]
    \centering
    \begin{tikzpicture}
      \node[text width=12cm,anchor=center] (Q) at (0,0) {\Large\textit{#1}};
      \node[gray,anchor=north east] (Ql) at (Q.north west) {\Huge\textbf{``}};
      \node[gray,anchor=north west] (Qr) at (Q.south east) {\Huge\textbf{''}};
      \node[black!80,anchor=north east] (Qa) at (Qr.north west) {\small - #2};
    \end{tikzpicture}
  \end{figure*}
}

You will need the to use tikz package. As an example:

\chapterquote{To be, or not to be}{William Shakespeare}

This produces something like:

enter image description here

Feel free to experiment with this custom command. You can for instance modify the color and size.

1
  • Thanks, that seems very nice. I am very happy with TikZ in general.
    – ipavlic
    Commented Feb 24, 2011 at 9:54

You must log in to answer this question.

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