Reprinted from TidBITS by permission; reuse governed by Creative Commons license BY-NC-ND 3.0. TidBITS has offered years of thoughtful commentary on Apple and Internet topics. For free email subscriptions and access to the entire TidBITS archive, visit http://www.tidbits.com/ Push-button Book Publishing with Leanpub Adam C. Engst Book publishing used to be a labor-intensive occupation, full of tedium and repetition, but such drudgery could be a thing of the past, thanks to a new system called [1]Leanpub, with which we've just published our latest title: '[2]Take Control of Dropbox.' Leanpub relies on a number of key tools ' the Markdown language, Dropbox, LaTeX, CSS, and a Web-based interface ' to enable a quick and efficient book publishing workflow. For my earliest books, I had to FedEx final Word files and screenshots to my publisher on CD-R, along with printouts. Those files were laid out in PageMaker, and we pored over the galleys to eliminate errors introduced in layout. At least it was mostly digital ' a friend was just telling us about how his first book was retyped (badly) in Ireland, to be entered into some early publishing system. But you know what? For a single book, that's not terrible. Publishers got away with such inefficiencies because labor was cheap and the alternatives didn't scale well. In fact, despite its whizzy features, Apple's iBooks Author software comes from such a tradition, lacking, as it does, the change tracking and commenting capabilities that are necessary for any professional author-editor workflow. When we started the Take Control book series nearly ten years ago, we knew we couldn't afford to play such a labor-intensive game, so our authors have always written directly into their final layouts, using detailed style sheets in programs like Microsoft Word and Pages that provide change tracking and commenting for the editing process. We adopted Dropbox quickly when it came out, since it makes swapping versions of a book between author, editor, and publisher trivially easy. When possible, we even take advantage of time zones so we can eliminate some dead time while different people work on the same manuscript. However, our Achilles heel has always been production, where we strive to create ebooks in the most common ebook formats. A lot of that effort goes into making PDF bookmarks and links. Back when we used Word, we cobbled together a system that relied on a squirrelly detour to Word for Windows to generate links and bookmarks. Although Pages makes PDF links, it does so in a long-broken fashion (doubling the PDF link boxes for each link), and it can't create bookmarks at all, requiring us to use the [3]Debenu PDF Aerialist plug-in for Adobe Acrobat Pro. Pages can put out an EPUB that looks decent, but it's so horribly constructed with regard to its CSS styles that fixing its EPUB requires a complex production step and a brittle BBEdit text factory. Worst were Mobipocket versions for the Kindle ' until our last book, we had our publishing partner O'Reilly Media create them because they're so hard to make properly. Happily, thanks to a tip from our friend Serenity Caldwell at Macworld, I figured out how to make our own high-quality Mobipocket for last week's minor update to '[4]Take Control of Using Mountain Lion,' but the process is fussy and complex. In essence then, there are two distinct phases of book creation: writing/editing and production. In the first, powerful authoring environments with change tracking and commenting are essential, and drafts need to be moved between author and editor quickly and seamlessly. In the second, the Holy Grail is a push-button system that takes a manuscript and kicks out nicely formatted ebooks in PDF, EPUB, and Mobipocket, complete with clickable links in all formats and with bookmarks in the PDF. I periodically scour the Internet for such systems, and have found several that seemed promising, including [5]Booktype, [6]PressBooks, and [7]Atavist. But when I looked deeper, I'd run into problems. Phase 1 issues revolved around the use of online editing environments that can't compete with a real word processor, the replacement of change tracking with after-the-fact comparison, and the lack of commenting on selections of text. Phase 2 troubles were related to the inability or difficulty of styling the output as we wanted ' the defaults weren't terrible, but they weren't necessarily up to our standards. Leanpub popped up in one of my searches, and I was intrigued by how they used a variety of existing tools at the surface, rather than building a platform from scratch. The writing and editing in Phase 1 of the publishing process in Leanpub happens in straight text files coded in the Markdown language, with which we're totally familiar because it's what we use for TidBITS. Those files live in Dropbox folders, which we would use anyway, and when you click a button on the Leanpub Web site, it transforms copies of those Markdown files into PDF, EPUB, and Mobipocket ebooks. Markdown may be easy to write, but with TidBITS, we simulate change tracking using the Subversion version control system and BBEdit's comparison feature. And we put comments in HTML comment style within the text. Neither of these approaches are ideal for book-length manuscripts. Although there's a messy way to compare versions of Dropbox-managed text files using the [8]DropboxDiff Chrome extension, comparing files is far clumsier and more confusing than change tracking, and intra-textual comments clutter a manuscript (and deleting them messes up comparisons even more). That was when I had a brainstorm ' we could write Markdown in any word processor, complete with change tracking and commenting, and then export to text for the Leanpub process! And better yet, since we were planning to test this system with Joe Kissell's '[9]Take Control of Dropbox,' Joe and I could use [10]NisusWriter Pro, our favorite writing tool of yesteryear, now back in force. NisusWriter Pro has full change tracking and commenting capabilities, plus powerful grep-based searching and macros that helped in creating the Markdown. We used character and paragraph styles in NisusWriter to differentiate various elements of the book visually as well, which made editing easier. Even with NisusWriter Pro, writing and editing Markdown in Phase 1 with Leanpub is still clumsier than working in Pages, because links must be constructed manually each time, graphics must be referenced as external files in a special folder, and things like nested lists with internal screenshots require extremely careful attention to Markdown rules. But it all worked, and it was huge fun to run a NisusWriter macro that exported the text and then click a Preview button on the Leanpub Web site to generate in-progress versions of the book in each format. When I found them, Leanpub had just moved from serving only self-published authors to working with small publishers like us as well. They call the concept behind the company '[11]Lean Publishing,' and the idea is to provide free, lightweight tools that make it sufficiently quick and easy to generate ebooks that authors will make in-progress versions available for readers while they write. (We chose not to do that with '[12]Take Control of Dropbox' because we were feeling our way into the system.) To pay the rent, Leanpub acts as a non-exclusive bookstore for the books their users create, charging an entirely reasonable 50ยข plus 10-percent of the selling price per copy. And yes, [13]you can buy 'Take Control of Dropbox' through Leanpub for the same price as on our site, though we're as yet unsure what the overall user experience will be like. (For instance, I just realized that customers on Leanpub can pay more than the cover price of $10 if they wish; a nice touch!) Thanks to their new focus on small publishers like Take Control, the Leanpub guys are constantly refining and improving their system, particularly with regard to the Phase 2 production step, and it has been a pleasure to work with them. For instance, we were planning to open their EPUB and insert our own CSS into it for custom formatting, but while we were discussing that with them a few weeks ago, they made our lives easier by including in the EPUB a custom.css file that we could place in the manuscript folder and have built into our EPUB. Of course, this benefits everyone who uses Leanpub, but it was still nice to feel acknowledged. However, although custom CSS improves EPUB and Mobipocket, their system relies on LaTeX for PDF generation, and while the PDF they're putting out isn't bad, when push came to shove, we decided it wasn't something we felt comfortable giving to Take Control readers. In particular, the LinLibertine font was ugly in some versions of Adobe Reader (and Leanpub offers no font family control at all), the font size was too small, and the line length was too long. We also preferred our style of colored boxes behind notes, tips, and sidebars. Alas, Leanpub couldn't fix all this just for us. Leanpub does have a solution to the desire for a custom PDF, but it's not yet ready for prime time, nor are we ready for it. Along with kicking out PDF, EPUB, and Mobipocket (plus HTML, either as a single file or one file per chapter), Leanpub can create InCopy Markup Language files for the book. InCopy Markup Language is a story-specific subset of InDesign Markup Language, an XML-based format that represents an entire InDesign document. The idea is that we could place these InCopy Markup Language files in a laid-out InDesign template, where they'd pick up our pre-defined styles. Changes to the source files could be automatically reflowed in InDesign. We would essentially be using InDesign as an engine for PDF creation. InDesign could also theoretically export EPUB and Mobipocket, though Leanpub's versions of those ' with our custom CSS ' is good enough already. So for '[14]Take Control of Dropbox,' we decided to fall back on our traditional process for PDF. A quickly generated NisusWriter macro stripped the Markdown formatting from our manuscript and made sure that everything was assigned style names. Then we opened NisusWriter's native RTF file in Microsoft Word, saved in Word format, and imported it into Pages, where our Take Control styles took over. Tonya added the internal and external links back in manually, and placed and resized the graphics, adding several tedious hours to our normal production process. We took the opportunity to play with the interior design a bit too, since the other new part of '[15]Take Control of Dropbox' is its use of our new cover design, created by Sam Schick of [16]Neversink, using a logo designed by Geoff Allen of [17]FUN is OK. (The cover colors will vary from title to title.) The new logo and cover are the first steps in a major visual redesign for Take Control, with some small changes in the book interiors as well, to match the cover color and address some things that we'd been wanting to try for a while ' notably, we've hidden most external URLs, since they're long and ugly in running text, differentiating them in the PDF from internal navigation links by a light underline. Once we're certain of the tools we'll be using ' Pages or InDesign or something else ' we'll look harder at the interior design. (The final part of the process is a new Web site design, and while the look is done, a lot of ExpressionEngine code needs to be updated and modified, and that's taking a while.) We are planning to work our way into Leanpub slowly, since authors and editors have varying amounts of experience with Markdown and NisusWriter Pro, so we won't be using them for every forthcoming book. But Leanpub is the most interesting development we've found in the book publishing world in a long time, and we're looking forward to the time when the production phase of the publishing process truly does come down to the click of a button. References 1. https://leanpub.com/ 2. http://www.takecontrolbooks.com/dropbox?pt=TB1172 3. http://www.debenu.com/products/desktop/debenu-pdf-aerialist/ 4. http://www.takecontrolbooks.com/mountain-lion-using?pt=TB1172 5. http://www.sourcefabric.org/en/booktype/ 6. http://pressbooks.com/ 7. https://www.atavist.com/howitworks/ 8. https://chrome.google.com/webstore/detail/dropboxdiff/aefdkgcdokdiaoppobphjogcilaaakka?hl=en-US 9. http://www.takecontrolbooks.com/dropbox?pt=TB1172 10. http://nisus.com/pro/ 11. https://leanpub.com/lean 12. http://www.takecontrolbooks.com/dropbox?pt=TB1172 13. https://leanpub.com/tco-dropbox 14. http://www.takecontrolbooks.com/dropbox?pt=TB1172 15. http://www.takecontrolbooks.com/dropbox?pt=TB1172 16. http://neversinkcreative.com/ 17. http://www.funisok.com/ .