# Extra newline between Latex equation blocks/a Latex equation block and a paragraph

**URL:** <https://forum.obsidian.md/t/extra-newline-between-latex-equation-blocks-a-latex-equation-block-and-a-paragraph/10852>\
**Category:** Bug graveyard\
**Tags:** repro, math\
**Created:** [January 3, 2021, 2:53pm UTC](https://forum.obsidian.md/t/extra-newline-between-latex-equation-blocks-a-latex-equation-block-and-a-paragraph/10852 "2021-01-03T14:53:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![halfelixir](https://forum.obsidian.md/user_avatar/forum.obsidian.md/halfelixir/32/8025_2.png) [@halfelixir](https://forum.obsidian.md/u/halfelixir)\
**Post date:** [January 3, 2021, 2:53pm UTC](https://forum.obsidian.md/t/extra-newline-between-latex-equation-blocks-a-latex-equation-block-and-a-paragraph/10852/1 "2021-01-03T14:53:05Z")

</div>

I searched in the forum, seems that there is only one topic related. And it is about generating newlines with an empty `$$` Latex equation call.

### Steps to reproduce

```auto
- test case 1
    $$func1$$
    text here
- test case 2
    $$func2$$
    $func3$
-test case 3
    $$func4$$
    $$func5$$

```

### Expected result

Text/equations right after a Latex equation block generated by `$$sample equation$$`, no extra space in between.

### Actual result

There is a `<br>` below `$$Latex equations$$. No such a problem with `$Latex equation$`  
(I’m using the mouse cursor to select all text so that newlines are easier to see)  
 ![image](https://forum.obsidian.md/uploads/default/original/2X/2/262d2039d74c8a24de5b0c34219390a973eb5265.png)

code here :

 ![image](https://forum.obsidian.md/uploads/default/original/2X/9/97f7d5b1d915b727b245949df2e1e674c108cb9f.png)

### Environment

- Operating system: Windows 10

- Obsidian version: v0.10.1

* * *

### Additional information

---

<div class="post-metadata">

**Author:** ![Pummelfisch](https://forum.obsidian.md/user_avatar/forum.obsidian.md/pummelfisch/32/3559_2.png) [@Pummelfisch](https://forum.obsidian.md/u/Pummelfisch)\
**Post date:** [January 20, 2021, 3:44pm UTC](https://forum.obsidian.md/t/extra-newline-between-latex-equation-blocks-a-latex-equation-block-and-a-paragraph/10852/2 "2021-01-20T15:44:11Z")

</div>

Yea I also came across that Bug several times.  
Just got used to add an emtpy line after my $$Latex equation$$. Oddly that extra line will get rid of the   
 in viewing mode.

---

<div class="post-metadata">

**Author:** ![Galaxias\_neptuni](https://forum.obsidian.md/user_avatar/forum.obsidian.md/galaxias_neptuni/32/15572_2.png) [@Galaxias\_neptuni](https://forum.obsidian.md/u/Galaxias_neptuni)\
**Post date:** [June 1, 2021, 3:33am UTC](https://forum.obsidian.md/t/extra-newline-between-latex-equation-blocks-a-latex-equation-block-and-a-paragraph/10852/3 "2021-06-01T03:33:11Z")

</div>

### Summary

When there is some text in a line immediately following a math block, it produces more space than if there was a blank line between the math block and the text.

### Steps to reproduce

Case 1

```auto
$$1 + 1 = 2$$
Text

```

Case 2

```auto
$$1 + 1 = 2$$

Text

```

### Expected result

Because case 2 has a blank line in between, one would expect that case 2 should produce equal or more space between the math block and the text compared to case 1.

### Actual result

Case 1 produces more space between the math block and the text compared to case 2.

 ![math block](https://forum.obsidian.md/uploads/default/original/2X/c/c7935ffa975c157022118a7ae6dc9ca4b351ae1c.png)

* * *

### Additional information

Inspecting the HTML, I noticed that in case 1 there is a line break `<br>` between the math block and the text. I initially tried hiding the line break but this caused a problem:  
Case 3

```auto
$$1 + 1 = 2$$ is true.
Text

```

If a math block was followed by some text in the same line, the subsequent “Text” appeared on the same line as the first part because of the missing line break.

### Proposed solution

A solution would be to hide the line break when it immediately follows a math block. In case 3, " is true." appears between the math block and the line break, and in this case the line break should be present to separate " is true." and “Text”. However, in case 1 there is nothing between the math block and the line break, and in this case the line break takes up extra space before “Text” so it should be hidden.

This JavaScript code fixes it in preview mode. However, this is temporary and does not work for exporting to PDF.

```auto
for (a of document.querySelectorAll("span.math.math-block.is-loaded")) {
    if (a.nextSibling && a.nextSibling.nodeName === "BR") {
        a.nextSibling.style.setProperty("display", "none");
    }
}

```

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [June 2, 2021, 7:50pm UTC](https://forum.obsidian.md/t/extra-newline-between-latex-equation-blocks-a-latex-equation-block-and-a-paragraph/10852/4 "2021-06-02T19:50:39Z")

</div>

will be fixed in 0.12.5

---

<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:** [June 3, 2021, 7:50pm UTC](https://forum.obsidian.md/t/extra-newline-between-latex-equation-blocks-a-latex-equation-block-and-a-paragraph/10852/5 "2021-06-03T19:50:59Z")

</div>

Closed on June 3, 2021, 7:50pm UTC

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

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [October 13, 2022, 4:08pm UTC](https://forum.obsidian.md/t/extra-newline-between-latex-equation-blocks-a-latex-equation-block-and-a-paragraph/10852/6 "2022-10-13T16:08:47Z")

</div>

Archived on October 13, 2022, 4:08pm UTC


