我正在尝试为标准文档设置自己的样式(德语中为“Normen”)。我从报告中复制了大部分内容,效果很好,除了月份,它是本地格式化的(甚至在\printfield{month}
和返回中也是Okt. 2023
如此;但是,它应该是 ISO 样式2023-10
。
我可以使用date=iso
,但这适用于所有日期,而不仅仅是 -entries 的日期@norm
。我该如何补救?
或者我可以使用\printfield{month}
,但这会返回已针对我的语言本地格式化的月份,即Okt.
,但10
如果月份只有一位数字,我希望 带有前导零。在编程语言中,日期应该是YYYY-MM
,Latex 有类似的东西吗?
梅威瑟:
\documentclass[ngerman]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{ngerman}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{microtype}
\begin{filecontents}[overwrite]{\jobname.bib}
@norm{lnorm,
title = {Information und Dokumentation -- Richtlinien für Titelangaben und Zitierung von Informationsressourcen},
type = {DIN ISO},
number = 690,
date = {2013-10},
doi = {10.31030/2054156},
}
\end{filecontents}
% , date=iso
\usepackage[backend=biber, style=ieee]{biblatex}
\addbibresource{\jobname.bib}
\DeclareBibliographyDriver{norm}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
%\usebibmacro{author}%
%\setunit{\labelnamepunct}\newblock
\printfield{type}%
\setunit*{\addspace}%
\printfield{number}%
\setunit*{\addcolon}%
\usebibmacro{date}%
%\printfield{year}-\printfield{month}%
\newunit\newblock
\usebibmacro{title}%
%\newunit
%\printlist{language}%
%\newunit\newblock
%\usebibmacro{byauthor}%
%\newunit\newblock
%\usebibmacro{institution+location}%
%\newunit\newblock
%\printfield{version}%
%\newunit\newblock
%\printdate
%\bibdatetimesep
%\usebibmacro{date}%
%\newunit
%\printfield{note}%
%\newunit\newblock
%\usebibmacro{chapter+pages}%
%\newunit
%\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isrn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
%\newunit\newblock
%\usebibmacro{addendum+pubstate}%
%\setunit{\bibpagerefpunct}\newblock
%\usebibmacro{pageref}%
%\newunit\newblock
%\iftoggle{bbx:related}
%{\usebibmacro{related:init}%
% \usebibmacro{related}}
%{}%
\usebibmacro{finentry}
}
\begin{document}
Text~\cite[6]{lnorm}.
\printbibliography
\end{document}
答案1
biblatex
目前无法在本地设置选项(请参阅https://github.com/plk/biblatex/issues/1209特别是日期https://github.com/plk/biblatex/issues/863),因此如果您不想更改其他日期的格式,则必须使用一些技巧。一个技巧是使用稍微更内部的宏来打印 ISO 格式的日期。
\documentclass{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage[backend=biber, style=ieee]{biblatex}
\newbibmacro*{isodate}{%
\mkdaterangeiso{}%
}
\DeclareBibliographyDriver{norm}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\printfield{type}%
\setunit*{\addspace}%
\printfield{number}%
\setunit*{\addcolon}%
\usebibmacro{isodate}%
\newunit\newblock
\usebibmacro{title}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isrn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\usebibmacro{finentry}%
}
\begin{filecontents}{\jobname.bib}
@norm{lnorm,
title = {Information und Dokumentation
-- Richtlinien für Titelangaben und Zitierung von Informationsressourcen},
type = {DIN ISO},
number = 690,
date = {2013-10},
doi = {10.31030/2054156},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
Text~\cite[6]{lnorm}.
\printbibliography
\end{document}