对于窄列,是否有更智能的连字符?

对于窄列,是否有更智能的连字符?

我知道如何关闭连字功能\nohyphens{.....}(来自连字符)。但我真正想要的是巧妙地使用连字符。我希望下面的例子能够清楚地表达我的意思。

左侧是使用该\nohyphens{...}命令渲染的表格中某一列的一段文本。这会留下大量空白。右侧是使用 vanilla XeLaTeX 排版的相同文本。如您所见,它仍然在文本中间留下一个很大的空白,并且还引入了相当奇怪的连字符“or-phaning”,而不是例如更自然的“cor-rections”。
完全没有连字符 默认行为

这是我在源代码中引入“更正”后制作的更智能的版本:

一些手动调整

至少在我看来,这比上面的任何一个版本都要好得多。

所以基本问题是:我能否让 LaTeX 自动为我完成这项工作,例如通过指定最长的可接受单词间空格?

附言。另一个更复杂的解决方案是为我的表格中的列指定一个“目标宽度”,例如,.25\textwidth然后让系统优化以生成一个表格,使我尽可能接近我指定的空白分数和表格宽度,同时尽量减少带连字符的单词数……但我不知道 LaTeX 是否可以在多个变量中进行这种动态优化!这是最后一张图片,我通过移动到列来完全摆脱连字符.27\textwidth。这似乎是迄今为止最易读的版本。

在此处输入图片描述

答案1

当尝试以非常窄的尺寸排版文本时,有时最好(最不坏?!)使用指令\sloppy,如下例所示。

在这种情况下设置 也会有所帮助\righthyphenmin2。(对于英语文本,此参数的默认值为3。)

在此处输入图片描述

\documentclass[12pt,letterpaper]{article}
\usepackage[showframe,margin=3.38in]{geometry} 
  % \textwidth = 8.5"-2*3.38" = 1.74"
\frenchspacing
\righthyphenmin2
\sloppy
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\begin{document}
\noindent
Quality control is handled with corrections and the ``orphaning'' mechanism in case 
of nonresponsive authors. Some articles are world-writeable, as in the wiki model.
\end{document}

答案2

我不确定你为什么要使用,\nohyphens我以为你想要更多而不是更少。使用链接表,因为你没有提供问题中示例的代码,我得到了这个,这还不算太糟糕,尽管显然可以再调整一下。

在此处输入图片描述

\documentclass[article,a4paper,12pt,twoside]{memoir}

\usepackage{hyphenat}

\setlrmarginsandblock{40mm}{20mm}{*}
\setulmarginsandblock{20mm}{20mm}{*}

\begin{document}

\renewcommand{\arraystretch}{1.5}
\begin{table}
\begin{center}
\raisebox{3in}{\small
\begin{tabular}{|*{3}{>{\hyphenpenalty0 }p{.25\textwidth}|}}
\hline
% \multicolumn{1}{p{.25\textwidth}}{\textbf{Relevance}}
\begin{center}(PM)
\end{center}

Ultimately relevance depends on peer review, and irrelevant content
may be deleted. Mechanisms to ensure that relevant content
\emph{will} be added could be improved. &
\begin{center}(WP)
\end{center}
People contribute articles about what
they're interested in; apart from this, rules like WP:WEIGHT come into
play.&
\begin{center}(DO)
\end{center}

Anyone can upload projects (for ``full projects'', one time approval
is needed), but getting changes into the core requires considerably
more vetting. \\
%\multicolumn{1}{p{.25\textwidth}}{\textbf{Quality}}
Quality control is handled with corrections and the ``orphaning'' mechanism
in case of nonresponsive authors. Some articles are world-writeable,
as in the wiki model. & Automated tools for spam and vandalism detection
combined with a system of editorial oversight, in which Jimmy Wales
has last say. & In addition to bug reports and feature requests handled
through the issue tracker, modules can make use of an automated patch
testing system.\\
%\multicolumn{1}{p{.25\textwidth}}{\textbf{Scalability}}
Peer review is distributed. Links are handled automatically. Caching
is deployed where relevant; in particular, interlinking features are
kept up to date. & The database and other infrastructure is massively
scaled. There are many bots that help with small tasks. & In theory,
anyone can join. Earl Miles, NYCCamp 2012 keynote: ``\emph{There are
no insiders, except Dries; there are no outsiders, only resumes.}''
\\
% \multicolumn{1}{p{.25\textwidth}}{\textbf{Consistency}}
Although automatic links and corrections can help with consistency,
mainly PM relies on standards for proof and expository quality.
&NPOV is the key rule, which works together with templates and other
process tools to maintain community standards about style and
content. & The project issue queues are the place to go when one
module's changes breaks another's. The core of the project has
considerable oversight in these
matters.\\
% \multicolumn{1}{p{.25\textwidth}}{\textbf{Motivation}}
People are solving some of their learning, exposition, and social
needs on the site by writing and reviewing articles and posting in the
forums.& As of 2006, over 50\% of the site had been written by less
than 1\% of the users; these days, paid editing is somewhat
notorious.& Miles continued: ``\emph{To build a resume, find someone
who needs help, and help them. Find something that needs doing, do
it.}'' \\ \hline
\end{tabular}
}
\end{center}
\caption{As typeset ``out of the box''}
\end{table}


\end{document}

如果您在右边距上留出一些灵活性,并添加微类型,则会获得:

\usepackage{microtype}

...

\begin{tabular}{|*{3}{
   >{\hyphenpenalty0 \rightskip0pt plus .3em \emergencystretch2em}%
   p{.25\textwidth}|}}

在此处输入图片描述

相关内容