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 would like to know how to give theorem type environments names and then how to later reference them using those names.

I was able to use this thread to create named theorems. However, this seems more complicated than it needs to be and I can't figure out how to reference things by their names later in the paper.

In particular, I want to do the following. I want to list the assumptions that I'm using at the beginning of my paper. However, instead of giving boring, uninformative names like Assumption 1, I want to give them names that will help the reader remember what the assumption is later in the paper. For instance, an assumption about continuity could be named "Assumption C" while an assumption about integrability could be named "Assumption I." Then later in the paper I'd like to refer to Assumption C by a \ref{} command.

share|improve this question

2 Answers 2

The cleveref package can be helpful here:

\documentclass{article}
\usepackage{amsthm}
\usepackage{cleveref}

\theoremstyle{definition}
\newtheorem{assump}{Assumption}
\newenvironment{myassump}[2][]
  {\renewcommand\theassump{#2}\begin{assump}[#1]}
  {\end{assump}}
\begin{document}

\begin{myassump}{C}
\label{ass:c}
test
\end{myassump}
\begin{myassump}{I}
\label{ass:i}
test
\end{myassump}
Cross-references to~\cref{ass:c} and~\cref{ass:i}

\end{document}

enter image description here

Since there's no information about how the actual structures for assumptions are built, I used some simple theorem-like structures with the help of amsthm; the myassump environment has as mandatory argument the string that will be used to name the assumption.

share|improve this answer
    
This answer mostly worked for me. Actually, the key was the way that you defined the named assumption environment. Actually, when I copied and pasted your tex into my editor and compiled, I got errors from the '/cref' commands. However, when I changed them into standard '/ref' commands instead, everything worked how I wanted it to. –  jonpeterson43 Mar 12 '13 at 15:53
    
@jonpeterson43 what kind of errors did you get with \cref? If you want, please add the exact error message so we can find detect the problem and correct it. –  Gonzalo Medina Mar 12 '13 at 15:54
    
I got three error messages. The first two read 'LaTeX Warning: \Cref reference format for label type `assump' undefined on input line 20.' The last warning was just 'LaTeX Warning: There were undefined references.' –  jonpeterson43 Mar 12 '13 at 16:12
    
@jonpeterson43 hmmm... that's strange. Did you get those warnings (they are not errors) with the code I posted exactly as it is? I ask you because my code will produce no warnings nor errors using an updated LaTeX installation. Is your LaTeX system updated? –  Gonzalo Medina Mar 12 '13 at 16:54
    
I'm using texlive on a computer running an Ubuntu operating system. I think I installed the texlive distribution about 1.5 years ago, so it's pretty recent. I don't know if it gets automatically updated by the update manager or not. –  jonpeterson43 Mar 12 '13 at 17:17

The \ref command requires a label. So you would have something like

\begin{namedtheorem}{My theorem}
 \label{thm:myThm}
 This is a simple named theorem.
\end{namedtheorem}
share|improve this answer
    
Of course, I tried labelling the theorem (assumption actually), but when I called the reference later using the '\ref' command it printed a "1" instead of a "C." That is, even though LaTeX isn't using the numbers for labelling the Assumptions when they are created, it is using the numbering for references later. –  jonpeterson43 Mar 12 '13 at 15:20
    
Actually, a little more investigation reveals that numbering that LaTeX is giving the assumptions when I reference them is just the section number that the theorem came from. If there are no sections defined, then the '\ref' command just gives a blank space. –  jonpeterson43 Mar 12 '13 at 15:32

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.