How to \label emails in appendix?

I would like to include ~20 emails in the appendix section of an article, so I in the article can e.g. write "...according to \ref{email1}".

If I put each email in a subsection, then I have to find a name for each of them, which I don't really want.

Each email is enclosed in \begin{verbatim} \end{verbatim}.

Is there a way to \ref these emails?

-
You presumably need some kind of heading or tag so the cross reference has some visible reference to the email? If so you could just use \label as normal? – David Carlisle Jan 29 '13 at 22:25
Yes, something like that would be great. A bit like how equations work with \label and \ref. – Sandra Schlichting Jan 29 '13 at 22:40
But what I mean is your question isn't clear. A verbatim on its own has nothing (in the final output) to use as a reference, but if they are titled or numbered or marked in any way then most likely \label would just work. You probably need to give more indication of the required result – David Carlisle Jan 29 '13 at 22:57

1 Answer

\documentclass{article}
\usepackage{verbatim}

\newcounter{quotedemail}
\newenvironment{quotedemail}[1]
{\refstepcounter{quotedemail}\label{#1}%
\subsubsection*{Email message \thequotedemail}
\verbatim}
{\endverbatim}

\begin{document}
As we read in the quoted email message \ref{email1} ...

\begin{quotedemail}{email1}
From: foo@bar.baz
To: Sandra

Got it!

foo
\end{quotedemail}

\end{document}


-