3

Can anyone help me to do citations in the text using author and year, importing them from/using a bib file. I tried to use this code but doesn't work.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}



\usepackage{biblatex}
\bibliography{xxx.bib}

\usepackage[english]{babel}
    \usepackage[
    backend=biber,
    style=alphabetic,
    citestyle=authoryear 
    ]{biblatex}

\begin{document}

 Let's cite! The Einstein's journal paper \cite {xxxx}

\printbibliography

\end{document}

1 Answer 1

3

If you look at the log file when you compile your minimal document, you should have seen an error Option Clash for package biblatex.

This is because you are loading biblatex twice: once with no options (which defaults to a numeric style) and once with alphabetic style.

But if you want author-year style, you should load it with just the [style=authoryear] option. If you actually want Author-Year citations but with an alpha style bibliography you can use [citestyle=authoryear,bibstyle=alphabetic].

I've also changed the \bibliography command to \addbibresource (and moved it to a position after loading biblatex) and changed your \cite command to \textcite.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage[backend=biber,style=authoryear]{biblatex}
\addbibresource{mybibfile.bib}

\begin{document}

 Let's cite! The Einstein's journal paper \textcite{mycitation}

\printbibliography

\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .