From 2bf6b273bae93038ad97a10f60be274ab8a63648 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 18 Apr 2023 19:45:16 +0000 Subject: lettrine (18apr23) git-svn-id: svn://tug.org/texlive/trunk@66888 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/lettrine/lettrine.sty | 182 +++++++++------------- 1 file changed, 76 insertions(+), 106 deletions(-) (limited to 'Master/texmf-dist/tex/latex/lettrine/lettrine.sty') diff --git a/Master/texmf-dist/tex/latex/lettrine/lettrine.sty b/Master/texmf-dist/tex/latex/lettrine/lettrine.sty index ab3e863b28d..58ca5035c50 100644 --- a/Master/texmf-dist/tex/latex/lettrine/lettrine.sty +++ b/Master/texmf-dist/tex/latex/lettrine/lettrine.sty @@ -6,41 +6,18 @@ %% %% lettrine.dtx (with options: `sty') %% -%% This file is a generated file part of the lettrine package. -%% ----------------------------------------------------------- -%% -%% For the copyright see the source file `lettine.dtx'. -%% -%% This file can be distributed and/or modified under the terms -%% of the LaTeX Project Public License either version 1.3c of this -%% license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3c or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. -%% -%% This work has the LPPL maintenance status "maintained". -%% -%% The Current Maintainer of this work is Daniel Flipo. -%% -%% Please report errors to: -%% -\NeedsTeXFormat{LaTeX2e}[2018-04-01] +%% IMPORTANT NOTICE: +%% For the copyright see the source file `lua-typo.dtx’. +%% +\NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesFile{lettrine.sty} - [2022-09-25 v2.30 (Daniel Flipo)] -\ifdefined\DeclareRelease - \DeclareRelease{v1.6}{1999-03-03}{lettrine-2006-03-17.sty} - \DeclareRelease{v1.9}{2012-07-20}{lettrine-2015-08-31.sty} - \DeclareRelease{v2.0}{2018-07-21}{lettrine-2018-08-18.sty} - \DeclareCurrentRelease{}{2020-03-14} -\else - \PackageWarning{lettrine}{Your LaTeX kernel is too old to provide - access\MessageBreak to former versions of the lettrine package.% - \MessageBreak If you need rollback, please upgrade% - \MessageBreak your LaTeX kernel (2018-04-01 or newer),% - \MessageBreak otherwise you are fine; reported} -\fi -\RequirePackage{xkeyval,minifp} + [2023-04-18 v2.40 (Daniel Flipo)] +\DeclareRelease{v1.6}{1999-03-03}{lettrine-2006-03-17.sty} +\DeclareRelease{v1.9}{2012-07-20}{lettrine-2015-08-31.sty} +\DeclareRelease{v2.0}{2018-07-21}{lettrine-2018-08-18.sty} +\DeclareRelease{v2.3}{2022-09-25}{lettrine-2022-09-25.sty} +\DeclareCurrentRelease{}{2023-04-18} +\RequirePackage{xfp} \newcounter{DefaultLines} \setcounter{DefaultLines}{2} \newcounter{DefaultDepth} @@ -59,30 +36,6 @@ \newif\ifLettrineImage \newif\ifLettrineOnGrid \newif\ifLettrineRealHeight -\InputIfFileExists{lettrine.cfg} - {\typeout{Loading lettrine.cfg}} - {\typeout{lettrine.cfg not found, using default values}} -\DeclareOptionX{lines}[\value{DefaultLines}]{\setcounter{DefaultLines}{#1}} -\DeclareOptionX{depth}[\value{DefaultDepth}]{\setcounter{DefaultDepth}{#1}} -\DeclareOptionX{lhang}[]{\ifx#1\@empty\else - \renewcommand*{\DefaultLhang}{#1}\fi} -\DeclareOptionX{loversize}[]{\ifx#1\@empty\else - \renewcommand*{\DefaultLoversize}{#1}\fi} -\DeclareOptionX{lraise}[]{\ifx#1\@empty\else - \renewcommand*{\DefaultLraise}{#1}} -\DeclareOptionX{findent}[\the\DefaultFindent]{% - \setlength{\DefaultFindent}{#1}} -\DeclareOptionX{nindent}[\the\DefaultNindent]{% - \setlength{\DefaultNindent}{#1}} -\DeclareOptionX{slope}[\the\DefaultSlope]{\setlength{\DefaultSlope}{#1}} -\DeclareOptionX{image}[true]{\csname LettrineImage#1\endcsname} -\DeclareOptionX{grid}[true]{\csname LettrineOnGrid#1\endcsname} -\DeclareOptionX{novskip}[\the\DiscardVskip]{\setlength{\DiscardVskip}{#1}} -\DeclareOptionX{realheight}[true]{\csname LettrineRealHeight#1\endcsname} -\DeclareOptionX{optionsfile}[]{\ifx#1\@empty\else - \renewcommand*{\DefaultOptionsFile}{#1}\fi} -\ProcessOptionsX - \newsavebox{\L@lbox} \newsavebox{\L@tbox} \newcounter{L@lines} @@ -110,7 +63,47 @@ \newif\ifL@image \newif\ifL@grid \newif\ifL@realh -\newif\ifL@selfref +\newcommand*{\LettrineTestString}{EFTZ} +\InputIfFileExists{lettrine.cfg} + {\typeout{Loading lettrine.cfg}} + {\typeout{lettrine.cfg not found, using default values}} +\DeclareKeys[LettrineGlobal] + { + lines.code = \setcounter{DefaultLines}{#1} , + depth.code = \setcounter{DefaultDepth}{#1} , + lhang.store = \DefaultLhang , + loversize.store = \DefaultLoversize , + lraise.store = \DefaultLraise , + findent.code = \setlength{\DefaultFindent}{#1} , + nindent.code = \setlength{\DefaultNindent}{#1} , + slope.code = \setlength{\DefaultSlope}{#1} , + novskip.code = \setlength{\DiscardVskip}{#1} , + image.if = LettrineImage , + grid.if = LettrineOnGrid , + realheight.if = LettrineRealHeight , + refstring.default:n = \l@initial , + refstring.store = \LettrineTestString , + optionsfile.store = \DefaultOptionsFile + } +\ProcessKeyOptions[LettrineGlobal] +\DeclareKeys[LettrineLocal] + { + lines.code = \setcounter{L@lines}{#1} , + depth.code = \setcounter{L@depth}{#1} , + lhang.code = \renewcommand*{\L@hang}{#1} , + loversize.code = \renewcommand*{\L@oversize}{#1} , + lraise.code = \renewcommand*{\L@raise}{#1} , + ante.code = \renewcommand*{\L@ante}{#1} , + findent.code = \setlength{\L@Findent}{#1} , + nindent.code = \setlength{\L@Nindent}{#1} , + slope.code = \setlength{\L@slope}{#1} , + novskip.code = \setlength{\L@novskip}{#1} , + image.if = L@image , + grid.if = L@grid , + realheight.if = L@realh , + refstring.default:n = \l@initial , + refstring.store = \l@refstring + } \newcommand*{\LettrineTextFont}{\scshape} \newcommand*{\LettrineSecondString}{x} \newcommand*{\LettrineFontHook}{} @@ -129,12 +122,11 @@ \setlength{\L@height}{\L@target@tht}% \addtolength{\L@height}{\L@oversize\L@target@tht}% } -\newcommand*{\LettrineTestString}{EFTZ} \def\compute@fontsize{% - \ifL@selfref - \def\Lettrine@RefString{\l@refstring}% - \else + \ifx\l@refstring\@empty \def\Lettrine@RefString{\LettrineTestString}% + \else + \def\Lettrine@RefString{\l@refstring}% \fi \sbox{\@tempboxa}{\LettrineFontHook \fontsize{\L@height}{\L@height}\selectfont @@ -146,7 +138,7 @@ \def\L@factor{1}% \else \@tempcntb=\L@height - \MFPdiv{\the\@tempcntb}{\the\@tempcnta}\L@factor + \def\L@factor{\fpeval{\the\@tempcntb/\the\@tempcnta}}% \fi } \newcommand*{\LettrineFont}{% @@ -166,25 +158,20 @@ \sbox{\L@lbox}{\LettrineFont \l@initial}% \fi } -\define@key{L}{lines}{\setcounter{L@lines}{#1}} -\define@key{L}{depth}{\setcounter{L@depth}{#1}} -\define@key{L}{lhang}{\renewcommand*{\L@hang}{#1}} -\define@key{L}{loversize}{\renewcommand*{\L@oversize}{#1}} -\define@key{L}{lraise}{\renewcommand*{\L@raise}{#1}} -\define@key{L}{ante}{\renewcommand*{\L@ante}{#1}} -\define@key{L}{findent}{\setlength{\L@Findent}{#1}} -\define@key{L}{nindent}{\setlength{\L@Nindent}{#1}} -\define@key{L}{slope}{\setlength{\L@slope}{#1}} -\define@key{L}{image}[true]{\csname L@image#1\endcsname} -\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}} -\newcommand*{\LettrineOptionsFor}[2]{\@namedef{l@#1-keys}{#2}} +\newcommand*{\LettrineOptionsFor}[2]{% + \edef\l@tmpa{#1}% + \begingroup + \def\color##1##{\l@color{##1}}% + \let\l@color\@gobbletwo + \def\textcolor##1##{\l@textcolor{##1}}% + \def\l@textcolor##1##2##3{##3}% + \xdef\l@tmpb{\l@initial}% + \endgroup + \ifx\l@tmpa\l@tmpb \SetKeys[LettrineLocal]{#2}\fi + } \def\lettrine{\@ifnextchar[\@lettrine{\@lettrine[]}} \def\@lettrine[#1]#2#3{% - \def\l@initial{#2}\let\l@refstring\l@initial + \def\l@initial{#2}\let\l@refstring\@empty \setcounter{L@lines}{\value{DefaultLines}}% \setcounter{L@depth}{\value{DefaultDepth}}% \renewcommand*{\L@hang}{\DefaultLhang}% @@ -198,7 +185,7 @@ \ifLettrineImage\L@imagetrue\else\L@imagefalse\fi \ifLettrineOnGrid\L@gridtrue\else\L@gridfalse\fi \ifLettrineRealHeight\L@realhtrue\else\L@realhfalse\fi - \setkeys{L}{#1}% + \SetKeys[LettrineLocal]{#1}% \sbox{\L@tbox}{\LettrineTextFont{\LettrineSecondString}}% \ifL@realh \def\@tempa{#3}% @@ -207,36 +194,19 @@ {Empty second argument,\MessageBreak ignoring option `realheight';}% \else - \sbox{\L@tbox}{\LettrineTextFont{#3}}% + \sbox{\L@tbox}{{\LettrineTextFont{#3}}}% \fi \fi \if\DefaultOptionsFile\relax \else - \begingroup + \setupL@lbox + \setlength{\LettrineWidth}{\wd\L@lbox}% \InputIfFileExists{\DefaultOptionsFile}% {}% {\PackageWarning{lettrine.sty}% {File \DefaultOptionsFile\space not found}% }% - \def\color##1##{\l@color{##1}}% - \let\l@color\@gobbletwo - \def\textcolor##1##{\l@textcolor{##1}}% - \def\l@textcolor##1##2##3{##3}% - \expandafter\ifx\csname l@#2-keys\endcsname\relax - \gdef\l@LOKeys{}% - \else - \xdef\l@LOKeys{\csname l@#2-keys\endcsname}% - \fi - \endgroup - \def\KV@prefix{KV@L@}% - \let\@tempc\relax - \expandafter\KV@do\l@LOKeys,\relax, - \setupL@lbox - \setlength{\LettrineWidth}{\wd\L@lbox}% - \def\KV@prefix{KV@L@}% - \let\@tempc\relax - \expandafter\KV@do\l@LOKeys,\relax, - \setkeys{L}{#1}% + \SetKeys[LettrineLocal]{#1}% \fi \setupL@lbox \setlength{\LettrineWidth}{\wd\L@lbox}% @@ -252,7 +222,7 @@ \ifdim\@tempdima=\z@\else\space loversize=\L@oversize\fi;% \MessageBreak reported}% \endgroup - \sbox{\L@tbox}{\LettrineTextFont{#3}}% + \sbox{\L@tbox}{{\LettrineTextFont{#3}}}% \setlength{\L@first}{\LettrineHeight}% \setlength{\L@lraise}{\L@raise\L@target@tht}% \addtolength{\L@first}{\L@lraise}% @@ -303,7 +273,7 @@ \parshape=\L@parshape\relax \smash{\llap{\mbox{\L@ante}\raisebox{\L@lraise}{\usebox{\L@lbox}}% \hskip \the\L@Findent}}% - \usebox{\L@tbox}% + \unhcopy\L@tbox\relax \ifnum\@listdepth>0 \Lreset@listparshape \fi } \newtoks\Llist@everypar @@ -315,6 +285,6 @@ \let\everypar\Llist@everypar }% } -\endinput +%% %% %% End of file `lettrine.sty'. -- cgit v1.2.3