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?

bkarpuz
  • 2,437

1 Answers1

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

lockstep
  • 250,273
  • So it is not possible to get text between two \newblocks? But beamer can colour them separately. – bkarpuz Jul 01 '13 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 01 '13 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 01 '13 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 01 '13 at 11:57
  • I am using WinEdt and I could not figure this out. – bkarpuz Jul 01 '13 at 12:04
  • @bkarpuz Change my example to \usepackage[backend=bibtex]{biblatex} and try to compile using pdflatex -- bibtex -- pdflatex. I'm fairly sure WinEdt allows to do this automatically. – lockstep Jul 01 '13 at 12:09
  • How can I replace seperator dots in the bibliography with commas? (A. Author, Alpha, Somewhere: A publisher, 2001) I also want the book use \beamertemplatebookbibitems. Does this apply? – bkarpuz Jul 01 '13 at 12:20
  • @bkarpuz Ad a) \renewcommand*{\newunitpunct}{\addcomma\space} Ad b) I don't know -- you should ask a new question and wait for a beamer expert to answer it. – lockstep Jul 01 '13 at 12:29
  • The solution of the second one is located here http://tex.stackexchange.com/questions/68080/beamer-bibliography-icon/68084#68084 By the way, I have JOURNAL, VOLUME, YEAR, NUMBER and PAGES information for my entry but why \citelist{MR2000143}{JOURNAL} does not call the value? – bkarpuz Jul 01 '13 at 16:03
  • @bkarpuz See updated answer -- you'll have to use \citefield for these. – lockstep Jul 01 '13 at 16:04
  • I fail. Do you mind showing me the code just for JOURNAL? So that I can modify it for my other purposes. Sorry to ask too much. – bkarpuz Jul 01 '13 at 16:22
  • 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 01 '13 at 16:29