# [NTG-context] Extract only certain part of document (via modes)?

Hans Hagen pragma at wxs.nl
Thu Nov 10 17:27:47 CET 2016

```On 11/6/2016 12:51 PM, Mikael P. Sundqvist wrote:
> Dear list, and in particular Hans,
>
> I asked the same question on stackexchange before today
> (http://tex.stackexchange.com/q/337738/52406), and got the answer that
> what I want to do might not be possible.
>
> In my large document I have exercises (typeset with \startexercise
> \stopexercise, defined as an enumeration). Is it possible to use modes
> (or any other trick) to be able to compile the same file and get only
> the exercises. For example,
>
> context file.tex
>
> should give the full document, while
>
> context --mode=exercises file.tex
>
> should give only all the exercises (or just everything "in one mode")?

search for 'blocks' ...

\defineblock
...
\hideblocks
\keepblocks
\useblocks
\processblocks
\selectblocks

Hans

-----------------------------------------------------------------