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've tried using the authordate2 style of bibtex which is really close of the styles I wanted for my dissertation but this package is really old. Trying with default styles the code worked well but with the authordate2 style it says that \cite{myref} is an Undefined control sequence.

So I discovered biblatex and with it the citation styles already had the parentheses. I just wanted to change the "and" by "&", put the "et al" in italics and to wrap the name and the year by a hyperlink.

The bibliography style is a little more tricky but I believe someone more experienced in biblatex macros and stuff would know.

I'd like to get citation and bibliography styles like these:

Citation

(Lastname & Lastname2, year)

(Lastname et al, year; Lastname2 et al, year; Lastname & Lastname2, year)

Bibliography

[Lastname & Lastname2, year] F.M. Lastname & F.M. Lastname2. (2003). Paper Title . Journal Name . 98(462):470–487.

[Lastname et al, year] F.M. Lastname, F.M. Lastname2 & F.M. Lastname3. (2003). Paper Title . Journal Name . 98(462):470–487.

Here's a minimal example from what I did until now.

\documentclass{article}
\usepackage{hyperref}
\usepackage[brazil]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,backref=true,hyperref=true]{biblatex}

\begin{filecontents}{\jobname.bib}

@ARTICLE{citationA,
 Author = {Fulano Tal de Rio de Janeiro and Fulano Tal de Sao Paulo },
 Year = {2001},
 Title = {Paper Title},
 Journal = {Jornal A}
}

@ARTICLE{citationB,
 Author = {Fulano Tal de Rio de Janeiro and Fulano Tal de Sao Paulo and Fulano Tal de Recife     },
 Year = {2002},
 Title = {Paper Title},
 Journal = {Jornal B}
}

@ARTICLE{citationB2,
 Author = {Fulano Tal de Rio de Janeiro and Fulano Tal de Sao Paulo and Fulano Tal de Recife         },
 Year = {2002},
 Title = {Paper Title},
 Journal = {Jornal C}
}

@ARTICLE{citationC,
 Author = {Fulano Tal de Recife},
 Year = {2003},
 Title = {Paper Title},
 Journal = {Jornal D}
}

\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\cite{citationA}

\cite{citationB}

\cite{citationB2}

\cite{citationC}

\parencite{citationA,citationC}

\parencite{citationB2}

\nocite{*}
\printbibliography

\end{document}

PARTIAL SOLUTION

\documentclass{article}
\usepackage{hyperref}
\usepackage[brazil]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,maxnames=2,maxbibnames=3,backref=true,hyperref=true,dashed=false,firstinits=true]{biblatex}  

\renewcommand*{\finalnamedelim}{\addspace\&\space}
\renewcommand*{\nameyeardelim}{\addcomma\space}

\renewbibmacro{in:}{}

\renewbibmacro*{name:andothers}{%
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
    }
    {\ifnumgreater{\value{liststop}}{1}
       {\finalandcomma}
       {}%
     \andothersdelim\bibstring[\emph]{andothers}}
    {}}

\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{% 
    \DeclareFieldAlias{bibhyperref}{default}% 
    \iffieldundef{shorthand}
      {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
         {\usebibmacro{cite:label}%
          \setunit{\addspace}}
         {\printnames{labelname}%
          \setunit{\nameyeardelim}}%
       \usebibmacro{cite:labelyear+extrayear}}
      {\usebibmacro{cite:shorthand}}}}

\DeclareCiteCommand{\textcite}% 
  {\boolfalse{cbx:parens}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{% 
     \DeclareFieldAlias{bibhyperref}{default}%
     \usebibmacro{textcite}%
     \iffieldundef{postnote}% 
       {\ifbool{cbx:parens}
          {\bibcloseparen\global\boolfalse{cbx:parens}}
          {}}
       {}}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}%
   \multicitedelim}
  {\iffieldundef{postnote}
    {}
    {\usebibmacro{textcite:postnote}}}

\DeclareFieldFormat[article]{title}{\textbf{#1}}

\renewcommand{\baselinestretch}{1.25}

\DeclareNameAlias{sortname}{first-last}

\addbibresource{jobname.bib}

\begin{document}

\cite{citationA}

\cite{citationB}

\cite{citationB2}

\cite{citationC}

\parencite{citationA,citationC}

\parencite{citationB2}

\nocite{*}

\printbibliography

\end{document}

Updated Output. OUTPUT

Missing only the links in front like this figure.

share|improve this question
3  
Existing answers address many of the style elements you're wanting: name list truncation and final delimiter, "et al." in italics, removing "In:", hyperlinking name and year. In this post, lockstep discusses name initials and order. The rest appears straightforward. I'm sure someone can help you figure it out. –  Audrey Feb 17 '12 at 2:07
1  
Thank you Audrey. I've gone through these articles and solved a bunch of requirements. I had updated the description with a partial solution. Now its missing the links in front of each bibitem. I've seen styles using numbers and the initial letters from authors in biblatex. I'll try to achieve the final result based on them. Have you seen if someone already tried something like that? Thanks again. –  Arthur Alvim Feb 17 '12 at 6:04
    
+1 No problem. The back references ("ver p. 1") can actually print a list of page numbers where the entry is cited. In the example would you want "Zhang et al., 2004" to be a link back to the page where the entry is first cited? –  Audrey Feb 17 '12 at 14:28
    
Well, its not mandatory putting links in the back. I just put that backref=true so the navigation in the eletronically version of the dissertation would be easier. Let's say that the back references got into the list of requirements now. What I really wanted is the front links like in the image [Zhang et al., 2004]. –  Arthur Alvim Feb 17 '12 at 14:53
1  
I have found a solution for the front labels here link. Almost done. I'm looking for a way to align the labels and the reference like in the image. –  Arthur Alvim Feb 17 '12 at 16:15
show 3 more comments

1 Answer 1

up vote 3 down vote accepted

I think I've finished. It's not a perfect solution but it clears a lot of customization in biblatex. The \defbibenvironment{bibliography} was got from the alphabetic/numeric styles and mixed with some code from here. I set the length of \labelwidth to 130pt so it would fit my needs. In the alphabetic/numeric styles these width are adjusted automatically. Maybe someone can achieve a better solution related to that.

\documentclass{article}
\usepackage{hyperref}
\usepackage[brazil]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,maxnames=2,maxbibnames=3,maxcitenames=2,backref=true,hyperref=true,dashed=false,firstinits=true]{biblatex}  

% putting & as the separator of the author name's
\renewcommand*{\finalnamedelim}{\addspace\&\space}
% the comma after the authors
\renewcommand*{\nameyeardelim}{\addcomma\space}

% no 'in'
\renewbibmacro{in:}{}

% et al in italic
\renewbibmacro*{name:andothers}{%
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
    }
    {\ifnumgreater{\value{liststop}}{1}
       {\finalandcomma}
       {}%
     \andothersdelim\bibstring[\emph]{andothers}}
    {}}

%  citation including both name and year
\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{% 
    \DeclareFieldAlias{bibhyperref}{default}% 
    \iffieldundef{shorthand}
      {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
         {\usebibmacro{cite:label}%
          \setunit{\addspace}}
         {\printnames{labelname}%
          \setunit{\nameyeardelim}}%
       \usebibmacro{cite:labelyear+extrayear}}
      {\usebibmacro{cite:shorthand}}}}

%  text citation including both name and year
\DeclareCiteCommand{\textcite}% 
  {\boolfalse{cbx:parens}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{% 
     \DeclareFieldAlias{bibhyperref}{default}%
     \usebibmacro{textcite}%
     \iffieldundef{postnote}% 
       {\ifbool{cbx:parens}
          {\bibcloseparen\global\boolfalse{cbx:parens}}
          {}}
       {}}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}%
   \multicitedelim}
  {\iffieldundef{postnote}
    {}
    {\usebibmacro{textcite:postnote}}}

    \newcounter{mymaxcitenames}
    \AtBeginDocument{%
      \setcounter{mymaxcitenames}{\value{maxnames}}%
    }

% the bold title in article's entries
\DeclareFieldFormat[article]{title}{\textbf{#1}}

% order first name then last name 
\DeclareNameAlias{sortname}{first-last}

% the front labels before the bibliography references
\defbibenvironment{bibliography}
  {\list
     {
        \printtext[brackets]{%
            \begingroup
            \defcounter{maxnames}{\value{mymaxcitenames}}%
            \printnames{labelname}%
            \setunit{\nameyeardelim}%
            \printfield{labelyear}% 
            \printfield{extrayear}%
            \endgroup
            }%
        }
     {\setlength{\labelwidth}{130pt}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hfill##1\hss}
      }
  {\endlist}
  {\item}

\addbibresource{jobname.bib}

\begin{document}

\cite{citationA}

\cite{citationB}

\cite{citationB2}

\cite{citationC}

\parencite{citationA,citationC}

\parencite{citationB2}

\nocite{*}

\printbibliography

\end{document}

The final output.

enter image description here

Just want to emphasize that most of the code were obtained from the links in Audrey's first comment.

share|improve this answer
1  
+1 maxnames=n is a shorthand for maxbibnames=n,maxcitenames=n. Automatically setting the label width was the nontrivial problem I was referring to in my last comment. It's easy with labelnumber and labelalpha because they are internally defined as fields. Your label is the result of many formatting commands, so its width is hard to capture. This might get resolved with future biblatex/biber features. –  Audrey Feb 21 '12 at 2:53
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.