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

Gavin gavinpublic at comcast.net
Tue Jan 11 20:50:58 CET 2022

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.

In the example below, the first solution has the desired behavior. The second solution has the syntax I’d like, but it doesn’t make the space without a solution.

Any ideas would be welcome! I am still pretty new to ConTeXt, so I struggle mixing things like the plain tex \vbox and ConTeXt \start…\stop concepts.


\definemode[solution][yes] % yes to enable solutions, no to disable

\definebuffer  [solution] % Captures solution in a buffer that isn't used

\startmode[solution] % If in solution mode, redefine \startsolution...\stopsolution
\definedelimitedtext[solution][ % Solution italic and indented
  leftmargin=standard, % Indents block on the left
  rightmargin=yes, % Indents block on the right
  before=\vbox to 1in\bgroup,


How many roads? (The 1-inch space below appears whether or not it contains a solution.)

\vbox to 1in{%
    42 roads.

How much wood? (I would like to define solution so this to behaves like the previous question.)
  Alotta wood!

No more questions.

More information about the ntg-context mailing list