如何去除商品標籤中的句點

如何去除商品標籤中的句點

使用 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}

程式碼的輸出

相關內容