Text FormattingRepeating numbered items, keeping the original number

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
letty
Posts: 9
Joined: Fri Jan 01, 2010 5:33 pm

Repeating numbered items, keeping the original number

Post by letty »

Hi,

My query is very similar to an older one, that can be found here

However, the solution suggested doesn't quite work as I need it.

I want to include numbered examples in my work. So far, I've used the Covington package to do this pretty well. It sorts all the numbering out for me, and allows me to refer back to the number of the example. I do things that look like this
(1) This is a numbered example
Some interesting things.
(2) This is another numbered example
More interesting things, comparing (1) and (2).
However, I would like to be able to repeat the numbered example, keeping the original number. Something like this
(1) This is a numbered example

Some interesting things.

(2) This is another numbered example

More interesting things, comparing (1) and (2).

Several pages of writing about something else, necessitating me to remind the reader about what (1) was.

(1) This is a numbered example
In particular, I want to be able to keep the way the numbers are all automatically updated, so if I insert another numbered example earlier on, all the numbers are updated - including the in-text references to the example, and the repeated use of the example.

Using the amsmath package allows me to do just this for equations, as described here

However, this only seems to work with in the equation environment. However, the examples that I want to repeat are all English sentences, and I can't reproduce these in the examples environment.

I'm not wedded to using the Covington package, and will happily use anything that allows me to repeat numbered examples, whilst keeping both the example number and the number updating.

Many thanks.

Letty.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Repeating numbered items, keeping the original number

Post by frabjous »

You could use the amsmath code you linked to with regular text by using AMSmath's \text{..} command for putting arbitrary text inside an equation environment.

Code: Select all

\documentclass[leqno,fleqn]{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
   \text{This is a numbered example}
   \label{myexample}
\end{equation}

Some interesting things.

\begin{equation}
	\text{This is another numbered example}
        \label{mynextexample}
\end{equation}

Several pages of writing about something else, necessitating me to remind the reader about what (\ref{myexample}) was.

Remember that
\begin{equation}
    \text{This is a numbered example}
    \tag{\ref{myexample}}
\end{equation}
\end{document} 
But you could probably use enumitem too. I'll post an example with that after I test it.

UPDATE: Well, I thought I could it by combining enumitem with the refcount package, but the refcount package doesn't seem to play nicely with enumitem-generated labels. Thus I get an error if I uncomment the optional argument [start=\getrefnumber{myexample}] to the last example environment here. If anyone knows how to fix this, or a better way, I hope they'll post. Otherwise you're better off using the first way.

Code: Select all

\documentclass{article}

\usepackage{enumitem}
\usepackage{refcount}

\newlist{example}{enumerate}{1}
\setlist[example]{label=(\arabic*),ref=\arabic*,resume}

\begin{document}

\begin{example}
   \item This is a numbered example
   \label{myexample}
\end{example}

Some interesting things.

\begin{example}
	\item This is another numbered example
   \label{mynextexample}
\end{example}

Several pages of writing about something else, necessitating me to remind the reader about what (\ref{myexample}) was.

Remember that

\begin{example}%[start=\getrefnumber{myexample}]
    \item This is a numbered example
\end{example}

\end{document}
Last edited by frabjous on Fri Jan 01, 2010 7:43 pm, edited 1 time in total.
letty
Posts: 9
Joined: Fri Jan 01, 2010 5:33 pm

Repeating numbered items, keeping the original number

Post by letty »

Hi Frabjous - thank you so much for that.

The AMSmath \text{...} solution works perfectly, except when I do a really long sentence as the example, in which case it spills over the edge of the page. Putting in the text below should illustrate the problem (I hope!) e.g.:

Code: Select all

\documentclass[leqno,fleqn]{article}
\usepackage{amsmath}

\begin{document}
  \begin{equation}
    \text{This is a numbered example}
    \label{myexample}
  \end{equation}
  \begin{equation}
    \text{This is deliberately a very long example to see what happens when I type a very long thing. It is therefore an experimental example.}
  \end{equation}
\end{document}
Post Reply