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

Pythontex does not work with German language (yes really) #195

Open
Kamik423 opened this issue Mar 25, 2022 · 3 comments
Open

Pythontex does not work with German language (yes really) #195

Kamik423 opened this issue Mar 25, 2022 · 3 comments
Labels
doc documentation

Comments

@Kamik423
Copy link

Minimal working example

\documentclass[a4paper]{article}

\usepackage[german, ngerman]{babel}
\usepackage{ngerman} % I am the bad line

\usepackage{pythontex}

\begin{document}

\begin{pycode}
    print("y")
\end{pycode}

\end{document}

Running

xelatex mwe.tex

yields

! Argument of " has an extra }.
<inserted text> 
                \par 
l.284 \StrSubstitute{\pytx@jobname}{"}{}
                                        [\pytx@jobname]

removing the ngerman line makes it run again.

@gpoore
Copy link
Owner

gpoore commented Mar 25, 2022

I'd suggest trying to load pythontex before babel. I expect that ngerman is globally redefining " immediately (making it active, perhaps for umlaut), and this is interfering with pythontex using the " character in the preamble.

@Kamik423
Copy link
Author

Should this not at least be mentioned in the documentation at some point where users can see it? Or maybe when loading pythontex the package could check for " being redefined and display a more helpful error message?

@gpoore
Copy link
Owner

gpoore commented Apr 22, 2022

I can look into adding a note to the documentation, and at some point, I may be able to add a check for redefinitions of ASCII punctuation characters. The order of loading packages should really be discussed in language packages like ngerman, though, because any time a package globally redefines character or common macro meanings within the preamble, there is significant potential for issues, and such packages should always be loaded as late as possible.

@gpoore gpoore added the doc documentation label Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc documentation
Projects
None yet
Development

No branches or pull requests

2 participants