Skip to main content

gtikz

A visual, drawio-style editor for building diagrams and generating the matching TikZ LaTeX code with one click.

version license

Features

  • Drag-and-drop canvas: rectangles, ellipses, diamonds, connectors.
  • Resize handles, multi-select, grouping with a labeled dashed box.
  • Properties panel: font size, fill/stroke color, bold/italic, rounded corners, arrow head style, line style (solid/dashed/dotted), straight or orthogonal routing.
  • One-click Generate TikZ code, with copy-to-clipboard and .tex download.
  • Built-in snippet library (preamble, rating-star icon, figure wrapper).
  • Save/load diagrams as JSON.

Requirements

  • Python 3.10+

Getting started

As a CLI tool (pip / pipx)

pipx install gtikz   # or: pip install gtikz
gtikz start

Then open http://127.0.0.1:18888. gtikz stop shuts it back down. pipx is recommended — it installs gtikz in its own isolated environment, so it won't clash with any other project's dependencies.

Saved diagrams and server logs live under ~/.gtikz/ (override with the GTIKZ_DATA_DIR environment variable). Other commands:

Command Description
gtikz start Start the server in the background (--host, --port, --reload)
gtikz stop Stop it
gtikz restart Restart it
gtikz status Show whether it's running
gtikz logs Show the server log (-f to follow, -n for line count)
gtikz --version Print the installed version

From a checkout (development)

git clone git@github.com:giper45/gtikz.git
cd gtikz
make install
make start

Then open http://127.0.0.1:18888. This runs uvicorn with --reload straight out of the checkout instead of an installed package — see Makefile targets below.

Without make:

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn gtikz.main:app --reload --port 18888

Usage

  • Pick a tool from the top bar (V select, R rectangle, E ellipse, D diamond, C connector), then click the canvas to place a shape, or click two nodes in sequence to connect them.
  • Drag a node to move it; with a single node selected, drag its handles to resize it.
  • Edit the selected element's style from the right-hand Properties panel.
  • Shift+click to multi-select, then Group (or press G) to wrap the selection in a labeled box.
  • Generate TikZ code opens the generated code with options for the figure wrapper, caption, label, preamble and \resizebox.
  • Snippets gives you ready-to-copy fragments (preamble, rating icon, etc.).
  • Save / Load store diagrams as JSON under ~/.gtikz/diagrams/ (or $GTIKZ_DATA_DIR/diagrams/ if that's set).

Makefile targets

These drive the checkout workflow (.venv + uvicorn). Once installed via pip/pipx, use the gtikz command instead (see above).

Command Description
make install Create the virtualenv and install dependencies
make start Start the server in the background
make stop Stop the server
make restart Restart the server
make status Show whether the server is running
make logs Follow the server log
make test Run the test suite
make build Build the sdist + wheel into dist/
make publish-test Upload dist/* to TestPyPI
make publish Upload dist/* to PyPI
make clean Remove the venv, caches, pid/log/build files

Project structure

gtikz/                Python package (installable, ships on PyPI)
├── main.py            App entrypoint, serves the API and the static frontend
├── cli.py              `gtikz start/stop/status/restart/logs` command
├── config.py            Paths: static/examples (in-package), user data (~/.gtikz)
├── models.py            Pydantic schema for a diagram (nodes/edges/groups)
├── storage.py            Save/load diagrams as JSON
├── api/routes.py        REST endpoints
├── tikz/                  Diagram -> TikZ code generation
├── static/               Frontend (vanilla JS + SVG, no build step)
│   ├── index.html
│   ├── css/style.css
│   └── js/                 One module per concern (state, canvas, properties, ...)
└── examples/              Sample diagrams (JSON)

tests/                 pytest suite

Testing

make test

Publishing

Maintainer-only; requires a trusted publisher set up once on the PyPI project pointing at .github/workflows/publish.yml (see the comment at the top of that file). To ship a release: bump VERSION and CHANGELOG.md, tag it and push the tag, then publish a GitHub Release from that tag — the workflow builds and uploads to PyPI automatically. To do it by hand instead: make build then make publish (or make publish-test for TestPyPI first).

Versioning

This project follows Semantic Versioning. See VERSION for the current version and CHANGELOG.md for release notes.

License

MIT

Metadata

Release files for gtikz 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gtikz 0.1.0
File Size Uploaded
gtikz-0.1.0.tar.gz 52.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gtikz 0.1.0
File Interpreter ABI Platform
gtikz-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 104.6 kB

Release files / gtikz-0.1.0.tar.gz

Download URL gtikz-0.1.0.tar.gz
Size 52.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2a22dee6eb0d8994b6ba340dc3227cf00afd8f689e78ce536c2b91b34d899621
BLAKE2b-256 checksum
How to use checksums
9b5aae4e55d4dbe3ebdcac3cf9f3db73b409fdf02219a1c460b221dc25f8ab9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release files / gtikz-0.1.0-py3-none-any.whl

Download URL gtikz-0.1.0-py3-none-any.whl
Size 52.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6bf5f79f9e521ef28dd4b1b4fccbccea68dc6cdf49e0882e507c2c010c702b4
BLAKE2b-256 checksum
How to use checksums
62f14308dccb3b59e3672ce9531c3bbdcec04404500f1f87a22d891683198be0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page