* description fails on \if
@ 2008-03-25 19:38 Hans van der Meer
2008-03-26 7:32 ` Wolfgang Schuster
2008-03-26 21:51 ` Hans Hagen
0 siblings, 2 replies; 6+ messages in thread
From: Hans van der Meer @ 2008-03-25 19:38 UTC (permalink / raw)
To: NTG ConTeXt
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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: description fails on \if
2008-03-25 19:38 description fails on \if Hans van der Meer
@ 2008-03-26 7:32 ` Wolfgang Schuster
2008-03-26 20:23 ` Hans van der Meer
2008-03-26 21:51 ` Hans Hagen
1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2008-03-26 7:32 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Tue, Mar 25, 2008 at 8:38 PM, Hans van der Meer <hansm@science.uva.nl> wrote:
> 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: description fails on \if
2008-03-26 7:32 ` Wolfgang Schuster
@ 2008-03-26 20:23 ` Hans van der Meer
2008-03-26 21:52 ` Hans Hagen
2008-03-27 7:37 ` Wolfgang Schuster
0 siblings, 2 replies; 6+ messages in thread
From: Hans van der Meer @ 2008-03-26 20:23 UTC (permalink / raw)
To: mailing list for ConTeXt users
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.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: description fails on \if
2008-03-26 20:23 ` Hans van der Meer
@ 2008-03-26 21:52 ` Hans Hagen
2008-03-27 7:37 ` Wolfgang Schuster
1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2008-03-26 21:52 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: description fails on \if
2008-03-26 20:23 ` Hans van der Meer
2008-03-26 21:52 ` Hans Hagen
@ 2008-03-27 7:37 ` Wolfgang Schuster
1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2008-03-27 7:37 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Wed, Mar 26, 2008 at 9:23 PM, Hans van der Meer <hansm@science.uva.nl> wrote:
> 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: description fails on \if
2008-03-25 19:38 description fails on \if Hans van der Meer
2008-03-26 7:32 ` Wolfgang Schuster
@ 2008-03-26 21:51 ` Hans Hagen
1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2008-03-26 21:51 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-03-27 7:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-25 19:38 description fails on \if Hans van der Meer
2008-03-26 7:32 ` Wolfgang Schuster
2008-03-26 20:23 ` Hans van der Meer
2008-03-26 21:52 ` Hans Hagen
2008-03-27 7:37 ` Wolfgang Schuster
2008-03-26 21:51 ` 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).