Skip to content

Core Latex Renderer

github-actions[bot] edited this page Jul 16, 2024 · 10 revisions

core.latex.renderer

Rendering LaTeX with image.nvim

Overview

This is an experimental module that requires nvim 0.10+. It renders LaTeX snippets as images making use of the image.nvim plugin. By default, images are only rendered after running the command: :Neorg render-latex. Rendering can be disabled with :Neorg render-latex disable

Requires:

  • The image.nvim neovim plugin.
  • latex executable in path with the following packages:
    • standalone
    • amsmath
    • amssymb
    • graphicx
  • dvipng executable in path (normally comes with LaTeX)

There's a highlight group that controls the foreground color of the rendered latex: @norg.rendered.latex, configurable in core.highlights

Configuration

  • conceal
    (boolean)

    When true, images of rendered LaTeX will cover the source LaTeX they were produced from. Setting this value to false creates more lag, and can be buggy with large numbers of images.

    true
  • debounce_ms
    (number)

    Don't re-render anything until 200ms after the buffer has stopped changing. Lowering will lead to a more seamless experience but will cause more temporary images to be created

    200
  • dpi
    (number)

    "Dots Per Inch" increasing this value will result in crisper images at the expense of performance

    350
  • min_length
    (number)

    Only render latex snippets that are longer than this many chars. Escaped chars are removed spaces are counted, $ and $|/|$ are not (ie. $\\int$ counts as 4 chars)

    3
  • render_on_enter
    (boolean)

    When true, images will render when a .norg buffer is entered

    false
  • renderer
    (string)

    Module that renders the images. "core.integrations.image" makes use of image.nvim and is currently the only option

    "core.integrations.image"
  • scale
    (number)

    Make the images larger or smaller by adjusting the scale. Will not pad images with virtual text when conceal = true, so they can overlap text. Images will not be blown up larger than their true size, so images may still render one line tall.

    1

Dependencies

Clone this wiki locally