使用 endfloat 和 caption 包删除图片标题

使用 endfloat 和 caption 包删除图片标题

在当前示例中:

\documentclass[12pt]{article}
\usepackage[textwidth=6.7in,textheight=9.125in]{geometry} % alter dimensions of document
\usepackage{graphicx} % include graphics i.e. figures
\usepackage[nomarkers,tablesfirst,notablist]{endfloat} %place figures at end of document

\begin{document}
\title{LaTeX Example}
\maketitle
This is an example of a latex document with figures and tables included. 

\begin{table}
\begin{tabular}{|l|c|p{3.5in}|}
\hline
\multicolumn{3}{|c|}{Places to Go Backpacking}\\ \hline
Name&Driving Time&Notes\\
&(hours)&\\ \hline
Big Basin&1.5&Very nice overnight to Berry Creek Falls from
either Headquarters or ocean side.\\ \hline
Sunol&1&Technicolor green in the spring. Watch out for the cows.\\ \hline
Henry Coe&1.5&Large wilderness nearby suitable for multi-day treks.\\ \hline
\end{tabular}
\caption{This is my first table}
\end{table}

\begin{figure}
\centering
\includegraphics{Figure1}
\caption{Here I describe the figure}
\end{figure}
\end{document}

我有一个包含表格和图形的文档。我使用包endfloat将它们放在文档末尾,首先放置表格,然后放置图形列表,最后放置图形本身。有没有一种方法可以删除图形的标题但保留表格的标题?通过添加删除标题的选项,它会同时删除图形和表格的标题(我不想要这个)。要仅删除图形标题,手册endfloat指出要使用caption包:

\captionsetup[figure]{labelsep=none,labelformat=empty,textformat=empty}

但是,这会产生错误,这让我认为该命令不能与该endfloat包一起使用。关于如何解决这个问题有什么建议吗?

答案1

您可以使用 来控制标题,\@makecaption并且该endfloat包允许您在表格开头\AtBeginTables和图形开头执行操作\AtBeginFigures。将两者放在一起可得到:

\makeatletter
\let\orig@makecaption\@makecaption
\AtBeginTables{\let\@makecaption\orig@makecaption}
\AtBeginFigures{\renewcommand{\@makecaption}[2]{#1}}
\makeatother

相关内容