I'm using minipage to keep 2 figures side by side. My problem now is, when trying to reference to those figures, only referencing the first one works. The second one will give me a ?? in the output instead.

+EDIT: for some reason running the example code I noticed that neither reference is working. In my original document the first one is working, the second one isn't. The code is exactly the same... I'm super-confused hah.

\usepackage {caption}
\usepackage {hyperref}


\begin{figure} [hbt!]
\begin {minipage}{0.45\textwidth}
    \includegraphics [width=0.8\textwidth]{0a1} 
    \caption{Der Aufschluss}
    \label {fig:0a1}
\begin {minipage}{0.45\textwidth}
    \includegraphics [width=0.9\textwidth]{1a1} 
    \label {fig:1a1}

Referencing figure \ref{0a1} works but referencing figure \ref{1a1} gives me ?? in the output.


  • 1
    In your example, the labels are fig:0a1 and fig:1a1, but you try to add references using 0a1 and 1a1. If I replace \ref{0a1} with \ref{fig:0a1} and \ref{1a1} with \ref{fig:1a1}, both references appear correctly on the output.
    – Vincent
    Commented Nov 16, 2020 at 17:48
  • ouch. Beginner mistake... Thanks! Commented Nov 16, 2020 at 17:49
  • 1
    In your MWE you use labels like \label{fig:0a1} but you use \ref{0a1}, which of course does not exist. You have to \label{lab}` and \ref{lab} not \ref{somethingelse}. Commented Nov 16, 2020 at 17:51
  • Off-topic: package hyperref had to be, with rare exceptions as cleveref, loaded last in preamble.
    – Zarko
    Commented Nov 16, 2020 at 17:54


You must log in to answer this question.

Browse other questions tagged .