0

this is my simplified code:

Text ... \ref{table:x} and \ref{table:y}.

\begin{table}[!h]
\begin{tabular}{lcc} 
    \toprule
    AAA & BBB & CCC\\
    \midrule
    DDD & \( 1 \) & \( A \) \\
    EEE & \( 2 \) & \( B \) \\
    FFF & \( 3 \) & \( C \) \\
    HHH & \( 4 \) & \( D \) \\
    \bottomrule
\end{tabular}
\label{table:x}
\caption{something about table x}
\end{table}

\begin{table}[!h]
\begin{tabular}{lcc} 
    \toprule
    AAA & BBB & CCC\\
    \midrule
    DDD & \( 1 \) & \( A \) \\
    EEE & \( 2 \) & \( B \) \\
    FFF & \( 3 \) & \( C \) \\
    HHH & \( 4 \) & \( D \) \\
    \bottomrule
\end{tabular}
\label{table:y}
\caption{something about table y}
\end{table}   

My problem is related to the fact that when i compile on my .pdf i get this as result:

Text...?? and ??.

How can i solve this? It seems like \ref is not working. I think that i am doing something wrong with \label but i can't understand what. Thank you for your help

it8
  • 1,210
  • Hi, welcome. The \label always has to be placed after (or within) the \caption. Edit: see https://tex.stackexchange.com/questions/32325/why-does-an-environments-label-have-to-appear-after-the-caption – Torbjørn T. Apr 27 '17 at 12:25
  • Place the \label inside the \caption tag, e.g., \caption{something about table y\label{table:y}} – MadyYuvi Apr 27 '17 at 12:30
  • Thank you for the answer, i solved the problem with your help. And i am sorry if this question was a duplicate of an existing one. – it8 Apr 27 '17 at 12:30

0 Answers0