LaTeX equations and sections labels with Markdown and Pandoc

Use case or problem

We won’t support equation numbering due to different ways in which Mathjax and Obsidian work. I suggest to leave out or comment the \label in the equations.

$$x=y+1 \tag{1} \label{eq1}$$

As shown in $\eqref{eq1}$, $x$ is grether than $y$.
  • An alternative consists in converting Markdown to LaTeX using pandoc-eqnos filters with this syntax:
$$ y = mx + b $$ {#eq:id}

The prefix #eq: is required. id should be replaced with a unique string composed of letters, numbers, dashes and underscores. If id is omitted then the equation will be numbered but unreferenceable.

To reference the equation, use

  • Sections can also be labelled as {#sec:my-section} and refered with @sec:my-section

:arrow_right: These labels are visibles in Edit and View mode. It would be nice if they could be hidden in View mode like in VScode (for sections only, see below).

:arrow_right: #eq:id is not interpreted in Obsidian as a tag, but it would be nice to search for equations across Obsidian.

Current workaround

The labels are visibles both in Edit and View modes:

Proposed solution

For sections in VScode the labels are hidden:

Related feature requests


You just need to change the syntax you use for math blocks.



instead of

$$ {#eq:equation}

Then, the equation will be rendered correctly in preview mode and pandoc can still works well.

1 Like