How very lame, I know. Not only am I using Windows instead of Linux, but I’m using Lyx instead of LaTeX! The shame. However, I recently had to put together a rush-job document and my LaTeX is a little rusty. So sue me.
In doing so, I came across what I’m guessing is a quite common scenario: I wanted to include other content, such as an Excel spreadsheet and some PDF documents as addenda. I figured that it would be easiest if all my attachments were in PDF form. So I dutifully saved all my attachments as PDFs, and set out to include them in my Lyx document. Easy as pie, right? Boy, how wrong I was.
Now, I know that LaTeX as a whole and Lyx are geared towards the Unix community. I have always found that things always Just Work from inside an Ubuntu install, for instance. I understand that development is geared towards that audience. But I would be remiss if I did not mention the following.
In the default install of Lyx 1.6.7 for Windows, there is a dialog (Insert => File => External material => [select Template pdfpages]) to include a PDF document inside a Lyx document. This dialog does not work! On my install, it fails with the following error: “pdfpages.sty not found” (or “eso-pic.sty not found”). Additional steps are required to resolve this error.
The steps are the following:
- From your start menu, right click and run as administrator the following entry: MikTeX => Maintenance (Admin) subfolder => Package manager (Admin)
- Right-click, select Install, for the following packages: eso-pic, pdfpages
In some cases, I have found that only the first few pages of a PDF are included. To fix this,
- Click on the embedded PDF. This brings up the “Lyx: External Material” dialog.
- Click on the “LaTeX and Lyx Options” tab and enter the following: “pages=-“. This tells LaTeX to include all pages.
Additionally, if you wish to insert a table of contents (TOC) entry for the included PDF, you should add something like this to that same options line:
addtotoc={1,section,1,My PDF,my_pdf}
Combining the two options I’ve just mentioned looks like:
addtotoc={1,section,1,My PDF,my_pdf},pages=-
Here’s a video of me going through the entire process (and making a few mistakes along the way). You’ll notice that my initial TOC entry is incorrect, and the first PDF that is generated does not include the whole PDF that I’m attempting to include (thus the adding of the pages=- option).
that is the most helpul advise I found for this kind of problem. thank you very much!
Thank you for this tip. It helped me.