DEV Community

Cover image for How to convert a block diagram to TikZ without redrawing it
Chintu Gurbani
Chintu Gurbani

Posted on Originally published at catchtex.com

How to convert a block diagram to TikZ without redrawing it

Redrawing a control loop or a flowchart in TikZ by hand takes an hour of nudging coordinates. CatchTeX reads the boxes, junctions, arrows and labels from the picture and writes the TikZ for you, laid out like the original.

The quick way

  • Snip the diagram in the PDF viewer (Ctrl+O) or from the screen (Ctrl+Alt+T).

  • Pick the Diagram chip (Auto also recognises most diagrams).

  • Check the preview: boxes, summing junctions with their + and − signs, arrows and
    labels, placed like the original.

  • Copy LaTeX and paste it into your document. The copied code includes the packages and
    TikZ libraries it needs.

\begin{tikzpicture}
\node[circle, draw] (s) at (0,0) {};
\node[draw, minimum height=8mm] (g) at (2.2,0) {$G(s)$};
\coordinate (y) at (4.4,0);
\draw[->] (s) -- (g);
\draw[->] (g) -- node[above] {$y$} (y);
\draw[->] (3.6,0) -- (3.6,-1.2) -- (0,-1.2)
-- node[left] {$-$} (s);
\end{tikzpicture}
Enter fullscreen mode Exit fullscreen mode

What it handles

  • Boxes with text or maths labels (transfer functions, block names).

  • Summing junctions with their + and − signs.

  • Arrows including feedback paths routed around the blocks.

  • From PDFs, the vector paths are read directly, which gives the most accurate result.

On our test set of control diagrams every block and junction is found, with the right type and
the right signs; 94 % of the connections are found. Small labels on arrows are the weak spot:
about half are picked up offline, so check them in the preview.

Dense diagrams: the optional AI assistant

For crowded real-world diagrams you can switch on the AI assistant with your own API key
(Anthropic, OpenAI, Google Gemini or OpenRouter). CatchTeX sends the snip together with everything
it measured, the model corrects missing feedback paths or arrow directions, and every connection is
marked as confirmed or inferred so you know what to check. It is off by default; without it
everything still runs offline.

Other ways, compared

Method Editable TikZ Effort
Redraw by hand in TikZ Yes 30–90 minutes per diagram
Draw in a visual editor and export Often messy code Redraw everything
Include the image No None, but fonts and style do not match
CatchTeX Yes, readable nodes and paths One snip, then small fixes

Try it on your own paper

CatchTeX is free for Windows, Mac and Linux: every mode, works offline, nothing to set up.

[

Download CatchTeX free](https://catchtex.comdownload?ref=guide-tikz)


Originally published at catchtex.com/guides/block-diagram-to-tikz.

CatchTeX runs offline on Windows, Mac and Linux. Download it free at catchtex.com.

Top comments (0)