Wandmalfarbe / pandoc-latex-template

A pandoc LaTeX template to convert markdown files to PDF or LaTeX.
BSD 3-Clause "New" or "Revised" License
6.26k stars 970 forks source link

[Bug] The bidi package is loaded too early #232

Open daamien opened 3 years ago

daamien commented 3 years ago

Hi !

Thanks for this template, it is a very impressive piece of work.

I'm currently trying to use it for a document written in Persian with Right-to-Left (RTL) writing. The original document is located here:

https://github.com/OWASP/owasp-masvs/tree/master/Document-fa

I created a minimal example document.md containing this :

---
mainfont: 'Nazli'
---
<div dir="rtl" markdown="1">

انقلاب‌های فناورانه می

</div>

Note that I don't speak or read Persian myself so my knowledge on this topic is limited.

I am able to build successfully a pdf artefact using the default pandoc latex template like this:

$ pandoc --pdf-engine=xelatex examples/language-persian/document.md -o examples/language-persian/document.pdf

However with eisvogel I get the following error:

$ pandoc --template=eisvogel --pdf-engine=xelatex examples/language-persian/document.md -o examples/language-persian/document.pdf      
Error producing PDF.                                                                                                                                                           
! Package bidi Error: Oops! you have loaded package caption after bidi package.                                                                                                
 Please load package caption before bidi package, and then try to run xelatex o                                                                                                
n your document again.                                                                                                                                                         

See the bidi package documentation for explanation.                                                                                                                            
Type  H <return>  for immediate help.                                                                                                                                          
 ...                                                                                                                                                                           

l.251 \begin{document}  

After looking into the template I have found 3 problems:

The template seems to work with the following modifications:

Here's my working version of eisvogel:

https://github.com/daamien/pandoc-latex-template/blob/bug_bidi_persian/eisvogel.tex

Thanks again for your time, let me know how I can help fixing this...

EDIT: fixed links

daamien commented 3 years ago

See PR #231 with my changes