我正在尝试通过以下方式设置参考书目:
\documentclass[12pt,french]{report}
\usepackage[backend=bibtex,
style=alphabetic
]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Cha65,
author = {Charles, Daniel},
year = {1965},
title = {Entr’acte: “Formal” or “Informal” Music?},
journaltitle = {The Musical Quarterly},
volume = {51},
number = {1},
pages = {144--165},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\addcontentsline{toc}{chapter}{Bibliography}
\end{document}
请问哪种 biblatex 样式允许我以这种方式显示引用[AuthorName, Last_two_integers_of_year_number]
?
多谢!
答案1
此解决方案修改了标签的默认模板。这需要biber
而不是bibtex
作为后端。这意味着编译顺序也需要改变:
pdflatex <filename>.tex
biber <filename>
pdflatex <filename>.tex
可能还会有额外的
pdflatex <filename>.tex
它将与latex
而不是一起工作pdflatex
- 这才biber
是必需的。
\documentclass[12pt,french]{report}
\usepackage{babel}% needed for french
\usepackage[utf8]{inputenc}% needed for sample bib entry
\usepackage{csquotes}% recommended in output (biblatex)
\MakeAutoQuote*{“}{”}
\usepackage[T1]{fontenc}
\usepackage[backend=biber, style=alphabetic]{biblatex}
\DeclareLabelalphaTemplate{% adjust the template for the label based on the default one - requires biber
\labelelement{%
\field[final]{shorthand}% if shorthand specified, use it
\field{label}% if label specified, use it
\field[strside=left]{labelname}% if not, use the labelname e.g. author
}
\labelelement{%
\literal{,}% add comma
}
\labelelement{%
\field[strwidth=2,strside=right]{year}% take the rightmost 2 numbers from the year
}
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Cha65,
author = {Charles, Daniel},
year = {1965},
title = {Entr’acte: “Formal” or “Informal” Music?},
journaltitle = {The Musical Quarterly},
volume = {51},
number = {1},
pages = {144--165},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\addcontentsline{toc}{chapter}{Bibliography}
\end{document}
请注意,在发布之前,您应该检查 MWE 编译。您的编译中出现了错误,因此我必须对其进行修改,才能开始思考您的问题。最小化是好的,而且绝对是必要的 - 只需确保它不会太过最小化而无法正常工作!
名字太多
如果您的条目中有太多作者(或者,如果作者的名字太长),上述代码将造成严重破坏。以下代码将仅使用名字,但+
如果条目中有其他名字,它将附加一个。(这似乎是默认的。)
\documentclass[12pt,french]{report}
\usepackage{babel}% needed for french
\usepackage[utf8]{inputenc}% needed for sample bib entry
\usepackage{csquotes}% recommended in output (biblatex)
\MakeAutoQuote*{“}{”}
\usepackage[T1]{fontenc}
\usepackage[backend=biber, style=alphabetic]{biblatex}
\DeclareLabelalphaTemplate{% adjust the template for the label based on the default one - requires biber
\labelelement{%
\field[final]{shorthand}% if shorthand specified, use it
\field{label}% if label specified, use it
\field[names=1,strside=left]{labelname}% if not, use the labelname e.g. author
}
\labelelement{%
\literal{,}% add comma
}
\labelelement{%
\field[strwidth=2,strside=right]{year}% take the rightmost 2 numbers from the year
}
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Cha65,
author = {Charles, Daniel},
year = {1965},
title = {Entr’acte: “Formal” or “Informal” Music?},
journaltitle = {The Musical Quarterly},
volume = {51},
number = {1},
pages = {144--165},
}
@article{Cha66,
author = {Charles, Daniel and Christmas, Father and Fairy, Tooth and Pan, Peter and Beanstalk, Jack},
year = {1966},
title = {Entr’acte: “Formal” or “Informal” Music?},
journaltitle = {The Musical Quarterly},
volume = {51},
number = {1},
pages = {144--165},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\addcontentsline{toc}{chapter}{Bibliography}
\end{document}
如果某位作者的名字很长,您有几个选择。一种是将所有名字截断为一定数量的字母。(标准标签使用此方法,使用 2 个字母,但您可以指定不同的数字。)以下使用第一个作者名字的前 8 个字符:
\documentclass[12pt,french]{report}
\usepackage{babel}% needed for french
\usepackage[utf8]{inputenc}% needed for sample bib entry
\usepackage{csquotes}% recommended in output (biblatex)
\MakeAutoQuote*{“}{”}
\usepackage[T1]{fontenc}
\usepackage[backend=biber, style=alphabetic]{biblatex}
\DeclareLabelalphaTemplate{% adjust the template for the label based on the default one - requires biber
\labelelement{%
\field[final]{shorthand}% if shorthand specified, use it
\field{label}% if label specified, use it
\field[strwidth=8,names=1,strside=left]{labelname}% if not, use the labelname e.g. author - use the first 8 characters of the first author's name
}
\labelelement{%
\literal{,}% add comma
}
\labelelement{%
\field[strwidth=2,strside=right]{year}% take the rightmost 2 numbers from the year
}
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Cha65,
author = {Charles, Daniel},
year = {1965},
title = {Entr’acte: “Formal” or “Informal” Music?},
journaltitle = {The Musical Quarterly},
volume = {51},
number = {1},
pages = {144--165},
}
@article{Cha66,
author = {Charles, Daniel and Christmas, Father and Fairy, Tooth and Pan, Peter and Beanstalk, Jack},
year = {1966},
title = {Entr’acte: “Formal” or “Informal” Music?},
journaltitle = {The Musical Quarterly},
volume = {51},
number = {1},
pages = {144--165},
}
@article{Cha67,
author = {CharlesChristmasFairtyPanBeanstalk, Daniel and Christmas, Father and Fairy, Tooth and Pan, Peter and Beanstalk, Jack},
year = {1967},
title = {Entr’acte: “Formal” or “Informal” Music?},
journaltitle = {The Musical Quarterly},
volume = {51},
number = {1},
pages = {144--165},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\addcontentsline{toc}{chapter}{Bibliography}
\end{document}
另一个选项是覆盖特定条目的默认标签:
\documentclass[12pt,french]{report}
\usepackage{babel}% needed for french
\usepackage[utf8]{inputenc}% needed for sample bib entry
\usepackage{csquotes}% recommended in output (biblatex)
\MakeAutoQuote*{“}{”}
\usepackage[T1]{fontenc}
\usepackage[backend=biber, style=alphabetic]{biblatex}
\DeclareLabelalphaTemplate{% adjust the template for the label based on the default one - requires biber
\labelelement{%
\field[final]{shorthand}% if shorthand specified, use it
\field{label}% if label specified, use it
\field[names=1,strside=left]{labelname}% if not, use the labelname e.g. author - use the first 8 characters of the first author's name
}
\labelelement{%
\literal{,}% add comma
}
\labelelement{%
\field[strwidth=2,strside=right]{year}% take the rightmost 2 numbers from the year
}
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Cha65,
author = {Charles, Daniel},
year = {1965},
title = {Entr’acte: “Formal” or “Informal” Music?},
journaltitle = {The Musical Quarterly},
volume = {51},
number = {1},
pages = {144--165},
}
@article{Cha66,
author = {Charles, Daniel and Christmas, Father and Fairy, Tooth and Pan, Peter and Beanstalk, Jack},
year = {1966},
title = {Entr’acte: “Formal” or “Informal” Music?},
journaltitle = {The Musical Quarterly},
volume = {51},
number = {1},
pages = {144--165},
}
@article{Cha67,
label = {CharlesCh},
author = {CharlesChristmasFairtyPanBeanstalk, Daniel and Christmas, Father and Fairy, Tooth and Pan, Peter and Beanstalk, Jack},
year = {1967},
title = {Entr’acte: “Formal” or “Informal” Music?},
journaltitle = {The Musical Quarterly},
volume = {51},
number = {1},
pages = {144--165},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\addcontentsline{toc}{chapter}{Bibliography}
\end{document}