3

I would like to merge all title and subtitle fields in a bib file into the field title with a custom separator. Is there a way to do this? (I know that biber has a tool mode that can be used for manipulating a source file. It is, for example, possible to resolve inheritances. But it would seem to me that merging two fields into one is not possible.)

Background: I sometimes use my bib file with pandoc. Pandoc merges the fields title and subtitle, but it uses a colon as a separator, which is rather unusual in German.

1 Answer 1

4

Place

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <output_align>true</output_align>
  <output_fieldcase>lower</output_fieldcase>
  <sourcemap>
    <maps datatype="bibtex" level="user">
      <map map_overwrite="1">
        <map_step map_field_source="subtitle" map_final="1"/>
        <map_step map_field_set="title" map_field_value=". " map_append="1"/>
        <map_step map_field_set="title" map_origfieldval="1" map_append="1"/>
        <map_step map_field_set="subtitle" map_null="1"/>
      </map>
    </maps>
  </sourcemap>
</config>

in a file called mergesubtitle.conf into the same directory as your .bib file.

Then call Biber with

biber --tool --configfile=mergesubtitle.conf <yourbibfile.bib>

If

@book{elk,
  author = {Anne Elk},
  title = {On the Theory of Brontosauruses},
  subtitle = {Really Interesting Dinosaurs},
  date = {1970},
  publisher = {Monthy Press},
  location = {London},
}

is saved as brontos.bib, the call biber --tool --configfile=mergesubtitle.conf brontos.bib will result in a file called brontos_bibertool.bib with the contents

@book{elk,
  author    = {Elk, Anne},
  location  = {London},
  publisher = {Monthy Press},
  date      = {1970},
  title     = {On the Theory of Brontosauruses. Really Interesting Dinosaurs},
}

being placed in the same directory.

You must log in to answer this question.

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