Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have built a .bib file with some entries providing a file attribute.

I want this file to be automatically attached to the document (at the end, where the references are).

I'm already using biblatex to provide a direct http link to some references via the doi=true flag (references that I can't legally include as PDFs).

I'd like this:

As stated in my previous report, \cite{report1} ...

to be translated into that:

As stated in my previous report, [1] ...


[1] My interesting report, 2012 (click here)

Does anyone know about a package able to do that? I've asked google and CTAN without much success...


Here we are, an example of .bib file, let's call it refs.bib:

author = {Some Authors},
title = {The Early Typography of Printed Welsh (sounds great)},
journal = {The Library},
volume = {3},
pages = {217--231},
year = {1981},
doi = {10.1093/library/s6-III.3.217},
author = {Some Authors},
title = {Navigator},
year = {2010},
url = {http://mirrors.ctan.org/macros/generic/navigator/navigator-doc.pdf},
file = {navigator-doc.pdf}

And the main.tex file:



This seems to be an interesting article\cite{SomethingIDidntRead}.
But I just took it at random for its \textsc{doi}.

This file is also interesting\cite{navigator} and I'd like it to be embedded.


What I want is to know if there is a package that takes the file name I provide in the .bib file to automatically and embed it to get file:click here just as I get doi:XXXXXXX.

If no package provides that, we'll see what can be done.

Thanks for your attention.

share|improve this question
Very interesting question! Could you make a Minimal (non-)Working Example, using some publicly available PDF file (e.g. some short CTAN package documentation)? –  tohecz Feb 21 '13 at 15:51
You can attach an external file to the end of the document by using package pdfpages. In your biblatex style, specify \AtEndDocument{\includepdf{filename}}. (Sorry, I can't offer any advice on how to extend a biblatex style, because I've never used biblatex... yet!) –  Sašo Živanović Feb 22 '13 at 2:21
Just to clarify: Do you want to embed the .bib or the .pdf? –  Martin Schröder Feb 22 '13 at 9:05
See tex.stackexchange.com/q/13187/5763 for answers on embedding arbitrary files into generated PDFs. –  Martin Schröder Feb 22 '13 at 9:07
I want to embed PDF files into a PDF, but not really the way embedfile do it. I prefer the attachfile2 approach here. I'd like to have [1] My interesting report, 2012 (click here) just like I already have [2] Interesting paper, 2013, DOI:[clickable_doi]. But maybe this does not exist. That's fine, I can try to code something but I wouldn't like to reimplement something that already exists. –  Gael Feb 22 '13 at 13:58

1 Answer 1

First I found this: http://tex.stackexchange.com/a/65403/15283 But I don't have biber 1.0+ nor biblatex 2.0+... The given solution won't work on my TeXLive 2012 installation.

Then I found that the file field was indeed parsed but not used in the usual style formats, I read the doc and here we are:

%Declare the "file" field format
\DeclareFieldFormat{file}{\bibstring{file}\addcolon\space \textattachfile[color={0 0 1}]{#1}{Click me!}}

Easy was't it? :P

Thanks for your input.

share|improve this answer
This works nicely as a proof-of-concept. If I actually wanted to use it, I would need to think about a) getting it to work with the way JabRef specifies the file path and b) avoiding having a file embedded twice if the citation style uses the full entry for the first citation (this would probably result in having the field differentiate between citations and the bibliography). This isn’t meant as criticism, though, but rather as notes to myself and anybody else using this code. –  doncherry Aug 17 at 14:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.