ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* typing midaligned
@ 2006-05-05 16:03 Peter Münster
  2006-05-06  7:42 ` Taco Hoekwater
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Münster @ 2006-05-05 16:03 UTC (permalink / raw)


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?

Cheers, Peter

-- 
http://pmrb.free.fr/contact/

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

* Re: typing midaligned
  2006-05-05 16:03 typing midaligned Peter Münster
@ 2006-05-06  7:42 ` Taco Hoekwater
  2006-05-06  8:32   ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Taco Hoekwater @ 2006-05-06  7:42 UTC (permalink / raw)


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

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

* Re: typing midaligned
  2006-05-06  7:42 ` Taco Hoekwater
@ 2006-05-06  8:32   ` Hans Hagen
  2006-05-06 13:58     ` Peter Münster
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2006-05-06  8:32 UTC (permalink / raw)


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

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

* Re: typing midaligned
  2006-05-06  8:32   ` Hans Hagen
@ 2006-05-06 13:58     ` Peter Münster
  2006-05-07 18:09       ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Münster @ 2006-05-06 13:58 UTC (permalink / raw)


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/

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

* Re: typing midaligned
  2006-05-06 13:58     ` Peter Münster
@ 2006-05-07 18:09       ` Hans Hagen
  2006-05-08  7:03         ` Peter Münster
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2006-05-07 18:09 UTC (permalink / raw)


� 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

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

* Re: typing midaligned
  2006-05-07 18:09       ` Hans Hagen
@ 2006-05-08  7:03         ` Peter Münster
  2006-05-08 12:06           ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Münster @ 2006-05-08  7:03 UTC (permalink / raw)


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/

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

* Re: typing midaligned
  2006-05-08  7:03         ` Peter Münster
@ 2006-05-08 12:06           ` Hans Hagen
  2006-05-08 21:32             ` Peter Münster
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2006-05-08 12:06 UTC (permalink / raw)


� 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

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

* Re: typing midaligned
  2006-05-08 12:06           ` Hans Hagen
@ 2006-05-08 21:32             ` Peter Münster
  2006-05-09 12:37               ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Münster @ 2006-05-08 21:32 UTC (permalink / raw)


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/

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

* Re: typing midaligned
  2006-05-08 21:32             ` Peter Münster
@ 2006-05-09 12:37               ` Hans Hagen
  2006-05-09 16:07                 ` Peter Münster
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2006-05-09 12:37 UTC (permalink / raw)


� 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

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

* Re: typing midaligned
  2006-05-09 12:37               ` Hans Hagen
@ 2006-05-09 16:07                 ` Peter Münster
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Münster @ 2006-05-09 16:07 UTC (permalink / raw)


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/

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

end of thread, other threads:[~2006-05-09 16:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-05 16:03 typing midaligned Peter Münster
2006-05-06  7:42 ` Taco Hoekwater
2006-05-06  8:32   ` Hans Hagen
2006-05-06 13:58     ` Peter Münster
2006-05-07 18:09       ` Hans Hagen
2006-05-08  7:03         ` Peter Münster
2006-05-08 12:06           ` Hans Hagen
2006-05-08 21:32             ` Peter Münster
2006-05-09 12:37               ` Hans Hagen
2006-05-09 16:07                 ` Peter Münster

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