inline math in paragraph setup <p> </p>

Q: If I align the paragraph then inline math doesn’t work. Please help

<p align="justify"> The objective of this research is to examine the dark matter fraction in star-forming galaxies, specifically disk-like systems located within the redshift range of $0.05\leq z\leq 0.2$ covered by MIGHTEE-HI survey. Our focus is on disk-like systems (late-type galaxies) since they form and evolve predominantly at $z\leq 1.5$ and exhibit homogenous and controlled evolution (e.g., Lagos2017). Consequently, these systems are a valuable tool for inferring the cosmic evolution of both baryons and dark matter. We plan to compare the results of these findings with their counterparts at $0.25  \leq  z \leq 2.5 $ (see technical details). </p>

What I’m trying to do

Things I have tried

I’ve edited your post. When you post syntax, put it between ``` backticks. Otherwise it won’t format properly.

More forum formatting info here: Forum use and formatting tips - #3 by ariehen

I don’t have an answer to your problem. I don’t think Mathjax inside html is supported: Text in subscript in mathjax not rendered correctly when surrounded by html character code inside html list in a markdown table

Math in html doesn’t work indeed. You could however set text to justify by using css, like this:

/* reading mode */
.markdown-preview-view p {
	text-align: justify;
}

But then all texts in all your notes are affected, don’t know if you want that. I don’t know if it is possible with css to apply it only on a specific part of text in a note.

As stated here, Obsidian doesn’t support other markdown in html code, so you’ll need to do that justify some other way. You could use cssClass: myJustify in the frontmatter, but that would apply that class to the entire document, which might be what you want. If so, go for it.

If however, you only want it applied to some blocks, then maybe the Custom Classes by LilaRest is a plugin you would like to take a look at. It would allow for something like:

`class: myJustify`
The objective of this research ... "0.05\leq z\leq 0.2$ ...

In either case, you will need to make a CSS snippet containing the needed CSS. In my examples I’ve defined the myJustify class to be assigned to either the block or the file, so your snippet could maybe look something like:

.myJustify {
  text-align: justify;
}
Bonus tip: How to add a custom CSS snippet
  • Goto Settings > Appearance and scroll down to “CSS snippets” section, and hit the folder icon on the far right. This opens up a file explorer window, in the folder vault/.obsidian/snippets, which is were you want to save your css snippet
  • In this new window create a file, like myCss.css, where you copy the CSS into. Make sure this actually is a text file, and that the name ends in .css
  • Back in Obsidian, you should now see your myCss in the list of CSS snippets. If not, hit the refresh button
  • Final step is to click the enable button to the right of your file, and now your new CSS should be in effect
  • If you later on make changes in the CSS snippet file, the effect should be immediate. If not, try disabling and re-enabling the snippet, or in some strange cases, you would need to reload Obsidian. In 99% of the cases, the changes are immediate, though.
2 Likes

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