控制横断面标题的控制破裂

控制横断面标题的控制破裂

我有以下代码:

\section{This is some long text and probably it will be broken}

我想防止出现如下分词情况:

This is some long text and pro-
bably it will be broken

第二个问题是用一种好的方式来打破它,例如:

This is some long text and probably it will be
broken

看起来很糟糕,因为只有单词“broken”会放在第二行。这样做会更好:

This is some long text and probably
it will be broken

答案1

您可以在标题中使用手动换行(以及命令的可选参数,\section以防止换行出现在标题和目录中)。另一个选择是使用命令\sloppy和不间断空格(但这可能会产生坏框):

\documentclass{article}

\begin{document}
\tableofcontents

\section[This is some long text and probably it will be broken]{This is some long text and probably\\ it will be broken}

\section{\sloppy This is some long text and probably it~will~be~broken}

\end{document}

答案2

我必须将具有自定义行距的部分标题中的行截断。我尝试了很多解决方案。对我来说唯一稳定的方法是

\usepackage{setspace} 
...

\begin{spacing}{1.1}
    \part{\sloppy Introduction and state~of~the~art}
\end{spacing}

相关内容