Live data from Hacker News

Brian Kernighan on the Typesetting of “The Go Programming Language” Book

rkrishnan.org

41–50 of 76 posts

Re: Brian Kernighan on the Typesetting of “The Go Programming Language” Book

#41
post #15

As a typesetting aficionado, I have tried most of the suggestions here (Prince, Troff, Lout, Docbook XML, Asciidoc, LaTeX, ConTeXt, .. except GUI typesetting tools.) TeX appears bad from a distance, mostly from hearsay, until you have to write an actual technical book of certain expected high production standards and you realize TeX gives you the best shot at doing so. There is a learning curve. It is an investment o…

I like LaTeX for formatting small works. But would a publisher be willing to take LaTeX input when producing a book?

many scientific and tech publishing houses have their own LaTeX styles (eg: MIT, nostarch).

Re: Brian Kernighan on the Typesetting of “The Go Programming Language” Book

#42
post #26
post #17

Earlier quoted context omitted.

XML may have been made for documents but it is certainly one of the worst language families ever for actually typing documents by hand.

You don't have to write the XML tags while you type. The hardest part about writing long-form technical prose is writing long-form technical prose. You can concentrate on getting that right, in the editor of your choosing, using placeholders for diagrams and layout elements. Then, in a second pass, mark the text up.

Indeed. And it's odd no one's mentioned Pandoc yet.

Re: Brian Kernighan on the Typesetting of “The Go Programming Language” Book

#43
post #27
post #15

As a typesetting aficionado, I have tried most of the suggestions here (Prince, Troff, Lout, Docbook XML, Asciidoc, LaTeX, ConTeXt, .. except GUI typesetting tools.) TeX appears bad from a distance, mostly from hearsay, until you have to write an actual technical book of certain expected high production standards and you realize TeX gives you the best shot at doing so. There is a learning curve. It is an investment o…

Sadly I have to work in Windows at times. Context seems to not be the most supported Windows platform. (The link to the Windows simplified package is 404) There is a New Installer http://wiki.contextgarden.net/Windows_Installation_new which does not contain a working binary. The only way to find anything for windows leads to a tar file. I still think there is a better way to do typesetting in 2016 but all I have seen…

I wish I could answer this.. but I'm a Mac and Linux user.

with the new "Bash for windows", it will hopefully get easier in future.

Re: Brian Kernighan on the Typesetting of “The Go Programming Language” Book

#44
post #34

Ironically this page typesets Prof. Kernighan's email in a tag so mobile users could enjoy scrolling left and right 100 times to read it.

Same here, to help future mobile readers:

Hi, Ramakrishnan --

Thanks for the kind words on the typography. The core formatting is just troff (groff, really) with the -ms macro package. We tried Latex briefly but neither Alan or I care for its output, and I personally find it impossible to control. Troff is the devil I know -- it's ugly and irregular in many ways but it will put characters where you want them.

The input was in XML, with a tag set of about 25 items for headings, paragraphs, index terms, program insertion, simple tables, and the like. A Go program converted this either into HTML for rapid viewing on the screen and potentially for an e-book version, or into troff for printing. Using XML was a mild nuisance when writing but the error checking was very helpful.

We wrote a variety of small Go programs and scripts to fix things up, including one that rewrites troff output to do vertical justification so all pages are the same height. There is also some fiddling with the generated postscript to put on printer's marks.

The fonts are Alan's choice, the result of a lot of work on his part to find them and get the right sizes and appearances. The handful of Asian characters were tough to get right; troff doesn't do wide Unicode characters properly, and there are a few places where we rewrote text to hide that fact.

The drawings are all Alan's work, using Google's drawing program. We toyed briefly with using pic but it wasn't really up to the job, and it would not have worked with HTML without a lot of work. We avoided mathematics beyond superscripts, and the tables are pretty limited; eqn and tbl would have been ok but again would not have dealt with HTML.

We should probably write a more organized description of what we did and make the tools available, though I think most readers are less interested in the process than you (and I) are. The other thing is that although one starts with grand ideas of being clean and orderly, by the end the process is somewhat of a mess, with a complicated makefile to keep it running.

Thanks again for writing.

Brian

Re: Brian Kernighan on the Typesetting of “The Go Programming Language” Book

#45
post #43
post #27

Earlier quoted context omitted.

Sadly I have to work in Windows at times. Context seems to not be the most supported Windows platform. (The link to the Windows simplified package is 404) There is a New Installer http://wiki.contextgarden.net/Windows_Installation_new which does not contain a working binary. The only way to find anything for windows leads to a tar file. I still think there is a better way to do typesetting in 2016 but all I have seen…

I wish I could answer this.. but I'm a Mac and Linux user. with the new "Bash for windows", it will hopefully get easier in future.

Well the BIG issue is you can't create new files on Window files only save as. I use virtual machines but my Window computers at work are long in the tooth machines.

Re: Brian Kernighan on the Typesetting of “The Go Programming Language” Book

#47

For anyone missing the lede here: the book is typeset in troff. This is astonishing because troff is 40+ years old and AFAIK hasn't gotten significant development in ~10 years. If it ain't broke don't fix it. http://www.troff.org/history.html

Kernighan has always used troff, so it is not a surprise that he is still using it. He can do things with troff that most people would have a hard time to do with LaTeX. On the other hand, this doesn't mean that troff is better, in fact as you said it has not been updated for a long time. For someone starting now, it is so much easier to learn and be productive with LaTeX instead of troff.

Re: Brian Kernighan on the Typesetting of “The Go Programming Language” Book

#48
> We wrote a variety of small Go programs and scripts to fix things up, including one that rewrites troff output to do vertical justification so all pages are the same height.

That sounds weird, why would they want that, wouldn't that make the pages pretty irregular internally? Like varying line heights..?

Re: Brian Kernighan on the Typesetting of “The Go Programming Language” Book

#49

> We wrote a variety of small Go programs and scripts to fix things up, including one that rewrites troff output to do vertical justification so all pages are the same height. That sounds weird, why would they want that, wouldn't that make the pages pretty irregular internally? Like varying line heights..?

Not if the paper is opaque and there are lots of snippets (you align the space of the floats, not the line height).

Re: Brian Kernighan on the Typesetting of “The Go Programming Language” Book

#50

> We wrote a variety of small Go programs and scripts to fix things up, including one that rewrites troff output to do vertical justification so all pages are the same height. That sounds weird, why would they want that, wouldn't that make the pages pretty irregular internally? Like varying line heights..?

Not if the paper is opaque and there are lots of snippets (you align the space of the floats, not the line height).

That makes sense, thanks.
Post reply on HN