%%
%% This is file `lettrine.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% lettrine.dtx  (with options: `sty')
%% 
%% IMPORTANT NOTICE:
%% For the copyright see the source file `lettrine.dtx’.
%%
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesFile{lettrine.sty}
             [2025-12-06 v2.83 (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}
\DeclareRelease{v2.4}{2023-04-18}{lettrine-2023-04-18.sty}
\DeclareCurrentRelease{}{2025-11-25}
\newcounter{DefaultLines}
\setcounter{DefaultLines}{2}
\newcounter{DefaultDepth}
\newcommand{\DefaultOptionsFile}{}
\newcommand{\DefaultLoversize}{0}
\newcommand{\DefaultLraise}{0}
\newcommand{\DefaultLhang}{0}
\newdimen\DefaultFindent
\setlength{\DefaultFindent}{\z@}
\newdimen\DefaultNindent
\setlength{\DefaultNindent}{0.5em}
\newdimen\DefaultSlope
\setlength{\DefaultSlope}{\z@}
\newdimen\DiscardVskip
\setlength{\DiscardVskip}{1pt}
\newif\ifLettrineImage
\newif\ifLettrineOnGrid
\newif\ifLettrineRealHeight
\newif\ifLettrineMoveAtEOP
\newsavebox{\L@lbox}
\newcounter{L@lines}
\newcounter{L@depth}
\newdimen\L@Pindent
\newdimen\L@Findent
\newdimen\L@Nindent
\newdimen\L@lraise
\newdimen\L@first
\newdimen\L@next
\newdimen\L@slope
\newdimen\L@height
\newdimen\L@novskip
\newdimen\L@target@ht
\newdimen\L@target@dp
\newdimen\L@target@tht
\newdimen\LettrineWidth
\newdimen\LettrineHeight
\newdimen\LettrineDepth
\newdimen\L@finalht
\newdimen\L@finaldp
\newcommand*{\L@file}{}
\newcommand*{\L@hang}{}
\newcommand*{\L@oversize}{}
\newcommand*{\L@raise}{}
\newcommand*{\L@ante}{}
\newcommand*{\L@actual}{}
\newif\ifL@image
\newif\ifL@grid
\newif\ifL@nextpage
\newif\ifL@realh
\let\ifL@RTL\iffalse
\newcommand*{\L@viewport}{}
\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                  ,
    nextpage.if       = LettrineMoveAtEOP               ,
    realheight.if     = LettrineRealHeight              ,
    actualtext.store  = \L@actual                       ,
    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.store       = \L@hang                          ,
    loversize.store   = \L@oversize                      ,
    lraise.store      = \L@raise                         ,
    ante.store        = \L@ante                          ,
    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                          ,
    viewport.store    = \L@viewport                      ,
    grid.if           = L@grid                           ,
    nextpage.if       = L@nextpage                       ,
    realheight.if     = L@realh                          ,
    actualtext.store  = \L@actual                        ,
    refstring.default:n = \L@initial                     ,
    refstring.store   = \L@refstring
 }
\AtBeginDocument{%
  \ifx\DefaultOptionsFile\@empty
  \else
    \InputIfFileExists{\DefaultOptionsFile}%
      {\PackageWarning{lettrine.sty}%
         {File \DefaultOptionsFile\space loaded!}%
      }%
      {\PackageWarning{lettrine.sty}%
         {File \DefaultOptionsFile\space not found!}%
      }%
  \fi}
\newtoks\Lettrine@tweaks
\newcommand*{\LettrineOptionsFor}[2]{%
  \Lettrine@tweaks=\expandafter{\the\Lettrine@tweaks
                                \@lettrine@optionsfor{#1}{#2,}}}
\newcommand*{\@lettrine@optionsfor}[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
  }
\newcommand*{\LettrineTextFont}{\scshape}
\newcommand*{\LettrineSecondString}{x}
\newcommand*{\LettrineFontHook}{}
\def\computeL@height{%
  \@tempdima=\baselineskip
  \setlength{\L@target@dp}{\value{L@lines}\@tempdima}%
  \ifnum\value{L@lines}>1
    \addtolength{\L@target@dp}{-\@tempdima}%
  \else
    \addtolength{\L@target@ht}{\L@target@dp}%
    \setlength{\L@target@dp}{\z@}%
  \fi
  \setlength{\L@target@tht}{\L@target@ht}%
  \addtolength{\L@target@tht}{\L@target@dp}%
  \setlength{\L@height}{\L@target@tht}%
  \addtolength{\L@height}{\L@oversize\L@target@tht}%
}
\def\compute@fontsize{%
  \ifx\L@refstring\@empty
    \def\Lettrine@RefString{\LettrineTestString}%
  \else
    \def\Lettrine@RefString{\L@refstring}%
  \fi
  \settoheight{\@tempdima}{\LettrineFontHook
                    \fontsize{\L@height}{\L@height}\selectfont
                    \Lettrine@RefString}%
  \ifdim\@tempdima=\z@
    \PackageWarning{lettrine}{Unable to compute \protect\fontsize!%
    \MessageBreak \protect\LettrineTestString\space empty? reported}%
    \def\L@factor{1}%
  \else
    \def\L@factor{\fpeval{\the\L@height/\the\@tempdima}}%
  \fi
}
\newcommand*{\LettrineFont}{%
   \LettrineFontHook
   \fontsize{\L@factor\L@height}{\L@factor\L@height}%
   \selectfont
}
\def\computeL@dimens{%
  \computeL@height
  \ifL@image
    \ifx\L@viewport\@empty
      \settowidth{\LettrineWidth}{%
        \includegraphics[height=\L@height]{\L@initial}}%
    \else
      \settowidth{\LettrineWidth}{%
        \expanded{\noexpand\includegraphics%
                  [viewport=\L@viewport, height=\L@height]{\L@initial}}%
                    }%
    \fi
    \setlength{\LettrineHeight}{\L@height}%
    \setlength{\LettrineDepth}{\z@}%
  \else
    \compute@fontsize
    \settowidth{\LettrineWidth}{\LettrineFont \L@initial}%
    \settoheight{\LettrineHeight}{\LettrineFont \L@initial}%
    \settodepth{\LettrineDepth}{\LettrineFont \L@initial}%
  \fi
}
\def\setupL@lbox{%
  \ifL@image
    \ifx\L@actual\@empty \edef\L@actual{\L@initial}\fi
    \ifx\L@viewport\@empty
      \sbox{\L@lbox}{\includegraphics%
               [height=\L@height, actualtext=\L@actual]{\L@initial}%
                    }%
    \else
      \sbox{\L@lbox}{%
        \expanded{\noexpand\includegraphics%
          [viewport=\L@viewport, height=\L@height,
                                 actualtext=\L@actual]{\L@initial}}%
                    }%
    \fi
  \else
    \compute@fontsize
    \sbox{\L@lbox}{\LettrineFont \L@initial}%
  \fi
}
\NewDocumentCommand\lettrine{ O{} m m }{%
  \def\L@initial{#2}\def\L@refstring{}\def\L@viewport{}%
  \setcounter{L@lines}{\value{DefaultLines}}%
  \setcounter{L@depth}{\value{DefaultDepth}}%
  \renewcommand*{\L@hang}{\DefaultLhang}%
  \renewcommand*{\L@oversize}{\DefaultLoversize}%
  \renewcommand*{\L@raise}{\DefaultLraise}%
  \renewcommand*{\L@ante}{}%
  \renewcommand*{\L@actual}{}%
  \setlength{\L@Findent}{\DefaultFindent}%
  \setlength{\L@Nindent}{\DefaultNindent}%
  \setlength{\L@slope}{\DefaultSlope}%
  \setlength{\L@novskip}{\DiscardVskip}%
  \ifLettrineImage\L@imagetrue\else\L@imagefalse\fi
  \ifLettrineOnGrid\L@gridtrue\else\L@gridfalse\fi
  \ifLettrineMoveAtEOP\L@nextpagetrue\else\L@nextpagefalse\fi
  \ifLettrineRealHeight\L@realhtrue\else\L@realhfalse\fi
  \SetKeys[LettrineLocal]{#1}%
  \settoheight{\L@target@ht}{\LettrineTextFont{\LettrineSecondString}}%
  \ifL@realh
    \def\@tempa{#3}%
    \ifx\@tempa\@empty
      \PackageWarning{lettrine.sty}%
        {Empty second argument,\MessageBreak
         ignoring option `realheight';}%
    \else
      \settoheight{\L@target@ht}{{\LettrineTextFont{#3}}}%
    \fi
  \fi
  \edef\@tempa{\the\Lettrine@tweaks}%
  \ifx\@tempa\@empty
  \else
    \computeL@dimens
    \the\Lettrine@tweaks
    \SetKeys[LettrineLocal]{#1}%
  \fi
  \computeL@dimens
  \par
  \setlength{\L@finalht}{\LettrineHeight}%
  \setlength{\L@lraise}{\L@raise\L@target@tht}%
  \addtolength{\L@finalht}{\L@lraise}%
  \ifnum\value{L@lines}>\@ne
    \@tempcnta=\value{L@lines}%
    \advance\@tempcnta \m@ne
    \@tempdima=\@tempcnta\baselineskip
    \addtolength{\L@finalht}{-\@tempdima}%
    \setlength{\L@finaldp}{\@tempdima}%
    \addtolength{\L@finaldp}{-\L@lraise}%
    \addtolength{\L@finaldp}{\LettrineDepth}%
    \addtolength{\L@lraise}{-\@tempdima}%
   \fi
  \begingroup
  \def\IeC##1{##1}%
  \@tempdima=\L@oversize pt\relax
  \PackageInfo{lettrine.sty}%
    {Targeted height = \the\L@target@tht\MessageBreak
     (for loversize=0, accent excluded),\MessageBreak
     Lettrine height = \the\LettrineHeight\space (#2)%
     \ifdim\@tempdima>\z@\space loversize=\L@oversize\fi;%
     \MessageBreak reported}%
  \endgroup
  \@tempdima=\L@finalht
  \advance\@tempdima \L@novskip
  \@tempdimb=\baselineskip
  \ifdim\@tempdima>\@tempdimb
    \ifL@grid
      \@tempcnta=\z@
      \loop\ifdim\@tempdima>\@tempdimb
         \advance\@tempcnta \@ne
         \advance\@tempdima -\@tempdimb
      \repeat
      \vskip\@tempcnta\baselineskip
    \fi
  \fi
  \@tempdima=\pagegoal
  \advance\@tempdima by -\pagetotal
  \advance\@tempdima by -\baselineskip
  \ifdim\@tempdima < \L@finaldp
    \@tempdimb=\L@finaldp
    \advance\@tempdimb by -\@tempdima
    \PackageWarning{lettrine}{%
      *** ATTENTION REQUIRED ***\MessageBreak
      The dropped cap #2 doesn't fit on page \thepage.%
      \MessageBreak Missing vertical space: \the\@tempdimb.
      \MessageBreak
      \ifL@nextpage The whole paragraph will be moved to
                    next page.\MessageBreak \fi
      Reported}%
    \ifL@nextpage \newpage \fi
  \fi
  \setlength{\L@Pindent}{\LettrineWidth}%
  \addtolength{\L@Pindent}{-\L@hang\LettrineWidth}%
  \settowidth{\L@first}{\L@ante}%
  \addtolength{\L@Pindent}{\L@first}%
  \addtolength{\L@Pindent}{\L@Findent}%
  \setlength{\L@first}{\linewidth}%
  \addtolength{\L@first}{-\L@Pindent}%
  \addtolength{\L@Nindent}{\L@Pindent}%
  \setlength{\L@next}{\linewidth}%
  \addtolength{\L@next}{-\L@Nindent}%
  \addtolength{\L@Pindent}{\@totalleftmargin}%
  \addtolength{\L@Nindent}{\@totalleftmargin}%
  \addtocounter{L@lines}{1}%
  \addtocounter{L@lines}{\value{L@depth}}%
  \ifL@RTL
    \def\L@parshape{\c@L@lines \z@ \the\L@first}%
  \else
    \def\L@parshape{\c@L@lines \the\L@Pindent \the\L@first}%
  \fi
  \@tempcnta=\tw@
  \@whilenum \@tempcnta<\c@L@lines\do{%
     \ifL@RTL
       \edef\L@parshape{\L@parshape \z@ \the\L@next}%
     \else
       \edef\L@parshape{\L@parshape \the\L@Nindent \the\L@next}%
     \fi
     \addtolength{\L@Nindent}{\L@slope}%
     \addtolength{\L@next}{-\L@slope}%
     \advance\@tempcnta\@ne}%
  \ifL@RTL
    \edef\L@parshape{\L@parshape \z@ \the\linewidth}%
  \else
    \edef\L@parshape{\L@parshape \@totalleftmargin \the\linewidth}%
  \fi
  \noindent
  \parshape=\L@parshape\relax
  \setupL@lbox
  \llap{\smash{\mbox{\L@ante}\raisebox{\L@lraise}{\usebox{\L@lbox}}}%
        \ifL@grid\else\rule{\z@}{\L@finalht}\fi
        \hskip \the\L@Findent}%
  {\LettrineTextFont{#3}}%
  \ifnum\@listdepth>0 \Lreset@listparshape \fi
}
\newtoks\Llist@everypar
\def\Lreset@listparshape{%
  \let\Lnew@everypar\everypar
  \Llist@everypar=\expandafter{\the\everypar}%
  \Lnew@everypar={\the\Llist@everypar
                  \parshape=\@ne \@totalleftmargin \linewidth \relax
                  \let\everypar\Llist@everypar
                 }%
}
\AtBeginDocument{%
  \IfPackageLoadedTF{bidi}{\eqnewif{\ifL@RTL}{\if@RTL}}{}%
}
%% 
%%
%% End of file `lettrine.sty'.
