From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/114133 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aditya Mahajan via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Conditional text appearing in a fixed vertical space Date: Tue, 11 Jan 2022 18:44:15 -0500 (EST) Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-33589151-1641944655=:1381716" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24509"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Alpine 2.23 (LNX 453 2020-06-18) Cc: Aditya Mahajan To: Gavin via ntg-context Original-X-From: ntg-context-bounces@ntg.nl Wed Jan 12 00:44:47 2022 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 1n7Qop-0006C8-1E for gctc-ntg-context-518@m.gmane-mx.org; Wed, 12 Jan 2022 00:44:47 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8A78A28903B; Wed, 12 Jan 2022 00:44:22 +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 SVr16ZqyqWJZ; Wed, 12 Jan 2022 00:44:21 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D714D280895; Wed, 12 Jan 2022 00:44:20 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 63035280895 for ; Wed, 12 Jan 2022 00:44: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 74ph-rzkeTZi for ; Wed, 12 Jan 2022 00:44:18 +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 66575280211 for ; Wed, 12 Jan 2022 00:44:17 +0100 (CET) Original-Received: from adi-thinkpad.local (135-23-198-80.cpe.pppoe.ca [135.23.198.80]) (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 D2F0DF552A; Tue, 11 Jan 2022 18:44:15 -0500 (EST) In-Reply-To: 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:114133 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-33589151-1641944655=:1381716 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 11 Jan 2022, Gavin via ntg-context wrote: > Hello List, >=20 > I am making problem sets for a physics class. Solutions use the style def= ined in the example below, and only appear if the =E2=80=9Csolution=E2=80= =9D mode is enabled. I am struggling to get a vertical space for the soluti= on which is the same whether or not the solution is printed. Different prob= lems require different amounts of space, so this should be an argument or k= ey-value. This is how I would do it: piggyback on framedtext. Note that framedtext do= esn't break across pages. So, if you have long answers, a different mechani= sm is needed.=20 \definemode[solution][no] \doifmodeelse{solution} {\defineframedtext[solution][empty=3Dno]} {\defineframedtext[solution][empty=3Dyes]} % Doesn't work. Why? % \expanded{\defineframedtext[solution][empty=3D\doifmodeelse{solution}{no}= {yes}]} \setupframedtext [solution] [ spacebefore=3Dmedium, spaceafter=3Dmedium, width=3Dbroad, foregroundstyle=3D\rm\it, loffset=3D2em, roffset=3D2em, indentnext=3Dno, ] \starttext Sample question. Always show answer. \startsolution[height=3D1in, empty=3Dno] Alotta wood! \stopsolution How much wood?=20 \startsolution[height=3D1in] Alotta wood! \stopsolution You don't need to specify the height: \startsolution \input ward \stopsolution No more questions. \stoptext --8323329-33589151-1641944655=:1381716 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-33589151-1641944655=:1381716--