# [NTG-context] Conditional text appearing in a fixed vertical space

Wed Jan 12 00:44:15 CET 2022

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,
foregroundstyle=\rm\it,
loffset=2em,
roffset=2em,
indentnext=no,
]

\starttext

\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