TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just curious if anyone had a good recommendation for generating a Turing machine style image using perhaps TikZ or something else that would create an image similar to the one shown here.

Turing Machine

Any sample/example code or links to similar content would be very much appreciated.

share|improve this question
There are a couple of examples here that might get you started: TeXample.net – Alan Munn Mar 28 '12 at 17:15
Have a look at his answer to a similar question which might be helpful for the lower part. – Martin Scharrer Mar 28 '12 at 17:34
up vote 5 down vote accepted

A quick example using the style from the answer that Martin linked to:

\begin{tikzpicture}[every node/.style={block},
        block/.style={minimum height=1.5em,outer sep=0pt,draw,rectangle,node distance=0pt}]
   \node (A) {$\sigma$};
   \node (B) [left=of A] {$\ldots$};
   \node (C) [left=of B] {$B$};
   \node (D) [right=of A] {$\ldots$};
   \node (E) [right=of D] {$\$ $};
   \node (F) [above = 0.75cm of A,draw=red,thick] {\textsf q};
   \draw[-latex] (F) -- (A);
   \draw[-latex,blue] ($(F.east)!0.5!(A.east)$) -- ++(7mm,0);
   \draw (C.north west) -- ++(-1cm,0) (C.south west) -- ++ (-1cm,0) 
                 (E.north east) -- ++(1cm,0) (E.south east) -- ++ (1cm,0);

enter image description here

share|improve this answer
I've deliberately avoided the cent symbol. – percusse Apr 22 '12 at 15:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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