How to Write a Book in Emacs (2015)
masteringemacs.org
masteringemacs.org
* https://www.xmlmind.com/tutorials/HTML5Books/HTML5Books.html
I find the concept of DITA very interesting: to write reusable chunks of content (called "Topics"), that one can later map into chapters and sections to generate a whole manual. DITA is geared towards creating manuals, but got me thinking it would be a useful way of splitting content for books and even blog posts.
Mallard seems inspired by DITA but more minimalist. Looks pretty cool if I was generating documentation for a software product.
The last resource is what I will actually try [1]: "XMLmind Ebook Compiler (ebookc for short) is a free, open source tool which can turn a set of HTML pages into a self-contained ebook. Supported output formats are: EPUB, Web Help, PDF, RTF, WML, DOCX (MS-Word) and ODT (OpenOffice/LibreOffice)."
Similar to the author of the OP, I also like PDF better than other formats for reading ebooks.
In short, it worked great. Can't imagine choosing to write a technical book like that in any other editor today.
Wouldn’t this be a distraction and an unnecessary cognitive load?
If you want to compare restructured text with R markdown, then they are simply different tools for different problems. If you want to embed code/figures/tables directly in the writing, R markdown is difficult to beat. Personally I would tend to prefer writing in either latex or markdown, but my reason is similar to the author's: I know latex and (R) markdown much better than I know restructured text.
For Dercuano I mostly just used Markdown (in Emacs and occasionally Vim, with Git) but then at the end I wrote a janky HTML renderer that outputs PDF in order to have a format people can read on cellphones. If I hadn't done such a rush job on the HTML renderer, I think it would have come out pretty well.
A couple of aspects that did work well were Latin Modern Mono Condensed Light (lmtlc), a TeX font derived from Computer Modern Teletype, page-number links, and Reportlab. lmtlc made it possible to produce a PDF that can display 80 columns of fixed-pitch text on a cellphone screen at a readable size, although I had to fall back to FreeMono for characters outside lmtlc’s repertoire and for boldface. And page numbers make it possible to follow links in Google Drive’s inept PDF viewer, which otherwise lacks any such ability and is disappointingly the Android default, with about 15 seconds of focused effort. Not great, but not bad for a 3700-page book. And Reportlab, a PDF output lib for Python 2, is just a pleasure to work with, which is a phrase very rarely found near the word “PDF”.
The PDF renderer is at https://github.com/kragen/dercuano/blob/master/genpdf.py but probably it would have been a better use of time to figure out how to do it in pandoc, which has an actual box model, even though Petersen isn't enthusiastic about his experience with it.
Readability on cellphone screens is really difficult, demanding a lot of compromise, and I'm very happy with what I was able to achieve there. With another couple of days I would have added hyphenation and justification, which would have made it considerably better still. The result is at http://canonical.org/~kragen/dercuano.20191230.pdf.
Emacs and VSCode (the two editors I use) have great support for markdown and the leanpub work flow is very nice.
1) A left hand pane with a tree structure of everything, including chapters, headlines, figures and tables. Dragging and dropping should move sections and the tree should understand that chapters are stored in separate files.
2) An autocomplete for referencing the above.
3) An autocomplete for references in my bib file (and no, I shouldn’t have to remember which paper acl2008a is. I should be able to autocomplete on name or author or date and see exactly which paper I’m pointing to)
Still a good read.
That description of the editing process sort of convinced me not to try emacs for this.
I like org mode too, but giving up the editing for org mode doesn't seem like a fair bargain.
edit: I know this author doesn't use org-mode. I was just pointing out my favorite feature of emacs.
But isn’t the crux that if you can program, you can often land another job that pays much more than being an editor?
[Edited]
Also, in the same way I have vim key bindings enabled for everything that supports it, a lot of UIs come with emacs bindings out of the box, so it is useful to learn some of them.
Or is the AZW/KFX format similar enough to HTML that - like with ePub - a generic HTML file will get you almost everything you need (plus some metadata and a simple conversion)?