joeyuping / quick_latex_obsidian

MIT License
327 stars 21 forks source link

Detect & from previous line and allow tabbing through them #63

Closed typecasto closed 1 year ago

typecasto commented 2 years ago

When making a new line in an align block, it always places my cursor after the &, and it only places 1. Most of the time I'm using alignment, it's because I want to align my equations at the = sign, and sometimes write something after it, meaning I have multiple & symbols at different places, but none at the beginning of a line.

When making a new line in an align block, it should search the current line for &s, and insert that many of them in the next line. If there's an & symbol at the very beginning of the current line, place the cursor after the first & in the next line, otherwise place the cursor at the beginning of the line, before the &s. Pressing tab when behind an & should also move through it.

Example:

Before pressing enter: 

$$\begin{align*}
3x_{1}+6x_{2}=&-3&\text{Eq. 1} #cursor
\end{align*}$$

After pressing enter:

$$\begin{align*}
3x_{1}+6x_{2}=&-3&\text{Eq. 1} \\
#cursor & #tab & #tab
\end{align*}$$