使用 caption 和 capt-of 包组合时发生意外的缩进取消

使用 caption 和 capt-of 包组合时发生意外的缩进取消

“captionof” 后面的段落缩进不正确。请注释掉\usepackage{caption}\captionof{figure}{figure}恢复缩进。

但我需要 capt-of 包和 caption 包将“labelsep”重新定义为空格而不是冒号。还有其他方法吗?

以下是一个例子:

\documentclass{article}

\usepackage{capt-of}
\usepackage{caption}

\begin{document}
before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption before caption 

\captionof{figure}{figure}

after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption 

after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption after caption 
\end{document}

答案1

这个问题这里已经有答案了:\captionof 与段落缩进混乱但我想补充一点解释。

文档\captionof包中的(caption第 18 页)说“...所以你应该同时使用两者, \captionof并且\captionof*只在框或环境中使用。”所以把命令放在它自己的组中{\captionof{figure}{figure}}应该是一种合法的方式。

另外您不需要\usepackage{capt-of}因为caption包裹还提供\captionof

相关内容