Заголовок таблицы не отображается в классе документа PNAS

Заголовок таблицы не отображается в классе документа PNAS

Я не могу отобразить заголовки таблиц при использованииPNASдва класса документовс 2008 года (последняя версия содержит типографские отметки, которые мне не нужны).

В документации говорится: «Подписи к рисункам и таблицам следует размещать в конце документа..." но как подписиявляютсяпоказаны для рисунков, я бы хотел, чтобы они были показаны и для таблиц.

Я надеялся, что их рекомендация не будет реализована как ограничение для авторов, но, похоже, это так, или я что-то упускаю? Если нет, есть ли обходной путь, который я могу использовать?

\documentclass{pnastwo}

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

\begin{документ}

\begin{статья}

\begin{table}[ч]
    \begin{tabular}{cc}
        1 и 2 \\
        3 и 4
    \end{табличный}
    \caption{Подпись, которая не отображается.}
\end{таблица}

\begin{figure}
    \caption{Подпись, которая появляется.}
\end{figure}

\end{статья}

\end{документ}

решение1

Я только что столкнулся с той же проблемой. (Это действительно раздражает, когда пытаешься создать препринтные версии статьи печатного качества.) Покопавшись в pnastwo.cls, я нашел следующее решение:

Найдите первую строку в pnastwo.cls, которая гласит:

\ifx\@captype\xtable

Изменить это на

\ifx\@captype\table

В качестве альтернативы, если вы не хотите трогать файл класса, вы можете поместить следующее в преамбулу вашего документа:

% 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

Еще один комментарий: как только эта ошибка будет исправлена, вы почти наверняка столкнетесь с другой проблемой, которую вы захотите исправить, если используете двухколоночный класс PNAS для создания качественного вывода: если вы не определяете плавающие элементы с размещением h "here", они теряют метки, поэтому все перекрестные ссылки на рисунки и таблицы нарушаются. Вот исправление для прямой вставки в преамбулу документа. Вы также можете исправить макрос \DonormalEndcol pnastwo.cls, это одна и та же ошибка 6 раз...

% 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                                   

решение2

В файле шаблона, который распространяется вместе с классом, говорится:

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

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

Вот пример:

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

введите описание изображения здесь

Обратите внимание, что заголовок таблицы набран той же ширины, что и tabularокружение. Почему? Я не знаю.

Связанный контент