# Question marks in a reference to a table?

I have this code and when I compile (even several times) some question marks appear on the pdf in the place where the reference should be.

Actually if we perform an Augmented Dickey-Fuller test on the in-sample we refuse the null hypothesis of explosive process with a p-value of 0.8226.
This applies to all the models here presented, AR(1), AR(3) and
ARMA(1,1). Model coefficients can be inspected in Table
\ref{tab:daily_model_coefficients}
\medskip

\begin{figure}[H]
\centering
\caption{Model coefficients of the Daily Component Models\label{tab:daily_model_coefficients}}
\begin{tabular}{c|c|c|c|c|c}
\hline \hline
$Model$ & \phi_{0} & \phi_{1} & \phi_{2} & \phi_{3} & \theta_{1}\\
\hline
AR(1)   & 6.5397    & 0.8988 &- &- & - \\
AR(3) & 6.2932  & 0.7257    & -0.0099   & 0.2162 &- \\
ARMA(1,1) & 6.0340  & 0.9741    & -&    -   & -0.4991 \\
\hline
\end{tabular}
\end{table}


So the point is that when I compile several times I get the following:

Actually if we perform an Augmented Dickey-Fuller test on the in-sample we refuse the null hypothesis of explosive process with a p-value of 0.8226. This applies to all the models here presented, AR(1), AR(3) and ARMA(1,1). Model coefficients can be inspected in Table ??

I am using Sharelatex now. I will appreciate any suggestion

• I have already tried writing the \caption before \label and it doesn't work... – adrian1121 Jun 6 '16 at 21:02
• If you get a tex error you should just look at the log, tex never tries to make sensible typeset output after an error, it just recovers enough to syntax-check the rest of the document. – David Carlisle Jun 6 '16 at 21:07

In order for your references to work properly (on ShareLaTeX), you need to make the document compile without error. You'll note that in your example you started with a figure but ended with a table:

\begin{figure}[H]
% ...
\end{table}


Also, tabular header row contains math content without you inserting math mode properly.

This is what you need:

\documentclass{article}

\begin{document}

Actually if we perform an Augmented Dickey-Fuller test on the in-sample we
refuse the null hypothesis of explosive process with a p-value of 0.8226.
This applies to all the models here presented, AR(1), AR(3) and
ARMA(1,1). Model coefficients can be inspected in Table
\ref{tab:daily_model_coefficients}.

\begin{table}
\centering
\caption{Model coefficients of the Daily Component Models\label{tab:daily_model_coefficients}}
\begin{tabular}{c|c|c|c|c|c}
\hline \hline
Model & $\phi_0$ & $\phi_1$ & $\phi_2$ & $\phi_3$ & $\theta_1$ \\
\hline
AR(1)   & 6.5397    & 0.8988 &- &- & - \\
AR(3) & 6.2932  & 0.7257    & -0.0099   & 0.2162 &- \\
ARMA(1,1) & 6.0340  & 0.9741    & -&    -   & -0.4991 \\
\hline
\end{tabular}
\end{table}

\end{document}


Consider using booktabs for your tabular representations.

• thank you very much for your help!! this worked perfectly!! – adrian1121 Jun 6 '16 at 21:09

A nuance, perhaps, but I am under the impression that the recommended practice is to place the label after the caption:

\documentclass{article}

\begin{document}

Actually if we perform an Augmented Dickey-Fuller test on the in-sample we refuse the null hypothesis of explosive process with a p-value of 0.8226.
This applies to all the models here presented, AR(1), AR(3) and
ARMA(1,1). Model coefficients can be inspected in Table
\ref{tab:daily_model_coefficients}
\medskip
\begin{table}[htbp]
\centering
\begin{tabular}{c|c|c|c|c|c}
\hline \hline
$Model$ & $\phi_{0}$ & $\phi_{1}$ & $\phi_{2}$ & $\phi_{3}$ & $\theta_{1}$ \\
\hline
AR(1)   & 6.5397    & 0.8988 &- &- & - \\
AR(3) & 6.2932  & 0.7257    & -0.0099   & 0.2162 &- \\
ARMA(1,1) & 6.0340  & 0.9741    & -&    -   & -0.4991 \\
\hline
\end{tabular}
\caption{Model coefficients of the Daily Component Models}
\label{tab:daily_model_coefficients}
\end{table}

\end{document}


Which produces this using ShareLaTeX:

• no actually it is better to put the label in the caption. – David Carlisle Jun 6 '16 at 21:11
• @DavidCarlisle interesting, i hadn't heard that. if that is the case then i stand corrected. – aeroNotAuto Jun 6 '16 at 21:13
• I was just finding this answer... tex.stackexchange.com/a/264115/1090 – David Carlisle Jun 6 '16 at 21:14
• I had the problem and writing \label after \caption fixed the issue. Weird... – MehmedB Jul 16 at 19:15