3

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
  • 1
    Does tex.stackexchange.com/questions/281294/… help? The idea is the same, you just need to pick the appropriate field and search/replace (and use Biber).
    – Joseph Wright
    Jan 12, 2016 at 10:31
  • Thank you. I edited my question to make it more clear what I want. I don't know how to do this from your reference. Jan 12, 2016 at 10:49

1 Answer 1

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .