[texhax] Strange formatting.

Robin Fairbairns Robin.Fairbairns at cl.cam.ac.uk
Wed Apr 14 00:04:15 CEST 2010


Tom Backer Johnsen <backer at psych.uib.no> wrote:

> Thanks for the responses, and I'll have to think about them.  I fail
> think that the lack of any descenders in the first line is the real
> cause of the problem.  Having to replace "Dear" with "Deary" is
> contrary with what I regard as the basic philosopy of LaTex.  On the
> other hand, having to add a blank line before the \normalsize (which
> worked very nicely, thank you) smacks a little of a magic wand, At
> least at the moment I cannot understand the explanation, I'll have to
> mull on that one.
> 
> Given my limited experience with LaTex (three or four years), I hardly
> dare to imply that this must be a bug.  However, given the
> documentation I have read, I am inclined to regard anything after the
> \Huge command as being formatted accordingly, regardless of
> descenders. Once you turn on that effect it remains in power, until
> some other command changes that attribute for the formatting of the
> text.  The fact that I would have to to do something  (completely
> illogical in my eyes) at the very END of that particular section to
> get everything right in the BEGINNING of that section, is in my eyes
> completely illogical.  And very confusing for users.  I have to add
> that my experience with programming goes back at least forty years.  I
> have generated many bugs of many different kinds.

what you're missing is that "font size" combines two concepts: the size
of the glyphs that are going to be printed, and the default spacing
between the lines of a paragraph.

tex treats these two very differently: the size is bound with the glyph
as it arrives, but the line spacing stands there as a static variable
until the paragraph is complete, and is split into lines.  (up to that
point, after all, there _are_ no lines, just a sequence of glyphs.)

now, your thing had

  \HUGE
[sets both variables]
  text of para (or whatever you call the bits of the mass)
[each character of text creates a glyph, whose size is HUGE]
  \normalsize
[sets both variables]
  \par
[actually implicit in the blank line: split the preceding paragraph into
lines, using the current value of line spacing, which is now that of
\normalsize]

if you put the \par (blank line) before \normalsize, the paragraph is
split into lines using the line spacing derived from \HUGE.

so barbara is telling you not to fiddle with blank lines, but to finish
the paragraph in the right place.  it just happens that you can
reasonably do that by fiddling with blank lines, but you shouldn't be
thinking of it that way.  (or rather, i hope you won't after reading
this...)

and, as several people remarked, you wouldn't have seen the misbehaviour
at all if the first line had had "deary" instead of "dear", because tex
doesn't allow adjacent lines to overlap, and the "y" would push the
following line down.  a person with sharp eyes might see differences
between the spacing of several lines, if they were all spaced by
descenders [i wouldn't, but i'm an old man] rather than the "correct"
value of line spacing.

> Sorry, I regard this as strange behavior of the LaTex system.  I am
> inclined to think this is a bug.

i hope the explanation helps.  it is indeed strange behaviour; but given
tex's modus operandi it's pretty much unavoidable.  and diagnosing the
problem, in code, is probably quite tricky -- too big a problem for
early latex systems to have contemplated it.

the faq answer on this topic is
  http://www.tex.ac.uk/cgi-bin/texfaq2html?label=paraparam
which doesn't talk about font sizes and line spacing.  must put that to
rights...


More information about the texhax mailing list