更改引文的“访问日期”格式

更改引文的“访问日期”格式

我想更改引文“urldate”中出现的日期格式。目前它是 yyyy-mm-dd,我想将其更改为 dd/mm/yyyy,我尝试过

\usepackage[ddmmyyyy]{datetime}
\renewcommand{\dateseparator}{//}

但是当我在 ref.bib 文件中输入所需格式的日期时,它会向我抛出此错误,并且 pdf 中没有日期。如果我保留旧格式,它就不会正确显示。

Entry 'mantis' (ref.bib): Invalid format '07/03/2023' of date field 'urldate' - ignoring.

主文件:

\documentclass[11pt, a4paper]{article}
\usepackage[a4paper,left=1.6cm, right=2cm, top=1.5cm, bottom=0.5cm,includefoot, footskip=30pt]{geometry}
%\usepackage[backend=biber, style=science]{biblatex} %authortitle
\usepackage[ddmmyyyy]{datetime}
\renewcommand{\dateseparator}{//}
\usepackage[english, czech]{babel}
\usepackage{csquotes}
\usepackage[backend=biber, babel=other, style=iso-numeric]{biblatex} %authortitle
\addbibresource{ref.bib}
\usepackage{url}
\usepackage{float}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{caption}
\usepackage{pdfpages}
\usepackage{setspace}
\usepackage{lipsum}

\DeclareCaptionType{code}[Kód][Seznam úryvků kódu] 

\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.97,0.97,0.97}

\lstdefinestyle{mystyle}{
    backgroundcolor=\color{backcolour},   
    commentstyle=\color{codegray},
    keywordstyle=\color{codegreen},
    numberstyle=\tiny\color{codegray},
    stringstyle=\color{codepurple},
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=true,                 
    numbers=left,                    
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
    showtabs=false,                  
    tabsize=2
}

\lstset{style=mystyle}
\setcounter{section}{-1}
\renewcommand{\figurename}{Obr.}
\renewcommand*\listfigurename{Seznam obrázků}
\renewcommand{\lstlistingname}{Kód}
\renewcommand*\contentsname{Obsah}

%\onehalfspacing

\begin{document}
\section{sample}

\lipsum[1] \supercite{mantis}
\newpage
\begin{center}
        \printbibliography[title={Reference}]
\end{center}
\newpage
\listoffigures 
\newpage
\end{document}

ref.bib 文件:

@MISC{mantis,
    title={Voron Mantis dual 5015},
    url={https://github.com/VoronDesign/VoronUsers/tree/master/printer_mods/Long/Mantis_Dual_5015},
    urldate = {2023-03-07}, 
}

我想要更改的日期格式:

默认引用日期格式

答案1

您在参考书目中看到的日期格式主要由您使用的样式以及所选语言控制。该包datetime无法控制 的biblatex日期输出。

biblatex-iso690样式类似于style=iso-numeric以 ISO8601 格式输出大多数日期。

如果您不喜欢这个并且喜欢更传统的输出,请使用选项urldate=short,。对于像您这样的捷克文档,这将给出dd. mm. yyyy

\documentclass[11pt, a4paper]{article}
\usepackage[english, czech]{babel}
\usepackage{csquotes}
\usepackage[
  backend=biber,
  style=iso-numeric,
  babel=other,
  urldate=short,
]{biblatex}
\usepackage{hyperref}

\begin{filecontents}{\jobname.bib}
@MISC{mantis,
  title   = {Voron Mantis dual 5015},
  url     = {https://github.com/VoronDesign/VoronUsers/tree/master/printer_mods/Long/Mantis_Dual_5015},
  urldate = {2023-03-07}, 
}
\end{filecontents}
\addbibresource{\jobname.bib}

%\onehalfspacing

\begin{document}
\section{sample}

Lorem \supercite{mantis}
\printbibliography[title={Reference}]
\end{document}

Voron Mantis dual 5015 [在线]。[Br]。[引自 2023 年 3 月 7 日]。


如果您愿意dd/mm/yyyy,您urldate=short,还需要重新定义short捷克的日期格式。

\documentclass[11pt, a4paper]{article}
\usepackage[english, czech]{babel}
\usepackage{csquotes}
\usepackage[
  backend=biber,
  style=iso-numeric,
  babel=other,
  urldate=short,
]{biblatex}
\usepackage{hyperref}

\DefineBibliographyExtras{czech}{%
  \protected\def\mkbibdateshort#1#2#3{%
    \iffieldundef{#3}
      {}
      {\mkdayzeros{\thefield{#3}}%
       \iffieldundef{#2}{}{/}}%
    \iffieldundef{#2}
      {}
      {\mkmonthzeros{\thefield{#2}}%
       \iffieldundef{#1}
         {}
         {/}}%
    \iffieldbibstring{#1}
      {\bibstring{\thefield{#1}}}
      {\dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}}}

\begin{filecontents}{\jobname.bib}
@MISC{mantis,
  title   = {Voron Mantis dual 5015},
  url     = {https://github.com/VoronDesign/VoronUsers/tree/master/printer_mods/Long/Mantis_Dual_5015},
  urldate = {2023-03-07}, 
}
\end{filecontents}
\addbibresource{\jobname.bib}

%\onehalfspacing

\begin{document}
\section{sample}

Lorem \supercite{mantis}
\printbibliography[title={Reference}]
\end{document}

Voron Mantis dual 5015 [在线]。[Br]。[引自 2023 年 7 月 3 日]。

相关内容