ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <pragma@wxs.nl>
Subject: Re: optical centering...
Date: Fri, 16 Dec 2011 18:26:34 +0100	[thread overview]
Message-ID: <68C98C03-7441-4B00-8B45-8C4749517E80@googlemail.com> (raw)
In-Reply-To: <CAHJRaA75ZzaEvZ_XK4V9EMZ=AcAP+zBFxrTjJqcAGR9mko_wzQ@mail.gmail.com>


Am 16.12.2011 um 17:53 schrieb Chris Lott:

> On Fri, Dec 16, 2011 at 12:00 AM, Hans Hagen <pragma@wxs.nl> wrote:
>>>>> I've seen some discussion about creating a verse environment in ConTeXt
>>>>> that handles the alignment of long (broken) lines of text. But I can't find
>>>>> anything about optical centering as can be done in LaTeX using the gmverse
>>>>> package: http://www.ctan.org/pkg/gmverse
>>>>> 
>>>>> Is there something like this available for ConTeXt?
>>>> 
>>>> 
>>>> Can you make a PDF where we can see what do you want?
>> 
>> 
>> That's just a bunch of macro code ... what Wolfgang meant was output that
>> you want to see. Writing from scratch fo rwhat you need is easier that
>> deciphering macro code.
> 
> My apologies, this is what I meant to link to, a TUGboat article which
> has both the formulae for calculating the center and visual
> illustrations of the resulting centering:
> www.tug.org/TUGboat/tb29-1/tb91murzynowski-text.pdf
> 
> The package provides three things, in descending order of importance for me:
> 
> * optical centering, which is a calculation of the center point for
> the alignment of the box of text that is based on based on an average
> of the line lengths of the work being set. gmverse provides four
> different possible centering methods based on different formulae (if
> it matters, method 3 and 2 are most useful.

Centered text based on the longest line is simple but when it’s
better to make this a feature of the lines environment.

\def\startverse
  {\begingroup
   \dostartbuffer[versecontent][startverse][stopverse]}

\def\stopverse
  {\setbox\scratchbox\hbox\bgroup\framed[width=fit,align=right]\bgroup
     \startlines
     \getbuffer[versecontent]
     \stoplines
   \egroup\egroup
   \leftskip\the\dimexpr(\textwidth-\wd\scratchbox)/2\relax
   \startlines
   \getbuffer[versecontent]
   \stoplines
   \endgroup}

\starttext \showframe
\startverse
ASM rządzi
dioda świeci miodowo
chrząszcz chrzęści w czcionkach.
\stopverse
\stoptext

> * Alignment of broken lines, right-aligned to the length of the line
> above the break

I guess Hans can do this when he provides a setting similar to “align=last”.

> * An environment that needs no use of \\ to break lines, but does so
> based on the length of the line and automatically wraps long lines (as
> defined by a dimension) and uses the alignment above.

This is more or less what the lines environment does.

\startlines
line 1
line 2
…
\stoplines

Wolfgang
___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2011-12-16 17:26 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 [this message]
2011-12-16 17:37           ` Chris Lott
2011-12-16 18:26             ` Wolfgang Schuster
2011-12-17  9:27               ` Hans Hagen

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=68C98C03-7441-4B00-8B45-8C4749517E80@googlemail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    --cc=pragma@wxs.nl \
    /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).