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.
5 replies
To answer my own question 🙂 What I'm doing now is printing a PDF from xCode, then drawing a marquee around the code I want in preview and copy & pasting that into keynote. It looks good, but it would still be nice to just copy and paste the text without the tabs being screwed up.
Try pasting your code in a new text box (the box you get from the menu Insert>Text).
Keynote removes the tabs when pasting text in Title or Subtitle placeholder text boxes. Tabs are preserved when pasting in a fresh text box.
By the way the colors from XCode are preserved as well. Pretty cool!
Keynote removes the tabs when pasting text in Title or Subtitle placeholder text boxes. Tabs are preserved when pasting in a fresh text box.
By the way the colors from XCode are preserved as well. Pretty cool!
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.
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.
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
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
Thanks - I'll give it a go.
Pasting code into Keynote