Search code examples
referencelatexfigures

Referencing Figures in Latex


I am currently writing my thesis in greek and whenever I try to reference a figure I get the following in my text:

[;;]

This is the code I wrote:

\begin{figure}[h]
\label{ fig:image1}
\includegraphics[width=1\textwidth]{image1}
\caption{Απεικόνιση τρόπου κληρονομικότητας}
\end{figure}

And I call the ref by writing: {\ref{fig:{image1}}.

How do I fix this?


Solution

  • There is a simple rule in latex \caption should always come before \label [1]. So the code you write becomes:

    \begin{figure}[h]
    \includegraphics[width=1\textwidth]{image1}
    \caption{Απεικόνιση τρόπου κληρονομικότητας}
    \label{fig:image1}
    \end{figure}
    

    Also, you were referring to the image incorrectly. and you can refer it using \ref{fig:image1} to get the correct reference.

    This will work well, as the key you use for \label is the key you use for \ref.

    References [1] https://tex.stackexchange.com/questions/32325/why-does-an-environments-label-have-to-appear-after-the-caption