Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Themes
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

Native TikZ

dingzy53dingzy53309 downloads

Render TikZ code blocks with your locally installed TeX distribution (TeX Live, MacTeX, MiKTeX) instead of a browser WASM engine. Full TikZ, real compiler logs, transparent caching.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates5

Render ```tikz code blocks in Obsidian with your **locally installed TeX distribution** (TeX Live, MacTeX or MiKTeX) instead of a browser WASM engine. A rewrite of artisticat1/obsidian-tikzjax, see License.

Mathematics & Geometry

Features

  • Full TikZ and any LaTeX package, compiled by your own TeX installation.
  • The real compiler log when a diagram fails, and a timeout instead of an endless spinner.
  • Colors adapted for dark themes.
  • Click a diagram to open it in a zoomable viewer.
  • A render cache inside the plugin folder. Nothing is written into your notes' folders unless you turn on mobile sharing.
  • Optional: share rendered diagrams with your phone or tablet through Obsidian Sync, git or Syncthing.

Requirements

  • Obsidian Desktop (Windows, macOS, Linux) to compile diagrams. Phones and tablets can display diagrams a desktop shared with them (see Mobile) but cannot compile.
  • A TeX distribution with dvisvgm installed:
    • Windows: MiKTeX or TeX Live
    • macOS: MacTeX (or via Homebrew: brew install --cask mactex-no-gui)
    • Linux: TeX Live
      • Ubuntu/Debian: sudo apt install texlive-latex-extra texlive-luatex texlive-pictures dvisvgm
      • Fedora: sudo dnf install texlive-scheme-medium dvisvgm
      • Arch Linux: sudo pacman -S texlive-basic texlive-latexextra texlive-pictures dvisvgm
    • Linux Flatpak note: If running Obsidian via Flatpak (md.obsidian.Obsidian), the plugin automatically executes host TeX binaries via flatpak-spawn --host and uses ~/.cache/obsidian-tikz for scratch files without extra setup.

Installation

From the community directory (recommended)

  1. Open Settings → Community plugins and turn on community plugins if asked.
  2. Select Browse, search for Native TikZ, then select Install and Enable.

You can also open the plugin's page: community.obsidian.md/plugins/tikz.

Manually

  1. Download main.js, manifest.json and styles.css from the latest release.
  2. In Settings → Community plugins, select the folder icon next to Installed plugins. This opens <vault>/.obsidian/plugins/.
  3. Create a folder named tikz there and put the three files in it.
  4. Select the reload icon next to Installed plugins, then enable Native TikZ.

Beta versions: install BRAT and add dingzy53/obsidian-tikz.

Update or remove: select Check for updates or Uninstall in Settings → Community plugins.

Usage

Place TikZ code inside a ```tikz block. Standard figures, bare snippets, or complete documents are all supported:

```tikz
\begin{document}
\begin{tikzpicture}
  \draw[thick, ->] (0,0) -- (1,1) node[right] {$x$};
\end{tikzpicture}
\end{document}
```

Bare TikZ snippets and packages loaded inline are also accepted:

```tikz
\usepackage{forest}
\begin{forest}
[VP [NP [Det][N]] [V]]
\end{forest}
```

\usepackage, \usetikzlibrary and \DeclareMathOperator lines in a bare snippet are moved into the preamble, including ones written over several lines.

One diagram per block

A block shows exactly one page. A document that produces several, such as two tikzpictures under \documentclass[tikz]{standalone}, fails with an error saying so. dvisvgm would otherwise show page 1 and silently drop the rest. Put each picture in its own block, or combine them in one tikzpicture (for example with shift on a scope).

When a diagram fails

The error block shows TeX's (or dvisvgm's) first error line, the full compiler log and the generated LaTeX. For the common mistakes it adds a hint naming the fix:

  • \lt / \gt copied from note math (MathJax only; write < / >);
  • a TikZ key or arrow tip whose library is not loaded (right=of, diamond, fit, Stealth, …), with the \usetikzlibrary to add;
  • \color inside font=, which dvisvgm cannot nest.

Zooming

Click a diagram, or select it with Tab and press Enter, to open it in a viewer. It opens fitted to the window, and you can:

  • zoom with the mouse wheel or a trackpad pinch, centered on the pointer;
  • drag to pan;
  • double-click to switch between fit and 2×;
  • press + / - to zoom, 0 to fit, 1 for actual size, and Esc to close.

The viewer uses the already rendered SVG, so nothing is recompiled. Turn it off with Click to enlarge diagrams.

Mobile

Phones and tablets cannot run TeX, so on mobile the plugin only displays diagrams that a desktop rendered and shared. Sharing is off by default, because it adds visible files to your vault.

  1. On a desktop, turn on Settings → Native TikZ → Mobile → Share diagrams with mobile. The plugin creates the shared folder (TikZ cache by default) and fills it with one <hash>.svg per diagram in your notes, copying renders it already has.
  2. Use Render all for mobile to compile the diagrams you have never opened on that desktop (as many at once as Parallel compiles allows). New and edited diagrams are added as they render, and Update shared diagrams now (also run once at startup) removes files no note uses any more. Only files named <64 hex>.svg are ever deleted, so anything else you keep in the folder is safe.
  3. Let your sync service carry the folder to your phone, then install and enable the plugin there. Diagrams show up as soon as they sync, and anything not shared yet shows "TikZ diagram not rendered yet". Clicking a diagram opens the zoomable viewer, with pinch to zoom.
  • Obsidian Sync: keep Images in selective sync (the default; .svg counts as an image). Turn on Installed community plugin list to sync the plugin itself and its settings, so the phone uses the same shared folder.
  • git, Syncthing, iCloud and similar: work as-is, since the folder is an ordinary vault folder.
  • Why a visible folder? Obsidian Sync never copies folders whose name starts with a dot, and inside a plugin's folder it only copies manifest.json, main.js, styles.css and data.json. A hidden cache, including the plugin's own cache/, would never reach your phone. You can still add the shared folder to Settings → Files and links → Excluded files to keep it out of search and the graph.
  • Turning sharing off asks whether to delete the shared diagrams (they disappear from synced devices too) or keep them. Delete shared diagrams stays in settings while any remain.
  • Shared files are treated as untrusted: they go through the same SVG sanitizer as fresh renders before they are displayed.

Cache & Scratch Files

  • Render cache: Compiled diagrams (<hash>.svg) are saved in <vault>/.obsidian/plugins/tikz/cache/ (hidden inside the plugin directory; zero vault pollution). Failed compiles are not cached; the error block shows the live compiler log. Very deeply nested output (pgfplots surf nests a group per facet, thousands deep, which took seconds to process on every display) is flattened when displayed, without changing how it looks. When the entry limit is reached, the least recently used diagrams are dropped first.
  • Compile scratch files: Temporary TeX build files (.tex, .dvi, .log) live in your OS temp folder (os.tmpdir()/obsidian-tikz/, or ~/.cache/obsidian-tikz/ on Flatpak) and are cleaned up immediately upon completion.

Showcase

Diagrams rendered side-by-side in Light mode (left) and Dark mode (right) with automatic adaptive contrast:

Circuits & Scientific Plots

Circuits & Scientific Plots

3D Coordinates & Diagrams

3D Coordinates & Diagrams

Automata & Theme Adaptation

Automata & Theme Adaptation

Mobile Viewer

A diagram shared from desktop, shown on a phone: in the note, in the viewer, and pinch-zoomed to 203%.

Mobile Viewer

Settings

Setting Description Default
Dark mode colors Adaptive (mirrors lightness with contrast floor), Light canvas (light panel), or Off. Adaptive
Click to enlarge diagrams Clicking a diagram (or Enter on it) opens the zoomable viewer. true
Share diagrams with mobile Desktop: keep an SVG of every diagram in the shared folder so a phone can show it. Adds visible files to the vault. false
Shared folder Vault folder for shared diagrams; must be visible and outside the config folder. Use the same one on every device. TikZ cache
TeX engine dvilualatex (recommended), latex, xelatex, or pdflatex. dvilualatex
Binary paths Custom path overrides for TeX engine and dvisvgm, with an Auto-detect button. Auto (PATH)
Extra PATH Extra directories to append to PATH at runtime. Empty
Default preamble Common packages injected when no \documentclass is provided. TikZ, common libraries, AMS math
Heavy packages When pgfplots, tikz-cd, circuitikz, chemfig and tikz-3dplot load: only for diagrams that use them, or always. When a diagram uses them
Allow shell escape Enables -shell-escape (danger: executes arbitrary system commands). false
Compile timeout Maximum seconds per compilation stage (1–3600) before killing the process tree. Time spent queued does not count. 20
Parallel compiles How many diagrams compile at once; the rest queue. 0 = automatic (half the CPU cores, 1–4). 0
Maximum cache Maximum cached SVGs (0 = unlimited). A saved 500 (the default before 1.3) moves to the new default once. 2000

[!NOTE] On macOS, GUI apps launched from Finder or the Dock do not inherit your shell's PATH. If binaries show as "not found", click Detect automatically or set the path manually (e.g. /Library/TeX/texbin).

Dark mode

  • Adaptive (default): Ink (anything legible on white) mirrors its lightness and keeps a 3:1 contrast floor, so labels and curves stay legible against dark themes. Light tints are treated as what they are, a color mixed into white (blue!12 is 12% blue): they are rebuilt with the same color mixed into the dark page instead. White becomes the page color, and pastel panels become faint tints just above it, never darker than the page.
  • Light canvas: Keeps original colors untouched and shows the diagram on a light panel (ideal for complex shading, ball color, or colormaps).
  • Off: Leaves colors unchanged.

The theme comes from Obsidian, unless a container outside the note overrides it. The nearest data-tikz-theme="light" or "dark" ancestor wins, then the nearest .theme-light or .theme-dark ancestor. This is for other plugins and outer containers, for example printing diagrams in light colors while Obsidian is dark. Wrapping a ```tikz block in <div data-tikz-theme="light">…</div> in Markdown does not work: Obsidian renders the HTML <div> and the code block as siblings rather than nesting them.

In Adaptive mode, explicit white fills (such as fill=white on a label mask, a legend box or a Venn cutout) become the dark page color (#1e1e1e, Obsidian's default dark background), so masks blend into the page instead of showing as black boxes. Light ink drawn on top stays readable. The adaptation assumes that default background: on a theme with a very different dark background, white masks show as slightly different boxes. To keep diagrams on a white background with untouched colors in dark mode, switch Dark mode colors to Light canvas.

Settings explained

  • Dark mode colors: Diagrams are authored for light paper. Adaptive preserves hues while inverting lightness (and re-tinting light fills onto the dark page) at display time; Light canvas leaves every diagram color intact on a light background. Changing this never recompiles diagrams.
  • TeX engine: dvilualatex matches standard LaTeX across tested math and TikZ blocks and supports fontspec system fonts.
  • TeX binaries & Environment: GUI launches on macOS do not inherit shell PATH; use Detect or add directories (such as /Library/TeX/texbin) to Extra PATH directories. Under Linux Flatpak, host TeX tools run automatically through flatpak-spawn --host.
  • Default preamble: Loaded before blocks that omit \documentclass. It loads TikZ with the everyday libraries (arrows.meta, calc, shapes.geometric, decorations.*, backgrounds, fit, matrix, …) and the AMS math packages. positioning is not preloaded on purpose: it changes what above right=4pt means in diagrams that never asked for it (the error hint names it when right=of … needs it). Inline \usepackage{...} and \usetikzlibrary{...} work regardless. A preamble saved unchanged from 1.0–1.2 is moved to the new default once; an edited one is kept.
  • Heavy packages: pgfplots (with compat=1.18), tikz-cd, circuitikz, chemfig and tikz-3dplot made every compile about a third slower, so by default they load only for diagrams that use them (an axis, tikzcd, \chemfig, \tdplot…, a circuitikz component, …). A diagram that fails without them is compiled once more with all of them, so nothing that worked before stops working; it just takes a second compile. Always restores the 1.0–1.2 behaviour. Changing this, or updating to 1.3, recompiles diagrams once.
  • Compile timeout & Parallel compiles: Timeout applies per stage (TeX, then dvisvgm). 0 parallel compiles picks half your CPU cores (up to 4).
  • Mobile sharing: Keeps a copy of compiled SVGs in a visible vault folder so Obsidian Sync, git, or Syncthing delivers them to mobile. Desktop compile failures also sync in data.json so mobile displays the error message instead of "not rendered yet".

API for other plugins

Other plugins can wait for diagrams to finish, for example before printing:

const tikz = app.plugins.plugins.tikz?.api; // missing in older versions
const { errors } = (await tikz?.whenSettled(root)) ?? { errors: 0 };

whenSettled(root) resolves once every diagram inside root (including hidden ones) shows a diagram, an error or "not rendered yet". errors counts the shown diagrams that show an error. Set data-tikz-theme="light" on root to get light colors in a dark app (see Dark mode).

Privacy and security

  • Running programs: the plugin starts only your TeX engine and dvisvgm, with an argument list and never through a shell. Under Flatpak it runs them on the host with flatpak-spawn --host.
  • Files outside the vault: compile scratch files go to the system temp folder (~/.cache/obsidian-tikz/ under Flatpak) and are deleted after each compile. The render cache stays in the plugin folder.
  • Network: none. If MiKTeX is set to install missing packages, MiKTeX itself may download them.
  • Clipboard: written only by the Copy log button on a failed diagram.

Security

  • Shell escape is off by default: Vault content is untrusted; -shell-escape is never enabled unless explicitly turned on by the user.
  • Direct argv execution: Subprocesses are spawned with an argv array (spawn/execFile), never interpolated shell strings.
  • File reads are not sandboxed: Like any TeX run, a diagram can \input or \includegraphics any file your user account can read, and render it into the note and the plugin cache. TeX Live dropped openin_any read restrictions in 2026 as ineffective, so only open vaults you trust. Shell escape stays off either way.
  • SVG sanitization (allowlist, fail-closed): The SVG is parsed and only the elements dvisvgm/PGF emit are kept; event handlers, external href/url() references, <style>, <a> and animation elements are removed. An SVG that cannot be parsed is rejected rather than displayed, and the result is inserted via DOMParser, never innerHTML.

Development

npm run dev     # watch build (outputs main.js)
npm run build   # typecheck + production bundle
npm run lint    # eslint
npm run lint:review  # what Obsidian's community plugin scanner checks
npm test        # vitest unit tests
npm run m1      # integration tests against your real TeX install
npm run clean   # clean generated bundle files

See AGENTS.md for architectural constraints and contribution rules.

License

MIT © 2026 Ding Zheng Yuan.

This plugin started as a fork of artisticat1/obsidian-tikzjax (MIT, © 2021–2023 artisticat1). The settings scaffolding and the ```tikz code block tag come from it; the rendering engine was rewritten to use a local TeX installation. Both copyright notices are kept in LICENSE.

HealthExcellent
ReviewSatisfactory
About
Render TikZ code blocks by running a local TeX distribution (TeX Live, MacTeX, MiKTeX) to generate SVG output directly in Obsidian Desktop. Support full documents, bare snippets, and inline packages, and store compiled SVGs and error logs in a plugin cache. Require Obsidian Desktop and a TeX setup with dvisvgm; mobile is unsupported.
LaTeXImagesVisualization
Details
Current version
1.3.0
Last updated
3 hours ago
Created
2 months ago
Updates
5 releases
Downloads
309
Compatible with
Obsidian 1.13.1+
Platforms
Desktop, Mobile
License
MIT
Report bugRequest featureReport plugin
Author
dingzy53dingzy53dingzy53
GitHubdingzy53
  1. Community
  2. Plugins
  3. LaTeX
  4. Native TikZ

Related plugins

Image Layouts

Add beautiful image layouts to your notes.

NanoBanana PRO

Generate Knowledge Posters (infographics) from your notes using AI. Supports OpenAI, Gemini, Anthropic, and xAI.

Adamantine Pick

Embeddable Pikchr diagrams renderer.

Leaflet

Interactive maps inside your notes.

Excalidraw

Visual PKM powerhouse. Create and edit Excalidraw drawings.

Advanced Canvas

Supercharge your canvas experience. Create presentations, flowcharts and more.

ExcaliBrain

An interactive, structured mind-map of your Obsidian vault.

Latex Suite

Make typesetting LaTeX math as fast as handwriting through snippets, text expansion, and editor enhancements.

Breadcrumbs

Visualise the hierarchy of your vault using a breadcrumb trail or matrix view.

Mermaid Tools

Improved Mermaid.js experience: visual toolbar with common elements and more.