Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Troff
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Macros == In general, one was not encouraged to use troff directly, but rather go through some easier-to-use interface.<ref>{{cite book | title=Troff Typesetting for UNIX Systems Β·| first1=Sandra L. | last1=Emerson | first2=Karen | last2=Paulsell | year=1987 | page =9 | publisher=Prentice-Hall | location=Englewood Cliffs, New Jersey}}</ref><ref name="gehani">{{cite book | first=Narain | last=Gehani | title=Document Formatting and Typesetting on the UNIX System | publisher=Silicon Press | location=Summit, New Jersey | edition=Second | year=1992 | pages=11–12 | isbn=978-0-9615336-2-5 | url=https://books.google.com/books?id=Wz1C5JhTzlYC&q=-m&pg=PA15 }}</ref> Troff includes '''macros''' that are run before starting to process the document. These macros include setting up page headers and footers, defining new commands, and influencing how the output will be formatted. The [[command-line argument]] for including a macro set is ''-m'''''name''', which has led to many macro sets being known as the base filename with a leading '''m'''.<ref>{{cite web | url=https://www.stephenlindholm.com/groff_macros.html | title=groff/troff macros: ms, mm, me or mom | first=Stephen | last=Lindholm | publisher=... | access-date=June 3, 2024}}</ref> The standard macro sets, with leading '''m''' are: * '''man''' for creating [[Unix manual|manual]] pages<ref>{{cite web |title=Writing and Formmating UNIX Manual Pages with -man macros |url=http://home.fnal.gov/~mengel/man_page_notes.html |website=home.fnal.gov |access-date=7 May 2019}}</ref><ref>{{man|7|man|ManKier}}</ref> * '''mdoc''' for semantically-annotated [[Unix manual|manual]] pages, which are better adapted to [[mandoc]] conversion to other formats.<ref>{{man|7|mdoc|FreeBSD}}</ref><ref>{{cite web |title=Index - Mandoc extended documentation |url=http://mandoc.bsd.lv/mdoc/ |website=Mandoc |access-date=7 May 2019}}</ref> <code>mandoc</code> is a fusion that supports both sets of manual commands.<ref name=tmac/> * '''me''' for creating research papers<ref>{{man|7|groff_me|ManKier}}</ref> * '''mm''' for creating [[memorandum]]s<ref>{{man|7|groff_mm|ManKier}}</ref> * '''ms''' for creating books, reports, and technical documentation<ref>{{man|7|groff_ms|ManKier}}</ref> The ms macros were the first of these, developed at AT&T, before they were supplanted by the mm macros.<ref name="Srinivasan"/> One goal of the mm macros was that they be usable by the [[typing pool]] at Bell Labs and, over time, this happened and the mm macros became a standard at Bell Labs.<ref name="oh-mashey">{{cite interview | url=https://archive.computerhistory.org/resources/access/text/2018/10/102738835-05-01-acc.pdf | title=Oral History of John Mashey | first=John| last=Mashey | interviewer=John Markoff | editor=Dag Spicer | publisher=Computer History Museum | location=Mountain View, California | date=July 18, 2018 | pages=27β29, 37 | access-date=May 26, 2024 }}</ref> AT&T made the mm macros commercially available for System V Unix.<ref name="Srinivasan"/> In contrast, the me macros were developed at Berkeley.<ref name="Srinivasan">{{cite book | first=B. | last=Srinivasan | title=UNIX Document Processing and Typesetting | publisher=World Scientific | location=Singapore | year=1993 | pages= 11β12 | isbn=978-981-02-0605-5 | url=https://books.google.com/books?id=VKPBHCWTCGEC&q=unix+document+processing+and+typesetting+hound}}</ref> An example of a simple business letter prepared with the mm macros would be: <syntaxhighlight lang="text"> .TL .ND "January 10, 1993" .AU "Ms. Jane Smith" .AT "Upcoming appointment" .MT 5 Reference #A12345 .sp 4 Mr. Samuel Jones .sp 0 Field director, Bureau of Inspections .sp 0 1010 Government Plaza .sp 0 Capitoltown, ST .sp 3 Dear Mr. Jones, .sp 2 .P Making reference to the noted obligation to submit for state inspection our newly created production process, we request that you consider the possible inappropriateness of subjecting the innovative technologies of tomorrow to the largely antiquated requirements of yesterday. If our great state is to prosper in the twenty-first century, we must take steps .B now , in .I this year of .I this decade, to prepare our industrial base for the interstate and international competition that is sure to appear. Our new process does precisely that. Please do not let it be undone by a regulatory environment that is no longer apt. .P Thank you for your consideration of our position. .FC Sincerely .SG </syntaxhighlight> A comprehensive list of macros available is usually listed in a <code>tmac(5)</code> [[manual page]].<ref name=tmac>{{man|5|groff_tmac|ManKier}}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)