groff
[Top][All Lists]
Advanced

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

Re: [Groff] macro question


From: Ted Harding
Subject: Re: [Groff] macro question
Date: Tue, 11 Sep 2001 21:27:25 +0100 (BST)

On 11-Sep-01 Ralph Corderoy wrote:
> 
> Hi Gaius,
> 
>> I wonder whether anyone has a macro which will typeset the first word
>> of a chapter so that the first letter of the first word is double the
>> vertical spacing of the remainder of the word.  (There has to be a
>> name for this, can anyone enlighten me?)
> 
> Dropped capitals?  They don't have to be just two lines high.
> 
> First stab is something like this;  you get the general idea.
[snipped]

The tricky bit is to get the baseline of the dropcap and the top
of the dropcap aligned with the bottom and top of the respective
lines of text. Ralph's solution doesn't quite do this. The following
seems to work (you can test it in different point sizes and line
spacings by changing the lines ".ps 10" and "vs 12":

   .de dropcap
   .nr dummy \\w'\\$1y'u
   .nr dcht (\\n[.v]+\\n[rst])*\\n[.ps]/\\n[rst]
   .char \[dcap] \\s'\\n[dcht]u'\\$1\\s0
   \\v'\\n[.v]u'\\[dcap]\\v'-\\n[.v]u'\c
   'ti \w'\\[dcap]'u
   \\$2
   ..
   .ps 10
   .vs 12
   .dropcap W hen
   I was younger, I could remember anything, 
   whether it had happened or not; but my 
   faculties are decaying now and soon I shall 
   be so I cannot remember any but the things 
   that never happened.  It is sad to go to pieces 
   like this but we all have to do it.

(the point of the ".nr dummy" line is that you have to
apply \w to something in order to set the number register
\n[rst] to the height, in the current font, of the capital
letter ("\\$1") to be "dropped".)

And the test ".ps 18//.vs 12" is pretty convincing!

Any refinements, anyone?
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 11-Sep-01                                       Time: 21:27:25
------------------------------ XFMail ------------------------------

reply via email to

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