thoughtbot / ios-on-rails

A guide to building a Rails API and iOS app
Other
76 stars 6 forks source link

Recommendations for Objective-C source code in EPub and PDF #57

Closed conradwt closed 10 years ago

conradwt commented 10 years ago

Here's are a few recommendations which works well for ebooks in regards to Objective-C source code:

EPub/PDF

EPub (Only)

In short, these are just a few things that makes it easier to read Objective-C source code within an EPub and a PDF ebook.

dazmuda commented 10 years ago

Thanks for these resources! Making the Obj-C code snippets readable inline has definitely been an interesting challenge.

Font size

I really like that idea of having a smaller font size for our code snippets. Wrapping to 80 characters is standard practice for our rails developers, but having to wrap to 80 characters so the Obj-C code will fit on the page has resulted in some very odd formatting. Shrinking the code snippet font size would definitely help with discernability AND readability.

Syntax highlighting

Obj-C syntax highlighting is a feature that isn't currently supported by the internal tool we used to generate these PDFs and EPUBs, but it's definitely something I would love to have.

Code images

Including images of the code is a great idea, as larger font sizes can make the code snippets look quite bizarre on EPUB. I think I would like to do this once the book is out of beta. Plus, then I can show off my sick awesome Xcode color theme. Spoiler alert: it looks a lot like Monokai and is actually probably not all that good for EPUB.

Also, thanks so much for mentioning specific books. They're really good visual references for formatting!

dazmuda commented 10 years ago

Thanks for these suggestions!

I'm going to close this and submit a font and syntax highlighting request per your suggestion to the thoughtbotter who wrote the internal tool we used to generate the PDFs and EPUBs.

conradwt commented 10 years ago

@dazmuda After looking at quite a few Apple published PDFs and EPubs, I would also recommend increasing the horizontal width of the document which would allow one to increase the text font for both EPub and PDF. Thus, I would look at the following on a 15" display where the document is opened at full screen using the two page view with Zoom To Fit:

https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/Blocks/Blocks.pdf

Here's another examples which are not specific to Objective-C but you can see the technique at work here:

https://itunes.apple.com/us/book/swift-programming-language/id881256329?mt=11