Tabellenüberschrift erscheint nicht in der PNAS-Dokumentklasse

Tabellenüberschrift erscheint nicht in der PNAS-Dokumentklasse

Ich kann keine Tabellenüberschriften anzeigen, wenn ich denPNAStwo-Dokumentenklassevon 2008 (die neuste Version enthält Druckermarken, die ich nicht möchte).

In der Dokumentation heißt es:Abbildungs- und Tabellenbeschriftungen sollten am Ende des Dokuments eingegeben werden …" aber als BildunterschriftenSindfür Abbildungen angezeigt, ich möchte, dass sie auch für Tabellen angezeigt werden.

Ich hatte gehofft, dass ihre Empfehlung nicht als Beschränkung für Autoren umgesetzt wurde, aber anscheinend ist das so, oder übersehe ich etwas? Wenn nicht, gibt es eine Problemumgehung, die ich anwenden kann?

\documentclass{pnastwo}

\usepackage{graphicx}
\usepackage{pnastwoF}
\usepackage{amssymb,amsfonts,amsmath}

\begin{document}

\begin{Artikel}

\begin{table}[h]
    \begin{tabular}{cc}
        1 und 2 \\
        3 und 4
    \end{tabulär}
    \caption{Eine Beschriftung, die nicht angezeigt wird.}
\end{table}

\begin{figure}
    \caption{Eine Beschriftung, die angezeigt wird.}
\end{figure}

\Ende {Artikel}

\end{document}

Antwort1

Ich bin gerade auf dasselbe Problem gestoßen. (Es ist wirklich ärgerlich, wenn man versucht, Vorabversionen des Papiers in Druckqualität zu erstellen.) Beim Stöbern in pnastwo.cls habe ich die folgende Lösung gefunden:

Suchen Sie in pnastwo.cls nach der ersten Zeile, die besagt

\ifx\@captype\xtable

Ändern Sie dies in

\ifx\@captype\table

Wenn Sie die Klassendatei nicht ändern möchten, können Sie alternativ Folgendes in die Präambel Ihres Dokuments einfügen:

% 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

Ein zusätzlicher Kommentar: Sobald dieser Fehler behoben ist, werden Sie mit ziemlicher Sicherheit auf ein anderes Problem stoßen, das Sie beheben lassen möchten, wenn Sie die Zweispaltenklasse von PNAS verwenden, um eine Ausgabe in Produktionsqualität zu erstellen: Wenn Sie Floats nicht mit der Platzierung „hier“ von h definieren, gehen die Beschriftungen verloren, sodass alle Querverweise von Abbildungen und Tabellen unterbrochen werden. Hier ist die Lösung für das direkte Einfügen in die Dokumentpräambel. Sie können auch das Makro \DonormalEndcol pnastwo.cls patchen, es ist derselbe Fehler 6 Mal ...

% 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                                   

Antwort2

Die mit der Klasse mitgelieferte Vorlagendatei besagt

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

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

Hier ist das Beispiel:

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

Bildbeschreibung hier eingeben

Beachten Sie, dass die Tabellenüberschrift mit der gleichen Breite wie die tabularUmgebung gesetzt wird. Warum? Ich weiß es nicht.

verwandte Informationen