0

In my report, I would like to add a table and be able to refer to it in my text.

I did the following:

\begin{table}[ht]
    \centering
    \begin{tabular}{c | c | c }
        \hline
        Training Data Duration [s] & Maximum SIR [dB] & Maximum SDR [dB] \\ \hhline{|=|=|=|}
        15 & 14.4353 & \textcolor[rgb]{1,0,0}{8.7172}\\ \hline
        25 & 14.4015 & 8.7312 \\ \hline 
        35 & \textcolor[rgb]{1,0,0}{14.2806} & 8.8179 \\ \hline
        45 & 14.4674 & 9.3875 \\ \hline
        55 & 14.3881 & 9.2663 \\ \hline
        65 & 14.3003 & 9.3346 \\ \hline
        75 & \textcolor[rgb]{0,0.58,0}{14.6173} & \textcolor[rgb]{0,0.58,0}{9.4663} \\ \hline
        85 & 14.5579 & 9.1584 \\ \hline
        \hline
    \label{tab:maxsirsdr}
    \caption{Maximum SIR/SDR values for different training data durations.}
    \end{tabular}
\end{table}

I use TeXnicCenter and the LaTeX -> PS -> PDF mode with TeXLive. Without the table environment, I get the PDF in a couple of seconds. Now it does not compile at all.

What can I do? If you need more info, please ask me! And I'm sorry for abusing LaTeX terminology, my LaTeX knowledge is very basic.

CarLaTeX
  • 62,716
  • Welcome to [tex.se]! What is written in the .log file? Incidentally note the \label command should be after \caption – Andrew Swann May 10 '17 at 09:30
  • Philipp's suggestion did the trick, the problem was that I've put my label and my caption into the tabular environment – Dmitrii C. May 10 '17 at 09:38

1 Answers1

1

You have to put the label and caption after the tabular environment.

\end{tabular}
\caption{Maximum SIR/SDR values for different training data durations.\label{tab:maxsirsdr}}

To be sure also put the label inside the caption so the counter which the label refers to is really the one of the caption and not something else.

Edit: Bernard has a good point in the comments about the location of captions. It is actually preferred to have the caption above the table and not below. For an explanation you can see this answer.

Philipp
  • 5,078
  • 10
  • 30
  • 32