Given the following TeX
file everything works as expected: the (Hungarian) text Árvíztűrő Tükörfúrógép
typesetted as expected and the code snippet also formatted brilliantly.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{verbments}
\begin{document}
\section{Text}
Árvíztűrő Tükörfúrógép.
\section{Java}
\begin{pyglist}[language=java]
public static void main(String[] args) {
int sum = 0;
for (int i = 0; i < 0; i++)
sum += i;
System.out.format("Sum: %s.\n", sum);
}
\end{pyglist}
\end{document}
However if I specify that I want to use the Hungarian babel
package with \usepackage[magyar]{babel}
, I receive some cryptic errors (possibly related to the code generated by Pygments
). (The log file containing the actual error message can be found here.)
I use verbments
in this sample, but the same thing applies to minted
.
Edit.: I forgot to mention, that loading any babel
package (like English, German, etc.) does not results in errors.
Second edit.: I forgot to phrase a question, so here I go: what could be the problem, and what could be the solution? I'm utterly confused.
Best Answer
Ok, I've found the solution.
The Hungarian
babel
package redefines some active characters (whatever those would be) which characters are used by thePygments
library to generateLaTeX
code.One has to use the
magyarOptions
(before loading thebabel
package) and set theactive=none
option (which means something like: do not use or redefine active characters - the ` [backtick] is used as an active character by the way).shorthandcs=none
has to be set along the way, because the package complains otherwise...I've ruined a whole day with this, I hope someone makes good use of it!