7

When I add a babel package with option czech, the alignment of systeme gets broken.

\documentclass{article}
\usepackage{systeme}
\usepackage[czech]{babel}

\begin{document}
$$
\systeme{x+2y = 0, x-y = -1}
$$
\end{document}

The results is:

wrong alignment

Without the option or when changing czech to english, this example works as expected (i.e., variables aligned). Is there a way to fix it?

krab1k
  • 105
  • 5
    Try \shorthandoff{-} before the equation (if you need czech's special meaning of - you should add \shorthandon{-} after the equation or use \begingroup...\endgroup around the equation to keep the effect local). Note that \[...\] is preferred over $$...$$ in LaTeX – moewe Mar 21 '20 at 11:23

1 Answers1

9

The czech language module for babel makes the hyphen character - an active shorthand, which means that some uses of - break or don't work as expected.

You can temporarily disable this special meaning of - with \shorthandoff, to keep the effect of this command local, we add \begingroup...\endgroup around the equation.

\documentclass{article}
\usepackage{systeme}
\usepackage[czech]{babel}

\begin{document}
\begingroup
\shorthandoff{-}
\[
  \systeme{x+2y = 0, x-y = -1}
\]
\endgroup
\end{document}

System of equations with expected alignment.

Since \[...\] comes with a grouping of its own,

\[
  \shorthandoff{-}
  \systeme{x+2y = 0, x-y = -1}
\]

also works (thanks to @egreg for pointing that out in the comments).

Another option would be to use no grouping and explicitly turn the shorthand back on

\shorthandoff{-}
\[
  \systeme{x+2y = 0, x-y = -1}
\]
\shorthandon{-}

Note that in LaTeX \[...\] is preferable over $$...$$, see Why is \[ ... \] preferable to $$ ... $$?.

moewe
  • 175,683
  • 2
    Why not \shorthandoff after \[? For a one-line display it's surely easier. – egreg Mar 21 '20 at 13:22
  • 1
    @egreg Because I didn't think to check whether or not \[...\] introduces a group. Thanks for the hint. Will edit in a sec. – moewe Mar 21 '20 at 13:31