我正在尝试更改以下 MWE 中图片下方标题的样式。我该如何更改样式以便 Endfloat 仍能拾取图片环境并将图片发送到章节末尾?
\documentclass[oneside,12pt]{book}
\usepackage[tablesfirst,notablist]{endfloat}
\usepackage{titletoc}
\usepackage[demo]{graphicx}
\renewcommand\theposttable{\arabic{chapter}.\arabic{posttbl}}
\renewcommand\thepostfigure{\arabic{chapter}.\arabic{postfig}}
%This creates bold captions for the figures.%If you uncomment this, the figures don't go to the end of the chapter!!!!!
\makeatletter
\long\def\@maketblcaption#1#2{%
\vskip\abovecaptionskip
\begin{center}\normalsize\bf#1. \normalsize#2\end{center}
\vskip\belowcaptionskip}
\renewcommand{\figure}{\let\@makecaption\@maketblcaption\@float{figure}}
\makeatother
\begin{document}
\chapter{Data}
\startlist{lot}
\begin{figure}
\centering
\includegraphics{histoOne1}
\caption{My caption for this figure}
\label{fig:MyFigure}
\end{figure}
\printlist{lot}{}{\chapter*{List of tables in Chapter~\thechapter}}
\processdelayedfloats
\chapter{Learning}
\startlist{lot}
\begin{figure}
\centering
\includegraphics{histoOne1}
\caption{My caption for this figure}
\label{fig:MyFigure}
\end{figure}
\printlist{lot}{}{\chapter*{List of tables in Chapter~\thechapter}}
\processdelayedfloats
\end{document}
答案1
要自定义字幕格式,请使用caption
包;例如,要使图形标题以粗体字体居中,您可以使用
\captionsetup[figure]{font=bf,justification=centering}
一个小例子(该包提供了许多其他定制的可能性;请参阅文档):
\documentclass[oneside,12pt]{book}
\usepackage[tablesfirst,notablist]{endfloat}
\usepackage{titletoc}
\usepackage{caption}
\usepackage[demo]{graphicx}
\renewcommand\theposttable{\arabic{chapter}.\arabic{posttbl}}
\renewcommand\thepostfigure{\arabic{chapter}.\arabic{postfig}}
\captionsetup[figure]{font=bf,justification=centering}
\begin{document}
\chapter{Data}
\startlist{lot}
\begin{figure}
\centering
\includegraphics{histoOne1}
\caption{My caption for this figure}
\label{fig:MyFigure}
\end{figure}
\printlist{lot}{}{\chapter*{List of tables in Chapter~\thechapter}}
\processdelayedfloats
\chapter{Learning}
\startlist{lot}
\begin{figure}
\centering
\includegraphics{histoOne1}
\caption{My caption for this figure}
\label{fig:MyFigure2}
\end{figure}
\printlist{lot}{}{\chapter*{List of tables in Chapter~\thechapter}}
\processdelayedfloats
\end{document}