Clew Manual

Sharing your work

Exporting notes

Because Clew's reading mode is the jmarkdown typesetting engine — a dual-output engine that compiles the same source to HTML and to LaTeX — exporting is not an afterthought bolted onto a preview. Any note exports to a standalone HTML page, to print-quality LaTeX source, or, when a TeX toolchain is installed, straight to a typeset PDF. The mathematics, theorem environments, citations, and diagrams you see in reading mode survive into print, because print was always one of the engine's two native targets.

Where the commands live

The export commands for the current note sit under File → Export:

(The last item in that submenu, Vault as Website…, exports the whole vault at once and has its own chapter.) The same four commands are in the command palette (⌘P) as Export note as HTML, Export note as LaTeX (.tex), Export note as PDF (via LaTeX) and Export note as PDF (reading view), and like every command they can be given hotkeys in the hotkey editor. All four act on the active note's tab and need a note to be open.

The command palette open over the Export guide note, filtered to export, listing the four note exports and the vault-as-website export
The command palette filtered to export: the four note exports and Export vault as website…, each of them hotkey-assignable like any other command.

Each command opens a save dialog. The suggested destination is the vault root, with the note's own name and the right extension (.html, .tex, or .pdf); you can point it anywhere on disk. Nothing is written until you confirm the dialog, and cancelling it cancels the export.

On iPad Clew for iOS has two of the four, in the command palette: Export note as HTML and Export note as PDF (reading view). The LaTeX export and the PDF via LaTeX need a TeX installation and stay on the desktop. There is no save dialog on the iPad: the exported file is offered in the share sheet, so Save to Files puts it anywhere Files can reach — the vault included — and Print, Markup and AirDrop are a tap away. The reading-view PDF is made on the device from the same rendered page, figures and mathematics included, at the paper size in Settings.
Clew on an iPad with the share sheet open over the Diagrams note, offering the exported PDF to Copy, Markup, Print or Save to Files
Export note as PDF (reading view) on the iPad ends in the share sheet rather than a save dialog.

One source, three outputs

The point of exporting through the engine — rather than only printing the preview to PDF, as most note apps do — is that each of these formats is generated natively from the Markdown source:

Two PDFs, for two different wishes

As PDF (reading view) is the other thing people mean by "export to PDF": not a typeset paper, but this, on paper — the note exactly as the reading pane draws it, callout colours, syntax highlighting, mermaid diagrams, editable-looking tables and all. Clew prints the very same rendered page the app shows you.

Pick between them by what you want the document to be. The LaTeX PDF is for a paper, a handout, anything whose typography should be the argument's equal — and it needs a TeX toolchain. The reading-view PDF needs nothing installed, takes a second, and looks like Clew: right for circulating lecture notes, sending a colleague what is on your screen, or keeping a copy of a note as you had it.

Three details are worth knowing. It prints in the light theme whatever the app is wearing, because the engine's own styling is written for a light page and a PDF is a paper artifact. Paper size comes from Settings → Appearance → PDF paper size (A4 by default; US Letter, Legal and Tabloid are there too). And a folded embed prints folded — "as displayed" is the promise, so if you want an embed's contents in the PDF, unfold it first.

This is the practical payoff of the design commitment described in the introduction: a note about, say, a convergence proof — with numbered equations, a theorem, a couple of citations from your .bib file — renders in the app, exports as a web page, and typesets as a paper, all from the file you were editing a minute ago. Nothing needs to be rewritten for print.

Exports use your jmarkdown configuration

Here is the subtle point of this chapter, and it is worth understanding because it explains everything else about how exports behave. When Clew renders a note for reading mode, it runs the engine with a private configuration of its own — one that loads Clew's wikilink and fence extensions, points at local assets, and uses Clew's preview template. When Clew exports a note, it deliberately does not use that configuration. Instead, the export runs the engine in a fresh process whose working directory is the note's own folder, which means the engine's normal configuration cascade applies: the built-in defaults, then your global ~/.jmarkdown configuration, then any .jmarkdown/ folder next to the note.

In other words, an export behaves exactly as if you had run the jmarkdown command-line tool on the file yourself. That is a feature:

One per-vault setting does carry over: if the vault is set to standard Markdown syntax (the normal syntax toggle in Settings → This vault, described in the dialect chapter), exports honour it, so a vault written in ordinary Markdown exports as ordinary Markdown.

Caution — Clew's preview extensions do not apply Clew's Obsidian-flavoured additions are extensions loaded by the preview configuration, and single-note exports do not load them. Concretely: inline [[wikilinks]] are not turned into links (they come out as written), ![[…]] embeds are not expanded, and the ```mermaid, ```leaflet, and ```query fences render as plain code blocks. The engine's native forms still work — :::mermaid or @begin(mermaid) blocks export fine, and everything in math, citations, and the engine's own diagram machinery is native. A note you intend to publish as a paper is best written leaning on the engine's own vocabulary; a note leaning on Clew's vault features is better shared via website export, which does load all of Clew's extensions.
Caution — own-line wikilinks become inclusions The engine has its own meaning for a [[chapter.md]] standing alone on a line: file inclusion, and it is on by default in the engine's configuration. In an export, such a line splices the named file's contents into the document — useful on purpose for book-style projects (it is the same behaviour the per-vault jmarkdown project setting brings into the preview), but surprising if you meant it as a mere link. Add File inclusion: false to a note's metadata header or a .jmarkdown/ config next to the note to switch it off.

PDF export and the TeX toolchain

PDF export needs a TeX installation on your machine — Clew does not bundle one, because a TeX distribution is enormous and you likely already have one if you want this feature. On macOS, MacTeX is the usual choice. Clew looks for latexmk first and falls back to pdflatex, checking the standard installation directories (/Library/TeX/texbin, /usr/local/bin, and /opt/homebrew/bin). With latexmk available, reruns for cross-references and bibliographies are handled automatically, which is why it is preferred.

A related detail that saves real head-scratching: apps launched from the Dock or Finder inherit a minimal PATH that usually lacks the TeX directories, which is why "it works in my terminal but not in the app" is such a common failure elsewhere. Clew sidesteps it by extending the PATH it hands to every engine process with the common TeX and Homebrew locations (/Library/TeX/texbin, /opt/homebrew/bin, /usr/local/bin). This matters for anything that shells out to a TeX program by name: the latex run behind this export, and jmarkdown's own diagram tools when an export uses them. (TikZ and MetaPost figures in the preview need none of it — those engines ship with Clew, as WebAssembly.) On Windows, TeX installers put themselves on the PATH, so no extension is needed.

Mechanically, a PDF export first writes the intermediate .tex file next to your chosen destination — deliberately, so that relative graphics paths resolve — and then compiles it there. The compiler runs with a two-minute timeout, in nonstop mode. One pragmatic wrinkle: pdflatex exits with a non-zero status on mere warnings, so Clew accepts the run as successful whenever the PDF actually materialised.

Tip — the .tex file is your debugging window After a PDF export, the generated .tex (and the compiler's .log and auxiliary files) remain next to the PDF. If a compile fails or the output looks wrong, open the .tex and run latexmk -pdf on it yourself: you get the full compiler output, and you can fix or restyle the LaTeX directly. Exporting to LaTeX first and compiling by hand is exactly the same pipeline, one step at a time. If you dislike the auxiliary clutter, export into a scratch folder and copy out the PDF.

Troubleshooting

"No TeX toolchain found (latexmk/pdflatex)"
Clew could not find latexmk or pdflatex in any of the directories listed above. Install MacTeX (or your platform's TeX distribution) and try again; no restart of Clew should be needed if the tools land in one of the standard locations.
The PDF was not produced
The LaTeX compile failed hard enough that no PDF appeared. Export the same note as LaTeX and compile it in a terminal — the compiler's error messages will name the offending line. Common causes are a missing LaTeX package and raw HTML in the note, which has no LaTeX equivalent.
Citations show as question marks in the PDF
The bibliography did not resolve. Check that the note's bibliography setup (see Citations and bibliographies) points at a .bib file the export can reach from the note's own folder — remember that exports run from the note's directory, not from wherever Clew was started.
The export looks different from reading mode
Almost always the configuration-cascade point above: the preview runs with Clew's extensions and per-vault settings, the export runs with yours. Wikilinks, Obsidian-style fences, and query blocks are the usual suspects.
The exported HTML page needs the network
Unlike Clew's preview, which uses only local assets, the engine's own HTML template may reference assets such as MathJax from a CDN. The page is standalone in the sense of being a single file, but rendering mathematics in the browser can require a network connection, depending on your jmarkdown template configuration.
Obsidian compatibility Obsidian's PDF export prints its HTML preview to a PDF — a picture of the app's rendering. Clew's PDF export generates LaTeX and typesets it, which is a different kind of artifact: selectable, searchable, journal-grade output with real mathematics. The trade is the one this chapter describes — the export pipeline speaks jmarkdown, not Obsidian's dialect, so it shines brightest on notes written with the engine's own vocabulary.

Reference

FormatMenu itemPalette commandProducesRequires
HTML File → Export → As HTML… Export note as HTML A standalone .html page from the engine's own templates, at the location you choose. Nothing extra.
LaTeX File → Export → As LaTeX… Export note as LaTeX (.tex) A .tex source file; relative graphics resolve from where it is saved. Nothing extra (a TeX installation to compile it later).
PDF File → Export → As PDF (via LaTeX)… Export note as PDF (via LaTeX) A typeset .pdf; the intermediate .tex and log files remain alongside it. latexmk or pdflatex on the machine.
FactDetail
Working directoryThe note's own folder — the normal jmarkdown config cascade applies (~/.jmarkdown, then a .jmarkdown/ next to the note, then the note's metadata header).
Not appliedClew's preview configuration: wikilink and embed rendering, ```mermaid/```leaflet/```query fences, local preview assets.
AppliedThe vault's standard-Markdown-syntax setting; the note's metadata header; all engine-native features.
TeX search path/Library/TeX/texbin, /usr/local/bin, /opt/homebrew/bin (latexmk preferred over pdflatex); the same directories are appended to PATH for every engine process.
Compile behaviourNonstop mode, two-minute timeout; accepted as success if the PDF exists even when the compiler returned warnings.

See also