[NTG-context] Hiding subanswer blocks

David Arnold dwarnold45 at cox.net
Sat Jul 15 18:48:59 CEST 2006


All,

Below I have our environment for our question and answer blocks. We  
are attempting to have questions that have parts, as in:

1. Yada, Yada, Yada, Yada, Yada, Yada, Yada, Yada, Yada.

1a) Yada, Yada, Yada, Yada, Yada, Yada, Yada, Yada, Yada.

1b) Yada, Yada, Yada, Yada, Yada, Yada, Yada, Yada, Yada.

1c) Yada, Yada, Yada, Yada, Yada, Yada, Yada, Yada, Yada,

2,

2a)

2b)

Etc.

However, we want to "hide" some of the shortsubanswers. We try with:

\beginshortanswer
\startanswer

\startsubanswer[-]
\stopsubanswer

\startsubanswer[-]
\stopsubanswer

\startsubanswer[-]
\stopsubanswer

\startsubanswer
\startbuffer

...


When typeset, the first three subanswers here are hidden, but the  
first subanswer that is not hidden, which should be the answer to  
"part d," it winds up be labeled "part a" in the pdf output.

Can anyone help?

\def\genericqacommands#1{\unnumberedsubsection{#1}\vskip 1em}

\def\startgenericqadouble#1{\genericqacommands{#1}\startcolumns[n=2]}
\def\stopgenericqadouble{\stopcolumns}

\def\startgenericqasingle#1{\genericqacommands{#1}}
\def\stopgenericqasingle{}

\def\preqacontainment{\vskip 0.5ex plus 1ex}
\def\postqacontainment{\vskip 0.5ex plus 1ex}

\def\startquestions{\startgenericqadouble{Exercises}}
\def\stopquestions{\stopgenericqadouble}

\def\startlonganswers{\startgenericqasingle{Answers}}
\def\stoplonganswers{\stopgenericqasingle}

\def\startshortanswers{\startgenericqadouble{Answers}}
\def\stopshortanswers{\stopgenericqadouble}

\def\questionbreak{\vskip 2em plus 1ex minus 1 ex}

\def\placeanswers{%
	\doifmodeelse{short}
	{
		\startshortanswers
		\selectblocks[shortanswer,shortsubanswer][criterium=section]
		\stopshortanswers
	}
	{
		\startlonganswers
		\selectblocks[longanswer,longsubanswer][criterium=section]
		\stoplonganswers
	}
}


\defineenumeration
	[question]
	[text=,
	headcolor=heavygreen]

\setupenumerations
	[question]
	[location=left,
	width=fit,
	distance=1em,
	hang=1,
	margin=0pt,
	headcolor=heavygreen,
	right=.,
	way=bysection,
	sectionnumber=no,
	before=\preqacontainment,
	after=\postqacontainment]

\defineenumeration
	[subquestion]
	[location=hanging,
	text=,
	headcolor=heavygreen,
	conversion=characters]

\setupenumerations
	[subquestion]
	[right=)]

\defineenumeration
	[answer]
	[text=,
	headcolor=heavygreen]

\setupenumerations
	[answer]
	[location=left,
	width=fit,
	distance=1em,
	hang=1,
	margin=0pt,
	headcolor=heavygreen,
	right=.,
	way=bysection,
	sectionnumber=no,
	before=\preqacontainment,
	after=\postqacontainment]

\defineenumeration
	[subanswer]
	[location=hanging,
	text=,
	headcolor=heavygreen,
	conversion=characters]

\setupenumerations
	[subanswer]
	[right=)]

\defineblock 
[question,shortanswer,longanswer,subquestion,shortsubanswer,longsubanswe 
r]
\hideblocks[shortanswer,longanswer,shortsubanswer,longsubanswer]


More information about the ntg-context mailing list