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.

Suppose you have a (PDF)LaTeX file where you include pdf pictures via \includegraphics.

Now, if you want to share the LaTeX file with another person, you always have to send not only the LaTeX file itself but also all the included pdf files containing the pictures. This is pretty inconvenient for recipient.

It would be much more comfortable to copy the pdf source code right into the LaTeX file so that only one file has to be sent. Is that possible?

share|improve this question
1  
That's really not a good idea. Better send a zip file. –  Stephan Lehmke Sep 3 '12 at 13:12
4  
Most recipients shouldn't find it inconvenient to receive a zip file of all the needed files? The alternative would be to (for example) base64 encode the pdf file so it is all safe characters and put it in a filecontents environment in the latex file and then specify a graphic rule which base64 decodes the file that latex will then write. But then you have to make sure the recipient's latex setup allows calling external scripts (and that they have a necessary decoder) which is harder to setup usually than simply unzipping an archive. –  David Carlisle Sep 3 '12 at 13:14
    
Ah, OK. Wasn't aware it's so difficult. Then of course a zip file seems to be more convenient. Then, maybe one could think of closing/deleting the question!? @moderators: Feel free to do so. –  lpdbw Sep 3 '12 at 13:21
1  
@DavidCarlisle: Make your comment to an answer, then there's no need for closing/deleting! –  Speravir Sep 3 '12 at 14:06
    
@Speravir answer added –  David Carlisle Sep 3 '12 at 14:11

4 Answers 4

up vote 10 down vote accepted

Most recipients shouldn't find it inconvenient to receive a zip file of all the needed files?

The alternative would be to (for example) base64 encode the pdf file so it is all safe characters and put it in a filecontents environment in the latex file and then specify a graphic rule which base64 decodes the file that latex will then write. But then you have to make sure the recipient's latex setup allows calling external scripts (and that they have a necessary decoder) which is harder to setup usually than simply unzipping an archive.

share|improve this answer

You can use the attachfile package. Abstract:

This package defines an \attachfile command that lets you attach arbitrary files to a pdf document. These files are embedded right in the pdf file, so they get transmitted along with it. The package also gives you control over the corresponding icon's properties and various other associated metadata.

So, you can attach all files needed ((La)TeX source, PDF images or a zip archive) into your PDF file.

(Obviously, if you want to group only sources LaTeX and PDF images without the resulting PDF file, David Carlisle's answer is more appropriate.)

share|improve this answer
3  
That's a bit indirect, isn't it. As the main purpose here is not the PDF file but the LaTeX source, it seems a bit like abusing PDF as an inferior zip format... –  Stephan Lehmke Sep 3 '12 at 13:39
    
@StephanLehmke It is very practical in many cases : in a tutorial for example... Do you think the PDF format is of inferior quality than the ZIP format? ;-) –  Paul Gaborit Sep 3 '12 at 13:49
    
Well it's not mainly meant for storing files, is it? A larger document might include thousands of files; there I'd rather trust a dedicated file format. –  Stephan Lehmke Sep 3 '12 at 14:06
1  
@StephanLehmke If it's only the source code of the PDF file, I find it better than carrying a zip file around since one doesn't need to extract or open the zip file for the PDF file. And the source code can be extracted whenever needed. –  percusse Sep 3 '12 at 14:21
2  
@percusse It wasn't my understanding that the PDF was supposed to be distributed; only the sources. –  Stephan Lehmke Sep 3 '12 at 14:34

4 years ago, someone by the name of Mike Ashley posted a GitHub gist that exactly solves the OP's original problem.

share|improve this answer

Inline encoding of images in LaTeX files isn't for human usage, it's for writing converters. Right now, any converter into LaTeX clutters the current directory with images or subdirectories, often containing large numbers of tiny files. People need to remember to remove them and copy them when they move the converted file around. It would be nice to have an alternative to this.

share|improve this answer
    
Welcome to TeX.sx!. It is worth while to expand/add more value with examples or demonstration with alternative approaches to existing answers. –  texenthusiast Apr 6 '13 at 23:38

Your Answer

 
discard

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.