troff Typesetting for UNIX™ Systems

Karen Paulsell, Sandra L. Emerson

Publisher: Prentice Hall, 1987, 359 pages

ISBN: 0-13-930959-4

Keywords: Programming

Last modified: March 8, 2022, 12:49 a.m.

This aptly named book is your key to making the most of a new office productivity tool — typesetting software. It focuses on the troff typesetting program.

Some of the benefits of self-service typesetting includes the professional look of typeset documents such as resumes, proposals, reports, handbooks, pamphlets, and other literature; faster turnaround time; decreased production costs; high-quality copy; and control of the design concepts. Flexible UNIX typesetting programs allow for special-purpose formats to be developed in minutes.

This book is a practical introduction for anyone using a UNIX system for document preparation. Some background in the UNIX system plus a knowledge of one of the standard UNIX editors is needed to use this book effectively.

Among its features, this book:

  • presents terminology related to the troff program
  • illustrates the basic troff requests with one or more examples
  • explores troff with step-by-step descriptions of how to write your own macros
  • describes device-independent troff

Of special interest are Appendices including a list of UNIX typesetting services, reference charts of the troff number registers, escape sequences, and requests, and a discussion of how to write nroff driving tables.

  1. The Development of Self-Service Typesetting
    • Computers and Self-Service Typesetting
      • How to Do It Yourself
      • How troff Creates a Self-Service Typesetting System
      • History and Overview of troff
      • Making troff Easier with Macros
      • Reasons for Using a Standard Macro Package
        • Predictability
        • Protection
        • High-level Language
      • Should you write your own macro package?
        • Learning to think like a typesetter
      • Device-Independent troff: Better than Ever
      • Problems with troff
        • Why the user interface is slow to change
      • Will troff Be Replaced by a Commercial Package?
  2. Learning to Do Your Own Typesetting
    • Typesetting and Programming
      • Introduction to Formatting Concepts
      • Formatting and Typesetting Terminology
        • Filling and adjusting
        • Letterspacing
      • Distance and troff
        • Horizontal measurement
        • Defaults, initial values, and previous values
        • Number arguments
      • Summary Chart of troff Units of Measure
        • Other horizontal page dimension
        • How nroff treats spacing
        • Character size
        • Vertical spacing
        • Fonts and styles
      • troff Formatting: A Two-Step Process
        • Editing files for typesetting
        • The formatting process
        • What you see is what you guessed
  3. troff Revealed: The Most Popular primitives
    • How troff Works
      • Styles of Commands
        • Looking at troff input
        • In-line requests
        • Escape sequences
      • Syntax for Requests, Strings, and Number Registers
      • troff Speaks: Number Registers
        • Arithmetic Expressions
      • String Registers
      • Getting Hands On
      • A Simple Document Using Some Common troff Commands
      • Formatted Output of the Resume
        • Effect of adding one more request
      • Formatting Command Lines
        • Formatting to the screen
        • Formatting to a printer
        • How troff reads files
      • How to Read the Rest of This Book
    • Line Control Requests
      • Text Filling, Adjusting, and Centering Requests
        • .fi — fill
        • .nf — no fill
        • .br — break
        • .ad — adjust
        • .na — no adjust
        • .ce — center
        • Escape sequences affecting filling and adjusting
      • Indentation and Line Length Requests
        • .in — indent
        • .ti — temporary indent
        • .ll — line length
      • Hyphenation Requests
        • .hy — hyphenation mode
        • .nh — no hyphenation
        • .hc — hyphenation character
        • .hw — exception words
    • Page Control Requests
        • .pl — page length
        • .pn — page number
        • .po page offset
        • .bp — begin page
        • .ne — need vertical space
        • .ne in diversions
        • .sv — save vertical space
        • .os — output saved vertical space
    • Vertical Spacing Requests
        • .vs — vertical space
        • .ls — line spacing
        • .sp — space
        • Blank line
        • .mk — mark vertical place
        • .rt — return to marked vertical place
        • Some previewing tips
    • Three-part Title Requests
        • .tl — three-part title
        • .lt — length of title
        • .pc — set page number character
    • Font and Character Size Control
        • .fp — font position
        • .ft — font
        • Minute spacing adjustments
        • .ps — point size
    • Tabs and Leaders
        • .ta — set tab stop
        • .tc — tab repetition character
        • .lc — leader repetition character
        • Using \t and \a for tabs and leaders
    • Input/Output Requests and File Switching
      • Other File Requests
        • .so — source
        • .nx — next
        • .ex — exit
        • .rd — read insertion
    • Form Letters
    • .tm — terminal message
    • .pi — pipe
  4. Introduction to Writing Macros
    • Introduction to Writing Macros
      • Programming troff
      • Number Registers and Strings
        • Naming strings and number registers
      • Traps, Conditionals, Diversions, and Environments
        • Traps
        • Conditionals
        • Diversions
        • Environments
      • Macros
      • The New Page Macro Revisited
        • Macros and copy mode
    • Using Number Registers
      • Defining Number Registers
        • .nr — number register
        • Storing non-integer values in number registers
      • Doing Arithmetic with Number Registers
        • Read-only number registers
        • Anomalies
      • Counters and Extra Tricks
        • Registers as counters
        • Dynamic creation of number registers
        • .af — assign format
        • .rr — remove register
    • Strings
        • .ds — define string
        • .as — append string
        • .rm — remove string, macro, or request
        • .rn — rename
    • Conditional Acceptance of Input Requests
        • .if — if
        • Doing arithmetic in conditionals
        • Multi-line conditional
        • Logical (Boolean) operators
        • Using strings in conditionals
        • .ie — if else
        • .el — else
    • Using Different Environments
        • .ev — environment switching
        • Titles, headers, and environments
        • Pushing and popping
    • Diversions
        • .di — divert text
        • Testing for diversion in conditionals
        • .da — divert append
        • Diversion traps
    • Setting and Springing Traps
        • .wh — when
        • .ch — change trap location
        • .dt — diversion trap
        • .it — input line count trap
    • Defining Macros
        • .de — define macro
        • .am — append macro
        • .em — end macro
        • .rm — remove
        • .rn — rename
    • Making Your Own Macros
      • Writing A Simple Macro
      • How to Use Macros
      • A "Keep" Macro
        • Diversions
      • How to Write More Complex Macros
        • Advance planning
        • The bibliography-entry unit
        • The page unit
        • The section unit
        • Keeping entries together
      • Additional Requests and Escape Sequences
  5. Additional Requests and Escape Sequences
    • Local Vertical and Horizontal Motions
      • Local Vertical Motion
        • \v'N' — vertical motion
        • \x'N' — pry apart output lines
      • Local Horizontal Motion
        • Adjusting Horizontal Spacing
        • Overstriking
        • Special characters and accents
        • The width and horizontal mark functions
      • Line Drawing and Bracket Building
        • Horizontal lines
        • Drawing vertical lines
        • Bracket-building functions
    • Additional Styling Requests
      • Character Spacing
        • .cs — constant character space
        • .ss — set space character
      • Artificial Emboldening
        • .bd — embolden
      • Special Underlining Features
        • .ul — underline
        • .uf — set underline font
        • .cu — continuous underline
      • Ligatures
        • .lg — ligature mode
    • Escape and Control Characters Requests
        • .cc — reset break control character
        • .c2 — reset no-break control character
        • .ec — set escape character
        • .eo — escape off
    • Output Line Numbering
        • .nm — line number mode
        • .nn — suspend numbering
    • Inserting Characters in the Right Margin
        • .mc — margin character
    • No-space Mode
        • .ns — Set no-space mode
        • .rs — Restore spacing
    • Miscellaneous Requests
        • .fc — field character
        • .tr — translate characters
        • .fl — flush output buffer
        • .ab — abort processing
        • .co — compact macros
        • .ig — ignore macros
        • .pm — print macros
  6. Typesetting with a Macro Package
    • Typesetting with a Macro Package
      • Where to Find a Macro Package
      • How to Modify a Macro Package
    • The ms Macros
      • How to Use the ms Macros
      • Default Formatting with ms
        • For more information
      • Initailisation
      • ms number registers and parameters
        • ms's 'reset to normal'
      • Changing number registers and parameters
      • ms String Registers
      • How to Change Values in ms String Registers
        • Changing the date
        • Differences between nroff and troff with ms
      • Major Macros of ms
        • Title and Author
        • Abstracts and released paper format
        • Paragraphs
        • Section headings
        • Numbered headings
      • Keeps, Display, and Footnotes
        • Keeps
        • Displays
        • Footnotes
      • Style and Special Features
        • Boldface and italics
        • Size changes
        • Underlining
        • Accent marks
        • Boxes
        • Multi-column output
        • Typesetting galleys
      • Special Document Formats
      • Reference Chart of ms Macros
    • The mm Macros
      • Availability of the mm Package
      • Distinguishing Characteristics of the mm Package
        • Documentation
        • Accommodating the larger size of the mm package
        • Separating nroff from troff versions
        • Compacting macros
        • Removing Bell Labs features
      • Highlights of mm
        • Command line options
        • Don't Tread on Me
        • Multiple choice
        • What kind of foo am I?
        • mm default settings
      • How mm Interferes with Formatting a Simple Document
      • Tables of Contents, Footnotes, and References
        • Footnotes and Footers
        • References
      • Summary
    • The man Macros
        • Pad that skeleton
        • Using the man macros
  7. Preprocessor and Post-processor Programs
    • Fancy Formatting with troff's Co-processor Programs
      • Using the Preprocessors
    • Making Tables with tbl
      • How tbl works
      • The Parts of a Table
        • Global options
        • tab(x) and delim (xy)
        • The format description lines
        • Writing format description lines
        • Numerical data
        • Changing column formats in mid-table
      • Additional format specifications
      • Last but Not Least — the Data!
        • Long input lines
        • Text blocks
        • Specifying widths for text blocks
        • troff commands within tables
      • A Few Words of Encouragement
      • Sample Tables
    • How to Format Equations
      • Using eqn
      • Example of Equation Input
      • Formatting Multi-Line Equations
      • Equation Processing Command Lines
      • Command Line Options
      • Setting Fonts and Sizes for Equations
      • troff Requests and Literals
      • Local Motions, Piles, and Matrices
      • Supplemental Equation Characters
    • Post-processor Filters
  8. Putting It All Together
    • Preview and Production Techniques
      • Formatting Command Lines
        • Options
        • Options specific to troff
        • Pipelines
        • Multiple files
      • Grooming the Input
        • Checking input
      • Previewing Output
      • Making Repairs
      • Document Maintenance
      • Final Printing and Production
        • Using makefiles for document control
    • Some Useful Macros for Indexes and Footnotes
      • (Semi) Automated Indexing
      • The Macro
        • Redirecting the output
      • Using the sort Utility
      • The awk script
      • A Macro to Format an Index into Two Columns
        • How the traps work
        • The titling macro
        • Transparent throughput
        • A transparent enhancement: indexing in a diversion
  9. Implementing Device-Independent troff
    • What This Chapter Covers
    • Developing Device-Independent troff
      • Characteristics of Device-Independent troff
      • Summary of Device-Independent troff
        • Device description files
        • Font width tables
        • Device drivers
      • Change in Internal Character Representation
      • What Happens when You Say ditroff?
      • What the DESC File Looks Like
      • Font Files
        • Orders in which font files are searched
    • Improving troff Performance
      • WIZARD
      • SoftQuad
      • xroff for Laser Printgers
        • Writing a driving table for a laser printer
      • Where to Get Device-Independent troff
  1. A Directory of UNIX Typesetting Services
  2. Requests, Escapes, and Number Registers
  3. Writing Driving Tables for nroff

Reviews

troff Typesetting for UNIX™ Systems

Reviewed by Roland Buresund

Very Good ******** (8 out of 10)

Last modified: May 21, 2007, 3:18 a.m.

This is a good introduction on how you write your own macro packages for troff. Not that anybody care today…

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required