Skip to content

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

Description

@Kamik423

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.

Activity

  1. gpoore commented on Mar 25, 2022

    @gpoore
    Owner

    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.

  2. Kamik423 commented on Apr 22, 2022

    @Kamik423
    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?

  3. gpoore commented on Apr 22, 2022

    @gpoore
    Owner

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docdocumentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions