
저는 처음으로 Moodle에 퀴즈를 업로드하려고 하며 {Moodle} 패키지를 사용하여 파일을 생성하고 있습니다. 문제는 업로드된 파일이 매트릭스 환경을 인식하지 못하고 매트릭스 형태가 아닌 코드를 표시한다는 것입니다. 이에 대한 해결책이 있습니까?
\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}
답변1
그만큼수동for (10페이지) 에서는 , 및 4 개의 moodle.sty
환경만 인식되고 html로 변환된다고 언급합니다 . 따라서 등의 다른 모든 환경 은 사용할 수 없습니다. 인용문(강조):center
enumerate
itemize
tikzpicture
matrix
무들레.sty는 다른 TEX나 LATEX 명령을 HTML로 변환하는 방법을 모른다는 점에 유의하세요. 다른 시퀀스가 사용되는 경우 그대로 통과XML 파일에 추가하거나 예기치 않은 결과를 초래할 수 있습니다.
그러나 a 내에서는 tikzpicture
LaTeX 코드를 사용하여 환경을 node
사용할 수 있습니다 matrix
. 행렬은 Moodle에 의해 이미지로 변환되고 파일을 .xml
포함하는 것과 유사하게 파일 에 base64 인코딩으로 저장됩니다 .png
.
\tikzexternalize
이 작업을 수행하려면 퀴즈 소스 코드에서 명시적 으로 호출해야 할 수도 있습니다 . 또한 shell-escape
필요합니다(이미지와 동일).
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}
결과 XML의 일부:
<questiontext format="html">
<text><![CDATA[<p>Consider the following system </P>
<P><IMG SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAc4AAACOCAYAAAC4 etc.
답변2
모범 사례 솔루션은 Moodle에서 제안한 솔루션 matrix
으로 대체되는 것 같습니다.array
수동, 다음과 같습니다:
\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}
중요 사항: 현재 공개된 moodle
패키지 버전 0.5는 오래되어 처리하지 못하는 버그가 있습니다 \\
. 에서 최신 버전을 다운로드해야 합니다.여기. 설치 지침은여기.