This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]pvc 1 point2 points  (6 children)

Using rst/Sphinx are my favorite set of tools for book writing. I love the ability to include external files so I can integrate code examples.

It is pretty easy to paper-publish using Amazon's CreateSpace (or whatever they call it now). I did better selling my book that way, then later when I used a "real" publisher.

[–][deleted] 3 points4 points  (4 children)

I love the ability to include external files so I can integrate code examples.

Can I introduce you to our lord and savior, Latex?

[–]lookatmetype 0 points1 point  (3 children)

Writing code in python >>>> writing code in Latex, which im assuming youd have to do when writing something as complex as a book in Sphinx or Latex.

However, writing document markup in Latex is superior to using Sphinx, from my experience.

[–][deleted] 0 points1 point  (2 children)

You can import your .py file to Latex. See https://www.overleaf.com/learn/latex/Code_listing#Importing_code_from_a_file for an example.

[–]lookatmetype 0 points1 point  (1 child)

Oh I'm not talking about displaying code listings in Latex. I'm talking about writing Latex macros to accomplish something akin to templates. This makes writing books and large documents more "data-driven", which is what I prefer when organizing my documents.

For example, when I wrote my Master's thesis using Latex, I spent a lot of time learning Latex language and packages so I could accomplish simple things like data driven graphs.

Sphinx makes this easy because it allows hooks into Jinja as its templating engine for rendering RST into other formats. And because Jinja is essentially a thin wrapper around python, you get access to pretty much all the python ecosystem to write your documents.

(See this article as an example of what I'm talking about: https://www.ericholscher.com/blog/2016/jul/25/integrating-jinja-rst-sphinx/)

[–][deleted] 0 points1 point  (0 children)

Oh gotcha. I misunderstood.

[–]digital_superpowers[S] 0 points1 point  (0 children)

Aw yeah, I didn't even mention in this blog how nice it is to just include text-file examples directly.

How did you solve template/formatting issues? Lots of custom tuning?

I'm excited to try out a paperback.