Giter Site home page Giter Site logo

nennigb / amc2moodle Goto Github PK

View Code? Open in Web Editor NEW
20.0 6.0 8.0 3.07 MB

amc2moodle, is an automatic tool to convert multiple choice quiz between auto-muliple-choice LaTeX format and moodle XML format.

License: GNU General Public License v3.0

Python 58.30% XSLT 11.26% TeX 28.85% Shell 1.02% Dockerfile 0.57%
moodle-xml-format multiple-choice moodle latexml auto-multiple-choice moodle-xml

amc2moodle's People

Contributors

adl avatar luclaurent avatar nennigb avatar pablooliveira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

amc2moodle's Issues

Problem for installing in Mac (Mojave)

Hi,

Feel free to ask your questions here :

  • on the usage
  • on bugs
  • ...

In case of trouble during the conversion, put the command line output to help to locate the origin of the problem.

nennigb

Quality loss on pictures (pdf)

I observe a loss of quality on the pictures after the xml conversion (pdf file):

Original file:
image

File in Moodle:
image

This is probably due to the convert process of Imagemagick.

description questions

I have several problems written using AMC that I'd like to convert to Moodle. (And in the future, I'd like to continue writing my problems using AMC before converting them to Moodle, because its much easier than using Moodle's web interface.)

These problems consist in several paragraphs of introduction (and often some pseudo-code and tikz figures), followed by several AMC questions. All of this is written in one \element{}{...} block.

Here is an example:

\element{analyse}{

  Some descriptive text presenting the next two functions.

  \begin{multicols}{2}
    \inputminted{c}{exam-201901-fun1.c}
    \columnbreak
    \inputminted{c}{exam-201901-fun2.c}
  \end{multicols}

  \begin{multicols}{2}
\begin{question}{anal1}\bareme{b=1,m=0}
  Question1 text.
 \begin{choices}
  \wrongchoice{...}
  \wrongchoice{...}
  \wrongchoice{...}
  \correctchoice{...}
\end{choices}
\end{question}

\begin{question}{anal2}\bareme{b=2,m=0}
  Question 2 text?
\begin{multicols}{3}
  \begin{choices}[o]
  \wrongchoice{...}
  \wrongchoice{...}
  \correctchoice{...}
  \wrongchoice{...}
  \wrongchoice{...}
  \wrongchoice{...}
\end{choices}
\end{multicols}
\end{question}

More description.

\begin{question}{anal3}\bareme{b=1,m=0}
  Question3 text.
 \begin{choices}
  \wrongchoice{...}
  \correctchoice{...}
\end{choices}
\end{question}

  \end{multicols}
}

Currently amc2moodle will only convert the questions, but those questions alone are meaningless without the introductory text. Note that we can also have some text between questions, as between question 2 and 3 above (although I could live without).

One plan would be to extract the text that is part of \element{} but not part of any question to create type="description" questions. The \element{} macro gives the category of the question but we need to name the descriptions somehow. And to ease the creation of the moodle quiz, it would best if the various moodle questions (so this includes the descriptions) have name that are alphabetically ordered.

What would you think about the following plan: if amc2moodle detects that \element contains description text, then all questions names would be prefixed by some number representing the index of this question. In addition to help the author ordering the question on moodle, the number prefix would make each question name unique, allowing all descriptive questions to be named simply description. For the above example, the names would be:

1.description
2.anal1
3.anal2
4.description
5.anal3

For extracting the description questions, I'm thinking that maybe one option is to open some tag in \element{}, then close it upon entering \begin{question} and reopen it when exiting the question. Then we need some way to remove those tags if they are empty.

What do you think?

PS: the above example also raises another issue, which isn't very important to me at this point: removing multicols seems OK when it's used to arrange questions or answers, but it could also be legitimately used in the text of a question.

Suppress CompleMulti

Hi,
how to suppress the CompleMulti option that seems to be set to true by default ?
I tried the AMC macro \AMCnoCompleteMulti but it is not recognized : 1 undefined macro[\AMCnoCompleteMulti].
Fred

Problem with white spaces in `\scoring` command

I observed that

\baremeDefautS{e=-0.5,b=1,m=-0.5}

works fine, but if white spaces are present after the comma like in

\baremeDefautS{e=-0.5, b=1,m=-0.5}

it fails since the scoring parser (in convert.py) do not trim white space in the body of the string.

Choosing the percentage of a score

Hi Benoit,

is there a way to choose the percentage of a score that applies to an answer?
For example in a true/false question, choosing 100% for a good response and -100% for the bad response.

Fred

moodle2amc issue with accent text amd gift questions

  1. When converting moodle xml format to AMC tex, moodle2amc does not remove accented characters, from group and question names. These letters are accepted in moodle but not in AMC. amc2moodle should change, for example, an 'à' by an 'a'. Otherwise it is only useful in English and for other languages a painful revision must be done by hand.
  2. When converting moodle xml format to AMC tex, options are only included in the output tex file if they are in [moodle] format. Moodle XML stores questions in two formats [moodle] and [gift] (https://docs.moodle.org/310/en/GIFT_format). Gift is simpler and widely used. moodle2amc converts [gift] questions text, but no answers. Options must be added by hand in a long and painful process.
    Hope these issues are easy to solve.

ValueError: dictionary update sequence element #2 has length 1; 2 is required

Hello. I have this problem:
ValueError: dictionary update sequence element #2 has length 1; 2 is required

[INFO    ]: ======================== 
[INFO    ]: ======================== 
[INFO    ]: === Start amc2moodle === 
[INFO    ]: ======================== 
[INFO    ]: ======================== 
[INFO    ]: ====== Build XML ======= 
[INFO    ]:  > Search for magic comments... 
[INFO    ]:  > Running LaTeXML pre-processing (may take a while)... 
[INFO    ]:  > Running LaTeXML conversion 
[INFO    ]:  > Running Python conversion... 
Traceback (most recent call last):
  File "/home/alain/Applications/amc2moodle/./bin/amc2moodle", line 163, in <module>
    run()
  File "/home/alain/Applications/amc2moodle/./bin/amc2moodle", line 148, in run
    a2m.amc2moodle(fileInput=fileIn, fileOutput=fileOut,keepFlag=keepFlag, catname=catname,indentXML=indentFlag, usetempdir=tempDir,magic_flag=magic_flag, cleanXML=cleanXML,include_styles=include_styles)
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/amc2moodle_class.py", line 171, in __init__
    self.runBuilding()
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/amc2moodle_class.py", line 329, in runBuilding
    convert.to_moodle(
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/convert.py", line 1116, in to_moodle
    quiz.toMoodle(os.path.join(pathout, fileout))
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/convert.py", line 852, in toMoodle
    self._scoring()
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/convert.py", line 981, in _scoring
    amc_bm = scoring2dict(barm[0].text)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alain/Applications/amc2moodle/lib/python3.11/site-packages/amc2moodle/amc2moodle/convert.py", line 109, in scoring2dict
    scoring = dict(map(str.strip, item.split("=")) for item in text.split(","))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: dictionary update sequence element #2 has length 1; 2 is required

Problems with mhchem package

Hi,
thanks for this very nice code. I am trying to use it with my test but I have a lot of chemical formulae written using the package mhchem which is quite used for chemical notations. Is it possible to add some biding for this package? The syntax is quite simple, it introduces a new latex environment "\ce{}" in which the chemical formulae or equation is typed. For example
\ce{H^+} gives a result simular to $\mathrm{H}^+$.
At the moment amc2moodle complains that the symbol ^ can be used only in math mode so I get an XML file full of errors.
Is it possible to solve or at least bypass the problem?

Thanks,
Raffaele

regression in translating < and > symbols: they are not output as &lt; and &gt; anymore

Hi!

I recently had to reconvert a question I had successfully translated with an older version of amc2moodle, but the new version failed to render online. My question had a large equation containing symbols < and >. The produced XML output was incorrectly producing those symbols verbatim, instead of escaping them with < and >. This in turn caused the online rendering of the question to be completely broken, because the browser would see opening tags in my equation when there was none, and then it would attempt to close those to fix things up.

I know that version 2.5.0 correctly escapes < and >, as this is the version I ended up using.
Version 2.6.0 is broken in that regards.

In patch e02307b, you can see the regression appearing in this snippet:

--- a/amc2moodle/amc2moodle/test/QCM.xml
+++ b/amc2moodle/amc2moodle/test/QCM.xml
@@ -91,7 +92,7 @@
     
   ]]></text></questiontext><answer format="html" fraction="33.333333333333336"><text><![CDATA[ Ou en <tt>C</tt> using <tt>alltt</tt> package
 <p><pre>
-int s=-2; <br/>for (int i=0;i&lt;4; i++)<text font="serif">{</text> <br/>s=i*i+s; <br/><text font="serif">}</text>
+int s=-2; <br/>for (int i=0;i<4; i++)<text font="serif">{</text> <br/>s=i*i+s; <br/><text font="serif">}</text>
 </pre></p>
 ]]></text></answer><answer format="html" fraction="33.333333333333336"><text><![CDATA[
            \(\lvert-10-2\rvert\)

Running the examples

In these COVID times your repository attracted me.

I am running the three examples provided (QCM, QCM_wo-tikz and numerical).
For the latter it works fine.
For the two first ones I a experiencing the following issue

Running Python conversion...
Traceback (most recent call last):
File "/Users/vkeryvin/opt/anaconda3/bin/amc2moodle", line 117, in
run()
File "/Users/vkeryvin/opt/anaconda3/bin/amc2moodle", line 108, in run
magic_flag=magic_flag)
File "/Users/vkeryvin/opt/anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/amc2moodle_class.py", line 149, in init
self.runBuilding()
File "/Users/vkeryvin/opt/anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/amc2moodle_class.py", line 271, in runBuilding
deb=self.deb)
File "/Users/vkeryvin/opt/anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/convert.py", line 1006, in to_moodle
quiz.toMoodle(os.path.join(pathout, fileout))
File "/Users/vkeryvin/opt/anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/convert.py", line 781, in toMoodle
self._graphics()
File "/Users/vkeryvin/opt/anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/convert.py", line 890, in _graphics
img_name = Ii.attrib['candidates'].split(',')[-1] #get the last candidates
File "src/lxml/etree.pyx", line 2479, in lxml.etree._Attrib.getitem
KeyError: 'candidates'

I'm using OSX 10.15.5
Thank you for your repo and hope you can help me.

NOT numbering of moodle answers

When I use AMC, each possible choice has a box to tick, and these choices are not numbered.

Testing amc2moodle on a small example, I see that each possible answer gets numbered (a, b, c, ...).
This can be quite confusing. Consider:

What is the first letter of the alphabet?

Select one:
◯ a. b
◯ b. z
◯ c. a

Clearly I'd prefer to see

What is the first letter of the alphabet?

Select one:
◯ b
◯ z
◯ a

How do you feel about forcing <answernumbering>none</answernumbering> for all questions?

Trouble with figures not in the root folder

Considering the following latex script:

\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{array}
\usepackage[francais,bloc,correc]{automultiplechoice}
\usepackage{multicol}
\usepackage{subfig}
\usepackage{graphics}
\newcommand{\vect}[1]{\overrightarrow{#1}}

\graphicspath{{figures/}} 

\begin{document}
\element{cinematique}{
  \begin{question}{graphestructure}
    So
    \begin{center}
      \includegraphics[width=0.5\textwidth]{graphe_structure.pdf}
    \end{center}
    \begin{reponses}
      \bonne{aa}
    \end{reponses}
  \end{question}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\exemplaire{1}{
\restituegroupe{cinematique}
\AMCcleardoublepage
}
\end{document}

graphe_structure.pdf is not on the root folder but in figures.

amc2moodle is not working. See below:

``` Input file: debug.tex - status: OK ======================== ======================== === Start amc2moodle === ======================== ======================== ====== Parameters ====== > path input TeX: . > input TeX file: debug.tex > temporary directory: /var/folders/fg/53phbn8n6nd3vrhm3sh_36w40000gn/T > path output TeX: . > output XML file: debug.xml > temp XML file: /var/folders/fg/53phbn8n6nd3vrhm3sh_36w40000gn/T/tmp83_bxlid/tex2xml.xml > keep temp files: False > categorie name: amc ====== Build XML ======= > Running LaTeXML pre-processing... > Running LaTeXML conversion latexml (LaTeXML version 0.8.4; revision 456c715) processing started Tue Jun 30 22:08:30 2020

(Digesting TeX debug...
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/TeX.pool.ltxml...
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/eTeX.pool.ltxml... 0.00 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/pdfTeX.pool.ltxml... 0.00 sec) 0.11 sec)
(Processing content ZZZZ/amc2moodle/debug.tex...
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/LaTeX.pool.ltxml... 0.14 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/article.cls.ltxml... 0.01 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/inputenc.sty.ltxml...
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/utf8x.def.ltxml... 0.00 sec) 0.00 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/fontenc.sty.ltxml...
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/t1enc.def.ltxml...
Warning:missing_file:t1enc Can't find definitions t1enc
at t1enc.def.ltxml; line 24
Anticipate undefined macros or environments
search paths are ZZZZ/amc2moodle, ZZZZ/Anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle
In Core::Gullet[@0x7f910d25dc78] /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/t1enc.def.ltxml; line 24
0.00 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/t1.fontmap.ltxml... 0.00 sec) 0.01 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/amsmath.sty.ltxml...
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/amsbsy.sty.ltxml... 0.00 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/amstext.sty.ltxml... 0.00 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/amsopn.sty.ltxml... 0.00 sec) 0.02 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/array.sty.ltxml... 0.00 sec)
(Loading ZZZZ/Anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/automultiplechoice.sty.ltxml... 0.00 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/multicol.sty.ltxml... 0.00 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/subfig.sty.ltxml... 0.00 sec)
(Loading /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/Package/graphics.sty.ltxml... 0.01 sec)
Warning:expected: Missing number, treated as zero.
at debug.tex; line 25 col 0 - line 25 col 17
while processing \textwidth
In Core::Gullet[@0x7f910d25dc78] ZZZZ/amc2moodle/debug.tex; from line 25 col 0 to line 25 col 17
0.23 sec) 0.34 sec)
(Building...
(Loading compiled schema /usr/local/Cellar/latexml/HEAD-456c715/libexec/lib/perl5/LaTeXML/resources/RelaxNG/LaTeXML.model... 0.01 sec). 0.04 sec)
(Rewriting... 0.00 sec)
(Finalizing... 0.00 sec)
Conversion complete: 2 warnings; 1 missing file[t1enc.def].
processing finished Tue Jun 30 22:08:31 2020

Running Python conversion...
Traceback (most recent call last):
File "ZZZZ/Anaconda3/bin/amc2moodle", line 111, in
run()
File "ZZZZ/Anaconda3/bin/amc2moodle", line 102, in run
indentXML=indentFlag, usetempdir=tempDir)
File "ZZZZ/Anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/amc2moodle_class.py", line 142, in init
self.runBuilding()
File "ZZZZ/Anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/amc2moodle_class.py", line 227, in runBuilding
deb=self.deb)
File "ZZZZ/Anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/convert.py", line 331, in to_moodle
Ii = encodeImg(Ii, pathin, wdir)
File "ZZZZ/Anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/convert.py", line 93, in encodeImg
img_path)
File "ZZZZ/Anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/convert.py", line 49, in init
self.convertImage(fileIn, fileOut)
File "ZZZZ/Anaconda3/lib/python3.7/site-packages/amc2moodle/amc2moodle/convert.py", line 55, in convertImage
im = wandImage(filename=fileIn)
File "ZZZZ/Anaconda3/lib/python3.7/site-packages/wand/image.py", line 8294, in init
units=units)
File "ZZZZ/Anaconda3/lib/python3.7/site-packages/wand/image.py", line 8774, in read
self.raise_exception()
File "ZZZZ/Anaconda3/lib/python3.7/site-packages/wand/resource.py", line 243, in raise_exception
raise e
wand.exceptions.BlobError: unable to open image 'graphe_structure.pdf': No such file or directory @ error/blob.c/OpenBlob/3496

</details>

[Archive.zip](https://github.com/nennigb/amc2moodle/files/4854166/Archive.zip)



[solved] Shuffling the answers of a question

Hello,

Your tool is very useful and time saving. Still, when importing the xml file to moodle, the box for automatic shuffle of the answers is not checked.

Please consider adding the following code to the xml file : <shuffleanswers>true</shuffleanswers>

Thanks

Improve verbosity in moodle2amc

In the case of the use of \AMCnumericChoices in the LaTeX, the conversion from XML to LaTeX could require to add some details in the LaTeX file to precise what kind of answer is expected.

Trouble with long equation after update in Moodle due to '%' added during processing

Considering the following file:

\documentclass{article}
% \usepackage[combine]{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{array}
\usepackage[francais,bloc,correc]{automultiplechoice}
\usepackage{multicol}
\usepackage{subfig}
\usepackage{graphics}
\newcommand{\vect}[1]{\overrightarrow{#1}}


\graphicspath{{figures/}} 

\begin{document}
\element{dynaS3}{
    \begin{question}{accS3S0tttt}%\bareme{\barQmult}
        \`A partir des résultats précédents, donner l'expression dans la base $(\vect{x_1},\vect{y_1},\vect{z_0})$ de l'accélération du point $G_3$ lié à $S_3$ dans son mouvement par rapport à $R_0$:
        \[\vect{\Gamma_{({G_3},S_3/R_0})}\]
        \begin{reponses}
            \mauvaise{$(\ddot{\lambda}-\lambda\dot{\theta}_{1}^{2})\vect{x_{1}}+(\lambda\ddot{\theta}_{1}+2\dot{\lambda}\dot{\theta}_{1})\vect{y_{1}}$}
            \mauvaise{$\ddot{\lambda}\vect{x_{1}}+\lambda\ddot{\theta}_{1}\vect{y_{1}}$}
            \bonne{$\ddot{\lambda}\vect{x_{1}}$}
            \mauvaise{$\ddot{\lambda}\vect{x_{1}}+(\lambda\ddot{\theta}_{1}+\dot{\lambda}\dot{\theta}_{1})\vect{y_{1}}$}
        \end{reponses}
    \end{question}
}

\exemplaire{1}{
    \restituegroupe{dynaS3}
    \AMCcleardoublepage
}

\end{document}

After processing with amc2moodle, the following xml file is built:

<?latexml class="article"?>
<?latexml package="inputenc" options="utf8x"?>
<?latexml package="fontenc" options="T1"?>
<?latexml package="amsmath"?>
<?latexml package="array"?>
<?latexml package="automultiplechoice" options="francais,bloc,correc"?>
<?latexml package="multicol"?>
<?latexml package="subfig"?>
<?latexml package="graphics"?>
<?latexml graphicspath="/Users/luclaurent/Documents/1PRO/Enseignement/CNAM/HTT_MEC121/ExamensPartiels/2019_Examen2/figures"?>
<?latexml RelaxNGSchema="LaTeXML"?>
<quiz>
  
  
  <question type="category"><category><text>$course$/amc/dynaS3</text></category></question>
  <question type="multichoice"><single>true</single><name><text>accS3S0tttt</text></name><questiontext format="html"><text><![CDATA[
      
        <p>À partir des résultats précédents, donner l’expression dans la base 
           \((\overrightarrow{x_{1}},\overrightarrow{y_{1}},\overrightarrow{z_{0}})\)
     de l’accélération du point 
           \(G_{3}\)
     lié à 
           \(S_{3}\)
     dans son mouvement par rapport à 
           \(R_{0}\)
    :</p>
        
          
    $$\begin{equation}
           \overrightarrow{\Gamma_{({G_{3}},S_{3}/R_{0}})}
    \end{equation}$$
    
        
        
        
        
        
      
    ]]></text></questiontext><answer format="html" fraction="-50.0"><text><![CDATA[
           \((\ddot{\lambda}-\lambda\dot{\theta}_{1}^{2})\overrightarrow{x_{1}}+(\lambda%
\ddot{\theta}_{1}+2\dot{\lambda}\dot{\theta}_{1})\overrightarrow{y_{1}}\)
    ]]></text><fraction>-50.0</fraction></answer><answer format="html" fraction="-50.0"><text><![CDATA[
           \(\ddot{\lambda}\overrightarrow{x_{1}}+\lambda\ddot{\theta}_{1}\overrightarrow{y%
_{1}}\)
    ]]></text><fraction>-50.0</fraction></answer><answer format="html" fraction="100.0"><text><![CDATA[
           \(\ddot{\lambda}\overrightarrow{x_{1}}\)
    ]]></text><fraction>100.0</fraction></answer><answer format="html" fraction="-50.0"><text><![CDATA[
           \(\ddot{\lambda}\overrightarrow{x_{1}}+(\lambda\ddot{\theta}_{1}+\dot{\lambda}%
\dot{\theta}_{1})\overrightarrow{y_{1}}\)
    ]]></text><fraction>-50.0</fraction></answer><defaultgrade>1.0</defaultgrade><shuffleanswers>true</shuffleanswers><answernumbering>abc</answernumbering></question>
  <question type="multichoice"><single>true</single><name><text>momentdynamiqueS3S0G3tttt</text></name><questiontext format="html"><text><![CDATA[
      
        <p>Exprimer dans la base 
           \((\overrightarrow{x_{1}},\overrightarrow{y_{1}},\overrightarrow{z_{0}})\)
    , le
moment dynamique de 
           \(S_{3}\)
     dans son mouvement par rapport à

           \(R_{0}\)
     exprimé en 
           \(O\)
    :</p>
        
          
    $$\begin{equation}
           \overrightarrow{\delta_{(O,S_{3}/R_{0})}}
    \end{equation}$$
    
        
        
        
        
        
      
    ]]></text></questiontext><answer format="html" fraction="-50.0"><text><![CDATA[
           \(A_{3}(\dot{\omega}_{x}\overrightarrow{x_{1}}+\omega_{x}\dot{\theta}_{1}%
\overrightarrow{y_{1}})+[(C_{3}+m_{3}\lambda^{2})\ddot{\theta}_{1}+2m_{3}\dot{%
\lambda}\lambda\dot{\theta}_{1}]\overrightarrow{z_{0}}\)
    ]]></text><fraction>-50.0</fraction></answer><answer format="html" fraction="-50.0"><text><![CDATA[
           \(C_{3}\ddot{\theta}_{1}\overrightarrow{z_{0}}\)
    ]]></text><fraction>-50.0</fraction></answer><answer format="html" fraction="100.0"><text><![CDATA[
           \(A_{3}\dot{\omega}_{x}\overrightarrow{x_{1}}+C_{3}\ddot{\theta}_{1}%
\overrightarrow{z_{0}}\)
    ]]></text><fraction>100.0</fraction></answer><answer format="html" fraction="-50.0"><text><![CDATA[
           \(A_{3}(\dot{\omega}_{x}\overrightarrow{x_{1}}+\omega_{x}\dot{\theta}_{1}%
\overrightarrow{y_{1}})+(C_{3}+m_{3}\lambda^{2})\ddot{\theta}_{1}%
\overrightarrow{z_{0}}\)
    ]]></text><fraction>-50.0</fraction></answer><defaultgrade>1.0</defaultgrade><shuffleanswers>true</shuffleanswers><answernumbering>abc</answernumbering></question>
</quiz>

The XML file could be loaded in Moodle. The following question is obtained:

image

But if you update the question or parameters of the question in Moodle (for instance only by clicking on Enregistrer les modifications et continuer (Save and continue), you obtain the following result:

image

As you see some parts of the answers disappear. This trouble seems to be due to two elements:

  • latexml add some % in the long equations that is not necessary.
  • my Moodle server uses a WYSIWYG editor that could alterate the result provided by amc2moodle

Does amc2moodle work with pyparsing 3?

After upgrading to pyparsing 3.0.7, I get the following error when running amc2moodle

Traceback (most recent call last):
  File "/usr/local/bin/amc2moodle", line 22, in <module>
    from amc2moodle.amc2moodle import amc2moodle_class as a2m
  File "/home/USER/.local/lib/python3.8/site-packages/amc2moodle/amc2moodle/amc2moodle_class.py", line 22, in <module>
    from ..amc2moodle import convert
  File "/home/USER/.local/lib/python3.8/site-packages/amc2moodle/amc2moodle/convert.py", line 29, in <module>
    from ..utils.calculatedParser import *
  File "/home/USER/.local/lib/python3.8/site-packages/amc2moodle/utils/calculatedParser.py", line 11, in <module>
    from pyparsing import Word, alphas, nums, alphas, alphanums, Char, oneOf,\
ImportError: cannot import name '_flatten' from 'pyparsing' (/usr/local/lib/python3.8/dist-packages/pyparsing/__init__.py)

Regards

Local scoring is not taken into account anymore.

The local scoring is not taken into account anymore since the xpath search was performed only for first level child nodes.
We need to add stricter tests.
This has been fixed in feature-amc2moodle-addquestiontype branch and the issue will be solved after its merging.

converted file "truncated"

I tried several conversion from moodle to amc, and every tex file ends weirdly, I tried with smaller category without success.
There is no error in the terminal.

Weird behavior in the case of text in element but outside question

Many authors of AMC quizz add text outside questions and automultiplechoice will render it correctly but `amc2moodle' seems to have difficulties to consider it (which can be normal). However in certains cases question(s) could not be imported in Moodle.

The following example does not work.

\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais,bloc,correc]{automultiplechoice}

\begin{document}

\element{test}{
  uioygbjkbk, hhHLJmq jkjlkqjs qjlkjqs lk
  aa
  \begin{question}{qtest}
    Loui
    \begin{reponses}
      \mauvaise{ hein}
      \mauvaise{oh}
      \bonne{ah}
      \mauvaise{ouf}
    \end{reponses}
  \end{question}
}
\exemplaire{1}{
  \restituegroupe{test}
}
\end{document}

One solution seems to add a linebreak before the `\begin{question}' command:

  \documentclass{article}
  \usepackage[utf8x]{inputenc}
  \usepackage[T1]{fontenc}
  \usepackage[francais,bloc,correc]{automultiplechoice}
  
  \begin{document}
  \element{test}{
    uioygbjkbk, hhHLJmq jkjlkqjs qjlkjqs lk
    aa

    \begin{question}{qtest}
      Loui
      \begin{reponses}
        \mauvaise{ hein}
        \mauvaise{oh}
        \bonne{ah}
        \mauvaise{ouf}
      \end{reponses}
    \end{question}
  }
  \exemplaire{1}{
    \restituegroupe{test}
  }
  \end{document}

The XML formatter is able to isolate the text before the \begin{question} in a paragraph <p>...</p> and this syntax seems to be accepted by Moodle.

amc2moodle v2.9.0 was used to diagnose this trouble.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.