我尝试使用authordate2
bibtex 的样式,它与我论文所需的样式非常接近,但这个包真的很旧。尝试使用默认样式,代码运行良好,但使用样式时,authordate2
它说这\cite{myref}
是一个Undefined control sequence
。
所以我发现biblatex
引用样式中已经有括号了。我只想将“and”改为“&”,将“et al”改为斜体,并用超链接包裹名称和年份。
书目风格有点棘手,但我相信在biblatex
宏和其他方面更有经验的人会知道。
我想要获得如下的引用和参考书目样式:
引用
(姓氏 & 姓氏 2,年份)
(姓等人, 年份; 姓氏2等人, 年份; 姓氏 & 姓氏2, 年份)
参考书目
[姓氏 & 姓氏 2,年份] FM 姓氏 & FM 姓氏 2。(2003 年)。论文标题。期刊名称。 98(462):470–487。
[姓等人,年份] FM Lastname、FM Lastname2 和 FM Lastname3。(2003 年)。论文标题。期刊名称。 98(462):470–487。
这是我迄今为止所做的一个最简单的例子。
\documentclass{article}
\usepackage{hyperref}
\usepackage[brazil]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,backref=true,hyperref=true]{biblatex}
\begin{filecontents}{\jobname.bib}
@ARTICLE{citationA,
Author = {Fulano Tal de Rio de Janeiro and Fulano Tal de Sao Paulo },
Year = {2001},
Title = {Paper Title},
Journal = {Jornal A}
}
@ARTICLE{citationB,
Author = {Fulano Tal de Rio de Janeiro and Fulano Tal de Sao Paulo and Fulano Tal de Recife },
Year = {2002},
Title = {Paper Title},
Journal = {Jornal B}
}
@ARTICLE{citationB2,
Author = {Fulano Tal de Rio de Janeiro and Fulano Tal de Sao Paulo and Fulano Tal de Recife },
Year = {2002},
Title = {Paper Title},
Journal = {Jornal C}
}
@ARTICLE{citationC,
Author = {Fulano Tal de Recife},
Year = {2003},
Title = {Paper Title},
Journal = {Jornal D}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\cite{citationA}
\cite{citationB}
\cite{citationB2}
\cite{citationC}
\parencite{citationA,citationC}
\parencite{citationB2}
\nocite{*}
\printbibliography
\end{document}
部分解决方案
\documentclass{article}
\usepackage{hyperref}
\usepackage[brazil]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,maxnames=2,maxbibnames=3,backref=true,hyperref=true,dashed=false,firstinits=true]{biblatex}
\renewcommand*{\finalnamedelim}{\addspace\&\space}
\renewcommand*{\nameyeardelim}{\addcomma\space}
\renewbibmacro{in:}{}
\renewbibmacro*{name:andothers}{%
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
and
test \ifmorenames
}
{\ifnumgreater{\value{liststop}}{1}
{\finalandcomma}
{}%
\andothersdelim\bibstring[\emph]{andothers}}
{}}
\renewbibmacro*{cite}{%
\printtext[bibhyperref]{%
\DeclareFieldAlias{bibhyperref}{default}%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\addspace}}
{\printnames{labelname}%
\setunit{\nameyeardelim}}%
\usebibmacro{cite:labelyear+extrayear}}
{\usebibmacro{cite:shorthand}}}}
\DeclareCiteCommand{\textcite}%
{\boolfalse{cbx:parens}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{%
\DeclareFieldAlias{bibhyperref}{default}%
\usebibmacro{textcite}%
\iffieldundef{postnote}%
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}}
{}}}
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
\multicitedelim}
{\iffieldundef{postnote}
{}
{\usebibmacro{textcite:postnote}}}
\DeclareFieldFormat[article]{title}{\textbf{#1}}
\renewcommand{\baselinestretch}{1.25}
\DeclareNameAlias{sortname}{first-last}
\addbibresource{jobname.bib}
\begin{document}
\cite{citationA}
\cite{citationB}
\cite{citationB2}
\cite{citationC}
\parencite{citationA,citationC}
\parencite{citationB2}
\nocite{*}
\printbibliography
\end{document}
更新的输出。
只缺少像这张图那样的前面的链接。
答案1
我认为我已经完成了。这不是一个完美的解决方案,但它清除了很多自定义biblatex
。\defbibenvironment{bibliography}
是从字母/数字样式中获取的,并与一些代码混合在一起这里。我将长度设置\labelwidth
为 130pt,这样它就符合我的需求了。在字母/数字样式中,这些宽度会自动调整。也许有人可以找到与此相关的更好的解决方案。
\documentclass{article}
\usepackage{hyperref}
\usepackage[brazil]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,maxnames=2,maxbibnames=3,maxcitenames=2,backref=true,hyperref=true,dashed=false,firstinits=true]{biblatex}
% putting & as the separator of the author name's
\renewcommand*{\finalnamedelim}{\addspace\&\space}
% the comma after the authors
\renewcommand*{\nameyeardelim}{\addcomma\space}
% no 'in'
\renewbibmacro{in:}{}
% et al in italic
\renewbibmacro*{name:andothers}{%
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
and
test \ifmorenames
}
{\ifnumgreater{\value{liststop}}{1}
{\finalandcomma}
{}%
\andothersdelim\bibstring[\emph]{andothers}}
{}}
% citation including both name and year
\renewbibmacro*{cite}{%
\printtext[bibhyperref]{%
\DeclareFieldAlias{bibhyperref}{default}%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\addspace}}
{\printnames{labelname}%
\setunit{\nameyeardelim}}%
\usebibmacro{cite:labelyear+extrayear}}
{\usebibmacro{cite:shorthand}}}}
% text citation including both name and year
\DeclareCiteCommand{\textcite}%
{\boolfalse{cbx:parens}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{%
\DeclareFieldAlias{bibhyperref}{default}%
\usebibmacro{textcite}%
\iffieldundef{postnote}%
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}}
{}}}
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
\multicitedelim}
{\iffieldundef{postnote}
{}
{\usebibmacro{textcite:postnote}}}
\newcounter{mymaxcitenames}
\AtBeginDocument{%
\setcounter{mymaxcitenames}{\value{maxnames}}%
}
% the bold title in article's entries
\DeclareFieldFormat[article]{title}{\textbf{#1}}
% order first name then last name
\DeclareNameAlias{sortname}{first-last}
% the front labels before the bibliography references
\defbibenvironment{bibliography}
{\list
{
\printtext[brackets]{%
\begingroup
\defcounter{maxnames}{\value{mymaxcitenames}}%
\printnames{labelname}%
\setunit{\nameyeardelim}%
\printfield{labelyear}%
\printfield{extrayear}%
\endgroup
}%
}
{\setlength{\labelwidth}{130pt}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hfill##1\hss}
}
{\endlist}
{\item}
\addbibresource{jobname.bib}
\begin{document}
\cite{citationA}
\cite{citationB}
\cite{citationB2}
\cite{citationC}
\parencite{citationA,citationC}
\parencite{citationB2}
\nocite{*}
\printbibliography
\end{document}
最终输出。
只是想强调一下,大部分代码都是从 Audrey 第一条评论中的链接获得的。