[OS X TeX] Backanswers in Memoir

Ross Moore ross at ics.mq.edu.au
Sun Apr 5 20:05:49 EDT 2009


Hi David,

On 06/04/2009, at 9:24 AM, David Arnold wrote:

> All,
>
> I'm trying to print only odd backanswers using the memoir class. My  
> full code sample appears below. The crux of the matter is this new  
> environment, where I am trying to output the contents of the  
> environment to \jobname.backans only if the exercise number is odd:
>
> \newsavebox{\backans}
>
> \newenvironment{backanswer}%
> 	{\begin{lrbox}{\backans}}
> 	{\end{lrbox}\ifodd\theexercise{%
> 		\addtostream{backansout}{\par\noindent\textbf{\theexercise.}}
> 		\addtostream{backansout}{\usebox{\backans}}}\fi}

You cannot do it this way.
You need to be writing out into the file,
the text that lies between
   \begin{backanswer}
   ...
   \end{backanswer}

By trying to write out the *result* of having typeset
this info into a box, you will get lots of stuff that
you cannot control --- as you are discovering.

>
> I get this error:
>
> (./QuestionAnswerExperiments.backans
> ! Undefined control sequence.
> l.2 \unhbox \voidb
>                   @x \copy \backans \relax
> ?
>
> And the contents of \jobname.backans are:
>
> \par \noindent \textbf {1.}
> \unhbox \voidb at x \copy \backans \relax
> \par \noindent \textbf {3.}
> \unhbox \voidb at x \copy \backans \relax
> \par \noindent \textbf {5.}
> \unhbox \voidb at x \copy \backans \relax
> \par \noindent \textbf {7.}
> \unhbox \voidb at x \copy \backans \relax
> \par \noindent \textbf {9.}
> \unhbox \voidb at x \copy \backans \relax

>
> Please be kind. I'm OK using LaTeX to write documents, but I'm  
> pretty lousy at the coding end and trying to write macros.
>
> Any help appreciated.


I'd advise you to look at:  \usepackage{comment} .
This lets you define environment that can be switched
between inclusion or exclusion.

>

>
> As a second request, if anyone could help me get these exercises  
> into two columns using all of the page (no odd-even large margins),  
> that would also be appreciated.
>
> Thanks.
>
> David Arnold
> College of the Redwoods
> http://msemac.redwoods.edu/~darnold/index.php


Hope this helps,

	Ross Moore

------------------------------------------------------------------------
Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------






More information about the MacOSX-TeX mailing list