From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/98606 Path: news.gmane.org!.POSTED!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: source code and result side by side Date: Sun, 30 Jul 2017 21:26:05 -0400 (EDT) Message-ID: References: <1CA2B972-5378-4283-B83C-A099A23E6F1D@fiee.net> <31703445-47BA-4348-A20B-B4CCF4D5382F@fiee.net> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1448192427-1501464367=:48300" X-Trace: blaine.gmane.org 1501464412 9838 195.159.176.226 (31 Jul 2017 01:26:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 31 Jul 2017 01:26:52 +0000 (UTC) User-Agent: Alpine 2.02 (OSX 1266 2009-07-14) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Jul 31 03:26:47 2017 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbzTn-0002ED-Tw for gctc-ntg-context-518@m.gmane.org; Mon, 31 Jul 2017 03:26:44 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 36F73104FDC; Mon, 31 Jul 2017 03:26:24 +0200 (CEST) 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 KIGNrVTkZxVW; Mon, 31 Jul 2017 03:26:22 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 4E465104FD7; Mon, 31 Jul 2017 03:26:22 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 6BCBC104FD7 for ; Mon, 31 Jul 2017 03:26:21 +0200 (CEST) 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 MIWSoawdLDcY for ; Mon, 31 Jul 2017 03:26:19 +0200 (CEST) Original-Received: from tombraider.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.12.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 6FC8D104FD2 for ; Mon, 31 Jul 2017 03:26:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=relay-2016-05-12; t=1501464367; bh=RKOgfgIXZFUqj3LA+lvGQXt1/q2Tj95UwVMyHvuCFBM=; h=Date:From:To:Subject:In-Reply-To:References; b=Ndd1oiooYFn48bNPTTBbOV9hCnQFmr/R6mt06KTTx+SpJYVnCJlG0sbjsC9MsiP6g ynX/9yrvG28eOds+Ize/Tw7YHuTqmg/4YebPW2V0OH6vygdHJACueER1SWZgBc16Sj lOWZ9OJGfXO0/pKq0Q9tRI59Ww9Zld8rJ9bFVNjKQqHIHDp4sn8ZcJvw6aGWc9iQI9 vNSS489SfjK67rbt9NelUlgHxlYiVaS4odqilRVqRlL8M1yrhwU3jYmQcfYfOXauOW 5IRa58kyy+EyUa5RVsdsPf4fExaNLnxDI5ysYFjbhWqAyKWDc7t4xEtMpx145rFqKT 3DOUwLTgm2DSQ== Authentication-Results: tombraider.mr.itd.umich.edu; iprev=pass policy.iprev=198.84.249.206 (198-84-249-206.cpe.teksavvy.com); auth=pass smtp.auth=adityam Original-Received: FROM [192.168.0.12] (198-84-249-206.cpe.teksavvy.com [198.84.249.206]) By tombraider.mr.itd.umich.edu ID 597E872F.54E0F.13243; Authuser adityam; Sun, 30 Jul 2017 21:26:07 -0400 In-Reply-To: <31703445-47BA-4348-A20B-B4CCF4D5382F@fiee.net> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 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.org gmane.comp.tex.context:98606 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. --0-1448192427-1501464367=:48300 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 30 Jul 2017, Henning Hraban Ramm wrote: > Am 2017-07-29 um 00:57 schrieb Aditya Mahajan : > >> On Fri, 28 Jul 2017, Henning Hraban Ramm wrote: >>=20 >>> Ahoi again, >>>=20 >>> I=E2=80=99m preparing some ConTeXt docs with a lot of examples and woul= d like to reproduce what we have in the wiki as >>>=20 >>> >>> ... >>> >>>=20 >>> i.e. sourcecode beside the result. >>>=20 >>> Often the shown source is exactly what I want to show, in other cases I= need some additional setup that I don=E2=80=99t want to show. >>>=20 >>> Which approach would you suggest? Combinations? >>=20 >> \startbuffer[example-1] >> .... >> \stopbuffer >>=20 >>=20 >> \placesidebyside >> {\typebuffer[example-1]} >> {\getbuffer[setups, example-1]} > > > Thank you again, that should be enough for most of my small examples. > I guess I never heard of or forgot about \placesidebyside as well as \pla= ceontopofeachother. > > But I=E2=80=99d like to show a lot of similar examples to explain several= options. > Therefore, if I=E2=80=99d like to simplify my code, but this doesn=E2=80= =99t work: > > \def\CodeExample#1{% > \startbuffer[zB] > #1 > \stopbuffer > \typebuffer[zB] > \getbuffer[zB] > } > > \CodeExample{\framed[frame=3Doff,leftframe=3Don,rulethickness=3D1em,frame= color=3Dblue]{Klotz am Bein}} You can't do that with buffers. If you need to define your own macros that= =20 behave like buffers, you need to use \grabbufferdata (see buff-ini.mkiv).= =20 But in this case, there is a simpler solution: \defineframed [CodeExampleFramed] [ frame=3Doff, width=3D0.5\textwidth, align=3Dnormal, ] \definebuffer [CodeExample] \define\stopCodeExample {\placesidebyside =09{\CodeExampleFramed{\typeCodeExample}} =09{\CodeExampleFramed{\getCodeExample}}} \starttext \startCodeExample \framed [ frame=3Doff, leftframe=3Don, rulethickness=3D1em, framecolor=3Dblue, ]{Klotz am Bein} \stopCodeExample \stoptext --0-1448192427-1501464367=:48300 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 X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --0-1448192427-1501464367=:48300--