1

I've places two tables side by side, but I can't get the labels right.

\begin{table}[ht]
\begin{minipage}[b]{0.45\linewidth}\centering
\begin{tabular} {l | l | l}
        a & a & a
        \end{tabular}
        \label{tab:NotreDame}
        \caption{Training on Yosemite dataset and testing on Notre-Dame dataset}
        \end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.45\linewidth}
\centering
    \begin{tabular} {l | l | l}
        b & b & b
        \end{tabular}
        \label{tab:Liberty}
        \caption{Training on Yosemite dataset and testing on Liberty dataset}
\end{minipage}
\end{table}

When I compile my code, I get question marks instead of correct references.

ChrisS
  • 13,529
GilLevi
  • 135

1 Answers1

1

In addition to put the label after the caption, it will do if the label is put inside the caption.

enter image description here

Code:

\documentclass{article}
\usepackage[demo]{graphicx} % for inclusion of graphics

\begin{document}

\begin{table}[ht]
\begin{minipage}[b]{0.45\linewidth}
\centering
\begin{tabular} {l | l | l}
        a & a & a
        \end{tabular}
        \caption{Training on Yosemite dataset and testing on Notre-Dame dataset}
       \label{tab:NotreDame}
        \end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.45\linewidth}
\centering
    \begin{tabular} {l | l | l}
        b & b & b
        \end{tabular}
        \caption{Training on Yosemite dataset and testing on Liberty dataset \label{tab:Liberty} }
\end{minipage}
\end{table}

This is Table \ref{tab:NotreDame} and Table \ref{tab:Liberty}

\end{document}
Jesse
  • 29,686