{"id":26334566,"url":"https://github.com/pzuehlke/turing-machine-tape-generator","last_synced_at":"2026-05-21T10:02:51.009Z","repository":{"id":157785004,"uuid":"623089996","full_name":"pzuehlke/Turing-machine-tape-generator","owner":"pzuehlke","description":"A Python function which generates LaTeX code for displaying the tape of a Turing machine","archived":false,"fork":false,"pushed_at":"2024-01-10T22:03:22.000Z","size":38,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-01-12T05:01:31.150Z","etag":null,"topics":["latex","python","tikz","turing","turing-machine"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pzuehlke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-04-03T17:13:27.000Z","updated_at":"2024-01-03T11:49:33.000Z","dependencies_parsed_at":"2024-01-10T22:59:58.147Z","dependency_job_id":null,"html_url":"https://github.com/pzuehlke/Turing-machine-tape-generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzuehlke%2FTuring-machine-tape-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzuehlke%2FTuring-machine-tape-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzuehlke%2FTuring-machine-tape-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzuehlke%2FTuring-machine-tape-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pzuehlke","download_url":"https://codeload.github.com/pzuehlke/Turing-machine-tape-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806965,"owners_count":20350937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["latex","python","tikz","turing","turing-machine"],"created_at":"2025-03-16T00:19:48.771Z","updated_at":"2026-05-21T10:02:50.804Z","avatar_url":"https://github.com/pzuehlke.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Turing Machine Tape Generator\n\nThis repository contains Python scripts designed to automate the generation and compilation of [LaTeX](https://en.wikipedia.org/wiki/LaTeX)/[TikZ](https://en.wikipedia.org/wiki/PGF/TikZ) source code for visually representing the tape of a [Turing machine](https://en.wikipedia.org/wiki/Turing_machine).\n\n\n![Examples](examples.png)\n\n\nThe resulting diagram follows the same style as that in Charles Petzold's book [_The Annotated Turing_](https://www.charlespetzold.com/books/). It consists of a grid of squares containing characters from a given input string, with an ultra-thick border around a specified square to indicate the current position of the head, a customizable total number of squares and a few style options.\n\n## Structure\n\nThe program consists of three scripts:\n\n1. `generate_tikz_code.py` – Generates the LaTeX/TikZ source code and saves it to the file `tikz_code.tex`.\n2. `compile_latex.py` – Compiles the generated LaTeX file to a PDF and saves it inside an `output` folder together with associated `.aux` and `.log` files.\n3. `main.py` – Main script; calls the other two scripts to produce the LaTeX source code and PDF files.\n\n## Requirements\n\n* Python 3.x\n* A LaTeX distribution with `pdflatex` (e.g., TeX Live, MiKTeX)\n* The [TikZ](https://en.wikipedia.org/wiki/PGF/TikZ) package for LaTeX\n\n## Usage\n\nUsing any text editor, modify the values of the variables in `main.py` to customize the tape's content according to the explanations there. Here's the code used to produce the first example in the preceding figure:\n```python\ns = \"r e c u r s i o n !\"  # The string to be printed on the tape\nhead = 15    # The position of the head (0-based)\nlength = 20  # The total number of squares\nstyle = \"c\"  # Additional style options\n```\n\nThen run the main script through the Python interpreter:\n```bash\npython3 main.py\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpzuehlke%2Fturing-machine-tape-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpzuehlke%2Fturing-machine-tape-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpzuehlke%2Fturing-machine-tape-generator/lists"}