Multiple Labels to a Single Definition or Theorem.

In summary: I supposed to do?Well, you could go back to the beginning of the document and change the label to \label{Closed Set}.Suppose on the first page of a document I write:\begin{definition}\label{Open And Closed Set}An open set is blah blah. A closed set is the complement of an open set.\end{definition}Now suppose I am, say, on the 56th page and I need to invoke the concept of a closed set and want to tell the reader too see Definition ref{wait.. what was the label?}.You could go back to the beginning of the document and change the label to \
  • #1
caffeinemachine
Gold Member
MHB
816
15
Suppose I define closed sets and open sets in a single definition environment. Now I want to put two labels in the environment. \label{Open Set} and \label{Closed Set}.

I have tried this and this doesn't cause any trouble and doesn't give any warning.

But are there any hidden pitfalls in doing this? Is there a better method?
 
Physics news on Phys.org
  • #2
I think you might have problems. You can't do this with the equation environment, for example. It throws away the first label. I would label like this:

\label{Open and Closed Sets}

How are you defining your definition environment?
 
  • #3
Ackbach said:
I think you might have problems. You can't do this with the equation environment, for example. It throws away the first label. I would label like this:

\label{Open and Closed Sets}

How are you defining your definition environment?
I have used the amsthm package for the definition environment.

In the preamble I have written \newtheorem{definition}{Definition}[section]

Then wherever I need to define something I just write

\begin{definition}
stuff
\end{definition}
____

I think labeling it as \label{Open and closed sets} is not a viable option.
I have a definition environment where I have deifned injective, surjective, bijective functions. In the same environment I have defied image, preimage etc.

It is always a good idea to define closely related concepts in a single environment.

Multiple labels would make like so much better.
 
  • #4
Hmm. Well, it seems to work. I tried a simple \newtheorem{theorem}{Theorem}, and slapped two labels on it. Then I used both labels later, and they both referenced correctly.
 
  • #5
Another possibility is to create nested definition environments. You could create a subdefinition environment that takes its numbering within the standard definition environment. They would work similarly to sections and subsections. You'd have to experiment with the environment definition (I don't know the exact syntax to make it work off the top of my head).
 
  • #6
Ackbach said:
Hmm. Well, it seems to work. I tried a simple \newtheorem{theorem}{Theorem}, and slapped two labels on it. Then I used both labels later, and they both referenced correctly.
Works on my system too. Hope it is not dangerous.
 
  • #7
I don't see any harm from multiple labels. The \label command writes to the .aux file a line of the following form.

\newlabel{eq:pythagoras}{{4}{1}}

Here the first number is the value of the counter that was incremented last using \refstepounter (in the case of the equation environment, the counter called "equation"), and the second number is the current page number. I don't see any difference between the lines in the .aux file from the two \label commands inside the equation environment. When the .aux file is read before processing the .tex file, the information about the labels is read and later used when a \ref command is encountered.

Ackbach said:
I would label like this:

\label{Open and Closed Sets}
The main drawback from this that I see is the need to change the labels if the author decides to split the definition into two.

I am not sure if the situation changes by packages that deal with references (such as hyperref).
 
  • #8
Evgeny.Makarov said:
I don't see any harm from multiple labels. The \label command writes to the .aux file a line of the following form.

\newlabel{eq:pythagoras}{{4}{1}}

Here the first number is the value of the counter that was incremented last using \refstepounter (in the case of the equation environment, the counter called "equation"), and the second number is the current page number. I don't see any difference between the lines in the .aux file from the two \label commands inside the equation environment. When the .aux file is read before processing the .tex file, the information about the labels is read and later used when a \ref command is encountered.

Danks. I feel much safer now. :)
 
  • #9
Evgeny.Makarov said:
The main drawback from this that I see is the need to change the labels if the author decides to split the definition into two.

True, although that's nothing a good text editor can't chew through fairly quickly.
 
  • #10
caffeinemachine said:
Suppose I define closed sets and open sets in a single definition environment. Now I want to put two labels in the environment. \label{Open Set} and \label{Closed Set}.

I have tried this and this doesn't cause any trouble and doesn't give any warning.

But are there any hidden pitfalls in doing this? Is there a better method?
I don't understand what you want to achieve. Can you post some example code and describe the output you would like?
 
  • #11
dwsmith said:
I don't understand what you want to achieve. Can you post some example code and describe the output you would like?
Okay.

Suppose on the first page of a document I write:

\begin{definition}
\label{Open And Closed Set}
An open set is blah blah. A closed set is the complement of an open set.
\end{definition}

Now suppose I am, say, on the 56th page and I need to invoke the concept of a closed set and want to tell the reader too see Definition ref{wait.. what was the label?}.
I know that I have defined it somewhere. May be in a same environment with some other concept also defined there. May be not. What could be the label I had used there? Going back and checking the label would be such a waste of time. So what I'd prefer doing is:

\begin{definition}
\label{Open Set}
\label{Closed Set}
An open set is blah blah. A closed set is the complement of an open set.
\end{definition}

Now I don't need to burden my head with what is the label I have used in the environment I have defined a closed set.
I know my habit is to label a definition environment once for each concept defined in it. So when I invoke the concept of a closed set, and want to make the reader's life easier, I simply write ref{Closed Set}.

Obviously the concept of a closed set is known to everybody and thus wouldn't need this kind of treatment. But some more involved and lesser known concepts demand this.
 
  • #12
caffeinemachine said:
What could be the label I had used there? Going back and checking the label would be such a waste of time.
Your approach may work for definitions, but it's hard to avoid giving hard-to-remember labels to other things, such as equations, theorems and items. A good text editor should facilitate recalling labels. I am using Ref mode in Emacs, which gives you a menu with recent labels, so you don't have to actually go to another part of the document.
 
  • #13
Use AUCTeX with RefTeX and your problem will be solve. When you are using those two with whatever compiler you like, you simply hit control+c and then ). This bings up
http://img543.imageshack.us/img543/7210/4qez.png

Then I have the option of carriage return for ref, p for page ref, a autoref, and u autopageref. Now suppose I hit return then I get a list of all my references by section or chapter. This is a practice quiz that has only one reference so it isn't going to look too special.
http://img600.imageshack.us/img600/4972/vuha.png

n and p let me jump to the next or previous sections list of references. I can navigate through 1000s of references across many pages in seconds. Then I simply highlight the one I want and hit enter. I can even select multiple ones and hit enter to add them all.

To make life even easier, use cleveref when references. Then you don't have to do label{eq:name} or label{fig:name}, you just do label{name}, and when you reference, you will do \cref{name}. Cleveref can determine if it is a figure, equation, definition, theorem, lemma, or anything else.
 

FAQ: Multiple Labels to a Single Definition or Theorem.

1. What is meant by "multiple labels to a single definition or theorem?"

Multiple labels to a single definition or theorem refers to the practice of assigning more than one label or name to a particular mathematical concept or statement. This can be done for clarity, convenience, or to make connections between related ideas.

2. Why would someone assign multiple labels to a single definition or theorem?

Assigning multiple labels to a single definition or theorem can help make the concept or statement easier to understand and remember. It can also help to make connections between related ideas or provide different perspectives on the same concept.

3. How is multiple labeling different from defining a concept or theorem in multiple ways?

Multiple labeling refers to assigning multiple names or labels to a single concept or theorem, while defining a concept or theorem in multiple ways refers to providing different descriptions or explanations for the same concept or theorem. Multiple labeling is more about naming conventions, while defining in multiple ways is about providing alternative ways of understanding the concept or theorem.

4. Are there any disadvantages to using multiple labels for a single definition or theorem?

One potential disadvantage of using multiple labels is that it may lead to confusion, especially if the labels are not consistent or clearly defined. It may also make it more difficult to search for information on a particular concept or theorem if there are multiple names for it.

5. Can multiple labels be applied to any mathematical concept or theorem?

Yes, multiple labels can be applied to any mathematical concept or theorem. However, it is important to use them judiciously and ensure that they are consistent and clearly defined to avoid confusion.

Back
Top