groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] Proposed revised START macro for mom


From: James J. Ramsey
Subject: [Groff] Proposed revised START macro for mom
Date: Tue, 7 Jan 2003 09:37:57 -0800 (PST)

I created a modified version of the START macro in
-mom that is more customizable than the original. The
changes I made were pretty much a reshuffling of the
code so that if the PRINTSTYLE was set to TYPESET, the
following macros could be redefined to change the look
of the docheader:

.TITLE_DOCHEADER \" Controls the docheader when the 
.                \" DOCTYPE is set to DEFAULT

.CHAPTER_DOCHEADER \" Controls the docheader when the 
.                \" DOCTYPE is set to CHAPTER

.NAMED_DOCHEADER \" Controls the docheader when the 
.                \" DOCTYPE is set to NAMED

The default definitions of the above macros print out
docheaders that should be identical to the docheaders
printed by the original.

The following macro is used inside TITLE_DOCHEADER and
NAMED_DOCHEADER to make them easier to read:

.PRINT_AUTHORS \"Prints the arguments of the AUTHOR
macro one to a line.

The PRINT_AUTHORS macro just contains the "while" loop
that the original START macro used to print the
arguments of AUTHOR. I just hid the loop inside a
macro.

The following strings were defined and used in the
*_DOCHEADER macros to make them easier to read:
$TITLE_PT_SIZE, $SUBTITLE_PT_SIZE, $AUTHOR_PT_SIZE,
and $DOCTYPE_PT_SIZE. Like the PRINT_AUTHORS macro,
the defined strings just encapsulate code already
present in the original START macro. By default, they
are defined as

\\n[#DOC_PT_SIZE]u\\*[$TITLE_SIZE_CHANGE]
\\n[#DOC_PT_SIZE]u\\*[$SUBTITLE_SIZE_CHANGE]
\\n[#DOC_PT_SIZE]u\\*[$AUTHOR_SIZE_CHANGE]
\\n[#DOC_PT_SIZE]u\\*[$DOCTYPE_SIZE_CHANGE]

The values of these strings can be changed from the
standard issue -mom macros TITLE_SIZE, SUBTITLE_SIZE,
AUTHOR_SIZE, and DOCTYPE_SIZE, just as they could be
from standard -mom.

I did add one macro that actually adds a feature to
-mom, namely CHAPTER_TITLE. If you want a chapter
heading like this,

Chapter 1
My Favorite Widgets

you can pass the argument "My Favorite Widgets" to
CHAPTER_TITLE. By default, "My Favorite Widgets" will
be set in $SUBTITLE_FT.

I have done some cursory testing of these macros. I
added the line .so startmacrocandidate.mom to the top
of the example files typeset.mom and typewrite.mom
from the -mom tarball. The files run through groff
just fine, and the PostScript output of the modified
files looks identical to the PostScript output of the
original files--with one slight difference, which I'll
get to shortly.

Some concerns:

In the original code for typesetting the docheaders,
the line \\n+[#DOCHEADER_LINES] occurs multiple times.
In the revised macro, all those lines using the
#DOCHEADER_LINES register were eliminated. So far as I
can tell, that register was only used to fine-tune the
space after the docheader, and the only telltale of
its absence is a slightly smaller amount of space
after the docheader on page 5 of the PostScript output
of the revised typeset.mom. That said, there is a
possibility that I may have introduced a bug by
eliminating those lines.

$TITLE_PT_SIZE and friends really should be number
registers, not strings. However, when I attempted to
make them registers (replacing \\* with \\n where
appropriate, groff barfed. I'm not sure why.

So far as I can tell, strings like $TITLE_FAM,
$TITLE_FT, $CHAPTER, etc. are really intended for
internal use, yet they appear in the macros
TITLE_DOCHEADER, CHAPTER_DOCHEADER, and
NAMED_DOCHEADER, which are explicitly meant to be
modified by -mom users.

That said, I hope these macros, either in their
present or revised form, might get folded into -mom.


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Attachment: startmacrocandidate.mom
Description: startmacrocandidate.mom


reply via email to

[Prev in Thread] Current Thread [Next in Thread]