允许更多连字符中断以减少单词间空间

允许更多连字符中断以减少单词间空间

我在页边空白处有一些标题,行数很短,我不喜欢 LaTeX 连字符算法将它们打断的方式。下面是我使用 LaTeX 完成这项工作的结果示例(当然,我将 babel 设置为使用意大利语连字符规则):

在此处输入图片描述

以下是更接近我想要获得的结果:

在此处输入图片描述

(这是我通过手动引入中断、框和空间减少而获得的)。

以下是产生输出的 MWE:

\documentclass[10pt,a4paper]{minimal}
\usepackage[italian]{babel}
\begin{document}

\begin{minipage}{2.95cm}\sffamily\itshape
\textbf{fig. 13.3.} Il flusso dei pagamenti nelle tre fasi di produzione, vendita all'ingrosso e al dettaglio
\end{minipage}

\vspace{1cm}

\begin{minipage}{2.95cm}\sffamily\itshape
\textbf{fig. 13.3.} Il flusso dei \mbox{pagamenti nelle} tre fasi di produzio\-ne, vendita all'in\-grosso e al dettaglio
\end{minipage}

\vspace{1cm}

\begin{minipage}{2.95cm}\sffamily\itshape
\textbf{fig.\,13.3.\!} Il\! \mbox{flusso\! dei} pagamenti nelle tre fasi di pro\-duzione, vendita all'in\-grosso e al dettaglio
\end{minipage}

\end{document}

我的问题:有没有办法指示 LaTeX 允许更多的停顿,并在必要时缩小单词间距,以避免单词之间有太多空格?

答案1

您可以让空格变得更紧凑、更具变化,并使用微类型,而不是添加更多的连字符点。

在此处输入图片描述

\documentclass[10pt,a4paper]{article}
\usepackage[italian]{babel}
\usepackage{microtype}
\begin{document}

\begin{minipage}{2.95cm}\sffamily\itshape
\spaceskip.25em plus .3em minus .1em
\xspaceskip.3em plus .3em minus .2em
\textbf{fig. 13.3.} Il flusso dei pagamenti nelle tre fasi di produzione, vendita all'ingrosso e al dettaglio
\end{minipage}

\end{document}

答案2

标签图 13.3应该被装箱,并且其中的空间不应该被拉伸。

如果我这样做,TeX 会非常乐意按顺序使用几个连字符。

最好标签后的空间也不允许拉伸,但这取决于文本;这里有三个短词,最后一个不能用连字符连接。

在任何情况下,我都会得到未满的框,但在窄列中排版时,这很正常。

\documentclass[10pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}

\begin{document}

% original
\begin{minipage}{2.95cm}\sffamily\itshape
\textbf{fig. 13.3.} Il flusso dei pagamenti nelle tre fasi di produzione, 
vendita all'ingrosso e al dettaglio
\end{minipage}

\vspace{1cm}

% better version
\begin{minipage}{2.95cm}\sffamily\itshape
\mbox{\textbf{fig.~13.3.}} Il flusso dei pagamenti nelle tre fasi di 
produzione, vendita all'ingrosso e al dettaglio
\end{minipage}

\vspace{1cm}

% not so good :-(
\begin{minipage}{2.95cm}\sffamily\itshape
\mbox{\textbf{fig.~13.3.} }Il flusso dei pagamenti nelle tre fasi di 
produzione, vendita all'ingrosso e al dettaglio
\end{minipage}

\end{document}

在此处输入图片描述

无论如何我都会使用microtype。以下是与之前相同的代码\usepackage{microtype}(但缺点减少了)。

在此处输入图片描述

请不要使用该类minimal。它不适用于排版示例。

答案3

当文本宽度较窄时,最好只在左侧对齐文本。这是通过命令获得的\raggedright。但\raggedright不要用连字符连接单词(参见第二个示例)。因此我们\RaggedRight使用ragged2e包裹。

正如 egreg 在他的回答中所指出的,我已经minimal用文档类替换了您的文档类article

\documentclass[10pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage{ragged2e}
%\usepackage{microtype} % optional but can give better results on some cases.

\begin{document}

\begin{minipage}{2.95cm}\sffamily\itshape
\textbf{Fig. 13.3.} Il flusso dei pagamenti nelle tre fasi di produzione, 
vendita all'ingrosso e al dettaglio
\end{minipage}

\vspace{1cm}

% With \raggedright, but no hyphenation
\begin{minipage}{2.95cm}\sffamily\itshape\raggedright
\textbf{Fig. 13.3.} Il flusso dei pagamenti nelle tre fasi di produzione, 
vendita all'ingrosso e al dettaglio
\end{minipage}

\vspace{1cm}

% With \RaggedRight from ragged2e
\begin{minipage}{2.95cm}\sffamily\itshape\RaggedRight
\textbf{Fig. 13.3.} Il flusso dei pagamenti nelle tre fasi di produzione, 
vendita all'ingrosso e al dettaglio
\end{minipage}
\end{document}

结果:

在此处输入图片描述

相关内容