OliverBalfour / obsidian-pandoc

Pandoc document export plugin for Obsidian (https://obsidian.md)
MIT License
712 stars 59 forks source link

PDF Export to LaTeX broken after recent Obsidian update #188

Open Haadi-Khan opened 1 year ago

Haadi-Khan commented 1 year ago

After today's Obsidian update, exporting to LaTeX pdf is broken for me. The PDF renders and is created, but the embedded LaTeX in my file is not rendered.

Basically, everything besides the equations render.

image

What I see when I'm writing the markdown

image

What I see in the PDF (even inline LaTeX doesn't work)

Exporting was working up to yesterday, prior to the Obsidian update that was released today.

pdflatex and pandoc both have valid locations in the settings.

Spuriosity1 commented 1 year ago

I'm having the same issue. FWIW export to .tex is also broken, there is no math (inline or otherwise).

Spuriosity1 commented 1 year ago

After some more digging, I see the issue. It seems that pandoc does not know how to 'decompile' mathjax - the HTML page stored internally by obsidian has already mangled $S^z$ into something like <span class="math math-block is-loaded"><mjx-container class="MathJax" jax="CHTML" display="true"><mjx-math display="true" class="MJX-TEX" style="margin-left: 0px; margin-right: 0px;"><mjx-msub>.... I'm working on a PR to fix now.

fredriksy commented 1 year ago

so this is still very much an issues, is there a workaround that anyone can suggest?

oameye commented 11 months ago

Having the same issue here :/

mikaraunio commented 11 months ago

Not sure my issue is the same, as no math is involved, but in any case: I'm seeing any LaTeX embedded in my note passed through verbatim to the PDF, even though I expect it should be parsed by latex. So I'm getting the string "\reportdate{}" in my PDF instead of the date I expect.

Guessing this is because the plugin seems to first convert the note to HTML, and then run that through Pandoc: pandoc --from html --to pdf -o NOTEPATH.pdf I'm sure there are workflows that need that step, so for my use case, best way forward might be to write a new, simple plugin that just runs pandoc NOTEPATH.md -o NOTEPATH.pdf (and maybe grabs template and pdf-engine from the frontmatter).

Haadi-Khan commented 11 months ago

Creating a new extension might be the best idea for this issue, given that the author has seemingly abandoned it.

As a temporary solution, I wrote a Python script a few months ago to fix the latex export (and add some functionality like callouts becoming tcolorboxes), and I'm using the shell scripts extension to make it seamless. I can attach it if anyone would like.

Spuriosity's fork might be useful, but the Lua files didn't play nice with my obsidian vault for some reason.

oameye commented 11 months ago

@Haadi-Khan I would like that script :)

Haadi-Khan commented 11 months ago

@Haadi-Khan I would like that script :)

https://gist.github.com/Haadi-Khan/a9ae504b6a16b6b048e113abfdd2eff0

MariosGkMeng commented 22 hours ago

I don't like the Pandoc plugin, it does not respect embedded notes. Check my repo. It converts Obsidian to LateX and is more complete Didn't see anything on strikethrough,