ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Problem with buffers in combination with textreference
@ 1999-11-15 15:30 Marc van Dongen
  1999-11-15 17:12 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Marc van Dongen @ 1999-11-15 15:30 UTC (permalink / raw)


Hello again,

Below there is one macro (no arguments) which if used at
a certain position in the text causes a problem. When
replacing the macro call by its definition, will resolve
the problem.....

I have managed to reduce the problem to the odd 23
lines which are appended together with the error message
below.

Replacing \beginanswer in tmp.tex by its definition resolves
the problem.

It should be noted that changing the line:
    \textreference[Answer]{Answer}%
in m-tmp.tex to some ordinary text also gets rid of the
error.

I cannot see what's causing the problem below.
Is this a bug?

Thanks in advance.

Marc van Dongen

BTW Should I post such questions to this forum or
    is there a more appropriate way of doing things?
_______________________________________________________
     Marc van Dongen, CS Dept | phone:   +353 21 903578
University College Cork, NUIC | Fax:     +353 21 903113
  College Road, Cork, Ireland | Email: dongen@cs.ucc.ie
_______________________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main source: tmp.tex                  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usemodule[tmp]
\starttext
   \beginquestion
        \beginanswer % !! Replace by definition of
                     % \beginanswer and it's fine !!
\stopbuffer % !! !! !! has to be fixed !! !! !!
\endgroup   % !! !! !! has to be fixed !! !! !!
%           % !! !! !! Because I would !! !! !!
%           % !! !! !! like to use \endanswer here. !!
   \endquestion
\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Module: m-tmp.tex                     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\beginanswer{%
  \begingroup
  \startbuffer[Answerbuffer]
    \textreference[Answer]{Answer}
}
%\endanswer{\endbuffer\endgroup\page[yes]}
\def\beginquestion{%
  \begingroup
  Blah.
}
\def\endquestion{\endgroup}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Error message                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Argument of \dodostartbuffer has an extra }.
<inserted text> 
                \par 
<to be read again> 
                   }
\doifnot ...f \!!stringa {#1}\edef \!!stringb {#2}
                                                  \unless \ifx \!!stringa \!...

\writetmpblock ... \write \tmpblocks {\string #1}}
                                                  \fi 
\next ...mpblock {\textreference [Answer]{Answer}}
                                                  \copyblockline 
l.6         \beginanswer


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problem with buffers in combination with textreference
  1999-11-15 15:30 Problem with buffers in combination with textreference Marc van Dongen
@ 1999-11-15 17:12 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 1999-11-15 17:12 UTC (permalink / raw)
  Cc: ConTeXt

At 03:30 PM 11/15/99 +0000, Marc van Dongen wrote:

>Below there is one macro (no arguments) which if used at
>a certain position in the text causes a problem. When
>replacing the macro call by its definition, will resolve
>the problem.....

Buffers are strange animals. You cannot start and stop them in a macro, since they fool around with catcodes. 

>\def\beginanswer{%
>  \begingroup
>  \startbuffer[Answerbuffer]
>    \textreference[Answer]{Answer}
>}
>%\endanswer{\endbuffer\endgroup\page[yes]}
>\def\beginquestion{%
>  \begingroup
>  Blah.
>}
>\def\endquestion{\endgroup}

Anyhow, there is a more straightforward way: 

\defineblock[question]
\defineblock[answer]

\hideblocks[answer]

\beginquestion
....
\beginquestion

\beginanswer
....
\endanswer

Now you can say:

\chapter {Answers}

\placeblocks[answer] 

Of course it makes sense to use definitions or enumarations (just try it yourself first) which end up in 

\beginquestion
  \startquestion 
    some text 
  \stopquestion 
\endquestion

etc etc When properly set up, you get cross linked questions and answers for free. This mechanism can also be used selectively, with tags, so you can make sets of answers and so. 

(Blocks is a pretty old mechanism that I wrote because I wanted to make some educational documents based on one source.) 

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.nl
-----------------------------------------------------------------


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-11-15 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-15 15:30 Problem with buffers in combination with textreference Marc van Dongen
1999-11-15 17:12 ` Hans Hagen

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).