在描述列表中添加脚注

在描述列表中添加脚注

我有以下代码:

\begin{description}
    \item[Source] The teacher was late because of the traffic. 
    \item[Reference] The teacher arrived late because of the traffic. 
    \item[Candidate (lowest BLEU)] The \textcolor{red}{professor was delayed due to} the \textcolor{red}{congestion}.
    \item[Candidate (lower BLEU)] \textcolor{red}{Congestion was responsible for}\textcolor{blue}{the teacher} \textcolor{red}{being}late.
    \item[Candidate (higher BLEU)] \textcolor{blue}{The teacher} \textcolor{red}{was} late \textcolor{red}{due to} \textcolor{blue}{the traffic}.
    \item[Candidate (highest BLEU)] The \textcolor{red}{professor} \textcolor{green}{arrived late because of} \textcolor{red}{circulation}.
\end{description}

这将生成包含一些彩色句子的描述。

我想添加一条注释来解释每种颜色的含义。我知道这可以用表格来实现threeparttable。我也试过,lstlistings但编号列表标题不适合用例。

在此先感谢您提供的任何帮助。

答案1

这是基于threeparttable的解决方案

在此处输入图片描述

\documentclass{article}
\usepackage{array}
\usepackage{xcolor}
  \colorlet{professor}{red}
  \colorlet{teacher}{blue}
  \colorlet{something}{black!25!green}
\usepackage{tabularx}
\usepackage{threeparttable}
  \newcommand{\xtnote}[1]{\textsuperscript{\TPTtagStyle{#1}}}


\begin{document}
\begin{threeparttable}
  \setlength\tabcolsep{2pt}
  \renewcommand*{\arraystretch}{1.75}
  \begin{tabularx}{\linewidth}{@{} >{\bfseries}l X @{}}
    Source                   & The teacher was late because of the traffic. \\
    Reference                & The teacher arrived late because of the traffic. \\
    Candidate (lowest BLEU)  & The \textcolor{professor}{professor\xtnote{$\dag$} was delayed due to} the \textcolor{professor}{congestion}. \\
    Candidate (lower BLEU)   & \textcolor{professor}{Congestion was responsible for} \textcolor{teacher}{the teacher\xtnote{$\dag\dag$}} \textcolor{professor}{being} late. \\
    Candidate (higher BLEU)  & \textcolor{teacher}{The teacher} \textcolor{professor}{was} late \textcolor{professor}{due to} \textcolor{teacher}{the traffic}. \\
    Candidate (highest BLEU) & The \textcolor{professor}{professor} \textcolor{something}{arrived\xtnote{$\dag\dag\dag$} late because of} \textcolor{professor}{circulation}. \\
  \end{tabularx}
  \medskip\rule{4cm}{0.4pt}
  \par\makebox[2em][r]{\color{professor}\xtnote{$\dag$}} the red color note
  \par\makebox[2em][r]{\color{teacher}\xtnote{$\dag\dag$}} the blue color note
  \par\makebox[2em][r]{\color{something}\xtnote{$\dag\dag\dag$}} the green color note
\end{threeparttable}
\end{document}

如果你不想在文本中添加注释标记,可以执行以下操作

在此处输入图片描述

以及表格的代码

\begin{threeparttable}
  \setlength\tabcolsep{2pt}
  \renewcommand*{\arraystretch}{1.75}
  \begin{tabularx}{\linewidth}{@{} >{\bfseries}l X @{}}
    Source                   & The teacher was late because of the traffic. \\
    Reference                & The teacher arrived late because of the traffic. \\
    Candidate (lowest BLEU)  & The \textcolor{professor}{professor was delayed due to} the \textcolor{professor}{congestion}. \\
    Candidate (lower BLEU)   & \textcolor{professor}{Congestion was responsible for} \textcolor{teacher}{the teacher} \textcolor{professor}{being} late. \\
    Candidate (higher BLEU)  & \textcolor{teacher}{The teacher} \textcolor{professor}{was} late \textcolor{professor}{due to} \textcolor{teacher}{the traffic}. \\
    Candidate (highest BLEU) & The \textcolor{professor}{professor} \textcolor{something}{arrived\ late because of} \textcolor{professor}{circulation}. \\
  \end{tabularx}
  \medskip\hrule\medskip
  \centering
  \par{\color{professor}\rule{6pt}{6pt}} the red color note%
  \quad|\quad {\color{teacher}\rule{6pt}{6pt}} the blue color note%
  \quad|\quad {\color{something}\rule{6pt}{6pt}} the green color note
\end{threeparttable}

答案2

我使用以下代码成功实现了我想要的效果:

\setlist[description]{leftmargin=\parindent,labelindent=\parindent, itemsep=-5pt}
\newlist{notes}{enumerate}{1}
\setlist[notes]{label=, topsep=5pt, leftmargin=\parindent, rightmargin=\parindent}

\begin{document}
\begin{description}
    \item[Source] Sentence 1. 
    \item[Reference] Sentence 2.
    \begin{notes}
    \item \small Notes I wanted HERE
    \end{notes}
\end{description}
\end{document}

相关内容