So I'm trying to put circles around 6,8,10,18 in row 1-4 respectively, however this does give me an error warning saying "missing $ inserted"
\documentclass{article}
\usepackage{mathtools}
\setlength\parindent{0pt}
\usepackage{tikz}
\begin{document}
$
\text{M}=\begin{pmatrix}
4 & \tikz\node[draw,circle]{6} & 4 & 5 \\
3 & 8 & 1 & 6 \\
2 & 9 & 2 & 10 \\
1 & 2 & 3 & 18
\end{pmatrix}
$
\end{document}
How can I correct this error, because positioning various $ around the command hasn't helped so far.





\documentclass{}and ending with\end{document}which allows you to reproduce your error. – AndréC Oct 28 '18 at 13:51