Skip to content

Commit

Permalink
Add example and doc on tikz
Browse files Browse the repository at this point in the history
  • Loading branch information
nennigb committed Mar 27, 2020
1 parent 7b3c626 commit 2f0f0b6
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 5 deletions.
Binary file modified amc2moodle.pdf
Binary file not shown.
4 changes: 4 additions & 0 deletions amc2moodle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ cat << EOF
This script converts a tex file of AMC questions into an xml file
suitable for moodle import. Only question and questionmult
environnement are ready!
This GNU bash script is not fully compatible with Mac. See issues
on amc2moodle github.
OPTIONS:
-h Show this message
Expand Down
8 changes: 5 additions & 3 deletions doc/amc2moodle.tex
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ \subsection{Command line call}

\subsection{Code structure}
%-----------------------------------------------------------------------
The command line calls a shell script \texttt{amc2moodle.sh}. This script then call
The command line calls a shell script \texttt{amc2moodle.sh}. This script work with linux and can be adapted for mac\footnote{see \url{https://github.com/nennigb/amc2moodle/issues/2}}. This script then call
\begin{itemize}
\item \texttt{LateXML} with \texttt{automuliplechoice.sty.ltxml}. The package has been made using \texttt{note} element in LateXML and most of AMC environment or command names are pass through attribute (in french for the moment). User command can be added in the .tex file. This first step is used to get an XML file \texttt{tex2xml.xml}. Thanks to \texttt{LateXML}, most \LaTeX possibilities are supported in the conversion to moodle. Note that option passed to \texttt{automuliplechoice.sty} package are ignored.

Expand All @@ -129,13 +129,15 @@ \subsection{What you can do}
\item Use user's command defined in the \LaTeX~file.
\item \texttt{\textbackslash usepackage[utf8]\{inputenc\}} for accents
\item Use packages that are supported by \texttt{LateXML}. See the list at \url{http://dlmf.nist.gov/LaTeXML/manual/included.bindings/}. Instead you need to add a binding to \texttt{LateXML}.
\item All answsers are Shuffled by default, you can keep the answer initial order by setting \texttt{ShuffleAll = False} in \texttt{grading.py}
\item Use \texttt{tikz}. \texttt{LateXML} generates \texttt{svg} content, embedded in the question or answer html text.
\item All answers are Shuffled by default, you can keep the answer initial order by setting \texttt{ShuffleAll = False} in \texttt{grading.py}
\end{itemize}

\subsection{What you cannot do}\label{sec:cannot}
% ========================================================================
\begin{itemize}
\item Use underscore in question name field !
\item Use accentuated path (problem with \texttt{lxml} and python2)
\item Use verbatim. This environment is not supported by \texttt{automultiplechoice} 1.0.3. Use \texttt{alltt} package instead.
\item Use font size (easy to add)
\item Use amsmath environments like align, aligned\dots Because \texttt{tex} attribute of \elem{equation}, provided by \texttt{LateXML} output, doesn't contains really the raw tex equation.
Expand Down Expand Up @@ -218,7 +220,7 @@ \section{Example}
\end{questionmult}
}
\end{verbatim}
\includepdf[pages=-,scale=.95,nup=1x2,landscape,
\includepdf[pages=-,scale=.95,nup=1x1,%portrait,
pagecommand={\thispagestyle{plain}},linktodoc=false,
addtotoc={1,subsection,1,AMC example,sec:exQCM}]{../test/QCM.pdf}
Expand Down
Binary file modified test/QCM.pdf
Binary file not shown.
21 changes: 20 additions & 1 deletion test/QCM.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
\usepackage{graphicx}
\usepackage[francais,bloc,completemulti]{automultiplechoice} % Mandatory for conversion
%\usepackage{attachfile}

\usepackage{tikz}

% exemple de commande utilisateur
\providecommand{\abs}[1]{\lvert#1\rvert}
Expand Down Expand Up @@ -168,6 +168,24 @@
\end{questionmult}
}

% test for tikz
\element{tikz}{
\begin{question}{tikz:Q1}
Among the following shape, where is the circle

\begin{choices}
\correctchoice{\begin{tikzpicture}
\draw (2,2) circle (1cm);
\end{tikzpicture}}
\wrongchoice{\begin{tikzpicture}
\filldraw[fill=blue!40!white, draw=black] (0,0) rectangle (2,2);
\draw (0,0) parabola (2,2);
\end{tikzpicture}}
\wrongchoice{$\triangle$}
\end{choices}
\end{question}
}

% #################################################################
% C R E A T I O N D E S C O P I E S
% #################################################################
Expand Down Expand Up @@ -203,6 +221,7 @@
\copygroup{cat1}{BigGroupe}
\copygroup{cat2}{BigGroupe}
\copygroup{english}{BigGroupe}
\copygroup{tikz}{BigGroupe}
\melangegroupe{BigGroupe}
\restituegroupe{BigGroupe}
}
Expand Down
36 changes: 35 additions & 1 deletion test/QCM.xml

Large diffs are not rendered by default.

0 comments on commit 2f0f0b6

Please sign in to comment.