![](https://secure.gravatar.com/avatar/58128ef2fa853eca7f2503a152c340ae.jpg?s=120&d=mm&r=g)
There is the following problem on code that did work around july 2007, but no longer under the current context version (2008-03-11). Define a description, I did: \definedescription[answerblock][% \c!margin=\v!no,\c!location=\v!left,% \c!headstyle=\@@exmintrostyle,\c!style=\@@exmstyle,% \c!before=,\c!inbetween=,\c!after=,% \c!hang=\@@exmhang,\c!width=\questionblockwidth,% \c!text=\placeanswerstart] Typeset with this description inside the following macro: \def\shortanswer#1\par{% \par % be sure to end paragraph here \answerblock{}% % {} needed here in description call \ifanswers #1\else\dotfill\strut\fi % <<<<<< crashing on this if \par % final \par of description ... \par } The above code crashes with: ! Incomplete \ifx; all text was ignored after ... After some detective work in which Wolfgang Schuster had a large share and has found the most elegant workaround, the addition of a \relax just after the description call prevents the error: \def\shortanswer#1\par{% \par % be sure to end paragraph here \answerblock{}% % {} needed here in description call \relax % <<<<<<<<<<<<<<<<< \relax prevents crash on if \ifanswers #1\else\dotfill\strut\fi \par % final \par of description ... \par } The way \relax stops the error reminds me of the \relax that one places after a number in order to separate that from the code following. I did compare core-des.tex, both the last version and the archived from 2007-04-17. But I must admit, I did not succeed finding a clue among the differences about what could have happened. The code is a bit too intricate to just jump in and pinpoint the culprit -- at least for me. Allthough Wolfgang's workaround saves the day, I feel this problem deserves solving inside ConTeXt, not outside it. Someday somewhere another person will stumble on the same problem -- a situation that can and should be avoided, in my view. Therefore I explain the problem here as fully as possible hoping someone knowledgeable with descriptions <<we might need to fall back to Taco or Hans>> will find the best remedy. Hans van der Meer
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
On Tue, Mar 25, 2008 at 8:38 PM, Hans van der Meer
There is the following problem on code that did work around july 2007, but no longer under the current context version (2008-03-11).
Define a description, I did: \definedescription[answerblock][% \c!margin=\v!no,\c!location=\v!left,% \c!headstyle=\@@exmintrostyle,\c!style=\@@exmstyle,% \c!before=,\c!inbetween=,\c!after=,% \c!hang=\@@exmhang,\c!width=\questionblockwidth,% \c!text=\placeanswerstart]
Could you try to set "title=no".
Typeset with this description inside the following macro: \def\shortanswer#1\par{% \par % be sure to end paragraph here \answerblock{}% % {} needed here in description call \ifanswers #1\else\dotfill\strut\fi % <<<<<< crashing on this if \par % final \par of description ... \par } The above code crashes with: ! Incomplete \ifx; all text was ignored after ...
After some detective work in which Wolfgang Schuster had a large share and has found the most elegant workaround, the addition of a \relax just after the description call prevents the error: \def\shortanswer#1\par{% \par % be sure to end paragraph here \answerblock{}% % {} needed here in description call \relax % <<<<<<<<<<<<<<<<< \relax prevents crash on if \ifanswers #1\else\dotfill\strut\fi \par % final \par of description ... \par }
The way \relax stops the error reminds me of the \relax that one places after a number in order to separate that from the code following. I did compare core-des.tex, both the last version and the archived from 2007-04-17. But I must admit, I did not succeed finding a clue among the differences about what could have happened. The code is a bit too intricate to just jump in and pinpoint the culprit -- at least for me.
Allthough Wolfgang's workaround saves the day, I feel this problem deserves solving inside ConTeXt, not outside it. Someday somewhere another person will stumble on the same problem -- a situation that can and should be avoided, in my view. Therefore I explain the problem here as fully as possible hoping someone knowledgeable with descriptions <<we might need to fall back to Taco or Hans>> will find the best remedy.
I would say the message comes from \dodoublegroupempty in \@@description. Wolfgang
![](https://secure.gravatar.com/avatar/58128ef2fa853eca7f2503a152c340ae.jpg?s=120&d=mm&r=g)
Wolfgang, From your observation I am inclined to guess that the \ifx falls prey to the collection of arguments. The \relax can be replaced by an extra pair {} behind the description: \answerblock{}{}% also typesets without the if-error. I more or less conclude that the lookahead from \dodoublegroupempty does not stop on the \if. If I remember correctly, that behaviour is to be expected from tex and the prospects for solving it generically within the format bleak. If Hans Hagen is listening, can he comment on this? Hans van der Meer On 26 mrt 2008, at 08:32, Wolfgang Schuster wrote:
Allthough Wolfgang's workaround saves the day, I feel this problem deserves solving inside ConTeXt, not outside it. Someday somewhere another person will stumble on the same problem -- a situation that can and should be avoided, in my view. Therefore I explain the problem here as fully as possible hoping someone knowledgeable with descriptions <<we might need to fall back to Taco or Hans>> will find the best remedy.
I would say the message comes from \dodoublegroupempty in \@@description.
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Hans van der Meer wrote:
I more or less conclude that the lookahead from \dodoublegroupempty does not stop on the \if. If I remember correctly, that behaviour is to be expected from tex and the prospects for solving it generically within the format bleak. If Hans Hagen is listening, can he comment on this?
indeed, but cooking up a solution that always works is hard 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 -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/93131e1e6e2204bd13501390d768dbdc.jpg?s=120&d=mm&r=g)
On Wed, Mar 26, 2008 at 9:23 PM, Hans van der Meer
Wolfgang,
From your observation I am inclined to guess that the \ifx falls prey to the collection of arguments. The \relax can be replaced by an extra pair {} behind the description: \answerblock{}{}% also typesets without the if-error.
You could also add "title=no" to \definedescription[answerblock], this stops TeX from looking after a optional argument between the braces.
I more or less conclude that the lookahead from \dodoublegroupempty does not stop on the \if. If I remember correctly, that behaviour is to be expected from tex and the prospects for solving it generically within the format bleak. If Hans Hagen is listening, can he comment on this?
I tried your module also with my ancient ConTeXt from august last year and it did also show this effect. Your module is broken since a very long time. Wolfgang
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
Hans van der Meer wrote:
After some detective work in which Wolfgang Schuster had a large share and has found the most elegant workaround, the addition of a \relax just after the description call prevents the error: \def\shortanswer#1\par{% \par % be sure to end paragraph here \answerblock{}% % {} needed here in description call \relax % <<<<<<<<<<<<<<<<< \relax prevents crash on if \ifanswers #1\else\dotfill\strut\fi \par % final \par of description ... \par }
The way \relax stops the error reminds me of the \relax that one places after a number in order to separate that from the code following. I did compare core-des.tex, both the last version and the archived from 2007-04-17. But I must admit, I did not succeed finding a clue among the differences about what could have happened. The code is a bit too intricate to just jump in and pinpoint the culprit -- at least for me.
i cannot put a \relax in there because \answerblock looks ahead the argument grabber handles some of the if's but only the primitives; in your case ... don't use \ifanswers, just use modes ... \enablemode[answers] ... \doirmnode{answers} 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 -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Hans van der Meer
-
Wolfgang Schuster