I'm writing a module to typeset problems/tests. Depending on a flag, 
solutions are either displayed or not. If the solutions are not displayed, 
I want to give a certain amount of empty vertical space for the student's 
work. This is where my difficulty begins.

The typesetting works with the solutions displayed (\def\examshowsolutions}
{yes}) but not with the empty vertical space (\def\examshowsolutions{no}). 
I get an "Emergency stop" that I cannot figure out. Here's the code for a 
minimal example of my difficulty..

\def\setupsolutions{
  \doifelse{\examshowsolutions}{yes}
           {\defineenumeration[SOLUTION] % display the solutions
                              [text=\Word{solution},number=no,
                               after={\vskip1ex}]}
           {\definebuffer[SOLUTION] % hide solutions,
            \setupbuffer[SOLUTION][local=yes]}
 }

\def\startsolution{\dosingleempty\dostartsolution}

\def\dostartsolution[#1]{
 \getparameters[solution][height=1em,] % set defaults (needed in case 
parameters missing)
 \iffirstargument
  \writestatus{DEBUG}{--First argument: |#1|}
  \getparameters[solution][#1,]
 \fi
 \writestatus{DEBUG}{--\solutionheight--}
 \startSOLUTION
 \writestatus{DEBUG}{--dostartsolution...finished}
 }
\def\stopsolution{
 \stopSOLUTION
 \writestatus{DEBUG}{--dostopsolution...1}
 \doif{\examshowsolutions}{no}{\godown[\solutionheight]}
 \writestatus{DEBUG}{--dostopsolution...finished}
 }
 
\starttext

\def\examshowsolutions{no} % control whether solutions are displayed
\setupsolutions
 
\startsolution % test without vertical height specified
 Here is a solution.
\stopsolution

\startsolution[height=5em] % test with vertical height specified
 Here is another solution.
\stopsolution

\stoptext

The error occurs with the \startSOLUTION command.

Here's the log file:
(/home/kenny/texlive/2013/texmf-dist/tex/context/base/cont-yes.mkiv

ConTeXt  ver: 2013.05.28 00:36 MKIV current  fmt: 2013.8.6  int: 
english/english

system          > 'cont-new.mkiv' loaded
(/home/kenny/texlive/2013/texmf-dist/tex/context/base/cont-new.mkiv)
system          > files > jobname 'check', input './check', result 'check'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
(/home/kenny/courses/Fall2014/phys1310/exam/check.tex{/home/kenny/texlive/2
013/texmf-dist/fonts/map/pdftex/context/mkiv-base.map}
fonts           > preloading latin modern fonts (second stage)
fonts           > typescripts > unknown library 'loc'
{/home/kenny/texlive/2013/texmf-dist/fonts/map/dvips/lm/lm-math.map}
{/home/kenny/texlive/2013/texmf-dist/fonts/map/dvips/lm/lm-rm.map}
fonts           > 'fallback modern rm 12pt' is loaded
DEBUG           > --1em--
))
! Emergency stop.

system          > tex > error on line 0 in file : Emergency stop ...

<empty file>

<*> cont-yes.mkiv
              
*** (job aborted, no legal \end found)

!  ==> Fatal error occurred, no output PDF file produced!

___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to