Path: utzoo!attcan!uunet!samsung!think.com!hsdndev!husc6!husc6.harvard.edu!smith From: smith@zeus.harvard.edu (Steven Smith) Newsgroups: comp.text.tex Subject: Re: Large initial Message-ID: Date: 9 Jan 91 15:12:29 GMT References: <1869@ruunsa.fys.ruu.nl> Sender: news@husc6.harvard.edu Distribution: comp.text.tex Organization: Harvard Robotics Lab, Harvard University Lines: 128 In-reply-to: spit@ruunsa.fys.ruu.nl's message of 8 Jan 91 16:34:40 GMT The following macro produces a large initial letter. By default, it provides an initial letter in the font cmr17, scaled so that the letter extends from the top of an `X' in the current font to the bottom of the second line, with no horizontal offsets. These defaults may be overridden, as described below. It behooves the user to employ Rokicki's dvips conversion program to handle the arbitrary font scaling capability. I've been pondering the addition of another feature that would allow one to indent the entire first letter, i.e., > DD oes someone have a TeX macro that produces a large > D D initial in the first line of a paragraph, somewhat > DD like the big D in front of this one. I figure one has > to twiddle a little bit with \hangindent, but I do not get it > completely right. but this remains unimplemented. I would appreciate any comments or improvements that anyone could suggest. Steven Smith smith@sandalphon.harvard.edu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Cut Here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % \bigstart % % % % A general macro to provide large letters at the start of paragraphs. % % % % Syntax: \bigstart{a}{b}[c_1][c_2]...[c_n] #1 % % % % where the following arguments are optional: % % % % a: font specification (Default=cmr17) % % b: font scale (Default=scale to nth line) % % c_1: 1st line offset from width of character % % c_2: 2d line offset from width of character % % ... % % c_n: nth line offset from width of character % % (Default=two lines, zero offset) % % % % Examples: \bigstart Call me Ishmael. % % % % \bigstart{cmb10}{\magstep4} Four score and seven years ago ... % % % % \font\rm=ptmr at12pt \rm % % \bigstart{ptmr}[0pt][-4pt][-8pt] WE, THE PEOPLE of the United States, % % in order to form a more perfect Union, establish justice, insure % % domestic tranquility, provide for the common defense, promote the % % general welfare, and secure the blessings of liberty to ourselves and % % our posterity, do ordain and establish this Constitution for the % % United States of America. % % % % % % Author: Steven T. Smith, 1990 % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \catcode`\@=11 % Make @ a letter (to name unlikely control sequences). \newif\ifsc@lespec \newif\if@ffsetspec \newif\iffirst@ff \newcount\linec@unt % Define macro to give the ratio of two integers times 1000. % Result: #1=1000(#2/#3) \newcount\numerat@r \newcount\denominat@r \newcount\tempc@unt \def\magratio#1#2#3{\numerat@r=#2 \denominat@r=#3 \def\r@t{}% \tempc@unt=\numerat@r \divide\tempc@unt by\denominat@r \ifnum\tempc@unt>0 \edef\r@t{\the\tempc@unt}\fi \multiply\tempc@unt by\denominat@r \advance\numerat@r by-\tempc@unt \multiply\numerat@r by10 \tempc@unt=\numerat@r \divide\tempc@unt by\denominat@r \edef\r@t{\r@t\the\tempc@unt}% \multiply\tempc@unt by\denominat@r \advance\numerat@r by-\tempc@unt \multiply\numerat@r by10 \tempc@unt=\numerat@r \divide\tempc@unt by\denominat@r \edef\r@t{\r@t\the\tempc@unt}% \multiply\tempc@unt by\denominat@r \advance\numerat@r by-\tempc@unt \multiply\numerat@r by10 \tempc@unt=\denominat@r \divide\tempc@unt by2 \advance\numerat@r by\tempc@unt \divide\numerat@r by\denominat@r \edef\r@t{\r@t\the\numerat@r}% #1=\r@t} \def\bigstart{\par\begingroup \def\par{\endgraf\endgroup}% \def\f@ntrootdefault{cmr17}% \def\linec@untdefault{1}\def\@ffsetdefault{[0pt][0pt]}% \sc@lespecfalse\@ffsetspecfalse\linec@unt=-1\def\@ffset{}% \futurelet\next\brace@ptional} \def\brace@ptional{\ifx\next\bgroup\def\@temp{\f@ntspec}% \else \def\@temp{\edef\f@ntroot{\f@ntrootdefault}\brack@ptional}\fi \@temp} \def\f@ntspec#1{\def\f@ntroot{#1}\futurelet\next\brace@@ptional} \def\brace@@ptional{\ifx\next\bgroup\def\@temp{\sc@lespectrue\sc@lespec}% \else \def\@temp{\sc@lespecfalse\brack@ptional}\fi \@temp} \def\sc@lespec#1{\def\sc@le{#1}\futurelet\next\brack@ptional} \def\brack@ptional{\ifx\next[\def\@temp{\@ffsetspectrue\@ffsetspec}% \else \def\@temp{\bigst@rtinit}\fi \@temp} \def\@ffsetspec[#1]{\advance\linec@unt by1 \edef\@ffset{\@ffset[#1]}\futurelet\next\brack@ptional} \def\bigst@rtinit#1{\if@ffsetspec\else \linec@unt=\linec@untdefault \edef\@ffset{\@ffsetdefault}\fi \setbox0=\hbox{X}% \ifsc@lespec \font\bigch@r=\f@ntroot\space scaled\sc@le \else \font\bigch@r=\f@ntroot \setbox1=\hbox{\bigch@r X}% \dimen0=\baselineskip \multiply\dimen0 by\linec@unt \advance\dimen0 by\ht0 \dimen1=\ht1 \advance\dimen1 by\dp1 \count11=\dimen0 \count12=\dimen1 \magratio{\count10}{\count11}{\count12}% \font\bigch@r=\f@ntroot\space scaled\count10\fi \setbox1=\hbox{\bigch@r#1}\advance\linec@unt by2 \edef\parsh@pe{\the\linec@unt}% \first@fftrue \edef\@temp{\futurelet\noexpand\next\noexpand\initparsh@pe \@ffset} \@temp} \def\initparsh@pe{\ifx\next[\def\@temp{\m@keparsh@pe}\else \def\@temp{\bigst@rt}\fi \@temp} \def\m@keparsh@pe[#1]{\dimen0=\wd1 \dimen1=\hsize \advance\dimen0 by#1 \advance\dimen1 by-\dimen0 \edef\parsh@pe{\parsh@pe\space\the\dimen0\space\the\dimen1}% \iffirst@ff \dimen2=\dimen0\first@fffalse \fi \futurelet\next\initparsh@pe} \def\bigst@rt{\edef\parsh@pe{\parsh@pe\space 0pt \hsize}% \expandafter\parshape\parsh@pe \noindent \rlap{\kern-\dimen2\raise\ht0\vbox to0pt{\box1\vss}}\ignorespaces} \catcode`\@=12 % Make @ an ``other'' (back to normal).