Hello fellow latex users.
I have a problem regarding the cross referencing of my images. I want to include the section number. Say for instance I write \label{fig:image} AFTER the \caption tag in a inserted image. I reference it and get the number of my figure to 4. But if I want to include the section number aswell eg instead of just figure 4, I want figure 11-4 denoting section 11 figure 4 in that section.
Any ideas?
//Christian
General ⇒ Label and reference issue
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Label and reference issue
If you just want to include a reference to the section number, then
will produce a label such that
If, instead, you want all figure numbers to automatically be numbered N-M, where N is the section number and M is the figure number, try
You'll need the amsmath package.
The default is to separate them by periods. If you want hyphens, you'll have to redefine
This is basically what
Code: Select all
\section{my section header} \label{sec:mysec}
\ref{sec:mysec}
will return its number.If, instead, you want all figure numbers to automatically be numbered N-M, where N is the section number and M is the figure number, try
Code: Select all
\numberwithin{figure}{section}
The default is to separate them by periods. If you want hyphens, you'll have to redefine
\thefigure
, like so:
Code: Select all
\renewcommand{\thefigure}{\thesection-\arabic{figure}
\numberwithin
does anyway.