9

I want to redefine the quote environment in such a way to get the output of the following code.

\begin{quote}{\tiny\textquotedblleft Text \textquotedblright}\end{quote}

I also want to fix the line spacing because the distance between the lines looks so wide.

2 Answers 2

12

This is the original definition of the quote environment from article:

\newenvironment{quote}
               {\list{}{\rightmargin\leftmargin}%
                \item\relax}
               {\endlist}

Here is a redefined one using your requirements in the form of an MWE:

enter image description here

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\renewenvironment{quote}
               {\list{}{\rightmargin\leftmargin}%
                \item\relax\tiny\textquotedblleft\ignorespaces}
               {\unskip\unskip\textquotedblright\endlist}
\begin{document}
\lipsum[1]
\begin{quote}
\lipsum*[2]
\end{quote}
\lipsum[3]
\end{document}

The correction of \ignorespaces at \begin{quote} is to remove any spaces between at the start, while \unskip\unskip does the same at \end{quote}. Also, don't wrap the contents in a group { }, which provide the unwanted spacing.

Note that this will replace the existing quote environment. If you're planning on using the original format, it is best to define a new (say) altquote environment for this purpose.


An updated version of quote allows for an optional argument [name] which prepends "name said:" before adding the quote. If no name is supplied, the default quote (above) is set:

enter image description here

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{ifmtarg}% http://ctan.org/pkg/ifmtarg
\makeatletter
\renewenvironment{quote}[1][]
               {\list{}{\rightmargin\leftmargin}%
                \item\relax\tiny\@ifmtarg{#1}{\relax}
                  {\textbf{#1}~said:~}\textquotedblleft\ignorespaces}
               {\unskip\unskip\textquotedblright\endlist}
\makeatother
\begin{document}
\lipsum[1]
\begin{quote}
\lipsum*[2]
\end{quote}
\lipsum[3]
\begin{quote}[bkarpuz]
\lipsum*[4]
\end{quote}
\end{document}

Testing for empty arguments is supplied by the ifmtarg package's conditional

\@ifmtarg{<arg>}
  {<Code for arg empty>}
  {<Code for arg not empty>}
0
8

You could use the quoting environment of my package of the same name. quoting provides key--value options to configure, e.g., font properties and additional text, and these can be changed globally as well as for single environments (using the environment's optional argument). Note that you need the current package version 0.1b in order to use the begintext and endtext options. Also note that the font key supports all kinds of LaTeX font switching/formatting macros that don't feature an argument -- you can, e.g., specify font={tiny,bfseries,doublespacing} (doublespacing with the the setspace package loaded).

\documentclass{article}

\usepackage[font=tiny,begintext=\textquotedblleft,endtext=\textquotedblright]{quoting}

\newcommand*{\sometext}{Lorem ipsum dolor sit amet, consectetuer
    adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
    adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
    libero, nonummy eget, consectetuer id, vulputate a, magna.}

\begin{document}

\sometext
% <-- first line of following `quoting` environment not indented
\begin{quoting}
\sometext
\end{quoting}
%
\begin{quoting}[begintext={Some special text: \textquotedblleft}]
\sometext
\end{quoting}
% <-- first line after `quoting` environment not indented
\sometext

\end{document}

enter image description here

1

You must log in to answer this question.

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