Pasting code into Keynote

Hi - does anyone have any tips on pasting code directly into Keynote from xCode. By simply copying and pasting it seems to screw up all the tabs. Thanks in advance.

Posted on Sep 21, 2005 10:35 AM

Reply
5 replies

Sep 21, 2005 9:44 PM in response to Vid Boi

Thanks. I tried that and it still isn't quite getting the tabs correct for some reason. I like the fact that the syntax coloring is maintained though.

Anyway, I also had to export to a powerpoint file (I know ... yuk, but the classroom where I'm teaching doesn't have a Mac available) and the colors were screwed up too!!

However, the pdf export solution still works perfectly, of course.

Sep 21, 2005 11:31 PM in response to Scaramanga

Not sure why it isn't working for you; it's working fine for me. The other thing you could try is converting the tabs to leading whitespaces.

In Xcode you can set the preferences so that the editor uses leading whitespaces instead of tabs. This makes it much easier to copy and paste code from one app into another. There are two places where you can specify these settings. One is under Preferences>Indentation and the other is under Preferences>Text Editing (deselect the box that says "Editor uses tabs"). You can specify the number of spaces for each tab, etc...

The above will only apply to any new code you write, so to convert the tabs in an existing document, do a Find/Replace operation within Xcode. Under the Find Options select "Regular Expression" and search for "\t" and replace with " " (four whitespaces or as many as you desire).

A mixture of whitespaces and tabs can cause funkiness so be sure you replace all tabs before pasting the text into Keyntote.

Hope that helps.

Vid

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Pasting code into Keynote

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.