[Tex/LaTex] Show journal abbreviation in reference list with biblatex/biber

biberbiblatex

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?

Best Answer

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".

Related Question