From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/21484 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Paragraph internal graphic/layout inquiry. Date: Tue, 19 Jul 2005 22:38:32 +0200 Message-ID: <42DD64C8.50905@wxs.nl> References: <42D4C175.5060102@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000408090808070709020102" X-Trace: sea.gmane.org 1121805560 20264 80.91.229.2 (19 Jul 2005 20:39:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 19 Jul 2005 20:39:20 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Tue Jul 19 22:39:19 2005 Return-path: 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 1Duyqx-0004a6-24 for gctc-ntg-context-518@m.gmane.org; Tue, 19 Jul 2005 22:38:11 +0200 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 91ABB1278B; Tue, 19 Jul 2005 22:38:10 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 23443-10; Tue, 19 Jul 2005 22:38:05 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 6239D127B7; Tue, 19 Jul 2005 22:38:05 +0200 (CEST) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id BD8CD127B7 for ; Tue, 19 Jul 2005 22:38:03 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 23279-06 for ; Tue, 19 Jul 2005 22:38:02 +0200 (CEST) Original-Received: from mailrelay01.solcon.nl (maillb.solcon.nl [212.45.32.200]) by ronja.ntg.nl (Postfix) with ESMTP id D43471278B for ; Tue, 19 Jul 2005 22:38:02 +0200 (CEST) Original-Received: from server-1.pragma-net.nl (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by mailrelay01.solcon.nl (8.12.11/SQL-8.12.11-5/8.12.11) with ESMTP id j6JKbsZo016750; Tue, 19 Jul 2005 22:37:54 +0200 Original-Received: by server-1.pragma-net.nl (Postfix, from userid 65534) id 0A0FE314E6; Tue, 19 Jul 2005 21:54:29 +0200 (CEST) Original-Received: from [10.100.1.52] (unknown [10.100.1.52]) by server-1.pragma-net.nl (Postfix) with ESMTP id EEF7317AEB; Tue, 19 Jul 2005 19:54:28 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en Original-To: Mikael Persson , mailing list for ConTeXt users In-Reply-To: X-Virus-Scanned: ClamAV 0.86.1/984/Tue Jul 19 11:16:09 2005 on mailrelay01 X-Virus-Status: Clean X-Virus-Scanned: 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-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on smtp.ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:21484 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:21484 This is a multi-part message in MIME format. --------------000408090808070709020102 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mikael Persson wrote: >Hans, is this something we can expect some nice ConTeXt-ish macros for? > > This is always kind of tricky. Grepping for parshape on my disk gave me an old test file which i wrapped in a preliminary module. I'm not that sure about the interface and I've forgotten how well it performs. (I do have a multi column variant somewhere too.) no guarantees 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 ----------------------------------------------------------------- --------------000408090808070709020102 Content-Type: application/x-tex; name="m-shape.tex" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="m-shape.tex" %D \module %D [ file=m-shape, %D version=2004.08.21, %D title=\CONTEXT\ Modules, %D subtitle=Shapes, %D author={Hans Hagen \& Ton Otten}, %D date=\currentdate, %D copyright={PRAGMA / Hans Hagen \& Ton Otten}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. %D This is a collection of macros dealign with shapes. It's just some %D experimental code, non||optimized and only to be used in controlled %D situations. \unprotect %D Basic parshape builder. \def\buildparshape#1#2#3#4% ntop nshape left right {\scratchcounter#1\relax \advance\scratchcounter #2\relax \advance\scratchcounter #2\relax \advance\scratchcounter \plusone \edef\parshapetemplate{\the\scratchcounter\space}% \dorecurse{#1} {\edef\parshapetemplate{\parshapetemplate\zeropoint\the\hsize}} \dorecurse{#2} {\scratchdimen#3% \edef\parshapetemplate{\parshapetemplate\zeropoint\the\scratchdimen}% \scratchdimen#4% \edef\parshapetemplate{\parshapetemplate\zeropoint\the\scratchdimen}} \edef\parshapetemplate {\parshapetemplate\zeropoint\the\hsize}} %D Example application. \definesystemvariable{sa} \def\setupparshape {\dodoubleargument\getparameters[\??sa]} \setupparshape [\c!left=.5, \c!ntop=0, \c!nbottom=3, \c!distance=1.5em] \long\def\shapedmidbox#1#2% {\bgroup \dontcomplain \forgetall \emergencystretch1em \setbox0\hbox{#1} \getnoflines{\ht0} \count0\noflines \dimen0\wd0 \advance\dimen0 \@@sadistance % \dimen0 == box breedte \advance\count0 \plusone % \count0 == aantal smalle regels \setbox2\vbox {\multiply\dimen0 \plustwo \advance\dimen0 -\hsize \hangindent-\dimen0 \hangafter-\count0 % bij ongelijk, beter parshape \indent#2\par} \getnoflines{\ht2}% \count2\noflines \advance\count2 -\count0 \ifcase0\@@santop\relax \ifcase0\@@sanbottom\relax \ifodd\count2 \divide\count2 \plustwo % \count2 == aantal volle regels boven (ongeveer) \advance\count2 \minusone \else \divide\count2 \plustwo % \count2 == aantal volle regels boven (ongeveer) \fi \else \ifnum\@@sanbottom<\count2 \advance\count2 -\@@sanbottom\relax \fi \fi \else \ifnum\@@santop<\count2 \count2=\@@santop\relax \fi \fi \count4=\count0 \multiply\count4 \plustwo % \count4 == dubbele aantal regels \count6=\count4 \advance\count6 \count2 % \count6 == totaal aantal te shapen lines \advance\count6 \plusone \dimen2=\hsize \advance\dimen2 -\dimen0 \dimen4=\@@saleft\dimen2 % \dimen4 links \dimen6=\dimen2 \advance\dimen6 -\dimen4 % \dimen6 rechts \buildparshape{\count2}{\count0}{\dimen4}{\dimen6}% \setbox4\vbox {\parshape\parshapetemplate\relax\strut\ignorespaces#2\par} \splittopskip\ht\strutbox %[\@@santop,\@@sanbottom,\the\count2] \setbox8\vbox {\offinterlineskip \dorecurse{\count2} {\hbox to\hsize {\setbox2\vsplit4 to \baselineskip \ht2\strutht \dp2\strutdp \box2}} \setbox2\vbox {\dorecurse{\count0} {\hbox to \hsize {\setbox2\vsplit4 to \baselineskip \ht2\strutht \dp2\strutdp \box2 \hss \setbox2\vsplit4 to \baselineskip \ht2\strutht \dp2\strutdp \box2}}} \startoverlay {\box2} {\hbox{\hskip\dimen4\lower.5\dp\strutbox\box0\hskip\dimen6}} \stopoverlay \doloop {\hbox to\hsize {\setbox2\vsplit4 to \baselineskip \ht2\strutht \dp2\strutdp \box2} \ifdim\ht4=\zeropoint\exitloop\fi}} \copy8 \egroup} \protect \doifnotmode{demo}{\endinput} \setuplayout [topspace=2cm, backspace=2cm, margin=0pt, width=middle, header=0pt, footer=0pt, height=middle] \starttext \startbuffer \dorecurse{2}{\input tufte\relax} \stopbuffer \shapedmidbox {\framed[background=screen,width=5cm,height=3cm]{Testje}} {\getbuffer} \shapedmidbox {\framed[background=screen,width=3cm,height=4cm]{Testje}} {\getbuffer} \switchtobodyfont[small] \shapedmidbox {\framed[background=screen,width=5cm,height=3cm]{Testje}} {\getbuffer} \shapedmidbox {\framed[background=screen,width=3cm,height=4cm]{Testje}} {\getbuffer} \shapedmidbox {\framed[background=screen,width=5cm,height=2cm]{Testje}} {\getbuffer} \shapedmidbox {\framed[background=screen,width=4cm,height=3cm]{Testje}} {\getbuffer} \shapedmidbox {\framed[background=screen,width=3cm,height=4cm]{Testje}} {\getbuffer} \shapedmidbox {\framed[background=screen,width=4cm,height=2cm]{Testje}} {\getbuffer} \stoptext --------------000408090808070709020102 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --------------000408090808070709020102--