2

I'm trying to reference a basic table in my Latex and it doesn't work. I have another table in my document which is referenced the same way and the other table reference is working. The label is in the caption itself and I compiled more than twice and I still get the warning that the reference is undefined (it doesn't print any number but ??).

I'm trying to reference the table in the paragraph before it (via \ref{caption}), but it doesn't change anything if I put the table before the paragraph. I have to say it was working before I made some changes to the content but I don't have any other warning except this one and the table prints perfectly. Here is the code:

\documentclass[conference,onecolumn]{IEEEtran}
\usepackage[table,xcdraw]{xcolor}
\begin{document}
Blah blah \ref{caption}.
\begin{table*}[H]
\centering
\caption{My caption \label{caption}}
\begin{tabular}{|c|c|c|}
\hline
 column 1 & column 2 & column 3 \\ \hline
\end{tabular}
\end{table*}
\end{document}

Does anyone of you have a clue of what happened? I also tried to delete and regenerate the Aux file but it didn't work. And when I put the label somewhere else (referencing the section for example) it works perfectly.

EDIT: It seems that the reason is the '*' I put after table. When I remove it, it works. Can someone explain me why ? Thank you in advance

  • Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Fran Aug 1 '16 at 3:38
  • A reference tends to be of the form "Table X.Y". What should X and Y be for a starred (unnumbered) table? – Mike Renfro Aug 1 '16 at 3:41
  • I thought the use of '*' would be for centralizing the table in one column (like we do for figures, it is not the same, is it?). It's true it's not the case right now (my document is one column), but I always star my figures because I know I will soon change the format to double columns. – criardialo Aug 1 '16 at 4:06
  • @MikeRenfro Starred tables (and figures) aren't usually unnumbered, they span two columns as the OP says above. – Torbjørn T. Aug 1 '16 at 6:58
  • 1
    At the time I commented, there was no document class. I should have waited on one. – Mike Renfro Aug 1 '16 at 11:57
0

Changing [H] to [h] addresses the problem.

\documentclass[conference,onecolumn]{IEEEtran}
\usepackage[table,xcdraw]{xcolor}

\begin{document}
Blah blah \ref{caption}.
\begin{table*}[h]
\centering
\caption{My caption \label{caption}}
\begin{tabular}{|c|c|c|}
\hline
 column 1 & column 2 & column 3 \\ \hline
\end{tabular}
\end{table*}
\end{document}

enter image description here

  • 1
    Yes, it works thank you (but I have to change 'h' to 'ht' as requested by warning) ! Can you explain me why I can't use [H] in this case ? – criardialo Aug 1 '16 at 22:20
  • I'm not familiar with the document class. I think that the H option doesn't work in the standard document class unless a package like float is loaded. Usually, starred environments moreover suggest the absence of a (table) number. – JPi Aug 2 '16 at 0:57
  • Oh yes sorry, I forgot to mention I also have the package float installed. Okay never mind, thank you for your answer ! – criardialo Aug 3 '16 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.