使用 \DeclareNewTOC 时浮点编号不包括章节

使用 \DeclareNewTOC 时浮点编号不包括章节

我使用\DeclareNewTOCKOMA 类中的命令,因为它会自动为标题生成悬挂缩进,与内置浮动环境(如)相同figure。但是,与不同figure,我新定义的浮点数不包括章节编号。KOMAlevel手册中提到的选项似乎没有任何作用。

我该如何修复它以显示例如 1.1?也欢迎产生相同结果的替代解决方案。

编号错误

\documentclass[paper=A6]{scrreprt}
\DeclareNewTOC[
    float, type=floatlisting, types=floatlistings,
    %level=2, % Doesn't do anything
    name=Listing, listname={List of Listings}
]{lol}

\begin{document}
\chapter{Topic}
\begin{floatlisting}[h]
Foo
\caption{Some really long caption that leads to a line break.}
\end{floatlisting}
\begin{figure}[h]
Foo
\caption{Some really long caption that leads to a line break.}
\end{figure}
\end{document}

答案1

使用选项counterwithin=chapter

\documentclass[paper=A6]{scrreprt}
\DeclareNewTOC[
    float, type=floatlisting, types=floatlistings,
    counterwithin=chapter,%<-%%%%%%%%%%%%%%%%%%%%
    name=Listing, listname={List of Listings}
]{lol}

\begin{document}
\chapter{Topic}
\begin{floatlisting}[h]
    Foo
    \caption{Some really long caption that leads to a
    line break.}
\end{floatlisting}
\begin{figure}[h]
    Foo
    \caption{Some really long caption that leads to a
    line break.}
\end{figure}
\end{document} 

相关内容