![使用 KOMA 脚本中的虚线水平对齐多行图形条目列表](https://linux22.com/image/440815/%E4%BD%BF%E7%94%A8%20KOMA%20%E8%84%9A%E6%9C%AC%E4%B8%AD%E7%9A%84%E8%99%9A%E7%BA%BF%E6%B0%B4%E5%B9%B3%E5%AF%B9%E9%BD%90%E5%A4%9A%E8%A1%8C%E5%9B%BE%E5%BD%A2%E6%9D%A1%E7%9B%AE%E5%88%97%E8%A1%A8.png)
有没有办法将图形列表中的多行标题条目与单行条目的虚线水平对齐?由于我使用 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}