Live data from Hacker News

How I Wrote My Book

kevinwmcconnell.com

11–20 of 23 posts

Re: How I Wrote My Book

#11
Very cool. I co-edit Peter Shirley's _Ray Tracing in One Weekend_ (https://raytracing.github.io/) and have taken a similar approach, though with a different toolset. At some point if I find the time, I'll write up a similar article on our approach and what we've learned. Our books are open-sourced on GitHub (https://github.com/raytracing/raytracing.github.io), and we also use GitHub to host our books.

Basically, we use Markdeep (https://casual-effects.com/markdeep/), a _very_ powerful Markdown implementation with a bunch of built-in features. The killer feature is that with a handful of boilerplate lines (UTF-8 declaration at the top, and JavaScript loader at the bottom), you get content that automatically self-transforms in the browser into a full HTML document. This eliminates any build step, and means you can treat it as you would any other HTML file, with optional CSS and other features. It also bundles in a LaTeX engine, ASCII diagram rendering, and a whole host of other features. If you look at the three ray tracing books, you can see how simple the source is, and how pleasing the final rendering.

Check out the books and the GitHub repo — it's a _great_ way to quickly and easily pound out a web book.

Re: How I Wrote My Book

#12
This is arguably within the context of "how to write books" -- what did you do to draw illustrations and figures? (I've taken a look at Inkscape. What I want to do is have line drawings of crystallographic shapes, so a constraint-based illustrator would be ideal. I've never understood why the ideas behind Ivan Sutherland's Sketchbook have never seemed to make it into existing drawing packages.)

Re: How I Wrote My Book

#13
I wrote mine in LaTeX. I remember that making terminal output fancy was a pain. Eventually I managed to even get scissors to indicate omitted output. I was proud of that. Example: https://bayimg.com/gAaLbAaHI

Then I had so many dependencies that I didn't want to update my computer anymore as it could break my build process and the Makefile which did everything from taking the .tex files, to image processing, to PDF generation and cover art integration. So I moved everything into a virtual machine. I still keep it around but I am too afraid to boot it nowadays. Would be pwnd in a second after years of no updates :)

Next time I write a book it'll be likely non-technical and then markdown should be fine.

My book was about IPv6 and since it is no longer up to date I stopped selling it. It's available at https://danrl.com/ipv6 (Book language is German, though)

Re: How I Wrote My Book

#14
For my book Hands on Scala, I did a totaly different approach: parsed markdown into HTML myself, used puppeteer to turn it into PDFs. I extended markdown with some macros to do the things I needed (e.g. named cross-references, two-column sections, graphviz diagram blocks, pulling in code snippets from the examples folder)

The build tool made it easy to import libraries like CommonMark-Java or ApachePDFBox to do what I wanted, wire in external tools like Puppeteer, and gave parallelism and incrementality for free. End result was The build pipeline is here, if anyone wants to take a look https://github.com/handsonscala/build. There's a link to the main website you can download samples to see how it ends up looking

Re: How I Wrote My Book

#15
post #6

Earlier quoted context omitted.

What's your opinion on doing it not "a la LaTeX" but actually in LaTeX? I mean, for writing the bulk of initial core text it's not much different than Markdown, but when you do get to the typography stage then it has all the things needed for the print layout.

Never written a book, but I have written a few reports in Latex, and I would say it is a miserable experience. Slow build times, horrible error messages, and so much markup for everything. I have taken the stance that all writing should happen in Markdown/Asciidoc/Pandoc/whatever minimal flavor you like and once content is complete, then port everything to Latex if necessary. Pandoc can spit out a reasonable .tex fil…

I've used Lyx to create Latex output. It was very nice.

Re: How I Wrote My Book

#16
> But when writing a book, pretty soon you run into things that Markdown doesn’t natively know how to do, and so you have to either look for extra tooling to fill in the gaps, or build support for those things yourself. There are open source projects that address some of this, but I didn’t see anything that would do everything I needed.

I'm surprised there's no mention of Pandoc, which does pretty much what the author wanted (at least at a high level) and works with markdown:

https://pandoc.org/epub.html

Re: How I Wrote My Book

#18
This was an interesting read. Thanks for sharing the template repository too. The part about “Writing one sentence per line” made a lot of sense for the source text and for diffs being easier to handle.

Overall, the process of writing text and turning it into a book format like ePub and PDF seemed a lot easier with this post (of course, this post is not for books with mathematical equations and other more stringent typography and layout requirements).

Re: How I Wrote My Book

#19
This is an interesting approach to self promotion.

Instead of outright saying “I wrote a book, you should buy it!”, you generate some form of meta-content revolving around your book, that ideally fits the kind of content that would be appreciated by the people on whatever platform you’re doing the promotion on.

Admittedly this ain’t exactly rocket science and in this specific case the actual agenda is so obvious as to make ones eye roll but it does make you wonder about other more subtle techniques being applied.

And very quickly this can lead to a form of existential crisis where you wonder if anything you see, even say on hn, has any actual value or maybe its all just people finding ways to hijack and abuse basic human neural mechanisms in order to generate revenue off of others.

And then you wonder, what does that make them? If these people and what they do are solely defined by what others find “interesting”, or by what can be profitable - what does that mean about who they are? Like, they are essentially non-entities, with no real human substance to them: they are the descriptions of our worst tendencies and reflections of economic mechanisms. I think this is called “soulless”.

Maybe I should write a post about how I wrote this post. Like subscribe and leave a comment :)

Re: How I Wrote My Book

#20

This is an interesting approach to self promotion. Instead of outright saying “I wrote a book, you should buy it!”, you generate some form of meta-content revolving around your book, that ideally fits the kind of content that would be appreciated by the people on whatever platform you’re doing the promotion on. Admittedly this ain’t exactly rocket science and in this specific case the actual agenda is so obvious as t…

> maybe its all just people finding ways to hijack and abuse basic human neural mechanisms in order to generate revenue off of others.

I'm not going to let your exceptionally cynical content hijack my neural mechanisms!

Post reply on HN