A widget for Trilium Notes for live previewing LaTeX files with support for sync scroll.
trilium_9xffklenTJ.mp4
- Preview LaTeX notes in real time
- Global and per-note styles
- Syncable scrollbars
- Download the
zip
file from the latest release on GitHub. - Import the zip into Trilium, but make sure you uncheck
Safe Import
! - (optional) Create one (or more) child code notes of
CSS
type and fill it with any global LaTeX styles.
Create a code note with LaTeX type. Then, to make a note previewable, simply add the #latexPreview
attribute to it. (You may have to switch notes afterward for the preview to appear.)
After that, just start writing in LaTeX on the code editor side. You'll see the preview update with you as you go. By default, it waits about a second before updating the preview in order to reduce performance overhead.
If you're going to add any styles to the note, it can be annoying to see the preview cards at the bottom. You can hide those by adding the #hideChildrenOverview
native to Trilium.
By default, LaTeXPreview will try to keep the scroll bars in sync no matter which side you are scrolling. The widget is not perfect at keeping them exactly at the same place contextually because the rendering can be so different.
You can disable the sync entirely by adding the #latexScrollSync
attribute with none
as the value. You can also disable each side separately with left
or right
. For instance, if you want the preview to automatically scroll as you scroll the source, but not the other way around, then use #latexScrollSync=left
.
Both the global and local styles are picked up and reapplied on note switch, so no need to keep reloading if you are tinkering with your styles!
As mentioned in the installation section, any CSS
note that is a child to the widget code will automatically be picked up and applied.
Local styles are specific to the LaTeX note. Just make a CSS
note as a child of the LaTeX note and it'll be picked up!
Check out my other Trilium-based projects:
- Trilium Markdown Preview
- Trilium Breadcrumbs
- Trilium SingleFile
- @types/trilium
- trilium-etapi
- trilium-pack
Want more? Be sure to check out the Awesome Trilium list!