Zettlr LogoZettlr Documentation
Setup
Troubleshooting
FAQ
  • About Zettlr
  • Download Zettlr
  • GitHub
  • English
  • Español
  • Deutsch
  • Français
  • Italiano
  • 日本語
  • Português
  • Русский
Setup
Troubleshooting
FAQ
  • About Zettlr
  • Download Zettlr
  • GitHub
  • English
  • Español
  • Deutsch
  • Français
  • Italiano
  • 日本語
  • Português
  • Русский
  • Welcome
  • Getting started

    • Setup
    • Migrating from Obsidian
    • Migrating to a New Computer
    • Installing LaTeX
    • A Note on Security
    • Get involved
    • Troubleshooting
  • First Time Users

    • First Steps
    • Workspaces
    • Creating Files and Folders
    • Writing Markdown
    • Importing Word- and other Documents into Zettlr
    • Exporting Files
  • Interface

    • File Manager
      • Workspaces and Root Files
      • Choosing Which Files To Display
      • File Manager Appearance (Modes)
      • The File List
      • Properties
      • Filtering
      • Global Search
      • Projects
    • Split View
      • Document Tab Bar
      • Markdown Editor
      • Code Editor
      • Image Viewer
      • PDF Viewer
    • Sidebar
      • Table of Contents
      • References
      • Related Files
      • Other Files
  • Writing

    • Markdown Editor
      • Markdown Compendium
      • Appearance
      • Search
      • Autocomplete
      • Footnotes
      • Citations
      • Working With Comments
      • Status Bar
      • Table Editor
      • Text Transforms
      • Snippets
      • YAML Front Matter
    • Language & Style
      • Spellchecking
      • LanguageTool
      • Markdown Syntax
      • Autocorrect and Magic Quotes
      • Readability
    • Scientific & Technical
      • Math
      • Code Blocks
      • Mermaid Diagrams
      • Pomodoro Timer
      • Writing Statistics
    • Exporting
      • Exporting Workflow
      • Defaults Files (Profiles)
      • Selecting the PDF Engine
      • Assets Manager
      • Custom Templates and Reference Documents
      • Custom Commands
      • Printing and Previewing
      • Lua Filters
    • PKMS & Zettelkasten
      • The Zettelkasten method
      • Graph View
      • Tag Manager
  • Guides
    • Custom CSS
    • Reference Manager Integration
    • Setting up LanguageTool locally
    • Presentations
    • Submitting to a Journal using a LaTeX Template
    • Zettlr as a Portable App
  • Reference
    • Keyboard Shortcuts
    • Settings
    • Frequently Asked Questions

Math

Math

Zettlr supports writing math and formulae using the KaTeX library.

To insert math code, enclose your formulae with dollar signs ($…$). To add a math block, use ($$…$$) instead.

Note

To prevent confusion with amounts of money, spaces between inline math and the dollar signs are not allowed.

By default, math is rendered using syntax highlighting. However, Zettlr can also pre-render math content. To do so, ensure to activate the corresponding renderer in the settings, and make sure your rendering mode is set to “Preview,” not “raw.”

Everybody should know Euler's formula: e±iθ=cos⁡θ±isin⁡θe^{ \pm i\theta } = \cos \theta \pm i\sin \thetae±iθ=cosθ±isinθ

These are Euler's most famous equations:

e±iθ=cos⁡θ±isin⁡θeiπ=−1\begin{aligned} e^{ \pm i\theta } & = \cos \theta \pm i\sin \theta \\ e^{i \pi} & = -1 \end{aligned} e±iθeiπ​=cosθ±isinθ=−1​

Examples of math equations. Click to view Markdown source:
Everybody should know Euler's formula: $e^{ \pm i\theta } = \cos \theta \pm i\sin \theta$

These are Euler's most famous equations:

$$
\begin{aligned}
e^{ \pm i\theta } & = \cos \theta \pm i\sin \theta    \\
e^{i \pi} & = -1
\end{aligned}
$$

Tip

KaTeX is almost fully compatible with MathTeX. However, some discrepancies remain. If you export a document containing math to LaTeX, ensure that the code blocks render appropriately. For HTML exports, you can specify the KaTeX library (the default is MathJax).

A complete documentation for all supported functions and symbols can be found on the KaTeX homepage: katex.org/docs/supported.html.

Chemical Symbols

Zettlr also supports chemical symbols with scientific inferiors and charge indicators using the mhchem library.

You can find a documentation on how to utilize its syntax on its homepage: mhchem.github.io/MathJax-mhchem.

Math During Export

While Zettlr uses KaTeX for preview purposes, exported math may differ. Exporting to PDF will cause the standard LaTeX math engine to take care of rendering the code, while exporting to HTML will by default make use of MathTeX.

You can customize how math is being treated on export by adapting your YAML frontmatter or profiles.

Edit on GitHub
Last update: 8/4/26, 2:35 PM
Contributors: Hendrik Erz, ryota-abe, captainsky25, leo-hstone
Prev
Scientific & Technical
Next
Code Blocks
© 2017-2026 by Zettlr and Contributors