El título de la tabla no aparece en la clase de documento PNAS

El título de la tabla no aparece en la clase de documento PNAS

No puedo hacer que aparezcan los títulos de las tablas cuando uso elClase de documento PNAStwodel 2008 (la última versión incluye marcas de impresora que no quiero).

La documentación dice "Los títulos de figuras y tablas deben ingresarse al final del documento..." pero como subtítulossonse muestran para las figuras, me gustaría que también se muestren para las tablas.

Esperaba que su recomendación no se implementara como un límite para los autores, pero parece que sí, ¿o me falta algo? Si no es así, ¿hay alguna solución que pueda emplear?

\documentclass{pnastwo}

\usepackage{gráficox}
\usepackage{pnastwoF}
\usepackage{amssymb,amsfonts,amsmath}

\begin{documento}

\begin{artículo}

\begin{tabla}[h]
    \begin{tabular}{cc}
        1 y 2 \\
        3 y 4
    \end{tabular}
    \caption{Un título que no aparece.}
\mesa final}

\begin{figura}
    \caption{Un título que sí aparece.}
\end{figura}

\end{artículo}

\end{documento}

Respuesta1

Me encontré con el mismo problema. (Es realmente molesto intentar producir versiones preimpresas del documento con calidad de impresión). Hurgando en pnastwo.cls, encontré la siguiente solución:

Busque la primera línea en pnastwo.cls que dice

\ifx\@captype\xtable

Cambie esto a

\ifx\@captype\table

Alternativamente, si no desea tocar el archivo de clase, puede colocar lo siguiente en el preámbulo de su 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

Un comentario adicional: una vez que se solucione este error, es casi seguro que se encontrará con otro problema que querrá solucionar si usa la clase de dos columnas PNAS para producir resultados con calidad de producción: a menos que defina flotantes con la h "aquí " ubicación, pierde las etiquetas, por lo que se rompe todo cruce de figuras y tablas. Aquí está la solución, para pegar directamente en el preámbulo del documento. También puedes parchear la macro \DonormalEndcol pnastwo.cls, es el mismo error 6 veces...

% 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                                   

Respuesta2

El archivo de plantilla que se distribuye junto con la clase dice

%----------------------------------------------------------------------------------------
%       FIGURES AND TABLES
%----------------------------------------------------------------------------------------

%% Adding Figure and Table References
%% Be sure to add figures and tables after \end{article}
%% and before \end{document}

Aquí está el ejemplo:

\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}

ingrese la descripción de la imagen aquí

Tenga en cuenta que el título de la tabla está escrito con el mismo ancho que el tabularentorno. ¿Por qué? No sé.

información relacionada