Fehler beim Hochladen nach Moodle bei Verwendung der Matrixumgebung

Fehler beim Hochladen nach Moodle bei Verwendung der Matrixumgebung

Ich versuche zum ersten Mal, ein Quiz in Moodle hochzuladen und erstelle meine Dateien mit dem Paket {Moodle}. Das Problem ist, dass die hochgeladene Datei die Matrixumgebung nicht erkennt und den Code anstelle des Matrixformulars anzeigt. Gibt es dafür eine Lösung?

\documentclass[12pt]{article}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\makeatletter
\renewcommand*\env@matrix[1][c]{\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{*\c@MaxMatrixCols #1}}
\makeatother 
\usepackage{moodle}
   \begin{document}
   \begin{quiz}{Revisiting Linear Algebra}
     \begin{multi}[points=2]{Matrix Form of a Linear System}
       Consider the following system
              \begin{center}
       $
\begin{matrix}[r]
3.0 x_1    &+2.0 x_2     &+2.0  x_3      & -5.0 x_4 & =8 .0   \\
0.6 x_1   &+ 1.5 x_2     &+1.5 x_3       & -5.4 x_4 & =2.7 \\  
1.2 x_1   & -0.3 x_2      & -0.3 x_3      & 2.4 x_4   &  =2.1 , \\  
\end{matrix}
$
   \end{center}


which may be written as a single vector equation; i.e, $\mathbf{AB}=\mathbf{B}$.\\
     The $\mathbf{A}$ matrix associated with the  system is:
\item*
 $
\begin{bmatrix}[r]
3.0    &+2.0      &+2.0        & -5.0   \\
0.6    &+ 1.5      &+1.5        & -5.4   \\  
1.2    & -0.3      & -0.3      & 2.4 , \\  
\end{bmatrix}
$
\item $
\begin{bmatrix}[r]
8 .0   \\
2.7 \\  
2.1  \\  
\end{bmatrix}
$  
  \item $
\begin{bmatrix}[r]
x_1 &\\
x_2& \\  
x_3 &\\  
x_4 &\\
\end{bmatrix}
$       
\item  
$
\begin{bmatrix}[r]
3.0    &+2.0      &+2.0        & -5.0 &  8.0 \\
0.6    &+ 1.5     &+1.5       & -5.4  & 2.7 \\  
1.2    & -0.3      & -0.3       & 2.4 , & 2.1\\  
\end{bmatrix}
$       
\end{multi}

     \begin{multi}[points=2]{Matrix Form of a Linear System}
     Consider the following system
              \begin{center}
       $
\begin{matrix}[r]
3.0 x_1    &+2.0 x_2     &+2.0  x_3      & -5.0 x_4 & =8 .0   \\
0.6 x_1   &+ 1.5 x_2     &+1.5 x_3       & -5.4 x_4 & =2.7 \\  
1.2 x_1   & -0.3 x_2      & -0.3 x_3      & 2.4 x_4   &  =2.1 , \\  
\end{matrix}
$
   \end{center}


which may be written as a single vector equation; i.e, $\mathbf{AB}=\mathbf{B}$.\\
       The $\mathbf{B}$ matrix associated with the  system is:
\item*
       $
\begin{bmatrix}[r]
8 .0   \\
2.7 \\  
2.1  \\  
\end{bmatrix}
$  
\item[fraction=0] 
 $
\begin{bmatrix}[r]
3.0    &+2.0      &+2.0        & -5.0   \\
0.6    &+ 1.5      &+1.5        & -5.4   \\  
1.2    & -0.3      & -0.3      & 2.4 , \\  
\end{bmatrix}
$
  \item[fraction=0]   
 $
\begin{bmatrix}[r]
x_1 &\\
x_2& \\  
x_3 &\\  
x_4 &\\
\end{bmatrix}
$       
\item[fraction=0]   
 $
\begin{bmatrix}[r]
3.0    &+2.0      &+2.0        & -5.0 &  8.0 \\
0.6    &+ 1.5     &+1.5       & -5.4  & 2.7 \\  
1.2    & -0.3      & -0.3       & 2.4 , & 2.1\\  
\end{bmatrix}
$       
     \end{multi}     

 \end{quiz}
\end{document}

Antwort1

DerHandbuchfor moodle.sty(Seite 10) erwähnt, dass nur vier Umgebungen erkannt und in HTML konvertiert werden: center, enumerate, itemizeund tikzpicture. Alle anderen Umgebungen, wie matrix, können daher nicht verwendet werden. Zitat (Hervorhebung von mir):

Beachten Sie, dass moodle.sty keine anderen TEX- oder LATEX-Befehle in HTML umwandeln kann. Wenn andere Sequenzen verwendet werden, können diese wörtlich übernommenzur XML-Datei oder kann zu unvorhergesehenen Ergebnissen führen.

Innerhalb einer können Sie jedoch tikzpictureLaTeX-Code verwenden node, wodurch Sie die Umgebung nutzen können matrix. Die Matrizen werden von Moodle in Bilder umgewandelt und in Base64-Kodierung in der .xmlDatei gespeichert, ähnlich wie .pngbeispielsweise beim Einbinden von Dateien.

\tikzexternalizeBeachten Sie, dass Sie dies möglicherweise explizit in Ihrem Quiz-Quellcode aufrufen müssen, damit dies funktioniert . shell-escapeDies ist ebenfalls erforderlich (dasselbe wie bei Bildern).

MWE:

\documentclass[12pt]{article}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\usepackage{tikz}
\makeatletter
\renewcommand*\env@matrix[1][c]{\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{*\c@MaxMatrixCols #1}}
\makeatother 
\usepackage{moodle}
\usetikzlibrary{external} % set this 
\tikzexternalize          % explicitly

\begin{document}
\begin{quiz}{Revisiting Linear Algebra}
\begin{multi}[points=2]{Matrix Form of a Linear System}
Consider the following system
       
\begin{tikzpicture} % matrix inside of tikzpicture node
\node{
$\begin{matrix}[r]
3.0 x_1    &+2.0 x_2     &+2.0  x_3      & -5.0 x_4 & =8 .0   \\
0.6 x_1   &+ 1.5 x_2     &+1.5 x_3       & -5.4 x_4 & =2.7 \\  
1.2 x_1   & -0.3 x_2      & -0.3 x_3      & 2.4 x_4   &  =2.1 , \\  
\end{matrix}
$};
\end{tikzpicture}

which may be written as a single vector equation; i.e, $\mathbf{AB}=\mathbf{B}$.\\
The $\mathbf{A}$ matrix associated with the system is:
\item*
\begin{tikzpicture}
\node{ $
\begin{bmatrix}[r]
3.0    &+2.0      &+2.0        & -5.0   \\
0.6    &+ 1.5      &+1.5        & -5.4   \\  
1.2    & -0.3      & -0.3      & 2.4 , \\  
\end{bmatrix}
$};\end{tikzpicture}
\item\begin{tikzpicture}
\node{ $
\begin{bmatrix}[r]
8 .0   \\
2.7 \\  
2.1  \\  
\end{bmatrix}
$};\end{tikzpicture}  
  \item \begin{tikzpicture}
\node{$
\begin{bmatrix}[r]
x_1 &\\
x_2& \\  
x_3 &\\  
x_4 &\\
\end{bmatrix}
$};\end{tikzpicture}       
\item  
\begin{tikzpicture}
\node{$
\begin{bmatrix}[r]
3.0    &+2.0      &+2.0        & -5.0 &  8.0 \\
0.6    &+ 1.5     &+1.5       & -5.4  & 2.7 \\  
1.2    & -0.3      & -0.3       & 2.4 , & 2.1\\  
\end{bmatrix}
$};\end{tikzpicture}       
\end{multi}
 \end{quiz}
\end{document}

Teil der resultierenden XML:

<questiontext format="html">
    <text><![CDATA[<p>Consider the following system </P>
<P><IMG SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc4AAACOCAYAAAC4 etc.

Antwort2

Die beste Lösung scheint der Ersatz matrixdurch arrayeine Lösung zu sein, wie sie von Moodle vorgeschlagen wird.Handbuch, wie folgt:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{moodle}
   \begin{document}
   \begin{quiz}{Revisiting Linear Algebra}
    
     \begin{multi}[points=2]{Matrix Form of a Linear System}
       Consider the following system
       \[
        \left[
\begin{array}{ccccc}
3.0 x_1    &+2.0 x_2     &+2.0  x_3      & -5.0 x_4 & =8.0\\
0.6 x_1   &+ 1.5 x_2     &+1.5 x_3       & -5.4 x_4 & =2.7\\  
1.2 x_1   & -0.3 x_2      & -0.3 x_3      & 2.4 x_4   &  =2.1 , \\  
\end{array}\right]
\]
  
which may be written as a single vector equation; i.e, $\mathbf{AB}=\mathbf{B}$.\\
     The $\mathbf{A}$ matrix associated with the  system is:   
\item* First answer
\[
 \left[
\begin{array}{cccc}
3.0    &+2.0      &+2.0        & -5.0   \\
0.6    &+ 1.5      &+1.5        & -5.4   \\  
1.2    & -0.3      & -0.3      & 2.4 , \\
\end{array}
\right]
\]
\item Second answer
\end{multi}

 \end{quiz}
\end{document}

Wichtiger Hinweis: die aktuell veröffentlichte moodlePaketversion 0.5 ist veraltet und hat einen Fehler, der nicht behandelt werden kann \\. Sie müssen die neueste Version herunterladen vonHier. Installationsrichtlinien sindHier.

verwandte Informationen