Nicematrix 包与 babel 冲突

Nicematrix 包与 babel 冲突

我有以下代码,受此启发回答

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

这按预期工作。但是当我像下面这样修改序言时。

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

我收到一个错误。

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.

其他语言类似englishfrench指定为参数以便可以babel无问题地工作。

我使用当前版本的 Overleafpdflatex作为编译器,Tex Live 的版本是 2022。更改编译器或 Tex Live 版本没有帮助。我应该怎么做才能解决这个问题?

答案1

您需要关闭babel速记-

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

(这种情况发生在-'活跃' 状态,得到了 的捷克支持babel,但那意味着 它没有被 正确 '识别' nicematrix。)

答案2

我在 CTAN 上发布了一个新版本nicematrix(2022-12-12 的 v. 6.13e),该版本解决了该问题。

相关内容