日期未格式化

日期未格式化

我正在使用该genealogytree包制作一个漂亮的家谱。但是,无论我做什么,我都无法正确格式化日期。例如,根据格式,我希望底部节点的出生日期为 22.7.1877 d.m.yyyy。我按照手册编写了 \genealogytree 的可选参数,并且似乎调用了一些格式化例程,因为(caAD)日历被正确解释,但实际日期按原样打印。相当简单的例子:

\documentclass[a4paper, landscape]{book}
\usepackage{fullpage}
\usepackage[czech]{babel}
\usepackage[all]{genealogytree}

\begin{document}

\begin{tikzpicture}
\genealogytree[
processing=database, database format=medium no marriage,
tcbset={male/.style={colframe=blue,colback=blue!5}, female/.style={colframe=red,colback=red!5}},
name font=\bfseries, place text={\newline}{}, date format=d.m.yyyy,
label database options={place text={(}{)}},
label options={fill=white,node font=\footnotesize,inner sep=0.5mm,draw=green!30!black},
]{
    parent[family database={marriage={1874-02-16}{Zalužany}}]{
        g[male]{name={Josef Zelenka}, birth={1877-07-22}{Zalužany}}
        parent[family database={marriage={1848-03-06}{Kozárovice}}]{
            g[male]{name={František Zelenka}, birth={1850-04-12}{Kozárovice}, death={1893-04-08}{Kozárovice}}
            p[male]{name={Tomáš Zelenka}, birth={1812-12-29}{Kozárovice}, death={1890-03-10}{Kozárovice}}
            p[female]{name={Anna Peterková}, birth={1817-11-14}{Kozárovice}, death={1890-06-16}{Kozárovice}}
        }
        parent[family database={marriage={1842-02-06}{Nevězice}}]{
            g[female]{name={Marie Říhová}, birth={1850-06-17}{Zalužany}, death={1889-08-09}{Kozárovice}}
            p[male]{name={Josef Říha}, birth={1819-08-04}{Vrábsko}}
            p[female]{name={Josefa Skopečková}, birth={(caAD)1824}{Nevězice}}
        }
    }
}
\end{tikzpicture}
\end{document}

编译结果如下: 以上是由 pdfLaTeX 编译的最小示例

软件包genealogytree版本是2.1.0。我使用 pdflatex,输出为pdflatex -version

pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian)
kpathsea version 6.3.4/dev
Copyright 2021 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.03

非常感谢所有能提供帮助的人!

答案1

正如评论中指出的那样,问题是由 Babel 的 Czech 选项引起的。这是因为该选项启用了-简写(例如,参见babel 简写列表)。简写是一种字符或字符组合,它使输入特定语言的标点符号或禁用连字符变得容易,其工作原理是将字符转换为 LaTeX 命令。但是,日期解析genealogytree取决于连字符是否为常规字符。

您可以在环境中关闭简写tikzpicture

\documentclass[a4paper, landscape]{book}
\usepackage{fullpage}
\usepackage[czech]{babel}
\usepackage[all]{genealogytree}
\AddToHook{env/tikzpicture/before}{\shorthandoff{-}}

结果:

在此处输入图片描述

相关内容