On 16-12-2011 19:26, Wolfgang Schuster wrote:
Am 16.12.2011 um 18:37 schrieb Chris Lott:
On Fri, Dec 16, 2011 at 8:26 AM, Wolfgang Schuster
wrote: Centered text based on the longest line is simple but when it’s better to make this a feature of the lines environment.
Yeah, but it *isn't* based on the longest line, but on an average of line length. I guess that's why it is call...well, except for the first example in the doc provided, which is what I think your code does.
Though the code you provided is very useful, so thanks!
I showed only it’s not so hard to achieve this feature but with a more complex solution where you check the width of each line you can use different values for the margins.
A teaser for Wolfgang (a few more status dimens in the latest): \definesystemvariable{zv} \def\startverse[#1]% {\begingroup \getparameters[\??zv][\c!align=,#1]% \dostartbuffer[versecontent][startverse][stopverse]} \setvalue{\??zv:\v!flushleft }{\raggedright} \setvalue{\??zv:\v!flushright}{\raggedleft} \setvalue{\??zv:\v!left }{\raggedleft} \setvalue{\??zv:\v!right }{\raggedright} \setvalue{\??zv:\v!middle }{\raggedcenter} \setvalue{\??zv:\v!min }{\leftskip\the\dimexpr(\textwidth-\framedminwidth)/2\relax} \setvalue{\??zv:\v!max }{\leftskip\the\dimexpr(\textwidth-\framedmaxwidth)/2\relax} \setvalue{\??zv:\v!medium }{\leftskip\the\dimexpr(\textwidth-\framedaveragewidth)/2\relax} \def\stopverse {\setbox\scratchbox\hbox\bgroup\framed[width=fit,align=right]\bgroup \startlines \getbuffer[versecontent] \stoplines \egroup\egroup \getvalue{\??zv:\@@zvalign}% \startlines \getbuffer[versecontent] \stoplines \endgroup} % \protect \starttext \showframe \startverse[align=flushleft] ASM rządzi dioda świeci miodowo chrząszcz chrzęści w czcionkach. \stopverse \startverse[align=flushright] ASM rządzi dioda świeci miodowo chrząszcz chrzęści w czcionkach. \stopverse \startverse[align=middle] ASM rządzi dioda świeci miodowo chrząszcz chrzęści w czcionkach. \stopverse \startverse[align=min] ASM rządzi dioda świeci miodowo chrząszcz chrzęści w czcionkach. \stopverse \startverse[align=max] ASM rządzi dioda świeci miodowo chrząszcz chrzęści w czcionkach. \stopverse \startverse[align=medium] ASM rządzi dioda świeci miodowo chrząszcz chrzęści w czcionkach. \stopverse \stoptext I'll think about a pluggable special line alignment in th emain text stream (would be multipass). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------