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 struggle with some biblatex settings (Style 2 of Annual Reviews):

1) The citations in the text should appear with parentheses instead of brackets and ampersand instead of 'and', so: Tex et al. (1), Ba & Rise (2).

2) In the references, the entries should appear like this

  1. Tex L, Bar F, Rate P. 2011. Minimal title. Journal of LaTeX questions. 1(1):110--20
  2. Ba K, Rise S. 2012. Minimal title. Journal of BibLaTeX questions. 1(1):110--31

I tried to adapt the numeric style (in order to get consecutively numbered citations), but that might not be a good idea (?). For example, concerning 1), I found biblatex: How to remove the parentheses around the year in authoryear style? but the trick by A. Munn there to get rid of the parentheses around the year does not seem to carry over to numeric citation styles.

I know that some requirements are probably hard to get (for, example, the page range 110--20 instead of 110--120), but any help towards achieving 1) and 2) is appreciated.

\documentclass{scrartcl}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[american]{babel}
\usepackage{blindtext}

\usepackage{csquotes}
\usepackage[
backend=bibtex,
style=numeric,
sorting=none,
firstinits=true,
terseinits=true,
uniquename=init,
maxcitenames=2,
date=iso8601,
urldate=iso8601
]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{bib.bib}
@Article{foo,
    author={Tex, La and Bar, Foo and Rate, Pi},
    journal={Journal of LaTeX questions},
    pages={110--120},
    title={{Minimal title}},
    volume={1},
    number={1},
    year={2011}}
@Article{bar,
    author={Ba, Ka and Rise, Sun},
    journal={Journal of BibLaTeX questions},
    pages={110--131},
    title={{Minimal title}},
    volume={1},
    number={1},
    year={2012}}
 \end{filecontents*}

% bibliography
\DeclareFieldFormat{labelnumberwidth}{#1.}% use 1., 2., ... in the references
\DeclareNameAlias{default}{last-first}
\renewbibmacro*{volume+number+eid}{% use volume(number) for articles for example
  \setunit*{\adddot\space}%
  \printfield{volume}%
  \printfield{number}}
\DeclareFieldFormat*{number}{(#1)}
\DeclareFieldFormat*{title}{#1}% remove quotes from title
\renewbibmacro*{in:}{}% remove in label
\DeclareFieldFormat{isbn}{ISBN #1}% format isbn number
\bibliography{bib.bib}% bibliography data
\renewcommand*{\cite}[2][]{\textcite[#1]{#2}}

\begin{document}
\blindtext[1]; see \cite{foo}, \cite{bar}.
\printbibliography
\end{document}
share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

To replace brackets with parentheses for all citations, you should take the definitions of citation commands in numeric.cbx and replace every instance of \mkbibbrackets, \bibopenbracket, and \bibclosebracket with \mkbibparens, \bibopenparen, and \bibcloseparen. In my example, I've patched the textcite bibmacro.

To place the year immediately after the author(s) in the bibliography, I've used sort of a hack: Use bibstyle=authoryear, but copy the definition of the bibliography bibenvironment from numeric.bbx. (One also has to redefine sortname instead of default when using \DeclareNameAlias.)

To compress page ranges, use \mkcomprange. See section 4.6.4 of the manual for details.

\documentclass{scrartcl}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[american]{babel}

\usepackage{csquotes}
\usepackage[
backend=bibtex,
citestyle=numeric,
bibstyle=authoryear,
sorting=none,
firstinits=true,
terseinits=true,
uniquename=init,
maxcitenames=2,
date=iso8601,
urldate=iso8601
]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{bib.bib}
@Article{foo,
    author={Tex, La and Bar, Foo and Rate, Pi},
    journal={Journal of LaTeX questions},
    pages={110--120},
    title={{Minimal title}},
    volume={1},
    number={1},
    year={2011}}
@Article{bar,
    author={Ba, Ka and Rise, Sun},
    journal={Journal of BibLaTeX questions},
    pages={110--131},
    title={{Minimal title}},
    volume={1},
    number={1},
    year={2012}}
 \end{filecontents*}

% bibliography
\DeclareFieldFormat{labelnumberwidth}{#1.}% use 1., 2., ... in the references
\DeclareNameAlias{sortname}{last-first}
\renewbibmacro*{volume+number+eid}{% use volume(number) for articles for example
  \setunit*{\adddot\space}%
  \printfield{volume}%
  \printfield{number}}
\DeclareFieldFormat*{number}{(#1)}
\DeclareFieldFormat*{title}{#1}% remove quotes from title
\renewbibmacro*{in:}{}% remove in label
\DeclareFieldFormat{isbn}{ISBN #1}% format isbn number
\addbibresource{bib.bib}% bibliography data
\renewcommand*{\cite}[2][]{\textcite[#1]{#2}}

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
    \printfield{prefixnumber}%
    \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

\usepackage{xpatch}

\xpatchbibmacro{date+extrayear}{%
  \printtext[parens]%
}{%
  \setunit{\addperiod\space}%
  \printtext%
}{}{}

\xapptobibmacro{journal+issuetitle}{\addcolon\space}{}{}

\xpatchbibmacro{textcite}{\bibopenbracket}{\bibopenparen}{}{}
\xpatchbibmacro{textcite}{\bibclosebracket}{\bibcloseparen}{}{}

\renewcommand*{\revsdnamepunct}{}

\renewcommand*{\multinamedelim}{\addspace\&\space}
\renewcommand*{\finalnamedelim}{\addspace\&\space}

\AtBeginBibliography{%
  \renewcommand*{\multinamedelim}{\addcomma\space}%
  \renewcommand*{\finalnamedelim}{\addcomma\space}%
}

\DeclareFieldFormat{pages}{\unskip\mkcomprange{#1}}
\DeclareFieldFormat{postnote}{\mkcomprange{#1}}
\DeclareFieldFormat{multipostnote}{\mkcomprange{#1}}

\begin{document}
Some text; see \cite{foo}, \cite{bar}.
\printbibliography
\end{document}

enter image description here

share|improve this answer
    
Hi lockstep, many thanks for helping. I had to use \newcommand for \revsdnamepunct (was undefined) to work. Then, I get a similar output as you, but the references appear as "Tex, L, Bar, F, Rate, P." so with commas (?). I use the basic biblatex as comes with texlive 2012 (on Ubuntu 12.10). Apart from that, do you know how to get "1(1):110--31" instead of "1(1), 110--31"? Many thanks again. –  Marius Hofert Nov 28 '12 at 10:11
    
@MariusHofert a) If you really can't upgrade to biblatex v2.2 (which introduced \revsdnamepunct), use my original answer to tex.stackexchange.com/questions/17583/… b) See updated answer. –  lockstep Nov 28 '12 at 10:21
    
Thanks. I downloaded the latest version from github.com/plk/biblatex/downloads and put the content in my local TeX tree: (./tex/latex/biblatex in /usr/local/texlive/texmf-local/tex/latex and ./bibtex in /usr/local/texlive/texmf-local (replaced the existing "bibtex" there)). Then a made texhash. On compiling the .tex, I obtain "/usr/local/texlive/2012/../texmf-local/tex/latex/biblatex/biblatex.sty:87: Miss ing number, treated as zero. <to be read again> D l.87 ?". Hmmm... not sure what goes wrong. –  Marius Hofert Nov 28 '12 at 11:00
    
I also obtain this error for other documents which involve biblatex, so it's an error in the installation. Line 87 in biblatex.sty is the last line which contains code. I'll accept your answer and open a new issue with the installation problem. –  Marius Hofert Nov 28 '12 at 11:20
    
Okay, it's solved now, the SF version (2.4) worked fine. –  Marius Hofert Nov 28 '12 at 14:45
show 3 more comments

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.