ArticleslgStudy

computer science

Nroff

Nroff is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Nroff rather than just read about it. In short: nroff (short for "new roff") is a text-formatting program on Unix and Unix-like operating systems. It produces output suitable for simple fixed-width printers and terminal windows.

Key takeaways

  • Nroff belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Nroff to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Nroff from memory before moving on to harder problems.

Reference excerpt

nroff (short for "new roff") is a text-formatting program on Unix and Unix-like operating systems. It produces output suitable for simple fixed-width printers and terminal windows. It is an integral part of the Unix help system, being used to format man pages for display. nroff and the related troff were both developed from the original roff. While nroff was intended to produce output on terminals and line printers, troff was intended to produce output on typesetting systems. Both used the same underlying markup and a single source file could normally be used by nroff or troff without change.

History nroff was written by Joe Ossanna for Version 2 Unix, in Assembly language and then ported to C. It was a descendant of the RUNOFF program from CTSS, the first computerized text-formatting program, and is a predecessor of the Unix troff document processing system.

Variants There is also a free software version of nroff in the groff package emulating the AT&T version, widely used by Unix-like operating systems. The Minix operating system, among others, uses a clone of nroff called cawf by Vic Abell, based on awf, the Amazingly Workable Formatter designed in awk by Henry Spencer. These are not full replacements for the nroff/troff suite of tools, but are sufficient for display and printing of basic documents and manual pages. In addition, a simplified version of nroff is available in Ratfor source code form as an example in the book Software Tools by Brian Kernighan and P. J. Plauger.

See also troff groff TeX LaTeX man page

References

External links source code for Henry Spencer's AWF troff/nroff quick reference nroff source code in Illumos. Explanation by Bryan Cantrill

Worked examples

Example 1 — a first encounter with Nroff

Start with the simplest possible case. Write down what Nroff claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Nroff before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Nroff ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Nroff

In research
Nroff appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Nroff in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Nroff is common in secondary-school and first-year university syllabi. It links to neighbouring topics Markup languages, Software programmed in assembly language, Troff, so understanding it makes those chapters shorter.
In everyday life
Look for Nroff outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Nroff in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Nroff means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Nroff out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Nroff in simple terms?

nroff (short for "new roff") is a text-formatting program on Unix and Unix-like operating systems. It produces output suitable for simple fixed-width printers and terminal windows.

Why does Nroff matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Nroff?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Nroff.

Tags

  • Markup languages
  • Software programmed in assembly language
  • Troff
  • Unix stubs
  • Unix text processing utilities

Keep exploring