[Tex/LaTex] How to reference a quote like an equation

cross-referencingequationsquoting

For my project, I've interviewed some people and used parts of those interviews as quotes in my project. Some quotes I would like to reference later on, just like how equations are referenced, with a number (1) right next to the equation.

My set up is

\documentclass[a4paper,11pt,oldfontcommands]{memoir}
\usepackage{pdfpages}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{parskip}    
\usepackage{graphicx}   
\usepackage{framed}     
\usepackage{setspace}   
\usepackage{caption}
\newenvironment{myquote}{\list{}{\leftmargin=1.0cm\rightmargin=1.0cm}\centering\small\itshape\item[]}{\endlist}
\usepackage{mathtools}
\usepackage[colorlinks=true]{hyperref}

\begin{document}
This is an example of what the subject might be.    
\begin{myquote}
Oh really -stranger.
\end{myquote}

Some text in-between.

\begin{myquote}
yes really -me
\end{myquote}

As mentioned by me in quote No. 1, I responded to a stranger.

\end{document}

So if I'm writing:

\begin{myquote}
Example of a quote.
\end{quote}

I just get the quote, which is fine, but in some cases I also want a number to the right of it – for later references, like:

yes really -me                      (1) 

Here is a picture of what I have:

enter image description here

And all I want is a number next to some of the quotes, just like it's possible to do with some equations.

I have tried to label it as an equation \label{eq:1} but it didn't work, and I also tried with the other labels. I have also tried How to reference a point in a document with a counter and descriptive text?, but that only gives me an active reference, which is close, but not quite what I'm looking for. I also tried Quote environment with reference at the end right, but that too wasn't quite what I was looking for. I have also tried \usepackage{csquotes} which for some reason doesn't work for me.

Solved:

Added this to the preamble:

\usepackage{environ}
\newcounter{quote}

\NewEnviron{myquotenumber}{\vspace{3ex}\par
\refstepcounter{quote}%
\hfill\parbox{\dimexpr \textwidth-2cm}%brug \parbox[b] for bunden [c] (standard) for center og [t] for top
{\centering\small\textit{\BODY}}
\hfill\llap{(\thequote)}\vspace{2ex}\par}

Now all quotes beginning with \begin{myquote} won't be numbered and quotes with \begin{myquotenumber}\cite{marker} has numbers and can be referenced with \ref{marker}.

Best Answer

Trying to center the quote while placing the number on the right was too difficult using the list environment, so I used a \parbox instead. The main difference is that a \parbox will not break at the end of a page.

\documentclass[a4paper,11pt,oldfontcommands]{memoir}
\usepackage{pdfpages}
\usepackage{tikz}
\usetikzlibrary{positioning}
%\usepackage{caption}% incompatible with memoir
\usepackage{mathtools}
\usepackage{environ}
\usepackage[colorlinks=true]{hyperref}

\newcounter{quote}

\NewEnviron{myquote}{\vspace{1ex}\par
\refstepcounter{quote}%
\hfill\parbox{\dimexpr \textwidth-2cm}%
{\centering\small\textit{\BODY}}%
\hfill\llap{(\thequote)}\vspace{1ex}\par}

\begin{document}
This is an example of what the subject might be.    
\begin{myquote}\label{example}
Oh really -stranger.
\end{myquote}

Some text in-between.

\begin{myquote}
yes really -me
\end{myquote}

As mentioned by me in quote No. \ref{example}, I responded to a stranger.

\end{document}