有没有办法将图形列表中的多行标题条目与单行条目的虚线水平对齐?由于我使用 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}
请注意,虚线不会在行中的最后一个点处停止。最后一个点后有一些空间。
的默认值为\@pnumwidth
1.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}