I've used *roff for a few basic things, along with roff2pdf or roff2text for delivery, but I always had frustratingly basic output. This is the best explanation of Nroff's formatting syntax I've seen, and I think it renews my interest in Nroff for practical use.
I am really liking this exploration into some of the early Unix utilities. It would also be kinda cool to look at some of the DOS ports of them as well
It's not what you asked, but I also did a conference talk about "Why DOS was [and is] a Thing": th-cam.com/video/3E5Hog5OnIM/w-d-xo.html And I did another video when I started the channel about a brief history of MS-DOS: th-cam.com/video/ZtXTAYT2DFM/w-d-xo.html [edit:added the history video]
Back in mid 2010s I used roff (likely groff) for a couple assignments in uni, to make it a bit more fun, and was quite surprised by how nice the PDFs I managed to get out of it were. I had used troff to write a couple small man pages before but the experience with the papers was much better. And in some ways less frustrating than with LaTeX.
But you know *roff is a standard, but in reality Markdown no. You can process your *roff text with nroff groff, but Markdown has many dialects and extensions that not all tools/sites support
Really nice video Jim! I've been using Unix for 30 years (started when "Mark Williams" Coherent dropped in price in 1993) and this is the best explanation of NROFF that I have ever seen. You make me want to use it again!!! Can't beleive I just said that... Anyways thanks again and cheers from Canada!
When I was a teacher for pharmaceutical assistants I wrote all my stuff with groff! I had a nice tcl program which put the questions in the right order, than I ran a pipeline with m4 macro processor and pdfmom from Peter Schafter when I clicked a button. It was blazingly fast and typed all the text in a nice mono spaced font. Loved it! LaTeX maybe is more nice but groff is small and fast and looks nice to my eye.
Thanks! I really like nroff and groff too. I'm currently re-learning the '-me' macros, especially the "right" way to make a cover page. I think the *.tp* macro is best used for shorter documents (like a short paper) that shouldn't have a header/footer on page 1. I'm sort of misusing the *.tp* and *.bp* macros when I add my own centered text - but it works fine on nroff. ☺
Wonderful video! I too do all of my university assignments in plan9's troff to all of my professors' stupefaction. I sometimes joke that I wouldn't mind becoming a typesetter if I could do the job in troff :D
I really enjoy writing docs in groff -me these days. I find that once I start writing, I get into a "zone" where I don't really focus on the formatting, it's more about the content.
Brings back memories for me. I remember that I found somewhere a nroff implementation for Dos and could use it there, too (maybe it was more restricted than the nroff part of groff). On Linux you had postscript viewers like ghostview or, better, gv, in the early 1990s.
We have an nroff implemention on FreeDOS (called nro) but the requests are slightly incompatible with Unix standard nroff. We also think no one uses it (because DOS has so many word processors) so we might remove it in a future version of the distribution.
Yeah, troff has become a lost art nowadays. There is not much outside of Groff. Back in the 90s I liked to play with it a bit but gave it up for LaTeX instead.
LaTeX is good (and I used it whenever I needed to write a physics lab report with equations) but to me, nroff/groff has a simplicity that appeals to me.
This is cool. Does this mean that you develop FreeDOS on Linux? If so, which distro do you use? Have you tried okular? I used xpdf for the longest time, and then when I got my Pi I started using evince and while it was somewhat devoid of features it was definitely better than xpdf, but for the past couple of years I've been using okular and it's the best PDF viewer I've used.
Glad you liked the video! Yes, my desktop system is Linux - so when I boot FreeDOS for the videos, I'm actually doing that in a QEMU window on Linux (and recording with OBS Studio). I run Fedora Linux. I haven't tried Okular, but mainly because Evince does a fine job to display PDF files, and that's all I've needed. But I see Okular can also render Epub files; I don't think Evince does that, so I think I'll have to try Okular.
@@freedosproject My desktop system is also in Linux. I use Mint. But for FreeDOS, I've actually installed it on actual hardware ( 2006 Acer Travel Mate) It works pretty good! Thanks for your wonderful work! I enjoy FreeDOS.
@@arkdov Hey this is interesting. I was desparate trying to install Freedos as main booting system on a lenovo Thinkthing Laptop (I don't have the actual name here) - but it won't let me. How did you install FreeDos on that Laptop of yours? Most courious! Thx!
@@dr.hugosperber4473 make sure you have legacy mode on your EFI (bios mode) I think this should help. Or else go into BIOS and boot into USB or from disk.
This was awesome. I think I'm going to look into using the ?roff utilities. The only thing I'm not sure of is being able to select fonts and the scaling. I'm sure when I look into it, the commands will be apparent. I know when I used to use WPS and the VMS systems at my university, I learned how select a font an point size, and imagine roff utils would have something similar I've installed the Microsoft fonts on my Linux system to make LibreOffice compatable with NS Office documents, so I assume roff (in some iteration of it) should be able to render the proper TrueType font..
Using fonts with groff are not just "reference this system font." That's because groff is a faithful implementation of the original troff [see note, below]. And troff was built when the typesetter in use at Bell Labs had a literal disc with fonts .. the typesetter would rotate the disc so the desired letter was in front of a lens, then shine a line through the lens and letter onto photographic paper. The typesetter had 4 positions where you could 'mount' a font disc. So original troff let you specify a 'font position' by number, not reference a font name. But because troff (and hence groff) was only meant to generate print content (not online content) the fonts work differently. So you have to convert a TTF font to use it in groff. See this article where Walter Alejandro Iglesias explains how to do that: technicallywewrite.com/2023/09/16/addfonts *Brief history of 'roff' systems: first, Unix had roff (an implementation like Saltzer's RUNOFF program, but only supporting abbreviated commands like .ce to center lines .. RUNOFF also supported long versions of these commands, like .center). Later, they updated roff to become nroff (new roff) that supported more advanced formatting. Then they updated it again to troff (typesetter roff) to support their new phototypesetter. Then again as ditroff (device independent troff) to support a second typesetter. In the 1990s, GNU created groff (GNU roff) that was a superset of nroff and troff.
A powerful trip to memory lane. I also experienced both MS-DOS and Linux in the early-mid 90s. I loved that both used hardware VGA text mode. I still love full screen text mode on CRT monitors. Unfortunately PCs today abandoned these hardware text modes.
No, first of all text BIOS was replaced with graphical UEFI, and also every graphics card after around 2010 introduced font smoothing in text mode, so the text mode looks terrible even on CRT. The latest PC I can use in pure text mode with good visual quality is from 2010.
@@DanielLenskiy You don't know what you are talking about. First of all LCD display has only one single native resolution: usually 1280x1024 or higher. The native VGA text mode is 720x400; there is no way you can see the display not washed out on LCD. You need CRT for that, but like I mentioned before even on CRT monitors hardware VGA text mode look washed out on computers manufactured after 2010. This is due to the changes they introduced to VGA text mode in graphics cards.
I've seen *roff used to format the Unix manual pages since I started using Linux in the late 90s, but was always scared of it :) after watching your videos I'm probably giving it a go soon, for the nostalgia of the matrix printers and old DOS documentation manuals. What font are you using on your terminal? It looks very pretty!
The "green screen" terminal is using VT323, meant to resemble a VT320 terminal. You can get it on Google Fonts: fonts.google.com/specimen/VT323 The "teletype" terminal is using Nimbus Mono PS. It was the best font that made 80x67 have about the same proportion as a piece of paper.
Do you mean blinking text? That's a video hardware feature. You can set up some VGA cards to do something different with the "blink bit" but generally, no - you can't turn that off.
let's say I want each even page has different header. is that possible to do? what I understand is each page get separated by .bp macro/command so I can be liberate with what I do in each page.
If you want different headers and footers for odd pages and even pages, you can do that too. Use .eh to set headers on even pages, and .oh to set headers on odd pages. And .ef for footers on even pages, and .of to set footers on odd pages. For example: (page headers) .eh 'even-left'even-center'even-right' .oh 'odd-left'odd-center'odd-right'
I first used LaTeX on DOS (as EmTeX) and also used LaTeX on Linux. I was a physics major, and I used LaTeX to write lab reports that included equations. But have you ever printed a multipage LaTeX document on a dot matrix printer? I'll be in the next room for an hour while it prints. (It's LOUD - and takes a long time, if you want good quality.) Dot matrix printers were very common at the time. Personal laser printers were too expensive, and inkjets weren't around yet. (Personal inkjets wouldn't become a thing until 1998.) I could have printed a LaTeX document on the computer lab's laser printer - but as I mentioned in the video, I'd have to pay to use the laser printer. Printing on the lab's dot matrix printer was free. Printing a multipage document *as text* on a dot matrix printer is very fast, so nroff was a good fit. And I could print nroff documents on my own dot matrix printer (fast) or I could print on the computer lab's dot matrix printer (free).
@@freedosproject I understand, thank you for your clarification. But I disagree with your date on when personal inkjet printers became common. My family had a Canon BJC-600 4 color inkjet printer in around early 1994. A friend of mine had a HP DeskJet 550C in 1992. While early inkjet printers were expensive, a family could still afford them. They did cost about as much as a computer monitor from that era.
@@OpenGL4ever To be clear: Inkjet printers were around (they were called "bubblejet" printers, iirc) but didn't become *popular and affordable* home printers until the late 1990s. Inkjets at the time were like $1000. As an undergrad in 1993, the dot matrix printer was cheap and easy, so that's what I had. [edit:spelling]
tried, nope, bye, i'need utf8, and i'm not going back to struggling with getting utf8 to work with all characters, not just one "é" edit: back in my early linux days, i just wrote my papers in html, hosted on webserver at home computer, left home computer running, then from library connected to my home computer and printed papers.
GNU groff (as "nroff") uses UTF-8 by default. You can force it into traditional US ASCII (ISO 646 1991:IRV) using: groff -Tascii … For example: (echo ".pl 1" ; echo "Isn't") | groff -Tascii > isnt.ascii …generates a "straight" apostrophe, because US ASCII. And: (echo ".pl 1" ; echo "Isn't") | groff -Tutf8 > isnt.utf8 or: (echo ".pl 1" ; echo "Isn't") | nroff > isnt.nroff …both generate a "curled" apostrophe, because UTF-8. Comparing those files: $ md5sum isnt.* 3cc8e4ae6d324c494f1414c52f640ba8 isnt.ascii ee24508c55f4edf72c0d6e621fdbdd29 isnt.nroff ee24508c55f4edf72c0d6e621fdbdd29 isnt.utf8 And: $ cmp isnt.ascii isnt.utf8 isnt.ascii isnt.utf8 differ: byte 4, line 1 In other words, they differ on the apostrophe. You can also use -Tlatin1 if you prefer ISO-8859-1 or ISO-8859-15. Or you an use -Tcp1047 if you use IBM-1047.
I used LaTeX too at the time. EmTeX was a great LaTeX implementation on DOS. And we had LaTeX in the campus Unix lab at my univeristy. But if I wanted to print a LaTeX document, I had to pay $ per page to use the computer lab laser printer. I could print a LaTeX document on my dot matrix printer in my dorm room, but it takes a loooooooong time to print a multipage document in graphics mode. For some papers, it might be worth it. But for standard English papers, writing in nroff and printing to a dot matrix (character mode) did the job. And that was pretty typical output for the era, when a lot of us used DOS word processors. Also, printing on the computer lab's dot matrix printer was free, if you didn't abuse it. So if I wrote a paper in nroff and printed from the lab, it didn't cost me anything. 😅
I've used *roff for a few basic things, along with roff2pdf or roff2text for delivery, but I always had frustratingly basic output. This is the best explanation of Nroff's formatting syntax I've seen, and I think it renews my interest in Nroff for practical use.
That's an awesome comment, I'm glad you liked it and rekindled an interest in nroff/groff.
I am really liking this exploration into some of the early Unix utilities. It would also be kinda cool to look at some of the DOS ports of them as well
It's not what you asked, but I also did a conference talk about "Why DOS was [and is] a Thing":
th-cam.com/video/3E5Hog5OnIM/w-d-xo.html
And I did another video when I started the channel about a brief history of MS-DOS:
th-cam.com/video/ZtXTAYT2DFM/w-d-xo.html
[edit:added the history video]
Back in mid 2010s I used roff (likely groff) for a couple assignments in uni, to make it a bit more fun, and was quite surprised by how nice the PDFs I managed to get out of it were. I had used troff to write a couple small man pages before but the experience with the papers was much better. And in some ways less frustrating than with LaTeX.
Good work Jim.
Thank you!
It looks similar to the Markdown format we use everywhere today.
anyways, *nroff* looks more capable in terms of spacing/aligning text.
Thanks Jim!
Same concept as Markdown, but Markdown tries to look like a regular text file.
But you know *roff is a standard, but in reality Markdown no. You can process your *roff text with nroff groff, but Markdown has many dialects and extensions that not all tools/sites support
@@alexloktionoff6833 but at least they agreed on a basic syntax
Really nice video Jim! I've been using Unix for 30 years (started when "Mark Williams" Coherent dropped in price in 1993) and this is the best explanation of NROFF that I have ever seen. You make me want to use it again!!! Can't beleive I just said that... Anyways thanks again and cheers from Canada!
Thanks so much! I'm glad you liked it - it was a lot of fun.
When I was a teacher for pharmaceutical assistants I wrote all my stuff with groff! I had a nice tcl program which put the questions in the right order, than I ran a pipeline with m4 macro processor and pdfmom from Peter Schafter when I clicked a button. It was blazingly fast and typed all the text in a nice mono spaced font. Loved it! LaTeX maybe is more nice but groff is small and fast and looks nice to my eye.
Thanks! I really like nroff and groff too. I'm currently re-learning the '-me' macros, especially the "right" way to make a cover page. I think the *.tp* macro is best used for shorter documents (like a short paper) that shouldn't have a header/footer on page 1. I'm sort of misusing the *.tp* and *.bp* macros when I add my own centered text - but it works fine on nroff. ☺
When I was at university in the early 2000s, I also discovered Linux and it was still KDE 1 and Gnome 1 so veru basic GUI but it was fun.
Wonderful video! I too do all of my university assignments in plan9's troff to all of my professors' stupefaction.
I sometimes joke that I wouldn't mind becoming a typesetter if I could do the job in troff :D
I really enjoy writing docs in groff -me these days. I find that once I start writing, I get into a "zone" where I don't really focus on the formatting, it's more about the content.
Great video, I've personally never used any program from the *roff family, but I've heard about them in school when we were learning TeX.
Definitely going to try.
Brings back memories for me. I remember that I found somewhere a nroff implementation for Dos and could use it there, too (maybe it was more restricted than the nroff part of groff). On Linux you had postscript viewers like ghostview or, better, gv, in the early 1990s.
We have an nroff implemention on FreeDOS (called nro) but the requests are slightly incompatible with Unix standard nroff. We also think no one uses it (because DOS has so many word processors) so we might remove it in a future version of the distribution.
Yeah, troff has become a lost art nowadays. There is not much outside of Groff. Back in the 90s I liked to play with it a bit but gave it up for LaTeX instead.
LaTeX is good (and I used it whenever I needed to write a physics lab report with equations) but to me, nroff/groff has a simplicity that appeals to me.
This is cool. Does this mean that you develop FreeDOS on Linux? If so, which distro do you use? Have you tried okular? I used xpdf for the longest time, and then when I got my Pi I started using evince and while it was somewhat devoid of features it was definitely better than xpdf, but for the past couple of years I've been using okular and it's the best PDF viewer I've used.
Glad you liked the video! Yes, my desktop system is Linux - so when I boot FreeDOS for the videos, I'm actually doing that in a QEMU window on Linux (and recording with OBS Studio). I run Fedora Linux.
I haven't tried Okular, but mainly because Evince does a fine job to display PDF files, and that's all I've needed. But I see Okular can also render Epub files; I don't think Evince does that, so I think I'll have to try Okular.
@@freedosproject My desktop system is also in Linux. I use Mint. But for FreeDOS, I've actually installed it on actual hardware ( 2006 Acer Travel Mate) It works pretty good! Thanks for your wonderful work! I enjoy FreeDOS.
@@arkdov Hey this is interesting. I was desparate trying to install Freedos as main booting system on a lenovo Thinkthing Laptop (I don't have the actual name here) - but it won't let me. How did you install FreeDos on that Laptop of yours? Most courious! Thx!
@@dr.hugosperber4473 make sure you have legacy mode on your EFI (bios mode) I think this should help. Or else go into BIOS and boot into USB or from disk.
Great vid! Brings back memories (incl. the matrix printer noise :D) and shows very well what was even possible with simple text terminals back then.
Glad you enjoyed it!
loved this! thanks for making it.
Glad you enjoyed it!
This was awesome. I think I'm going to look into using the ?roff utilities. The only thing I'm not sure of is being able to select fonts and the scaling. I'm sure when I look into it, the commands will be apparent. I know when I used to use WPS and the VMS systems at my university, I learned how select a font an point size, and imagine roff utils would have something similar I've installed the Microsoft fonts on my Linux system to make LibreOffice compatable with NS Office documents, so I assume roff (in some iteration of it) should be able to render the proper TrueType font..
Using fonts with groff are not just "reference this system font." That's because groff is a faithful implementation of the original troff [see note, below]. And troff was built when the typesetter in use at Bell Labs had a literal disc with fonts .. the typesetter would rotate the disc so the desired letter was in front of a lens, then shine a line through the lens and letter onto photographic paper. The typesetter had 4 positions where you could 'mount' a font disc. So original troff let you specify a 'font position' by number, not reference a font name.
But because troff (and hence groff) was only meant to generate print content (not online content) the fonts work differently. So you have to convert a TTF font to use it in groff. See this article where Walter Alejandro Iglesias explains how to do that:
technicallywewrite.com/2023/09/16/addfonts
*Brief history of 'roff' systems: first, Unix had roff (an implementation like Saltzer's RUNOFF program, but only supporting abbreviated commands like .ce to center lines .. RUNOFF also supported long versions of these commands, like .center). Later, they updated roff to become nroff (new roff) that supported more advanced formatting. Then they updated it again to troff (typesetter roff) to support their new phototypesetter. Then again as ditroff (device independent troff) to support a second typesetter. In the 1990s, GNU created groff (GNU roff) that was a superset of nroff and troff.
A powerful trip to memory lane. I also experienced both MS-DOS and Linux in the early-mid 90s. I loved that both used hardware VGA text mode. I still love full screen text mode on CRT monitors. Unfortunately PCs today abandoned these hardware text modes.
Why? No. Just remove plymouth loading animation and "startx" from startup and you will see text mode in blood and flesh :)
You can still have text mode on Linux pressing CTRL+ALT+ [F1... F12] key.
No, first of all text BIOS was replaced with graphical UEFI, and also every graphics card after around 2010 introduced font smoothing in text mode, so the text mode looks terrible even on CRT. The latest PC I can use in pure text mode with good visual quality is from 2010.
@@spearPYN no, smoothing only turning on in hi-res displays, just take simple cheap lcd display and enjoy beatiful pixel-in-pixel fonts.
@@DanielLenskiy You don't know what you are talking about. First of all LCD display has only one single native resolution: usually 1280x1024 or higher. The native VGA text mode is 720x400; there is no way you can see the display not washed out on LCD. You need CRT for that, but like I mentioned before even on CRT monitors hardware VGA text mode look washed out on computers manufactured after 2010. This is due to the changes they introduced to VGA text mode in graphics cards.
I've seen *roff used to format the Unix manual pages since I started using Linux in the late 90s, but was always scared of it :) after watching your videos I'm probably giving it a go soon, for the nostalgia of the matrix printers and old DOS documentation manuals. What font are you using on your terminal? It looks very pretty!
The "green screen" terminal is using VT323, meant to resemble a VT320 terminal. You can get it on Google Fonts: fonts.google.com/specimen/VT323
The "teletype" terminal is using Nimbus Mono PS. It was the best font that made 80x67 have about the same proportion as a piece of paper.
What do you think about groff on FreeDos? (nr is in the software archive for Freedos)
Yes, we have NRO in FreeDOS. It's okay but incomplete.
@@freedosproject would you recommend using it or rather not?
Nice video, do you know how to turn blink off usin FreeDos and its applicantions? TIA.
Do you mean blinking text? That's a video hardware feature. You can set up some VGA cards to do something different with the "blink bit" but generally, no - you can't turn that off.
What's the font in your green-screen emulation, please?
I'm using the VT323 font, which is meant to emulate a VT320 terminal. You can download it from Google Fonts: fonts.google.com/specimen/VT323
@@freedosproject thank you!
let's say I want each even page has different header. is that possible to do? what I understand is each page get separated by .bp macro/command so I can be liberate with what I do in each page.
If you want different headers and footers for odd pages and even pages, you can do that too. Use .eh to set headers on even pages, and .oh to set headers on odd pages. And .ef for footers on even pages, and .of to set footers on odd pages.
For example: (page headers)
.eh 'even-left'even-center'even-right'
.oh 'odd-left'odd-center'odd-right'
This is great ;-)
Glad you liked it! ☺
Why didn't you use just TeX or LaTex?
I first used LaTeX on DOS (as EmTeX) and also used LaTeX on Linux. I was a physics major, and I used LaTeX to write lab reports that included equations. But have you ever printed a multipage LaTeX document on a dot matrix printer? I'll be in the next room for an hour while it prints. (It's LOUD - and takes a long time, if you want good quality.)
Dot matrix printers were very common at the time. Personal laser printers were too expensive, and inkjets weren't around yet. (Personal inkjets wouldn't become a thing until 1998.)
I could have printed a LaTeX document on the computer lab's laser printer - but as I mentioned in the video, I'd have to pay to use the laser printer. Printing on the lab's dot matrix printer was free.
Printing a multipage document *as text* on a dot matrix printer is very fast, so nroff was a good fit. And I could print nroff documents on my own dot matrix printer (fast) or I could print on the computer lab's dot matrix printer (free).
@@freedosproject I understand, thank you for your clarification.
But I disagree with your date on when personal inkjet printers became common. My family had a Canon BJC-600 4 color inkjet printer in around early 1994. A friend of mine had a HP DeskJet 550C in 1992.
While early inkjet printers were expensive, a family could still afford them. They did cost about as much as a computer monitor from that era.
@@OpenGL4ever To be clear: Inkjet printers were around (they were called "bubblejet" printers, iirc) but didn't become *popular and affordable* home printers until the late 1990s. Inkjets at the time were like $1000. As an undergrad in 1993, the dot matrix printer was cheap and easy, so that's what I had. [edit:spelling]
cmiiw for man page also groff doesn't take much spaces to install
@@superfoxbat Yes, man pages are typically formatted with 'nroff -man' for terminal display.
tried, nope, bye, i'need utf8, and i'm not going back to struggling with getting utf8 to work with all characters, not just one "é"
edit: back in my early linux days, i just wrote my papers in html, hosted on webserver at home computer, left home computer running, then from library connected to my home computer and printed papers.
GNU groff (as "nroff") uses UTF-8 by default. You can force it into traditional US ASCII (ISO 646 1991:IRV) using:
groff -Tascii …
For example: (echo ".pl 1" ; echo "Isn't") | groff -Tascii > isnt.ascii
…generates a "straight" apostrophe, because US ASCII.
And: (echo ".pl 1" ; echo "Isn't") | groff -Tutf8 > isnt.utf8
or: (echo ".pl 1" ; echo "Isn't") | nroff > isnt.nroff
…both generate a "curled" apostrophe, because UTF-8.
Comparing those files:
$ md5sum isnt.*
3cc8e4ae6d324c494f1414c52f640ba8 isnt.ascii
ee24508c55f4edf72c0d6e621fdbdd29 isnt.nroff
ee24508c55f4edf72c0d6e621fdbdd29 isnt.utf8
And:
$ cmp isnt.ascii isnt.utf8
isnt.ascii isnt.utf8 differ: byte 4, line 1
In other words, they differ on the apostrophe.
You can also use -Tlatin1 if you prefer ISO-8859-1 or ISO-8859-15. Or you an use -Tcp1047 if you use IBM-1047.
Freedos and Syslinux!
In the 90th nearly everyone used LaTeX. 5 times better
I used LaTeX too at the time. EmTeX was a great LaTeX implementation on DOS. And we had LaTeX in the campus Unix lab at my univeristy.
But if I wanted to print a LaTeX document, I had to pay $ per page to use the computer lab laser printer. I could print a LaTeX document on my dot matrix printer in my dorm room, but it takes a loooooooong time to print a multipage document in graphics mode. For some papers, it might be worth it.
But for standard English papers, writing in nroff and printing to a dot matrix (character mode) did the job. And that was pretty typical output for the era, when a lot of us used DOS word processors.
Also, printing on the computer lab's dot matrix printer was free, if you didn't abuse it. So if I wrote a paper in nroff and printed from the lab, it didn't cost me anything. 😅
@@freedosproject Printing was never a problem in my university. Anyway. Great content. Thanks.