如何删除物品标签中的句号

如何删除物品标签中的句号

当使用 enumitem 时,我想要按如下方式更改标签名称:

\documentclass[11pt]{article} 
\usepackage[utf8]{inputenc} 
\usepackage{enumitem}
\begin{document}
\section{First section}

\begin{enumerate}[leftmargin=*,labelindent=\parindent,=itemsep=0pt,label=Part \arabic*.]
  \item\label{part:1} append this;
  \item\label{part:2} advance that;
  \item\label{part:3} advance theother.
\end{enumerate}

Look at  \ref{part:1} where we get the extra period. It's particularly bad if I refer to \ref{part:2}.  This gives me ".." at the end of the sentence.
\end{document}

\ref{part:1}给了我Part 1.想要的位置Part 1。如何在引用时删除句点,但在列表中显示时保留它?

答案1

enumitem还有一把ref专门为此设计的钥匙:

\documentclass[11pt]{article} 
\usepackage[utf8]{inputenc} 
\usepackage{enumitem}
\begin{document}
\section{First section}

\begin{enumerate}[leftmargin=*,labelindent=
\parindent,=itemsep=0pt,label=Part \arabic*., ref=Part \arabic*]
  \item\label{part:1} append this;
  \item\label{part:2} advance that;
  \item\label{part:3} advance theother.
\end{enumerate}

Look at  \ref{part:1} where we get the extra period.
\end{document}

代码输出

相关内容