Geometry Manager

Code routine that automatically positions widgets in a GraphicalUserInterface.

One example I can think of is SpringsAndStruts.

TclTk and its derivatives, such as GTK+ (GtkPlus), do this type of stuff. Make application interfaces easy. Sometimes though, I want to make a fixed size program and set everything up myself. GTK+ makes that harder than need be.

HyperTextMarkupLanguage manages geometry. Not well.. not usefully... but it does (sorta).

Would Display PostScript (from NextStep) count?


Regarding SpringsAndStruts, the NextStep (and now MacOsx) InterfaceBuilder tool has this feature too. Actually, I'd like to see (or perhaps write) a GeometryManager that mimics the boxes and glue of TeX, where different glues can have different orders of infinity [affinity?] in their stretchability and shrinkability. You'd have to use it to understand why it's important. -- EricJablow

I meant infinity. In TeX, glues (or rubber lengths) have a natural length, a stretch component, and a shrink component. For example (from the Plain TeX code)

  \abovedisplayskip=12pt plus 3pt minus 9pt

defines how much space should appear above a display (a floating table, etc.) The natural length is 12pt, it can be extended to 15pt without the TeX engine screaming too loudly, and can be shrunk to 3pt if necessary. (Actually, the engine will go past 15pt if really really necessary, though it complains very loudly). The space character may be defined (depending on the current font) to provide 4pt plus 1pt minus 0.5pt of space, for example. When the engine fills a box, it adds up the natural lengths, the stretches, and the shrinks, and it decides how big to make the box and chooses lengths appropriately. For paragraphs, it breaks the lines up in various ways, computes scores for each set of line breaks, and chooses the best.

However, the stretch and shrink components can be denominated in 3 different orders of infinity: fil, fill, and filll. When a box has infinite stretch in it, all finite stretch is ignored. For example, the end of a paragraph has \parfillskip added on automatically:

  \parfillskip=0pt plus 1fil

The natural length is zero, but it can stretch to the right as much as necessary. The last line of a paragraph uses its natural lengths for everything else. What if you wanted to center the line instead?

\hfill provides natural length 0pt but 1fill worth of stretch, and the centering commands do the equivalent of

  \hfill The line.\hfill

Adding the \parfillskip doesn't matter, because the \hfill comands provide a higher order of infinite stretch, and override the \parfillskip.

So, to do what Laurent mentions below, one writes:

  \hfill A\hfill B\hfill

The space will be allocated evenly before A, between A and B, and after B. Similarly,

  \hfill\hfill A\hfill

will put the letter A 2/3 of the way along a line.

Sorry about the excess detail. --EricJablow

Definitely. It's entirely beyond me why the TeX model for page layout wasn't adopted as a standard conceptual model by every system concerned with layout ever since, from HTML to Word to XSL/FO. Just about the only things you can do with a box nowadays is center it, or position it to pixel precision - but simply distributing two boxes along a line so that the remaining whitespace is evenly proportioned is beyond most of the programs I can think of. -- LaurentBossavit

What changes would you make to the TeX model to avoid the problem of (in TeX terms) overfull boxes? Also, how would you handle discretization error? -- EricJablow


See Also: CoordinateVersusNestedGui


EditText of this page (last edited November 9, 2009) or FindPage with title or text search