3

I am using Beamer, and I prepare the references as follows.

\begin{thebibliography}{99}

\bibitem{refno} Author Name,
\newblock Title,
\newblock Location.

\end{thebibliography}

Is it possible to receive authorname, title or location just by refno? Or is there any other simple way for this?

1 Answer 1

5

Your "crafted" thebibliography environment does not consist of fields like author and title, but simply of unlabeled strings separated by \newblock. Therefore, it is not possible to extract specific information. Instead, you must use packages like biblatex that resort to a bibliography database managed by backend programs like biber or BibTeX. Below, you'll find a compilable example using biblatex -- the filecontents package is used to "store" the .bib database within the example.

Make sure to compile the example using pdflatex -- biber -- pdflatex. If your editor doesn't handle this automatically, use the command line.

See section 3.7.7 of the biblatex manual for details about the \citelist command and its cousins \citename and \citefield. Note that some standard BibTeX field types are replaced with other types by biblatex (e.g. journal becomes journaltitle); while the old types work in the .bib file, you must use their biblatex equivalent within \citefield.

\documentclass{beamer}

\usepackage{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
  location = {Somewhere},
  publisher = {A publisher},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\begin{frame}
As was shown by \citeauthor{A01} in \citeyear{A01} (published in
    \citelist{A01}{location})~\dots

\printbibliography
\end{frame}

\end{document}

enter image description here

12
  • So it is not possible to get text between two \newblocks? But beamer can colour them separately.
    – bkarpuz
    Jul 1, 2013 at 11:38
  • My guess is that beamer uses certain colours e.g., for the first, second, ... last block (and makes implicit assumptions about the content of these blocks), but that doesn't equal being able to extract the information.
    – lockstep
    Jul 1, 2013 at 11:42
  • This does not produce the same output. What I get is "As was shown by A01 in A01 (published in A01 )...".
    – bkarpuz
    Jul 1, 2013 at 11:52
  • @bkarpuz You have to compile the example using (e.g.) pdflatex, then biber, the again pdflatex. (Such sequences are common if one uses backend programs like biber.)
    – lockstep
    Jul 1, 2013 at 11:57
  • 1
    @bkarpuz That was just bad luck -- you need to use \citefield{<key>}{journaltitle}, because biblatex treats the journal field as an alias of its journaltitle. P.S.: If it works now, please accept my answer.
    – lockstep
    Jul 1, 2013 at 16:29

You must log in to answer this question.

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