![隐藏特定表格,保留 \listoftables 中的交叉引用和标题](https://linux22.com/image/303735/%E9%9A%90%E8%97%8F%E7%89%B9%E5%AE%9A%E8%A1%A8%E6%A0%BC%EF%BC%8C%E4%BF%9D%E7%95%99%20%5Clistoftables%20%E4%B8%AD%E7%9A%84%E4%BA%A4%E5%8F%89%E5%BC%95%E7%94%A8%E5%92%8C%E6%A0%87%E9%A2%98.png)
我在一篇文章中有一些支持表格需要作为单独的 pdf 文件提交,但我需要主文档中的交叉引用和带有标题的表格编号(\listoftables)。
单独的 pdf 没有问题,但是如何隐藏主文档中的特定表格?基本上,一些表格应该被处理以用于参考和标题,但从最终输出中删除。
谢谢!
编辑:最小工作示例
\documentclass[letterpaper,11pt]{article}
\usepackage[nolists,nomarkers,figuresfirst]{endfloat}
\newcommand{\beginsupplement}{\setcounter{table}{0}\renewcommand{\thetable}{S\arabic{table}}\setcounter{figure}{0}\renewcommand{\thefigure}{S\arabic{figure}}}
\begin{document}
Table~\ref{tab:S1} but not Table~\ref{tab:1} should be in a separate pdf file. The rest is fine.
\begin{table}[ht]
\begin{tabular}{c}
Content 1
\end{tabular}
\caption{Caption 1}
\label{tab:1}
\end{table}
\newpage
\listoftables
\newpage
\processdelayedfloats
\beginsupplement
\renewcommand{\tablename}{Supporting Table}
\begin{table}[ht]
\begin{tabular}{c}
Content S1
\end{tabular}
\caption{Caption S1}
\label{tab:S1}
\end{table}
\end{document}
答案1
您可以使用\include
;您的补充内容应放在单独的文件中(filecontents
尽管如此,我还是在这里使用它将其放入主文档中)。在序言中,您将有一行\includeonly{}
。
为了使引用已知,请注释\includeonly{}
;编译直到解决交叉引用,然后取消注释该行并再次编译。
\documentclass[letterpaper,11pt]{article}
\usepackage[nolists,nomarkers,figuresfirst]{endfloat}
\usepackage{filecontents}
\newcommand{\beginsupplement}{%
\setcounter{table}{0}%
\renewcommand{\thetable}{S\arabic{table}}%
\setcounter{figure}{0}%
\renewcommand{\thefigure}{S\arabic{figure}}%
}
%\includeonly{} %%%%% Uncomment for removing the supplement table
\begin{document}
Table~\ref{tab:S1} but not Table~\ref{tab:1} should be in a separate pdf file. The rest is fine.
\begin{table}[ht]
\begin{tabular}{c}
Content 1
\end{tabular}
\caption{Caption 1}
\label{tab:1}
\end{table}
\newpage
\listoftables
\newpage
\processdelayedfloats
\begin{filecontents}{\jobname-support}
\beginsupplement
\renewcommand{\tablename}{Supporting Table}
\begin{table}[ht]
\begin{tabular}{c}
Content S1
\end{tabular}
\caption{Caption S1}
\label{tab:S1}
\end{table}
\processdelayedfloats
\end{filecontents}
\include{\jobname-support}
\end{document}