使用 KOMA 脚本中的虚线水平对齐多行图形条目列表

使用 KOMA 脚本中的虚线水平对齐多行图形条目列表

有没有办法将图形列表中的多行标题条目与单行条目的虚线水平对齐?由于我使用 KOMA 脚本类 scrreprt,因此我想避免使用诸如 之类的包tocloft。下图应勾勒出所需的结果。这也可能适用于其他列表,例如表格列表、清单列表等。谢谢!

在此处输入图片描述

梅威瑟:

\documentclass[11pt]{scrreprt}

\begin{document}

\listoffigures

\chapter{Chapter}

\begin{figure}
    \caption{Single line entry}
\end{figure}
\begin{figure}
    \caption{Long figure caption that spans over two or more lines should be aligned with the 
dotted line above long figure caption that spans over two or more lines should be aligned with the dotted line above}
    \end{figure}
    
    \end{document}

答案1

你可以使用

\documentclass[fontsize=11pt]{scrreprt}% remark: fontsize=11pt is default

\makeatletter
\let\@tocrmarg\@pnumwidth
\makeatother

\begin{document}
\listoffigures
\chapter{Chapter}
\begin{figure}
  \caption{Single line entry}
\end{figure}
\begin{figure}
  \caption{Long figure caption that spans over two or more lines should be aligned with the 
    dotted line above long figure caption that spans over two or more lines should 
    be aligned with the dotted line above}
\end{figure}
\end{document}

在此处输入图片描述

请注意,虚线不会在行中的最后一个点处停止。最后一个点后有一些空间。

的默认值为\@pnumwidth1.55em,的默认\@tocrmarg值为 2.55em。

如果多行条目应该与虚线的最后一个点对齐,则必须根据\@tocrmarg需要进行调整:

\documentclass[fontsize=11pt]{scrreprt}% remark: fontsize=11pt is default

\makeatletter
\renewcommand*{\@tocrmarg}{1.85em}
\makeatother

\begin{document}
\listoffigures
\chapter{Chapter}
\begin{figure}
  \caption{Single line entry}
\end{figure}
\begin{figure}
  \caption{Long figure caption that spans over two or more lines should be aligned with the 
    dotted line above long figure caption that spans over two or more lines should 
    be aligned with the dotted line above}
\end{figure}
\end{document}

在此处输入图片描述

相关内容