Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am having trouble with the print of my bibliography.

I have a bib file which looks like this

    @Article{Sample:01,
  Title                    = {Some Title},
  Author                   = {Doe, John},
  Year                     = {111},
  Pages                    = {pp. 1-2},
  Journal                  = {Really Cool Journal},
  }

    @Article{Sample:02,
  Title                    = {Different Title},
  Author                   = {Doe, Jane},
  Year                     = {222},
  Pages                    = {3-4},
  Journal                  = {Other Cool Journal},
  }

I use this with biblatex and biber.

However my bibliography is printed correctly for the 2nd type but not for the first (i.e. pages 3-4), whereas in the second case it only says pages.

I get this non-unified style of the page list, since I collect the citations from different internet sources, that sometimes have the first sometimes the second type.

Is there anyway I could tell biber to ignore any pp. in the list Pages and always print out pages a-b?

My workaround so far is to change the lists by hand and remove the pp. However, I feel there must be some way to do that automatically.

So far I was unable to find one. Has anybody an idea about this?

For the record: I am using MikTex 2,9 and compile using pdflatex invoked via the latexmk package.

Here is a minimal working example that creates the error with the above bib file stored as mybib in the same folder.

\documentclass{scrartcl}

\usepackage[
    backend=biber, natbib
]{biblatex}

\bibliography{mybib}

\begin{document}
    \citet{Sample:01}, \citet{Sample:02}

    \printbibliography
\end{document}
share|improve this question
1  
TeX.SX starter guide and congrats for this beautiful (almost) minimal working example (MWE). I reduced it a bit further to eliminate unneeded package and documentclass options. –  Benedikt Bauer Mar 26 at 14:59
    
Yeah, thanks, I should have tried whether it had worked that way. Sorry, for the unecessary mess... –  johaschn Mar 26 at 15:00
    
No problem, your code was pretty fine and far from being a "mess". We have seen much bigger and messier code given as "MWE" by much more experienced users here. –  Benedikt Bauer Mar 26 at 15:02
    
Looks a bug in biber. You can put text there that isn't pagenumbers, like "Chapter 3" or "First appendix". My guess is code that looks for "pp." especially to handle those entries as normal digit-starting entries, but then there is some error. A workaround is therefore to use backend=bibtex if you don't need biberfeatures. (But of course we all need biberfeatures! :-) –  pst Mar 26 at 15:32
1  
I've reported as bug at github.com/plk/biber/issues/25 . –  pst Mar 26 at 16:37
show 5 more comments

2 Answers 2

up vote 5 down vote accepted

You can ask biber to do such replacements for you. My facility with regular expressions is patchy at best, but I think this works:

\DeclareSourcemap{
  \maps[datatype=bibtex,overwrite=true]{
    \map{
      \step[fieldsource=pages,
            match=\regexp{pp\.(.+)},
            replace=\regexp{$1}]
    }
  }
}
share|improve this answer
    
Alright. That really does the job. However, now I have some problem with my text editor (Sublime Text2&LaTexTools) that thinks I am in inline math mode all the time and the syntax highlighting is screwed. I am not so firm in regular expressions to have an equivalent phrase at hand. Is there some, you think? –  johaschn Mar 26 at 15:50
3  
I'd generalise (for spacing after the "pp", and to deal with just "p" for single pages) a little match=\regexp{pp?\.?\ ?(.+)} –  Chris H Mar 26 at 15:50
1  
Add a comment " % $" after the line with $. Maybe put ending "]" on the next line too, to make it easier for the editor. –  pst Mar 26 at 15:51
1  
About the text highlighting: I found another (dirty) workaround for that. I store the DeclareSourcemap in another file and load it with \input, that way syntax highlighting is not affected. For me this does the job since I have some packages I always load anyway stored in a separate folder (on my svn) that is included in all projects. If this wasn't the case, this workaround might of course not work. % $did not work unfortunately –  johaschn Mar 26 at 16:05
2  
In addition I found at least a solution to p. and pp.with the match p{1,2}\.(.+) –  johaschn Mar 26 at 16:42
show 15 more comments

Just replace all the '{pp. ' with '{ ' using Replace option of any text editor!

share|improve this answer
2  
As the OP already wrote "My workaround so far is to change the lists by hand and remove the pp.", so he's aware of that, but he's asking for a solution directly in biber or biblatex so that there's no need to take care if there's a "pp." in the pages field or not. –  Benedikt Bauer Mar 26 at 15:13
    
I doubt that there is something automatic that is been implemented in bibtex for this specific task. However, one can write a small 'sed' code to take care of this problem. –  Sina Mar 26 at 16:05
    
@sina, This is not about bibtex but about biber, and it does indeed do something automatic, otherwise it would just have copied the value (as it does if you write for example "Chapter Two" as value). –  pst Mar 26 at 16:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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