6

I have the following code, inspired by this answer.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}
    \begin{table}[h]
    \begin{center}
        \begin{NiceTabular}{cccc}[hvlines]
            \Block{2-2}{R}  &       & \Block{1-2}{C} \\
                            &       & true & false \\
            \Block{2-1}{R}  & true  & 1    & 1 \\
                            & false & 2    & 3
        \end{NiceTabular}
    \end{center}
    \caption{Table}
    \end{table}
\end{document}

This works as expected. But when I modify the preamble like the following.

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

I get an error.

2-2\q_stop {}{}{R}\unskip \__nicematrix_cell_end: \relax \d@llarend \do@row@strut \ETC.
! Forbidden control sequence found while scanning use of \__nicematrix_Block_i.<inserted text> 
                \par 
l.9             \Block{2-2}{R}  &
                                        & \Block{1-2}{C} \\
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.

! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.9             \Block{2-2}{R}  &
                                        & \Block{1-2}{C} \\
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

Other languages like english and french specified as an argument to babel work without problems.

I use the current version of Overleaf, pdflatex as compiler and the version of Tex Live is 2022. Changing the compiler or the Tex Live version doesn't help. What should I do to fix this?

2 Answers 2

8

You need to turn the babel shorthand - off:

\documentclass{article}
\usepackage[czech]{babel}
\usepackage{nicematrix}
\begin{document}
    \begin{table}[h]
    \begin{center}
    \shorthandoff{-}
        \begin{NiceTabular}{cccc}[hvlines]
            \Block{2-2}{R}  &       & \Block{1-2}{C} \\
                            &       & true & false \\
            \Block{2-1}{R}  & true  & 1    & 1 \\
                            & false & 2    & 3
        \end{NiceTabular}
    \end{center}
    \caption{Table}
    \end{table}
\end{document}

(This happens as - is 'active' with the Czech support from babel, but that then means that it is not 'identified' properly by nicematrix.)

1

I have posted on CTAN a new version of nicematrix (v. 6.13e of 2022-12-12) which solves that problem.

You must log in to answer this question.

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