![A legenda da tabela não aparece na classe de documento PNAS](https://rvso.com/image/286346/A%20legenda%20da%20tabela%20n%C3%A3o%20aparece%20na%20classe%20de%20documento%20PNAS.png)
Não consigo fazer com que as legendas das tabelas apareçam ao usar oClasse de documento PNAStwode 2008 (a versão mais recente inclui marcas de impressora que não desejo).
A documentação diz "As legendas das figuras e tabelas devem ser inseridas no final do documento..."mas como legendassãomostrados para figuras, gostaria que fossem mostrados também para tabelas.
Eu esperava que a recomendação deles não fosse implementada como um limite para os autores, mas parece que sim, ou estou faltando alguma coisa? Caso contrário, há uma solução alternativa que eu possa empregar?
\documentclass{pnastwo} \usepackage{gráficox} \usepackage{pnastwoF} \usepackage{amssymb,amsfonts,amsmath} \begin{documento} \begin{artigo} \begin{tabela}[h] \begin{tabular}{cc} 1 e 2 \\ 3 e 4 \end{tabular} \caption{Uma legenda que não aparece.} \mesa final} \começo{figura} \caption{Uma legenda que aparece.} \end{figura} \end{artigo} \end{documento}
Responder1
Acabei de encontrar o mesmo problema. (É realmente irritante tentar produzir versões pré-impressas do papel com qualidade de impressão.) Procurando em pnastwo.cls, encontrei a seguinte correção:
Encontre a primeira linha em pnastwo.cls que diz
\ifx\@captype\xtable
Mude isso para
\ifx\@captype\table
Alternativamente, se você não quiser mexer no arquivo de classe, você pode colocar o seguinte no preâmbulo do seu documento:
% Fix wierd behavior which prevents table captions from appearing for
% tables in the body of the article
\makeatletter
\long\def\@makecaption#1#2{%
\ifx\@captype\table
\let\currtabcaption\relax
\gdef\currtabcaption{
\tabnumfont\relax #1. \tabtextfont\relax#2\par
\vskip\belowcaptionskip
}
\else
\vskip\abovecaptionskip
\sbox\@tempboxa{\fignumfont#1.\figtextfont\hskip.5em\relax #2}%
\ifdim \wd\@tempboxa >\hsize
\fignumfont\relax #1.\figtextfont\hskip.5em\relax#2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\fi
}
\makeatother
Um comentário adicional: depois que esse bug for corrigido, você quase certamente encontrará outro problema que gostaria de corrigir se usar a classe PNAS de duas colunas para produzir saída com qualidade de produção: A menos que você defina floats com o h "aqui "na colocação, ele perde os rótulos, então todo cruzamento de figuras e tabelas quebra. Aqui está a solução, para colar diretamente no preâmbulo do documento. Você também pode corrigir a macro \DonormalEndcol pnastwo.cls, é o mesmo erro 6 vezes...
% And another fix. PNAS class loses the label of floats unless they
% were defined with the [h] option (so not really floats at all). It
% all comes down to wrong scope in the following routine which pushes
% out the floats onto the page. This is the fixed version:
\makeatletter
\def\DonormalEndcol{%
%% top float ==>
\ifx\toporbotfloat\xtopfloat%
%% figure ==>
\ifcaptypefig%
\expandafter\gdef\csname topfloat\the\figandtabnumber\endcsname{%
\vbox{\vskip\PushOneColTopFig%
\unvbox\csname figandtabbox\the\loopnum\endcsname%
\vskip\abovefigcaptionskip%
\csname caption\the\loopnum\endcsname%
\csname letteredcaption\the\loopnum\endcsname%
\csname continuedcaption\the\loopnum\endcsname%
\csname letteredcontcaption\the\loopnum\endcsname
\ifredefining%
\csname label\the\loopnum\endcsname%
\expandafter\gdef\csname topfloat\the\loopnum\endcsname{}\fi}%
\vskip\intextfloatskip%%
\vskip-4pt %% probably an artifact of topskip??
}%
\else%
%% plate ==>
\ifcaptypeplate%
\expandafter\gdef\csname topfloat\the\figandtabnumber\endcsname{%
\vbox{\vskip\PushOneColTopFig%
\unvbox\csname figandtabbox\the\loopnum\endcsname
\vskip\abovefigcaptionskip
\csname caption\the\loopnum\endcsname
\csname letteredcaption\the\loopnum\endcsname
\csname continuedcaption\the\loopnum\endcsname
\csname letteredcontcaption\the\loopnum\endcsname
\ifredefining
\csname label\the\loopnum\endcsname
\expandafter\gdef\csname topfloat\the\loopnum\endcsname{}\fi}
\vskip\intextfloatskip %%
\vskip-4pt %% probably an artifact of topskip??
}%
\else% table ==>
\expandafter\gdef\csname topfloat\the\figandtabnumber\endcsname{%
\vbox{\vskip\PushOneColTopTab %%
\csname caption\the\loopnum\endcsname
\csname letteredcaption\the\loopnum\endcsname
\csname continuedcaption\the\loopnum\endcsname
\csname letteredcontcaption\the\loopnum\endcsname
\vskip\captionskip
\unvbox\csname figandtabbox\the\loopnum\endcsname
\ifredefining
\csname label\the\loopnum\endcsname
\expandafter\gdef\csname topfloat\the\loopnum\endcsname{}\fi
}\vskip\intextfloatskip %% why don't we need this?
\vskip-10pt}
\fi\fi%
%
\else% bottom float
%
\ifcaptypefig
\expandafter\gdef\csname botfloat\the\figandtabnumber\endcsname{%
\vskip\intextfloatskip
\vbox{\unvbox\csname figandtabbox\the\loopnum\endcsname
\vskip\abovefigcaptionskip
\csname caption\the\loopnum\endcsname
\csname letteredcaption\the\loopnum\endcsname%
\csname continuedcaption\the\loopnum\endcsname%
\csname letteredcontcaption\the\loopnum\endcsname%
\vskip\PushOneColBotFig%%
\ifredefining%
\csname label\the\loopnum\endcsname
\expandafter\gdef\csname botfloat\the\loopnum\endcsname{}\fi}}%
\else
\ifcaptypeplate
\expandafter\gdef\csname botfloat\the\figandtabnumber\endcsname{%
\vskip\intextfloatskip
\vbox{\unvbox\csname figandtabbox\the\loopnum\endcsname
\vskip\abovefigcaptionskip
\csname caption\the\loopnum\endcsname
\csname letteredcaption\the\loopnum\endcsname%
\csname continuedcaption\the\loopnum\endcsname%
\csname letteredcontcaption\the\loopnum\endcsname%
\vskip\PushOneColBotFig%%
\ifredefining%
\csname label\the\loopnum\endcsname
\expandafter\gdef\csname botfloat\the\loopnum\endcsname{}\fi}}%
\else% TABLE
\expandafter\gdef\csname botfloat\the\figandtabnumber\endcsname{%
\vskip\intextfloatskip
\vbox{\csname caption\the\loopnum\endcsname
\csname letteredcaption\the\loopnum\endcsname
\csname continuedcaption\the\loopnum\endcsname
\csname letteredcontcaption\the\loopnum\endcsname%
\vskip.5\intextfloatskip
\unvbox\csname figandtabbox\the\loopnum\endcsname%
\vskip\PushOneColBotTab
\ifredefining%
\csname label\the\loopnum\endcsname
\expandafter\gdef\csname botfloat\the\loopnum\endcsname{}\fi}}%
\fi\fi\fi}
\makeatother
Responder2
O arquivo de modelo distribuído junto com a classe diz
%----------------------------------------------------------------------------------------
% FIGURES AND TABLES
%----------------------------------------------------------------------------------------
%% Adding Figure and Table References
%% Be sure to add figures and tables after \end{article}
%% and before \end{document}
Aqui está o exemplo:
\documentclass{pnastwo}
\usepackage{graphicx}
%\usepackage{pnastwoF} % this is not required
\usepackage{amssymb,amsfonts,amsmath}
\usepackage{lipsum} % just for the example
\begin{document}
\title{X}
\author{A. Uthor\affil{1}{University of Nowhere}}
\contributor{Submitted to Proceedings of the National Academy of Sciences
of the United States of America}
%----------------------------------------------------------------------------------------
\maketitle % The \maketitle command is necessary to build the title page
\begin{article}
\lipsum
\end{article}
\begin{table}[h]
\caption{A caption that appears.}
\begin{tabular}{cc}
1 & 2 \\
3 & 4
\end{tabular}
\end{table}
\begin{figure}[h]
\caption{A caption that does appear.}
\end{figure}
\end{document}
Observe que a legenda da tabela é composta com a mesma largura do tabular
ambiente. Por que? Não sei.