3

I'd like to use letter style enumeration for two running lists, combined into one.

The two lists have letter enumeration J-journals and C-conference. Code and output below for the two lists.

Once combined as one single list, it would allow overlapping J and C items. such as: J3 C2 J2 J1 C1

Journal list:
\begin{etaremune}
\renewcommand{\theenumi}{J\arabic{enumi}}
\item Journal 1
\item Journal 2
\end{etaremune}

Conference list:
\begin{etaremune}
\renewcommand{\theenumi}{C\arabic{enumi}}
\item Proceeding 1
\item Proceeding 2
\end{etaremune}

enter image description here

  • You mean that the numbers will be counted down, like J5 -> C5 -> J4 -> C4 -> ... -> J1 -> C1? – user156344 Nov 21 '18 at 14:59
  • Not exactly, I can list journals and conference items together but they are counted separately, the journals with a J and conference items with a C. They are both counted down of course descending order. I have updated my question, does it help? – dr_rk Nov 21 '18 at 15:16
  • 2
    it is always better to post a small test document rather than a fragment in particular it would show where you are defining etaremune – David Carlisle Nov 21 '18 at 15:16
2

I don't think there's a package that does this, so below is effectively a reimplementation of etaremune that uses two counters instead of one.

The jcenum environment defined below is defined using itemize. It can contain two types of items, declared with \jitem and \citem which correspond to journals and conferences respectively.

\documentclass{article}

%% Counter for jcenum environments:
\newcounter{jcenum}

%% Separate counters for journals and conferences:
\newcounter{enumj} %% <- counts journals
\newcounter{enumc} %% <- counts conferences
\renewcommand*\theenumj{J\arabic{enumj}}
\renewcommand*\theenumc{C\arabic{enumc}}

%% A new enumeration environment based on itemize:
\makeatletter %% <- make @ usable in macro names
\newenvironment{jcenum}{%
  \stepcounter{jcenum}%
  \@ifundefined{enumjmax@\arabic{jcenum}}{\@namedef{enumjmax@\arabic{jcenum}}{0}}{}%
  \@ifundefined{enumcmax@\arabic{jcenum}}{\@namedef{enumcmax@\arabic{jcenum}}{0}}{}%
  \setcounter{enumj}{\@nameuse{enumjmax@\arabic{jcenum}}}%
  \setcounter{enumc}{\@nameuse{enumcmax@\arabic{jcenum}}}%
  \itemize
}{%
  %% Write the number of journals/conferences to the aux files:
  \immediate\write\@auxout{%
    \string\global\string\@namedef{enumjmax@\arabic{jcenum}}%
      {\the\numexpr\@nameuse{enumjmax@\arabic{jcenum}}-\value{enumj}+1}%
    \string\global\string\@namedef{enumcmax@\arabic{jcenum}}%
      {\the\numexpr\@nameuse{enumcmax@\arabic{jcenum}}-\value{enumc}+1}%
  }%
  \enditemize
}
\makeatother  %% <- revert @

%% Separate \item macros for journals and conferences:
\newcommand*\jitem{\addtocounter{enumj}{-2}\refstepcounter{enumj}\item[\theenumj.]}
\newcommand*\citem{\addtocounter{enumc}{-2}\refstepcounter{enumc}\item[\theenumc.]}

\begin{document}

\subsection*{First environment}

\begin{jcenum}
\jitem First journal \label{firstitem}
\citem First conference
\citem Second conference
\jitem Second journal
\citem Third conference
\end{jcenum}

\noindent Reference to the first item: \ref{firstitem}

\subsection*{Second environment}

\begin{jcenum}
\jitem First journal
\citem First conference
\citem Second conference
\end{jcenum}

\end{document}

output

A few words on what this does:

I define the counters enumj and enumc to keep track of the journal and conference index. These are decremented whenever \jitem or \citem is called and at the end of the jcenum environment their correct starting values are calculated and written to the aux file. On the second run, the starting value that was stored in the aux file is applied to enumj and enumc at the start of the jcenum environment (otherwise 0 is used).

The jcenum counter is there to generate identifiers for the individual jcenum environments in case your document contains multiple jcenum environments.

| improve this answer | |

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.