I would prefer another solution:
\makeatletter
%Works without the last bracket ;-)
\let\abx@macro@citeOrig\abx@macro@cite
\renewbibmacro{cite}{%
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@citeOrig%
}%
}
\let\abx@macro@textciteOrig\abx@macro@textcite
\renewbibmacro{textcite}{%
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@textciteOrig%
}%
}%
\makeatother
You can use it for every cite-command.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[style=authoryear-comp,backend=biber,hyperref]{biblatex}
\usepackage[colorlinks]{hyperref}
\bibliography{biblatex-examples}
\makeatletter
%Works without the last bracket ;-)
\let\abx@macro@citeOrig\abx@macro@cite
\renewbibmacro{cite}{%
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@citeOrig%
}%
}
\let\abx@macro@textciteOrig\abx@macro@textcite
\renewbibmacro{textcite}{%
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@textciteOrig%
}%
}%
\makeatother
\begin{document}
A reference to \parencite{kastenholz,sigfridsson} and~\cite{sigfridsson}.
\printbibliography
\end{document}
EDIT:
I change the code of the example above.
\makeatletter
\patchcmd{\blx@citeprint}%
{\blx@loopcode}%
{\blx@imc@bibhyperlink{#1}{\blx@loopcode}}%
{}{}
\makeatother
The problem: The last bracket isn't part of the link.
Here is one approach which gives exactly the result you want. Put this in your biber.conf
:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<sourcemap>
<maps datatype="bibtex" map_overwrite="1">
<map maptype="field">
<map_pair map_source="AUTHOR"/>
<also_set map_field="SHORTAUTHOR" map_origfieldval="1"/>
<also_set map_field="SORTNAME" map_origfieldval="1"/>
</map>
<map maptype="field">
<map_pair map_source="SHORTAUTHOR" map_match="Doe,\s*J(?:\.|ohn)(?:[ -]*)(?:P\.|Paul)*" map_replace="Doe, John Paul"/>
<map_pair map_source="SORTNAME" map_match="Doe,\s*J(?:\.|ohn)(?:[ -]*)(?:P\.|Paul)*" map_replace="Doe, John Paul"/>
</map>
</maps>
</sourcemap>
</config>
This follows the new Biber 0.9.8 semantics for the maps - the maps are processed sequentially, each depending on the results of the previous. Within a map, you can also use multiple items but items within a map which change things should not rely on the results of other other changes within the map element. Use map elements to do the sequencing. So, this first copies AUTHOR to both SHORTAUTHOR and SORTNAME and then, after that, edits these two fields to regularise some specific names. Biber DEV PDF doc will be updated soon.
It's a rather hairy regular expression but they are incredibly useful for faking semantic equivalence. This essentially renders the Does into the canonical "Doe, John Paul" format so that Biber knows that they are the same person. It's probably possible to design a regular expression to make this not so name specific but that will depend in the idiosyncracies of the name formats. For example, you could remove all "-' characters in names and also, since you are using firstinits
, force all names to initials only.
EDIT: There will be a simpler syntax in Biber 0.9.8 like this:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<sourcemap>
<maps datatype="bibtex" map_overwrite="1">
<map>
<map_step map_field_source="AUTHOR" map_match="Doe," map_final="1"/>
<map_step map_field_set="SHORTAUTHOR" map_origfieldval="1"/>
<map_step map_field_set="SORTNAME" map_origfieldval="1"/>
<map_step map_field_source="SHORTAUTHOR" map_match="Doe,\s*J(?:\.|ohn)(?:[ -]*)(?:P\.|Paul)*" map_replace="Doe, John Paul"/>
<map_step map_field_source="SORTNAME" map_match="Doe,\s*J(?:\.|ohn)(?:[ -]*)(?:P\.|Paul)*" map_replace="Doe, John Paul"/>
</map>
</maps>
</sourcemap>
</config>
Best Answer
Using
biblatex
instead of the journal'sbst
-based style probably isn't a good idea. That said none of the standard or contributedbiblatex
styles will give you this output. The document below demonstrates how you can obtain a custom style based on standard variants ofnumeric
andauthoryear
.Some notes:
\revsdnamepunct
corresponds to the comma printed between the last and first parts in a reversed name. It was introduced in 2.2. For olderbiblatex
versions refer to this previous answer from lockstep.string
entry type. Refer to thebib
file in thebiblatex
documentation for some examples.