[OS X TeX] Shadows of pdf in Keynote

Jens Noeckel noeckel at uoregon.edu
Sat Apr 5 01:14:38 EDT 2008


On Apr 4, 2008, at 1:02 PM, François Chaplais wrote:

> I have just had my first experience of teaching a course using  
> Keynote 4 ('08 version)
>
> My personal taste, as a result of my own experience, is that a  
> slide should have little text, even fewer maths (2 lines max). So I  
> am a very happy user of LaTeXit with Keynote; I can choose the  
> color of the LaTeXit output with the color picker to match the  
> color of the usual text, and I can even use the same font using  
> XeLaTeX+fontspec in LaTeXit. I have not used LinkBack for the  
> moment, I am happy with the history of LaTeXit.
>
> And, of course, drop shadows etc.. work nice. I have drag and drop  
> the LaTeXit PDF into "intelligent compositions", which are useful  
> if you you want to hilite several consequences of a result.  And I  
> do basic graphic editing with Intaglio. For instance, I can combine  
> a Matlab output with an equation from LatExIt into Intaglio, save  
> the intaglio fine for further reference, and paste into keynote.  
> Or, if I want to illustrate the iterates of a transform, I use an  
> "intelligent" composition to display them one after the other...
>
> And, yes, (in another presentation) I even copied/pasted tabular  
> data (a benchmark) into a Keynote graphics, and, presto, Super  
> glossy 3D chart to convince that my algorithms is more accurate,  
> uses less CPU and makes coffee
>
>
> Now, I'll grant you that I am not a TeXShop power user...
>
> François
> on "Tiger" 10.4.11
>
> Le 4 avr. 08 à 19:15, Martin Costabel a écrit :
>> Chris Goedde wrote:
>> []
>>> Keynote 3 is broken, though, it doesn't correctly recognize the  
>>> cropping of pdf's done in Preview (don't know if that's different  
>>> in Keynote 4).
>>
>> Copying from Preview to Keynote 4.0.3 is a catastrophe. It does  
>> not paste the selected part of the page, but the whole page off- 
>> center instead. This is terrible, because it is the most important  
>> feature why I was using Keynote (and paid money for the new  
>> version). If one cannot paste pdfs any more, and with transparent  
>> background, the whole thing is worthless. Combine this with the  
>> fact that Keynote crashes instead of starting on this machine here  
>> (a new iMac with 10.5.2 preinstalled), unless I kill the "pboard"  
>> process first, and I am really starting to get very angry at  
>> Apple. :-(
>>
>>


Hi,
reading this, I tried it out on my Leopard machine, with Keynote 3 (I  
have Keynote 4 on a Tiger machine that I use predominantly). And of  
course, as Martin said, the copying from Preview is totally messed up.

But I figured out a way to fix it, using ghostscript. Here is a  
python script that has to be invoked ater you copied a selection in  
Preview. When the script is done, the clipboard will contain a  
"fixed" version of the copied selection. Now just switch to Keynote  
and paste from the clipboard, and you get only the desired cropped  
portion.

I didn't have time to put in the extra fluff to make a temp file and  
delete it again when the script is done, and of course I should wrap  
this up as an "Application" for Terminal-averse users. Also, it  
doesn't perform any error handling. I'll probably add this if someone  
lets me know that it works with Keynote 4 on Leopard. I only tested  
it with Keynote 3 on Leopard, as mentioned above. It's just the proof  
of principle...
Jens

Here's the code:
Save this script as "clipPDF" somewhere in your PATH, and run it in  
the Terminal with "clipPDF"  everytime you have copied a PDF  
selection to the clipboard. I'm using fink's python and PyObjC for  
this script - knowing that at least Martin is likely to have that  
installed. It would be easy to translate this back into Cocoa as  
well, but python is just so much faster to write.

#!/sw/bin/python2.4
import os,sys
from AppKit import *
from Foundation import *

pathname="/tmp//test1.pdf"
outname="/tmp/test1a.pdf"

board=NSPasteboard.generalPasteboard()
result = board.dataForType_(NSPDFPboardType)
if result:
         print "Got something"
         result.writeToFile_atomically_(pathname,1)

rr=os.spawnlp(os.P_WAIT,"gs","gs","-sDEVICE=pdfwrite", "- 
sOutputFile="+outname, "-q", "-dbatch", "-dNOPAUSE", pathname, "-c",  
"quit")

content=NSData.dataWithContentsOfFile_(outname)
board.declareTypes_owner_([NSPDFPboardType], None)
board.setData_forType_(content, NSPDFPboardType)






More information about the MacOSX-TeX mailing list