obsidian-pandoc icon indicating copy to clipboard operation
obsidian-pandoc copied to clipboard

PDF Export to LaTeX broken after recent Obsidian update

Open Haadi-Khan opened this issue 1 year ago • 8 comments

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.

Haadi-Khan avatar Jun 01 '23 23:06 Haadi-Khan

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

Spuriosity1 avatar Jul 25 '23 22:07 Spuriosity1

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.

Spuriosity1 avatar Jul 26 '23 02:07 Spuriosity1

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

fredriksy avatar Oct 11 '23 01:10 fredriksy

Having the same issue here :/

oameye avatar Nov 22 '23 11:11 oameye

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).

mikaraunio avatar Nov 26 '23 00:11 mikaraunio

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.

Haadi-Khan avatar Nov 26 '23 04:11 Haadi-Khan

@Haadi-Khan I would like that script :)

oameye avatar Nov 26 '23 08:11 oameye

@Haadi-Khan I would like that script :)

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

Haadi-Khan avatar Nov 26 '23 15:11 Haadi-Khan