Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF Export to LaTeX broken after recent Obsidian update #188

Open
Haadi-Khan opened this issue Jun 1, 2023 · 9 comments · May be fixed by #191
Open

PDF Export to LaTeX broken after recent Obsidian update #188

Haadi-Khan opened this issue Jun 1, 2023 · 9 comments · May be fixed by #191

Comments

@Haadi-Khan
Copy link

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 Haadi-Khan changed the title PDF Export to LaTeX broken after previous update PDF Export to LaTeX broken after recent Obsidian update Jun 1, 2023
@Spuriosity1
Copy link

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

@Spuriosity1
Copy link

Spuriosity1 commented Jul 26, 2023

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 Spuriosity1 linked a pull request Jul 26, 2023 that will close this issue
@fredriksy
Copy link

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

@oameye
Copy link

oameye commented Nov 22, 2023

Having the same issue here :/

@mikaraunio
Copy link

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
Copy link
Author

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
Copy link

oameye commented Nov 26, 2023

@Haadi-Khan I would like that script :)

@Haadi-Khan
Copy link
Author

@Haadi-Khan I would like that script :)

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

@MariosGkMeng
Copy link

MariosGkMeng commented Nov 13, 2024

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants