[texhax] TeX Queries (2): Artificial Break

Paul Isambert zappathustra at free.fr
Thu Jul 19 09:38:17 CEST 2012

```Paul Stanley <paulrichardstanley at gmail.com> a écrit:
>
>  > The latter result isn't so bad, but the lines are quite stretched,
>  > and of course there is that fourth single-word line, smaller than the
>  > paragraph indentation, which is quite bad-looking.
>
>  > By "stretched" do you mean the tracking space is too wide?
>
>  > If by ``tracking'' you mean interword space, then yes; if on the other
>  > hand you mean interletter space, then no. Letterspacing (``tracking''
>  > proper) can be used in recent TeX engines, but not in Knuth's legacy
>  > TeX.
>
> let me get this right, there's no letter spacing applied in documents
> compiled by the legacy Tex engine. does that mean the glyphs are
> always adjacent and any gap between the characters is achieved by kerning?

Exactly (except that kerning does not necessarily produce a gap; more
often than not, it brings two glyphs closer to each other).

> [snip]
>
>  > Is there a substitute for the visual inspection of the lines --- for
>  > example, a formula or some other heuristics --- in determining the
>  > appropriate amount of tracking in a paragraph (to ensure the glyphs
>  > aren't too stretched or compressed together)?
>
>  > Unfortunately, I can't see how you can do that ``unvisually''. Of
>  > course, TeX's algorithm is not visual at all: it simply has a default
>  > space, plus maximum shrink and stretch of that space, and compute
>  > everything so that the actual space in lines is as close as possible to
>  > the default space (to put it simply). But space, stretch and shrink can
>  > all be reset by hand (the default values are inherited from the font),
>  > and that is a visual matter.
>
> Sorry to be obtuse, what default values are inherited from the font?

Space, stretch and shrink, a.k.a. \fontdimen 2, 3 and 4.

>  > As for real tracking, i.e. letterspacing, it's all visual to me, but
>  > perhaps somebody has found a nice formula (e.g. do not letterspace by
>  > more than ...). The crux of the matter is that letterspacing should be
>  > invisible, although of course it's often blatant in magazines with
>  > narrow columns.
>
> By "invisible" do you mean not visible to the naked eye?  I'd imagine
> there  would be some gap between the glyphs if letter spacing were
> applied, thus, the total width of two contiguous glyphs would be
> their advanced (declared) widths plus the letter spacing between
> them, or is that completely off the mark?

No, that's right, but letterspacing can be applied in two ways: one is
to really separate letters, and is used e.g. in all-cap titling; the
other is to add a very tiny amount of stretch between letters to help
justification. The former is made to be seen, but the letter is not, and
is definitely ugly when you can see it.

>  > Could you expand a little more on vertical spacing please? I'm
>  > assuming it's not the same as leading, or is it?
>
>  > It is. TeX takes into account the depth of the upper line (i.e. the
>  > depth of the glyph with the larger descender) and height of the lower
>  > line (i.e. the height of the glyph with the larger ascender) and adds
>  > space so that the two baselines are spaced by a given amount
>  > (\baselineskip). You can deactivate that operation, in which case the
>  > distance between the baselines depends on the glyphs in the lines -- a
>  > bad idea, of course.
>
> Ah yes, that's clear now, thanks.
> how is the depth or the height of the line measured? For example,
> does the depth start at the baseline and end at the tip of the lowest
> descender?

Yes, and the other way around for ascenders.

> With leading "deactivated", does the TeX engine put any space between
> the lines at all?

No, precisely. TeX stacks lines as they go, like ragged bricks without
mortar.

Best,
Paul

```