TikZ diagrams

TikZ is the LaTeX drawing language used across academia for precise diagrams: geometric constructions, commutative diagrams, graphs, circuits, plots. A TikZ block holds the LaTeX source; LibreTimes compiles it to an SVG when the publication is saved and shows the image to readers.

:::tikz
\begin{tikzpicture}
  \draw[->] (-2,0) -- (2,0) node[right] {$x$};
  \draw[->] (0,-2) -- (0,2) node[above] {$y$};
  \draw (0,0) circle (1cm);
  \draw (0,0) -- (45:1cm) node[midway, above left] {$r$};
\end{tikzpicture}
:::

How it works

  • The body is standard tikzpicture LaTeX. Math inside node labels works as usual ({$x$}).
  • Compilation happens on the server at save time, in a sandbox. Readers receive a static SVG – nothing compiles in the browser, and the page does not depend on any external service.
  • While a diagram has not been rendered yet (or its compilation failed), the block shows a "Diagram not rendered" placeholder instead of the source. In the editor's preview you can see and fix compilation errors.
  • A failed diagram never blocks publishing the text around it.

Captions and ids

Wrap the block in a figure to caption it:

::::figure{#unit-circle}
:::tikz
\begin{tikzpicture} \draw (0,0) circle (1cm); \end{tikzpicture}
:::
 
The unit circle.
::::

Scope

The supported surface is the TikZ language itself. Arbitrary LaTeX packages are not available inside the sandbox; if a diagram depends on an exotic library, test it in the editor preview before building a document around it. For source code that should display as LaTeX rather than render, use a regular code block with the latex language.