2

I have a file in bibtex format with records like:

@BOOK{11980,
   author = "French, A. P.",
   title = "Vibrations and Waves",
   publisher = " ",
   year = 1971,
   numpages = 327,
   language = "english",
   edition = " ",
}

I wan to use it with biblatex biber also, but biblatex understand pagetotal entry instead of numpages. How can I redefine numpages->pagetotal without changing .bib-file

My MuWE:

\documentclass[11pt, a4paper]{article}

\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{csquotes}

\usepackage{selinput}

    \SelectInputEncodingList{utf8,cp1251}
    \inputencoding{utf8}
    \usepackage[russian]{babel}

    \usepackage[mis]{xecyr}
    \setmainfont{Times New Roman}
    \newfontfamily\cyrillicfont{Times New Roman}
    \DeclareRobustCommand{\No}{\ifmmode{\nfss@text{\textnumero}}\else\textnumero\fi}



\usepackage[%
            backend=biber,
            bibstyle=gost-numeric,
            language=auto,
            babel=other,
            sorting=none,
            doi=false,
            eprint=true,
            isbn=false,
            dashed=false,
                ]{biblatex}
\addbibresource{e:/projects/LaTeX/MyPackage/MyBaseXe.bib}

\DeclareDefaultSourcemap[datatype=bibtex]{%
\map{
\step[fieldsource=numpages, fieldtarget=pagetotal]
    }
}

\begin{document}
Some text \cite{LL1,LL2,SivP5, Siv1}.
\printbibliography
\end{document}

I get an error Undefined control sequence. \DeclareDefaultSourcemap

sergiokapone
  • 5,578
  • 1
  • 16
  • 39
  • If you mean a specific page in the book, the relevant field is pages (§ 2.2.2 of the documentation, p. 21). – Bernard Jan 04 '15 at 15:57
  • You can use a sourcemap declaration to copy the field. – Ulrike Fischer Jan 04 '15 at 16:51
  • @Ulrike Fischer I find \DeclareDefaultSourcemap[datatype=bibtex]{ \map{\step[typesource=numpages, typetarget=pagetotal]} } but where can I put this code? – sergiokapone Jan 04 '15 at 18:06
  • Somewhere in the minimal example that you didn't provide. (and imho it should be \step[fieldsource=numpages, fieldtarget=pagetotal] – Ulrike Fischer Jan 04 '15 at 18:12
  • @ Ulrike Fischer I get an error Undefined control sequence. \DeclareDefaultSourcemap. MEW is added above. – sergiokapone Jan 04 '15 at 18:39
  • That command was renamed to \DeclareDriverSourcemap. And I think the structure is normally \DeclareDriverSourcemap{\maps[datatype=bibtex]{\map{\step[fieldsource=numpages, typetarget=pagetotal]}}}. (Untested.) – jon Jan 04 '15 at 19:23
  • In version 1.9 of biblatex, there is no DeclareDefaultSourcemap. I'd go with \DeclareSourcemap{\maps[datatype=bibtex]{\map{\step[fieldsource=numpages]\step[fieldset=pagetotal, origfieldval]}}}. See §4.5.2 Dynamic Modification of Data of the biblatex documentation, especially the second example on pp. 151/152. – moewe Jan 04 '15 at 21:12
  • @jon Is there any reason for preferring of \DeclareDriverSourcemap? (I have never used that command in any of my documents; but it seems the default data mapping uses it, so there seems to be a difference.) I think typetarget in your code above should read fieldtarget. – moewe Jan 04 '15 at 21:19
  • See also http://tex.stackexchange.com/a/68043/35864, http://tex.stackexchange.com/q/65374/35864, and http://tex.stackexchange.com/a/163787/35864. – moewe Jan 04 '15 at 21:23
  • @moewe -- No, I don't think there is a good reason. I suggested it only because it is the new name for the command the OP was using (can't remember which version it was changed in -- 2.something..?). I've never actually used it either, only the \DeclareSourcemap one. And you're surely right about the second correction. That's (for me) the problem of suggesting things without testing them first! – jon Jan 05 '15 at 02:04
  • @jon Mhhh, \DeclareDriverSourcemap seems to have a slightly different syntax compared to \DeclareSourcemap, because it always applies only to one data format driver; but other than that the documentation only states it is conceptually different from mappings done via user sourcemapping. I was curious about that because I had never seen this command being used, but maybe it's just that. – moewe Jan 05 '15 at 07:46
  • @moewe -- Hmm, I see what you mean now that I looked it up. Anyway, the issue is moot it seems. Will delete my comments later today.... – jon Jan 05 '15 at 14:30

1 Answers1

3

Based on your comments, I solved the problem.

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=numpages,fieldtarget=pagetotal]
    }
  }
}
sergiokapone
  • 5,578
  • 1
  • 16
  • 39