Leanpub appears to be a great way to share or sell in-progress or final version of a textbook.
The principle is quite simple: You write a book using Markdown, which you can store on Dropbox or GitHub, and it get formatted as PDF/EPUB on Leanpub website; you then propose a minimal price, and get your money each month via PayPal. Of course, you can offer your book for free. Regarding royalties, here is what we find on the FAQ:
We pay a royalty of 90%, minus 50 cents, on your paid purchases. Royalties are paid at the beginning of each month via PayPal, once a minimum amount of $40 is reached. Our 10% covers all the PayPal fees, both on the sale of the book, and on the payment of royalties to you.
Interestingly, Leanpub relies on a superset of Markdown: Markua. Markua Specification can be read online, and other information on the editing/publishing process can be found in Leanpub manual. At the time of this writing, I was not able to find any implementation that could replace Markdown or MultiMarkdown.
Some folks from the Johns Hopkins University are currently Leanpub to publish very nice textbooks on the use of R for data science, inspired by their nice tutorial from the corresponding Coursera specialization. Here are the gems: The Elements of Data Analytic Style, Statistical inference for data science, R Programming for Data Science, and Exploratory Data Analysis with R (in progress). The book on R programming is really a great one.
As someone who spend a great part of his time writing tutorials, blog posts, or statistical report, a text-based workflow is essential to me, and Markdown soon became my markup language of choice. I generally write text in Emacs and preview Markdown output using Marked 2 which is one of those wonderful applications that you don’t want to miss if you are working on a Mac. If I want more fancy outputs (i.e., other than PDF/HTML), I can use Pandoc, of course, but Marked.app already offers Pandoc integration (see also Plain Text, Papers, Pandoc). I wonder why the Python community keep using rst with Sphinx.1 I should note that there are some great alternative to Sphinx, e.g. MkDocs.
On a related note, some time ago I started writing a GitBook using the dedicated editor that was provided on the website, and even started to hack the Rgitbook package to make it works. Now both projects seem to be dead and GitBook offers an in-browser editor, which I do not find very convenient for working off-line as is often the cases for me. I noticed that Jan de Leeuw was also offering a series of textbook on Block relaxation algorithms in statistics, and is now only using the editor to upload his books to GitBook.
I should note that there are great websites, like The Hitchhiker’s Guide to Python! or https://readthedocs.org, that are written entirely using rst. ↩︎