部分标题中的水平盒子过满

部分标题中的水平盒子过满

我时不时会遇到这个错误,但我不知道该如何解决。从我读过的其他帖子中了解到,这是因为 LaTeX 不知道如何对某些句子进行连字符连接,并且找不到好的方法来断行。

就我而言,我有以下几行:

\section{Estimating the odds ratio in a case-control study}

并出现以下错误:

Overfull \hbox (7.52351pt too wide) in paragraph at lines 64--64

我试过,\-但无济于事。有趣的是,如果将其用作项目而不是部分标题,则不会出现错误。

谢谢

编辑:

日志错误:

Overfull \hbox (7.52351pt too wide) in paragraph at lines 64--64
[]\T1/cmr/bx/n/14.4 Estimating the odds ra-tio in a case-control study 
 []

答案1

你有

\documentclass{article}

\setlength\textwidth{309.49615pt}

\begin{document}
\section{Estimating the odds ratio in a case-control study}
zz
\end{document}

产生

Overfull \hbox (7.52351pt too wide) in paragraph at lines 6--6

您可以调整标题的类设置,但对于章节标题,您可能需要声明手动控制:

在此处输入图片描述

\documentclass{article}

\setlength\textwidth{309.49615pt}

\begin{document}
\section[Estimating the odds ratio in a case-control study]
{Estimating the odds ratio\\ in a case-control study}
zz
\end{document}

答案2

更糟糕的是?自我评论的 MWE 带有自我回答(即你自己的答案)。

\documentclass{article}
\usepackage{lipsum}
\setlength\textwidth{309.49615pt}
\begin{document}

\section{Estimating the odds ratio in a \\case-control study} 
To hell the limits! why bother by margins? \lipsum[1][1-2] 

\section{Estimating the odds ratio in a case-con\-trol study} 
Ouch! Ugly hyphens! \lipsum[2][1-3] 

\section{Estimating the odds ratio in a case-\protect\linebreak[4]control study}
Ouch! Ugly spaces! \lipsum[4][1-4] 

\section{Estimating the odds ratio in a case-control study}

Ugly \verb|\hbox|!! ... Did you noticed it? \lipsum[1][1-3] 

\section{Estimating OR in a case-control study} 
Ugly rewrite! And it is so exhausting... \lipsum[5][1-3] 

\end{document}

相关内容