From: Hans Hagen <pragma@wxs.nl>
To: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
Cc: Mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: optical centering...
Date: Sat, 17 Dec 2011 10:27:54 +0100 [thread overview]
Message-ID: <4EEC609A.9040500@wxs.nl> (raw)
In-Reply-To: <59DF6886-A501-4936-8B93-DB9FB54F41ED@googlemail.com>
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
>> <schuster.wolfgang@googlemail.com> 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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
prev parent reply other threads:[~2011-12-17 9:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-16 1:31 Chris Lott
2011-12-16 5:22 ` Wolfgang Schuster
2011-12-16 7:11 ` Chris Lott
2011-12-16 9:00 ` Hans Hagen
2011-12-16 16:53 ` Chris Lott
2011-12-16 17:26 ` Wolfgang Schuster
2011-12-16 17:37 ` Chris Lott
2011-12-16 18:26 ` Wolfgang Schuster
2011-12-17 9:27 ` Hans Hagen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EEC609A.9040500@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
--cc=schuster.wolfgang@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).