Graphics, Figures & Tables\ref to figure problem

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
kobinissim
Posts: 3
Joined: Mon Sep 06, 2010 2:24 pm

\ref to figure problem

Post by kobinissim »

Hi
When Im using the command \numberwithin{figure}{chapter}
everything is O.K, I get for example FIGURE 3.1
BUT when Im trying to use \ref to the figure I get only FIG. 3
Is anybody can help me?
Thanks

Recommended reading 2024:

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

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

\ref to figure problem

Post by frabjous »

We're going to need to see a minimal working example per the Board Rules; see also the Post on Avoidable Mistakes.
kobinissim
Posts: 3
Joined: Mon Sep 06, 2010 2:24 pm

Re: \ref to figure problem

Post by kobinissim »

Hi
Here is the code I used for the figure:

\begin{center}
\begin{figure}[h]
\begin{picture}(130,220)
\put(-125,-180){\includegraphics[scale=0.65]{PS_3d.pdf}}
\end{picture}
\put(-240,-80){\caption{Pseudospectra of Orr-Sommerfeld operator}}
\label{PS2}
\put(-30,-40){Real$\;\;\lambda$}
\put(-180,10){Imag$\;\;\lambda$}
\put(-240,140){$||(zI-A)^{-1}||_2$}
\end{figure}
\end{center}

%%%%%%%%%%%%%%%%%%%%%%%%

Now, I used The \numberwithin command and the caption of the figure was :
FIGURE 3.1. Pseudospectra of Orr-Sommerfeld operator

When I do Fig.(\ref{PS2}) The result is --> Fig.(3)
There is a problem with the \ref
If somebody know what to do with this problem
please tell me
Thanks
kobi
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

\ref to figure problem

Post by localghost »

I strongly recommend to read the topics frabjous referred to. Do that very careful and follow the instructions unexceptionally (especially regarding the tagging of code in posts, building a minimal example, …). This is in your own interest if you expect instant help.


Best regards and welcome to the board
Thorsten
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

\ref to figure problem

Post by sommerfee »

kobinissim wrote:\begin{center}
\begin{figure}[h]
Since figure is a floating environment, it will "float" out of the center environment, so it does not make sense putting a figure environment inside a center environment.
\put(-240,-80){\caption{Pseudospectra of Orr-Sommerfeld operator}}
\label{PS2}
The \label should be on the same level as \caption, so you should write either

Code: Select all

\put(-240,-80){\caption{Pseudospectra of Orr-Sommerfeld operator}\label{PS2}}
or

Code: Select all

\put(-240,-80){\caption{Pseudospectra of Orr-Sommerfeld operator\label{PS2}}}
HTH,
Axel

P.S.: Please read http://www.minimalbeispiel.de/mini-en.html
kobinissim
Posts: 3
Joined: Mon Sep 06, 2010 2:24 pm

Re: \ref to figure problem

Post by kobinissim »

Hi sommerfee
Thanks a lot
The problem is solved
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

\ref to figure problem

Post by localghost »

Now that the problem is solved, please be so kind and mark the topic accordingly as clearly written in Section 3 of the Board Rules (to be read before posting).


Best regards and welcome to the board
Thorsten
Post Reply