AMCOpen fails on blank lines (Bug #530)


Added by David Dixon about 6 years ago. Updated about 3 years ago.


Status:Closed Start date:02/07/2018
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:-
Target version:-

Description

Choices, choiceshoriz, and choicescustom ignore blank lines after \begin{question} and before \end{question}.
\AMCOpen, however, fails if there are any blank lines.

==============
THIS ONE FAILS ==============

%% LyX 2.2.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[insidebox,box,automarks]{automultiplechoice}
\AMCtext{draft}{}
\AMCtext{message}{}

\makeatother

\usepackage{babel}
\begin{document}
\AMCformBegin
\begin{question}{open}

You spend Tuesday on campus: you're at your job for three hours in
the morning and in the SUB for two hours in the afternoon. You have
to memorize fifty vocabulary words and read pages of economics. The
five hours on campus is the only time you have to do your schoolwork.

\AMCOpen{lines=5}{\wrongchoice[W]{w}\scoring{0}\wrongchoice[P]{p}\scoring{1}\correctchoice[C]{c}\scoring{2}}
\end{question}
\AMCform
\end{document}

==============
THIS ONE WORKS ==============

%% LyX 2.2.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[insidebox,box,automarks]{automultiplechoice}
\AMCtext{draft}{}
\AMCtext{message}{}

\makeatother

\usepackage{babel}
\begin{document}
\AMCformBegin
\begin{question}{open}You spend Tuesday on campus: you're at your job for three hours in
the morning and in the SUB for two hours in the afternoon. You have
to memorize fifty vocabulary words and read pages of economics. The
five hours on campus is the only time you have to do your schoolwork.\AMCOpen{lines=5}{\wrongchoice[W]{w}\scoring{0}\wrongchoice[P]{p}\scoring{1}\correctchoice[C]{c}\scoring{2}}
\end{question}
\AMCform
\end{document}

with-blank-line.png (7.8 kB) Alexis Bienvenüe, 02/08/2018 08:57 am

without-blank-line.png (7.6 kB) Alexis Bienvenüe, 02/08/2018 08:57 am


History

Updated by Alexis Bienvenüe about 6 years ago

Do you have any LaTeX error?
If you use a blank line before \AMCOpen, I would say you ask LaTeX to begin a new paragraph before the answer zone, right?

Updated by David Dixon about 6 years ago

Good question! The latex error is below. The blank lines are added by LyX. They have no effect with choices, choiceshoriz, or choicescustom. Forcing everything onto one line in LyX sort of works, but then it's very fragile - adding a macro to the text, like "You spend \dayOfWeek on campus" creates an error.

Here's the error if I run the sample bad code:

! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.27 ...scoring{1}\correctchoice[C]{c}\scoring{2}}

Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

Updated by Alexis Bienvenüe about 6 years ago

Here's the error if I run the sample bad code:

With which AMC version? The images I attached come from a single compilation of your sample files, with no errors.

Updated by David Dixon about 6 years ago

1.2.1 (svn:1403)

Updated by Alexis Bienvenüe about 6 years ago

Maybe you can consider updating AMC.

Updated by David Dixon about 6 years ago

This is the current version of AMC on the current LTS release of Ubuntu (16.04). I'll update from your PPA. Thanks!

Updated by David Dixon about 6 years ago

I upgraded to 1.3.0 and now AMC doesn't give me StudentID (from \AMCCode{StudentID}) so I can't make associations. The \AMCCode{StudentIS} is in an \input file (which worked in 1.2.1).

Updated by David Dixon about 6 years ago

I tried inlining the \AMCCode and it still fails. Reverted to 1.2.1 and it works fine. Working on minimal example.

Updated by Alexis Bienvenüe about 6 years ago

OK. Minimal example will be appreciated to explore this problem.

Updated by Alexis Bienvenüe about 3 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF