From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/18927 Path: news.gmane.org!not-for-mail From: h h extern Newsgroups: gmane.comp.tex.context Subject: Re: alignment questions Date: Sun, 13 Mar 2005 19:45:16 +0100 Message-ID: <42348A3C.3060800@wxs.nl> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1110759821 10095 80.91.229.2 (14 Mar 2005 00:23:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 14 Mar 2005 00:23:41 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Mar 14 01:23:40 2005 Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1DAdLm-0006Kd-EE for gctc-ntg-context-518@m.gmane.org; Mon, 14 Mar 2005 01:22:26 +0100 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D1659127E2; Mon, 14 Mar 2005 01:23:22 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 31269-05; Mon, 14 Mar 2005 01:23:20 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 3AF7B127D7; Mon, 14 Mar 2005 00:07:59 +0100 (CET) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 34E81127D7 for ; Mon, 14 Mar 2005 00:07:58 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 30069-04 for ; Mon, 14 Mar 2005 00:07:57 +0100 (CET) Original-Received: from mailrelay02.solcon.nl (maillb.solcon.nl [212.45.32.200]) by ronja.ntg.nl (Postfix) with ESMTP id 30355127D4 for ; Mon, 14 Mar 2005 00:07:57 +0100 (CET) Original-Received: from server-1.pragma-net.nl (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by mailrelay02.solcon.nl (8.12.11/SQL-8.12.11-5/8.12.11) with ESMTP id j2DN7pAk023250 for ; Mon, 14 Mar 2005 00:07:51 +0100 Original-Received: by server-1.pragma-net.nl (Postfix, from userid 65534) id 6182417C21; Sun, 13 Mar 2005 23:52:25 +0100 (CET) Original-Received: from [127.0.0.1] (unknown [10.100.1.1]) by server-1.pragma-net.nl (Postfix) with ESMTP id D1BD017B39 for ; Sun, 13 Mar 2005 22:52:20 +0000 (UTC) User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: X-Virus-Scanned: ClamAV 0.80/705/Fri Feb 11 17:51:32 2005 clamav-milter version 0.80j on mailrelay02 X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: by amavisd-new at ntg.nl X-MailScanner-From: ntg-context-bounces@ntg.nl X-MailScanner-To: gctc-ntg-context-518@m.gmane.org Xref: news.gmane.org gmane.comp.tex.context:18927 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:18927 Patrick Gundlach wrote: > Hello *, > > > inspired by Gerben's question, I did some experimenting with \framed. > > I'd like to get A[text]B, where text is some long thing in a framed > box like \framed[width=5cm] {\input tufte \par}. > > There are three different ways of aligning the three objects: > > > (A and B on the same baseline as the first row) > > A We thrive in information- B > ------------------------------- > thick worlds because of our > marvelous and everyday ca- > > > (A and B in the middle of the box, not necessarily on the same > baseline as a line in the box) > > criminate, distinguish, screen, > A pigeonhole, pick over, sort, B > integrate, blend, inspect, > > > (A and B on the same baseline as the last row) > > from the chaff and seperate > A the sheeps from the goats. B > -------------------------------- > > > > I was unable to get any of these alignments. one way is to put things in a box and do some measuring and such; however, then you need to know a bit about the position of the baseline (measurethe middle box, and use a dummy framed around A and B with that height set etc) the other way is to use the following extensions (i made the dislocator installable so that you can hook in your own code if needed) \unprotect \def\stoplocalframed {\dontshowcomposition \@@stopframedorientation \ifboxhasformat \ifx\localwidth\v!fit \ifreshapeframebox\doreshapeframedbox\fi \boxhaswidthfalse \else\ifx\localwidth\v!fixed \boxhaswidthfalse \else \resetshapeframebox \fi\fi \else \resetshapeframebox \fi \ifboxhaswidth \wd\framebox\!!widtha \fi \ifboxhasheight \ht\framebox\!!heighta \fi \doifvalue{\@@framed\c!empty}\v!yes {\setbox\scratchbox\null \wd\scratchbox\wd\framebox \ht\scratchbox\ht\framebox \dp\scratchbox\dp\framebox \setbox\framebox\box\scratchbox}% \stopregistercolor \docolorframebox \ifboxhasoffset \dooffsetframebox \fi \ifboxisoverlaid \else \dolocateframebox \fi \ifx\postprocessframebox\relax \else \let\next\postprocessframebox \let\postprocessframebox\relax % prevent nesting \next\framebox \fi \edef\overlaylinecolor{\framedparameter\c!framecolor}% \edef\overlaylinewidth{\the\ruledlinewidth}% \@@... \ifboxhasframe % real or invisible frame \doframedbox \fi \doifvaluesomething{\@@framed\c!background}\dobackedbox \handleframedlocator\@@locallocation \box\framebox \egroup \egroup} \def\installframedlocator#1#2% {\setvalue{\??ol:\c!location:#1}{#2}} \def\handleframedlocator#1% {\getvalue{\??ol:\c!location:#1}} \def\doprelocframedbox#1% {\scratchdimen#1\relax \advance\scratchdimen \ruledlinewidth \ifboxhasoffset \advance\scratchdimen \framedparameter\c!offset \fi \scratchskip\ht\framebox \advance\scratchskip-\scratchdimen} \installframedlocator \v!hanging % best with strut=no {\dp\framebox\ht\framebox \ht\framebox\zeropoint} \installframedlocator \v!depth {\scratchdimen\ht\framebox \advance\scratchdimen -\strutdp \ht\framebox\scratchdimen \dp\framebox\strutdp \box\framebox} \installframedlocator \v!height {\scratchdimen\ht\framebox \advance\scratchdimen -\strutht \ht\framebox\strutht \dp\framebox\scratchdimen \box\framebox} \installframedlocator \v!high {\doprelocframedbox\strutht \setbox\framebox\hbox{\lower\scratchskip\box\framebox}% \ht\framebox\strutht \dp\framebox\strutdp \hbox{\box\framebox}} \installframedlocator \v!line {\setbox\framebox\hbox{\lower.5\ht\framebox\box\framebox}% \ht\framebox.5\lineheight \dp\framebox.5\lineheight \hbox{\box\framebox}} \installframedlocator \v!low {\doprelocframedbox\strutdp \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}% \ht\framebox\strutht \dp\framebox\strutdp \box\framebox} \installframedlocator \v!top {\doprelocframedbox\strutht \setbox\framebox\hbox{\lower\scratchskip\box\framebox}% \ht\framebox\scratchdimen \dp\framebox\scratchskip \hbox{\box\framebox}} \installframedlocator \v!middle {\scratchdimen.5\ht\framebox \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}% \ht\framebox\scratchdimen \dp\framebox\scratchdimen \hbox{\box\framebox}} \installframedlocator \v!lohi {\handleframedlocator\v!middle} \installframedlocator \v!bottom {\doprelocframedbox\strutdp \setbox\framebox\hbox{\lower\scratchdimen\box\framebox}% \ht\framebox\scratchskip \dp\framebox\scratchdimen \hbox{\box\framebox}} \starttext \ruledhbox {A \framed[width=2cm,align=middle,location=hanging]{location\\equals\\hanging} \framed[width=2cm,align=middle,location=depth] {location\\equals\\depth} \framed[width=2cm,align=middle,location=height] {location\\equals\\height} B} \vskip2cm \ruledhbox {A \framed[width=2cm,align=middle,location=low] {location\\equals\\low} \framed[width=2cm,align=middle,location=line] {location\\equals\\line} \framed[width=2cm,align=middle,location=high] {location\\equals\\high} B} \vskip2cm \ruledhbox {A \framed[width=2cm,align=middle,location=top] {location\\equals\\top} \framed[width=2cm,align=middle,location=bottom] {location\\equals\\bottom} \framed[width=2cm,align=middle,location=lohi] {location\\equals\\lohi} \framed[width=2cm,align=middle,location=middle] {location\\equals\\middle} B} \stoptext (hanging, depth and low were already present) check for compatibility -) 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 -----------------------------------------------------------------