4

I'm writing a paper to submit a conference.

However, I am having some problems fixing non-resolved references in latex.

\begin{figure*}[ht!]

\begin{subfigure}[b]{0.3\linewidth}

    \includegraphics[width=1\linewidth]{fig/toy}

    \vspace*{-1cm} % for cosmetic change

    \label{fig:toynetwork_example}

    \caption{A toy network}

\end{subfigure}%

\begin{subfigure}[b]{0.3\linewidth}

    \includegraphics[width=1\linewidth]{fig/exampleProcedure13}

    \vspace*{-1cm} % for cosmetic change

    \label{fig:firstIterationFin}

    \caption{After first iteration}

\end{subfigure}

\begin{subfigure}[b]{0.3\linewidth}

    \includegraphics[width=1\linewidth]{fig/proposed_adjacency_matrix}

    \vspace*{-0.4cm} % for cosmetic change

    \label{fig:proposed_adjacency_matrix}

    \caption{Adjacency matrix}

\end{subfigure}%

\begin{subfigure}[b]{0.3\linewidth}

    \includegraphics[width=1\linewidth]{fig/proposed_influence_matrix}

    \vspace*{-0.4cm} % for cosmetic change

    \label{fig:proposed_influence_matrix}

    \caption{Influence matrix}

\end{subfigure}%

    \hspace*{0.2cm}

\vspace*{0.3cm} % for cosmetic change

\begin{subfigure}[b]{0.3\linewidth}

    \includegraphics[width=1\linewidth]{fig/proposed_update_order}

    \vspace*{-0.4cm} % for cosmetic change

    \label{fig:proposed_update_order}

    \caption{Update order}

\end{subfigure}%

\caption{Example network}

\label{fig:example_network_procedure}

\end{figure*}

The PDF file shows ?? rather than the reference.

Can you help me?

enter image description here

2
  • 1
    What is the reference that you are missing? Or is all of them? In addition, try placing the label command just after the includegraphics command.
    – arodrisa
    Commented Jul 21, 2015 at 6:08
  • 1
    Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question.
    – Werner
    Commented Jul 22, 2015 at 0:24

1 Answer 1

8

The \label must go after or inside the \caption command. It cannot be placed before. This is because \caption increments the relevant counter, which is what \label hooks onto. If you put the \label first, there is nothing onto which it might hook.

For example, turning your code into a (semi-)Minimal Working Example by adding a preamble and substituting standard images:

labelled subfigures

Code:

\documentclass{article}
\usepackage{graphicx,subcaption}

\begin{document}

\ref{fig:example_network_procedure}
\ref{fig:firstIterationFin}
\ref{fig:proposed_adjacency_matrix}
\ref{fig:proposed_influence_matrix}
\ref{fig:proposed_update_order}
\ref{fig:toynetwork_example}

\begin{figure*}[ht!]
  \begin{subfigure}[t]{0.3\linewidth}
    \includegraphics[width=1\linewidth]{example-image-a}

    \caption{A toy network\label{fig:toynetwork_example}}
  \end{subfigure}
  \begin{subfigure}[t]{0.3\linewidth}
    \includegraphics[width=1\linewidth]{example-image-a}

    \caption{After first iteration}\label{fig:firstIterationFin}
  \end{subfigure}
  \begin{subfigure}[t]{0.3\linewidth}
    \includegraphics[width=1\linewidth]{example-image-a}

    \caption{Adjacency matrix}\label{fig:proposed_adjacency_matrix}
  \end{subfigure}

  \begin{subfigure}[t]{0.3\linewidth}
    \includegraphics[width=1\linewidth]{example-image-a}

    \caption{Influence matrix\label{fig:proposed_influence_matrix}}
  \end{subfigure}
  \begin{subfigure}[t]{0.3\linewidth}
    \includegraphics[width=1\linewidth]{example-image-a}

    \caption{Update order}\label{fig:proposed_update_order}
  \end{subfigure}

  \caption{Example network}
  \label{fig:example_network_procedure}
\end{figure*}

\end{document}
0

Not the answer you're looking for? Browse other questions tagged .