AMCOpen is broken. produces LaTeX Error: There's no line here to end. (Bug #251)


Added by Pieter Van den Hombergh over 10 years ago. Updated over 9 years ago.


Status:Closed Start date:01/02/2014
Priority:High Due date:
Assignee:Anirvan Sarkar % Done:

100%

Category:LaTeX
Target version:1.3.0

Description

When using \\AMCOpen, it produces the mentioned latex error.
sample code

\begin{question}{xml-ooXML01}  [4 Points]

This question is about an XML document.

\begin{itemize}
\item
    Which node always has to be present in an XML tree?
\end{itemize}

  \AMCOpen{lines=1}{
    \wrongchoice[W]{0}\scoring{0}
    \correctchoice[C]{1}\scoring{4}
  }

\end{question}

when \AMCOpen is redefined in a macro file (which is included after the automul style file) as follows, the error is gone.

fix:

\def\AMCOpen{\hfill\AMCformatChoices{\AMCopenShow}{\AMCopenHide}}

stops latex from complaining.

The fix appears not to have any other effect then to fill out the line, so latex will happily end the line.


History

Updated by Anirvan Sarkar over 10 years ago

Pieter Van den Hombergh wrote:

The fix appears not to have any other effect then to fill out the line, so latex will happily end the line.

This will not produce a proper formatting if the separateanswersheet option is used. An extra line will be printed after the open question.

But it helped me locate where the problem is. The error is caused due to this line in the definition of \AMCopenShow command:

\linebreak[1]\hspace*{\fill}%
A line break only works if a paragraph has started otherwise LaTeX will give the error: There's no line here to end.

A new paragraph does not automatically start after the end of an environment (in your case the itemize environment) and the \AMCOpen internally uses a linebreak. These two factors contributed to this error.

The easiest way to fix this is to add a space before the linebreak.

~\linebreak[1]\hspace*{\fill}%

Updated by Anonymous over 10 years ago

Applied in changeset r1502.

  • % Done changed from 0 to 100
  • Status changed from New to Resolved

Updated by Pieter Van den Hombergh over 10 years ago

Hello Anrivan,

Your solution is most likely correct. I did not observe the extra line and my proposal was only a fix for the error.

I'll wait for Alexis to adapt you solution.

Updated by Pieter Van den Hombergh over 10 years ago

Pieter Van den Hombergh wrote:

Hello Anrivan,

Your solution is most likely correct. I did not observe the extra line and my proposal was only a fix for the error.

I'll wait for Alexis to adapt you solution.

Just updated and installed and your solution is correct.

Updated by Anonymous about 10 years ago

Applied in changeset hg:7300ca4e7b9a.

Updated by Anirvan Sarkar over 9 years ago

  • Target version set to 1.3.0
  • Assignee set to Anirvan Sarkar
  • Status changed from Resolved to Closed

Also available in: Atom PDF