General ⇒ Issue with \label and \ref
Issue with \label and \ref
In my dissertation, I have to explain about lot of different cases. I want to give all a unique number and refer to them while discussing about these cases using figures or tables.
Now is there any way to label details of the cases in the beginning using \label command and then refer to them later where ever i want using \ref command. I want to do this, so that if I want to change the "case number" later on, I can do it without changing it everywhere manually.
Please suggest a way out.
Thanks and Regards,
Atul
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Issue with \label and \ref
the basic procedure is always as follows: You create a new counter, say case, and increase this for every case via the \refstepcase command. Then you can use \label and \ref as with any other sectioning command. Here is a small example:
Code: Select all
\documentclass{article}
\newcounter{case}
\newcommand*\case{%
\refstepcounter{case}%
Case \arabic{case}: %
}
\begin{document}
\section{ABC}
\case foo
\label{mycase1}
\case bar
\label{mycase2}
\section{DEF}
As discussed in case \ref{mycase2}\ldots
\end{document}
Re: Issue with \label and \ref
Regards,
Atul