![在 `year` 前面的方括号中输入 `origyear`](https://linux22.com/image/360391/%E5%9C%A8%20%60year%60%20%E5%89%8D%E9%9D%A2%E7%9A%84%E6%96%B9%E6%8B%AC%E5%8F%B7%E4%B8%AD%E8%BE%93%E5%85%A5%20%60origyear%60.png)
我需要满足我的书目的特殊设计规则,所以为我制作了这个代码:
\documentclass[a4paper,12pt,numbers=endperiod]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}
\DefineBibliographyStrings{ngerman}{references={Bibliographie}}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\renewbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{\printnames[byeditor]{editor}%
\setunit{\addspace}%
\usebibmacro{byeditor+othersstrg}%
\clearname{editor}%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}
\renewbibmacro*{byeditor+othersstrg}{\usebibmacro{editor+othersstrg}}
\renewbibmacro*{bytranslator+othersstrg}{\usebibmacro{translator+othersstrg}}
\renewbibmacro*{bytypestrg}[2]{%
\iffieldundef{#1type}
{\bibstring{#2}}
{\ifbibxstring{\thefield{#1type}}
{\bibstring{\thefield{#1type}}}
{\printtext{\thefield{#1type}}}}}
\renewcommand*{\multinamedelim}{/}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\renewcommand*{\labelnamepunct}{\addcolon\space}
\renewcommand*{\postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\DeclareFieldFormat{superedition}{\textsuperscript{#1}}
\providecommand*{\iflabeldateisdate}{%
\ifboolexpr{%
not test {\iffieldundef{labeldatesource}}
and
(test {\iffieldequalstr{labeldatesource}{}}
or test {\iffieldequalstr{labeldatesource}{year}})}}
\renewbibmacro*{date+extrayear}{%
\iffieldundef{labelyear}
{}
{\printtext[parens]{%
\iflabeldateisdate
{\iffieldnum{edition}
{\printfield[superedition]{edition}%
\global\clearfield{edition}}
{}%
\printdateextra}
{\printlabeldateextra}}}}
\renewcommand*{\bibpagespunct}{\addcolon\space}
\DeclareFieldFormat{pages}{#1}
\DeclareNameAlias{sortname}{family-given}
\begin{document}
\nocite{sigfridsson,companion,cotton,iliad,malinowski,
gaonkar:in,westfahl:space,pines,brandt,hyman,kant:kpv}
\printbibliography
\end{document}
现在我还需要最后一件事:对于某些出版物,我有必要像这样说明其首次出现的年份:
多伊,简 [1979] (22003)等
(这大胆的数字应以上标显示)
答案1
如果已定义,您可以修改宏以在参考书目中date+extrayear
打印。origdate
\renewbibmacro*{date+extrayear}{%
\iffieldundef{labelyear}
{}
{\usebibmacro{origdate}% <- add this line
\setunit*{\addspace}% <- add this line
\printtext[parens]{%
\iflabeldateisdate
{\iffieldnum{edition}
{\printfield[superedition]{edition}%
\global\clearfield{edition}}
{}%
\printdateextra}
{\printlabeldateextra}}}}
然后定义一个宏来打印origdate
。
\newbibmacro*{origdate}{%
\iffieldundef{origyear}
{}
{\printtext[brackets]{\printorigdate}}}
将其与您的 MWE 放在一起(我添加了 Doe 2003 和origyear
1979 年的):
\documentclass[a4paper,12pt,numbers=endperiod]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=authoryear]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{doe,
author = {Doe, Jane},
title = {Title},
edition = {2},
date = {2003},
origdate = {1979},
location = {Location},
publisher = {Publisher}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\DefineBibliographyStrings{ngerman}{references={Bibliographie}}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\renewbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{\printnames[byeditor]{editor}%
\setunit{\addspace}%
\usebibmacro{byeditor+othersstrg}%
\clearname{editor}%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}
\renewbibmacro*{byeditor+othersstrg}{\usebibmacro{editor+othersstrg}}
\renewbibmacro*{bytranslator+othersstrg}{\usebibmacro{translator+othersstrg}}
\renewbibmacro*{bytypestrg}[2]{%
\iffieldundef{#1type}
{\bibstring{#2}}
{\ifbibxstring{\thefield{#1type}}
{\bibstring{\thefield{#1type}}}
{\printtext{\thefield{#1type}}}}}
\renewcommand*{\multinamedelim}{/}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\renewcommand*{\labelnamepunct}{\addcolon\space}
\renewcommand*{\postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\DeclareFieldFormat{superedition}{\textsuperscript{#1}}
\providecommand*{\iflabeldateisdate}{%
\ifboolexpr{%
not test {\iffieldundef{labeldatesource}}
and
(test {\iffieldequalstr{labeldatesource}{}}
or test {\iffieldequalstr{labeldatesource}{year}})}}
\renewbibmacro*{date+extrayear}{%
\iffieldundef{labelyear}
{}
{\usebibmacro{origdate}%
\setunit*{\addspace}%
\printtext[parens]{%
\iflabeldateisdate
{\iffieldnum{edition}
{\printfield[superedition]{edition}%
\global\clearfield{edition}}
{}%
\printdateextra}
{\printlabeldateextra}}}}
\newbibmacro*{origdate}{%
\iffieldundef{origyear}
{}
{\printtext[brackets]{\printorigdate}}}
\renewcommand*{\bibpagespunct}{\addcolon\space}
\DeclareFieldFormat{pages}{#1}
\DeclareNameAlias{sortname}{family-given}
\begin{document}
\cite{doe}
\nocite{sigfridsson,companion,cotton,iliad,malinowski,
gaonkar:in,westfahl:space,pines,brandt,hyman,kant:kpv}
\printbibliography
\end{document}