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 use the embedfile package in order to embed the LaTeX source code into the final PDF with the following code:

\documentclass{article}

\usepackage{embedfile}
\embedfile{\jobname.tex}

\begin{document}
The document
\end{document}

This works fine with pdflatex, but now I have to switch to XeLaTeX in order to use a custom TrueType font. However, the embedfile package doesn't support the program dvipdfmx used by XeLaTeX. Is there a way to modify the package to make it cooperate with dvipdfmx, or another package with similar functionality supporting this driver?

(This question is similar, but not identical, to Attach files to PDF with dvipdfmx: In the answers to this question, a way to attach a file to a PDF using dvipdfmx is shown. This creates a visible icon in the document, which is not what I want: The embedded file should only appear in the list of attachments displayed e.g. by Acrobat Reader.)

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

OK, I figured it out myself: The package navigator works fine with pdflatex and dvipdfmx and supports embedding files through the \embeddedfile macro:

\documentclass{article}

\usepackage{navigator}
\embeddedfile{sourcecode}{\jobname.tex}

\begin{document}
The document
\end{document}

The syntax of the command is

\embeddedfile[<optional description>]{<object name>}[<optional filename displayed in the viewer>]{<file>}
share|improve this answer
1  
Thanks, I didn't know this package before. –  Leo Liu Feb 5 '11 at 13:37
add comment

Heiko Oberdiek has updated attachfile2 package to support dvipdfmx and XeTeX. Use this version:

http://www.informatik.uni-freiburg.de/~oberdiek/tmp/attachfile2.pdf

(The attachfile2.dtx is attached in the pdf file.)

To avoid the icon, you can use \textattachfile command. For example:

\textattachfile{foo.jpg}{} % no icon or text
share|improve this answer
    
Thanks for your answer! Unfortunately, I couldn't find a way to embed a file using this package without creating a visible icon in the document as described in my question. However, I came across the navigator package, which implements exactly what I need - see my own answer. –  diabonas Feb 5 '11 at 13:29
2  
@diabonas: \textattachfile{filename}{} should work. –  Leo Liu Feb 5 '11 at 13:33
1  
On 2011-04-12, the latest attachfile2 version was uploaded to CTAN, so you can now install the version supporting dvipdfmx by simply updating your TeX distribution. The temporary download link mentioned above doesn't exist any more. –  diabonas May 26 '11 at 16:51
add comment

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.