I am writing a paper using the optics letters template below:
http://www.photonics.umd.edu/umd/index.html
In it, I am citing several figures that appear within the paper, like this
\begin{figure}
...
\label{fig}
\end{figure}
Later on I cite the figure using \ref{fig}.
In the text, the citation does not appear as "figure 1", but instead appears as "1" bounded by a red box. I have been trying to correct this by searching the .sty files my document is using, but I cannot identify the cause. Does anyone know why LaTex is doing this, or how to fix it?
Thanks for the help.
General ⇒ Problem with citing figures, citations are displayed incorre
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Problem with citing figures, citations are displayed incorre
You always have to use a caption to create an anchor for reference.Phanixis wrote:[…] Does anyone know why LaTex is doing this, or how to fix it? […]
Code: Select all
\begin{figure}[!ht]
\rule{4cm{3cm}
\caption{Dummy figure}\label{fig:dummy}
\end{figure}
Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Problem with citing figures, citations are displayed incorre
I didn't show it in my example, but my caption does appear before my label statement. I double checked this an it is definitely not the cause of my problem.
Also, the problem isn't that LaTex is unable to find the correct figure, its that it is not displaying the caption properly. I almost suspect that somewhere in one of the packages /ref has been redefined to bound the citation number by boxes instead of writting the word "figure" in front of the citation number.
Also, the problem isn't that LaTex is unable to find the correct figure, its that it is not displaying the caption properly. I almost suspect that somewhere in one of the packages /ref has been redefined to bound the citation number by boxes instead of writting the word "figure" in front of the citation number.