Groff: Typesetting Documents on the Command Line (A pleasant workflow)

preview_player
Показать описание
Hello there kind people of the world, this is a walkthrough of my workflow with groff (GNU troff). There aren't too many helpful resources for groff online, so I thought I'd give it a go.

(1) Why should you use groff?
- If you're using a WYSIWYG (what you see is what you get) editor for your notes, then you should read others' arguments for why a markup language is preferable -- there are many (arguments... and reasons). Search up "arguments against WYSIWYG" or something like that.

- If you have a lot of free disk space and don't mind installing more programs, then by all means get LaTeX and use that instead. If you're like me and you barely have any space left on your computer, groff is preferable, as it comes preinstalled. Especially if you're on a Mac, you can set this up without doing much of anything (let alone installing anything new).

- You want to use your editor of choice, not be forced to use some word processing application made for geriatrics. Of course you can just take plaintext notes using whatever you'd like, but at least minimal formatting (like bolding/underlining) and conversion to PDF were things that I deemed necessary.

- TLDR; you don't have space and you want to type formatted notes in vim.

(2) Where can I find more resources for learning how to use groff?

(3) Ok, how should I start?
- If you're on Linux, make sure you have groff and ghostscript downloaded. If you're on a Mac, you're good as you are.
- Choose a set of macros (ms, mom, man, and so on)
- Type away young lad (reference the relevant macros and syntax by searching for the documentation online). More info is provided in the video. Maybe take an example file from online and edit it for your purposes.
- If on Linux, skip the conversion and simply tack on "-T pdf" to the end of the first command.
- If you're gonna be using eqn, tbl, or pic (preprocessors that let you do mathstuff, tables, and diagrams), tack on the "-e -t -p" flags in the first command.
- You're done! Open the PDF, observe, make changes, repeat.

(4) Gimme a good workflow:
- Bind a keyboard shortcut in vim that compiles your current file and opens it as a PDF -- this would simply save the file and call the compiling script on it.
- Simply make changes and continuously compile the file with the keyboard shortcut in vim to see the changes.

Errata:
Рекомендации по теме
Комментарии
Автор

The more time passes the funnier it is to me that I made this video. There are some useful tips in here but I don’t really know what I’m talking about at all :-). If you’re a noob this will probably be helpful, otherwise maybe seek out some written documentation or a more experienced host

josh
Автор

Because groff follows the unix-philosphy, you can basically do anything you want with it!
You can run source codes like pyhton, latex, gnuplot or whatever have you, from within a groff document.
I have written so many macros in groff that I don't see myself using any other document typesetting systems in the near future.

pewolo
Автор

by the way, you can use "-T pdf" to tell groff to output to pdf instead of .ps

porteal
Автор

groff is definitely pre-installed in linux

porteal