我的大学希望使用哈佛和数字风格的混合引用风格。在我的例子中,我只得到了 [数字(作者+年份)],而不是 [ 数字 ](作者+年份)。所以我对括号有些问题。
\documentclass[a4paper,fontsize=12pt,parskip]{scrbook}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Layout
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%
\usepackage[labelfont={bf}]{caption}
\usepackage{subcaption}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage[]{geometry}
\renewcommand{\baselinestretch}{1.2}
\setlength\parindent{0pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Seitenränder und Abstände
\geometry{
textwidth=150mm,
textheight=220mm,
top=40mm,
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Literaturverzeichnis
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[german=guillemets]{csquotes}
%
\usepackage[backend=biber,style=numeric,maxnames=5,minnames=5,maxcitenames=2,mincitenames=1,datamodel=eprint-hal]{biblatex}
\renewbibmacro*{cite}{%
\printtext[bibhyperref]{%
\printtext[hardbrackets]{%
\printfield{prefixnumber}%
\printfield{labelnumber}%
\ifbool{bbx:subentry}
{\printfield{entrysetcount}}
{}}
\printtext[parens]{%
\printnames{labelname}%
\setunit{\nameyeardelim}%
\setunit{\addcomma\space}
\printfield{year}%
}}}
%
\addbibresource{biblatex-examples.bib}
\begin{document}
ba bla
\cite{springer}
%Literaturverzeichnis
\printbibliography[heading=bibintoc,title=Literaturverzeichnis]
\end{document}
答案1
在您使用的代码中(可能来自是否有一个包允许使用 [作者,年份] [数字] 的引用样式?) 括号是\cite
通过其包装器命令隐式添加的。这不是我们想要的,因为我们有不同类型的括号。
在我看来,最简单的方法是定义一个新\cite
命令,这样我们就可以完全控制括号。该方法的其余部分类似于是否有一个包允许使用 [作者,年份] [数字] 的引用样式?。
\documentclass[12pt]{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage[german=guillemets]{csquotes}
\usepackage[
backend=biber,
style=numeric,
maxbibnames=5, minbibnames=5,
maxcitenames=2, mincitenames=1,
]{biblatex}
\newbibmacro*{naycite}{%
\printtext[bibhyperref]{%
\printtext[brackets]{%
\printfield{labelprefix}%
\printfield{labelnumber}%
\ifbool{bbx:subentry}
{\printfield{entrysetcount}}
{}}
\setunit{\addspace}%
\printtext[parens]{%
\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}%
\printdate}}}
\DeclareCiteCommand{\naycite}
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{naycite}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareMultiCiteCommand{\naycites}{\naycite}{\multicitedelim}
\DeclareAutoCiteCommand{nay}{\naycite}{\naycites}
\ExecuteBibliographyOptions{autocite=nay}
\addbibresource{biblatex-examples.bib}
\begin{document}
lorem \autocite{sigfridsson}
lorem \autocite{springer}
\printbibliography[heading=bibintoc,title=Literaturverzeichnis]
\end{document}
如果你想要整个表达式周围有更大的括号,你可以尝试类似
\newrobustcmd*{\mkbibbiggerbrackets}[1]{%
{\large[}#1{\large]}}
\DeclareCiteCommand{\naycite}[\mkbibbiggerbrackets]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{naycite}}
{\multicitedelim}
{\usebibmacro{postnote}}
我并不会以任何形式推荐它。