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 have to cite articles without page numbers, book sections however are supposed to have them. I'm using the following code to avoid the "pp." before the pages:

\DefineBibliographyStrings{ngerman}{pages={}}

Obviously, this omits page numbers for all citations. Is there a way to have only the articles without page numbers?

share|improve this question
    
Just to be clear: Should this apply for the bibliography, or for in-text-citations, or for both? –  lockstep Jan 4 '12 at 13:25
1  
Which bibliography style are you using? I think the easiest option might be to duplicate it in your texmf folder and change it. For instance, in many styles you could remove (or comment) the line that says \printfield{pages} under \DeclareBibliographyDriver{article}. –  ienissei Jan 4 '12 at 13:27
    
It is for the authoryear-style and only in the bibliography. –  Jan Jan 4 '12 at 13:28
add comment

2 Answers

up vote 10 down vote accepted

You have to change the format of the pages field which deals with page ranges of articles, incollections etc. in the bibliography. (There's also a pagetotal field for the total pages of, e.g., books.) The optional argument of \DeclareFieldFormat takes a comma-separated list of entry types for which the new/changed format should apply.

Changing the format for in-text-citations requires to fiddle with the postnote field; see section 3.11.3 of the biblatex manual for details.

\documentclass{article}

\usepackage[style=authoryear]{biblatex}

\DeclareFieldFormat[article]{pages}{#1}%

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{Bli74,
  author = {Blinder, Alan S.},
  year = {1974},
  title = {The economics of brushing teeth},
  journaltitle = {Journal of Political Economy},
  volume = {82},
  number = {4},
  pages = {887--891},
}
@incollection{Fis00,
  author = {Fischel, William A.},
  year = {2000},
  title = {Zoning and land use regulation},
  maintitle = {Encyclopedia of law and economics},
  volume = {2},
  booktitle = {Civil law and economics},
  editor = {Boudewijn, Bouckaert and de Geest, Gerrit},
  location = {Cheltenham},
  publisher = {Elgar},
  pages = {403--442},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

Some text \autocites[887]{Bli74}[403]{Fis00}.

\printbibliography

\end{document}

enter image description here

EDIT: iennisei's answer makes me think I may have misunderstood your question: In case you don't only want to drop the prefix for article page ranges, but to omit them entirely, use the following code (which makes the above format redefinition superfluous):

\AtEveryBibitem{%
  \ifentrytype{article}{%
    \clearfield{pages}%
  }{%
  }%
}

enter image description here

share|improve this answer
    
Thank you, that does it. I assume that the code in question is: \DeclareFieldFormat[article]{pages}{#1}% What exactly does this mean? Only for learning benefits ;-) –  Jan Jan 4 '12 at 13:47
1  
@Jan I added a short explantion to my answer. –  lockstep Jan 4 '12 at 13:54
add comment

The technique you used replaces the language string for "pages" throughout the entire bibliography, and also presupposes that you do not write any page references in the entries for your articles (but what if you need them for another paper, with another citation style?). @lockstep's answer is more targeted, but (unless I am mistaken) also supposes that you omit the page numbers in your .bib file.

In order to prevent printing the page number altogether, how about this:

\renewbibmacro*{note+pages}{%
    \printfield{note}%
    %\setunit{\bibpagespunct}%
    %\printfield{pages}%
    \newunit}

The note+pages macro is used by the standard.bbx file for displaying the page numbers of articles. It is the file called by authoryear for formatting the bibliography.

share|improve this answer
1  
With @locksteps solution, you don’t have to omit the pages in the .bib file. –  domwass Jan 4 '12 at 14:03
    
Good catch, with regard to omitting prefixes vs. omitting the entire data! I've updated my answer to include my preferred method (\clearfield), but +1 for your one. –  lockstep Jan 4 '12 at 14:10
    
@domwass Actually, re-reading the OP's question makes me think it was quite ambiguous, and iennissei's answer was helpful. –  lockstep Jan 4 '12 at 14:11
    
@lockstep Yes, the ambiguity of the question was behind my reasoning, but I very much like your solutions. –  ienissei Jan 4 '12 at 14:19
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.