ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Two framed texts on the same line
Date: Fri, 25 Nov 2005 15:32:02 +0100	[thread overview]
Message-ID: <43872062.5060704@wxs.nl> (raw)
In-Reply-To: <1382468175.20051125152004@iol.it>

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

  reply	other threads:[~2005-11-25 14:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-25 11:15 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 [this message]
2005-11-25 15:05       ` Giuseppe Bilotta
2005-11-25 15:12 ` Giuseppe Bilotta
2005-11-25 17:30   ` 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=43872062.5060704@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.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).