我的问题是,是否存在一种方法来抑制目录中的悬垂文本元素。下面您将看到我的 MWE。非常感谢您的解决方案和评论!
\documentclass{scrbook}
\usepackage{ragged2e}
\makeatletter
\renewcommand{\@pnumwidth}{3em}
\makeatother
\begin{document}
\begin{FlushLeft}
\tableofcontents
\end{FlushLeft}
\chapter{chapter -- what a very long acronym (\emph{qwertzuiopasdfghjk})}
some text
\section{section -- what a very long and even longer heading with this acronym \emph{qwertzuiopasdfghjk}}
some text\newpage
\setcounter{page}{10}
\section{Another section}
\end{document}
答案1
使用包tocstyle
,您可以将目录中的条目设置为右侧不规则。
\documentclass{scrbook}
\usepackage{showframe}
\usepackage{ragged2e}
\usepackage{tocstyle}
\usetocstyle{KOMAlike}
\settocfeature{raggedhook}{\raggedright}
\makeatletter
\renewcommand{\@pnumwidth}{3em}
\makeatother
\begin{document}
\tableofcontents
\chapter{chapter -- what a very long acronym
(\emph{qwertzuiopasdfghjk})
}
some text
\section{section -- what a very long and even longer
heading with this acronym
\emph{qwertzuiopasdfghjk}
}
some text\clearpage
\setcounter{page}{1000}
\section{Well, this is quite the text and nobody
should ever use section or chapter titles that
long. However, we want to see if that is raggedright or
not. Justified text would look different.}
\end{document}