[Tex/LaTex] How to add an electonic identifier (eid) field to inproceedings type in biblatex

biblatexbibliographies

By default, in biblatex, inproceedings entries do not support the eid field (electronic identifier). In article entries, the eid is printed instead of the page number, see the following MWE:

\documentclass{scrbook}

\usepackage[ngerman]{babel} 
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}

\usepackage[%
  citestyle = alphabetic, 
  bibstyle = ieee-alphabetic,
  labelalpha = true,
  defernumbers = true,
  backend = biber,
  maxalphanames = 1,
  firstinits = true,
  abbreviate = true,
  bibencoding = utf8,
  dateabbrev = true,
  maxbibnames = 10,
  minbibnames = 3
  %eprint = true
]{biblatex}%

\bibliography{./Literatur.bib}

\DeclareFieldFormat{eid}{Art. \addnbspace #1}

\begin{filecontents}{./Literatur.bib}

@article{ibrahim_spectral_2010,
  title =    {Spectral imaging method for material classification
                  and inspection of printed circuit boards},
  author =   {Ibrahim, Abdelhameed and Tominaga, Shoji and
                  Horiuchi, Takahiko},
  journal =  {Optical Engineering},
  volume =   49,
  number =   5,
  eid =      05720,
  year =     2010
}

@inproceedings{gruna_optical_2012,
  author =   {Gruna, Robin and Beyerer, Juergen},
  title =    {Proc. Optical feature extraction with illumination-encoded
                  linear functions},
  series =   {Proceedings of SPIE},
  year =     2012,
  booktitle =    {Image Processing: Machine Vision Applications V},
  volume =   8300,
   eid =     830004
}

\end{filecontents}

\begin{document}

\nocite{*}
\printbibliography

\end{document}

enter image description here

How can I modifiy the proceedings entry type to print the eid field like in articles (instead of page numbers at the same position)?

Best Answer

We can redefine the macro that prints the page numbers and chapter to also output the eid via

\renewbibmacro*{chapter+pages}{%
  \printfield{chapter}%
  \setunit{\bibpagespunct}%
  \printfield{eid}
  \setunit{\bibpagespunct}%
  \printfield{pages}%
  \newunit}

This also allows for eid and pages to be present at the same time. (Note that we essentially treat eid and pages the same in the sense that both are preceded by \bibpagespunct and not the standard \newunitpunct.)

MWE

\documentclass{article}
\usepackage[ngerman]{babel} 
\usepackage[T1]{fontenc}
\usepackage{filecontents}
\usepackage[utf8]{inputenc}
\usepackage[%
  citestyle = alphabetic, 
  bibstyle = ieee-alphabetic,
  labelalpha = true,
  defernumbers = true,
  backend = biber,
  maxalphanames = 1,
  firstinits = true,
  abbreviate = true,
  bibencoding = utf8,
  dateabbrev = true,
  maxbibnames = 10,
  minbibnames = 3
  %eprint = true
]{biblatex}%
\DeclareFieldFormat{eid}{Art. \addnbspace #1}

\begin{filecontents*}{\jobname.bib}
@article{ibrahim_spectral_2010,
  title =    {Spectral imaging method for material classification
                  and inspection of printed circuit boards},
  author =   {Ibrahim, Abdelhameed and Tominaga, Shoji and
                  Horiuchi, Takahiko},
  journal =  {Optical Engineering},
  volume =   49,
  number =   5,
  eid =      05720,
  year =     2010
}

@inproceedings{gruna_optical_2012,
  author =   {Gruna, Robin and Beyerer, Juergen},
  title =    {Proc. Optical feature extraction with illumination-encoded
                  linear functions},
  series =   {Proceedings of SPIE},
  year =     2012,
  booktitle =    {Image Processing: Machine Vision Applications V},
  volume =   8300,
   eid =     830004,
}
\end{filecontents*}

\renewbibmacro*{chapter+pages}{%
  \printfield{chapter}%
  \setunit{\bibpagespunct}%
  \printfield{eid}
  \setunit{\bibpagespunct}%
  \printfield{pages}%
  \newunit}


\addbibresource{\jobname.bib}

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