Michael J. Downes wrote:
>There is a related kind of justification problem that is used in AMS
>publications: if a figure caption is less than one line in length,
>center it, otherwise use block justification:
>
>  |-----------------------------------------------------------|
>                  Figure 1. A short caption
>
>
>  |-----------------------------------------------------------|
>  Figure 2.  On the other hand  if there is  a long caption the
>  first line  should not be centered,  the whole caption should
>  be full-justified like this.
>
>This is hard to handle by only declarative parameter settings. At some
>level it is necessary to program a test for the length of the text.

No, it isn't. It is sufficient to first try the Figure 2 layout, then count
how many lines it broke into (using \prevgraf), and set it again in the
Figure 1 layout if it turned out to be a single line. With this
implementation, your are probably better off with a declarative interface,
as you can then have a template do all the fiddling with linebreaking
parameters (you'd probably want a large \linepenalty, for example).

Lars Hellström