# Create aligned LaTeX equations

**URL:** <https://forum.obsidian.md/t/create-aligned-latex-equations/27554>\
**Category:** Basement\
**Created:** [November 23, 2021, 9:43am UTC](https://forum.obsidian.md/t/create-aligned-latex-equations/27554 "2021-11-23T09:43:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichaelBaudin](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/ee59a6/32.png) [@MichaelBaudin](https://forum.obsidian.md/u/MichaelBaudin)\
**Post date:** [November 23, 2021, 9:43am UTC](https://forum.obsidian.md/t/create-aligned-latex-equations/27554/1 "2021-11-23T09:43:40Z")

</div>

Hi !  
I have an issue with respect to the use of aligned LaTeX equations. I often use Obsidian to create math texts that get instantaneously readable. To do this, I often use the `align` LaTeX environment :

```auto
Therefore,
$$
\begin{align*}
&d_{k+1}^{(k+1)} = a_k d_k^{(k)} \\
&d_{k}^{(k+1)} = a_k d_{k - 1}^{(k)} + b_k d_k^{(k)}\\
& \vdots \\
& d_0^{(k+1)} = b_k d_0^{(k)} + c_k d_0^{(k - 1)}
\end{align*}
$$
for any $k > 1$

```

It works well graphically:  
 ![image](https://forum.obsidian.md/uploads/default/original/3X/6/1/615f6a0e30099d6bce23054ee1a340b61ed8a7a4.png)

The Markdown file does not have, however, a proper content. This is because the display math environment created by the double `$` should not contain an `align` environment. This is not compliant with the LaTeX language. Hence, the .md file cannot be converted automatically with, e.g. pandoc (but exporting the document to pdf with Obsidian works well).

How should I format my code to make it clean?  
Best regards,  
Michaël

---

<div class="post-metadata">

**Author:** ![saf-dmitry](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/s/b5e925/32.png) [@saf-dmitry](https://forum.obsidian.md/u/saf-dmitry)\
**Post date:** [November 23, 2021, 2:32pm UTC](https://forum.obsidian.md/t/create-aligned-latex-equations/27554/2 "2021-11-23T14:32:07Z")

</div>

@MichaelBaudin You can use `aligned`, `alignedat` or `split` environments, which can be used within equations:

```markdown
$$
\begin{aligned}
  a &= b + c \\
  d &= e + f
\end{aligned}
$$

```

---

<div class="post-metadata">

**Author:** ![MichaelBaudin](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/ee59a6/32.png) [@MichaelBaudin](https://forum.obsidian.md/u/MichaelBaudin)\
**Post date:** [November 23, 2021, 5:39pm UTC](https://forum.obsidian.md/t/create-aligned-latex-equations/27554/3 "2021-11-23T17:39:40Z")

</div>

I did not known that environment.  
I can now generated the file with

```auto
pandoc myfile.md -o myfile.pdf

```

Before your fix, I got the “Erroneous nesting of equation structures” error. Now the document is generated.  
Thank you very much!

---

<div class="post-metadata">

**Author:** ![system](https://forum.obsidian.md/uploads/default/original/3X/b/e/bec35fbd23ab28909bb6bfe62cb32eb82dd34019.png) [@system](https://forum.obsidian.md/u/system)\
**Post date:** [November 24, 2021, 5:40pm UTC](https://forum.obsidian.md/t/create-aligned-latex-equations/27554/4 "2021-11-24T17:40:13Z")

</div>

Closed on November 24, 2021, 5:40pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
