4

When using enumitem, I want to change the label names as follows:

\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} gives me Part 1. where I would like Part 1. How can I get rid of the period when I refer to it but keep it when it displayed in the list?

  • 2
    Add ref=Part \arabic* to the options list. – Sergei Golovan Jul 12 '17 at 13:27
  • @AlanMunn Please feel free to delete the question if it's a duplicate. Many apologies. – Lembik Jul 12 '17 at 13:33
  • @Lembik No, it's not a problem to have duplicates, so the question doesn't need to be deleted, but will be closed and linked to the duplicate. – Alan Munn Jul 12 '17 at 13:34
  • @AlanMunn Is it possible to have a period but just not if it is at the end of sentence? That is to avoid the .. problem. – Lembik Jul 12 '17 at 13:56
  • @Lembik I don't think that's very good style. How do you distinguish the period of your label from the end of your sentence when the label is in the middle? – Alan Munn Jul 12 '17 at 13:59
7

enumitem also has a ref key which is specifically designed for this:

\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}

output of code

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.