ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* 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

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