datetime2 导致堆栈错误

datetime2 导致堆栈错误

有人能解释一下这是为什么吗?这是一个 mwe。如果我注释掉这两datetime2行,文档就可以编译成功,否则会出现失败\opening

\documentclass[a4paper,
    margin=2cm,
    headlines=4,
    parskip=full]{scrartcl}

\usepackage[%
    foldmarks=false,
    fromalign=right,
    fromrule=off,
    refline=dateleft,
    fromphone=false,
    fromemail=true,
    pagenumber=footright,
    fromlogo=false]{scrletter}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
%\usepackage{showframe}

\usepackage[en-GB]{datetime2}
\DTMlangsetup[en-GB]{ord=raise}

\begin{document}
\begin{letter}{%
        A. N. Other\\
        Someplace\\
        ZIP CODE%
    }
\opening{test}
\closing{cheers}
\end{letter}
\end{document}

编辑:

日志输出

! TeX capacity exceeded, sorry [input stack size=5000].
\sym@date ->\if@orgdate \sym@date 
                                  \else \num@date \fi 
l.31         \opening{test}
                           
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.

答案1

似乎有两种方法可以避免这个错误:

  1. 添加一个全局选项british。(我注意到这一点是因为的文档中datetime2有很多\documentclass[british]{article}。)
  2. babel之后加载datetime2(但这可能不是一个好主意)
\documentclass[a4paper,
    margin=2cm,
    headlines=4,
    parskip=full,
    british,
    ]{scrartcl}

\usepackage[%
    foldmarks=false,
    fromalign=right,
    fromrule=off,
    refline=dateleft,
    fromphone=false,
    fromemail=true,
    pagenumber=footright,
    fromlogo=false]{scrletter}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% \usepackage[en-GB]{datetime2}
% \DTMlangsetup[en-GB]{ord=raise}

\usepackage[english]{babel}
%\usepackage{showframe}

\usepackage[en-GB]{datetime2}
\DTMlangsetup[en-GB]{ord=raise}


\begin{document}
\begin{letter}{%
        A. N. Other\\
        Someplace\\
        ZIP CODE%
    }
\opening{test}
\closing{cheers}
\end{letter}
\end{document}

相关内容