3

I went trough Guidelines for customizing biblatex styles and could solve some of the problems I encountered while customizing the alphabetic style (an answer for authoryear style is given in Biblatex - How to change format of journal, volume and page numbers in bibliography) to my needs

For a journal article

@article{somearticle,
 title = {some article},
 volume = {5},
 number = {1},
 journaltitle = {some journal},
 author = {Some, {Person} },
 date = {2005-12-01},
 pages = {175--176},
 langid = {english},
}

I'd like to have an output of the form

...,5(1):175-176 (2005),...

I managed to to this by the redefinitions:

\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=alphabetic]{biblatex}


\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{somearticle,
 title = {some article},
 volume = {5},
 number = {1},
 journaltitle = {some journal},
 author = {Some, {Person} },
 date = {2005-12-01},
 pages = {175--176},
 langid = {english},
}
\end{filecontents}
\addbibresource{\jobname.bib}






\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addspace}%
  \iffieldundef{series}
{}
{\newunit
 \printfield{series}%
 \setunit{\addspace}}%
 \usebibmacro{volume+number+eid}%
 \setunit{\addcolon}%
 \setunit*{\addnbthinspace}
 \printfield{pages}
 \setunit*{\addnbspace}
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
%  \setunit*{\adddot}% DELETED
\setunit*{\addnbthinspace}% NEW (optional); there's also \addnbthinspace
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{eid}}
 \DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
 \DeclareFieldFormat[article]{pages}{#1}

 \AtEveryBibitem{\clearfield{month}}
 \AtEveryBibitem{\clearfield{day}}

\begin{document}
\cite{somearticle}
\printbibliography
\end{document}

Instead I get ...,5(1):175-176 (2005), 175-176, i.e. the page numbers are printed twice. How can I get rid of the second printing of the page numbers?

2
  • 2
    Just add \clearfield{pages} after \printfield{pages}.
    – moewe
    Nov 5, 2015 at 16:01
  • Instead of \setunit{\addcolon}\setunit*{\addnbthinspace} you probably want \setunit{\addcolon\addnbthinspace} also note that you are missing some % at the end of lines.
    – moewe
    Nov 5, 2015 at 16:05

1 Answer 1

3

Just add \clearfield{pages} directly after \printfield{pages}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \usebibmacro{volume+number+eid}%
  \setunit{\addcolon\addnbthinspace}
  \printfield{pages}%
  \clearfield{pages}%
  \setunit{\addnbspace}
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}

But since the macro note+pages is only used by @rticles you might as well redefine it

\newbibmacro*{note+pages}{%
  \printfield{note}%
  \newunit}

You must log in to answer this question.

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