TransWikia.com

How to switch from biblatex+biber to natbib+bibtex?

TeX - LaTeX Asked on July 26, 2021

Context

I use the biblatex package coupled with biber (see terminology disambiguation) for my personal writings.

I want to submit a paper using a template requiring the natbib package — hence the use of bibtex. However, I use biber features in my .bib file (such as crossref) that are not handled by natbib, making the switch not straightforward.

Question

Given the.bib file where all my references are stored, which are all the steps/modifications needed to switch from {biblatex+biber} to {natbib+bibtex}?

2 Answers

Disclaimer: This answer is a work-in-progress, since final solution have not been found yet.

Roadmap overview

  1. Clean-up the biber-specific features of your .bib file using biber-tool

  2. ...


1/ Clean-up the biber-specific features of your .bib file using biber-tool

The .bib file might use biber-specific features (such as the @inbook entry, crossref or urldate fields, etc.). A new .bib file that is BibTeX-compatible must thus be generated. Following answer based on this and this treads.

  • Create a file named myBiberConfig.conf containing following code. It defines how your original .bib file should be transformed in order to be BibTeX-compatible.
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <output_fieldcase>lower</output_fieldcase>
    <output_resolve>1</output_resolve>
    <output_safechars>1</output_safechars>
    <sourcemap>
        <maps datatype="bibtex" map_overwrite="1">
            <map map_overwrite="1">
                <map_step map_field_source="date" map_match="[0-9]{4}?-([0-9]{2}?)" map_final="1"/>
                <map_step map_field_set="month" map_field_value="$1"/>
            </map>
            <map map_overwrite="1">
                <map_step map_field_source="date" map_match="([0-9]{4}?)" map_final="1"/>
                <map_step map_field_set="year" map_field_value="$1"/>
            </map>
        </maps>
        <maps datatype="bibtex">
            <map>
                <map_step map_type_source="conference" map_type_target="inproceedings"/>
                <map_step map_type_source="electronic" map_type_target="online"/>
                <map_step map_type_source="www" map_type_target="online"/>
            </map>
            <map>
                <map_step map_type_source="mastersthesis" map_type_target="thesis" map_final="1"/>
                <map_step map_field_set="type" map_field_value="mathesis"/>
            </map>
            <map>
                <map_step map_type_source="phdthesis" map_type_target="thesis" map_final="1"/>
                <map_step map_field_set="type" map_field_value="phdthesis"/>
            </map>
            <map>
                <map_step map_type_source="techreport" map_type_target="report" map_final="1"/>
                <map_step map_field_set="type" map_field_value="techreport"/>
            </map>
            <map>
                <map_step map_field_source="address" map_field_target="location"/>
                <map_step map_field_source="school" map_field_target="institution"/>
                <map_step map_field_source="annote" map_field_target="annotation"/>
                <map_step map_field_source="archiveprefix" map_field_target="eprinttype"/>
                <map_step map_field_source="journal" map_field_target="journaltitle"/>
                <map_step map_field_source="primaryclass" map_field_target="eprintclass"/>
                <map_step map_field_source="key" map_field_target="sortkey"/>
                <map_step map_field_source="pdf" map_field_target="file"/>
            </map>
        </maps>
    </sourcemap>
</config>
  • Process your original .bib file with the --tool option of biber

    biber --tool --configfile=myBiberConfig.conf <yourbibfile>.bib
    
  • Your processed .bib file is the freshly created <yourbibfile>_bibertool.bib

Answered by ebosi on July 26, 2021

To add to the existing answers. For bibtex-2.16 a minimal configuration:

<?xml version="1.0" encoding="utf-8"?>
<!-- Got the date from https://gist.githubusercontent.com/mkouhia/f00fea7fc8d4effd9dfd/raw/500e9dbc6aa43a47e39c45ba230738ff4544709f/biblatex-to-bibtex.conf -->
<config>
  <output_fieldcase>lower</output_fieldcase>
  <output_resolve>1</output_resolve>
  <output_safechars>1</output_safechars>
  <output_format>bibtex</output_format>
  <sourcemap>
    <maps datatype="bibtex">
      <!-- Easy type conversions -->
      <map>
        <map_step map_type_source="report" map_type_target="techreport"/>
        <map_step map_type_source="online" map_type_target="misc"/>
      </map>
      <!-- Date to year, month -->
      <map>
        <map_step map_field_source="date"
        map_field_target="year" />
      </map>
      <map>
        <map_step map_field_source="year"
        map_match="(d{4}|d{2})-(d{1,2})-(d{1,2})"
        map_final="1" />
        <map_step map_field_source="year"
        map_match="(d{4}|d{2})-(d{1,2})-(d{1,2})"
        map_replace="$1" />
        <map_step map_field_set="month" map_origfieldval="1" />
        <map_step map_field_source="month"
        map_match="(d{4}|d{2})-(d{1,2})-(d{1,2})"
        map_replace="$2" />
      </map>
      <map>
        <map_step map_field_source="year"
        map_match="(d{4}|d{2})-(d{1,2})" map_final="1" />
        <map_step map_field_source="year"
        map_match="(d{4}|d{2})-(d{1,2})" map_replace="$1" />
        <map_step map_field_set="month" map_origfieldval="1" />
        <map_step map_field_source="month"
        map_match="(d{4}|d{2})-(d{1,2})" map_replace="$2" />
      </map>
    </maps>
  </sourcemap>
</config>

Coupled with a few command line options:

biber --tool --configfile=biberConf.xml references.bib --output-file refsTmp.bib --output-legacy-date --output-field-replace=location:address,journaltitle:journal

Is sufficient. More details are here. Note that sufficiency in this case is defined as being recognized as valid bibtex by sphinx, and this should not be used without more work for other cases (like journal templates).

Answered by HaoZeke on July 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP