Document Crafting, Objectively

Marcel Weiher marcel at metaobject.com
Wed Mar 13 11:23:29 UTC 2002


On Wednesday, March 13, 2002, at 10:46 AM, goran.hultgren at bluefish.se 
wrote:

>>  From what I\ve read so far, this is not really the case.  The real
>> 'crown jewel' (IMHO) of TeX is the paragraph-optimzing line-breaking
>> algorithm, which is not in Lout (at least according to the Lout papers
>> I've read so far).  In addition I am not sure it has a lot of the other
>> "typography know-how" that is built into TeX.
>
> Well, are you sure? :-)

No ;-)

> I looked around just now and even though the
> homepage is unaccessible, I found:
> http://www.chez.com/emarsden/lout/loutFAQ-2.html#ss2.4
>
> It says "For example, Lout uses Knuth's (the author of TeX, on which
> LaTeX is based) optimal line breaking algorithm, and has extended it to
> paragraph breaking across pages."

Yeah, I probably misinterpreted the following section from the "design" 
paper:

The actual paragraph breaking is just a simple transformation on the
parse tree; the real issue is how to describe the various styles:  ragged
right, adjusted, outdented, and so on.  Their diversity suggests that
they should somehow be defined using more basic features; but then there
are algorithms for high-quality paragraph breaking, which presumably
must be built-in.  This dilemma was not clearly grasped by the author in
1985, and he included a built-in paragraph breaker, with the @Code
"@Break" operator selecting from a fixed set of styles.  A much better
solution based on galleys will be given in Section {@NumberOf 
horizontal},
but, regrettably, it is not implemented.

Anyway, I just looked at the sources ( named, z01.c - z51.c ), and it 
really is very C-ish...

After digging in with grep, I found some of the line-breaker, (in z14.c, 
others may be in z46.c, I am not sure ) and it used a CONSTRAINT type.  
A bit more grepping revealed the definition of CONSTRAINT;

typedef struct
{ FULL_LENGTH  obc;
   FULL_LENGTH  obfc;
   FULL_LENGTH  ofc;
   FULL_LENGTH  osparec;
} CONSTRAINT;

Hmm, obc, obfc and ofc. ...  obuscated, obfuscated and ofuscated?

Of course, TeX is also a joy...but I spent some time a while ago 
figuring out that algorithm.  I should still have those notes around 
somewhere.

Marcel

--
Marcel Weiher				Metaobject Software Technologies
marcel at metaobject.com		www.metaobject.com
Metaprogramming for the Graphic Arts.   HOM, IDEAs, MetaAd etc.




More information about the Squeak-dev mailing list