ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* optical centering...
@ 2011-12-16  1:31 Chris Lott
  2011-12-16  5:22 ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Lott @ 2011-12-16  1:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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?

c
--
Chris Lott <chris@chrislott.org>




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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: optical centering...
  2011-12-16  1:31 optical centering Chris Lott
@ 2011-12-16  5:22 ` Wolfgang Schuster
  2011-12-16  7:11   ` Chris Lott
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2011-12-16  5:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 16.12.2011 um 02:31 schrieb Chris Lott:

> 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?

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: optical centering...
  2011-12-16  5:22 ` Wolfgang Schuster
@ 2011-12-16  7:11   ` Chris Lott
  2011-12-16  9:00     ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Lott @ 2011-12-16  7:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Dec 15, 2011 at 8:22 PM, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
>
> Am 16.12.2011 um 02:31 schrieb Chris Lott:
>
>> 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?

The documentation for the gmverse package probably explains it better
than I can. Here's a direct link:
http://mirror.ctan.org/macros/latex/contrib/gmverse/gmverse.pdf

Thanks!

c
--
Chris Lott
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: optical centering...
  2011-12-16  7:11   ` Chris Lott
@ 2011-12-16  9:00     ` Hans Hagen
  2011-12-16 16:53       ` Chris Lott
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2011-12-16  9:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 16-12-2011 08:11, Chris Lott wrote:
> On Thu, Dec 15, 2011 at 8:22 PM, Wolfgang Schuster
> <schuster.wolfgang@googlemail.com>  wrote:
>>
>> Am 16.12.2011 um 02:31 schrieb Chris Lott:
>>
>>> 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?
>
> The documentation for the gmverse package probably explains it better
> than I can. Here's a direct link:
> http://mirror.ctan.org/macros/latex/contrib/gmverse/gmverse.pdf

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.

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: optical centering...
  2011-12-16  9:00     ` Hans Hagen
@ 2011-12-16 16:53       ` Chris Lott
  2011-12-16 17:26         ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Lott @ 2011-12-16 16:53 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

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.

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

* 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.

I have no idea if the way the package is written is overly complicated
for what it does... I don't really understand the code nearly well
enough, I just know that it works!

Thanks for any input. I can keep using LaTeX for this work, but when I
switch technologies, I tend to learn it by trying to move everything
to it (having recently switched from emacs to vim comes to mind :)

c
--
Chris Lott <chris@chrislott.org>
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: optical centering...
  2011-12-16 16:53       ` Chris Lott
@ 2011-12-16 17:26         ` Wolfgang Schuster
  2011-12-16 17:37           ` Chris Lott
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2011-12-16 17:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen


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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: optical centering...
  2011-12-16 17:26         ` Wolfgang Schuster
@ 2011-12-16 17:37           ` Chris Lott
  2011-12-16 18:26             ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Lott @ 2011-12-16 17:37 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: Mailing list for ConTeXt users, Hans Hagen

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!

c
--
Chris Lott <chris@chrislott.org>
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: optical centering...
  2011-12-16 17:37           ` Chris Lott
@ 2011-12-16 18:26             ` Wolfgang Schuster
  2011-12-17  9:27               ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2011-12-16 18:26 UTC (permalink / raw)
  To: Chris Lott; +Cc: Mailing list for ConTeXt users, Hans Hagen


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.

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: optical centering...
  2011-12-16 18:26             ` Wolfgang Schuster
@ 2011-12-17  9:27               ` Hans Hagen
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2011-12-17  9:27 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: Mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-12-17  9:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-16  1:31 optical centering 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 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).