如何在 captionlabel(koma-script 选项)后插入换行符?

如何在 captionlabel(koma-script 选项)后插入换行符?

第 125 页scrguien.pdf,两个下方的标题在标签后有换行符。我该如何对我的标题做同样的事情?使用内置的 KOMA 选项是否可能?我找了整整 15 分钟,到目前为止,没有运气。:/

Markus 的输出图片,我也想拥有它

在此处输入图片描述

我的MWE

\documentclass[
12pt,
a4paper
]{scrartcl}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

%% built-in KOMA caption specifications
\setcapmargin{1cm}
\setkomafont{captionlabel}{\sffamily}

\begin{document}
\begin{table}
\centering
AAA
\caption{Test.}
\end{table}
\begin{center}
BBB
\captionof{table}{Some more words 12. Some more words 12. Some more words 12. Some more words 12. Some more words 12. Some more words 12.}
\end{center}
\end{document}

答案1

使用\setcapindent*;注意参数为正数或负数时的区别。我在环境中使用了命令center,但当然你应该在序言中做出全局决定。

\documentclass[
  12pt,
  a4paper
]{scrartcl}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{showframe} % just for the example

%% built-in KOMA caption specifications
\setcaphanging
\setcapmargin{1cm}
\setcapindent*{0pt}
\setkomafont{captionlabel}{\sffamily}

\begin{document}
\begin{table}
\centering
AAA
\caption{Test.}
\end{table}
\begin{center}
BBB

\captionof{table}{Some more words 12. Some more words 12. Some more words 12. 
Some more words 12. Some more words 12. Some more words 12.}

\setcapindent*{1em}

\captionof{table}{Some more words 12. Some more words 12. Some more words 12. 
Some more words 12. Some more words 12. Some more words 12.}

\setcapindent*{-1em}

\captionof{table}{Some more words 12. Some more words 12. Some more words 12. 
Some more words 12. Some more words 12. Some more words 12.}


\end{center}
\end{document}

在此处输入图片描述

答案2

我推荐这个caption软件包: http://sunsite.informatik.rwth-aachen.de/ftp/pub/mirror/ctan/macros/latex/contrib/caption/caption-eng.pdf

它提供了大量自定义字幕的可能性。

您想要的行为可以通过以下方式实现:

\usepackage[labelsep=newline,            % Caption starts in a new line below the label
            format=hang,                 % Caption hangs under the label
            indentation=-1em]{caption}   % and moved back by 1em

相关内容