\raggedright 的用途是什么?

\raggedright 的用途是什么?

我以为这\raggedright是为了获得文本:1)不超过一定宽度,2)具有自然的单词间距,3)没有连字符。但事实证明,连字符完成\raggedright。那么,这个宏是用来做什么的呢?为什么不将它定义为\myraggedright,而是定义为\actualraggedright?(见下面的例子)

为什么使用\rightskip=0pt plus 1filin\myraggedright来产生不规则的右侧效果不好(如 TeXbook 第 101 页第二段中所述)?它似乎完美无缺。

例如,一个人可以设置\rightskip=0pt plus1fil,这样每行右侧都会有空格。但这不是制作右侧边距不齐的特别好的方法,因为无限可拉伸性会为非常短的行分配零不良度。

示例 1:

\def\actualraggedright{%
  \rightskip=0pt plus 2em
  \spaceskip .3333em \xspaceskip .5em\relax
}
\magnification=\magstep5
\actualraggedright
\frenchspacing
\noindent
There are not many different types of question that can be asked on Fourier series so, if you practice,
you should not have any surprises in the exam. In addition to the questions in the mock exam papers
and the blue book, there are many Fourier series questions available in maths text books or on-line.
\bye

示例 2:

\def\myraggedright{%
  \rightskip=0pt plus 1fil
  \spaceskip .3333em \xspaceskip .5em\relax
}
\magnification=\magstep5
\myraggedright
\frenchspacing
\noindent
There are not many different types of question that can be asked on Fourier series so, if you practice,
you should not have any surprises in the exam. In addition to the questions in the mock exam papers
and the blue book, there are many Fourier series questions available in maths text books or on-line.
\bye

答案1

\raggedright适用于特别窄的文本块的情况,因为完全对齐不会产生良好的结果。

如果你允许任意拉伸那么你可以得到非常粗糙的文本,通常可以通过限制粗糙度来改善。

比较同一文本的这两个设置。

在此处输入图片描述

\magnification=\magstep5
\noindent X\hrulefill X

\frenchspacing
{\raggedright

\noindent
There are not many different types of question
that\-can\-be\-asked\-on\-Fourier\-series\-so,\-if you
practice, you\-should\-not\-have\-any\-surprises\-in\-the exam.
In addition to the questions in the mock exam papers
and the blue book, there are many Fourier series
questions available in maths text books or online.

}
\def\myraggedright{%
  \rightskip=0pt plus 1fil
  \spaceskip .3333em \xspaceskip .5em\relax
}

\bigskip

{\myraggedright
\noindent
There are not many different types of question
that\-can\-be\-asked\-on\-Fourier\-series\-so,\-if you
practice, you\-should\-not\-have\-any\-surprises\-in\-the exam.
In addition to the questions in the mock exam papers
and the blue book, there are many Fourier series
questions available in maths text books or online.

}
\bye

相关内容