Search code examples
r-markdownbibtexbibliography

How do I remove DOI from R-markdown bibliography?


I would like to remove the DOI from the bibliographic references in my markdown script. Is there a way I can do this?

Here is my markdown file:

---
title: "my paper"
author: "name"
date: \today
header-includes:
output:
  pdf_document:
    number_sections: yes
    toc: yes
    keep_tex: yes
    fig_caption: yes
  word_document:
    toc: yes
latex_engine: xelatex
indent: yes
bibliography: library.bib
references: 
link-citations: yes
linkcolor: blue
hyperfootnotes: yes
---

I would like to remove the DOI from this reference @Wallace2005

# Bibliography {-}
::: {#refs}
:::

The output of this file is the following: enter image description here

And here is the .bib file

@article{Wallace2005,
abstract = {Constantly evolving, and with far-reaching implications, European Union policy-making is of central importance to the politics of the European Union. From defining the processes, institutions and modes through which policy-making operates, the text moves on to situate individual policieswithin these modes, detail their content, and analyse how they are implemented, navigating policy in all its complexities. The first part of the text examines processes, institutions, and the theoretical and analytical underpinnings of policy-making, while the second part considers a wide range of policy areas, from economics to the environment, and security to the single market. Throughout the text, theoreticalapproaches sit side by side with the reality of key events in the EU, including enlargement, the ratification of the Lisbon Treaty, and the financial crisis and resulting euro area crisis, exploring what determines how policies are made and implemented. In the final part, the editors consider trendsin EU policy-making and look at the challenges facing the EU. Exploring the link between the modes and mechanisms of EU policy-making and its implementation at national level, Policy-Making in the Europe Union helps students to engage with the key issues related to policy. Written by experts, for students and scholars alike, this is the most authoritative andin-depth guide to policy in the European Union.},
author = {Wallace, Helen and Wallace, William and Pollack, Mark A},
doi = {10.1177/0010414013516917},
file = {:Users/aguasti/Desktop/Mendely Organized Library/Wallace, Wallace, Pollack/Wallace, Wallace, Pollack - 2005 - Policy-Making in the European Union.pdf:pdf},
isbn = {0199689679},
issn = {0010-4140},
pages = {574},
pmid = {130137987},
title = {{Policy-Making in the European Union}},
url = {https://books.google.com/books?id=w6SbBQAAQBAJ&pgis=1},
year = {2005}
}

If anyone knows how I could remove the DOI from the bibliographic reference I would be extremely grateful


Solution

  • I am assuming that you want to have this done on the fly while knitting the PDF.

    The way the references are rendered is controlled by the applied citation styles.

    So, one way would be to change the citation style and in the YAML header to a style that does not include the DOI (note that for the PDF output you would need to add the natbib line).

    bibliography: library.bib
    citation_package: natbib
    csl: somethingelse.csl
    

    Alternatively, if you have to stick to a certain style, you could [modify the CSL-file] (https://www.zotero.org/support/dev/citation_styles/style_editing_step-by-step).

    Example for elsevier-harvard.csl

    You could just comment the relevant line in the CSL-file:

    <if variable="DOI">
       <!--<text variable="DOI" prefix="https://doi.org/"/> -->
    </if>
    

    Save this under a new name (e.g., elsevier-harvard_mod.csl) and then re-run your example (here shortened)

    ---
    title: "my paper"
    author: "name"
    date: \today
    output: pdf_document
    bibliography: library.bib
    citation_package: natbib
    csl: elsevier-harvard_mod.csl
    ---
    
    I would like to remove the DOI from this reference @Wallace2005
    
    # Bibliography {-}
    
    

    enter image description here