I am using the enumitem
package and need to access the counter values after the end of the environment. With a standard
\newlist{Example}{enumerate}{2}
for instance, the counter value is simply the list name with an i
appended to the end: Examplei
.
What is the counter name when an inline list is declared, such as
\newlist{Example*}{enumerate*}{2}%
The value highlighted in red is incorrect and should be 2
:
Notes:
- Ideally, I would prefer to have the inline version use the same counter as the non-inline version. But a solution just accessing the inline counter might be useful for others who come across this question.
Code:
\documentclass{article}
\usepackage{enumitem}
\usepackage{xcolor}
\newlist{Example}{enumerate}{2}%
\setlist[Example]{label={\arabic*.}}
\newlist{Example*}{enumerate*}{2}%
\setlist[Example*]{itemjoin={\hspace*{2.0em}}, label={\arabic*.}}
\begin{document}
\textbf{Vertical List}
\begin{Example}
\item First V item.
\item Second V item.
\item Third V item.
\end{Example}
There were \arabic{Examplei} elements in prior list.
\bigskip
\textbf{Horizontal List}:
\begin{Example*}
\item First H item.
\item Second H item.
\end{Example*}
\medskip
%% How do I get the correct count here?
There were \textcolor{red}{\arabic{Examplei}} elements in prior list.
\end{document}