This is a guess, but see if it changes anything if you put a \newline or a \\ 
or a ~\\ either before or after the \end{question} in \myquestion.

SteveT



On Monday 30 July 2007 15:02, Paul Johnson wrote:
> I'm trying to make a lyx layout file to help with making multiple
> choice exams with the examdesign LaTeX class.  This class has many
> great features, including automatic randomization of questions to
> create separate forms as well as automatic key generation for grading.
>
> The question environment is used with LaTeX like this
>
> \begin{question}
> Here is a question
> \choice{first}
> \choice{second}
> \end{question}.
>
>
> When processed, it should create output that assigns a number and
> letters like this
>
> 1. Here is a question
>     (a)  first
>     (b)  second
>
> I am attaching a layout file and a test lyx file and hope you can
> advise me.  The pdf file result is posted online here, so you can see
> I have some success.
>
> http://pj.freefaculty.org/latex/examdes-ex1.pdf
>
> I've used LyX Enumerate components and when properly nested, the
> questions and answers do "look right" in LyX.  But if it looks right
> in LyX, it doesn't print out through LaTeX.
>
> Here is what is wrong.  The "question" environment does not know how
> to end.  I put in the choices as nested inside the question, and that
> "looks right" inside lyx because the enumeration is correct.  After I
> put in the last choice in LyX and go up one level, I insert a new
> question, but the output shows the new question "inside" the previous
> one.  The only workaround I find is to put in a separator paragraph of
> another style.  That does force LyX to put in \end{question}, but then
> Lyx's enumeration of the questions is broken.
>
>
> I'm not an expert, but it appears to me there is something weird in
> the way LyX takes new environments.  newcommand works as expected, but
> environments that have custome Preamble simply don't compile.  Here's
> an example. "myquestion" should be the exact same thing as the
> "question" environment.  Note the Preamble makes it do the same thing.
>
> Style Question
>       LatexType                Environment
>       LatexName                myquestion
>       NextNoIndent     1
>       Preamble
>                \newenvironment{myquestion}{
>                \begin{question}}
>                {\end{question}}
>        EndPreamble
> End
>
> I export to LaTeX from lyx and study the result, it appears it should
> compile, but running latex fails. It says there is a runaway.
>
> Is there a LaTeX "preprocessor" like a C preprocessor?  I found myself
> wishing I could review the first phase of the latex document
> processing. Is there a phase in the latex processor which takes all of
> the newenvironments and inserts them into the document itself, so you
> can read what is going wrong?  I can't see much when the LaTeX
> document simply has a preamble like
>
> \newenvironment{myquestion}{
>   \begin{question}}
>   {\end{question}
> }
>
> and then inside the document it has
>
> \begin{myquestion}
>
> \end{myquestion}
>
> I can't see why the latex program complaining.
>
> I'm using Fedora Linux 7 with the tetex distribution.

Reply via email to