I keep getting this error in my TeXStudio:

Package bidi Error: Oops! you have loaded package pgf after bidi package. Pleocument again. \begin{document}

What does it mean?

  • 2
    Call the pgf package before bidi. (\usepackage{pgf} and then \usepackage{bidi})
    – PMC1234
    Jan 6, 2016 at 20:07

1 Answer 1


You are probably not loading pgf directly; it's more likely that you are loading tikz or pgfplots, or some other package that depends on tikz. Just make sure you load this before loading bidi. Since bidi modifies lots of package behaviour to work with RTL languages, it's generally best to load it last in the order. You may not be even loading bidi directly either, but it gets loaded, for example when you set the language using the polyglossia package, or the xepersian package so you should load that later too.

From the xepersian documentation (Section 2: Basics):

  1. xepersian should be the last package that you load, because otherwise you are certainly going to overwrite bidi and XePersian package’s definitions and consequently, you will not get the expected output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.