抱歉问了这么多问题,到目前为止您的帮助非常棒!
我还有一个问题。我希望文章中的期刊标题前面有
在:
在:
我有点不知道该如何实现这一点。提前谢谢您,祝您有个愉快的夜晚!:)
Latex 示例:https://www.overleaf.com/read/dvtrpzgfqghn
-- 编辑:我希望这是一个可以接受的例子 :) 由于某种原因,Hg 之后的部分现在缺少一些空格 :<
\documentclass{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage[main=ngerman, english]{babel}
%----------------------------------------------------------------------------
% BIB
%----------------------------------------------------------------------------
\usepackage[
backend=biber,
style=authoryear,
sorting=nyvt
]{biblatex}
\renewcommand{\mkbibnamefamily}[1]{\textsc{#1}}
\renewcommand{\labelnamepunct}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\renewcommand\postnotedelim{\addcolon\addspace}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{#1\isdot}
% sets Hg
\renewbibmacro*{in:}{%
\printtext{%
\bibstring{in}\intitlepunct}%
\ifentrytype{incollection}
{\DeclareNameAlias{editor}{last-first}%
\ifnameundef{editor}
{}
{\printnames{editor}%
\setunit{\printunit{editortypedelim}}%
\usebibmacro{editorstrg}%
\setunit{\addcolon\addspace}}%
\usebibmacro{maintitle+booktitle}%
\clearfield{maintitle}%
\clearfield{booktitle}%
\clearfield{volume}%
\clearfield{part}%
\clearname{editor}}
{}}
% Use Hg. in parentheses after editor
\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DefineBibliographyStrings{german}{%
editor = {Hg\adddot}
andothers = {et\ al\adddot}, %et al. statt u.a.
editor = {{Hg\adddot}}, %Hg. statt Hrsg.
editors = {{Hgg\adddot}}, %Hgg. plural
byeditor = {{Hg\adddot}},
}
\begin{filecontents*}{\jobname.bib}
@book{CommissionontheHumanities.1980,
editor = {{Commission on the Humanities}},
year = {1980},
title = {The Humanities in American Life},
keywords = {Humanities},
publisher = {{University of California Press}},
isbn* = {0520041836},
subtitle = {Report of the Commission on the Humanities},
location = {Berkeley and London},
abstract = {},
organization = {{Commission on the Humanities}}
}
@incollection{Gotoda.1990,
author = {Got{\^o}da, Masaharu},
year = {1990},
title = {Shin no minshu shugi o mezashite},
titleaddon = {Eine wirkliche Demokratie anstreben},
publisher = {Seibund{\^o}},
maintitle = {Shishunki no seiji},
maintitleaddon = {Politik in der Pubert{\"a}t},
pagetotal = {34--59},
location = {T{\^o}ky{\^o}},
abstract = {},
editor = {Yasuoka, Okiharu},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
%----------------------------------------------------------------------------
% MAIN
%----------------------------------------------------------------------------
\begin{document}
\nocite{*}
\printbibliography[heading=bibintoc,title={Literaturverzeichnis}]
\end{document}
答案1
您的代码中对 bibmacro进行了重新定义in:
。(为了方便本问答的未来读者:in:
bibmacro 的原始重新定义不是问题中 MWE 中显示的定义。原始代码仅作为 Overleaf 链接发布,将来可能会或可能不会访问。问题中的 MWE 已经包含了第一次尝试解决原始问题的结果(几乎成功,但最终存在错误)——如果您对我的尴尬拼写错误感兴趣,另请参阅此答案的编辑历史。)
您可能希望重新定义略有不同,以确保始终打印“in”,而不仅仅是@incollection
:只需将打印“in”的代码移到条件之外即可。我还修复了一些可能的虚假空间,并尝试使整个事情现代化,这样它就可以很好地与您的其他定义(即格式editortype
)配合使用。
\documentclass{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage[main=ngerman, english]{babel}
\usepackage[backend=biber, style=authoryear, sorting=nyvt]{biblatex}
\renewcommand{\mkbibnamefamily}[1]{\textsc{#1}}
\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\renewcommand\postnotedelim{\addcolon\addspace}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{#1\isdot}
\renewbibmacro*{in:}{%
\printtext{%
\bibstring{in}\intitlepunct}%
\ifentrytype{incollection}
{\DeclareNameAlias{editor}{family-given}%
\ifnameundef{editor}
{}
{\printnames{editor}%
\setunit{\printdelim{editortypedelim}}%
\usebibmacro{editorstrg}%
\setunit{\addcolon\space}}%
\usebibmacro{maintitle+booktitle}%
\clearfield{maintitle}%
\clearfield{booktitle}%
\clearfield{volume}%
\clearfield{part}%
\clearname{editor}}
{}}
\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DefineBibliographyStrings{german}{%
editor = {Hg\adddot}
andothers = {et\ al\adddot}, %et al. statt u.a.
editor = {{Hg\adddot}}, %Hg. statt Hrsg.
editors = {{Hgg\adddot}}, %Hgg. plural
byeditor = {{Hg\adddot}},
}
\begin{filecontents*}{\jobname.bib}
@book{CommissionontheHumanities.1980,
editor = {{Commission on the Humanities}},
year = {1980},
title = {The Humanities in {American} Life},
keywords = {Humanities},
publisher = {University of California Press},
isbn = {0520041836},
subtitle = {Report of the Commission on the Humanities},
location = {Berkeley and London},
organization = {Commission on the Humanities}
}
@incollection{Gotoda.1990,
author = {Got{\^o}da, Masaharu},
year = {1990},
title = {Shin no minshu shugi o mezashite},
titleaddon = {Eine wirkliche Demokratie anstreben},
publisher = {Seibund{\^o}},
maintitle = {Shishunki no seiji},
maintitleaddon = {Politik in der Pubert{\"a}t},
pagetotal = {34--59},
location = {T{\^o}ky{\^o}},
editor = {Yasuoka, Okiharu},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography[heading=bibintoc, title={Literaturverzeichnis}]
\end{document}
我个人不建议使用这种方法在之前打印editor
的 s 。相反,我会使用@incollection
booktitle
biblatex-ext
的innamebeforetitle
选择,但我显然有偏见……