Command/useblocks

From ConTeXt wiki

\useblocks

Syntax (autogenerated)

\useblocks[...,...][...,...][...=...,...]
[...,...]name
[...,...]name
criteriumtext section


Syntax

\useblocks[...,...,...][...,...,...]
[...,...,...] names of block classes to reuse here
[...,...,...] tags (optional)

Description

\useblocks[myquestion,myanswer] typesets all myquestion and myanswer blocks defined in the document, in the order in which they were defined. An optional second argument can be used to print only blocks with certain tags.

Example

\defineblock[myquestion]
\defineblock[myanswer]

% We don't want to display blocks when we define them.
\hideblocks[myquestion,myanswer] 

\starttext
\beginmyquestion[first]
First question, defined at the start
\endmyquestion

\beginmyanswer[first]
First answer
\endmyanswer

\subsection{My questions and answers, original interleaving}
\useblocks[myquestion,myanswer]

\subsection{Only the first answer}
\useblocks[myanswer][first]

\beginmyquestion
Second block, defined at the end
\endmyquestion

\beginmyanswer
Second answer, also defined at the end
\endmyanswer

\subsection{You can't select by tag only}
\useblocks[first]   % produces nothing
\useblocks[][first] % produces nothing

\stoptext

This gives:

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: