我尝试以粗体形式显示所有文内引用的年份和作者。
谢谢@moewe我已经设法获得了我喜欢的参考书目样式,并且以粗体打印了文内引文中的作者。现在还缺少最后一步来获得我喜欢的格式样式。
如果有人能给我一点提示,我会非常高兴。我认为只缺少一行,但我不知道如何编辑年份。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{csquotes}
\usepackage[backend=biber,
citestyle=ext-authoryear,
bibstyle=ext-authortitle,
sorting=nyt,
introcite=label,
maintitleaftertitle=true,
maxcitenames=2,
dashed=false
]{biblatex}
\setlength{\introcitewidth}{4cm}
\setlength{\introcitesep}{\bibhang}
\DeclareFieldFormat{bbx@introcite}{\mkbibbold{#1}}
\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\mkbibnamefamily}{\textbf}
% make square brackets around citation in text
\makeatletter
\newrobustcmd*{\parentexttrack}[1]{%
\begingroup
\blx@blxinit
\blx@setsfcodes
\blx@bibopenparen#1\blx@bibcloseparen
\endgroup}
\AtEveryCite{%
\let\parentext=\parentexttrack%
\let\bibopenparen=\bibopenbracket%
\let\bibcloseparen=\bibclosebracket}
\makeatother
\AtBeginBibliography{
\renewcommand*{\mkbibnamefamily}[1]{\textsc{#1}}}
\begin{filecontents}{Bibliography.bib}
@book{Loftin80,
title={Subsonic Aircraft: Evolution and the Matching of Size to Performance},
author={Laurence K. Loftin},
year={1980},
}
\end{filecontents}
\addbibresource{Bibliography.bib}
\begin{document}
The author and year should be in bold. \autocite{Loftin80}
\printbibliography
\end{document}
答案1
不幸的是,没有内置格式可以以这种方式更改引用标签,所以我们必须重新定义 bibmacro cite
。使用的定义ext-authoryear.cbx
继承自authoryear.cbx
(v3.16 中第 10-18 行)。我们只需\printtext[bold]{...}
在正确的位置添加一个。
该代码还将自动使参考书目中的引用变为粗体,因此我们可以删除\DeclareFieldFormat{bbx@introcite}{\mkbibbold{#1}}
。
请注意,使用biblatex-ext
它可以比使用标准样式更容易地在引用周围添加方括号。你不需要\parentexttrack
和朋友。请参阅我的回答到Biblatex,作者年份,方括号,您可以\parentexttrack
在其中找到所接受的答案。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{csquotes}
\usepackage[backend=biber,
citestyle=ext-authoryear,
bibstyle=ext-authortitle,
sorting=nyt,
introcite=label,
maintitleaftertitle=true,
maxcitenames=2,
dashed=false
]{biblatex}
\setlength{\introcitewidth}{4cm}
\setlength{\introcitesep}{\bibhang}
\DeclareNameAlias{sortname}{family-given}
\DeclareOuterCiteDelims{parencite}{\bibopenbracket}{\bibclosebracket}
\renewbibmacro*{cite}{%
\printtext[bold]{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}}
{\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}}%
\usebibmacro{cite:labeldate+extradate}}
{\usebibmacro{cite:shorthand}}}}
\AtBeginBibliography{%
\renewcommand*{\mkbibnamefamily}{\textsc}}
\begin{filecontents}{\jobname.bib}
@book{Loftin80,
title = {Subsonic Aircraft: Evolution and the Matching of Size to Performance},
author = {Laurence K. Loftin},
year = {1980},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
The author and year should be in bold. \autocite{Loftin80}
\printbibliography
\end{document}