From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/4200 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Horizontal centering \startlines...\stoplines / poems Date: Thu, 22 Feb 2001 09:47:23 +0100 Sender: owner-ntg-context@let.uu.nl Message-ID: <3.0.6.32.20010222094723.01c6ec30@server-1> References: <008034529071621HAMS4@lvcablemodem.com> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: main.gmane.org 1035394887 23773 80.91.224.250 (23 Oct 2002 17:41:27 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 17:41:27 +0000 (UTC) Cc: ntg-context@ntg.nl Original-To: Steve Lumos In-Reply-To: <008034529071621HAMS4@lvcablemodem.com> Xref: main.gmane.org gmane.comp.tex.context:4200 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:4200 At 11:24 PM 2/21/01 -0800, Steve Lumos wrote: >What I'm wondering is whether there is an automatic way in ConTeXt to >horizontally center a poem (or any fairly long block of short-line, >ragged-right text) on the page. For example I would like to do >something like: One way (there a re couple more) to handle this is to analyze the poem, so let's open up pandora's box: \setupindenting [big] \setuplines [indenting=even] \definehead [FancyPoem] [subject] \setuphead [FancyPoem] [textcommand=\midaligned, textstyle=\ss] \def\startFancyPoem#1% {\def\PoemTitle{\FancyPoem{#1}}% \beginofshapebox \startlines} \def\stopFancyPoem% {\stoplines \endofshapebox \dimen1=0pt \reshapebox {\setbox\scratchbox=\hbox{\unhcopy\shapebox}% \ifdim\wd\scratchbox>\dimen1 \global\dimen1=\wd\scratchbox \fi \unhbox\shapebox} \bgroup \hsize\dimen1 \PoemTitle \egroup \flushshapebox} \starttext \startFancyPoem{SomePoem} Great fleas have little fleas upon their backs to bite 'em And little fleas have lesser fleas, and so ad infinitum, And the great fleas themselves, in turn, have greater fleas to go on, While these again have greater still, and greater still, and so on. \stopFancyPoem \stoptext Of course this is a rather minimal implementation. Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com -------------------------------------------------------------------------