3

I use the authoryear style in biblatex and want to create a number before the entries just like in the numeric style. I managed to get the numbers but would also like to have square brackets around them an get rid of the dot after the number.

\documentclass{article}
\usepackage[style=authoryear,dashed=false,backend=biber,eprint=false,doi=false,isbn=false,url=false]{biblatex}
\defbibenvironment{bibliography}
{\enumerate
    {}
    {\setlength{\leftmargin}{\bibhang}%
        \setlength{\itemindent}{-\leftmargin}%
        \setlength{\itemsep}{\bibitemsep}%
        \setlength{\parsep}{\bibparsep}}}
{\endenumerate}
{\item}
\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{DiGiuseppe2016,
    Title                    = {{Borrowed Time: Sovereign Finance, Regime Type, and Leader Survival}},
    Author                   = {DiGiuseppe, Matthew and Shea, Patrick E.},
    Journal                  = {Economics and Politics},
    Year                     = {2016},
    Number                   = {3},
    Pages                    = {342--367},
    Volume                   = {28},
    Doi                      = {10.1111/ecpo.12081},
    ISBN                     = {1468-0343},
    ISSN                     = {14680343}
}

@Article{Dixit2000,
    Title                    = {{Political Power and the Credibility of Government Debt}},
    Author                   = {Dixit, Avinash and Londregan, John},
    Journal                  = {Journal of Economic Theory},
    Year                     = {2000},
    Number                   = {1},
    Pages                    = {80--105},
    Volume                   = {94},

    Doi                      = {10.1006/jeth.2000.2684},
    ISSN                     = {00220531}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
Text \cite{Dixit2000} More Text \cite{DiGiuseppe2016}
\printbibliography
\end{document}
  • This is the default. Why are you trying to reinvent the wheel? – Bernard Jan 16 '18 at 13:42
  • @Bernard the numbers in the bibliography are not shown for author-year citations by default, the OP apparently wants to combine the two styles. – Marijn Jan 16 '18 at 14:35
  • If you have numbers in the bibliography they are going to be much more prominent than the author and the year - almost obscuring them. For a reader it will be harder to look past the numbers to find the correct author-year combination that matches the citation label. I don't think it is a good idea to mix authoryear and numeric like this. I'd find something like tex.stackexchange.com/q/314014/35864 less confusing if you insist on numbers in the bibliography. If you don't strictly need them, style=authoryear as it is by default might be the better choice. – moewe Jan 16 '18 at 14:40
  • The problem of the mentioned solution is that I need the authoryear citation style in the text and I need the numbers in the bibliography. – PeterStrawson Jan 16 '18 at 14:54
  • Indeed. But I was trying to persuade you that what you want is not ideal. The bibliography will be quite a bit harder to navigate for your reader. – moewe Jan 16 '18 at 15:21
1

Using the package enumitem you can customize the enumerate environment. Modify your MWE with the following code:

\usepackage{enumitem}
\defbibenvironment{bibliography}
{\enumerate[label={[\arabic*]}]

Result:

enter image description here

  • This anwer is not usable without the context. Is there a more general solution? – JHBonarius Mar 22 '18 at 13:15
  • @JHBonarius the approach of the question is applicable in general (i.e., combine an authoryear style in the main text with an enumerate style in the reference list), as is my solution to the specific problem (i.e., change the appearance of the enumerate labels). In a different context, well, you should change the context accordingly - but the approach of the solution remains the same. As it is currently presented in the question it is already a rather general case (except maybe for some unnecessary biblatex options), how would you propose to make it more general? – Marijn Mar 22 '18 at 14:26
  • 1
    Well, for my case (using style=science) the solution turned out to be to use \DeclareFieldFormat{labelnumberwidth}{[#1]}. However, I've posted an answer with my proposed solution for this issue. – JHBonarius Mar 22 '18 at 14:53
0

I don't know if this was available in januari 2016, bu nowadays you can have a seperate bibstyle and citestyle. E.g.:

\usepackage[citestyle=authoryear,bibstyle=numeric,backend=biber,eprint=false,doi=false,isbn=false,url=false]{biblatex}
  • 1
    You'll notice subtle differences between the outcome of this solution and the other answer. In particular Marijn's answer retains the order of "Author (Year). Title" in the bibliography, while bibstyle=numeric moves the year to the back of the entry. This may or may not be desirable. – moewe Mar 22 '18 at 14:54
  • Good point. Well, I'll just keep this answer here for reference. – JHBonarius Mar 22 '18 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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