狭い列のためのよりスマートなハイフネーション?

狭い列のためのよりスマートなハイフネーション?

ハイフネーションをオフにする方法は知っています\nohyphens{.....}(からハイフン) ですが、私が本当に望んでいるのは、スマートにハイフンでつなぐことです。次の例を見れば、これが何を意味するのかが明らかになると思います。

左は、コマンドでレンダリングされた表の列のテキストの一部です\nohyphens{...}。これにより、多くの空白が残ります。右は同じテキストを標準のXeLaTeXでタイプセットしたものです。ご覧のとおり、まだテキストの中央に大きな空白が残り、たとえばより自然な「修正」の代わりに、かなり奇妙なハイフネーション「or-phaning」が導入されます。
ハイフネーションは一切なし デフォルトの動作

以下は、ソース コードに「修正」を導入して作成した、よりスマートなバージョンです。

一部は手作業で調整

少なくとも私の目には、これは上記のどちらのバージョンよりもはるかに優れているように見えます。

したがって、基本的な質問は次のとおりです。たとえば、許容される最長の単語間空白を指定することで、LaTeX でこれを自動的に実行できるでしょうか?

追伸もう 1 つのより複雑な解決策は、たとえば、表の列の「ターゲット幅」を指定して、.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}|}}

ここに画像の説明を入力してください

関連情報