Path: utzoo!mnetor!uunet!munnari!otc!metro!basser!elecvax!agsm!bobm From: bobm@agsm.unsw.oz (Robert Marks) Newsgroups: comp.text Subject: troff .DC macro for drop caps, version 2.0 Message-ID: <561@agsm.unsw.oz> Date: 21 Feb 88 07:40:21 GMT Organization: Australian Graduate School of Management Lines: 152 Summary: 2.0 handles .ls 2 and drop caps spanning up to 5 lines ( <100 pts) Below is a shar file containing version 2.0 of the .DC drop cap troff macro which now automatically works with .ls 2 double spacing, and takes an argument specifying the size (in lines spanned) of the drop cap (default=2). Because of the 99-point limitation of \s(NN, the macro abandons drop caps greater than 99 points in size. Thanks to Dean Okamura for suggesting the use of \& and that the size of the drop cap should be a function of the ambient point size, .s. The bug pointed out by several people has been fixed by explicit examination of drop cap size >< 36 points. I haven't been able to see how to separate a string into the first character and the rest using troff functions -- although john@basser.oz.au suggested a way of capturing the first character (unless a slosh, \) -- so one still has to put up with incomplete words (eg. ut) from spell. Comments and suggestions welcome, Bob Robert MARKS, Australian Graduate School of Management, University of New South Wales, PO Box 1, Kensington, NSW 2033, Australia. PHONE: +61 2 662-0271 Fax: +61 2 662-2451 ARPA: bobm%agsm.unsw.oz@uunet.uu.net ACSnet: bobm@agsm.unsw.oz CSNET: bobm%agsm.unsw.oz.au JANET: agsm.unsw.oz!bobm@ukc UUCP: {uunet,hplabs,ukc,mcvax,ubc-vision,nttlab}!munnari!agsm.unsw.oz!bobm #--------------------------------CUT HERE------------------------------------- #! /bin/sh # # This is a shell archive. Save this into a file, edit it # and delete all lines above this comment. Then give this # file to sh by executing the command "sh file". The files # will be extracted into the current directory owned by # you with default permissions. # # The files contained herein are: # # -rw-r----- 1 bobm bobm 4281 Feb 21 17:37 dropinmm # echo 'x - dropinmm' if test -f dropinmm; then echo 'shar: not overwriting dropinmm'; else sed 's/^X//' << '________This_Is_The_END________' > dropinmm X.\" X.\" The following is a (revised) short troff macro for creating drop caps X.\" at the beginning of lines or paragraphs or sections. X.\" Its first argument is the string to be dropped, X.\" and its second (optional) argument is the number of lines to be X.\" spanned (2, 3, 4, or 5; default=2). X.\" The revised version will work with double-spacing (.ls 2) X.\" X.\" Written by Robert Marks, bobm@agsm.unsw.oz.au -- Version 2.0, Feb 19, 1988 X.\" with suggestions by dean@jpl-devvax.jpl.nasa.gov (Dean Okamura) X.\" X.\" DC sub-macro -- indent revert, trap turned off X.de In X'in X.wh \\n(v2u X.. X.\" .DC Drop Capital letter to the next line X.de DC X.br X.nr nL 2 X. if "\\$2"3" .nr nL 3 X. if "\\$2"4" .nr nL 4 X. if "\\$2"5" .nr nL 5 X.nr fS \\n(.s X.nr pS (\\n(nL*\\n(.L*\\n(.v/10)+(35*\\n(fS*(3*\\n(nL-4)/200) X.ie \\n(pS>99 \{\ X. tm The drop cap on line \\n(c. of file \\n(.F is too large -- X. tm (\\n(pS > 99), ... so this drop cap has been abandoned. X\\$1\c\} X.el \{\ X. ne \\n(nL X\& X. mk hH X. nr v2 (\\n(nL*\\n(.L*\\n(.v)+\\n(hH X. nr vV \\n(.L*(\\n(nL-2) X. sp \\n(vV X. ie \\n(pS>36 \{\s(\\n(pS\\$1\s\\n(fS X. nr hS \w'\s(\\n(pS\\$1\s\\n(fS\\^'\} X. el \{\s\\n(pS\\$1\s\\n(fS X. nr hS \w'\s\\n(pS\\$1\s\\n(fS\\^'\} X. in +\\n(hSu X. sp |\\n(hHu X. wh \\n(v2u In\} X.. X.\" Description of the number registers used: X.\" nL is the size (in lines) of the drop cap X.\" fS is the existing font size (in points) X.\" pS is the drop cap size (in points) X.\" hH is the position of the top line (in u) X.\" v2 is the position of the In trap to turn off the indent of +hSu X.\" The following text illustrates the drop cap macro in action: X.\" X.DC P Xut this macro at the top of this file and ditroff it to your Xfavourite output laser printer to see what it does. XRemember that two-line drop caps look best with at least two and preferably Xthree lines of text around them, so that the large letter X(point size = \n(pS in this paragraph) stands out. XIt uses \e& to print nothing on the top line. XFor larger -- three-, four-, or five-line -- drop caps, invoke .DC with Xa second argument of 3, 4, or 5, respectively. XNote that .DC works with .ls 2 double-spacing as well. X.br X.DC P 3 Xut this macro at the top of this file and ditroff it to your Xfavourite output laser printer to see what it does. XRemember that two-line drop caps look best with at least two and preferably Xthree lines of text around them, so that the large letter X(point size = \n(pS in this paragraph) stands out. XIt uses \e& to print nothing on the top line. XFor larger -- three-, four-, or five-line -- drop caps, invoke .DC with Xa second argument of 3, 4, or 5, respectively. XNote that .DC works with .ls 2 double-spacing as well. X.br X.DC P 4 Xut this macro at the top of this file and ditroff it to your Xfavourite output laser printer to see what it does. XRemember that two-line drop caps look best with at least two and preferably Xthree lines of text around them, so that the large letter X(point size = \n(pS in this paragraph) stands out. XIt uses \e& to print nothing on the top line. XFor larger -- three-, four-, or five-line -- drop caps, invoke .DC with Xa second argument of 3, 4, or 5, respectively. XNote that .DC works with .ls 2 double-spacing as well. X.br X.DC P 5 Xut this macro at the top of this file and ditroff it to your Xfavourite output laser printer to see what it does. XRemember that two-line drop caps look best with at least two and preferably Xthree lines of text around them, so that the large letter X(point size = \n(pS in this paragraph) stands out. XIt uses \e& to print nothing on the top line. XFor larger -- three-, four-, or five-line -- drop caps, invoke .DC with Xa second argument of 3, 4, or 5, respectively. XNote that .DC works with .ls 2 double-spacing as well. X.br X.ps 16 X.vs 18 X.DC P 5 Xut this macro at the top of this file and ditroff it to your Xfavourite output laser printer to see what it does. XRemember that two-line drop caps look best with at least two and preferably Xthree lines of text around them, so that the large letter X(point size = \n(pS in this paragraph) stands out. XIt uses \e& to print nothing on the top line. XFor larger -- three-, four-, or five-line -- drop caps, invoke .DC with Xa second argument of 3, 4, or 5, respectively. XNote that .DC works with .ls 2 double-spacing as well. ________This_Is_The_END________ if test `wc -l < dropinmm` -ne 108; then echo 'shar: dropinmm was damaged during transit (should have been 108 bytes)' fi fi ; : end of overwriting check exit 0