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 would like to number the quotations that appear in my document. I like what LaTeX does with the equation environment, and would like something similar, so that if I had typed

\begin{quote}
Quote 1  
\end{quote}
more text more text more text  
\begin{quote}
Quote 2  
\end{quote}

The two quotes would appear with numbers off to the side like would happen if I had used the equation environment.

Thanks for your help.

share|improve this question
    
Probebly make use of theorem environments. They are highly customizable. See amsthm and ntheorem. –  jmc Apr 5 '12 at 20:20
    
Welcome to TeX.SE! Two quick comments. First, the style in this group, when asking a question, is not to thank people in words; rather, when you get answers, do consider upvoting the good ones and accepting the best. Second, it would be helpful if you provided a bit more information about your document's setup: Which document class do you use, and do you use any special packages for typesetting quotations? For instance, there's a LaTeX package called "quoting". –  Mico Apr 5 '12 at 20:22
    
Do the quotes span more than one line, like a paragraph? If it spans more than one line, is it okay if the block is numbered in the middle (vertically), or should be at the top/bottom? Do you want the numbers in the margin, or within the text block (like with an equation)? Please clarify. –  Werner Apr 5 '12 at 20:47

2 Answers 2

up vote 9 down vote accepted

Here's a simple approach using a \parbox.

\documentclass[12pt]{article}
\usepackage{lipsum}

\newcounter{quotecount}
\newcommand{\MyQuote}[1]{\vspace{1cm}\addtocounter{quotecount}{1}%
     \parbox{10cm}{\em #1}\hspace*{2cm}(\arabic{quotecount})\\[1cm]}

\begin{document}
\lipsum[1]
\MyQuote{\lipsum[2]}
\lipsum[3]
\MyQuote{\lipsum[4]}
\lipsum[5]

\end{document}

simple test

share|improve this answer
2  
Using \stepcounter{quotecount} is equivalent to \addtocounter{quotecount}{1}. However, using \refstepcounter{quotecount} instead allows one to use \label and later \ref it. –  Werner Apr 6 '12 at 2:44
    
Ah, this is perfect. Werner: this is helpful; I will frequently be referring to my quotes. –  Shay Apr 7 '12 at 19:24
1  
In the solution with the parbox, I would suggest using variable sizes: \newcommand{\MyQuote}[1]{\addtocounter{quotecount}{1}% \indent\parbox{\textwidth - 4\parindent}{\bigskip\em #1}\hfill(\arabic{quotecount})\bigskip} –  user79927 Oct 1 at 16:32
1  
I’d add \par to the beginning of the env to ensure that \vspace works and also use \par\vspace at the end and not \\[…] –  Tobi Oct 3 at 12:51
1  
And note that these quotes can't be broken across pages. –  Tobi Oct 3 at 12:52

One way is to use the resume feature of the enumitem package, which gives you much flexibility in choosing how you want your quotes to be numbered. Below I have defined a list to have a depth of 2 and use numbers for the first level quotes and switch to letters for the second level quotes (if any). The color blue was added just so that the quote environment would stand out:

enter image description here

Notes:

  • The showframe package was added just so that you could see where the margins of the text are.

References:

Code:

\documentclass{article}
\usepackage{showframe}
\usepackage{lipsum}
\usepackage{xcolor}

\usepackage{enumitem}
\newlist{myQuoteEnumerate}{enumerate}{2}% Set max nesting depth
\setlist[myQuoteEnumerate,1]{label=(\arabic*)}% Use numbers for level 1
\setlist[myQuoteEnumerate,2]{label=(\alph*)}%   Use letters for level 2

\newenvironment{MyQuote}{%
    \begin{myQuoteEnumerate}[resume=*,series=MyQuoteSeries]%
    \color{blue}%
    \item \begin{quote}%
}{%
    \end{quote}%
    \end{myQuoteEnumerate}%
}%

\begin{document}
\noindent
some text some text some text
%
\begin{MyQuote}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris et diam viverra mauris commodo eleifend. Donec quis massa nisi.  
    \begin{MyQuote}
        Suspendisse magna nisi, rhoncus sed sagittis sed, auctor id quam. Phasellus quis neque ut tellus tristique accumsan. Curabitur dignissim laoreet pellentesque. Integer placerat consectetur commodo. 
    \end{MyQuote}
\end{MyQuote}
%
more text more text more text
%
\begin{MyQuote}
    Proin elit massa, sollicitudin vitae consectetur sit amet, sollicitudin nec nisl. Nulla facilisi.
\end{MyQuote}
\end{document}
share|improve this answer
    
This is helpful, and your sample document is particularly useful for showing how to further modify this setup. It happens that the other answer matches the aesthetic I was hoping for more, however. –  Shay Apr 7 '12 at 19:22

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.