Graphics, Figures & TablesReferencing to figure 1.1 => 1.1.1

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
albinoblacksheep
Posts: 12
Joined: Fri Mar 05, 2010 7:53 pm

Referencing to figure 1.1 => 1.1.1

Post by albinoblacksheep »

Hi!

In subsection 1.1.1 I want to use the \ref command to reference to a figure.
Basically it works fine, the only problem is in the figure's label Latex puts "Figure 1.1.: description" (because its the first figure in Chapter 1, section 1, but inside the text it puts: "see Fig. 1.1.1."

here is the corresponding code of the MWE:

Code: Select all

% !TEX encoding = IsoLatin2  

% LaTeX Template Version 1.0,  October 2008
% by Dr. Andreas Drauschke (andreas.drauschke@technikum-wien.at) and Dr. Susanne Teschl (susanne.teschl@technikum-wien.at)

\documentclass[a4paper,oneside]{scrbook} %add bibtotoc if necessary
% For short papers the documentclass "scrartcl" is sufficient. In this case the highest sectioning structure is "section" ("chapter" does not exist). 
% \documentclass[a4paper,bibtotoc,oneside]{scrartcl}

\usepackage{hyperref}

\usepackage[ansinew]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel} 

\usepackage{amsmath,amssymb,amsfonts,amstext}

\usepackage{fancyhdr}
\usepackage{color}
\usepackage{lscape} %for rotating page 90° : \newpage
											%\begin{landscape}
											%   Some text here
											%\end{landscape}
											%\newpage	

%\usepackage[pdftex]{graphicx}
\usepackage{graphicx} %to make compilation with LaTeX work
\usepackage{array}

\setlength{\textheight}{225mm}

\tolerance = 9999
\sloppy

\setcounter{secnumdepth}{3} %uncomment this to not display all the subsubsections in the
\setcounter{tocdepth}{3}    %table of contents
 
\begin{document}

\setcounter{page}{1}
\chapter{Introduction}
text
\section{test}
text
\subsection{test}
Please see Fig.\ref{FIGage}.
 
\begin{figure}[htbp] \label{FIGage}
\centering
\fbox{\includegraphics[width=120mm]{Figures/AgeCurve.png}}
\caption[Alt text]{description}
\end{figure}

\end{document}
How can I make the caption and the referencing the text the same? I dont care if both are 1.1 or 1.1.1?

Thank you!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Referencing to figure 1.1 => 1.1.1

Post by php1ic »

The label of your figure is in the wrong place, move it to after the caption to make the referencing consistent.

Code: Select all

\begin{figure}[htbp] 
\centering
\fbox{\includegraphics[width=120mm]{Figures/AgeCurve.png}}
\caption[Alt text]{description}
\label{FIGage}
\end{figure}
albinoblacksheep
Posts: 12
Joined: Fri Mar 05, 2010 7:53 pm

Re: Referencing to figure 1.1 => 1.1.1

Post by albinoblacksheep »

Great, thanks a mill!
Post Reply