From: Aditya Mahajan via ntg-context <ntg-context@ntg.nl>
To: Gavin via ntg-context <ntg-context@ntg.nl>
Cc: Aditya Mahajan <adityam@umich.edu>
Subject: Re: Conditional text appearing in a fixed vertical space
Date: Tue, 11 Jan 2022 18:44:15 -0500 (EST) [thread overview]
Message-ID: <nycvar.YAK.7.78.908.2201111840410.1381716@nqv-guvaxcnq> (raw)
In-Reply-To: <F5F32357-E94B-4352-ACFD-8ADF35D08C4A@comcast.net>
[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]
On Tue, 11 Jan 2022, Gavin via ntg-context wrote:
> Hello List,
>
> I am making problem sets for a physics class. Solutions use the style defined in the example below, and only appear if the “solution” mode is enabled. I am struggling to get a vertical space for the solution which is the same whether or not the solution is printed. Different problems require different amounts of space, so this should be an argument or key-value.
This is how I would do it: piggyback on framedtext. Note that framedtext doesn't break across pages. So, if you have long answers, a different mechanism is needed.
\definemode[solution][no]
\doifmodeelse{solution}
{\defineframedtext[solution][empty=no]}
{\defineframedtext[solution][empty=yes]}
% Doesn't work. Why?
% \expanded{\defineframedtext[solution][empty=\doifmodeelse{solution}{no}{yes}]}
\setupframedtext
[solution]
[
spacebefore=medium,
spaceafter=medium,
width=broad,
foregroundstyle=\rm\it,
loffset=2em,
roffset=2em,
indentnext=no,
]
\starttext
Sample question. Always show answer.
\startsolution[height=1in, empty=no]
Alotta wood!
\stopsolution
How much wood?
\startsolution[height=1in]
Alotta wood!
\stopsolution
You don't need to specify the height:
\startsolution
\input ward
\stopsolution
No more questions.
\stoptext
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2022-01-11 23:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-11 19:50 Gavin via ntg-context
2022-01-11 20:13 ` Hans Hagen via ntg-context
2022-01-11 22:56 ` Gavin via ntg-context
2022-01-11 23:13 ` Fabrice L via ntg-context
2022-01-11 23:44 ` Aditya Mahajan via ntg-context [this message]
2022-01-12 15:30 ` Gavin via ntg-context
2022-01-13 0:49 ` fv leung via ntg-context
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.YAK.7.78.908.2201111840410.1381716@nqv-guvaxcnq \
--to=ntg-context@ntg.nl \
--cc=adityam@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).