7

There is no plural form for the term ‘number’, referring to an issue of a journal. I tried to define one (nos) but it's not sufficient to print it (e.g. article in a double issue). What should I do? My style is verbose-trad2.

MWE:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}

\usepackage[style=verbose-trad2,language=french,backend=biber]{biblatex}

\addbibresource{numero.bib}

\DeclareFieldFormat[article]{number}{\bibstring{number}\addnbspace #1}

\NewBibliographyString{numbers}

\DefineBibliographyStrings{french}{%
  numbers = {{num\'eros}{n\textsuperscript{os}}}
}

\begin{document}
citation\footcite{doe_life_2011}
\end{document}

numero.bib:

@article{doe_life_2011,
  title = {My Life},
  number = {137-138},
  journal = {{IJAS}},
  author = {Dan, {John}},
  pages = {139--153},
   date = {2011}
}

enter image description here

6

Only printing the number bibstring doesn't take the new numbers string in account. You must check if the field is either a single number or a numeral range and then print it accordingly. In a very simplified way, you can use:

\DeclareFieldFormat[article]{number}{%
  \iffieldnum{number}{\bibstring{number}\addnbspace}%
    {\iffieldnums{number}{\bibstring{numbers}\addnbspace}%
    {}}%
  #1}

It checks if the number field is a single number and uses the number bibstring if so, using the newly created numbers otherwise. Non-numerical fields will be printed without a any of the bibstrings. If you want to add the number bibstring to such fields you can to add it to the plural form check:

\DeclareFieldFormat[article]{number}{%
  \iffieldnum{number}{\bibstring{number}\addnbspace}%
    {\iffieldnums{number}{\bibstring{numbers}\addnbspace}%
    {\bibstring{number}\addnbspace}}%
  #1}

So that whenever there's a number field the number bibstring is used, using the numbers bibstring in plural forms.

MWE:

\begin{filecontents}{\jobname.bib}
  @article{single-number,
    title = {An article in a single number of the journal},
    author = {John Doe},
    journal = {The Journal Title},
    number = {99},
    date = {2015},
  }
  @article{no-number,
    title = {An article without a journal number},
    author = {John Doe},
    journal = {Another Journal},
    volume = {10},
    date = {2015},
  }
  @article{multiple-numbers,
    title = {Article in multiple numbers of a journal},
    author = {John Doe},
    journal = {Yet another journal},
    number = {137-138},
    date = {2015},
  }
  @article{roman-number,
    title = {An article in a roman number of the journal},
    author = {John Doe},
    journal = {The Journal Title},
    number = {xii},
    date = {2015},
  }
  @article{non-numerical-number,
    title = {An article in a non-numerical journal number},
    author = {John Doe},
    journal = {Journal Title},
    number = {Three},
    date = {2015},
  }

\end{filecontents}

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}

\usepackage[style=verbose-trad2,language=french,backend=biber]{biblatex}

\addbibresource{\jobname.bib}

\NewBibliographyString{numbers}

\DefineBibliographyStrings{french}{%
  numbers = {n\textsuperscript{os}}
}

\DeclareFieldFormat[article]{number}{%
  \iffieldnum{number}{\bibstring{number}\addnbspace}%
    {\iffieldnums{number}{\bibstring{numbers}\addnbspace}%
    {}}%
  #1}

\begin{document}
\autocites{no-number,single-number,multiple-numbers,roman-number,non-numerical-number}
\printbibliography
\end{document}

enter image description here

  • 1
    biblatex has the checks \ifnumeral/\iffieldnum as well as \ifnumerals/``\iffieldnums` which should allow more fine-grained control over the usage of number vs numbers vs. nothing at all. (Check \blx@mkpageprefix in biblatex2.sty for an example) – moewe Aug 12 '15 at 5:35
  • @moewe thanks, i added another check as you suggested. do you think this could be further improved? – henrique Aug 12 '15 at 22:46
  • Than you. As a matter of fact, I would have put the \addnbsp directly after the \bibstrings so as to not print one if no \bibstring was issued. I'm not sure whether there is any situation that would cause trouble though with your version. So you could say \DeclareFieldFormat[article]{number}{% \iffieldnum{number}{\bibstring{number}\addnbspace} {\iffieldnums{number}{\bibstring{numbers}\addnbspace} {}}% #1} (modulo line breaks/%s, of course!). – moewe Aug 13 '15 at 5:32
  • @moewe (-_Q) Of course! Thank you so much! I fixed the code accordingly. @Carg please check the edited answer. – henrique Aug 13 '15 at 22:06
  • Hiya, it's me again! Now you have the problem that you suppress the number field if it is not recognised as a number. So if someone were to have number = {Three} in their .bib file, that would be ignored. But biblatex will still think it had printed the field, when it hadn't. I would suggest: \DeclareFieldFormat[article]{number}{% \iffieldnum{number}{\bibstring{number}\addnbspace} {\iffieldnums{number}{\bibstring{numbers}\addnbspace} {}}% #1%} (again, modulo line breaks) – moewe Aug 14 '15 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.