我正在用biblatex
它作为参考,发现了chem-angew
我非常欣赏的风格。
我找到了如何在期刊标题下添加超文本链接的方法,而且效果很好。但有一个小问题:我不知道如何删除超文本链接造成的多余空格(如果我删除超链接,多余空格就会消失)。请注意,如果链接后面跟着逗号,则没有问题……但在样式中chem-angew
,期刊标题和年份之间没有逗号。我希望超文本链接位于期刊标题下方。
有人知道该怎么办吗?我必须完全定义自己的biblatex
风格吗?
这是我的代码:
\documentclass{book}
\usepackage[backend=biber,
style=chem-angew,
firstinits=true,
maxbibnames=99]{biblatex}
\renewbibmacro{in:}{}
\addbibresource{library2.bib}
\usepackage{hyperref}
\hypersetup{urlcolor=black, colorlinks=true}
%*************Hyperlink on title****************
\newbibmacro{string+doiurlisbn}[1]{%
\iffieldundef{doi}{%
\iffieldundef{url}{%
\iffieldundef{isbn}{%
\iffieldundef{issn}{%
#1%
}{%
\href{http://books.google.com/books?vid=ISSN\thefield{issn}}{#1}%
}%
}{%
\href{http://books.google.com/books?vid=ISBN\thefield{isbn}}{#1}%
}%
}{%
\href{\thefield{url}}{#1}%
}%
}{%
\href{http://dx.doi.org/\thefield{doi}}{#1}%
}%
}
\DeclareFieldFormat[article]{journaltitle}%
{\usebibmacro{string+doiurlisbn}%
{\mkbibemph{#1}}%
}
\DeclareFieldFormat[manual]{title}%
{\usebibmacro{string+doiurlisbn}
{\mkbibemph{#1}}
}
\begin{document}
I really wonder why there is an extra space in the bibliography \cite{Bocquet2010}!
I wish I could erase it \cite{Nicholls2012}.
However, it depends on what type of document you cite \cite{Palacci2010}.
\label{Bibliography}
\printbibliography
\end{document}
以下是.bib
:
@article{Bocquet2010,
author = {Bocquet, Lyd\'{e}ric and Charlaix, Elisabeth},
doi = {10.1039/B909366B},
journal = {Chemical Society Reviews},
number = {3},
pages = {1073--1095},
title = {{Nanofluidics, from bulk to interfaces.}},
url = {http://www.ncbi.nlm.nih.gov/pubmed/20179826},
volume = {39},
year = {2010}
}
@article{Nicholls2012,
author = {Nicholls, William D. and Borg, Matthew K. and Lockerby, Duncan A. and Reese, Jason M.},
doi = {10.1007/s10404-011-0869-3},
journal = {Microfluidics and Nanofluidics},
number = {1-4},
pages = {257--264},
title = {{Water transport through (7,7) carbon nanotubes of different lengths using molecular dynamics}},
url = {http://dx.doi.org/10.1007/s10404-011-0869-3},
volume = {12},
year = {2012}
}
@manual{Palacci2010,
author = {Palacci, J\'{e}r\'{e}mie},
organization = {Universit\'{e} Claude-Bernard},
title = {{Manipulation of colloids by osmotic forces}},
url = {https://tel.archives-ouvertes.fr/tel-00597477/fr/},
type = {phdthesis},
urldate = {09-22-2015},
location = {Lyon, France},
year = {2010}
}
非常感谢那些可能需要一些时间来回答的人。
答案1
Joseph Wright 刚刚修复问题适当地。
这是因为removecomma
中使用了特殊字段格式\renewbibmacro*{journal}
,并定义为\DeclareFieldFormat{removecomma}{\mkbibnocomma{#1}}
。
具体来说,空格是由\scantokens
命令在
\newcommand*\mkbibnocomma[1]{%
\begingroup
\catcode`\, = 9\relax
\scantokens{#1}%
\endgroup
}
另请参阅@egreg 的回答有人可以进一步阐明扩展、catcodes 和 scantokens……吗?
通常,该空间会被标点符号命令发出的 s 占用\unspace
,但一旦空间进入 hyperref 命令,它似乎就太晚了。
暂时重新定义为
\renewcommand*\mkbibnocomma[1]{%
\begingroup
\catcode`\, = 9\relax
\scantokens{#1\empty}%
\endgroup
}
我们得到了正确的输出。
平均能量损失
\documentclass{article}
\usepackage{filecontents}
\usepackage[backend=biber,
style=chem-angew,
firstinits=true,
maxbibnames=99]{biblatex}
\renewbibmacro{in:}{}
\begin{filecontents*}{\jobname.bib}
@article{Bocquet2010,
author = {Bocquet, Lyd\'{e}ric and Charlaix, Elisabeth},
doi = {10.1039/B909366B},
journal = {Chemical Society Reviews},
number = {3},
pages = {1073--1095},
title = {{Nanofluidics, from bulk to interfaces.}},
url = {http://www.ncbi.nlm.nih.gov/pubmed/20179826},
volume = {39},
year = {2010}
}
@article{Nicholls2012,
author = {Nicholls, William D. and Borg, Matthew K. and Lockerby, Duncan A. and Reese, Jason M.},
doi = {10.1007/s10404-011-0869-3},
journal = {Microfluidics and Nanofluidics},
number = {1-4},
pages = {257--264},
title = {{Water transport through (7,7) carbon nanotubes of different lengths using molecular dynamics}},
url = {http://dx.doi.org/10.1007/s10404-011-0869-3},
volume = {12},
year = {2012}
}
@manual{Palacci2010,
author = {Palacci, J\'{e}r\'{e}mie},
organization = {Universit\'{e} Claude-Bernard},
title = {{Manipulation of colloids by osmotic forces}},
url = {https://tel.archives-ouvertes.fr/tel-00597477/fr/},
type = {phdthesis},
urldate = {2015-09-22},
location = {Lyon, France},
year = {2010}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\usepackage{hyperref}
%*************Hyperlink on title****************
\newbibmacro{string+doiurlisbn}[1]{%
\iffieldundef{doi}{%
\iffieldundef{url}{%
\iffieldundef{isbn}{%
\iffieldundef{issn}{%
#1%
}{%
\href{http://books.google.com/books?vid=ISSN\thefield{issn}}{#1}%
}%
}{%
\href{http://books.google.com/books?vid=ISBN\thefield{isbn}}{#1}%
}%
}{%
\href{\thefield{url}}{#1}%
}%
}{%
\href{http://dx.doi.org/\thefield{doi}}{#1}%
}%
}
\DeclareFieldFormat[article]{journaltitle}%
{\usebibmacro{string+doiurlisbn}%
{\mkbibemph{#1}}}
\DeclareFieldFormat[manual]{title}%
{\usebibmacro{string+doiurlisbn}
{\mkbibemph{#1}}}
\renewcommand*\mkbibnocomma[1]{%
\begingroup
\catcode`\, = 9\relax
\scantokens{#1\empty}%
\endgroup
}
\begin{document}
I really wonder why there is an extra space in the bibliography \cite{Bocquet2010}!
I wish I could erase it \cite{Nicholls2012}.
However, it depends on what type of document you cite \cite{Palacci2010}.
\label{Bibliography}
\printbibliography
\end{document}