2

I have an entry in my bibliography that has a number looking like number = {D-810}.

Biblatex replaces dashes in the number field by \bibrangedash; for normal number ranges like number = {2-3} it is completely correct, but D-810 is not a range, but a special kind of number, and should be displayed with a short dash.

I've found tips how to redefine the style of all occurrences of \bibrangedash, e.g. Custom dash in Biblatex, but what I need is to prevent a dash from being replaced by \bibrangedash just in a single entry.

How could I achieve this?

MWE for the style I need:

\begin{filecontents}{test.bib}

@TECHREPORT{c1,
  author      = {Author, A.},
  title       = {Some title},
  institution = {Inst. 1},
  year        = {2000},
  type        = {Preprint},
  number      = {D-810},
  address     = {Some city},
  pagetotal   = {10},
  langid      = {english},
}
@TECHREPORT{c2,
  author      = {Author, B.},
  title       = {Another title},
  institution = {Inst. 2},
  year        = {2000},
  type        = {Preprint},
  number      = {2-3},
  address     = {Some city},
  pagetotal   = {10},
  langid      = {english},
}

\end{filecontents}

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage[style=gost-numeric]{biblatex} % from package biblatex-gost
\addbibresource{test.bib}

\begin{document}

Citations:~\cite{c1,c2}.

\printbibliography

\end{document}
  • I did a few tests with the standard styles and biblatex 3.11/Biber 2.11 and I can't reproduce the behaviour you describe there. A - in the number field is not modified. Please consider adding a full MWE/MWEB to your question. That MWE needs to tell show us one .bib entry and the biblatex style you use as well as other settings related to the bibliography. – moewe May 1 '18 at 4:14
  • Also: Welcome to TeX.SX! – moewe May 1 '18 at 4:14
  • 1
    If you use D\symbol{45}810 then you get a hyphen: I understand it's suboptimal, so this can't be an answer. From the bbl file, I gather that Biber knows it's not a range, because it writes \range{number}{-1}, but it replaces - with \bibrangedash nonetheless. – egreg May 1 '18 at 17:35
  • Thanks very much, @egreg, a \symbol{45} solution seems completely fine to me for those rare cases when the number field is not a range; actually I have only two such entries in my 200+ bibliography. – Dmitry Tsirkov May 2 '18 at 10:10
2

biblatex-gost defines the number field to be a 'range field'. The standard styles on the other hand define the field as 'integer' and will treat it as a 'literal' field from version 3.12 onwards. This issue does not occur with the standard styles, it only comes to light in biblatex-gost.

The deciding feature of a range field is that all sort of dashes get normalised to \bibrangedash automatically. Unfortunately, there is no simple way to break out of this normalisation (there is one exception in ranges like x-000--y-999 only the -- is replaced by \bibrangedash, the single -s are left alone, but that can't help you here) if you want to keep using -.

A simple, but sadly neither elegant nor particularly portable work-around is

\newcommand*{\norangehyphen}{-}

and then

@TECHREPORT{c1,
  author      = {Author, A.},
  title       = {Some title},
  institution = {Inst. 1},
  year        = {2000},
  type        = {Preprint},
  number      = {D\norangehyphen810},
  address     = {Some city},
}

Alternatively, you can use \symbol{45} as egreg suggests in the comments.

Before reading the code of biblatex-gost I would have suggested to ask its author to stop treating number as a range field, but after are more thorough look it has become clear that quite a bit of code actually relies on number being a range field, so that is not an option.

In other biblatex contexts it would be enough to 'protect' the - from being converted to \bibrangedash by shielding with with curly braces

  number      = {D{-}810},

this does not work for Biber-detected ranges, however. But if you think this is an important feature, you may consider adding this as a feature request at the Biber bugtracker https://github.com/plk/biber/issues

|improve this answer|||||
  • Thank you very much, @moewe! Actually, both solutions, \newcommand*{\norangehyphen}{-} and \symbol{45}, work well. Maybe they are not quite elegant, but not-a-range numbers containing - are actually very rare and definitely non-standard, so I am personally completely fine with these workarounds. Maybe I'd think about contacting the developers of biblatex-gost and asking them to add some standard way to handle such cases. – Dmitry Tsirkov May 2 '18 at 10:19
  • @DmitryTsirkov Fortunately, numbers like D-810 are rare, but similar things seem to be on the rise. And people in general often expect this to work. You can try to ask the biblatex-gost developer (no plural, I believe), but as I explained it may be too late at that stage, so he may well direct you to Biber. But it is probably a good idea to make him aware of the problem: github.com/odomanov/biblatex-gost/issues – moewe May 2 '18 at 10:26

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.