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

Pandoc failing to convert valid xelatex file #4698

Closed
kashcit opened this issue Jun 11, 2018 · 5 comments
Closed

Pandoc failing to convert valid xelatex file #4698

kashcit opened this issue Jun 11, 2018 · 5 comments

Comments

@kashcit
Copy link

kashcit commented Jun 11, 2018

When running pandoc --from latex --pdf-engine=xelatex --to html5 skanda.tex -o skanda.tex.html upon this file https://github.com/hindutva/tex-files/blob/master/skanda/skanda.tex (on which xelatex skanda.tex works perfectly, assuming that the siddhanta font is installed), I get the following error:

pandoc --from latex --pdf-engine=xelatex --to html5 skanda.tex -o skanda.tex.html

Error at "source" (line 102, column 1):
unexpected \end
\end{document}
^
@jgm
Copy link
Owner

jgm commented Jun 12, 2018

It seems to be choking on this:

{\normalsize{\skt ॐ कं क्षं कं कार्त्तिकेयाय फट् ॥\\
ॐ श्रीं ह्रीं क्लीम् ऐं सौं शरवनभवाय नमः ॥\\
ॐ वचद्भुवे नमः ॥\\
ॐ भुवे नमः स्वाहा ॥\\
ॐ षं षण्मुखाय नमः ॥\\
ॐ श्रीम् ए इ उ न श्रीं रीं कुमाराय नमः ॥
}\\

It looks like the { before \normalize isn't matched by a close }, and if you delete it this should work.

@kashcit
Copy link
Author

kashcit commented Jun 12, 2018

Thank you! It was indeed so.

However I found a separate problem:
Images such as :

\graphicspath{ {images/} }
...
    \includegraphics[width=0.5\textwidth]{kaumara_magic_square}

is converted to

<img src="kaumara_magic_square" alt="The magic square Kaumāra-yantra" style="width:50.0%" />

rather than

<img src="images/kaumara_magic_square.jpg" alt="The magic square Kaumāra-yantra" style="width:50.0%" />

.

@jgm
Copy link
Owner

jgm commented Jun 12, 2018 via email

@kashcit
Copy link
Author

kashcit commented Jun 12, 2018

Thanks for the tip - that solves the image extension problem!

However, it doesn't address pandoc ignoring: \graphicspath{ {images/} }, which was also illustrated in #4698 (comment) ..

@jgm
Copy link
Owner

jgm commented Jun 12, 2018

You don't mention your pandoc version. In recent pandoc, \graphicspath is indeed supported. However, it won't rewrite the path unless you also use --extract-media. (Path rewriting doesn't make sense in general since \graphicspath can contain multiple directories, but it makes sense with --extract-media.)

So,

pandoc -f latex --default-image-extension .jpg --extract-media=mymedia

However, there's still a small issue. I noticed that pandoc chokes on the spaces inside the argument of \graphicspath. Removing them will make it work:

\graphicspath{{images/}}

I can fix this.

@jgm jgm closed this as completed in 1e45bb0 Jun 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants