I'm currently trying to write up some solutions to a set theory text, but some of my labels don't seem to be working correctly. I've uploaded it here, if it's perhaps helpful to look at.

Anyway, I have two sections so far, Introduction and Axioms and Operations. In Axioms and Operations after the third exercise, I have \label{exer3}. Later in exercise 6, I reference it twice with \ref{exer3}, however, the hyperlink instead links one back to exercise 3 of the Introduction section, not exercise 3 of the Axioms and Operations section. The label of exercise 3 in the Introduction section is \label{pwrsetex}.

I've also noticed that I have several warnings when building, saying

pdfTeX warning (ext1): destination with the same identifier (name{exercise.1}) has already been used, duplicate ignored.

I have one of these for (ext1) through (ext5).

Not sure if it's pertinent, but at the beginning of the section Axioms and Operations, I reset the Exercise counter with \setcounter{exercise}{0}.

Could someone please show me what I'm doing wrong here? Thanks! I can include the actual code, if that makes my question any more clear.

This is the code for exercise 3 of Axioms and Operations:

\begin{exercise}\label{exer3} Show that every member of a set $A$ is a subset of $\bigcup A$. 
\begin{proof}[\bf Solution.] If $A=\emptyset$, then the statement is vacuously true. So suppose $A$ is nonempty, and take some $b\in A$. Again, if $b$ is empty, then the statement holds. So suppose $b$ is nonempty. Then for any $t\in b$, $t\in\bigcup A$ by the Union Axiom. In other words, 
\forall t(t\in b\Rightarrow t\in\bigcup A).
This is precisely the definition that $b\subseteq\bigcup A$.   

For exercise 6 of Axioms and Operations:

\item Show that for any set $A$, $\bigcup\mathscr{P}A=A$. 
\item Show that $A\subseteq\mathscr{P}\bigcup A$. Under what conditions does equality hold?
\begin{proof}[\bf Solution.] For $(a)$, take $x\in\bigcup\mathscr{P}A$. So there exists some $b\in\mathscr{P}A$ such that $x\in b$. Since $b\in\mathscr{P}A$, $b\subseteq A$, and thus $x\in A$. Also, since $A\subseteq A$, by definition of the power set, $A\in\mathscr{P}A$. Then by Exercise \ref{exer3}, it follows that $A\subseteq\bigcup\mathscr{P}A$.
For $(b)$, take $x\in A$. Again by Exercise \ref{exer3}, $x\subseteq\bigcup A$, so by definition of the power set, $x\in\mathscr{P}\bigcup A$. Equality holds when $A$ has form $\{\emptyset\}$ or $\{a,\emptyset\}$. If $A=\{\emptyset\}$, then $\bigcup A=\emptyset$, and so $\mathscr{P}\bigcup A=\{\emptyset\}$. 

For exercise 3 of the Introduction:

\begin{exercise}\label{pwrsetex} Show that if $B\subseteq C$, then $\mathscr{P}B\subseteq\mathscr{P}C$.
\begin{proof}[\bf Solution.] Suppose $A\in\mathscr{P}B$. Then $A\subseteq B$, and thus $A\subseteq C$, as containment is transitive. Hence $A\in\mathscr{P}C$.

My preamble is:


where packages.tex is

\usepackage[top=1.3in, bottom=1.3in, left=1.3in, right=1.3in]{geometry}

% header and footer

\input xy

and theoremdef.tex is

\newtheorem{exercise}{\bf Exercise}
  • To give a good answer, what is needed here is a minimal working example of the code you are using.
    – Joseph Wright
    Commented Dec 21, 2010 at 22:01
  • @yunone: What is your definition of the exercise environment? Is it a theorem environment? If yes, which theorem package is used? Your document preamble might add helpful information to the question.
    – Stefan Kottwitz
    Commented Dec 21, 2010 at 22:22
  • @Stefan, thanks, I will add that in as well. Also, do you mind if I ask how you edited my previously quoted sections to give it that gray background and better format?
    – yunone
    Commented Dec 21, 2010 at 22:25
  • @yunone four spaces before each line adds it to a code block. Or you can select the text and click the "10101" button.
    – Seamus
    Commented Dec 21, 2010 at 22:33

1 Answer 1


I recommend to number the exercises per section. Instead of having to times Exercise 1 in different sections, I would number them Exercise 1.1 and Exercise 2.1. This is clearer and solves the problem of referencing.

This can be done easily by:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .