mh-chart.man7: $(ALLPROGS)
        $(srcdir)/mh-chart-gen.sh $(ALLPROGS) >$@
 
+titles:
+       $(srcdir)/gettitles.sh 1 >titles1.temp
+       $(srcdir)/gettitles.sh 5 >titles5.temp
+       $(srcdir)/gettitles.sh 7 >titles7.temp
+       $(srcdir)/gettitles.sh 8 >titles8.temp
+
 $(MAN1) $(MAN5) $(MAN7) $(MAN8): man.sed
 
 # create the sed file for building man pages
-man.sed: Makefile
+man.sed: Makefile titles
        @echo 's,%nmhwarning%,THIS FILE HAS BEEN AUTOMATICALLY GENERATED.  DO NOT EDIT.,g' > $@
        @echo 's,%nmhversion%,mmh-$(VERSION),g' >> $@
        @echo 's,%nmhdate%,$(DATE),g' >> $@
        @echo ' s,%mhl_format%,,g' >> $@
        @echo '/%mhl_reply%/r $(top_srcdir)/etc/mhl.reply' >> $@
        @echo ' s,%mhl_reply%,,g' >> $@
+       @echo '/^%titles1%$$/r titles1.temp' >> $@
+       @echo '/^%titles5%$$/r titles5.temp' >> $@
+       @echo '/^%titles7%$$/r titles7.temp' >> $@
+       @echo '/^%titles8%$$/r titles8.temp' >> $@
+       @echo '/^%titles[0-9]%$$/d' >> $@
 
 # ========= INSTALL TARGETS =========
 
 clean: mostlyclean
        rm -f $(MAN1) $(MAN5) $(MAN7) $(MAN8)
        rm -f man.sed mh-chart.man7
+       rm -f titles[0-9].temp
 
 distclean: clean
        rm -f Makefile
 
 .PP
 .RS 5
 .IP \fI<num1>\fR\-\fI<num2>\fR 15
-Indicates all messages in the range <num1> to <num2>, inclusive. The range must be nonempty.
+Indicates all messages in the range <num1> to <num2>, inclusive.
+The range must be nonempty.
 .IP \fI<num>\fR:+\fIN\fR 15
 .IP \fI<num>\fR:\-\fIN\fR 15
 Up to
 .RS 5
 .fc ^ ~
 .nf
-.ta 1.5i
-^ali(1)~^\- list mail aliases
-^anno(1)~^\- annotate messages
-^burst(1)~^\- explode digests into messages
-^comp(1)~^\- compose a message
-^dist(1)~^\- redistribute a message to additional addresses
-^flist(1)~^\- list folders with messages in given sequence(s)
-^flists(1)~^\- list all folders with messages in given sequence(s)
-^folder(1)~^\- set/list current folder/message
-^folders(1)~^\- list all folders
-^forw(1)~^\- forward messages
-^inc(1)~^\- incorporate new mail
-^mark(1)~^\- mark messages
-^mhbuild(1)~^\- translate MIME composition draft
-^mhl(1)~^\- produce formatted listings of mmh messages
-^mhlist(1)~^\- list information about content of MIME messages
-^mhmail(1)~^\- send mail (mailx replacement)
-^mhparam(1)~^\- print mmh profile components
-^mhpath(1)~^\- print full pathnames of mmh messages and folders
-^mhpgp(1)~^\- verify and decrypt a message with gnupg
-^mhsign(1)~^\- sign or encrypt a message with gnupg
-^mhstore(1)~^\- store contents of MIME messages into files
-^mmh(1)~^\- initialize the mmh environment
-^mmhwrap(1)~^\- invoke mmh commands if they are not in $PATH
-^next(1)~^\- show the next message
-^packf(1)~^\- pack a folder into mbox format
-^pick(1)~^\- select messages by content
-^prev(1)~^\- show the previous message
-^prompter(1)~^\- prompting editor front end
-^rcvdist(1)~^\- asynchronously redistribute new mail
-^rcvpack(1)~^\- asynchronously append a message to an mbox file
-^rcvstore(1)~^\- asynchronously incorporate new mail
-^refile(1)~^\- file messages in other folders
-^repl(1)~^\- reply to a message
-^rmf(1)~^\- remove folder
-^rmm(1)~^\- remove messages
-^scan(1)~^\- produce a one line per message scan listing
-^send(1)~^\- send a message
-^sendfiles(1)~^\- send multiple files and directories in MIME message
-^show(1)~^\- display MIME messages
-^slocal(1)~^\- asynchronously filter and deliver new mail
-^sortm(1)~^\- sort messages
-^whatnow(1)~^\- prompting front\-end for send
-^whom(1)~^\- list recipients of a message
+.ta 1.7i
+%titles1%
 .sp
-^ap(8)~^\- parse addresses 822\-style
-^dp(8)~^\- parse dates 822\-style
-^fmtdump(8)~^\- decode \fImmh\fP format files
-^spost(8)~^\- deliver a message
+%titles8%
 .fi
 .RE
 .PP
 .RS 5
 .fc ^ ~
 .nf
-.ta 1.5i
-^mh\-alias(5)~^\- alias file for mmh message system
-^mh\-format(5)~^\- format file for mmh message system
-^mh\-mail(5)~^\- message format for mmh message system
-^mh\-profile(5)~^\- user customization for mmh message system
+.ta 1.7i
+%titles5%
 .sp
-^mmh(7)~^\- introduction to the mmh message system
-^mh\-draft(7)~^\- draft folder facility
-^mh\-sequence(7)~^\- sequence specification for mmh message system
+%titles7%
 .RE
 
 .SH FILES
 .fc ^ ~
 .nf
-.ta \w'%etcdir%/ExtraBigFileName  'u
+.ta \w'%etcdir%/FileName  'u
 ^%bindir%~^contains \fImmh\fR commands
 ^%etcdir%~^contains \fImmh\fR format files
 ^%libdir%~^contains \fImmh\fR library commands