0

enter image description hereMy code is below, and the error I got is details:

Package tikz Error: Sorry, the system call 'pdflatex -halt-on-error -interact ion=batchmode -jobname "Midterm-tikztemp-1" "\def\tikzexternalrealjob{Midterm}\input{Midterm}"' did NOT result in a usable output file 'Midterm-tikztemp-1' (expected one of .pdf:.jpg:.jpeg:.png:). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that.

and I got the error in the picture when I add --enable-write18, also when I used terminal it didn't work as shown in the picture as well.error in terminal

I still couldn't figure out how to solve the problem.

\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
\usepackage{graphicx}
 
\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:
\end{multi}
 \end{quiz}
\end{document}
  • The error message helps you a lot with this. You are using tikzexternalize. This feature does only work if LaTeX is able to execute other commands during the process of compiling your document, in this case generating the PDF that should be externalized and include it as an external source. You have to look at how you can enable shell-escape in your software. "Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that." – Sam Oct 20 at 15:28
  • Texworks: tex.stackexchange.com/questions/82699/… – Sam Oct 20 at 15:30
  • Texmaker: tex.stackexchange.com/questions/236641/… – Sam Oct 20 at 15:31
1

There are several issues in your code. First of all, you don't need to include the matrix into a TikZ node, so I removed the tikzpicture for the time being. If you need it for other graphics, e.g. the one in your screenshot, feel free to add it. Now that you have enabled --shell-escape, it should work.

Next, moodle expects to have answers for each problem, and you didn't define any, which results in an error. So the first step would be to add your answers with \item and \item* for the correct answer.

Lastly, the matrix has to be in a math environment. Your use of $ is not correct in this case. Do only use the dollar sign for in-line math expressions, not for entire blocks. Rather use \begin{math}\end{math} or \begin{displaymath}\end{displaymath} to wrap the matrix. Your optional argument [r] is non-existant, so LaTeX will just print [r] in the 1,1 position of your matrix.

See this MWE of a functioning moodle question:

\documentclass[12pt]{article}
\usepackage{amsmath,amsthm, amssymb}
\usepackage{moodle}

\begin{document}
\begin{quiz}{Revisiting Linear Algebra}
    \begin{multi}[points=2]{Matrix Form of a Linear System}
        Consider the following system
        
        \begin{math}
            \begin{matrix}
                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{math}
        
        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{Foo}
        \item*{Bar}
        \item{Bacon}
        \item{Eggs}
    \end{multi}
\end{quiz}
\end{document}

moodle MWE

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.