![Biblatex 更改特定条目类型的字段格式](https://linux22.com/image/379263/Biblatex%20%E6%9B%B4%E6%94%B9%E7%89%B9%E5%AE%9A%E6%9D%A1%E7%9B%AE%E7%B1%BB%E5%9E%8B%E7%9A%84%E5%AD%97%E6%AE%B5%E6%A0%BC%E5%BC%8F.png)
我想editor
仅在条目类型为 时更改 的字段格式incollection
。这样作者姓名仍为粗体。编辑姓名不应为粗体。
我已附上一个例子:
\documentclass[12pt]{scrartcl}
%
\usepackage[%
backend=biber,%
citestyle=authoryear,%-comp,%
bibstyle=authortitle,%
]{biblatex}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{filecontents}
\usepackage{verbatim}
\usepackage{csquotes}
%\usepackage{newtxtext}
%\usepackage{mathptmx}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\fontspec[
% SmallCapsFont=Times,
SmallCapsFeatures={Letters=SmallCaps}]{Times New Roman}
%\setmainfont[SmallCapsFont=Times]{Times New Roman}
%
\addbibresource{\jobname.bib}
% ===
% ===============
\renewcommand{\finentrypunct}{}% kein Punkt am Ende im LitVZ
% ==========================================================
\renewcommand{\mkbibnamefamily}[1]{\textsc{#1}}%Kapitaelchen Name
%\renewcommand{\mkbibnamegiven}[1]{\textsc{#1}}%Kapitaelchen Vorname
% ==========================================================
\renewcommand*{\multinamedelim}{~/\space}% Separation der Autoren
\renewcommand*{\finalnamedelim}{~/\space}%
% ==========================================================
%\renewcommand*{\labelnamepunct}{}%\newunitpunct}
\renewcommand*{\newunitpunct}{\addcomma\space}% Bibentry Felder werden mit Komma getrennt
% ==========================================================
\renewbibmacro{in:}{% kein 'in' bei @article
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
% ==========================================================
\renewbibmacro{issue+date}{%
%\printtext[parens]{% Klammern um Jahr weg
\printfield{issue}%
\setunit*{\addspace}%
\usebibmacro{date}%}%
\newunit}
% ===============
% =====
\newbibmacro*{cite:article:journal}{%
\newunit
\printfield{journaltitle}
%\newunit% no comma between journal and year
}
%
\newbibmacro*{cite:article:pages}{%
\newunit%\addcomma
\printfield{pages}}
%
\newbibmacro*{cite:book:shorttitle}{%
\printfield[citetitle]{labeltitle}}
%
\renewbibmacro{postnote}{%
\iffieldundef{postnote}
{}
{%\setunit{%\postnotedelim}%
\printfield{postnote}}}
% ======================
\makeatletter
%% ===
\renewbibmacro{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}}
{\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}}%
\ifentrytype{book}% === field
{\setunit{\printdelim{nametitledelim}}\usebibmacro{cite:book:shorttitle}}% === true
{}%\usebibmacro{cite:labeldate+extradate}% === false
\ifentrytype{article}% === field
{\usebibmacro{cite:article:journal}\usebibmacro{cite:labeldate+extradate}
\usebibmacro{cite:article:pages}%
}% === true
{}% === false
{\usebibmacro{cite:shorthand}}
}
}
\makeatother
% ===
% ===
% ===
% =========== incollection bib driver
\DeclareBibliographyDriver{incollection}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{in:}%
\newunit\newblock
\usebibmacro{editor+others}% It shouldn't be bold
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
% \usebibmacro{editor+others}% OLD
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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}}
% ===
% ===
% ===
% === BIB
\begin{filecontents}{\jobname.bib}
@book{book,
author = {Brox, Hans and Walker, Wolf-Dietrich},
shortauthor = {Brox/Walker},
title = {Allgemeiner Teil BGB},
shorttitle = {BGB AT},
year = {2012},
edition = {36},
}
@article{article,
author = {Jorg Neuner},
title = {Was ist eine Willenserklärung?},
journal = {JuS},
year = {2007},
pages = {881-888},
}
@misc{misc,
TITLE = {Beck'scher Online-Kommentar BGB},
SHORTTITLE = {},
EDITOR = {Bamberger, Heinz Georg and Roth, Herbert and Hau, Wolfgang and Poseck, Roman},
SHORTAUTHOR = {BeckOK},
VOLUME = {},
VOLUMETITLE = {},
YEAR = {2018},
ADDRESS = {},
EDITION = {45},
%HOWCITED = {1},
}
@incollection{incoll,
TITLE = {Unvernunft als Zurechnungskriterium in den "Retterfällen"},
AUTHOR = {Beckemper, Katharina},
BOOKTITLE = {Strafrecht als Scientia Universalis - Festschrift f{\"u}r Claus Roxin zum 80. Geburtstag},
EDITOR = {Manfred, Heinrich},
SHORTTITLE = {FS Roxin},
YEAR = {2011},
PAGES = {397--411},
}
\end{filecontents}
%
\begin{document}
\fontspec[
%SmallCapsFont=Times,
SmallCapsFeatures={Letters=SmallCaps}]{Times New Roman}
% ===
\printbibliography[title=Bibliography]
%
I want to achieve that the editor is not bold when using the \verb|\ifentrytype{incollection}|.\footcite{incoll}\\
\\The author should remain bold.
\end{document}
我也用这个biblatex.cfg
:
% !TEX encoding = UTF-8 Unicode
\ProvidesFile{biblatex.cfg}
%
% ==========================================================
% === Autoren Fett, Nachname, Vorname ====
%
\DeclareNameAlias{sortname}{last-first-bold}
\DeclareNameFormat{last-first-bold}{\mkbibbold{%
\ifgiveninits
{\usebibmacro{name:family-given}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffix}}
{\usebibmacro{name:family-given}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}}%
\usebibmacro{name:andothers}}}
% ==========================================================
% === Titel nicht kursiv ===
%
\DeclareFieldFormat{citetitle}{\normalfont{#1}}% Zitate: Schriftart der Titel
\DeclareFieldFormat{title}{\normalfont{#1}}% Titel im LitVZ
\DeclareFieldFormat{journaltitle}{\normalfont{#1}}%
% ==========================================================
% === kein Punkt in Library ===
%
\renewcommand{\finentrypunct}{}% Kein Punkt am Ende des Eintrags im LitVZ
% ==========================================================
% === Hrsg. ===
%
\DeclareFieldFormat{authortype}{\mkbibparens{#1}}% Authortyp in Klammern
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}% Editortyp in Klammern
% ==========================================================
\DeclareDelimFormat{authortypedelim}{\space}% Kein Komma nach Autor
\DeclareDelimFormat{editortypedelim}{\space}% Kein Komma nach Editor
% ==========================================================
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addspace%\labelnamepunct% Kein Punkt zwischen Autoren und Werk
}
% ==========================================================
% === Auflage/Aufl. ===
%
\DefineBibliographyStrings{german}{%
edition = {\ifbibliography{Auflage}{Aufl\adddot}},% 'Auflage' statt 'Aufl.'
}
% ==========================================================
% === Erkennt Satzzeichen & setzt kein Komma ausser bei Abkurzungen ===
%
\DefineBibliographyExtras{german}{\DeclarePunctuationPairs{comma}{*}}
% ==========================================================
\endinput
有任何想法吗?
答案1
我不会在for和其朋友editor+others
之后使用。相反,我会定义一个可以在该位置使用并使用其自身格式的新宏。in:
@incollection
\documentclass[12pt]{scrartcl}
%
\usepackage[%
backend=biber,%
citestyle=authoryear,%-comp,%
bibstyle=authortitle,%
]{biblatex}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{libertine}
\usepackage{filecontents}
\usepackage{csquotes}
\addbibresource{\jobname.bib}
\DeclareNameAlias{sortname}{family-given-bold}
\DeclareNameFormat{family-given-bold}{\mkbibbold{%
\ifgiveninits
{\usebibmacro{name:family-given}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffix}}
{\usebibmacro{name:family-given}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}}%
\usebibmacro{name:andothers}}}
\DeclareFieldFormat{citetitle}{\normalfont{#1}}
\DeclareFieldFormat{title}{\normalfont{#1}}
\DeclareFieldFormat{journaltitle}{\normalfont{#1}}%
\renewcommand{\finentrypunct}{}
\DeclareFieldFormat{authortype}{\mkbibparens{#1}}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{authortypedelim}{\addspace}
\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addspace}
\DefineBibliographyStrings{german}{%
edition = {\ifbibliography{Auflage}{Aufl\adddot}},
}
\DefineBibliographyExtras{german}{\DeclarePunctuationPairs{comma}{*}}
\renewcommand{\mkbibnamefamily}[1]{\textsc{#1}}
%\renewcommand{\mkbibnamegiven}[1]{\textsc{#1}}
\DeclareDelimFormat{multinamedelim}{\addnbspace/\space}%
\DeclareDelimAlias{finalnamedelim}{multinamedelim}%
%\renewcommand*{\labelnamepunct}{}%\newunitpunct}
\renewcommand*{\newunitpunct}{\addcomma\space}%
\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
\renewbibmacro{issue+date}{%
%\printtext[parens]{%
\printfield{issue}%
\setunit*{\addspace}%
\usebibmacro{date}%}%
\newunit}
\newbibmacro*{cite:article:journal}{%
\newunit
\printfield{journaltitle}%
%\newunit%
}
\newbibmacro*{cite:article:pages}{%
\newunit%\addcomma
\printfield{pages}}
\newbibmacro*{cite:book:shorttitle}{%
\printfield[citetitle]{labeltitle}}
\renewbibmacro{postnote}{%
\iffieldundef{postnote}
{}
{%\setunit{%\postnotedelim}%
\printfield{postnote}}}
\makeatletter
\renewbibmacro{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}}
{\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}}%
\ifentrytype{book}%
{\setunit{\printdelim{nametitledelim}}\usebibmacro{cite:book:shorttitle}}%
{}%\usebibmacro{cite:labeldate+extradate}%
\ifentrytype{article}%
{\usebibmacro{cite:article:journal}\usebibmacro{cite:labeldate+extradate}
\usebibmacro{cite:article:pages}}
{}%
{\usebibmacro{cite:shorthand}}}}
\makeatother
%%%%%%%%%%%% answer starts here %%%%%%%%%%%%%%%%%%
\DeclareNameAlias{ineditor}{family-given}
\newbibmacro*{bbx:in:editor}[1]{%
\ifboolexpr{
test \ifuseeditor
and
not test {\ifnameundef{editor}}
}
{\printnames[ineditor]{editor}%
\setunit{\printdelim{editortypedelim}}%
\usebibmacro{#1}%
\clearname{editor}}
{}}
\newbibmacro*{in:editor}{%
\usebibmacro{bbx:in:editor}{editorstrg}}
\newbibmacro*{in:editor+others}{%
\usebibmacro{bbx:in:editor}{editor+othersstrg}}
\DeclareBibliographyDriver{incollection}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{in:}%
\newunit\newblock
\usebibmacro{in:editor+others}%<----- new macro
\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\newunit\newblock
% \usebibmacro{editor+others}% OLD
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\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{filecontents}{\jobname.bib}
@book{book,
author = {Brox, Hans and Walker, Wolf-Dietrich},
title = {Allgemeiner Teil BGB},
shorttitle = {BGB AT},
year = {2012},
edition = {36},
}
@article{article,
author = {Jorg Neuner},
title = {Was ist eine Willenserklärung?},
journal = {JuS},
year = {2007},
pages = {881-888},
}
@misc{misc,
title = {Beck'scher Online-Kommentar BGB},
editor = {Bamberger, Heinz Georg and Roth, Herbert and Hau, Wolfgang and Poseck, Roman},
shortauthor = {BeckOK},
year = {2018},
edition = {45},
%HOWCITED = {1},
}
@incollection{incoll,
title = {Unvernunft als Zurechnungskriterium in den \enquote{Retterfällen}},
author = {Beckemper, Katharina},
booktitle = {Strafrecht als Scientia Universalis - Festschrift für Claus Roxin zum 80. Geburtstag},
editor = {Manfred, Heinrich},
shortitle = {FS Roxin},
year = {2011},
pages = {397--411},
}
\end{filecontents}
%
\begin{document}
\printbibliography[title=Bibliography]
%
I want to achieve that the editor is not bold when using the \verb|\ifentrytype{incollection}|.\footcite{incoll}\\
\\The author should remain bold.
\end{document}
请注意,在 MWE 中,我将 的内容合并biblatex.cfg
到了序言中。至少在这里,我认为没有理由将两者分开(并且它使示例自成一体)。