Block referencing with a equations

Hello!

First of all, Obsidian is great, thank you for your work! I’ve been lurking around the forum for a while and finally decided to register.

I want to ask whether it is possible to use block referencing when we have equations in combinations with text? If so, how?

The trick is, that equations have to have a new line around them for formatting purposes and blocks seem to be looking for a line break, so I am having trouble defining an equation and its accompanying text as a block.

Here is an example. I would like the block to start right after “Companion form”

**Companion form**

$z_{t}=F_{1}(\Phi) z_{t-1} + F_{c} (\Phi)+\nu_{t}$

where the first n rows of $F_1(\Phi)$, $F_c(\Phi)$, and $v_t$ are defined to reproduce the DGP ^ce73ba
- $\nu_{t} \sim \operatorname{iid} N(0, \Omega(\Sigma))$ 
- another equation

^test

[[#^test]]

If I delete the line after the first equation, I get the sentence “where the first…” to be inline with the $z_t$ equation, which I do not want. Currently ^test points to the first item in the list, so the second equation.

Is such a thing even possible?

I’ve found two workarounds so far:

  1. Use a list, i.e. start each line below the next equation with “-”, then it is not a problem.
  2. Use atomic notes, embed them where you need them and reference them.

If this is currently not possible, a workaround could be to be able to tell where the block starts, not only where it ends, i.e. “wrap” blocks and not look only for the ^blockid syntax.

Ohhh, me stupid…

Simply use $$ $$ to force a math linebreak, which, however is not counted for a line break for the blockid.

This is one paragraph:

     **Companion form**
     $$z_{t}=F_{1}(\Phi) z_{t-1} + F_{c} (\Phi)+\nu_{t}$$

This is not:

**Companion form**

$z_{t}=F_{1}(\Phi) z_{t-1} + F_{c} (\Phi)+\nu_{t}$

Okay, me not so stupid after all. My question still stands.

The $$ $$ solution works but then you lose the list afterwards. So the question remains, how to wrap the whole example above as a block?

I am confused, the behaviour is really wonky.

Can somebody tell me why is this a block:

but this is not?

I am referring to having the text preceding the equation as part of the block in one instance and not as part in another.

I am willing to share the .md files.

No need to share the files—mind pasting the two examples in code-fenced block here, though?

Of course!

However… stupid question, how do I do code-fenced block? I see options for “pre-formatted text” (Ctrl-shift-C) and “Blockquote” (Ctrl+Shift+9).

Here is with pre-formatted text:

**Companion form**
$$z_{t}=F_{1}(\Phi) z_{t-1} + F_{c} (\Phi)+\nu_{t}$$

^tsaffsa

[[#^tsaffsa]]

and

**The DGP is a monthly VAR:**
$$x_{t}= \Phi x_{t-1}+\ldots+\Phi_{p} x_{t-p}+\Phi_{c}+u_{t}, \hspace{20pt} u_{t}=N(0, \Sigma)
$$

^testsaf


[[#^testsaf|what?]]
1 Like

Finally getting back to this, sorry for the delay.

It looks like the issue is that you have a line break after the suffix $$ in the second example.

This works:

You may want to see the discussion here on blocks and $$ use:

Thank you and no worries about any “delay”.

It looks like the issue is that you have a line break after the suffix $$ in the second example.

Do you mean a line break before the suffix $$? I think that explains it. I have one between line 7 and 8 on the second example and deleting that solves the problem:

I still think this behaviour is wonky. Why does a line break between line 7 and 8, in the equation (which in latex typically has no effect, so people would not expect it) acts as if there is a line break between lines 6 and 7?

I don’t understand your example. In your picture, if I see correctly, the equation name “The DGP is a monthly VAR” is rendered. In my case it is not. As far as I see in your example, the difference is that in the second case there is no break after $$ and ^testsaf. This does not reproduce the behaviour on my end.

And thanks for the link to the thread regarding my original question. I read through and as far as I understood:

  • there is a suggested workaround with headings. Headings are a totally different thing for me and I would not put a heading for every equation. Also I do not want equations in the table of contents. The atomic notes (my current workaround) is better but not optimal
  • this would not be considered (at least not currently). I really think, that introducing opening and closing synthax is an elegant solution, as suggested in those topics.

Did I understand the discussion correctly?

I see that the discussion has been marked as resolved. I still have no idea how to create a complex block with multiple equations which is not an atomic note.

Yes, the issue is the line break, and yes, if you want to do more complicated block references, you’ll need to use headings.

In reproducing the example I showed, be very careful to use the exact same number of lines & line breaks. I can paste the raw text later if you’d like.

The issue is the markdown parser. I don’t understand it very deeply, but it is non-trivial to get the markdown parser to recognize certain sets of lines as a single block. That’s why one-line equations work, but multi-line will not.

You can certainly create a feature request to encourage the devs to address this issue. Feel free to copy-paste whatever’s helpful from this thread.

Also, for what it’s worth, a workaround is to use e.g. H6 headings and use css to hide them in preview, such that these are not “real” headings, just display math markers.

Ah, I understand, thank you!

For my use-case using atomic notes is actually better. This also makes the obsidian notes easily portable in the future, as far as I understand block-referencing is something added because of user pressure and it is non-standard in terms of mark-down synthax.

I will consider making a feature request, thank!

1 Like