Below is the source text for creating this example pdf:
How to create a simple pdf file in FreeBSD using groff and ps2pdf
What you’ll need
Of course you will need a working installation of FreeBSD. I am using FreeBSD 10.1 at the time of this writing. I recently installed it on an old Asus EeePC 1000H that I was no longer using for anything. I do not use the Xorg X-server on this device, but instead do all my work in text based programs. I use CenterIM for chatting with friends, Mutt for reading and answering my emails, Vim for text editing and tmux for terminal multiplexing.
Besides the operating system, you will also need to install groff. This may be achieved either by installing a precompiled package ($>pkg install groff) or by compiling it yourself from ports (in “/usr/ports/textproc/groff” execute the command “make -C install clean” as root user). Once groff is installed, all you need to do is read some bigass manual on groff and its macros. Do not be discouraged or deterred by this\[-]even I didn’t read more than the basics, and look how nice this document turned out.
Writting groff code and compiling it into a pdf
There are several so-called macros available (groff is after all just a wrapper for gtroff). In my example I will use groff_ms (look it up on googlebing or
whatever). To begin writing a simple file, you might startup the Vim editor (or whatever other editor floats your boat). Call the file whatever you like, but
something like “test.ms” is what I would choose. Begin writing your novel and save when finished (remember to look up the man page for groff_ms to see how you may control the layout of your document).
Next step is to compile your document. Top tip: try executing “grog test.ms”. This will return the command that you can use with groff. In my case it advised
me to use “groff -ms test.ms”. This, however, does not produce a pdf. It outputs a postscript file instead, so you will need to convert it. And that is done with “ps2pdf”. So the full command would be: “$>groff -ms test.ms | ps2pdf – test.pdf”
Now, if all went well, you should have a reasonably nice looking pdf that was a lot easier to create than if you had used LaTeX. Great for composing a nice letter for someone, or writing down your favorite recipes. As you can see, the resulting pdf file does not yet look as `fancy’ as the ones I create with LaTeX. But it is nice have such a simple alternative, and not everything I write has to look like it was written to be submitted to a scientific journal ;-).