通过加载pdfcomment
包,日期格式似乎被隐式更改为 YYYY-MM-DD。考虑以下 MWE:
\documentclass[12pt]{scrartcl}
\usepackage[american]{babel}
\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{xcolor}
%\usepackage{pdfcomment}
%\pdfcommentsetup{author=me, color=yellow, open=true}
\title{Example in \LaTeX}
\author{rotton}
\begin{document}
\maketitle
\section{Example section}
Today is \today.
%\pdfcomment{This changes the date format}
\end{document}
日期在标题和文本中均按预期显示。当您在第一行、第一行+第二行或所有三行中注释pdfcomment
并重新编译时,日期现在显示为 YYYY-MM-DD。简短的测试表明这与语言设置无关\documentclass
。pdfcomment
手动的指出所需包之一是datetime2
。
这种行为是有意为之,还是只是一种不想要的副作用?如果是后者,如何恢复原始日期格式?
答案1
您应该激活 datetime2 的本地化:
\documentclass[12pt]{scrartcl}
\usepackage[american]{babel}
\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{xcolor}
\usepackage{pdfcomment}
\DTMsetregional
\title{Example in \LaTeX}
\author{rotton}
\begin{document}
\maketitle
\section{Example section}
Today is \today.
%\pdfcomment{This changes the date format}
\end{document}
答案2
您可以将选项传递useregional=numeric
给包datetime2
:
\documentclass[12pt]{scrartcl}
\usepackage[american]{babel}
\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{xcolor}
\PassOptionsToPackage{useregional=numeric}{datetime2}
\usepackage{pdfcomment}
\pdfcommentsetup{author=me, color=yellow, open=true}
\title{Example in \LaTeX}
\author{rotton}
\begin{document}
\maketitle
\section{Example section}
Today is \today.
\end{document}
datetime2
有关 option 的更多值,请参阅手册useregional
,例如,
\documentclass[12pt]{scrartcl}
\usepackage[american]{babel}
\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{xcolor}
\PassOptionsToPackage{useregional}{datetime2}
\usepackage{pdfcomment}
\pdfcommentsetup{author=me, color=yellow, open=true}
\title{Example in \LaTeX}
\author{rotton}
\begin{document}
\maketitle
\section{Example section}
Today is \today.
\end{document}
为了