3

I defined parlist using lower case letters for the items (I know that there are other ways to use letters for the items but I wanted to customize the list style anyway).

Unfortunately, if I refer to them, the label is printed with a number. Can anyone help me with that?

Here is a MWE:

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}

\newcounter{num}
\newenvironment{parlist}{\begin{list}{(\alph{num})}{\usecounter{num} \leftmargin0pt \itemindent5pt \topsep0pt \labelwidth0pt}}{\end{list}}

\begin{document}
\begin{parlist}
    \item This is the first item \label{first}
    \item and another one
\end{parlist}   

As seen in \eqref{first}...
\end{document}

Which produces:

enter image description here

4

Reinventing the wheel rarely holds out the promise of substantial rewards. Thus, rather than try to bend the very-low-level LaTeX environment called listto my specific needs, I would load the enumitem package and issue the following commands in the preamble:

\usepackage{enumitem}
\newlist{parlist}{enumerate}{1}
\setlist[parlist]{label=(\alph*),wide=0pt,topsep=0pt}

You may verify for yourself that this setup produces the exact same output as your version of parlist, in terms of the layout of the list-like environment. There's a big difference, though: The output of \ref is now what you expect it to be too, viz. (a), etc.


A full MWE (minimum working example):

\documentclass[a4paper]{article} % '10pt' is the default
\usepackage{lipsum} % for filler text

%\newcounter{num}
%\newenvironment{parlist}{\begin{list}{(\alph{num})}{\usecounter{num}%
%    \leftmargin0pt \itemindent5pt \topsep0pt \labelwidth0pt}}{\end{list}}

\usepackage{enumitem}
\newlist{parlist}{enumerate}{1}
\setlist[parlist]{label=(\alph*),wide=0pt,topsep=0pt}

\begin{document}

\begin{parlist}
    \item This is the first item \label{first}
    \item \lipsum*[2]
\end{parlist}

As seen in \ref{first}, \dots

\end{document}
3

Redefine \thenum:

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}

\newcounter{num}
\renewcommand{\thenum}{\alph{num}}
\newenvironment{parlist}
 {%
  \begin{list}{(\thenum)}{%
    \usecounter{num}%
    \leftmargin0pt
    \itemindent5pt
    \topsep0pt
    \labelwidth0pt
  }%
}{\end{list}}

\begin{document}
\begin{parlist}
    \item This is the first item \label{first}
    \item and another one
\end{parlist}

As seen in \eqref{first}...
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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