6

I use the ieee-alphabteic style for biblatex and since I have a lot of drafts from arXiv, they are treated as the published articles. For some, the field

pages={...},

is present, for some it is not. How can I get biblatex to skip the page field for arXiv preprints only ?

[since I get the .bib from Mendeley, I could select all the papers from arXiv and delete the page field, but let's say I wish for a method on the biblatex side]

A typical arXiv entry in my .bib is

@article{Ashtekar1997,
archivePrefix = {arXiv},
arxivId = {arXiv:gr-qc/9706069v1},
author = {Ashtekar, A and Schilling, T},
eprint = {9706069v1},
pages = {1--41},
primaryClass = {arXiv:gr-qc},
title = {{Geometrical Formulation of Quantum Mechanics}},
year = {1997}
}

2 Answers 2

4

This can be done within biblatex by testing the text of archivePrefix field. Using the same demo as moewe has, the following works:

\documentclass[ngerman, a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=ieee-alphabetic, backend=bibtex]{biblatex}
\addbibresource{\jobname.bib}

\renewbibmacro*{pages}{%
  \iffieldequalstr{archivePrefix}{arXiv}
    {}
    {%
      \iffieldequalstr{eprinttype}{arxiv}
        {}
        {%
          \setunit{\bibpagespunct}%
          \printfield{pages}%
        }%  
    }%
}

\begin{filecontents}{\jobname.bib}
@article{KingZengHistoryGuide,
  author        = {Gary King and Langche Zeng},
  title         = {When Can History Be Our Guide?},
  subtitle      = {The Pitfalls of Counterfactual Inference},
  journaltitle  = {International Studies Quarterly},
  volume        = {51},
  date          = {2007-03},
  pages         = {183-210},
  url           = {http://gking.harvard.edu/files/abs/counterf-abs.shtml},
  urldate       = {2012-06-05},
  gender        = {pm},
}
@article{Ashtekar1997,
  archivePrefix = {arXiv},
  arxivId       = {arXiv:gr-qc/9706069v1},
  author        = {Ashtekar, A and Schilling, T},
  eprint        = {9706069v1},
  pages         = {1--41},
  primaryClass  = {arXiv:gr-qc},
  title         = {{Geometrical Formulation of Quantum Mechanics}},
  year          = {1997}
}
@article{DBLP:journals/corr/abs-1008-2849,
  author        = {Jan Wassenberg and Peter Sanders},
  title         = {Faster Radix Sort via Virtual Memory and Write-Combining},
  eprinttype    = {arxiv},
  eprintclass   = {cs.DS},
  eprint        = {1008.2849},
  date          = {2010-09-06},
  pages         = {1-8},
}
\end{filecontents}

\begin{document}
  \nocite{*}
  \printbibliography
\end{document}

Note that the test here is case-sensitive: a non-sensitive one is doable but more work, so I'm assuming a 'well-formed' set of input data.

0
3

If you use biber, \DeclareSourcemap does exactly what you want. Just add this to your preamble.

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=eprinttype,match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$},final]
      \step[fieldset=pages,null]
    }
    \map{
      \step[fieldsource=archivePrefix,match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$},final]
      \step[fieldset=pages,null]
    }
  }
}

This code looks through the fields archivePrefix and eprinttype fields (the former is actually a link to the latter) and checks if either contains just arxiv (in any case variation), if so, the field pages is reset.

MWE

\documentclass[ngerman, a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=ieee-alphabetic, backend=biber]{biblatex}
\addbibresource{\jobname.bib}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=eprinttype,match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$},final]
      \step[fieldset=pages,null]
    }
    \map{
      \step[fieldsource=archivePrefix,match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$},final]
      \step[fieldset=pages,null]
    }
  }
}

\begin{filecontents}{\jobname.bib}
@article{KingZengHistoryGuide,
  author        = {Gary King and Langche Zeng},
  title         = {When Can History Be Our Guide?},
  subtitle      = {The Pitfalls of Counterfactual Inference},
  journaltitle  = {International Studies Quarterly},
  volume        = {51},
  date          = {2007-03},
  pages         = {183-210},
  url           = {http://gking.harvard.edu/files/abs/counterf-abs.shtml},
  urldate       = {2012-06-05},
  gender        = {pm},
}
@article{Ashtekar1997,
  archivePrefix = {arXiv},
  arxivId       = {arXiv:gr-qc/9706069v1},
  author        = {Ashtekar, A and Schilling, T},
  eprint        = {9706069v1},
  pages         = {1--41},
  primaryClass  = {arXiv:gr-qc},
  title         = {{Geometrical Formulation of Quantum Mechanics}},
  year          = {1997}
}
@article{DBLP:journals/corr/abs-1008-2849,
  author        = {Jan Wassenberg and Peter Sanders},
  title         = {Faster Radix Sort via Virtual Memory and Write-Combining},
  eprinttype    = {arxiv},
  eprintclass   = {cs.DS},
  eprint        = {1008.2849},
  date          = {2010-09-06},
  pages         = {1-8},
}
\end{filecontents}

\begin{document}
  \nocite{*}
  \printbibliography
\end{document}

yields enter image description here


Edit

Your arXiv links seem to be not properly formatted for biblatex, to change this you can add the following to your preamble

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=eprinttype, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
      \step[fieldset=pages, null]
    }
    \map{
      \step[fieldsource=archivePrefix, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
      \step[fieldset=pages, null]
    }
    \map[overwrite]{%<---- this maps your example article to the proper arxiv site
      \step[fieldsource=archivePrefix, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
      \step[fieldsource=arxivId,  fieldtarget=eprint]
      \step[fieldsource=eprint, match=\regexp{[a|A][r|R][x|X][i|I][v|V]:}, replace=\regexp{$1}]
      \step[fieldset=primaryClass, null]
    }
  }
}

The MWE

\documentclass[ngerman, a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=ieee-alphabetic, backend=biber]{biblatex}
\usepackage{hyperref}
\addbibresource{\jobname.bib}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=eprinttype, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
      \step[fieldset=pages, null]
    }
    \map{
      \step[fieldsource=archivePrefix, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
      \step[fieldset=pages, null]
    }
    \map[overwrite]{
      \step[fieldsource=archivePrefix, match=\regexp{^[a|A][r|R][x|X][i|I][v|V]$}, final]
      \step[fieldsource=arxivId,  fieldtarget=eprint]
      \step[fieldsource=eprint, match=\regexp{[a|A][r|R][x|X][i|I][v|V]:}, replace=\regexp{$1}]
      \step[fieldset=primaryClass, null]
    }
  }
}

\begin{filecontents}{\jobname.bib}
@article{KingZengHistoryGuide,
  author        = {Gary King and Langche Zeng},
  title         = {When Can History Be Our Guide?},
  subtitle      = {The Pitfalls of Counterfactual Inference},
  journaltitle  = {International Studies Quarterly},
  volume        = {51},
  date          = {2007-03},
  pages         = {183-210},
  url           = {http://gking.harvard.edu/files/abs/counterf-abs.shtml},
  urldate       = {2012-06-05},
  gender        = {pm},
}
@article{Ashtekar1997,
  archivePrefix = {arXiv},
  arxivId       = {arXiv:gr-qc/9706069v1},
  author        = {Ashtekar, A and Schilling, T},
  eprint        = {9706069v1},
  pages         = {1--41},
  primaryClass  = {arXiv:gr-qc},
  title         = {{Geometrical Formulation of Quantum Mechanics}},
  year          = {1997}
}
@article{DBLP:journals/corr/abs-1008-2849,
  author        = {Jan Wassenberg and Peter Sanders},
  title         = {Faster Radix Sort via Virtual Memory and Write-Combining},
  eprinttype    = {arxiv},
  eprintclass   = {cs.DS},
  eprint        = {1008.2849},
  date          = {2010-09-06},
  pages         = {1-8},
}
\end{filecontents}

\begin{document}
  \nocite{*}
  \printbibliography
\end{document}

yields enter image description here Note the difference in the link.

You must log in to answer this question.

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