Hi! I’m using Obsidian with Pandoc to generate PDF documents. To accomplish this, sometimes I need to insert some Latex codes inside the Markdown text. Like this:
I would like to know if it’s possible to create a custom CSS in order to Obsidian show latex commands with a different text color to be easier to identify along the normal Markdown text.
I searched the internet for a solution, for weeks now, and doesn’t find anything, so I even don’t know where to start.
January 13, 2023, 8:49pm
Try installing the
Dynamic Highlights plugin, it can with the correct configuration highlight your latex commands in edit mode (not in reading mode).
See the following to get you started:
So your solution works, but I found a better one. I got Dynamic Highlights working! Thanks
@holroy for making me have another look at it.
I think the plugin isn’t working the way it should, but I got it to work, and if anyone comes looking for an automatic highlighting, this is how you do it.
Go to the plugin’s Github page and copy one of the author’s templates. I used the Pandoc one because I also want to capture groups.
Then in the plugin’s settings in Obsidian go to Import and paste the te…
Solved! Working like a charm! Thank you so much
January 14, 2023, 10:22am
A snippet would also do the work. I haven’t gone into too much detail but I also use Latex in different color with this CSS selector. Works.
January 14, 2023, 10:33am
A snippet would only work if there were some targets to connect to. With only the latex commands in mid text, that’s not the case as they’re just pure text in the markdown context.
See the linked thread for more context.
January 14, 2023, 11:27am
Sure but isn’t that always the case?
Obsidian renders LaTeX inside $$ blocks with Mathjax and appends the .math class to the div. So you can modify the look. Can you elaborate a bit more on what you are saying?
January 14, 2023, 1:10pm
If you’re doing math, that would indeed be the case, but the OP is adding LaTeX commands into the markdown text, for use when exporting markdown to pandoc. See wording in the original question, and the non-math LaTeX commands.
January 14, 2023, 8:49pm
If you’re doing math, that would indeed be the case, but the OP is adding LaTeX commands into the markdown text, for use when exporting markdown to pandoc.
Ah okay understood. Thanks!
January 21, 2023, 8:49pm
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.