5

I am using biblatex together with a bibliography manager Referencer. I want to use the url field of the bib file to link to the page. However, Referencer has urls of the form

url = {{ http://... }}

rather than the usual format with only a single brace. Url fields are interpreted literally in biblatex and so I get links to { http:// ... } in the pdf and they consequently do not work. Since every time I change the bibliography file through Referencer the curly braces reappear, going through the bib file and removing the extra braces is not a solution for me. Is there a way to tell LaTeX to automatically remove the braces before passing the result to \href?

4
  • 2
    Why is Referencer doing this: it's wrong.
    – Joseph Wright
    Commented Aug 19, 2012 at 10:40
  • I think it's because URL is a custom field in Referencer and it adds double braces to all of the custom fields if you want it to add double braces to other fields (such as title), where they are desirable. You can set this via the option "Protect capitalization". But if I switch this off I won't get double braces anywhere.
    – SMeznaric
    Commented Aug 19, 2012 at 11:12
  • Taking a look at how Referencer works, it seems that when you select 'Protect capitalization' it adds braces around the entire content of almost every field. I would say that this is not a good idea: braces should be used only where needed. I would suggest using a BibTeX-focussed manager, such as JabRef.
    – Joseph Wright
    Commented Aug 19, 2012 at 11:32
  • Yes, I agree it is a bad idea. Is there no way to do string processing in LaTeX and remove the braces that way?
    – SMeznaric
    Commented Aug 19, 2012 at 13:49

1 Answer 1

12

Make sure you are using biblatex 2.0+ and biber 1.0+ and put this in your preamble:

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite]{
      \step[fieldsource=url,
            match=\regexp{\A\{(.+)\}\z},
            replace=$1]
    }
  }
}

Of course the regexp can be tuned to your liking. See section 4.5.2 of the current biblatex manual.

0

You must log in to answer this question.

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