15

This question was previously asked by Yotam who got an answer from Andy Thomas saying he should edit the biber.conf file in order to use biber's regular expressions capacities.

I tried this with my setup: biblatex 1.7.1; biber and working on LyX on Kubuntu 12.04. I didn't have any .biber.conf file on my home dir so I just created one and wrote into it:

<map>
  <bibtex>
  BMAP_OVERWRITE 1
    <globalfield journal>
      BMAP_MATCH Applies\sand\sEnvironmental\sMicrobiology
      BMAP_REPLACE "Appl Environ Microbiol"
    </globalfield>
  </bibtex>
</map>

The result was that I didn't get any reference list at all.
Where's my error here?

1
  • 1
    +1! Thanks for splitting up your question! That actually rarely happens when we ask a new user to do that. You're now really adding helpful (and findable) knowledge to tex.sx!
    – doncherry
    Commented Oct 11, 2012 at 3:27

1 Answer 1

13

If you look at PLK's comment on the question you referred to, you will see that he referred to an intended change of syntax. In fact, Biber has moved on substantially from where it was when that question was answered.

There are two ways to do this now. One (which will work, I think, with versions of Biber after (I think) 0.9.7, including current versions, is to have a biber.conf file with an entry like this:

<?xml version="1.0" encoding="UTF-8"?>
 <config>
  <sourcemap>
   <maps datatype="bibtex">
     <map map_overwrite="1">
      <map_step map_field_source="journal"
       map_match = "Applied\sand\sEnvironmental\sMicrobiology"
       map_replace = "Appl Environ Microbiol"/>
     </map>
     <map map_overwrite="1">
      <map_step map_field_source="journaltitle"
       map_match = "Applied\sand\sEnvironmental\sMicrobiology"
       map_replace = "Appl Environ Microbiol"/>
     </map>
   </maps>
  </sourcemap>
 </config>

(Note: I have corrected your regular expression, which was matching "Applies ..." and made this work for both journal and journaltitle fields.)

The alternative approach, which is possible with Biblatex 2.0+ and Biber 1.0+ (which I highly recommend you upgrade to) allows you to do this in the document code itself, or in a biblatex configuration or style file), using the \DeclareSourcemap facility.

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{art1,
  author = {Someone},
  title  = {Something},
  journal = {Applied and Environmental Microbiology},
  date = {1994},
  pages = {100},
}
@article{art2,
  author = {Someone},
  title  = {Something},
  journaltitle = {Applied and Environmental Microbiology},
  date = {1994},
  pages = {100},
}
\end{filecontents}
\usepackage[backend=biber]{biblatex}
\DeclareSourcemap{
  \maps[datatype=bibtex,overwrite=true]{
   \map{
     \step[fieldsource=journal,
           match=\regexp{Applied\sand\sEnvironmental\sMicrobiology},
           replace={Appl Environ Microbiol}]
     \step[fieldsource=journaltitle,
           match=\regexp{Applied\sand\sEnvironmental\sMicrobiology},
           replace={Appl Environ Microbiol}]
   }
  }
}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

In each case, albeit by different methods (one by writing a configuration file directly, one by writing it indirectly using the \DeclareSourcemap essentially says: look at the journal or journaltitle fields, and if they match the regular expression "Applied[space]and[space]Environmental[space]Microbiology" replace them with "Appl Environ Microbiol".

8
  • I did see PLK's comment just didn't know what to do about it :). Anyway, your method (nr.1) works great. The only trouble is with method 2. biblatex 2.2 isn't on ubuntu's repos yet. I tried installing it myself by copying the files manually according to the README file in biblatex. I also updated biber, of course. But that didn't work. I'm getting an error message: Package biblatex Info: Trying to load biblatex default data model... Package biblatex Info: ... file 'blx-dm.def' found. (/usr/share/texmf/tex/latex/biblatex/blx-dm.def) ! Extra \fi. ...
    – Roey Angel
    Commented Oct 11, 2012 at 13:14
  • ... <argument> ...expandafter ,\CurrentOption }}}}\fi l.4750 \ProcessLocalKeyvalOptions{blx@opt@eldt} I'm ignoring this; it doesn't match any \if. Package biblatex Info: Trying to load biblatex style data model... Package biblatex Info: ... file 'authoryear.dbx' not found. Package biblatex Info: Trying to load biblatex custom data model... Package biblatex Info: ... file 'biblatex-dm.cfg' not found.
    – Roey Angel
    Commented Oct 11, 2012 at 13:17
  • O dear! That sounds like a problem with the installation of the current files. I'm bad enough at solving those on my own computer, let alone from afar. Make absolutely sure the files are in correct places and you have updated your name database. There's no doubt that they work! And it's worth getting them working, because the improvements are considerable. Commented Oct 11, 2012 at 13:37
  • And one other thing: If I'm using a biber.config is there a way to decide from within the latex doc or the .bbx file whether to call the config file or not? That would be useful in my case since some styles require journal names while other journal abbreviations.
    – Roey Angel
    Commented Oct 11, 2012 at 21:30
  • That's exactly what the source map system does, which is its great advantage. Otherwise, I think, your best bet is to keep a biber.conf that is in the particular working directory. Commented Oct 11, 2012 at 22:09

You must log in to answer this question.

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