Automatic equation numbering (Latex Math)

Is it possible already to show the equation numbers? For instance when I write

$$F=ma$$

I would like to get something like:

F=ma (1)

By the way Obsidian is awesome. Keep up the good work.

Thanks in advance.
Best regards.

Gafsiqueira

9 Likes

I’ve moved this to the Feature requests category

1 Like

Thanks.

I think it could be as simple as adding this: http://docs.mathjax.org/en/latest/input/tex/eqnumbers.html

1 Like

Nice! Are we able to do this or only devs?

How about something like

$$F=ma \tag{1}$$

3 Likes

Althought you have to put the numbers manually, its a good alternative. Thank you, @aroberge!

Only the devs can do this, I think, since this requires modifying JavaScript. You could mess with the internals of Obsidian, of course, but the external interface allows us to modify the CSS, but not JS.

Devs, could you take a look at this? It should only take a second to enable and is somewhat backwards compatible, in that if users don’t want number, they can just use the equation* environment instead of equation (or you can hide this option behind a flag if you’d like):

window.MathJax = {
  tex: {
    tags: 'ams'
  }
};
2 Likes

Nice, thanks @singhrac

There are now several feature requests that are all essentially the same - additional control over MathJax initialization and extensions. In addition to this one I found the following:

In my opinion these should all be merged since they all deal with the fine-grain control of MathJax. If these are implemented 1-by-1 I worry that the solution will be a bit inflexible. Since MathJax is a core feature I think these should be also, but if not this topic should motivate the plugin API to be able to handle these use cases.

6 Likes

Unfortunately, due to the way mathjax is implemented this is not just as easy as flipping a switch for us. This is not likely to be implemented in the short term.

2 Likes

That’s okay, I still love you guys. Keep up the good work.

As I just saw the notes on 8.2, perhaps this will be solved? @WhiteNoise

no, but we looked into it. We enabled what we could, but we can’t enable that.

1 Like

Cool. Thanks anyways.

Manual equation numbering works:

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

As shown in $\eqref{eq1}$, $x$ is grether than $y$.
7 Likes

Hey,

did something change with newer Obsidian versions? Copying

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

does not render for me, because of the “\label{eq1}” part.

Thanks!

4 Likes

Yeah, this has been finicky for me too. It’s been a while, but my recollection is that quitting and reopening obsidian numbering works again.

Anyway, the whole equation numbering issue is unworkable in Obsidian. If one has to put in the numbers with tag{1}, the elegance and power of Latex equation numbering is lost. The whole point is to avoid manual numbering.

This is a fundamental and deep flaw (IMO) that precludes long form writing involving mathematics and equations in Obsidian — without tedious manual intervention, such as tag{1}, and hackery (regex search-replace after moving text into a Latex-friendly environment).

If frustration is evident in this post, it is genuine and not meant to disparage or insult the developers for whom I have great respect and admiration for a stellar app.

6 Likes

Obsidian is very well done in general. It is a rare markdown editor for which I do not have the urge to change its default settings. However, the lack of auto-numbering is a significant drawback. I hope the developers are still working on a full MathJax support.

As a workaround, I found a solution for auto-numbering equations across Apple devices. The “One Markdown” app has both iOS and macOS versions. One Markdown automatically numbers equations as long as they are in the following format:
$$
\begin{equation}

\end{equation}
$$

I believe there is full mathjax support now but no equations numbering? Is there any chance this will be added in future?