Referencing a quote environment
See below for Alternate Appearance. See ADDENDUM for version that uses aux file to allow future referencing
As Christian noted in a comment, a quote has no counter (and thus no identifying label). However, we could introduce one to the lquote
environment, which requires a label as the argument, reference-able by \quoteref
.
The implementation given below can be altered to suit the needs for quotation marks, numbering scheme and appearance, etc.
\documentclass{article}
\newcounter{numquote}
\newenvironment{lquote}[1]{%
\stepcounter{numquote}%
\expandafter\xdef\csname#1\endcsname{\fbox{\thenumquote}}%
\quote``\ignorespaces}{\unskip''\fbox{\thenumquote}\endquote}
\newcommand\quoteref[1]{\csname#1\endcsname}
\begin{document}
Compare this quote
\begin{lquote}{quote:one}
blabla
\end{lquote}
to this one
\begin{lquote}{quote:two}
moreblabla
\end{lquote}
In quotation \quoteref{quote:one}, we see a difference from quote \quoteref{quote:two}.
\end{document}
Alternate Appearance
\documentclass{article}
\newcounter{numquote}
\newenvironment{lquote}[1]{%
\stepcounter{numquote}
\expandafter\xdef\csname#1\endcsname{\thenumquote}%
\quote Quote \thenumquote: ``\ignorespaces}{\unskip''\endquote}
\newcommand\quoteref[1]{\csname#1\endcsname}
\begin{document}
Compare this quote
\begin{lquote}{quote:one}
blabla
\end{lquote}
to this one
\begin{lquote}{quote:two}
moreblabla
\end{lquote}
In quotation \quoteref{quote:one}, we see a difference from quote \quoteref{quote:two}.
\end{document}
ADDENDUM:
It seemed from the OP's comment that he may be using the \quoteref
prior to the label definition in the lquote
environment. To account for that, I have in this addendum implemented a system of writing out to the aux file to make the labels available even before they are defined.
\documentclass{article}
\makeatletter
\long\def \protected@iwrite#1#2#3{%
\begingroup
\let\thepage\relax
#2%
\let\protect\@unexpandable@protect
\edef\reserved@a{\immediate\write#1{#3}}%
\reserved@a
\endgroup
\if@nobreak\ifvmode\nobreak\fi\fi
}
\newcounter{numquote}
\newenvironment{lquote}[1]{%
\stepcounter{numquote}%
\protected@iwrite\@auxout{\def\nex{\noexpand\noexpand\noexpand}}{%
\nex\expandafter\xdef%
\nex\csname #1%
\nex\endcsname{\thenumquote}%
}%
\quote Quote \thenumquote: ``\ignorespaces}{\unskip''\endquote}
\makeatother
\newcommand\quoteref[1]{\csname#1\endcsname}
\begin{document}
In the future quotation \quoteref{quote:one},
we see a difference from quote \quoteref{quote:two}.
Compare this quote
\begin{lquote}{quote:one}
blabla
\end{lquote}
to this one
\begin{lquote}{quote:two}
moreblabla
\end{lquote}
In quotation \quoteref{quote:one}, we see a difference from quote \quoteref{quote:two}.
\end{document}
Note: the \protected@iwrite
macro came from egreg's answer at Writing \\ to a File.