1

I encountered a problem when I try to typeset text with the babel library for the Czech language and using the polynom library. The correct polynom division looks like below.

enter image description here

My MWE is:

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

\listfiles
\begin{document}
  \begin{equation*}
    \polylongdiv[style=C,div=:]{x^3+4x^2-x+2}{x^2+x-3}
  \end{equation*}
\end{document}

and the wrong output is: enter image description here

I don't know, how can protect the command \polylongdiv. The magic word \protect\polylongdiv leads to a compile error. The command \shorthandoff{-} doesn't work. So I exhausted all the tricks.

2
  • 2
    \shorthandoff{-} works for me, if used after \begin{document}. May 23, 2021 at 21:10
  • The problem is the same with \usepackage[slovak]{babel} and the solution is good also in that case.
    – egreg
    Jul 1, 2021 at 22:02

1 Answer 1

2

You can patch \polylongdiv to locally set \shorthandoff{-}

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

\xpatchcmd{\polylongdiv}{\begingroup}{\begingroup\shorthandoff{-}}{}{}

\begin{document}

\begin{equation*}
\polylongdiv[style=C,div=:]{x^3+4x^2-x+2}{x^2+x-3}
\end{equation*}

\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 .