Latex 引用电子邮件文本中的行

Latex 引用电子邮件文本中的行,latex,Latex,我试着用乳胶来达到一个目的,它可能不是专门为之设计的,也不奇怪会有一些困难。我试图将一系列电子邮件中的文本包括在内,然后我想写一个摘要,其中提到电子邮件中的行号,提请注意对话的某些部分 对于行编号,我发现lineno包运行良好,允许我使用\linelabel{label1}宏设置引用目标,然后可以使用\ref{label1}引用这些宏 但是,由于文本格式的电子邮件链中有许多需要转义的字符,例如>字符,因此我一直在寻找一个软件包,该软件包允许我将文本视为预格式化文本,同时仍然解析\linelabe

我试着用乳胶来达到一个目的,它可能不是专门为之设计的,也不奇怪会有一些困难。我试图将一系列电子邮件中的文本包括在内,然后我想写一个摘要,其中提到电子邮件中的行号,提请注意对话的某些部分

对于行编号,我发现lineno包运行良好,允许我使用\linelabel{label1}宏设置引用目标,然后可以使用\ref{label1}引用这些宏

但是,由于文本格式的电子邮件链中有许多需要转义的字符,例如>字符,因此我一直在寻找一个软件包,该软件包允许我将文本视为预格式化文本,同时仍然解析\linelabel Latex宏

我尝试了verbatim环境和lstlisting环境,但两者似乎都忽略了\linelabel宏。有人知道我要找的包裹吗

提前谢谢

编辑:添加了MWE。在背面。演示了使用lineno软件包,我可以成功获取要输出的行号,并且在电子邮件内容中定义标签时可以引用行号,但有许多字符需要转义。还显示了将电子邮件内容放在列表块中,这样可以更好地格式化电子邮件,但会丢失linelabel宏解析。寻找一个快乐的媒介

\documentclass[12pt,stdletter,orderfromtodate,sigleft]{newlfm}

\usepackage{listings}

\lstset{basicstyle=\footnotesize,stringstyle=\footnotesize,language=,}


\usepackage{lineno}

\begin{document}
\section{Summary}

Refer to line \ref{label1}.  And then he did it again on line \ref{label2}.
\newpage

\linenumbers

\section{Emails with no formatting}

Email response number 2

On Wed, Sep 9, 2020, 9:15 AM Anonymous wrote:

> Hi Umptyscrunch,
>
> I'm letting you know that I did that thing.
>
> Thanks,
> Marklar
>

Hi Marklar,

\linelabel{label1} Yeahhh.  I'm going to need you to come in this Saturday.  

Thanks,
Umptyscrunch

---------- Forwarded message ---------

No rush, it's all good my friend.  It's a minimal working example.

\section{Emails with listing formatting}

\begin{lstlisting}
Email response number 2

On Wed, Sep 9, 2020, 9:15 AM Anonymous wrote:

> Hi Umptyscrunch,
>
> I'm letting you know that I did that thing.
>
> Thanks,
> Marklar
>

Hi Marklar,

\linelabel{label2} Yeahhh.  I'm going to need you to come in this Saturday.  

Thanks,
Umptyscrunch

---------- Forwarded message ---------

No rush, it's all good my friend.  It's a minimal working example.
\end{lstlisting}

\end{document}

有件事我还算满意。尽管我不想在每行末尾插入换行符\\。我宁愿它像逐字记录软件包一样,将输入中的换行符视为输出中的换行符。切换到courier字体可以解决>字符显示为的问题?在输出中

\documentclass[12pt,stdletter,orderfromtodate,sigleft]{newlfm}

\renewenvironment{email}{\fontfamily{pcr}\selectfont\begin{footnotesize}}{\end{footnotesize}\par}

\renewcommand{\L}{\linelabel}


\usepackage{lineno}

\begin{document}
\section{Summary}

Refer to line \ref{label1}.  And then he did it again on line \ref{label2}.
\newpage

\linenumbers

\section{Emails with no formatting}



\begin{email}
Email response number 2\\
\\
On Wed, Sep 9, 2020, 9:15 AM Anonymous wrote:\\
\\
> Hi Umptyscrunch,\\
>\\
> I'm letting you know that I did that thing.\\
>\\
> Thanks,\\
> Marklar\\
>
\\
Hi Marklar,
\\
\L{label1}Yeahhh.  I'm going to need you to come in this Saturday.  This line is so long it should wrap.  I believe you have my stapler. \\ 
\\
Thanks,\\
Umptyscrunch

---------- Forwarded message ---------

No rush, it's all good my friend.  \linelabel{label2}It's a minimal working example.

\end{email}

\end{document}

我会使用
清单
软件包。它可以显示行号、参考特定行,甚至可以为回复添加颜色:

\documentclass[12pt,stdletter,orderfromtodate,sigleft]{newlfm}

\usepackage{listings}

\lstset{
  basicstyle=\footnotesize\ttfamily,
  stringstyle=\footnotesize,
  escapeinside={&}{&},
  numbers=left,
  morecomment=[l][\color{blue!80}]{> },
  morecomment=[l][\color{red!80}]{>> }, 
}


\begin{document}
\section{Summary}

Refer to line \ref{label2}. 

\begin{lstlisting}
Email response number 2

On Wed, Sep 9, 2020, 9:15 AM Anonymous wrote:

> Hi Umptyscrunch,
>
> I'm letting you know that I did that thing.
>
>> previous reply
>
> Thanks,
> Marklar
>

Hi Marklar,

&\label{label2}&Yeahhh.  I'm going to need you to come in this Saturday.  

Thanks,
Umptyscrunch

---------- Forwarded message ---------

No rush, it's all good my friend.  It's a minimal working example.
\end{lstlisting}

\end{document}


(将转义字符的
&
替换为电子邮件中不会出现的任何字母或字母序列)

请,请,请不要滥用
\\
换行符,这实际上只应该用在表格中。啊,这很好,解决了我提出的一些问题。谢谢