Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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$.   
\end{proof}
\end{exercise}

For exercise 6 of Axioms and Operations:

\begin{exercise} 
\begin{enumerate}
\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?
\end{enumerate}
\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\}$. 
\end{proof}
\end{exercise}

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$.
\end{proof}
\end{exercise}

My preamble is:

\documentclass[11pt]{article}
\input{other/packages.tex}
\input{other/theoremdef.tex}

where packages.tex is

\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amscd}
\usepackage{url}
\usepackage[top=1.3in, bottom=1.3in, left=1.3in, right=1.3in]{geometry}

% header and footer
\pagestyle{headings}

\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{stackrel}
\usepackage{mathrsfs}
\usepackage{verbatim}
\usepackage{enumerate}
\usepackage{hyperref}
\usepackage{xy}
\input xy
\xyoption{all}

and theoremdef.tex is

\newtheorem{exercise}{\bf Exercise}
share|improve this question
    
To give a good answer, what is needed here is a minimal working example of the code you are using. –  Joseph Wright Dec 21 '10 at 22:01
    
Ok, I will add that right away. Thank you. –  yunone Dec 21 '10 at 22:02
    
@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 Dec 21 '10 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 Dec 21 '10 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 Dec 21 '10 at 22:33

1 Answer 1

up vote 3 down vote accepted

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:

\numberwithin{exercise}{section}
share|improve this answer
    
Thanks Stefan, that was quite a nice solution. –  yunone Dec 22 '10 at 9:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.