3

My problem is the conflict between polynomial long division provided by the polynom package and Slovak babel.

I want to get the polynomial long division, I use the package polynom and the following command:

\usepackage{polynom}

\polyset{style=C,div=:,vars=x}
\polylongdiv{x^3-2x^2+3x-1}{x-1}

Without using slovak babel, the output is correct:

enter image description here

But when I add \usepackage[slovak]{babel}, I get

enter image description here

As you can see the output with slovak babel active is wrong.

Any idea what might be causing this behaviour is much appreciated. Thank you!

3
  • The question which this is a duplicate of is about Czech babel, but the problem is exactly the same.
    – egreg
    Commented Jul 1, 2021 at 22:01
  • 1
    Hello, thank you for the hint! It does not work exactly the same as with czech babel though. I just found out that shorthandoff{-} is not enough. Slovak babel uses shorthand for ^ character as well, so when I used \shorthandoff*{^-} it worked well. Thanks again!
    – Iveta
    Commented Jul 2, 2021 at 7:38
  • 1
    I overlooked the problem with ^ , sorry.
    – egreg
    Commented Jul 2, 2021 at 9:00

1 Answer 1

2

The problem is similar for the Czech language, but requires a slightly different solution.

\documentclass{article}
\usepackage[main=slovak]{babel}
\usepackage{amsmath}
\usepackage{polynom}
\usepackage{xpatch}

\xpatchcmd{\polylongdiv}
  {\begingroup}
  {\begingroup\catcode`^=7 \shorthandoff{-}}
  {}{}

\polyset{style=C,div=:,vars=x}

\begin{document}

\polylongdiv{x^3-2x^2+3x-1}{x-1}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .