2

How can I truncate http://adsabs.harvard.edu/abs/ from every adsurl field that looks like

adsurl = {http://adsabs.harvard.edu/abs/2015EPJST.224.2217S}.

Could it be accomplished by changing the rendering

\DeclareFieldFormat{adsurl}{#1}

I would like the field to appear as link at the end of a reference as

Author (year), Title, ..., ADS: 2015EPJST.224.2217S

This question appeared in How to add adsurl field as link to bibliography.

2

It seems like I found a first solution based on the comment by Joseph Wright by cutting the text first and adding it later as follows

\usepackage{filecontents}
\begin{filecontents}{biblatex-dm.cfg}
\DeclareDatamodelFields[type=field,datatype=verbatim]{adsurl}
\DeclareDatamodelEntryfields{adsurl}
\end{filecontents}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=adsurl, match={http://adsabs.harvard.edu/abs/},
        replace={}]
    }
  }
}

\DeclareFieldFormat{adsurl}{ADSURL: \href{http://adsabs.harvard.edu/abs/#1}{#1}}

\renewbibmacro{finentry}{\printfield{adsurl}\finentry}

And it produces something like:

Kundu, M. R. (1965). Solar radio astronomy. New York: Interscience Publication,
1965. ADSURL: 1965sra..book.....K.

While 1965sra..book.....K is a link. See How to add adsurl field as link to bibliography.

I am wondering if this is the simplest way of doing it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.