3

I misspoke I meant I used enumerate not cases sorry.

Is it possible to reference a case?

I have \begin{enumerate} and then cases 1 to 4 where each case is a rather detailed.

I would like the refer the reader back to case 2 where the solving a complex integral took place since the only difference in case 2 and 4 is tan and tanh due to the changing of the variable e.

I tried labeling the case but that doesn't work.

A more reasonable example:

\documentclass{article}
\usepackage{amsmath, hyperref}


\begin{document}
\begin{enumerate}
\item[Case 1:]
x
\item[Case 2:]
\label{case2}
xx
\item[Case 4:]
 case~\ref{case2} 

\end{enumerate}

\end{document}

As you can see there is no reference to click after the word case:

enter image description here

  • @DavidCarlisle I have added a very minimal example. – dustin May 16 '13 at 16:22
  • Oh \label works automatically in enumerate It doesn't in cases which was what your original question indicated. – David Carlisle May 16 '13 at 16:29
  • @DavidCarlisle I noticed the error in my question and noted it in the op but the label isn't working when I compile the document it just says case (then a blank) where the reference should be. – dustin May 16 '13 at 16:31
  • @DavidCarlisle see png image. – dustin May 16 '13 at 16:32
  • @DavidCarlisle I ran it 3 times! and then again when that didn't work and then again. – dustin May 16 '13 at 16:34
6

The MWE as posted produces

enter image description here

If you don't get that, check your log file for something strange....

Using the updated MWE you see all (automatic) numbering is suppressed so there is nothing to label You should never number "by hand". Just use a list and customise the display, Here I use enumerate although enumitem is newer with more features.

enter image description here

\documentclass{article}
\usepackage{amsmath, hyperref,enumerate}

\begin{document}
\begin{enumerate}[{Case} 1:]
\item
x
\item
\label{case2}
xx
\item
 case~\ref{case2} 

\end{enumerate}

\end{document}
  • in the log file, I have Package hyperref Warning: Suppressing empty link on input line 1893. and LaTeX Warning: There were multiply-defined labels. – dustin May 16 '13 at 16:43
  • Your MWE only has one \label how can it have multiple anything? Is that really the log from the MWE as posted? It also doesn't load hyperref – David Carlisle May 16 '13 at 16:46
  • that is from the actual document. I found the multiple issue it had nothing to with the current problem. The only warning is the suppressing piece what does that mean? That MWE isn't the real thing I am working on. I just supplied that since you asked. – dustin May 16 '13 at 16:48
  • You are obviously not running your own MWE, since that doesn't load hyperref, doesn't have 1893 lines, has only one label (and the text in the image you have uploaded is different). In your case, the MWE needs to be a minimal non-working example. Long and short of it is that your MWE shows that \label and \ref will work, and there must be some error in your actual document: it's probably a typo in your labels or references. Preparing a MWE which shows the problem will probably reveal it! – Paul Stanley May 16 '13 at 16:49
  • 2
    @dustin No. The idea is that you start from your document and cut it down to a few lines while preserving the fact that it doesn't work. Most likely while doing that you will find out yourself which code is wrong. – David Carlisle May 16 '13 at 16:54
0

I'm not sure where you're at on this, but what you ask can be done. Apologize if I have missed the thrust of your question.

\documentclass{article}

\begin{document}

\begin{enumerate}
\item A \label{a}
\item B \label{b}
\item C \label{c}
\end{enumerate}

Please refer to Items~\ref{b} \& \ref{c}.

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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