<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[tikz,convert={outfile=\jobname.svg}]{standalone}

\usetikzlibrary{automata}
\usepackage{utf8}

\begin{document}

\begin{tikzpicture}
\node[state,initial] (qstart) at (0,0) {$q_0$};
\node[state] (pass0) at (3,0) {$q_1$};
\node[state] (pass1) at (6,0) {$q_2$};
\node[state] (erase1) at (9,0) {$q_3$};
\node[state] (rewind) at (12,0) {$q_4$};

\node (accept) at (0,2) {halt and accept};
\node (reject) at (3,-2) {halt and reject};

\draw[-&gt;]
 (qstart) edge node[above] {$0 â†’ \textvisiblespace, R$} (pass0)
          edge node[right] {$1$} (reject)
          edge node[right] {$\textvisiblespace$} (accept)

 (pass0) edge node[right] {$\textvisiblespace$} (reject)
         edge[loop above] node[above] {$0 â†’ 0, R$} (pass0)
         edge node[above] {$1 â†’ 1, R$} (pass1)

 (pass1) edge node[above] {$\textvisiblespace â†’ \textvisiblespace, L$} (erase1)
         edge node[right] {$0$} (reject)
         edge [loop above] node[above] {$1 â†’ 1, R$} (pass1)

 (erase1) edge node[above] {$1 â†’ \textvisiblespace, L$} (rewind)

 (rewind) edge[loop below] node[below,align=left] {$0 â†’ 0, L$ \\ $1 â†’ 1,L$} (rewind)
          edge[bend right] node[above] {$\textvisiblespace â†’ \textvisiblespace,R$} (qstart)
;

\end{tikzpicture}

\end{document}
</pre></body></html>