我想更改引用的“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}
參考文獻文件:
@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}
如果您願意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}