ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Two framed texts on the same line
@ 2005-11-25 11:15 Giuseppe Bilotta
  2005-11-25 13:04 ` Hans Hagen
  2005-11-25 15:12 ` Giuseppe Bilotta
  0 siblings, 2 replies; 7+ messages in thread
From: Giuseppe Bilotta @ 2005-11-25 11:15 UTC (permalink / raw)


Hello, I would like to achieve this kind of typographical
effect: two text blocks, one of them aligned to the left
margin, the other with left-aligned text but with the right
margin at the right margin of the page.

I can obtain each of them with for example the following:

\defineframedtext[lepi][align=raggedright,width=fit,offset=0pt,frame=off,location=left]
\defineframedtext[repi][align=raggedright,width=fit,offset=0pt,frame=off,location=right]

Now, I want them to be "at the same height". However, using
things like placesidebyside or even just \startlepi ...
\stoplepi \startrepi ... \stoprepi  doesn't work.

Any suggestions?

-- 
Giuseppe "Oblomov" Bilotta

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

* Re: Two framed texts on the same line
  2005-11-25 11:15 Two framed texts on the same line Giuseppe Bilotta
@ 2005-11-25 13:04 ` Hans Hagen
  2005-11-25 14:20   ` Re[2]: " Giuseppe Bilotta
  2005-11-25 15:12 ` Giuseppe Bilotta
  1 sibling, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2005-11-25 13:04 UTC (permalink / raw)


Giuseppe Bilotta wrote:

>Hello, I would like to achieve this kind of typographical
>effect: two text blocks, one of them aligned to the left
>margin, the other with left-aligned text but with the right
>margin at the right margin of the page.
>
>I can obtain each of them with for example the following:
>
>\defineframedtext[lepi][align=raggedright,width=fit,offset=0pt,frame=off,location=left]
>\defineframedtext[repi][align=raggedright,width=fit,offset=0pt,frame=off,location=right]
>
>Now, I want them to be "at the same height". However, using
>things like placesidebyside or even just \startlepi ...
>\stoplepi \startrepi ... \stoprepi  doesn't work.
>
>Any suggestions?
>
>  
>
depends a bit on the usage; the following shows you a few tricks

\defineframedtext
  [gb]
  [align=raggedright,
   width=.5\textwidth,
   offset=0pt,
   frame=off,
   before=,
   after=]

\startbuffer[left]
\startgb[none]
\input tufte
\stopgb
\stopbuffer

\startbuffer[right]
\startgb[none]
\input zapf
\stopgb
\stopbuffer

\starttext

\input tufte

\definepairedbox[gb][location={right,top}]

\startbaselinecorrection
\placepairedbox[gb]
  {\getbuffer[left]}
  {\getbuffer[right]}
\stopbaselinecorrection

\input zapf

\stoptext

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

* Re[2]: Two framed texts on the same line
  2005-11-25 13:04 ` Hans Hagen
@ 2005-11-25 14:20   ` Giuseppe Bilotta
  2005-11-25 14:32     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Giuseppe Bilotta @ 2005-11-25 14:20 UTC (permalink / raw)


Friday, November 25, 2005 Hans Hagen wrote:

> depends a bit on the usage; the following shows you a few tricks

> \defineframedtext
>   [gb]
>   [align=raggedright,
>    width=.5\textwidth,
>    offset=0pt,
>    frame=off,
>    before=,
>    after=]

> \startbuffer[left]
> \startgb[none]
> \input tufte
> \stopgb
> \stopbuffer

> \startbuffer[right]
> \startgb[none]
> \input zapf
> \stopgb
> \stopbuffer

> \starttext

> \input tufte

> \definepairedbox[gb][location={right,top}]

> \startbaselinecorrection
> \placepairedbox[gb]
>   {\getbuffer[left]}
>   {\getbuffer[right]}
> \stopbaselinecorrection

> \input zapf

> \stoptext

Oh, interesting this pairedbox thing (it's undocumented,
though). I was hoping to be able to do it like this:

\defineframedtext[lepi][align=raggedright,width=fit,offset=0pt,frame=off,location=left]
\defineframedtext[repi][align=raggedright,width=fit,offset=0pt,frame=off,location=right]
\definepairedbox[epi][location={right,top}]

\placepairedbox[epi]
{\startlepi
{\bf Coordinatore}\par
prof. F.~Nicolosi
\stoplepi}
{\startrepi
{\bf Tutor}\par
prof. G.~Russo
\stoprepi}

But it won't work because the second box (repi) gets placed
with its LEFT margin on the right margin of the page,
whereas I needed to be with its right margin at the right
margin of the page. I think the problem is that, from what I
get by reading the source, in paired boxes are not treated
equally.

Basically, the rpbolem seems to be that the width of the
lepi framed text is not the 'natural width' of the text,
despite the width=fit command ... why is this so?

-- 
Giuseppe "Oblomov" Bilotta

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

* Re: Two framed texts on the same line
  2005-11-25 14:20   ` Re[2]: " Giuseppe Bilotta
@ 2005-11-25 14:32     ` Hans Hagen
  2005-11-25 15:05       ` Re[2]: " Giuseppe Bilotta
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2005-11-25 14:32 UTC (permalink / raw)


Giuseppe Bilotta wrote:

>Friday, November 25, 2005 Hans Hagen wrote:
>
>  
>
>>depends a bit on the usage; the following shows you a few tricks
>>    
>>
>
>  
>
>>\defineframedtext
>>  [gb]
>>  [align=raggedright,
>>   width=.5\textwidth,
>>   offset=0pt,
>>   frame=off,
>>   before=,
>>   after=]
>>    
>>
>
>  
>
>>\startbuffer[left]
>>\startgb[none]
>>\input tufte
>>\stopgb
>>\stopbuffer
>>    
>>
>
>  
>
>>\startbuffer[right]
>>\startgb[none]
>>\input zapf
>>\stopgb
>>\stopbuffer
>>    
>>
>
>  
>
>>\starttext
>>    
>>
>
>  
>
>>\input tufte
>>    
>>
>
>  
>
>>\definepairedbox[gb][location={right,top}]
>>    
>>
>
>  
>
>>\startbaselinecorrection
>>\placepairedbox[gb]
>>  {\getbuffer[left]}
>>  {\getbuffer[right]}
>>\stopbaselinecorrection
>>    
>>
>
>  
>
>>\input zapf
>>    
>>
>
>  
>
>>\stoptext
>>    
>>
>
>Oh, interesting this pairedbox thing (it's undocumented,
>though). I was hoping to be able to do it like this:
>
>\defineframedtext[lepi][align=raggedright,width=fit,offset=0pt,frame=off,location=left]
>\defineframedtext[repi][align=raggedright,width=fit,offset=0pt,frame=off,location=right]
>\definepairedbox[epi][location={right,top}]
>
>\placepairedbox[epi]
>{\startlepi
>{\bf Coordinatore}\par
>prof. F.~Nicolosi
>\stoplepi}
>{\startrepi
>{\bf Tutor}\par
>prof. G.~Russo
>\stoprepi}
>
>But it won't work because the second box (repi) gets placed
>with its LEFT margin on the right margin of the page,
>whereas I needed to be with its right margin at the right
>margin of the page. I think the problem is that, from what I
>get by reading the source, in paired boxes are not treated
>equally.
>  
>
no, you need to bypass the location handling in framed texts

so, replacing left and right by none should do the trick, however, i 
found out that this demands an extra line of code in core-rul.tex (see 
'newer' below)

\def\dodostopframedtext#1#2% % no \baselinecorrection, see faq docs
  {\endgraf
   \removelastskip
   \doifvalue{\??kd#1\c!depthcorrection}\v!on % local and global
     {\forgetall
      \vskip-\struttotal
      \verticalstrut
      \egroup
      \forgetall
      \vskip-\lineheight
      % will be an option, not default
      % \setbaselinecorrections
      % \donegbotbaselinecorrection
      \verticalstrut}
   \stopboxedcontent
   \stopcolor
   \egroup
   \doif{#2}\v!none\insidefloattrue % new
   \doif{\framedtextparameter{#1}\c!location}\v!none\insidefloattrue % 
newer
   \ifinsidefloat
     \box\framebox
   \else
     \doplacement[\??kd#1][\c!depthcorrection=\v!off]{\box\framebox}%
   \fi
   \egroup}

>Basically, the rpbolem seems to be that the width of the
>lepi framed text is not the 'natural width' of the text,
>despite the width=fit command ... why is this so?
>
>  
>
see \doplacement in the previous code, you need to have the then branch; 
placement is for placemen tin the running text (and looks at the text 
width)

Hans

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

* Re[2]: Two framed texts on the same line
  2005-11-25 14:32     ` Hans Hagen
@ 2005-11-25 15:05       ` Giuseppe Bilotta
  0 siblings, 0 replies; 7+ messages in thread
From: Giuseppe Bilotta @ 2005-11-25 15:05 UTC (permalink / raw)


Friday, November 25, 2005 Hans Hagen wrote:

> \def\dodostopframedtext#1#2% % no \baselinecorrection, see faq docs
>   {\endgraf
>    \removelastskip
>    \doifvalue{\??kd#1\c!depthcorrection}\v!on % local and global
>      {\forgetall
>       \vskip-\struttotal
>       \verticalstrut
>       \egroup
>       \forgetall
>       \vskip-\lineheight
>       % will be an option, not default
>       % \setbaselinecorrections
>       % \donegbotbaselinecorrection
>       \verticalstrut}
>    \stopboxedcontent
>    \stopcolor
>    \egroup
>    \doif{#2}\v!none\insidefloattrue % new
>   
> \doif{\framedtextparameter{#1}\c!location}\v!none\insidefloattrue
> % 
> newer
>    \ifinsidefloat
>      \box\framebox
>    \else
>     
> \doplacement[\??kd#1][\c!depthcorrection=\v!off]{\box\framebox}%
>    \fi
>    \egroup}

Hm, strange, I patched core-rul and redumped the format, but
location=none still doesn't work. However, \startlepi[none]
does, so I'll go by this for the time being, thanks.

-- 
Giuseppe "Oblomov" Bilotta

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

* Re: Two framed texts on the same line
  2005-11-25 11:15 Two framed texts on the same line Giuseppe Bilotta
  2005-11-25 13:04 ` Hans Hagen
@ 2005-11-25 15:12 ` Giuseppe Bilotta
  2005-11-25 17:30   ` Hans Hagen
  1 sibling, 1 reply; 7+ messages in thread
From: Giuseppe Bilotta @ 2005-11-25 15:12 UTC (permalink / raw)


For what it's worth, I'm now using the following:


\defineframedtext[lepi][align=raggedright,width=fit,offset=0pt,frame=off,location=none]
\defineframedtext[repi][align=raggedright,width=fit,offset=0pt,frame=off,location=none]
\definepairedbox[lrepi][location={right,top}]

\noindent
\startlepi[none]
\obeylines
{\bf Coordinatore}
prof. F.~Nicolosi
\stoplepi\hfill\startrepi[none]
\obeylines
{\bf Tutor}
prof. G.~Russo
\stoprepi

The [none] spec is required until the location=none
specification is fixed :)

TeX does complain about underfull boxes, but the output is
just what I need.

-- 
Giuseppe "Oblomov" Bilotta

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

* Re: Two framed texts on the same line
  2005-11-25 15:12 ` Giuseppe Bilotta
@ 2005-11-25 17:30   ` Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2005-11-25 17:30 UTC (permalink / raw)


Giuseppe Bilotta wrote:

>For what it's worth, I'm now using the following:
>
>
>\defineframedtext[lepi][align=raggedright,width=fit,offset=0pt,frame=off,location=none]
>\defineframedtext[repi][align=raggedright,width=fit,offset=0pt,frame=off,location=none]
>\definepairedbox[lrepi][location={right,top}]
>
>\noindent
>\startlepi[none]
>\obeylines
>{\bf Coordinatore}
>prof. F.~Nicolosi
>\stoplepi\hfill\startrepi[none]
>\obeylines
>{\bf Tutor}
>prof. G.~Russo
>\stoprepi
>
>The [none] spec is required until the location=none
>specification is fixed :)
>
>TeX does complain about underfull boxes, but the output is
>just what I need.
>
>  
>
ok. to get rid of messages, say \dontcomplain

Hans

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

end of thread, other threads:[~2005-11-25 17:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-25 11:15 Two framed texts on the same line Giuseppe Bilotta
2005-11-25 13:04 ` Hans Hagen
2005-11-25 14:20   ` Re[2]: " Giuseppe Bilotta
2005-11-25 14:32     ` Hans Hagen
2005-11-25 15:05       ` Re[2]: " Giuseppe Bilotta
2005-11-25 15:12 ` Giuseppe Bilotta
2005-11-25 17:30   ` 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).