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'm battling with this for couple of hours now...

My supervisor asked me to generate the bibliography in a certain style, for articles I need to do:

Author 1; Author 2, Journal name, volume, page, (year)

Where the volume, page and year are number (page is only the starting page of the article)

For chapters I need:

Author 1; Autoher 2, In Book name, page editors: Editor 1; Editor2; (publisher, city, year).

Again, year is a number and page is the staring page

Finally, books follow the same logic

Editor 1; Editor 2, Book name, (publisher, city, year).

I tried to do this through makebst but it insist on using page range. I tried to search for a bst files online but all I found was list without examples. Where can I find a list with examples or a generator for bst files?

I also considered switching to biblatex but couldn't find any clear notion wither or not biblatex provides control over citation style.

share|improve this question

3 Answers 3

Here's a solution using biblatex. Note that \mkfirstpage uses \mkpageprefix as a post-processor instead of these commands simply being nested; see section 4.6.4 of the biblatex manual for details.

\documentclass{article}

\usepackage{biblatex}

\DeclareFieldFormat{pages}{\mkfirstpage[{\mkpageprefix[bookpagination]}]{#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},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

\printbibliography

\end{document}

enter image description here

share|improve this answer
    
Thanks. I have to say though that I don't understand anything about your solution. Where can I find a by-example documentation of this? I compare this to the excellent documentation of tikz –  Yotam Nov 3 '11 at 17:43
    
@Yotam: have a look at tex.stackexchange.com/questions/5091/… –  lockstep Nov 3 '11 at 17:46
    
ֻCiting @hadley: >The manual is unfortunately of the common latex style: beautifully typeset, and incredibly detailed, but of no use to get you up and running quickly –  Yotam Nov 3 '11 at 17:49

Inter alia, you stated:

I tried to do this through makebst but it insist on using page range.

This is strange: When I invoke the makebst program (latex makebst from the command line) and follow the prompts, I eventually get to the question

PAGE NUMBERS:
(*) Start and stop page numbers given
(f) Only start page number
  Select:

Note that you have to type f to invoke the non-default option. This question comes right after the question YEAR IN JOURNAL SPECIFICATION and right before the LARGE PAGE NUMBER question.

If you can't rerun the makebst program to create a bst file to your (or, rather, your adviser's) liking, you could also edit your existing bst file, as follows:

  1. Insert the following bibtex function between the bibtex functions format.pages and format.journal.pages (Where exactly these functions are located within the bst file can vary):

    FUNCTION {first.page} { 't := "" { t empty$ not t #1 #1 substring$ "-" = not and } { t #1 #1 substring$ * t #2 global.max$ substring$ 't := } while$ }

  2. In the existing function format.journal.pages, replace the line

    n.dashify

    with

    first.page

This should do the trick too, I believe. Happy (Bib)TeXing!

share|improve this answer

If memory serves, the page range is a single entry in a bib file. Take the entry below for example.

@article{Chuang1997,
    author = {Chuang, Isaac and Nielsen, Michael A.},
    day = {1},
    doi = {10.1080/09500349708231894},
    issn = {0950-0340},
    journal = {Journal of Modern Optics},
    month = nov,
    number = {11},
    pages = {2455--2467},
    publisher = {Taylor \& Francis},
    title = {Prescription for experimental determination of the dynamics of a quantum black box},
    url = {http://dx.doi.org/10.1080/09500349708231894},
    volume = {44},
    year = {1997}
}

Unfortunately the easy way to achieve what you want is to process your bib file entry by entry to remove the double dash and second page. Or you can do this fairly easily using sed. I use the below in one of my bash scripts, and it may serve your needs provided you have a well formatted bibtex library.

sed -e 's/pages = {\(.*\)-.*--.*-.*},/pages = {\1},/' <input_bibtex_file.bib >output.bib

It's been a while since I wrote that though. Otherwise sticking with makebst is a good idea. I used it for my thesis and hand edited the style file to add DOI links in.

ADDITION: Looking through a bst file I once constructed, this may do what you want. It grabs just the first page. No guarantees though, and other symbols like "+" may remain.

FUNCTION {first.page}
{ 't :=
  ""
    {  t empty$ not t #1 #1 substring$ "-" = not and }
    { t #1 #1 substring$ *
      t #2 global.max$ substring$ 't :=
    }
  while$
}

FUNCTION {format.journal.pages}
{ pages duplicate$ empty$ 'pop$
    { swap$ duplicate$ empty$
        { pop$ pop$ format.pages }
        {
          " " *
          swap$
          first.page
          "pages" bibinfo.check
          *
        }
      if$
    }
  if$
}
share|improve this answer
    
What bother me is that latex tries to fill the missing end pages so it place a + sign whenever one is missing. I only want the starting page. –  Yotam Nov 3 '11 at 16:06
    
This plus symbol, is that in the bibtex file itself? I found that citeulike (if you use that) did this whenever only the first page was given to it... –  qubyte Nov 3 '11 at 16:11
    
If it's not, and you need a really quick, one time fix, you can go through the .bbl file generated when you run bibtex and manually delete the plus symbols. That's a rubbish solution though. –  qubyte Nov 3 '11 at 16:18
    
S Everitt: you are, of course, right. The + sign is originated from the .bib document. The question remains though. Is there any sane way to control the bibliography style or learn biblatex? –  Yotam Nov 3 '11 at 16:25
    
Honestly, I'm not sure. It's been a couple of years since I looked at a .bst file. You can remove those plus symbols by adding the following to your sed command: -e 's/pages = {\(.*\)+},/pages = {\1},/' –  qubyte Nov 3 '11 at 16:27

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.