From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/18506 Path: main.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: lettrine.sty, but not LaTeX Date: Sat, 26 Feb 2005 11:23:14 +0100 Message-ID: <42204E12.8040803@elvenkind.com> References: <000501c51b6e$e7790df0$cbddd850@DJCPX90J> <421F87B9.2000600@wxs.nl> <421F92CB.3010706@elvenkind.com> <421FA686.3020005@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010209090307000001000303" X-Trace: sea.gmane.org 1109413185 25009 80.91.229.2 (26 Feb 2005 10:19:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 26 Feb 2005 10:19:45 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sat Feb 26 11:19:45 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 1D4z2w-0003aK-2b for gctc-ntg-context-518@m.gmane.org; Sat, 26 Feb 2005 11:19:39 +0100 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 209EA12840; Sat, 26 Feb 2005 11:23:49 +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 02770-06; Sat, 26 Feb 2005 11:23:46 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 7FA1812839; Sat, 26 Feb 2005 11:23:46 +0100 (CET) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 46CC012839 for ; Sat, 26 Feb 2005 11:23:45 +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 02996-01-2 for ; Sat, 26 Feb 2005 11:23:44 +0100 (CET) Original-Received: from post-22.mail.nl.demon.net (post-22.mail.nl.demon.net [194.159.73.192]) by ronja.ntg.nl (Postfix) with ESMTP id 74F5912838 for ; Sat, 26 Feb 2005 11:23:44 +0100 (CET) Original-Received: from boo.demon.nl ([82.161.175.147]:36561 helo=[192.168.1.3]) by post-22.mail.nl.demon.net with esmtp (Exim 4.43) id 1D4z6u-000EHM-76 for ntg-context@ntg.nl; Sat, 26 Feb 2005 10:23:44 +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: 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:18506 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:18506 This is a multi-part message in MIME format. --------------010209090307000001000303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit David Wooten wrote: > Hmm, this is great. > However, I can't seem to get it to accept an image (Image=true or > Image=yes). Anyone else have some luck? It couldn't work. Here is a new version, with fixed image support, some cleanups in the code, and support for per-argument setup functionality as provided by \LettrineOptionsFor{...} in LaTeX The one thing I could not/did not solve is how to make ConTeXt shut up about 'bodyfont 112.5pt is defined (can better be done global)'. I think I've covered all of lettrine.sty now, but I may have overlooked a bug or two ;-) Greetings, Taco --------------010209090307000001000303 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\sbox#1#2{\setbox#1=\hbox{{#2}}} \def\doLettrineheight{% \Lettrineheight =\Lettrinelines\baselineskip\relax \ifnum\Lettrinelines>1 \advance\Lettrineheight -\baselineskip \fi \sbox{\Lettrinetbox}{\LettrineTextFont x}% \Lettrineheight = \dimexpr \Lettrineheight+ \ht\Lettrinetbox + \LettrineOversize\Lettrineheight \relax } \def\LettrineFont{% \doLettrineheight \sbox{\Lettrinetbox}{\LettrineFontHook \expanded{\switchtobodyfont[\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 \expanded{\switchtobodyfont[\the\!!dimena]}% } \def\LettrineFontEPS#1{% \doLettrineheight\LettrineFontHook \externalfigure[#1][\c!height=\Lettrineheight]} \def\lettrinenew{\dosingleempty\dolettrine} \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 \sbox{\Lettrinelbox}{\ifx\LettrineImage\v!yes\LettrineFontEPS{#2}\else\LettrineFont #2\fi}% \sbox{\Lettrinetbox}{\LettrineTextFont{#3}}% \ifnum\Lettrinelines=1 \Lettrinefirst = \dimexpr \ht\Lettrinelbox-\ht\Lettrinetbox \relax \Lettrineraise=0pt \else \sbox{\scratchbox}{\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}% \noindent \parshape=\Lparshape \smash{\llap{\hbox{\LettrineAnte}\raise \Lettrineraise \hbox{\box\Lettrinelbox }}% \hskip \the\Lettrinefindent}% \box\Lettrinetbox } \protect \endinput --------------010209090307000001000303 Content-Type: application/x-tex; name="drop.tex" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="drop.tex" \usemodule[lettri] \setuplettrine[Lines=4, Hang=.5, Oversize=0, Raise=0, Findent=0pt, Nindent=2pt, Slope=-.7em, Ante=, FontHook=, TextFont=\sc, Image=no] \setuplettrine[\'V][Lines=5] \starttext \lettrine {V}{oici} a very silly \input tufte \lettrine {\'V}{oici} a very silly \input tufte \lettrine [Image=yes]{V}{oici} a very silly \input tufte \stoptext --------------010209090307000001000303 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 --------------010209090307000001000303--