From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/110583 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: tikzpicture in margin Date: Sun, 14 Feb 2021 16:43:13 -0500 (EST) Message-ID: References: <534947008.1281700.1613315494023.ref@mail.yahoo.com> <534947008.1281700.1613315494023@mail.yahoo.com> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1023451362-1613338993=:342737" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27728"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Alpine 2.23 (LNX 453 2020-06-18) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Feb 14 22:43:38 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBPB4-00076W-Du for gctc-ntg-context-518@m.gmane-mx.org; Sun, 14 Feb 2021 22:43:38 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id A39112809EB; Sun, 14 Feb 2021 22:43:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZtXLfsStH7kZ; Sun, 14 Feb 2021 22:43:18 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id A09022809ED; Sun, 14 Feb 2021 22:43:18 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id E978928085D for ; Sun, 14 Feb 2021 22:43:16 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wcKPGrRdjJkv for ; Sun, 14 Feb 2021 22:43:16 +0100 (CET) Received-SPF: Softfail (mailfrom) identity=mailfrom; client-ip=132.206.73.2; helo=orford.cim.mcgill.ca; envelope-from=adityam@umich.edu; receiver= Original-Received: from orford.cim.mcgill.ca (orford.cim.mcgill.ca [132.206.73.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 50054280003 for ; Sun, 14 Feb 2021 22:43:15 +0100 (CET) Original-Received: from adi-thinkpad (198-48-192-62.cpe.teksavvy.com [198.48.192.62]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: adityam) by orford.cim.mcgill.ca (Postfix) with ESMTPSA id 60D68F22E4 for ; Sun, 14 Feb 2021 16:43:12 -0500 (EST) In-Reply-To: <534947008.1281700.1613315494023@mail.yahoo.com> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:110583 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1023451362-1613338993=:342737 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 14 Feb 2021, Jig=C3=A9 wrote: > Hi all. >=20 > I'm trying to place a TikZ picture in the margin. > Here is a small example: >=20 > \usemodule[tikz] > \setuplayout[backspace=3D4cm, topspace=3D2cm, height=3Dmiddle] > \starttext > \input{lorem} > \margintext{I have discovered a truly > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 marvelous proof ...=C2=A0 but > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 this margin is too narrow > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 to contain it.} > \input{lorem} > \inmargin{\externalfigure[cow] [width=3D\marginwidth]} > % The above works. > % The following does not: > \input{lorem} > \inmargin{ > \starttikzpicture > =C2=A0 \draw[gray] (-2,0) grid (2,2) ; > =C2=A0 \draw plot [domain=3D-2:2, samples=3D50, smooth] (\x,{\x * \x}); > \stoptikzpicture > } > \stoptext >=20 > -> Undefined control sequence Most likely because the argument of \inmargin is scanned upfront and at tha= t time \draw etc are undefined. One option is: \startbuffer[picture] \starttikzpicture =2E.. \stoptikzpicture \stopbuffer \inmargin{\getbuffer[picture]} Another option (but better to do that in tikz module) is: \let\draw\relax \let\x\relax \inmargin{\starttikzpicture ... \stoptikzpicture} > Actually the command \startmarginblock ... \stop... described in the ConT= ext reference works with a TikZ picture.=20 Because the \start ... \stop blocks don't scan the argument. Aditya --8323329-1023451362-1613338993=:342737 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --8323329-1023451362-1613338993=:342737--