![biblatex 中的参考文献](https://linux22.com/image/424897/biblatex%20%E4%B8%AD%E7%9A%84%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE.png)
我在格式化参考文献时遇到了麻烦。我必须使用 11 号字体和单行间距来准备整个文本。我还想通过在打印下一个 bibitem 时删除换行来节省参考文献中的空间。我还想将参考编号加粗。我已经实现了这两个目标,但参考文献中的字体相对于文本的其余部分而言不知何故被压缩了。
如果可能的话,我还想改变参考文献的格式:
- 顺序:作者、年份、标题、期刊、期刊信息
删除多余的空间[ 1]
,使其看起来像[1]
- 将每个条目转换为指向给定文章的 URL 链接
我找不到说明如何手动格式化参考文献的文档。我不必坚持使用 biblatex,因此如果我的要求可以使用 natbib 或 cite 包实现,那么对我来说没问题。对于编译,我使用默认设置的 overleaf。
编辑:@daleif 的评论解决了大多数问题,我已将其删除。代码和图像已更新。
这是我现在的版本:
\documentclass[11pt]{article}
\usepackage{lipsum}
\usepackage[doi=false,isbn=false,url=false,eprint=false]{biblatex}
\addbibresource{bibinfo.bib}
\defbibenvironment{bibliography}
{\noindent}
{\unspace}
{\textbf{\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{labelnumber}}}%
\addspace}
\renewbibmacro*{finentry}{\finentry\addspace}
\begin{document}
\lipsum[1-1]
See also \cite{duquennoy91} and \cite{dwek95}. Also \cite{duquennoy91,dwek95,feroz08}.
\printbibliography[heading=none]
\end{document}
@ARTICLE{duquennoy91,
author = {{Duquennoy}, A. and {Mayor}, M.},
title = "{Multiplicity among solar-type stars in the solar neighbourhood. II - Distribution of the orbital elements in an unbiased sample}",
journal = {\it A\&A},
keywords = {Binary Stars, Dwarf Stars, G Stars, Solar Neighborhood, Stellar Orbits, Brown Dwarf Stars, Orbital Elements, Peculiar Stars, Radial Velocity, Stellar Evolution, Variable Stars},
year = 1991,
month = aug,
volume = 248,
pages = {485-524},
adsurl = {http://adsabs.harvard.edu/abs/1991A%26A...248..485D},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
@ARTICLE{dwek95,
author = {{Dwek}, E. and {Arendt}, R.~G. and {Hauser}, M.~G. and {Kelsall}, T. and
{Lisse}, C.~M. and {Moseley}, S.~H. and {Silverberg}, R.~F. and
{Sodroski}, T.~J. and {Weiland}, J.~L.},
title = "{Morphology, near-infrared luminosity, and mass of the Galactic bulge from COBE DIRBE observations}",
journal = {\it ApJ},
keywords = {COSMIC BACKGROUND EXPLORER SATELLITE, GALACTIC BULGE, GALACTIC MASS, IMAGE PROCESSING, LUMINOSITY, MORPHOLOGY, NEAR INFRARED RADIATION, ASTRONOMICAL MODELS, GALACTIC STRUCTURE, MAPPING, STAR DISTRIBUTION, STELLAR EVOLUTION},
year = 1995,
month = jun,
volume = 445,
pages = {716-730},
doi = {10.1086/175734},
adsurl = {http://adsabs.harvard.edu/abs/1995ApJ...445..716D},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
@ARTICLE{feroz08,
author = {{Feroz}, F. and {Hobson}, M.~P.},
title = "{Multimodal nested sampling: an efficient and robust alternative to Markov Chain Monte Carlo methods for astronomical data analyses}",
journal = {\it MNRAS},
archivePrefix = "arXiv",
eprint = {0704.3704},
keywords = {methods: data analysis, methods: statistical},
year = 2008,
month = feb,
volume = 384,
pages = {449-463},
doi = {10.1111/j.1365-2966.2007.12353.x},
adsurl = {http://adsabs.harvard.edu/abs/2008MNRAS.384..449F},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
答案1
首先要注意的是,解释所有必要宏的文档都在 中biblatex.pdf
。使用 打开 ist texdoc biblatex
。话虽如此,以下是我的建议:
通用格式
您似乎正在编写一篇物理学领域的文档,因此我将以样式phys
作为起点。这会改变外观的几个方面,在我看来都是改进。如果您不喜欢这种样式,则可以轻松调整此答案的其余大部分内容以使用biblatex
默认值。
为了获得括号中的数字和所需的排序,请使用选项biblabel=brackets, sorting=nyt
。前者是biblatex-phys
选项,后者是常规biblatex
选项。
格式在文件中是没有位置的bib
(\it
在 LaTeX 中也是没有位置的)。不过,你可以在序言中轻松更改它。要获得斜体期刊标题,请使用
\DeclareFieldFormat{journaltitle}{\itshape #1}
如果你不喜欢默认使用粗体字号来标记文章数量,可以使用
\DeclareFieldFormat[article]{volume}{#1}
要获得如何定义这些事物的灵感,请查看phys.bbx
。
制作条目链接
首先,为了获取超链接,您需要加载hyperref
。如果这样做,biblatex-phys
只要您提供doi
或 ,就已经将期刊和发行信息变成了链接url
。您的第一个bib
条目没有这两个,因此我将非标准adsurl
字段中的 URL 复制到了 字段中url
。
您可以添加以下代码来创建文章标题链接。
\renewbibmacro*{title}{%
\ifboolexpr{
test {\iffieldundef{title}}
and
test {\iffieldundef{subtitle}}
}
{}
{%
\printtext[doi/url-link]{%
\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}%
}%
}%
\newunit
}%
\printfield{titleaddon}%
}
人们可以轻松地将其扩展到整个条目,但我更喜欢作者姓名而不是链接。
补充笔记
如果存在,biblatex
则自动加载文件biblatex.cfg
,这样您就可以将任何更改参考书目的配置代码放在那里,这就是我下面所做的。这会使您的序言稍微整洁一些,也使在多个文档中使用相同的配置变得更容易。
请注意,字段journal
、year
和month
是 BibTeX 字段,因此最好将journaltitle
和date
与 一起使用biblatex
。与所有其他字段一样,您可以在biblatex
文档中找到更多信息。
\begin{filecontents}[nosearch, overwrite]{bibinfo.bib}
@article{duquennoy91,
author = {{Duquennoy}, A. and {Mayor}, M.},
title = "{Multiplicity among solar-type stars in the solar neighbourhood. II - Distribution of the orbital elements in an unbiased sample}",
journal = {A\&A},
keywords = {Binary Stars, Dwarf Stars, G Stars, Solar Neighborhood, Stellar Orbits, Brown Dwarf Stars, Orbital Elements, Peculiar Stars, Radial Velocity, Stellar Evolution, Variable Stars},
year = 1991,
month = aug,
volume = 248,
pages = {485-524},
url = {http://adsabs.harvard.edu/abs/1991A%26A...248..485D},
adsurl = {http://adsabs.harvard.edu/abs/1991A%26A...248..485D},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
@article{dwek95,
author = {{Dwek}, E. and {Arendt}, R.~G. and {Hauser}, M.~G. and {Kelsall}, T. and
{Lisse}, C.~M. and {Moseley}, S.~H. and {Silverberg}, R.~F. and
{Sodroski}, T.~J. and {Weiland}, J.~L.},
title = "{Morphology, near-infrared luminosity, and mass of the Galactic bulge from COBE DIRBE observations}",
journal = {ApJ},
keywords = {COSMIC BACKGROUND EXPLORER SATELLITE, GALACTIC BULGE, GALACTIC MASS, IMAGE PROCESSING, LUMINOSITY, MORPHOLOGY, NEAR INFRARED RADIATION, ASTRONOMICAL MODELS, GALACTIC STRUCTURE, MAPPING, STAR DISTRIBUTION, STELLAR EVOLUTION},
year = 1995,
month = jun,
volume = 445,
pages = {716-730},
doi = {10.1086/175734},
adsurl = {http://adsabs.harvard.edu/abs/1995ApJ...445..716D},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
@article{feroz08,
author = {{Feroz}, F. and {Hobson}, M.~P.},
title = "{Multimodal nested sampling: an efficient and robust alternative to Markov Chain Monte Carlo methods for astronomical data analyses}",
journal = {MNRAS},
archivePrefix = "arXiv",
eprint = {0704.3704},
keywords = {methods: data analysis, methods: statistical},
year = 2008,
month = feb,
volume = 384,
pages = {449-463},
doi = {10.1111/j.1365-2966.2007.12353.x},
adsurl = {http://adsabs.harvard.edu/abs/2008MNRAS.384..449F},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
\end{filecontents}
\begin{filecontents}[nosearch, overwrite]{biblatex.cfg}
\ExecuteBibliographyOptions{
biblabel=brackets,
sorting=nyt,
}
\DeclareFieldFormat{journaltitle}{\itshape #1}
\defbibenvironment{bibliography}
{\noindent}
{\unspace}
{\textbf{\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{labelnumber}}}%
\addspace}
\renewbibmacro*{finentry}{\finentry\addspace}
\renewbibmacro*{title}{%
\ifboolexpr{
test {\iffieldundef{title}}
and
test {\iffieldundef{subtitle}}
}
{}
{%
\printtext[doi/url-link]{%
\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}%
}%
}%
\newunit
}%
\printfield{titleaddon}%
}
\end{filecontents}
\documentclass[11pt]{article}
\usepackage{lipsum}
\usepackage[style=phys]{biblatex}
\usepackage{hyperref}
\addbibresource{bibinfo.bib}
\begin{document}
\lipsum[1-1]
See also \cite{duquennoy91} and \cite{dwek95}. Also \cite{duquennoy91,dwek95,feroz08}.
\printbibliography[heading=none]
\end{document}