Re: [NTG-context] typing midaligned

2006-05-06 Thread Taco Hoekwater
Peter Münster wrote:
> Hello,
> such things are really easy and straightforward with LaTeX (parbox and
> minipage), but with ConTeXt I have still a lot of difficulties. This is
> what I do to align some typing in the middle:
> 
> \starttext
> \input tufte
> 
> \setuptyping[before=\vskip-\lineheight,after=\vskip-0.13\lineheight]
> \startalignment[middle]
> \dontleavehmode
> \framed[align=lohi,frame=off]{%
> \starttyping
> bla bla bla
> bla bla bla bla bla bla bla bla bla
> \stoptyping
> }
> \stopalignment
> \input tufte
> \stoptext
> 
> The result is correct, but can't this be done much easier?

I've been staring at this for a while now. I would have expected
this to work:

  \setuptyping
 [before={\startframedtext
[width=fit,align=lohi,frame=off,location=middle]},
  after={\stopframedtext}]
  \starttyping
  bla bla bla
  bla bla bla bla bla bla bla bla bla
  \stoptyping

but it doesn't.

Cheers, Taco
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] typing midaligned

2006-05-06 Thread Hans Hagen
Taco Hoekwater wrote:
> Peter M�nster wrote:
>   
>> Hello,
>> such things are really easy and straightforward with LaTeX (parbox and
>> minipage), but with ConTeXt I have still a lot of difficulties. This is
>> what I do to align some typing in the middle:
>>
>> \starttext
>> \input tufte
>>
>> \setuptyping[before=\vskip-\lineheight,after=\vskip-0.13\lineheight]
>> \startalignment[middle]
>> \dontleavehmode
>> \framed[align=lohi,frame=off]{%
>> \starttyping
>> bla bla bla
>> bla bla bla bla bla bla bla bla bla
>> \stoptyping
>> }
>> \stopalignment
>> \input tufte
>> \stoptext
>>
>> The result is correct, but can't this be done much easier?
>> 
>
> I've been staring at this for a while now. I would have expected
> this to work:
>
>   \setuptyping
>  [before={\startframedtext
> [width=fit,align=lohi,frame=off,location=middle]},
>   after={\stopframedtext}]
>   \starttyping
>   bla bla bla
>   bla bla bla bla bla bla bla bla bla
>   \stoptyping
>
> but it doesn't.
>   
you mean that you want centered verbatim? 

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] typing midaligned

2006-05-06 Thread Peter Münster
On Sat, 6 May 2006, Hans Hagen wrote:

> you mean that you want centered verbatim? 

Yes!
A very nice solution would be:
\starttyping[location=middle] or \setuptyping[location=middle]
Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] typing midaligned

2006-05-07 Thread Hans Hagen
� wrote:
> On Sat, 6 May 2006, Hans Hagen wrote:
>
>   
>> you mean that you want centered verbatim? 
>> 
>
> Yes!
> A very nice solution would be:
> \starttyping[location=middle] or \setuptyping[location=middle]
>   
\starttext

\setuptyping
  [before={\startframedtext[strut=no,width=fit,align={lohi,middle}]},
   after={\stopframedtext}]

\starttyping
bla bla bla
bla bla bla bla bla bla bla bla bla
\stoptyping


\stoptext


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] typing midaligned

2006-05-08 Thread Peter Münster
On Sun, 7 May 2006, Hans Hagen wrote:

> ? wrote:
> > On Sat, 6 May 2006, Hans Hagen wrote:
> >
> >   
> >> you mean that you want centered verbatim? 
> >> 
> >
> > Yes!
> > A very nice solution would be:
> > \starttyping[location=middle] or \setuptyping[location=middle]
> >   
> \starttext
> 
> \setuptyping
>   [before={\startframedtext[strut=no,width=fit,align={lohi,middle}]},
>after={\stopframedtext}]

Hello Hans,
with align=middle, the typing is aligned line by line. What I'm looking for
is this:

normal text in a paragraph, normal text in a paragraph, normal  text in a
paragraph, normal text in a paragraph, normal text in a paragraph, normal
text  in a  paragraph,  normal  text  in  a paragraph,  normal  text in a
paragraph, normal text in a paragraph, normal text in a paragraph
on line of typing
second line of typing but longer
normal text in a paragraph, normal text in a paragraph, normal  text in a
paragraph, normal text in a paragraph, normal text in a paragraph, normal
text  in a  paragraph,  normal  text  in  a paragraph,  normal  text in a
paragraph, normal text in a paragraph, normal text in a paragraph

Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] typing midaligned

2006-05-08 Thread Hans Hagen
� wrote:
> On Sun, 7 May 2006, Hans Hagen wrote:
>
>   
>> ? wrote:
>> 
>>> On Sat, 6 May 2006, Hans Hagen wrote:
>>>
>>>   
>>>   
 you mean that you want centered verbatim? 
 
 
>>> Yes!
>>> A very nice solution would be:
>>> \starttyping[location=middle] or \setuptyping[location=middle]
>>>   
>>>   
>> \starttext
>>
>> \setuptyping
>>   [before={\startframedtext[strut=no,width=fit,align={lohi,middle}]},
>>after={\stopframedtext}]
>> 
>
> Hello Hans,
> with align=middle, the typing is aligned line by line. What I'm looking for
> is this:
>
> normal text in a paragraph, normal text in a paragraph, normal  text in a
> paragraph, normal text in a paragraph, normal text in a paragraph, normal
> text  in a  paragraph,  normal  text  in  a paragraph,  normal  text in a
> paragraph, normal text in a paragraph, normal text in a paragraph
> on line of typing
> second line of typing but longer
> normal text in a paragraph, normal text in a paragraph, normal  text in a
> paragraph, normal text in a paragraph, normal text in a paragraph, normal
> text  in a  paragraph,  normal  text  in  a paragraph,  normal  text in a
> paragraph, normal text in a paragraph, normal text in a paragraph
>   
\starttext
\setuptyping[margin=3cm]
test

\starttyping
test
\stoptyping

\stoptext
-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] typing midaligned

2006-05-09 Thread Peter Münster
On Mon, 8 May 2006, Hans Hagen wrote:

> ? wrote:
> > On Sun, 7 May 2006, Hans Hagen wrote:
> >
> >> ? wrote:
> >> 
> >>> On Sat, 6 May 2006, Hans Hagen wrote:
> >>>   
>  you mean that you want centered verbatim? 
>  
> >>> Yes!
> >>> A very nice solution would be:
> >>> \starttyping[location=middle] or \setuptyping[location=middle]
> >>>   
> >> \starttext
> >> \setuptyping
> >>   [before={\startframedtext[strut=no,width=fit,align={lohi,middle}]},
> >>after={\stopframedtext}]
> >
> > Hello Hans,
> > with align=middle, the typing is aligned line by line. What I'm looking for
> > is this:
> >
> > normal text in a paragraph, normal text in a paragraph, normal  text in a
> > paragraph, normal text in a paragraph, normal text in a paragraph, normal
> > text  in a  paragraph,  normal  text  in  a paragraph,  normal  text in a
> > paragraph, normal text in a paragraph, normal text in a paragraph
> > on line of typing
> > second line of typing but longer
> > normal text in a paragraph, normal text in a paragraph, normal  text in a
> > paragraph, normal text in a paragraph, normal text in a paragraph, normal
> > text  in a  paragraph,  normal  text  in  a paragraph,  normal  text in a
> > paragraph, normal text in a paragraph, normal text in a paragraph
> >   
> \starttext
> \setuptyping[margin=3cm]

Hello Hans,
I don't understand, it's still not centred...
Or do you mean, I have to put the typing into a box,
measure the width of the box, and then calculate the
right margin ((\textwidth - \typingwidth) / 2) ?

Greetings, Peter

-- 
http://pmrb.free.fr/contact/
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] typing midaligned

2006-05-09 Thread Hans Hagen
� wrote:
>
> Hello Hans,
> I don't understand, it's still not centred...
> Or do you mean, I have to put the typing into a box,
> measure the width of the box, and then calculate the
> right margin ((\textwidth - \typingwidth) / 2) ?
>
>   
indeed this is teh only way since in typing each line is a par 

Hans 

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] typing midaligned

2006-05-09 Thread Peter Münster
On Tue, 9 May 2006, Hans Hagen wrote:

> ? wrote:
> >
> > I don't understand, it's still not centred...
> > Or do you mean, I have to put the typing into a box,
> > measure the width of the box, and then calculate the
> > right margin ((\textwidth - \typingwidth) / 2) ?
> >   
> indeed this is teh only way since in typing each line is a par 

Ok, this seems to work:

\def\startTypeMidaligned{%
  \dostartbuffer[typemidaligned][startTypeMidaligned][stopTypeMidaligned]}
\def\stopTypeMidaligned{\setuptyping[margin=0pt]%
  \setbox\scratchbox\hbox{%
\framed[frame=off,offset=overlay,align=lohi]{\typebuffer[typemidaligned]}}%
  \setuptyping[margin=\dimexpr (\textwidth - \wd\scratchbox) / 2 \relax]%
  \typebuffer[typemidaligned]}
\starttext
\input tufte
\startTypeMidaligned
bla bla bla
bla bla bla bla bla bla bla bla bla bla bla
\stopTypeMidaligned
\input tufte
\startTypeMidaligned
bla bla bla
blub
\stopTypeMidaligned
\input tufte
\stoptext

Can be wikified ;)
Cheers, Peter

-- 
http://pmrb.free.fr/contact/
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context