ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Blocks in a macro?
Date: Mon, 14 Feb 2005 15:26:47 +0100	[thread overview]
Message-ID: <4210B527.9020209@wxs.nl> (raw)
In-Reply-To: <4210AA03.6070306@econ.muni.cz>

Michal Kvasnicka wrote:
> Good evening.
> 
> How can I include \begin<block> ... \end<block> into a macro?
> 
> I have defined:
>    \defineblock[question]
>    \defineblock[answer]
>    \defineenumeration[question][location=serried, coupling=answer]
>    \defineenumeration[answer][location=serried, coupling=answer]
>    \hideblocks[answer]
> I'd like to simplify my code from
>    \beginquestion \startquestion question ... \stopquestion \endquestion
>    \beginanswer \answer answer ... \par  \endanswer
> to
>    \q{question ...}{answer ...}
> \q begin something like this:
>    \def\q{%
>       \beginquestion \question #1\par \endquestion
>        \beginanswer \answer #2\par  \endanswer
>    }
> 
> But no question/anwer is written into .tub file (only the beginning/end 
> of those blocks).

you can't do that since buffer and block code works on the main input stream 
directly (catcode trickery and such)

but you can hook things into blocks (before/after keys)

   \setupblock[question][before=\startquestion,after=\stopquestion]

should work (i'm crossing my fingers now)

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

  reply	other threads:[~2005-02-14 14:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-14 13:39 Michal Kvasnicka
2005-02-14 14:26 ` Hans Hagen [this message]
2005-02-14 15:01   ` Michal Kvasnicka

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=4210B527.9020209@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /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).