General ⇒ Label and reference issue
Label and reference issue
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
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
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Label and reference issue
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.