RyotaUshio / obsidian-latex-theorem-equation-referencer

A powerful indexing & referencing system for theorems & equations in your Obsidian vault.
https://ryotaushio.github.io/obsidian-latex-theorem-equation-referencer/
MIT License
147 stars 6 forks source link

Equation numbering within align environment with commands utilizing "\\" #212

Closed Flesko closed 7 months ago

Flesko commented 7 months ago

General conditions: regarding the setup:

Bug description

The logic behind the equation numbering within an align environment breaks as soon as commands are used which also utilize the double backslash \\. For instance, matrix environments break the align environment due to the \\ for new row entries.

Minimal example

\begin{align}
a = \begin{pmatrix} 1 \\2 \\ 3 \end{pmatrix}
\end{align}

Referencing this equation fails with

\begin{align} a = \begin{pmatrix} 1 \tag{4-1}\\2 \tag{4-2}\\ 3\end{pmatrix} \tag{4-3}\end{align}.

Basically, each matrix row gets a tag.

RyotaUshio commented 7 months ago

Thanks for the detailed report. I will fix it before long.

By the way, I'm thinking about deprecating the "number line by line" setting because it's incompatible with an update I'm planning to improve equation numbering performance.

Is this feature valuable for you? If so, I'll rethink the plan.

RyotaUshio commented 7 months ago

Seems that it's working now

$$
\begin{align}
a = \begin{pmatrix} \begin{bmatrix} 1\\2 \\ 3 \end{bmatrix} \\2 \\ 3 \end{pmatrix}
\end{align}
$$
image
RyotaUshio commented 7 months ago

Released as 2.1.4

Flesko commented 7 months ago

Thank you very much!

Thanks for the detailed report. I will fix it before long.

By the way, I'm thinking about deprecating the "number line by line" setting because it's incompatible with an update I'm planning to improve equation numbering performance.

Is this feature valuable for you? If so, I'll rethink the plan.

I think it is fine to deprecate the option and make it the default behavior. The user can then just add \notag commands to the appropriate rows. However, I am not sure about the numbering within align environments. Debating with myself if it would be better to have just an increasing count rather than subindices as (1-1).

RyotaUshio commented 7 months ago

Thanks for sharing your thoughts!

I think it is fine to deprecate the option and make it the default behavior. The user can then just add \notag commands to the appropriate rows.

Apologies if my previous communication was unclear. I'm planning to remove the "line by line" setting. It means all we will be able to do is just assigning a single equation number to an entire $$\begin{align} ... \end{align}$$.

(Feel free to ignore if there was no confusion on your end.)

Debating with myself if it would be better to have just an increasing count rather than subindices as (1-1).

Using subindices is actually intentional. Obsidian doesn't allow linking to a specific row inside align. So incrementing the number row by row will make the equation number for the entire align environment not "well-defined."

Flesko commented 7 months ago

Of course, thank you for the plugin!

Apologies if my previous communication was unclear. I'm planning to remove the "line by line" setting. It means all we will be able to do is just assigning a single equation number to an entire $$\begin{align} ... \end{align}$$.

(Feel free to ignore if there was no confusion on your end.)

Sorry for the misunderstanding. I do find it very useful to be able to assign multiple numbers within such environments. Optimization equations are one example. It's often useful to reference specific constraints to explain them further, e.g., random example where I could now go into details for the cost function and the constraints (just a random example) and reference them accordingly.

Using subindices is actually intentional. Obsidian doesn't allow linking to a specific row inside align. So incrementing the number row by row will make the equation number for the entire align environment not "well-defined."

I see, then this won't be an option.

RyotaUshio commented 7 months ago

Thanks, then I will rethink my plan!