# Table ref not displaying in PNAS format

I'm using the PNAS two column style (pnastwo.cls). As per the answer here, I need to wrap my text in the article environment to have it actually display in two columns. However, this makes it so that references to my table don't appear. The caption sometimes doesn't appear either. Below is my code

\documentclass{pnastwo}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{article}
\begin{table}
\begin{tabular}{|c|}
\hline
testing \\
\hline
\end{tabular}
\caption{TESTING}
\label{test}
\end{table}
Table~\ref{test}
\end{article}
\end{document}


and the output is

As you can see, no reference to the table # and the caption doesn't appear either. If I remove the article environment, then the table # appears but the caption still doesn't.

Edit: As suggested by egreg below, moving the table out of the article environment makes the table # appear. The caption still doesn't though.

• IIRC, tables should go after \end{article}. – egreg Apr 9 '15 at 22:04
• Ok, that makes the table # appear but the caption still doesn't – Opt Apr 9 '15 at 22:05
• The caption must go above the tabular. – egreg Apr 9 '15 at 22:08

The tables and figures must go after \end{article}. In both cases the caption must precede the object.

\documentclass{pnastwo}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{article}

Table~\ref{test}

\end{article}

\begin{table}
\caption{TESTING}
\label{test}
\begin{tabular}{ccc}
\hline
testing & testing & testing \\
\hline
\end{tabular}
\end{table}

\end{document}


I'm very sorry for you being forced to use such a horrible document class: horrible for how it's written and for the output it produces.

All floats must be after \end{article}, using the starred form if two-column mode is used.

This is clearly stated in the instruction manual:

\documentclass[final]{pnastwo}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
\begin{article}

In Table~\ref{test} we see

\end{article}
\begin{table*}
\caption{TESTING}
\label{test}

\begin{tabular}{|c|}
\hline
testing \\
\hline
\end{tabular}
\end{table*}

\end{document}

• I omit a screen shot – user31729 Apr 9 '15 at 22:15