From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/52243 Path: news.gmane.org!not-for-mail From: Andreas Harder Newsgroups: gmane.comp.tex.context Subject: Re: =?windows-1252?q?loop_textext_and_=5CMPstring=7B=85?= =?windows-1252?q?=7D?= Date: Wed, 12 Aug 2009 16:53:31 +0200 Message-ID: <4409ACEE-4337-45DC-8DC2-9EEC858B8C5C@uni-koblenz.de> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v936) Content-Type: multipart/mixed; boundary=Apple-Mail-3--948811773 X-Trace: ger.gmane.org 1250088830 15898 80.91.229.12 (12 Aug 2009 14:53:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Aug 2009 14:53:50 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Aug 12 16:53:43 2009 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.50) id 1MbFCv-0004O7-73 for gctc-ntg-context-518@m.gmane.org; Wed, 12 Aug 2009 16:53:41 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 87866C9A4A; Wed, 12 Aug 2009 16:53:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id G1pBgulj8dlp; Wed, 12 Aug 2009 16:53:36 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0AFDAC9A81; Wed, 12 Aug 2009 16:53:36 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 08DB1C9A90 for ; Wed, 12 Aug 2009 16:53:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IWpKJpAjYyY8 for ; Wed, 12 Aug 2009 16:53:32 +0200 (CEST) Original-Received: from deliver.uni-koblenz.de (deliver.uni-koblenz.de [141.26.64.15]) by balder.ntg.nl (Postfix) with ESMTP id C07BEC9A81 for ; Wed, 12 Aug 2009 16:53:32 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 95760789A6EE for ; Wed, 12 Aug 2009 16:53:32 +0200 (CEST) Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 16036-05 for ; Wed, 12 Aug 2009 16:53:31 +0200 (CEST) X-CHKRCPT: Envelopesender vrfy aharder@uni-koblenz.de Original-Received: from [192.168.1.102] (unknown [95.88.47.93]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTP id BBB4C789A48F for ; Wed, 12 Aug 2009 16:53:31 +0200 (CEST) In-Reply-To: X-Mailer: Apple Mail (2.936) X-Virus-Scanned: amavisd-new at uni-koblenz.de X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:52243 Archived-At: --Apple-Mail-3--948811773 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Am 12.08.2009 um 15:25 schrieb Aditya Mahajan: > On Wed, 12 Aug 2009, Andreas Harder wrote: > >> >> Am 12.08.2009 um 07:40 schrieb Aditya Mahajan: >> >>> On Tue, 11 Aug 2009, Andreas Harder wrote: >>>> Hi, >>>> I am trying to achieve the following: >>>> \setMPtext{1}{ABC} >>>> \setMPtext{2}{DEF} >>>> \setMPtext{3}{GHI} >>>> \starttext >>>> \startMPpage[offset=3D1ex,width=3D\paperwidth,height=3D\paperheight] >>>> for i=3D1 upto 3: >>>> draw textext(\MPstring{i}) shifted(i*cm,i*cm) ; >>>> endfor; >>>> \stopMPpage >>>> \stoptext >>>> There is no error but no content either. What's wrong? >>> Another way to do this is to use >>> \TeXtext{1}{ABC} etc. >>> and then call >>> draw sometxt(i) >>> For Sec 4.5 of Mojca's my way on sometxt = http://dl.contextgarden.net/myway/sometxt.pdf >> >> Thank you for the tip, I tried it, but sometext seems deprecated in =20= >> mkiv ("[do we need TeXtexts in MkIV]"). > > I thought that you were using MKII. > >> I've different buffers named 1=9612 and would like to pipe them to =20= >> Metapost. I thought I could use a textext(\getbuffer[i])-construct, =20= >> it failed. So I tried it with \setMPtext{}{} =85 >> >> What is the approach to achieve this? > > Well, if nothing else works, you can always cheat. > > \startluacode > userdata =3D userdata or {} > userdata.labels =3D { > [1] =3D "ABC" , > [2] =3D "DEF" , > [3] =3D "GHI" } > > function userdata.shift(i) > return "(" .. i .. "cm ," .. i .. "cm )" > end > > function userdata.draw(i) > return "draw btex " .. userdata.labels[i] .. " etex shifted ".. =20= > userdata.shift(i) .. ";" > end > > \stopluacode > > \starttext > > \startluacode > context.startMPpage({offset =3D "1ex", width =3D [[\paperwidth]], =20 > height =3D [[\paperheight]]}) > for i =3D 1,3 do > context(userdata.draw(i)) > end > context.stopMPpage() > \stopluacode > > \stoptext Thank you, very nice. In the "real world=93 I've stripped quotes form another document and =20 stored them in buffer-environments (attachment). With your solution =20 I've no idea how to incorporate them in a "automatic" manner. --Apple-Mail-3--948811773 Content-Disposition: attachment; filename=MP-random-textboxes2.tex Content-Type: application/x-tex; x-unix-mode=0644; name="MP-random-textboxes2.tex" Content-Transfer-Encoding: quoted-printable %=20<>=20=0A=0A\mainlanguage[de]=0A=0A= \setuplayout[middle]=0A=0A%%=20Buffer=20mit=20Zitaten=0A=0A= \startbuffer[1]=0A=20=20Ohne=20Enthusiasmus=20keine=20Mathematik!\hfill=20= \mbox{(J.\kern=0A=20=20=20=20+.1667em\relax=20W.=20von=20Goethe)}\par=0A= \stopbuffer=0A=0A\startbuffer[2]=0A=20=20Es=20gibt=20Dinge,=20die=20den=20= meisten=20Menschen=20unglaublich=20erscheinen,=20die=0A=20=20nicht=20= Mathematik=20studiert=20haben.\hfill=20\mbox{(Archimedes,=20ca.=0A=20=20=20= =20285--212=20v.\kern=20+.1667em\relax=20Chr.)}\par=0A\stopbuffer=0A=0A= \startbuffer[3]=0A=20=20Reden=20lernt=20man=20durch=20Reden.=20Beweisen=20= lernt=20man=20durch=20Beweisen=0A=20=20\hfill=20\mbox{(mathem.=20= Folklore)}\par=0A\stopbuffer=0A=0A\startbuffer[4]=0A=20=20In=20der=20= Mathematik=20gibt=20es=20keine=20Autorit=C3=A4ten.=20Das=20einzige=20= Argument=0A=20=20f=C3=BCr=20die=20Wahrheit=20ist=20der=20Beweis.=20= \hfill=20\mbox{(K.=20Urbanik)}\par=0A\stopbuffer=0A=0A\startbuffer[5]=0A=20= =20Die=20erste=20Regel,=20an=20die=20man=20sich=20in=20der=20Mathematik=20= halten=20muss,=20ist,=0A=20=20exakt=20zu=20sein.=20Die=20zweite=20Regel=20= ist,=20klar=20und=20deutlich=20zu=20sein=20und=0A=20=20nach=20= M=C3=B6glichkeit=20einfach.\hfill=20\mbox{(L.\kern=20+.1667em\relax=0A=20= =20=20=20N.\kern=20+.1667em\relax=20M.=20Carnot)}\par=0A\stopbuffer=0A=0A= \startbuffer[6]=0A=20=20Vergesst=20nicht:=20Wenn=20ihr=20schwimmen=20= lernen=20wollt,=20dann=20geht=20mutig=20ins=0A=20=20Wasser,=20wenn=20ihr=20= lernen=20wollt,=20Aufgaben=20zu=20l=C3=B6sen,=20dann=20l=C3=B6st=0A=20=20= sie.\hfill=20\mbox{(G.=20Polya)}\par=0A\stopbuffer=0A=0A\startbuffer[7]=0A= =20=20Niemand=20soll=20uns=20aus=20dem=20Paradies=20(der=20= Mengentheorie)=20vertreiben,=0A=20=20das=20Cantor=20f=C3=BCr=20uns=20= erschaffen=20hat.\hfill=20\mbox{(D.=20Hilbert=0A=20=20=20=20= 1862--1943)}\par=0A\stopbuffer=0A=0A\startbuffer[8]=0A=20=20Wenn=20$A$=20= gleich=20Erfolg=20ist,=20dann=20gilt=20die=20Formel=20$A=20=3D=20x+y+z$;=20= $x$=0A=20=20ist=20Arbeit,=20$y$=20ist=20Vergn=C3=BCgen,=20$z$=20ist=20= Mund=20halten.\hfill=20\mbox{(A.=0A=20=20=20=20Einstein=20= 1879--1955)}\par=0A\stopbuffer=0A=0A\startbuffer[9]=0A=20=20Wenn=20ich=20= ungl=C3=BCcklich=20bin,=20betreibe=20ich=20Mathematik,=20um=20gl=C3=BCckli= ch=20zu=0A=20=20werden.=20Wenn=20ich=20gl=C3=BCcklich=20bin,=20betreibe=20= ich=20Mathematik,=20um=0A=20=20gl=C3=BCcklich=20zu=20bleiben.\hfill=20= \mbox{(Alfred=20Renyi=0A=20=20=20=201921--1970)}\par=0A\stopbuffer=0A=0A= \startbuffer[10]=0A=20=20Lernen=20ohne=20zu=20denken=20ist=20eitel.=20= Denken=20ohne=20zu=20lernen=20ist=0A=20=20gef=C3=A4hrlich.\hfill=20= \mbox{(Konfuzius=20551--479=20v.\kern=20+.1667em\relax=0A=20=20=20=20= Chr.)}\par=0A\stopbuffer=0A=0A\startbuffer[11]=0A=20=20Mathematik=20ist=20= die=20Wissenschaft=20der=20jungen=20Leute.=20Es=20kann=20gar=20nicht=0A=20= =20anders=20sein.=20Mathematik=20ist=20eine=20solche=20Gymnastik=20f=C3=BC= r=20den=20Verstand,=0A=20=20dass=20man=20daf=C3=BCr=20die=20ganze=20= Flexibilit=C3=A4t=20und=20Ausdauer=20der=20Jugend=0A=20=20= ben=C3=B6tigt.\hfill=20\mbox{(N.=20Wiener=201894--1964)}\par=0A= \stopbuffer=0A=0A\startbuffer[12]=0A=20=20Das=20Leben=20ist=20nur=20f=C3=BC= r=20zwei=20Dinge=20gut:=20Mathematik=20zu=20entdecken=20und=0A=20=20= Mathematik=20zu=20lernen.\hfill=20\mbox{(S.-D.=20Poisson=20= 1781--1840)}\par=0A\stopbuffer=0A=0A=0A= \dorecurse{12}{\setMPtext{\recurselevel}{\getbuffer[\recurselevel]}}=0A=20= =20=0A=0A\startuseMPgraphic{boxen}=0A=20=20u:=3D1cm=20;=20=20pair=20= punkt;=20picture=20pic;=20=20path=20box;=0A=20=20=0A=20=20width=20:=3D=20= \the\hsize/3=20;=20w=20:=3D=20.7width=20;=0A=20=20height:=3D=20= \the\vsize/4=20;=20h=20:=3D=20.7height;=0A=20=20=0A=20=20box=20:=3D=20= unitsquare=20xscaled=20w=20yscaled=20h=20;=0A=0A=20=20k:=3D0;=0A=20=20= for=20i=3D0=20upto=203:=0A=20=20=20=20for=20j=3D0=20upto=202:=0A=20=20=20= =20=20=20punkt=20:=3D=20(j*width=20+=20uniformdeviate=2050,=20i*height=20= -=20uniformdeviate=2050)=20;=0A=20=20=20=20=20=20k=20:=3D=20k+1;=0A=20=20= =20=20=20=20label(decimal=20k,=20center=20box=20shifted=20punkt)=20;=0A=20= =20=20=20=20=20pic=20:=3D=20= textext("\framed[width=3D4cm,height=3D2cm,align=3Dright]{\MPtext{i}}")=20= ;=20%=20this=20won't=20work=20as=20{i}=20is=20not=20expanded=20at=20the=20= right=20moment=0A=20=20=20=20=20=20draw=20pic=20shifted=20center=20box=20= shifted=20punkt=20;=0A=20=20=20=20endfor;=0A=20endfor;=0A= \stopuseMPgraphic=0A=0A=0A= \defineoverlay[Hintergrund]{\useMPgraphic{boxen}}=0A=0A= \setupbackgrounds[text][background=3DHintergrund]=0A=0A=0A\starttext=20= \showframe=0A=0A\stoptext=0A=0A%%%=20Local=20Variables:=20=0A%%%=20mode:=20= context=0A%%%=20TeX-master:=20t=0A%%%=20End:=20=0A%<>=0A= --Apple-Mail-3--948811773 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Anyhow thanks Andreas --Apple-Mail-3--948811773 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --Apple-Mail-3--948811773--