You didn't say what kind of book you're talking about, unfortunately.

I have a range of projects on the go but thought I would start by trying to replicate the style you see in The Unix Programming Environment. I'm aware that MOM does a lot to help with book length projects, but I'd like to begin with creating the kind of look you see with Kernighan's books, which he describes as being done with ms and a few additional macros - but I can't find any source material on how this is done.

ms doesn't have a concept of a chapter, per se, but it's easy enough to
regard the top-level section number as a chapter number.  The questions
are these, at least.
   1. Do your chapters have titles?
   2. How do you want your chapters to render typographically?
      2a. Should they start a new page?
      2b. Should they be centered?
      2c. Should they be set in a really large font?
   3. Will you be producing a table of contents?

Yes to all these. I suppose it's about having options for common layouts that we can see in the manual so users can have some examples to start from.

This might be close or far away from what you have in mind.  It is,
however, extensively annotated with roff comments.

Here's an example of what I'm trying to get to, with a manual layout then an attempt at using a macro, which doesn't work too well.

\# Set up page

\# Set left margin to 1.5in
.nr po 1in

\# Set paragraph indent to 3
.nr PI 3n


\# Set paper size for a book
.pl 8in
.nr LL 3.5in
.device papersize=5.5in,8.5in
.ds papersize 8.5in,5.5in

\# Set page numbers at the bottom of the page
.rm CH
.ds CF %

\#----------------------------------------------------------------------
\# CHAPTER
\#
.nr @CHAPTER_NUMBER 0 1
.de %CHAPTER
.bp \" Each chapter start on new page.
.sv 6
.nr actual_page \\n%	\" Save the page number.
.ad r
.sp 3
.ft TR
\s+3CHAPTER  \\n+[@CHAPTER_NUMBER]:
.nr H1 \\n[@CHAPTER_NUMBER]
.nr H2 0
\t   
.ft HB
\s+6\\$*\s0
.sp 3
.ft TR
.ad n
..

.NH
This is the first chapter
.nr H1 2
.bp
.sv 6
.ad r
.sp 3
.ft TR
\s+3CHAPTER 2:
\t
.ft HB
\s+6BOOTSTRAP
.sp 3
.ft TR
.ad n
.NH 2
How will this pan out?
.LP
This is a paragraph.
.PP
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam magna risus, semper ac eros id, eleifend rutrum tellus. Sed sed sem quam. Aenean iaculis placerat sapien, eu convallis nunc fermentum quis. Maecenas varius lectus ut ultricies rhoncus. Praesent at massa id urna elementum dictum. Nunc pretium lacus a pellentesque mattis. Integer consectetur nunc et vestibulum tempus. Integer rutrum odio vel velit volutpat auctor. Aliquam eu accumsan orci, eu lobortis nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vivamus tortor dui, mattis a eros ac, venenatis dignissim urna. Etiam maximus tellus nisi, eu scelerisque elit aliquam quis. Nullam ac orci magna.

.%CHAPTER "UNIX FOR BEGINNERS"

.LP
This is a paragraph.
.PP
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam magna risus, semper ac eros id, eleifend rutrum tellus. Sed sed sem quam. Aenean iaculis placerat sapien, eu convallis nunc fermentum quis. Maecenas varius lectus ut ultricies rhoncus. Praesent at massa id urna elementum dictum. Nunc pretium lacus a pellentesque mattis. Integer consectetur nunc et vestibulum tempus. Integer rutrum odio vel velit volutpat auctor. Aliquam eu accumsan orci, eu lobortis nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vivamus tortor dui, mattis a eros ac, venenatis dignissim urna. Etiam maximus tellus nisi, eu scelerisque elit aliquam quis. Nullam ac orci magna.

Attachment: example.pdf
Description: Adobe PDF document

Reply via email to