Troff and Friends

Total Page:16

File Type:pdf, Size:1020Kb

Troff and Friends this talk • history and background • theory • practical usage ... of nroff, troff, and friends (tbl, eqn, refer, pic) troff and friends please interrupt me at any time in case of questions markus schnalke <[email protected]> please tell me what I should demonstrate goal: motivate to learn and use these programs my troff history historical background ______________________________________________________ years ago __________________________________first contact through man pages see my talk on ‘‘old software treasuries’’ ___________________________________________________ a simple document, just to try it___ quick summary: ___________________________________________________a year ago used pic for my diploma thesis___ • terminal = keyboard + line printer ___________________________________________________two months ago started to learn troff better ___ • no screen orientation thus: It’s all pretty new to me too :-) • size limits on software history of typesetting history of troff • completely by hand early 60s at MIT: •‘‘hot metal’’ typesetting (Linotype) • RUNOFF for CTSS • completely by computers (line printers and photo- • ‘‘right-justifying type-out program’’ typesetters) • ported to many systems (also MULTICS) goal: text automatically right-adjusted and hyphenated around 1970 at Bell Labs: • roff by McIlroy (Unix version of RUNOFF) • used daily history of troff (2) glossary nroff (‘‘new roff’’) • word processing • by Joe Ossanna • text formating • strength: macro programmable • document preparation • still only for daisy wheel/golf ball printers • typesetting troff (‘‘typesetting roff’’?) and: nroff, ditroff, troff, otroff • superset of nroff groff is the GNU implementation of troff and friends • written when Bell Labs got a phototypesetter • supports different fonts, font sizes, more characters, ... • basically the same program as nroff with different out- put TeX Differences: __________________________________________________ metaphor basic entity troff__________________________________________________ hand composer line TeX__________________________________________________ raster image paragraph nroff Heirloom troff does also include paragraph-at-once adjustment, hanging characters, and micro typography but no question, TeX is great software! nroff nroff (2) Input consists of: overview • command lines (match to /ˆ[.’]/) words lines nroff • input lines (everything else) on lines on pages • plus escape sequences (introduced with backslash) nroff does: Unrecognized commands are simply ignored • filling (→ hyphenation) • adjusting (→ adding inter-word spaces) All commands and names are one or two characters number registers • own namespace • set with: .nr XY 42 • substitute value: \n(XY • increment, decrement in defineable steps possible <nroff demo> • defineable format: .af XY 0001 (1, 0001, i, I, a, A) • remove register: .rr XY strings macros • namespace together with macros and diversions • share namespace with strings and diversions • set with: .ds AB "foo • define: • substitute value: \*(AB .de AB • append: .as AB "bar . \" number of arguments: \n(.$ . \" first argument: \$1 • rename: .rn AB CD .. • remove: .rm AB .am • may contain escape sequences • append with: • rename and remove like with strings (diversions collect text for later insertion – not covered here) • add backslashes to delay interpretation • may be nested if two kinds: • .if with only one branch • .ie and .el with two branches true is: • ! false <nroff demo> • ’foo’foo’ • non-negative number (-1 is false!) • valid numeric comparison • e/o and t/n in the matching cases multiline branches with \{ and \} troff a nroff for phototypesetters supports: • high resolution and small movements • different fonts troff • different font sizes • special characters <troff demo> macro packages macro packages ms • principally not different from normal input • the standard macros • get prepended to the normal input • developed for Bell Labs internal documents • searched for at a central location • superseded by mm • usage: troff -ms input.ms • easy to learn (is the same as: troff s input.ms) • used for these slides • multiple macro packages for one document possible, but beware conflicts • well known macro packages are: ms, mm, me, man man slides • the man page macros • came from Sape Mullender over Uriel to me • that’s what you use when you write man pages • http://repo.cat-v.org/troff-slider/sample_slides.ms • stripped down to this specific task • I took .SS and .IT and added .PA, that’s all • could be improved ... and I plan to do that to learn more about troff ;-) • these slides are created with those macros, of course <macros demo> preprocessors preprocessors tbl • add ‘‘features’’ to troff by Mike Lesk • work only on text between start and end markers example code: • copy everything else through .TS • they are a very nice concept to extend software! center box; lfB | cfB | cfB l | c | c. write your own preprocessor (in the language of your tab separated fields choice) if you want to add some functionality = several lines of data _ last format applies _ to all further lines .TE eqn refer • by Kernighan and Cherry • by Mike Lesk • the first preprocessor • for literature references (like bibtex for LaTeX) • would hardly exist without yacc • but does a ‘‘fuzzy’’ search • write formulas as spoken in English • macro package needs to support refer • Greek letters and math symbols available example: • inline formulas possible with delim $$ .[ words unique to the referenced document example: .] x sub {1,2}˜=˜{ -b ˜+-˜ sqrt { b sup 2˜-˜4 a c } } over { 2 a } sample database entry: − ± √2 − = __b_____b_____4_ac__ %T Title x 1, 2 2a %A Author %D Date of publication %I Issuer pic • by Kernighan • draw diagrams by ‘‘explaining’’ them • impressed me much example: .PS further stuff ED: box "ed" arrow right box "ex" arrow box "vi" arrow up right from ED.ne box "grep" arrow down right from ED.se box "sed" .PE postprocessors doctype dpost • frequent question: which preprocessors are needed? • for troff • doctype gives the answer • converts device independent output to PostScript • introduced in ‘‘The Unix Programming Environment’’ • a script, mainly in awk col • easy to extend to personal needs • for nroff • removes backward movements (primary for multi column text) literature • ‘‘Text Processing and Typesetting with Unix’’ by Bar- this talk was prepared using tools of the Heirloom project: ron and Rees explains everything pretty good (focus on http://heirloom.sf.net nroff) the slides macros were taken from • ‘‘Heirloom Documentation Tools Nroff/Troff User's http://repo.cat-v.org/troff-slider/ Manual’’ by Ossanna, Kernighan, and Ritter is more a ed technical reference all editing was done with , of course :-) • Various documents collected on http://troff.org the slides and examples are available on my website http://marmaro.de/docs and on http://ulm.ccc.de/ChaosSeminar/ 2009-11-09.
Recommended publications
  • Using NROFF and TROFF
    Using NROFF and TROFF Part Number: 800-1755-10 Revision A, of 9 May 1988 UNIX is a registered trademark of AT&T. SunOS is a trademark of Sun Microsystems, Inc. Sun Workstation is a registered trademark of Sun Microsystems, Inc. Material in this manual comes from a number of sources: NrofflTroff User's Manual, Joseph F. Ossanna, Bell Laboratories, Murray Hill, New Jersey; A Troff Tutorial, Brian W. Kernighan, Bell Laboratories, Murray Hill, New Jersey; Typ­ ing Documents on the UNIXSystem: Using the -ms Macros with Troff and Nroff, M. E. Lesk, Bell Laboratories, Murray Hill, New Jersey; A Guide to Preparing Documents with -ms, M. E. Lesk, Bell Laboratories, Murray Hill, New Jersey; Document Formatting on UNIXUsing the -ms Macros, Joel Kies, University of California, Berkeley, California; Writing Papers with Nroff Using -me, Eric P. Allman, University of California, Berkeley; and Introducing the UNIXSystem, Henry McGilton, Rachel Morgan, McGraw-Hill Book Company, 1983. These materials are gratefully acknowledged. Copyright © 1987, 1988 by Sun Microsystems, Inc. This publication is protected by Federal Copyright Law, with all rights reserved. No part of this publication may be reproduced, stored in a retrieval system, translated, transcribed, or transmitted, in any form, or by any means manual, electric, electronic, electro-magnetic, mechanical, chemical, optical, or other­ wise, without prior explicit written permission from Sun Microsystems. Contents Chapter 1 Introduction . 1.1. nrof f andtrof f . Text Formatting Versus Word Processing TheEvolutionof nr of f andt ro f f Preprocessors and Postprocessors 1.2. tr of f, Typesetters, and Special-Purpose Formatters ............ 1.3.
    [Show full text]
  • Linux from Scratch Linux from Scratch
    Linux From Scratch Linux From Scratch Table of Contents Linux From Scratch............................................................................................................................................1 Gerard Beekmans.....................................................................................................................................1 Dedication............................................................................................................................................................2 Preface................................................................................................................................................................10 Who would want to read this book..................................................................................................................11 Who would not want to read this book...........................................................................................................12 Organization......................................................................................................................................................13 Part I − Introduction...............................................................................................................................13 Part II − Installation of the LFS system.................................................................................................13 Part III − Appendixes.............................................................................................................................13
    [Show full text]
  • The Strange Birth and Long Life of Unix - IEEE Spectrum Page 1 of 6
    The Strange Birth and Long Life of Unix - IEEE Spectrum Page 1 of 6 COMPUTING / SOFTWARE FEATURE The Strange Birth and Long Life of Unix The classic operating system turns 40, and its progeny abound By WARREN TOOMEY / DECEMBER 2011 They say that when one door closes on you, another opens. People generally offer this bit of wisdom just to lend some solace after a misfortune. But sometimes it's actually true. It certainly was for Ken Thompson and the late Dennis Ritchie, two of the greats of 20th-century information technology, when they created the Unix operating system, now considered one of the most inspiring and influential pieces of software ever written. A door had slammed shut for Thompson and Ritchie in March of 1969, when their employer, the American Telephone & Telegraph Co., withdrew from a collaborative project with the Photo: Alcatel-Lucent Massachusetts Institute of KEY FIGURES: Ken Thompson [seated] types as Dennis Ritchie looks on in 1972, shortly Technology and General Electric after they and their Bell Labs colleagues invented Unix. to create an interactive time- sharing system called Multics, which stood for "Multiplexed Information and Computing Service." Time-sharing, a technique that lets multiple people use a single computer simultaneously, had been invented only a decade earlier. Multics was to combine time-sharing with other technological advances of the era, allowing users to phone a computer from remote terminals and then read e -mail, edit documents, run calculations, and so forth. It was to be a great leap forward from the way computers were mostly being used, with people tediously preparing and submitting batch jobs on punch cards to be run one by one.
    [Show full text]
  • The Strange Birth and Long Life of Unix - IEEE Spectrum
    The Strange Birth and Long Life of Unix - IEEE Spectrum http://spectrum.ieee.org/computing/software/the-strange-birth-and-long-li... COMPUTING / SOFTWARE FEATURE The Strange Birth and Long Life of Unix The classic operating system turns 40, and its progeny abound By WARREN TOOMEY / DECEMBER 2011 They say that when one door closes on you, another opens. People generally offer this bit of wisdom just to lend some solace after a misfortune. But sometimes it's actually true. It certainly was for Ken Thompson and the late Dennis Ritchie, two of the greats of 20th-century information technology, when they created the Unix operating system, now considered one of the most inspiring and influential pieces of software ever written. A door had slammed shut for Thompson and Ritchie in March of 1969, when their employer, the American Telephone & Telegraph Co., withdrew from a collaborative project with the Photo: Alcatel-Lucent Massachusetts Institute of KEY FIGURES: Ken Thompson [seated] types as Dennis Ritchie looks on in 1972, shortly Technology and General Electric after they and their Bell Labs colleagues invented Unix. to create an interactive time-sharing system called Multics, which stood for "Multiplexed Information and Computing Service." Time-sharing, a technique that lets multiple people use a single computer simultaneously, had been invented only a decade earlier. Multics was to combine time-sharing with other technological advances of the era, allowing users to phone a computer from remote terminals and then read e-mail, edit documents, run calculations, and so forth. It was to be a great leap forward from the way computers were mostly being used, with people tediously preparing and submitting batch jobs on punch cards to be run one by one.
    [Show full text]
  • The Evolution of the Unix Time-Sharing System*
    The Evolution of the Unix Time-sharing System* Dennis M. Ritchie Bell Laboratories, Murray Hill, NJ, 07974 ABSTRACT This paper presents a brief history of the early development of the Unix operating system. It concentrates on the evolution of the file system, the process-control mechanism, and the idea of pipelined commands. Some attention is paid to social conditions during the development of the system. NOTE: *This paper was first presented at the Language Design and Programming Methodology conference at Sydney, Australia, September 1979. The conference proceedings were published as Lecture Notes in Computer Science #79: Language Design and Programming Methodology, Springer-Verlag, 1980. This rendition is based on a reprinted version appearing in AT&T Bell Laboratories Technical Journal 63 No. 6 Part 2, October 1984, pp. 1577-93. Introduction During the past few years, the Unix operating system has come into wide use, so wide that its very name has become a trademark of Bell Laboratories. Its important characteristics have become known to many people. It has suffered much rewriting and tinkering since the first publication describing it in 1974 [1], but few fundamental changes. However, Unix was born in 1969 not 1974, and the account of its development makes a little-known and perhaps instructive story. This paper presents a technical and social history of the evolution of the system. Origins For computer science at Bell Laboratories, the period 1968-1969 was somewhat unsettled. The main reason for this was the slow, though clearly inevitable, withdrawal of the Labs from the Multics project. To the Labs computing community as a whole, the problem was the increasing obviousness of the failure of Multics to deliver promptly any sort of usable system, let alone the panacea envisioned earlier.
    [Show full text]
  • A Brief History of Unix
    A Brief History of Unix Tom Ryder [email protected] https://sanctum.geek.nz/ I Love Unix ∴ I Love Linux ● When I started using Linux, I was impressed because of the ethics behind it. ● I loved the idea that an operating system could be both free to customise, and free of charge. – Being a cash-strapped student helped a lot, too. ● As my experience grew, I came to appreciate the design behind it. ● And the design is UNIX. ● Linux isn’t a perfect Unix, but it has all the really important bits. What do we actually mean? ● We’re referring to the Unix family of operating systems. – Unix from Bell Labs (Research Unix) – GNU/Linux – Berkeley Software Distribution (BSD) Unix – Mac OS X – Minix (Intel loves it) – ...and many more Warning signs: 1/2 If your operating system shows many of the following symptoms, it may be a Unix: – Multi-user, multi-tasking – Hierarchical filesystem, with a single root – Devices represented as files – Streams of text everywhere as a user interface – “Formatless” files ● Data is just data: streams of bytes saved in sequence ● There isn’t a “text file” attribute, for example Warning signs: 2/2 – Bourne-style shell with a “pipe”: ● $ program1 | program2 – “Shebangs” specifying file interpreters: ● #!/bin/sh – C programming language baked in everywhere – Classic programs: sh(1), awk(1), grep(1), sed(1) – Users with beards, long hair, glasses, and very strong opinions... Nobody saw it coming! “The number of Unix installations has grown to 10, with more expected.” — Ken Thompson and Dennis Ritchie (1972) ● Unix in some flavour is in servers, desktops, embedded software (including Intel’s management engine), mobile phones, network equipment, single-board computers..
    [Show full text]
  • Unix Programmer's Manual
    There is no warranty of merchantability nor any warranty of fitness for a particu!ar purpose nor any other warranty, either expressed or imp!ied, a’s to the accuracy of the enclosed m~=:crials or a~ Io ~helr ,~.ui~::~::.j!it’/ for ~ny p~rficu~ar pur~.~o~e. ~".-~--, ....-.re: " n~ I T~ ~hone Laaorator es 8ssumg$ no rO, p::::nS,-,,.:~:y ~or their use by the recipient. Furln=,, [: ’ La:::.c:,:e?o:,os ~:’urnes no ob~ja~tjon ~o furnish 6ny a~o,~,,..n~e at ~ny k:nd v,,hetsoever, or to furnish any additional jnformstjcn or documenta’tjon. UNIX PROGRAMMER’S MANUAL F~ifth ~ K. Thompson D. M. Ritchie June, 1974 Copyright:.©d972, 1973, 1974 Bell Telephone:Laboratories, Incorporated Copyright © 1972, 1973, 1974 Bell Telephone Laboratories, Incorporated This manual was set by a Graphic Systems photo- typesetter driven by the troff formatting program operating under the UNIX system. The text of the manual was prepared using the ed text editor. PREFACE to the Fifth Edition . The number of UNIX installations is now above 50, and many more are expected. None of these has exactly the same complement of hardware or software. Therefore, at any particular installa- tion, it is quite possible that this manual will give inappropriate information. The authors are grateful to L. L. Cherry, L. A. Dimino, R. C. Haight, S. C. Johnson, B. W. Ker- nighan, M. E. Lesk, and E. N. Pinson for their contributions to the system software, and to L. E. McMahon for software and for his contributions to this manual.
    [Show full text]
  • UNIX™ System V DOCUMENTER's WORKBENCH™ Volume ONE
    ___ALTOS _ UNIX™ SySTEM V DOCUMENTER'S WORKBENCH™ VOlUME ONE INTROduCTioN ANd TEXT FORMATTERS REfERENCE UNIX™ System V DOCUMENTER'S WORKBENCH™ Volume One ACKNOW'LBDGBMEN'rS The Altos logo, as it appears in this manual, is a registered trademark of Altos Computer Systems. DOCUMENTER IS WORKBENCH™ is a trademark of AT&T Technologies. IMPRINT@ and IMAGEN® are registered trademarks of the IMAGEN Corporation. TEKTRONIX® is a registered trademark of Tektronics, Inc. TELETYPE™ is a trademark of AT&T Teletype Corporation. TRENDATA® is a registered trademark of Trendata Corporation. UNIX™ is a tr ademark of AT &'1' Bell Labor at or ies. CONTENTS Chapter 1 DOCUMENTER'S WORKBENCH SOFTWARE Chapter 2 DOCUMENT PREPARATION APPENDIX USER REFERENCE MANUAL - i - Chapter 1 DOCUMENTER'S WORKBENCH SOFTWARE PAGE INTRODUCTION............................................... 1-1 HOW TO USE THIS BOOK. • . • . .. 1-2 I!.. 1 ,J Chapter 1 DOCUMENTER'S WORKBENCH SOFTWARE INTRODUCTION This book is the introductory volume of a set of documents that provide information about the DOCUMENTER'S WORKBENCH software on the UNIX* system. Other books in this series are: 307-151 Text Formatters Reference-provides a reference covering the text formatters nroff, troff (device independent), otroff (old troff), and sroff. 307 -152 Macro Packages Reference-provides a reference for the macro packages mm (memorandum macros), sroff/mm (mm macros for the sroff formatter), and mv (view graph macros). 307-153 Preprocessors Reference-provides a reference for the preprocessors tbl, pic, and eqn/neqn. This book is both an introduction to the DOCUMENTER'S WORKBENCH software and a DOCUMENTER'S WORKBENCH software command reference manual. Chapter 2 contains introductory material on some of the software, and the appendix provides pages describing the various commands that are part of the DOCUMENTER'S WORKBENCH software.
    [Show full text]
  • LFS-BOOK.Pdf
    Linux From Scratch Версия 7.3 Автор Gerard Beekmans Редакторы Matthew Burgess и Bruce Dubbs Перевод Иван Лабутин Linux From Scratch: Версия 7.3 by Автор Gerard Beekmans, Редакторы Matthew Burgess и Bruce Dubbs, Перевод Иван Лабутин Copyright © 1999-2013 Gerard Beekmans Copyright © 1999-2013, Gerard Beekmans Все права защищены. Эта книга выпущена под лицензией Creative Commons License. Команды для компьютера могут быть извлечены из книги под лицензией MIT License. Linux® зарегистрированная торговая марка Linus Torvalds. Linux From Scratch - Версия 7.3 Содержание Пролог ......................................................................................................................... viii i. Предисловие ........................................................................................................ viii ii. Кому адресована эта книга? ............................................................................... ix iii. Целевые архитектуры LFS .................................................................................. x iv. LFS и стандарты .................................................................................................. x v. Пояснения к выбранным пакетам ..................................................................... xii vi. Необходимые знания ....................................................................................... xvii vii. Требования к хост-системе ........................................................................... xviii viii. Соглашения, используемые в книге .............................................................
    [Show full text]
  • Separate Instruction and Data Space) Is Needed for Some Utilities
    Aimed at larger systems. Devices are addressable to 231 bytes, files to 230 bytes. 128K memory (separate instruction and data space) is needed for some utilities. Portability. Code of the operating system and most utilities has been extensively revised to minimize its dependence on particular hardware. Fortran 77. F77 compiler for the new standard language is compatible with C at the object level. A For- tran structurer, STRUCT, converts old, ugly Fortran into RATFOR, a structured dialect usable with F77. Shell. Completely new SH program supports string variables, trap handling, structured programming, user profiles, settable search path, multilevel file name generation, etc. Document preparation. TROFF phototypesetter utility is standard. NROFF (for terminals) is now highly compatible with TROFF. MS macro package provides canned commands for many common formatting and layout situations. TBL provides an easy to learn language for preparing complicated tabular material. REFER fills in bibliographic citations from a data base. UNIX-to-UNIX file copy. UUCP performs spooled file transfers between any two machines. Data processing. SED stream editor does multiple editing functions in parallel on a data stream of indefi- nite length. AWK report generator does free-field pattern selection and arithmetic operations. Program development. MAKE controls re-creation of complicated software, arranging for minimal re- compilation. Debugging. ADB does postmortem and breakpoint debugging, handles separate instruction and data spaces, floating point, etc. C language. The language now supports definable data types, generalized initialization, block structure, long integers, unions, explicit type conversions. The LINT verifier does strong type checking and detection of probable errors and portability problems even across separately compiled functions.
    [Show full text]
  • The Electronic Journal and Its Implications for the Electronic Library
    The Electronic journal and its implications for the digital library Item Type Book Chapter Authors McKnight, Cliff; Dillon, Andrew; Shackel, Brian Citation The Electronic journal and its implications for the digital library 1996, :351-368 Computer Networking and Scholarly Communication in the 21st Century Publisher New York: SUNY Press (SUNY Series in Computer-Mediated Communication) Journal Computer Networking and Scholarly Communication in the 21st Century Download date 27/09/2021 00:25:20 Link to Item http://hdl.handle.net/10150/105169 THE ELECTRONIC JOURNAL AND ITS IMPLICATIONS FOR THE ELECTRONIC LIBRARY Cliff McKnight(1), Andrew Dillon(2) and Brian Shackel(3) (1) Department of Information and Library Studies, Loughborough University of Technology (2) School of Library and Information Science, Indiana University (3) HUSAT Research Institute, Loughborough University of Technology This item is not the definitive copy. Please use the following citation when referencing this material: McKnight, C., Dillon, A. and Shackel, B. (1996) The electronic journal and its implications for the digital library. In: T. Harrison and T. Stephens (eds.) Computer Networking and Scholarly Communication in the 21st Century. NY: SUNY Press, 351- 368. 1. INTRODUCTION It is now over ten years since the first electronic journal experiments (e.g., EIES, BLEND) and the intervening years have not seen researchers being idle in this field. Indeed, while experiments have continued apace in an attempt to answer various questions such as the appropriateness of particular interfaces, electronic journals have continued to appear. The third edition of the ARL list (Okerson, 1993) contains 45 electronic journals while the first edition, only two years earlier (Okerson, 1991), listed only 27.
    [Show full text]
  • Nroff/Troff User's Manual
    AT&T Bell Laboratories Murray Hill, New Jersey 07974 Computing Science Technical Report No. 54 Troff User's Manual² Joseph F. Ossanna Brian W. Kernighan Revised November, 1992 Troff User's Manual² Joseph F. Ossanna Brian W. Kernighan AT&T Bell Laboratories Murray Hill, New Jersey 07974 Revised November, 1992 Troff User's Manual² Joseph F. Ossanna Brian W. Kernighan AT&T Bell Laboratories Murray Hill, New Jersey 07974 Introduction Troff and nroff are text processors that format text for typesetter- and typewriter-like terminals, respectively. They accept lines of text interspersed with lines of format control information and format the text into a printable, paginated document having a user-designed style. Troff and nroff offer unusual free- dom in document styling: arbitrary style headers and footers; arbitrary style footnotes; multiple automatic sequence numbering for paragraphs, sections, etc; multiple column output; dynamic font and point-size control; arbitrary horizontal and vertical local motions at any point; and a family of automatic overstriking, bracket construction, and line-drawing functions. Troff produces its output in a device-independent form, although parameterized for a specific device; troff output must be processed by a driver for that device to produce printed output. Troff and nroff are highly compatible with each other and it is almost always possible to prepare input acceptable to both. Conditional input is provided that enables the user to embed input expressly des- tined for either program. Nroff can prepare output directly for a variety of terminal types and is capable of utilizing the full resolution of each terminal. A warning, however: nroff necessarily cannot support all fea- tures of troff.
    [Show full text]