5

I'd like the text that links to the references to be simply the bibtex key. So, with a bibtex entry like

@ARTICLE{Author1:2000:Topic,
  author      = {A. Author1 and B. Author2},
  title       = {Title},
  journal     = {Journal},
  year        = {2000},
  volume      = {1},
  pages       = {3--4}
}

I would like to have an in-text link Author1:2000:Topic and not a number style [1] or an author-year style Author1 (2000).

The description of the drftcite package sounded as if it might have provided that functionality. But it does not work with the biblatex package:

! Package biblatex Error: Incompatible package 'drftcite'.

The problem sounds to me rather simple, because nothing tricky has to be calculated. As I have to provide the bibtex key anyway, I could just write it into the text and use the \nocite command to have the respective entry in the reference list. But what I'm then obviously missing is the hyperlink from the citation to the reference list.

To provide a small working example that might be modified into an answer:

\documentclass{article}

\begin{filecontents*}{literature.bib}
@ARTICLE{Author1:2000:Topic,
  author      = {A. Author1 and B. Author2},
  title       = {Title},
  journal     = {Journal},
  year        = {2000},
  volume      = {1},
  pages       = {3--4}
}
\end{filecontents*}

\usepackage[backend=bibtex, style=authoryear, natbib=true]{biblatex}
\bibliography{literature}

\usepackage{hyperref}

\newcommand{\drftcite}[1]{\cite{#1}}

\begin{document}
\par This is shown in \drftcite{Author1:2000:Topic}.
\printbibliography
\end{document}

After compilation with pdflatex and bibtex, I get a pdf with the following text:

    This is shown in Author1 and Author2, 2000.

References
Author1, A. and B. Author2 (2000). “Title”. In: Journal 1, pp. 3–4.

In this text, the first number 2000 is a hyperlink to the cited reference.

What I'd like to have, is a \drftcite command that instead of Author1 and Author2, 2000 writes a hyperlink with the bibtex key Author1:2000:Topic.

2
  • Doesn't what biblatex show before you run BibTeX/Biber look very much like what you want?
    – Joseph Wright
    Commented Apr 26, 2014 at 17:41
  • After the first pdflatex run and before the biblatex run, the in-text citation looks (except for bold face and colour) like I want to have it, but there is no reference list yet and, thus, no link.
    – Wolfram
    Commented Apr 26, 2014 at 18:05

2 Answers 2

6

The draft citation style seems to cover what you want:

\documentclass{article}

\begin{filecontents*}{literature.bib}
@ARTICLE{Author1:2000:Topic,
  author      = {A. Author1 and B. Author2},
  title       = {Title},
  journal     = {Journal},
  year        = {2000},
  volume      = {1},
  pages       = {3--4}
}
\end{filecontents*}

\usepackage[backend=bibtex, bibstyle=authoryear, citestyle = draft, natbib=true]{biblatex}
\bibliography{literature}

\usepackage{hyperref}

\newcommand{\drftcite}[1]{\cite{#1}}

\begin{document}
\par This is shown in \drftcite{Author1:2000:Topic}.
\printbibliography
\end{document}

which gives

enter image description here

where the citation here is a hyperlink.

1
  • Perfect, thank you! The draft option does it! And I like very much the possibility to determine bibstyle and citestyle separately.
    – Wolfram
    Commented Apr 26, 2014 at 18:48
6

If you just want a \drftcite command that prints the bibkey and still want to be able to use the proper other citation commands, you can easily define \drftcite yourself.

\DeclareCiteCommand{\drftcite}
  {\usebibmacro{prenote}}
  {\printfield[bibhyperref]{entrykey}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

That command can then be used just like any other cite command.

MWE

\documentclass{article}
\usepackage[backend=bibtex, style=authoryear, natbib=true]{biblatex}
\usepackage{hyperref}

\addbibresource{biblatex-examples.bib}

\DeclareCiteCommand{\drftcite}
  {\usebibmacro{prenote}}
  {\printfield[bibhyperref]{entrykey}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\begin{document}
\drftcite{cicero} and \drftcite{knuth:ct:a}

\printbibliography
\end{document}

enter image description here

You must log in to answer this question.

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