
Brian Kernighan on the Typesetting of “The Go Programming Language” Book - melling
https://rkrishnan.org/posts/2016-03-07-how-is-gopl-typeset.html
======
baldfat
Sadly the tool used is not maintained currently

GNU troff is looking for a maintainer. If you’re interested, please take a
look at this general information about GNU packages and being a GNU
maintainer, and then email maintainers@gnu.org with a bit about your
background and particular interest in this package. Thanks.

Please note that maintaining this package requires assigning copyright to the
FSF, and ensuring that any future contributors also execute papers, since that
is what past authors and contributors have done.

------
FraaJad
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 of your time, but it pays off.

Also, it is not like LaTeX et al are standing still in time. There are
companies and teams working on improving the ecosystem everyday. I personally
like ConTeXt unless I'm doing a predefined template exists (for conferences
etc.,) where it makes sense to just use their LaTeX guidelines.

~~~
baldfat
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](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 are a bunch of smaller projects without much support.

Personally I would love a markup language redefined with built in PDF-X
support and a simple infrastructure. Context is Ruby, Tex, and ConText. I find
LaTex to work well (for the most part) but it is not very flexible but I found
the MikText Package Manager as a big step forward.

~~~
xemdetia
For LaTeX on Windows I enjoy [http://miktex.org/](http://miktex.org/).

~~~
baldfat
Well ConTex is in addition to MikTex

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

~~~
tambourine_man
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

~~~
ShaneOG
Thank you!

------
oxplot
Recently I've been playing with Prince [1] and I've found it to be very
powerful with excellent support for paged media. Given that HTML, CSS,
Javascript, SVG is used to build the document, it's also familiar to most
people already. There doesn't seem to be any open source competitor to Prince
though.

[1]: [http://www.princexml.com/](http://www.princexml.com/)

~~~
tomjen3
It also means your documents are locked to a proprietary standard that isn't
that widely used (compared to say MS Word) and as such, may not be totally
recoverable 10,20 or 30 years from now. You want to keep that in mind when you
choose which typesetting system to use - for the record, I keep a digital
diary that I intend should still exist 50 years from now. I use only markdown,
and the occasional entry that mention really private stuff is ascii encrypted
with GPG.

~~~
jnbiche
>It also means your documents are locked to a proprietary standard that isn't
that widely used (compared to say MS Word)

HTML and CSS?

~~~
tomjen3
I assume there is some additional special sauce that enables you to do things
that are not possible in a browser, which means you still won't get the exact
formatting, index, etc correct.

~~~
oxplot
To extent of my knowledge, Prince only implements web standards set by w3. The
reason browsers can't do what Prince does is because they lack support for
those standards.

Wikipedia lists some of what Prince does that others don't:

[https://en.wikipedia.org/wiki/Comparison_of_layout_engines_(...](https://en.wikipedia.org/wiki/Comparison_of_layout_engines_\(Cascading_Style_Sheets\))

------
bryogenic
Life:

    
    
        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.

~~~
andy_ppp
Yes! I loved that even Brian Kernighan can make a mess when trying to get
something done :-) There is hope for us all!

~~~
tambourine_man
Another way of looking at it is that, if even Kernighan can make a mess when
trying to get something done, there's no hope for anyone.

…

Your take on it is more uplifting

------
blue1
It's sad that a complete structure writing/publishing workflow is still so
hard. XSL-FO is awkward and limited, and will probably remain so. TeX is not
design-friendly. On the other side, InDesign is mostly visual only. Framemaker
seems to be only serious tool but it's very expensive.

~~~
Finnucane
I was a devoted FrameMaker user until Adobe killed the Mac product. I used to
have to do fairly complicated legal documents, and it was worth every penny.
Plus, it was a very good word processor--you never had to leave the program to
edit text. So I used it for everything I had to write.

A book like this could have been handled fairly easily in FrameMaker, but
sadly Adobe has decided to position in it to be only for large enterprise
shops running Windows. They're probably (rightfully) afraid it would
cannabalize InDesign sales if they made it more accessible.

~~~
shepard
Hm. I never heard of FrameMaker before, but their 2015 release is available at
$29.99/month, which is hardly "positioned only for large enterprises".

~~~
Finnucane
Yeah, just out of curiosity I looked at what the current deal was, and that
might almost be reasonable if a) I were still going to be using it every day
and b) there were still a Mac/Linux version. I wouldn't do a subscription deal
it just for personal use, but that's a different issue. But 'positioning' is
partly a marketing thing. Not having a Mac version clearly separates the
product from Indesign for a lot of users.

------
Tomte
Heirloom troff supports OpenType and OpenType features. I still haven't found
time to look into it, but it sounds awesome.

------
girzel
Written in XML?! That's the first I've heard. Though also a fine proof that
_what_ you're writing is much more important than _how_ you're writing it.

(Still, though -- XML?)

~~~
insertnickname
Why not XML? XML was made for documents, they were writing a document.

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

~~~
insertnickname
What would you use instead that would allow you to define your own markup?
LaTeX? \em{Hello} isn't much better than <em>Hello</em>.

~~~
zeveb
Sure, a single small example looks almost (but not quite) as bad, but in
larger texts LaTeX is basically the text-you're-writing, plus some control
stuff, whereas XML interferes with _everything_.

------
NelsonMinar
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](http://www.troff.org/history.html)

~~~
jklowden
I wrote to Kernighan a few years ago, when "D is for Digital" came out, to ask
him, in effect, if troff had been made obsolete by TeX. At the time I had
begun using it, and wondered if it was worth investing my time to learn.

He answered that he still preferred to use groff, having tried alternatives.
Since then I have used groff exclusively for writing documentation and papers.
It never runs out of gas, and always produces attractive output. It offers a
complete suite -- math, tables, pictures, graphs -- all in one package. It's
fast, adaptable, and easy to learn. It has the highest ratio of text to markup
of any typesetting system, including TeX and Markdown. It is the single most
overlooked and under appreciated project on the planet.

Whether it's had "significant" development in the past 10 years depends on
what that means. Current groff produces PDF format directly, without a
Postscript intermediary. The PDF macros support links and TOC generation. I
think that all took place in the last few years.

~~~
claystu
What platform do you write on? Linux? Mac? I'm genuinely curious.

I have been looking for substitutes to Latex ever since writing my
dissertation in Latex and having to debug/tweak an already horrendous Latex
.sty file. I basically decided that I would either write technical documents
in Tex or not at all after that. For me, Latex is great, until it isn't, and
then it's Jinga-on-a-unicycle frustration.

~~~
FraaJad
The problem with LaTeX is that you are given an already unstable jinga (ie.,
style file etc.,).

You can always go back to the basics and use simple TeX for your documents if
you think groff/troff is simpler.

However, I'd encourage you to give ConteXt
[http://wiki.contextgarden.net/](http://wiki.contextgarden.net/) a try because
it is the spiritual successor to TeX (one tool for all the typesetting)
instead of having to depend on "third party" stuff like LaTeX, most of which
very few of us (outside the original sty author) understand.

------
elcapitan
> 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..?

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

~~~
elcapitan
That makes sense, thanks.

------
frik
HTML with CSS with lend itself to generate PDFs. Are there open alternatives
to Prince XML? Browsers don't support all page-layout related CSS2/3
attributes, like a page break.

~~~
noir_lord
wkhtmltopdf has some extensions for forcing a page break etc.

I used it for generating some documents from a groundup rebuild of bootstrap
meant purely for printing (meant we could just use a lot of the web templates
with minor changes) and it worked pretty well for our uses.

PrinceXML however is in a class of its own (as you'd expect for $3.8k per
server)

