# Pulling Information out of Bibfile

But it kind of annoys me to write out author and year and things like that, which are already in my global bib-file (or should be). Also, I would like mistakes corrected everywhere if I correct them in the bib-file. Is there a way to get at the information from the bib-file for my latex-document?

So, instead of: (shamelessly copied from above post)

\section{Paper #1 Name, Authors, Date, \cite{...}}
My summary of the motivation and findings of the paper, or whatever I find interesting.
May be as short as a few sentences or as long as a page, depending on how relevant it is.
\index{an important word}


I would want to write something like:

\section{\mycitetitle{citekeyfrombibfile}}
\citeurl{citekeyfrombibfile}
notes and so on


where \mycitetitle would expand to Title, Authors, Year and \citeurl would expand to the url (if available). I guess this would be a case for biblatex, but I am just starting with that and not yet sure what it can do.

Here is a solution using biblatex

\documentclass{article}
\usepackage[hyperref]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{Goossens1994LaTeX,
author = {Michel Goossens and Frank Mittelbach and Alexander Samarin},
title = {The \LaTeX{} Companion, $2^{nd}$ Edition},
year = {1994},
url = {www.tex.stackexchange.com}
}
\end{filecontents*}

\DeclareCiteCommand{\citepaper}[\section]
{}
{\bibyhyperref{Paper
\printfield{title},
\printnames{author},
\printfield{year}
\mkbibbrackets{\printfield{labelnumber}}}}
{}
{}

\begin{document}

\citepaper{Goossens1994LaTeX}

\end{document}


The solution implements a new cite command (\citepaper) printing the desired/required information.

• Will this be clickable? I mean, can I click on it and it gives me the reference at the end of the file like the usual cite-command? (If I decide to have a bibliography at the end of the file) Does this give me an entry in the bibliography? And is there a way to make it flexible on whether it is a section or a subsection? That would be useful sometimes, although I guess I could just declare two separate commands. – fifaltra Oct 21 '14 at 8:15
• updated the solution to include clickable hyperlinks – Guido Oct 21 '14 at 9:31
• hm, the version with bibhyperref gives me Unknown command \citepaper, also it was fine without. Does this depend on the version of biblatex? – fifaltra Oct 21 '14 at 11:19
• You have to use \citepaper also in \DeclareCiteCommand) – Guido Oct 21 '14 at 17:55
• I just noticed there was a typo. It works perfectly now. – fifaltra Oct 22 '14 at 2:04

Why not bibentry?

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{mybib1.bib}
@book{Goossens1994LaTeX,
author = {Michel Goossens and Frank Mittelbach and Alexander Samarin},
title = {The \LaTeX{} Companion, $2^{nd}$ Edition},
year = {1994{.}},
url = {www.tex.stackexchange.com}
}
\end{filecontents*}
\usepackage{natbib}
\usepackage{bibentry}
\begin{document}
\bibliographystyle{unsrtnat}
\nobibliography{mybib1}

\subsection*{\bibentry{Goossens1994LaTeX}}

\end{document}


• This seems to be dumping just everything, which might get ugly for some of my bib-file entries. – fifaltra Oct 21 '14 at 9:41
• @fifaltra It is supposed to do that :-) Please ask a new question on how to modify the output of \bibentry so as to get specific content. – user11232 Oct 21 '14 at 9:42

Just for the sake of completeness, an alternative method I have found while waiting for answers is:

\documentclass{article}
\usepackage[hyperref]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{Goossens1994LaTeX,
author = {Michel Goossens and Frank Mittelbach and Alexander Samarin},
title = {The \LaTeX{} Companion, $2^{nd}$ Edition},
year = {1994},
url = {www.tex.stackexchange.com}
}
\end{filecontents*}