Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Since some years I'm working with polyglossia and the minted package in combination with XeLaTeX and English texts without any problems. Now I had to write a document in German with some code, so I wanted to use polyglossia with German as main language and babelshorthands enabled together with minted. When I try to compile this document, the .out.pyg file is not generated and XeLaTeX throws an error.

This issue disappears if I disable babelshorthands.

Please consider the following MWE:

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{german}

\usepackage{minted}

\begin{document}
    \begin{minted}{python}
        x = 1
    \end{minted}
\end{document}

The code above throws the aforementioned error. Now remove babelshorthands=true as option from the \setmainlanguage command:

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{german}

\usepackage{minted}

\begin{document}
    \begin{minted}{python}
        x = 1
    \end{minted}
\end{document}

The document should now compile without any errors.

Is this a bug in polyglossia/minted or am I doing something wrong?

Thanks for your support in advance.

share|improve this question
1  
Loading minted before polyglossia seems to help. –  egreg Mar 30 '13 at 19:04
    
@egreg: Thanks, that solved the issue for me! –  DigNative Mar 30 '13 at 20:59

1 Answer 1

up vote 1 down vote accepted

There is a difference between babel and polyglossia (which might be considered as a bug, probably): while the former makes shorthand characters active at \begin{document}, polyglossia makes them active immediately.

Since the definition of the internal macro \minted@pygmentize contains ", a problem arises.

Solution: load minted before polyglossia.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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