![PNAS 문서 클래스에 테이블 캡션이 표시되지 않습니다.](https://rvso.com/image/286346/PNAS%20%EB%AC%B8%EC%84%9C%20%ED%81%B4%EB%9E%98%EC%8A%A4%EC%97%90%20%ED%85%8C%EC%9D%B4%EB%B8%94%20%EC%BA%A1%EC%85%98%EC%9D%B4%20%ED%91%9C%EC%8B%9C%EB%90%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
사용할 때 테이블 캡션을 표시할 수 없습니다.PNAStwo 문서 클래스2008년부터(최신 버전에는 내가 원하지 않는 프린터 표시가 포함되어 있습니다).
문서에는 "그림과 표 캡션은 문서 마지막에 입력해야 합니다."하지만 캡션으로~이다그림으로 표시했는데 표로도 표시하고 싶습니다.
나는 그들의 추천이 저자에 대한 제한으로 구현되지 않기를 바랐지만 실제로 그런 것 같습니다. 아니면 제가 뭔가를 놓치고 있는 걸까요? 그렇지 않은 경우 사용할 수 있는 해결 방법이 있습니까?
\documentclass{pnastwo} \사용패키지{graphicx} \usepackage{pnastwoF} \usepackage{amssymb,amsfonts,amsmath} \begin{문서} \begin{기사} \begin{테이블}[h] \begin{표 형식}{cc} 1 & 2 \\ 3 & 4 \end{표 형식} \caption{표시되지 않는 캡션입니다.} \탁자} \begin{그림} \caption{표시되는 캡션입니다.} \end{그림} \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 2열 클래스를 사용하여 프로덕션 수준의 출력을 생성하는 경우 수정하고 싶은 또 다른 문제가 거의 확실하게 발생합니다. 여기에서 h "로 부동 소수점을 정의하지 않는 한 " 배치를 수행하면 레이블이 손실되므로 그림과 표의 모든 상호 참조가 중단됩니다. 문서 서문에 직접 붙여넣는 방법은 다음과 같습니다. \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
. 왜? 모르겠습니다.