2

I need to make a text in front of a list. This text is needed in two versions, conditional upon the number of items in the list. If one item, the text will refer to the number of items in singular. If more than one item, the text will refer to the number of items in plural. I want to use the conditional commands from the package etoolbox to decide which of the conditional text to use.

A related problem is this one: How to refer to number of items in a list before the list appears in the .tex file?

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

\begin{document}

% My conditional text: depends upon  the number of items in "My list" below
This report will addresses the following 
\ifnumcomp{\NumberOfItems}{>}{1}%
{issues}% if more than one item in the following list
{issue}%  if only one item


% My list
\begin{enumerate} 

\item Issue A
\item Issue B
\item Issue C

\end{enumerate}

% Count the number of items in the list
% Somehow store this number in a new variable, by using
% \newcommand{\NumberOfItems}{????}, 
% where this variable is not annihilated by the next round of compilation


\end{document}

How can I count the number of items and store this number in a command by \newcommand? How can this be done, so that the value of this variable carries over to the next compilation where it can be available for "My conditional text" ?

If I had the solution/code I am searching, my text would look like this:

1) If one item in the list:

This report addresses the following issue:

  • issue one

2) If more than one item in the list:

This report addresses the following issues:

  • issue one

  • issue two

  • ...

merged by Joseph Wright Feb 14 '13 at 8:28

This question was merged with How to refer to number of items in a list before the list appears in the .tex file? because it is an exact duplicate of that question.

Browse other questions tagged or ask your own question.