From e37b523eeee35826ced48838c29b610085d65ce1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 21 Aug 2018 21:52:33 +0000 Subject: lettrine (21aug18) git-svn-id: svn://tug.org/texlive/trunk@48450 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/lettrine/lettrine.cfg | 2 + Master/texmf-dist/tex/latex/lettrine/lettrine.sty | 75 ++++++++++++++--------- 2 files changed, 48 insertions(+), 29 deletions(-) (limited to 'Master/texmf-dist/tex/latex/lettrine') diff --git a/Master/texmf-dist/tex/latex/lettrine/lettrine.cfg b/Master/texmf-dist/tex/latex/lettrine/lettrine.cfg index c84e0004a8b..3af13c9caa7 100644 --- a/Master/texmf-dist/tex/latex/lettrine/lettrine.cfg +++ b/Master/texmf-dist/tex/latex/lettrine/lettrine.cfg @@ -25,6 +25,8 @@ %%\LettrineImagefalse %%\LettrineOnGridfalse %%\LettrineRealHeightfalse +%%\LettrineSelfReffalse +%%\LettrineVonefalse %% %% Theses are *commands* (value=string, only height matters): %%\renewcommand*{\LettrineTestString}{EFTZ} diff --git a/Master/texmf-dist/tex/latex/lettrine/lettrine.sty b/Master/texmf-dist/tex/latex/lettrine/lettrine.sty index 518e600a1f4..cd6ce420159 100644 --- a/Master/texmf-dist/tex/latex/lettrine/lettrine.sty +++ b/Master/texmf-dist/tex/latex/lettrine/lettrine.sty @@ -22,9 +22,9 @@ %% in the same archive or directory.) \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesFile{lettrine.sty} - [2018/07/31 v2.01 (Daniel Flipo)] + [2018/08/18 v2.1 (Daniel Flipo)] \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\RequirePackage{keyval} +\RequirePackage{keyval,minifp} \newcounter{DefaultLines} \setcounter{DefaultLines}{2} \newcounter{DefaultDepth} @@ -43,6 +43,8 @@ \newif\ifLettrineImage \newif\ifLettrineOnGrid \newif\ifLettrineRealHeight +\newif\ifLettrineVone +\newif\ifLettrineSelfRef \newsavebox{\L@lbox} \newsavebox{\L@tbox} \newcounter{L@lines} @@ -70,11 +72,12 @@ \newif\ifL@image \newif\ifL@grid \newif\ifL@realh +\newif\ifL@vone +\newif\ifL@selfref \newcommand*{\LettrineTextFont}{\scshape} +\newcommand*{\LettrineTestString}{EFTZ} +\newcommand*{\LettrineSecondString}{x} \def\Lettrine@height{% - \ifvoid\L@tbox - \sbox{\L@tbox}{\LettrineTextFont{\LettrineSecondString}}% - \fi \setlength{\L@target@ht}{\ht\L@tbox}% \@tempdima=\baselineskip \setlength{\L@target@dp}{\value{L@lines}\@tempdima}% @@ -86,37 +89,43 @@ \fi \setlength{\L@target@tht}{\L@target@ht}% \addtolength{\L@target@tht}{\L@target@dp}% - \global\L@target@ht=\L@target@ht - \global\L@target@dp=\L@target@dp - \global\L@target@tht=\L@target@tht \setlength{\L@height}{\L@target@tht}% \addtolength{\L@height}{\L@oversize\L@target@tht}% + \ifL@image + \else + \ifL@selfref + \def\Lettrine@RefString{\l@refstring}% + \else + \def\Lettrine@RefString{\LettrineTestString}% + \fi + \sbox{\@tempboxa}{\LettrineFontHook + \fontsize{\L@height}{\L@height}\selectfont + \Lettrine@RefString}% + \@tempcnta=\ht\@tempboxa + \@tempcntb=\L@height + \ifL@vone + \multiply\@tempcntb by 100 + \divide\@tempcnta by 100 + \divide\@tempcntb by \@tempcnta + \advance\@tempcntb by -9999 + \ifnum\@tempcntb>0 + \def\L@factor{1.\the\@tempcntb}% + \else + \def\L@factor{1}% + \fi + \else + \MFPdiv{\the\@tempcntb}{\the\@tempcnta}\L@factor + \fi + \fi } \newcommand*{\LettrineFontHook}{} -\newcommand*{\LettrineTestString}{EFTZ} -\newcommand*{\LettrineSecondString}{x} \newcommand*{\LettrineFont}{% - \Lettrine@height - \sbox{\@tempboxa}{\LettrineFontHook\fontsize{\L@height}{\L@height}% - \selectfont \LettrineTestString}% - \@tempcntb=\ht\@tempboxa - \@tempcnta=\L@height - \multiply\@tempcnta by 50 - \divide\@tempcntb by 200 - \divide\@tempcnta by \@tempcntb - \advance\@tempcnta by -9999 - \ifnum\@tempcnta>0 - \def\@tempa{1.\the\@tempcnta}% - \else - \def\@tempa{1}% - \fi \LettrineFontHook - \fontsize{\@tempa\L@height}{\@tempa\L@height}% + \fontsize{\L@factor\L@height}{\L@factor\L@height}% \selectfont } \newcommand*{\LettrineFontEPS}{% - \Lettrine@height\LettrineFontHook - \includegraphics[height=\L@height]% + \LettrineFontHook\includegraphics[height=\L@height]% } \define@key{L}{lines}{\setcounter{L@lines}{#1}} \define@key{L}{depth}{\setcounter{L@depth}{#1}} @@ -131,9 +140,13 @@ \define@key{L}{grid}[true]{\csname L@grid#1\endcsname} \define@key{L}{realheight}[true]{\csname L@realh#1\endcsname} \define@key{L}{novskip}{\setlength{\L@novskip}{#1}} +\define@key{L}{refstring}[\l@initial]{\L@selfreftrue + \def\l@refstring{#1}} +\define@key{L}{Vone}[true]{\csname L@vone#1\endcsname} \newcommand*{\LettrineOptionsFor}[2]{\@namedef{l@#1-keys}{#2}} \def\lettrine{\@ifnextchar[\@lettrine{\@lettrine[]}} \def\@lettrine[#1]#2#3{% + \def\l@initial{#2}\let\l@refstring\l@initial \setcounter{L@lines}{\value{DefaultLines}}% \setcounter{L@depth}{\value{DefaultDepth}}% \renewcommand*{\L@hang}{\DefaultLhang}% @@ -147,6 +160,8 @@ \ifLettrineImage\L@imagetrue\else\L@imagefalse\fi \ifLettrineOnGrid\L@gridtrue\else\L@gridfalse\fi \ifLettrineRealHeight\L@realhtrue\else\L@realhfalse\fi + \ifLettrineVone\L@vonetrue\else\L@vonefalse\fi + \ifLettrineSelfRef\L@selfreftrue\else\L@selfreffalse\fi \setkeys{L}{#1}% \sbox{\L@tbox}{\LettrineTextFont{\LettrineSecondString}}% \ifL@realh @@ -180,6 +195,7 @@ \def\KV@prefix{KV@L@}% \let\@tempc\relax \expandafter\KV@do\l@LOKeys,\relax, + \Lettrine@height \sbox{\L@lbox}{\LettrineFont #2}% \setlength{\LettrineWidth}{\wd\L@lbox}% \def\KV@prefix{KV@L@}% @@ -187,10 +203,11 @@ \expandafter\KV@do\l@LOKeys,\relax, \setkeys{L}{#1}% \fi + \Lettrine@height \ifL@image - \sbox{\L@lbox}{\LettrineFontEPS{#2}}% + \sbox{\L@lbox}{\LettrineFontEPS{#2}}% \else - \sbox{\L@lbox}{\LettrineFont #2}% + \sbox{\L@lbox}{\LettrineFont #2}% \fi \setlength{\LettrineWidth}{\wd\L@lbox}% \setlength{\LettrineHeight}{\ht\L@lbox}% -- cgit v1.2.3