Latex commands with no output still render blank lines in preview

I recently discovered to my excitement that in Obsidian I can use \newcommand and have it to apply to the whole document, which will make my life much easier! However:

Steps to reproduce

Start with a document with multiple lines of text in it (so you can see the spacing)
On a new line in the middle of the text, write a latex command that doesn’t render anything: e.g. $\newcommand{\Cov}{\mathrm{Cov}}$

Expected result

The command is accepted silently and the preview view doesn’t change

Actual result

The Latex command gets its own line, showing up as a blank line in the even though there’s no actual content. Maybe related to the issue (bug? feature?) mentioned here where, unlike most other markdown interpreters, Obsidian renders all line breaks, rather than ignoring them unless there are 2 spaces at the end of the line. Is it just detecting and rendering the line breaks at the start and end of the line with the Latex?


  • Operating system: Windows 10
  • Obsidian version: v0.6.5
  • Using custom CSS: Nope

Additional information

1 Like

I think this has more todo with Obsidian rendering the line breaks than anything related to latex.