环绕图标题无缩进

环绕图标题无缩进

我想删除环绕图标题的缩进,但不想删除普通图标题的缩进。可以吗?

\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{wrapfig}
\usepackage{blindtext}

\begin{document}
    \begin{figure}[tbp]
      \fbox{\begin{minipage}[t]{\textwidth}A figure!\end{minipage}}
      \caption{\blindtext}
    \end{figure}%
    \begin{wrapfigure}{l}{5cm}
      \fbox{\begin{minipage}[t]{5cm}A figure!\end{minipage}}
      \caption{For this caption I don't want an indention!}
    \end{wrapfigure}
    \blindtext
\end{document}

答案1

使用该caption包和本地\captionsetup{format=plain}命令:

\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{caption}
\usepackage{wrapfig}
\usepackage{blindtext}

\begin{document}

\begin{wrapfigure}{l}{5cm}
  \fbox{\begin{minipage}[t]{4cm}A figure!\end{minipage}}
  \captionsetup{format=plain}
  \caption{For this caption I don't want an indention!}
 \end{wrapfigure}
\blindtext

\begin{figure}[htbp]
  \fbox{\begin{minipage}[t]{.9\textwidth}A figure!\end{minipage}}
  \caption{\blindtext}
\end{figure}

\end{document}

使用标准方法可以实现自动化:

\usepackage{etoolbox}
\pretocmd{\wrapfloat}{\captionsetup{format=plain}}

就足够了。

在此处输入图片描述

相关内容