0

Hi I want to modify biliographystyle unsrt, this style return :

Einstein journal paper [1].

But I want :

Einstein journal paper (Einstein 1905, [1]).

With the same entry in the bibliography section. I have test citep but it doesn't work, and I have chose other biliographystyle but I prefer the unsrt bibliographystyle.

example.tex source :

\documentclass[12pt,a4paper]{report}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
  \bibliographystyle{unsrt}

\begin{document}
Einstein journal paper \cite{einstein}.
\bibliography{example}
\end{document}

example.bib source :

@article{einstein,
  author =       "Albert Einstein",
  title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
                 [{On} the electrodynamics of moving bodies]",
  journal =      "Annalen der Physik",
  volume =       "322",
  number =       "10",
  pages =        "891--921",
  year =         "1905",
  DOI =          "http://dx.doi.org/10.1002/andp.19053221004"
}
0

This style calls for biblatex, which is a very extendable alternative to bibtex. See What is the difference between bibtex and biblatex? and biblatex in a nutshell for a bit more information.

You can load biblatex with

% Load BibLaTeX
\usepackage[
        backend=bibtex, % You can still use bibtex, but it is also worth checking out biber
        citestyle=authoryear,
        ]{biblatex}
\addbibresource{\jobname} % or bibliography[.bib] - no extension

Note, with backend=bibtex, you will still use the latex > bibtex > latex > latex compilation dance. But you should also check out biber, which is an alternative backend that allows for even fancier things with the bibliography. (See also bibtex vs. biber and biblatex vs. natbib).

After a few customizations, you have the format that you desire as the default. Play around with the settings to see if it will work for you.

Working Example

bibliography

\documentclass[12pt,a4paper]{article}
\begin{filecontents}{\jobname.bib}
@article{einstein,
  author =       "Albert Einstein",
  title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
                 [{On} the electrodynamics of moving bodies]",
  journal =      "Annalen der Physik",
  volume =       "322",
  number =       "10",
  pages =        "891--921",
  year =         "1905",
  DOI =          "http://dx.doi.org/10.1002/andp.19053221004"
}
\end{filecontents}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%\bibliographystyle{unsrtnat} % Removed, not used in biblatex

% Load BibLaTeX
\usepackage[
        backend=bibtex, % You can still use bibtex, but it is also worth checking out biber
        citestyle=authoryear,
        ]{biblatex}
\addbibresource{\jobname} % or bibliography[.bib] - no extension



% Make \cites \parencite by default
\let\cite\parencite

% Make bibmacro to create the key (doesn't exist with authoryear by default)
\newbibmacro*{cite:key}{%
  \printtext[brackets]{%
    \printfield{prefixnumber}%
    \printfield{labelnumber}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
      {}}}

% Renew cite style for format you desire
\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\addspace}}
       {\printnames{labelname}%
        \setunit{\nameyeardelim}}%
     \printtext{\usebibmacro{cite:labelyear+extrayear}}%
    \setunit{\addcomma\space}%
    \usebibmacro{cite:key}}%
    {\usebibmacro{cite:shorthand}}}


\begin{document}
Einstein journal paper \cite{einstein}.
\printbibliography % \bibliography becomes \printbibliography
\end{document}

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.