I want to customize items from a list within the enumerate environment, using a counter that is followed up in each list.
Here's how I did it:
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\newcounter{counter}
List 1
\begin{enumerate}[label=Ex.\arabic{counter}] \stepcounter{counter}
\item Some text \stepcounter{counter}
\item Some text \stepcounter{counter}
\item Some text \stepcounter{counter}
\end{enumerate}
List 2
\begin{enumerate}[label=Ex.\arabic{counter}] \stepcounter{counter}
\item Some text \stepcounter{counter}
\item Some text \stepcounter{counter}
\item Some text \stepcounter{counter}
\end{enumerate}
\end{document}
Another way to do it is by customizing each item:
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\newcounter{counter}
List 1
\begin{enumerate}
\item[Ex.\stepcounter{counter}\arabic{counter}] Some text
\item[Ex.\stepcounter{counter}\arabic{counter}] Some text
\item[Ex.\stepcounter{counter}\arabic{counter}] Some text
\end{enumerate}
List 2
\begin{enumerate}
\item[Ex.\stepcounter{counter}\arabic{counter}] Some text
\item[Ex.\stepcounter{counter}\arabic{counter}] Some text
\item[Ex.\stepcounter{counter}\arabic{counter}] Some text
\end{enumerate}
\end{document}
As you can see, the only way I can stepcounter each item is by using the command every time I create a new item. However, I want to avoid using the same command every time and just define from the begining that each item should step the counter, I'm looking to do something like this:
\begin{enumerate}[label=\stepcounter{counter}Ex.\arabic{counter}]
\item Some text
\item Some text
\item Some text
\end{enumerate}
But that doesn't work.
Also, if possible, I'd like to avoid creating a new command for "item" such as
\newcommand{\newitem}{\item[\stepcounter{counter}Ex.\arabic{counter}]}
Because I might neeed to create a list that shouldn't follow the same count.
Also I know I can delimit from which number to start like this:
List 1
\begin{enumerate}[label=Ex.\arabic*]
\item Some text
\item Some text
\item Some text
\end{enumerate}
List 2
\begin{enumerate}[label=Ex.\arabic*, start=4]
\item Some text
\item Some text
\item Some text
\end{enumerate}
But I want to avoid that too, though maybe it is much to ask.
Thank you
label=Ex. \arabic*
seems to do what you want