From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/18547 Path: main.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: lettrine.sty, but not LaTeX Date: Sun, 27 Feb 2005 15:29:13 +0100 Message-ID: <4221D939.7020005@elvenkind.com> References: <000501c51b6e$e7790df0$cbddd850@DJCPX90J> <421F87B9.2000600@wxs.nl> <421F92CB.3010706@elvenkind.com> <421FA686.3020005@elvenkind.com> <42204E12.8040803@elvenkind.com> <4221A9A5.7000405@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070300020403090407030303" X-Trace: sea.gmane.org 1109514557 5750 80.91.229.2 (27 Feb 2005 14:29:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 27 Feb 2005 14:29:17 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sun Feb 27 15:29:17 2005 Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1D5PPw-0006P1-8Z for gctc-ntg-context-518@m.gmane.org; Sun, 27 Feb 2005 15:29:08 +0100 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5E6B5127C2; Sun, 27 Feb 2005 15:33:30 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 26919-04; Sun, 27 Feb 2005 15:33:30 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 7D3FF1287D; Sun, 27 Feb 2005 15:29:49 +0100 (CET) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 2DA531287D for ; Sun, 27 Feb 2005 15:29:48 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 26919-02 for ; Sun, 27 Feb 2005 15:29:47 +0100 (CET) Original-Received: from post-24.mail.nl.demon.net (post-24.mail.nl.demon.net [194.159.73.194]) by ronja.ntg.nl (Postfix) with ESMTP id 59179127C2 for ; Sun, 27 Feb 2005 15:29:47 +0100 (CET) Original-Received: from boo.demon.nl ([82.161.175.147]:37824 helo=[192.168.1.3]) by post-24.mail.nl.demon.net with esmtp (Exim 4.43) id 1D5PQX-000M2E-Te for ntg-context@ntg.nl; Sun, 27 Feb 2005 14:29:47 +0000 User-Agent: Mozilla Thunderbird 1.0 (X11/20050215) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <4221A9A5.7000405@wxs.nl> X-Virus-Scanned: by amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: by amavisd-new at ntg.nl X-MailScanner-From: ntg-context-bounces@ntg.nl X-MailScanner-To: gctc-ntg-context-518@m.gmane.org Xref: main.gmane.org gmane.comp.tex.context:18547 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:18547 This is a multi-part message in MIME format. --------------070300020403090407030303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Ok, so I *should* be doing other stuff, but this is just a lot of fun, so here is the 3rd version, with three bugfixes - No more font messages (followed Hans' advice) - No more \sbox redefinition (used it's expansion instead) - The page breaks unless the lettrine actually fits (this is an independant improvement by me) This is the last version before EuroTeX. Really. ;-) Greetings, Taco h h extern wrote: > just do something > > in setup: LettrineFont = Serif > > in code: \definedfont[Serif at ...] > > instead > > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com > | www.pragma-pod.nl > ----------------------------------------------------------------- > > _______________________________________________ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context --------------070300020403090407030303 Content-Type: application/x-tex; name="t-lettri.tex" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="t-lettri.tex" %D \module %D [ file=t-lettri, %D version=2005.02.27, %D title=\CONTEXT\ Lettrines, %D subtitle=Funny stuff, %D author=Taco Hoekwater, %D date=\currentdate, %D copyright=Public Domain] %C %C Donated to the public domain. %D This is just a quick and dirty conversion of the LaTeX package %D %D \ProvidesFile{lettrine.sty}[2004/05/22 v1.6 (D. Flipo)] %D %D Errors are likely mine, credit is due to Daniel.Flipo@univ-lille1.fr %D %D If enough people like it, I may even clean this mess up sometime. The %D current version is just a (c)rude conversion of the low-level LaTeX %D stuff to sometimes even lower-level ConTeXt. %D \unprotect \newbox\Lettrinelbox \newbox\Lettrinetbox \newcount\Lettrinelines \newdimen\LettrineHeight \newdimen\Lettrinefirst \newdimen\Lettrinenext \newdimen\Lettrineraise \newdimen\Lettrinepindent \newdimen\Lettrinefindent \newdimen\Lettrinenindent \getparameters[LettrineDefault] [Lines=2, Hang=0, Oversize=0, Raise=0, Findent=0pt, Nindent=0.5em, Slope=0pt, Ante=, FontHook=, TextFont=\sc, Image=\v!no] \def\setuplettrine{\dodoubleempty\dosetuplettrine} \def\dosetuplettrine[#1][#2]{% \doifassignmentelse{#1}{% \dodosetuplettrine[][#1]% }{% \def\ascii{}% \doifsomething{#1}{\convertargument#1\to\ascii }% \expandafter\dodosetuplettrine\expandafter[\ascii][#2]% }% } \def\dodosetuplettrine[#1][#2]{% \getparameters[LettrineDefault#1][#2] } \def\doLettrineHeight{% \LettrineHeight =\Lettrinelines\baselineskip\relax \ifnum\Lettrinelines>1 \advance\LettrineHeight -\baselineskip \fi \setbox\Lettrinetbox\hbox{{\LettrineTextFont x}}% \LettrineHeight = \dimexpr \LettrineHeight+ \ht\Lettrinetbox + \LettrineOversize\LettrineHeight \relax } \def\doLettrineEPS#1{% \doLettrineHeight\LettrineFontHook \externalfigure[#1][\c!height=\LettrineHeight]} \def\doLettrineFont{% \doLettrineHeight \definefontsynonym[LettrineFont][Serif]% \setbox\Lettrinetbox=\hbox{{\LettrineFontHook \definedfont[LettrineFont at \the\LettrineHeight] X}}% \scratchcounter = \numexpr (100*\LettrineHeight)/(\ht\Lettrinetbox/100) - 9999\relax \ifnum\scratchcounter>0 \def\tempa{1.\the\scratchcounter}% \else \def\tempa{1}% \fi \LettrineFontHook \!!dimena = \tempa\LettrineHeight \definedfont[LettrineFont at \the\!!dimena]% }% \def\lettrine{\dosingleempty\dolettrine} \def\dolettrine[#1]#2#3{% \convertargument#2\to\ascii \def\lettrgetparam##1{% \ifcsname LettrineDefault\ascii##1\endcsname \setevalue{Lettrine##1}{\csname LettrineDefault\ascii##1\endcsname}% \else \setevalue{Lettrine##1}{\csname LettrineDefault##1\endcsname}% \fi}% \processcommalist [Lines,Hang,Oversize,Raise,Findent,Nindent,Slope,Ante,FontHook,TextFont,Image]\lettrgetparam \getparameters[Lettrine][#1]% \Lettrinenindent=\LettrineNindent\relax \Lettrinefindent=\LettrineFindent\relax \Lettrinelines =\LettrineLines\relax \setbox\Lettrinelbox\hbox{{\ifx\LettrineImage\v!yes\doLettrineEPS{#2}\else\doLettrineFont #2\fi}}% \setbox\Lettrinetbox\hbox{{\LettrineTextFont{#3}}}% \ifnum\Lettrinelines=1 \Lettrinefirst = \dimexpr \ht\Lettrinelbox-\ht\Lettrinetbox \relax \Lettrineraise=0pt \else \setbox\scratchbox\hbox{{\LettrineTextFont x}}% \Lettrinefirst = \dimexpr -\Lettrinelines\baselineskip + \baselineskip -\ht\scratchbox \relax \Lettrineraise = -\LettrineRaise\Lettrinefirst \Lettrinefirst = \dimexpr\Lettrinefirst+\Lettrineraise+\ht\Lettrinelbox \relax \Lettrineraise = \dimexpr\Lettrineraise-\Lettrinelines\baselineskip +\baselineskip \relax \fi \par \ifdim\Lettrinefirst>0.2pt\vskip\Lettrinefirst\fi \setbox\scratchbox= \hbox{\LettrineAnte}% \Lettrinepindent= \dimexpr \wd\Lettrinelbox -\LettrineHang\wd\Lettrinelbox + \wd\scratchbox + \Lettrinefindent \relax \Lettrinefirst=\dimexpr \hsize -\Lettrinepindent \relax \advance\Lettrinenindent \Lettrinepindent \Lettrinenext=\dimexpr \hsize -\Lettrinenindent \relax \advance\Lettrinepindent \rightskip \advance\Lettrinenindent \rightskip \advance\Lettrinelines 1 \def\Lparshape{\the\Lettrinelines\space \the\Lettrinepindent\space \the\Lettrinefirst}% \scratchcounter=\numexpr \Lettrinelines - 2 \relax \dorecurse{\scratchcounter}{% \edef\Lparshape{\Lparshape\space \the\Lettrinenindent\space \the\Lettrinenext}% \advance\Lettrinenindent\LettrineSlope \advance\Lettrinenext -\LettrineSlope }% \edef\Lparshape{\Lparshape\space \the\rightskip\space \the\hsize}% \setbox\scratchbox = \hbox{\hbox{\LettrineAnte}\raise \Lettrineraise \hbox{\box\Lettrinelbox }}% \scratchdimen = \dimexpr \dp\scratchbox + \ht\strutbox + 1pt\relax \vskip\scratchdimen \penalty0\vskip-\scratchdimen \noindent \parshape=\Lparshape \smash{\llap{\box\scratchbox}}% \hskip \the\Lettrinefindent \box\Lettrinetbox } \protect \endinput --------------070300020403090407030303 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --------------070300020403090407030303--