diff options
author | Norbert Preining <preining@logic.at> | 2008-07-29 15:47:29 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-07-29 15:47:29 +0000 |
commit | cd08345583336bc8f553a59ae8edc4caa729904c (patch) | |
tree | ab679d862a8d633d48dbade83c202b2af4f72874 /Master/texmf-dist/tex/context | |
parent | a712cd61df036f1f73973d714058bf23a2dc9617 (diff) |
add context-lettrine
git-svn-id: svn://tug.org/texlive/trunk@9883 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context')
-rw-r--r-- | Master/texmf-dist/tex/context/interface/third/lettrine.xml | 65 | ||||
-rw-r--r-- | Master/texmf-dist/tex/context/third/lettrine/t-lettrine.tex | 163 |
2 files changed, 228 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/interface/third/lettrine.xml b/Master/texmf-dist/tex/context/interface/third/lettrine.xml new file mode 100644 index 00000000000..83093547786 --- /dev/null +++ b/Master/texmf-dist/tex/context/interface/third/lettrine.xml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> + +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" + name="context/third/t-lettrine" + language="all" version="2005.03.26"> + +<cd:command name="setuplettrine" file="t-lettrine.tex"> + <cd:sequence> + <cd:string value="setuplettrine"/> + </cd:sequence> + <cd:arguments> + <cd:keywords optional="yes"> + <cd:constant type="cd:text"/> + </cd:keywords> + <cd:assignments list="yes"> + <cd:parameter name="Lines"> + <cd:constant type="cd:number"/> + </cd:parameter> + <cd:parameter name="Hang"> + <cd:constant type="cd:text"/> + </cd:parameter> + <cd:parameter name="Oversize"> + <cd:constant type="cd:text"/> + </cd:parameter> + <cd:parameter name="Raise"> + <cd:constant type="cd:text"/> + </cd:parameter> + <cd:parameter name="Findent"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="Nindent"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="Slope"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="Ante"> + <cd:constant type="cd:text"/> + </cd:parameter> + <cd:parameter name="FontHook"> + <cd:constant type="cd:command"/> + </cd:parameter> + <cd:parameter name="TextFont"> + <cd:constant type="cd:command"/> + </cd:parameter> + <cd:parameter name="Image"> + <cd:constant type="yes"/> + <cd:constant type="no" default="yes"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> +</cd:command> +<cd:command name="lettrine" file="t-lettrine.tex"> + <cd:sequence> + <cd:string value="lettrine"/> + </cd:sequence> + <cd:arguments> + <cd:assignments list="yes" optional="yes"> + <cd:inherit name="setuplettrine"/> + </cd:assignments> + <cd:content/> + <cd:content/> + </cd:arguments> +</cd:command> +</cd:interface> diff --git a/Master/texmf-dist/tex/context/third/lettrine/t-lettrine.tex b/Master/texmf-dist/tex/context/third/lettrine/t-lettrine.tex new file mode 100644 index 00000000000..ea86ddc416e --- /dev/null +++ b/Master/texmf-dist/tex/context/third/lettrine/t-lettrine.tex @@ -0,0 +1,163 @@ +%D \module +%D [ file=t-lettri, +%D version=2006.01.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 +%D Changes: +%D 2005.08.29: support use within \startframedtext ..\stop +%D 2006.01.27: support use within \startnarrower..\stop + +\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 + \ifx\LettrineImage\v!true\doLettrineEPS{#2}\else + \doLettrineFont #2\fi\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 = \dimexpr\LettrineRaise\Lettrinefirst \relax + \Lettrineraise = -\Lettrineraise \relax + \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}% + \setlocalhsize + \Lettrinepindent= \dimexpr \wd\Lettrinelbox -\LettrineHang\wd\Lettrinelbox + + \wd\scratchbox + \Lettrinefindent \relax + \Lettrinefirst=\dimexpr \localhsize -\Lettrinepindent +\rightskip+\leftskip\relax + \advance\Lettrinenindent \Lettrinepindent + \Lettrinenext=\dimexpr \localhsize -\Lettrinenindent +\rightskip+\leftskip\relax + \def\Lparshape{\the\numexpr\Lettrinelines+1\relax\space \the\Lettrinepindent\space \the\Lettrinefirst}% + \dorecurse{\numexpr \Lettrinelines - 1 \relax}{% + \edef\Lparshape{\Lparshape\space \the\Lettrinenindent\space \the\Lettrinenext}% + \advance\Lettrinenindent\LettrineSlope + \advance\Lettrinenext -\LettrineSlope + }% + \edef\Lparshape{\Lparshape\space 0pt\space \the\localhsize}% + \setbox\scratchbox = \hbox{\hbox{\LettrineAnte}\raise \Lettrineraise \hbox{\box\Lettrinelbox }}% + \scratchdimen = \dimexpr \dp\scratchbox + \ht\strutbox + 1pt\relax + \vskip\scratchdimen \penalty0\vskip-\scratchdimen + \noindent + \scratchdimen = \leftskip \leftskip=\scratchdimen + \scratchdimen = \rightskip \rightskip=\scratchdimen + \parshape=\Lparshape + \smash{\llap{\box\scratchbox}}% + \hskip \the\Lettrinefindent + \box\Lettrinetbox +} + +\protect +\endinput |