texlive[72860] Master/texmf-dist: lettrine (15nov24)
commits+karl at tug.org
commits+karl at tug.org
Fri Nov 15 23:11:20 CET 2024
Revision: 72860
https://tug.org/svn/texlive?view=revision&revision=72860
Author: karl
Date: 2024-11-15 23:11:20 +0100 (Fri, 15 Nov 2024)
Log Message:
-----------
lettrine (15nov24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/lettrine/lettrine-demo-arabic.pdf
trunk/Master/texmf-dist/doc/latex/lettrine/lettrine-demo-de.pdf
trunk/Master/texmf-dist/doc/latex/lettrine/lettrine-demo-fr.pdf
trunk/Master/texmf-dist/doc/latex/lettrine/lettrine-demo-lua.pdf
trunk/Master/texmf-dist/doc/latex/lettrine/lettrine.pdf
trunk/Master/texmf-dist/source/latex/lettrine/lettrine.dtx
trunk/Master/texmf-dist/tex/latex/lettrine/lettrine.sty
Modified: trunk/Master/texmf-dist/doc/latex/lettrine/lettrine-demo-arabic.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/lettrine/lettrine-demo-de.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/lettrine/lettrine-demo-fr.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/lettrine/lettrine-demo-lua.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/lettrine/lettrine.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/lettrine/lettrine.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/lettrine/lettrine.dtx 2024-11-15 22:11:07 UTC (rev 72859)
+++ trunk/Master/texmf-dist/source/latex/lettrine/lettrine.dtx 2024-11-15 22:11:20 UTC (rev 72860)
@@ -107,7 +107,7 @@
\ProvidesFile{lettrine.dtx}
%</dtx>
%<*sty|dtx>
- [2024-06-26 v2.61 (Daniel Flipo)]
+ [2024-11-14 v2.70 (Daniel Flipo)]
%</sty|dtx>
% \fi
%
@@ -313,26 +313,36 @@
% \item |\setlength{\DiscardVskip}{1pt}|,
% \item |\LettrineImagefalse|,
% \item |\LettrineOnGridfalse|,
-% \item |\LettrineRealHeightfalse|,
-% \item |\renewcommand{\DefaultOptionsFile}{optfile.cfl}|.
+% \item |\LettrineRealHeightfalse|.
% \end{itemize}
%
% Instead of giving optional parameters to the |\lettrine| command,
-% it is possible to set them on a per character
-% basis in a second config file (suggested by Pascal Kockaert):
+% it is possible to set them on a per character basis
+% in a second config file (suggested by Pascal Kockaert):
% |\renewcommand{\DefaultOptionsFile}{|\meta{filename}|}|
-% in the preamble (or anywhere in the document) will
-% force each call to |\lettrine| to read the file \meta{filename}.
+% in the preamble will force this file to be read `AtBeginDocument’.
% Alternatively, |\usepackage[optionsfile=|\meta{filename}|]{lettrine}|
% produces the same effect.
% See examples of such config files in the subdirectory \file{contrib}.
%
-% The dimensional parameters \lopt{findent}, \lopt{nindent} and
-% \lopt{slope}, can be set relative to |\LettrineWidth| if needed,
-% \emph{in an \file{optionsfile} only}. The settings read from this
-% file will be overridden by the optional arguments eventually given
-% to the |\lettrine| command.
+% The idea is to provide settings for specific fonts, or to define
+% suitable parameters for some initials like A or V, for instance\\
+% |\LettrineOptionsFor{A}{slope=0.5em, findent=-1.5em, nindent=.7em}|\\
+% Options passed this way are meant to fine tune how the text will be
+% wrapped around the initial; for convenience \emph{inside}
+% |\LettrineOptionsFor| \emph{only}, |\LettrineWidth| can be used
+% instead of~|em| as a unit length.
%
+% Since version~2.70, these commands are also allowed in the document’s
+% preamble. Mixing |\LettrineOptionsFor| commands in the preamble
+% and in an external config file is not recommended: remember that
+% if an options file is declared, the settings it holds will be taken
+% into account `AtBeginDocument’ thus possibly overriding
+% |\LettrineOptionsFor| commands in the preamble.
+%
+% Anyway, the settings read from this file will be overridden by the
+% optional arguments eventually given to the |\lettrine| command.
+%
% More customisation possibilities are offered by the next four
% commands:
% \begin{itemize}
@@ -696,6 +706,57 @@
}
% \end{macrocode}
%
+%\changes{v2.70}{2024/11/14}{Read the config file only once, its
+% content is added to token register \cs{Lettrine at tweaks}.}
+%
+% Read the per letter options file `AtBeginDocument’.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \if\DefaultOptionsFile\relax
+ \else
+ \InputIfFileExists{\DefaultOptionsFile}%
+ {}%
+ {\PackageWarning{lettrine.sty}%
+ {File \DefaultOptionsFile\space not found}%
+ }%
+ \fi}
+% \end{macrocode}
+%
+% \changes{v1.5}{2003/08/18}{\cs{LettrineOptionsFor} and
+% \cs{LettrineWidth} added.}
+%
+% \begin{macro}{\LettrineOptionsFor}
+% This command sets the values of parameters on a per character
+% basis, for instance:\\
+% |\LettrineOptionsFor{A}{slope=0.6em, findent=-1em, nindent=0.6em}|
+%
+% \begin{macrocode}
+\newtoks\Lettrine at tweaks
+\newcommand*{\LettrineOptionsFor}[2]{%
+ \Lettrine at tweaks=\expandafter{\the\Lettrine at tweaks
+ \@lettrine at optionsfor{#1}{#2,}}}
+% \end{macrocode}
+% The internal |\@lettrine at optionsfor| checks if its first argument
+% matches the current initial, if so it passes the options (second
+% argument) to |\SetKeys|.
+% \begin{macrocode}
+\newcommand*{\@lettrine at optionsfor}[2]{%
+ \edef\L at tmpa{#1}%
+% \end{macrocode}
+% Gobble potential color commands for the initial.
+% \begin{macrocode}
+ \begingroup
+ \def\color##1##{\L at color{##1}}%
+ \let\L at color\@gobbletwo
+ \def\textcolor##1##{\L at textcolor{##1}}%
+ \def\L at textcolor##1##2##3{##3}%
+ \xdef\L at tmpb{\L at initial}%
+ \endgroup
+ \ifx\L at tmpa\L at tmpb \SetKeys[LettrineLocal]{#2}\fi
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \changes{v2.21}{2018/08/28}{Code clean up, new commands
% \cs{computeL at height}, \cs{compute at fontsize}, \cs{setupL at lbox}.}
%
@@ -886,33 +947,7 @@
% \end{macrocode}
% \end{macro}
%
-% \changes{v1.5}{2003/08/18}{\cs{LettrineOptionsFor} and
-% \cs{LettrineWidth} added.}
%
-% \begin{macro}{\LettrineOptionsFor}
-% This command is to be used in an optional config file (the name
-% of which is found in |\DefaultOptionsFile|) to set the values
-% of parameters on a per character basis, for instance:\\
-% |\LettrineOptionsFor{A}{slope=0.6em, findent=-1em, nindent=0.6em}|
-%
-% \begin{macrocode}
-\newcommand*{\LettrineOptionsFor}[2]{%
- \edef\L at tmpa{#1}%
-% \end{macrocode}
-% Gobble potential color commands for the initial.
-% \begin{macrocode}
- \begingroup
- \def\color##1##{\L at color{##1}}%
- \let\L at color\@gobbletwo
- \def\textcolor##1##{\L at textcolor{##1}}%
- \def\L at textcolor##1##2##3{##3}%
- \xdef\L at tmpb{\L at initial}%
- \endgroup
- \ifx\L at tmpa\L at tmpb \SetKeys[LettrineLocal]{#2}\fi
- }
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}{\lettrine}
% Now let’s define the |\lettrine| command.
%
@@ -969,40 +1004,24 @@
\fi
\fi
% \end{macrocode}
-% \changes{v1.5}{2003/08/18}{Added reading of an optional
-% config file \cs{DefaultOptionsFile}.}
-% Then try to read an optional file (its name is given by
-% |\DefaultOptionsFile|), do this inside a group, and define a
-% global command |\L at LOKeys| which will expand to the list of
-% options given by |\LettrineOptionsFor| for the current initial
-% (defined by |#2|)…
%
% \changes{v2.40}{2023/04/18}{Options from the per letter config file
% are now handled by LaTeX command \cs{SetKeys}.}
%
-% Take the per character config file into account if any.
-% \begin{macrocode}
- \if\DefaultOptionsFile\relax
- \else
-% \end{macrocode}
-% As some parameters’ values \lopt{findent}, \lopt{nindent} and
+% Take the per character options into account if any. For these
+% options some parameters’ values \lopt{findent}, \lopt{nindent} and
% \lopt{slope} ---which do not influence the initial’s size--- may
% be given relative to |\LettrineWidth|, the |\L at lbox| has to be
-% set up to evaluate |\LettrineWidth|.
+% set up first to evaluate |\LettrineWidth|.
% \begin{macrocode}
- \setupL at lbox
- \setlength{\LettrineWidth}{\wd\L at lbox}%
- \InputIfFileExists{\DefaultOptionsFile}%
- {}%
- {\PackageWarning{lettrine.sty}%
- {File \DefaultOptionsFile\space not found}%
- }%
+ \setupL at lbox
+ \setlength{\LettrineWidth}{\wd\L at lbox}%
+ \the\Lettrine at tweaks
% \end{macrocode}
-% As local options prevail on those held in the config file, we
-% have to read again the optionnal argument of |\lettrine|.
+% As local options always prevail, read again the optionnal
+% argument of |\lettrine|.
% \begin{macrocode}
- \SetKeys[LettrineLocal]{#1}%
- \fi
+ \SetKeys[LettrineLocal]{#1}%
% \end{macrocode}
% \changes{v1.65}{2014/09/04}{Measure and store the initial’s
% final dimensions.}
Modified: trunk/Master/texmf-dist/tex/latex/lettrine/lettrine.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lettrine/lettrine.sty 2024-11-15 22:11:07 UTC (rev 72859)
+++ trunk/Master/texmf-dist/tex/latex/lettrine/lettrine.sty 2024-11-15 22:11:20 UTC (rev 72860)
@@ -11,7 +11,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesFile{lettrine.sty}
- [2024-06-26 v2.61 (Daniel Flipo)]
+ [2024-11-14 v2.70 (Daniel Flipo)]
\DeclareRelease{v1.6}{1999-03-03}{lettrine-2006-03-17.sty}
\DeclareRelease{v1.9}{2012-07-20}{lettrine-2015-08-31.sty}
@@ -111,6 +111,30 @@
refstring.default:n = \L at initial ,
refstring.store = \L at refstring
}
+\AtBeginDocument{%
+ \if\DefaultOptionsFile\relax
+ \else
+ \InputIfFileExists{\DefaultOptionsFile}%
+ {}%
+ {\PackageWarning{lettrine.sty}%
+ {File \DefaultOptionsFile\space not found}%
+ }%
+ \fi}
+\newtoks\Lettrine at tweaks
+\newcommand*{\LettrineOptionsFor}[2]{%
+ \Lettrine at tweaks=\expandafter{\the\Lettrine at tweaks
+ \@lettrine at optionsfor{#1}{#2,}}}
+\newcommand*{\@lettrine at optionsfor}[2]{%
+ \edef\L at tmpa{#1}%
+ \begingroup
+ \def\color##1##{\L at color{##1}}%
+ \let\L at color\@gobbletwo
+ \def\textcolor##1##{\L at textcolor{##1}}%
+ \def\L at textcolor##1##2##3{##3}%
+ \xdef\L at tmpb{\L at initial}%
+ \endgroup
+ \ifx\L at tmpa\L at tmpb \SetKeys[LettrineLocal]{#2}\fi
+ }
\newcommand*{\LettrineTextFont}{\scshape}
\newcommand*{\LettrineSecondString}{x}
\newcommand*{\LettrineFontHook}{}
@@ -169,17 +193,6 @@
\sbox{\L at lbox}{\LettrineFont \L at initial}%
\fi
}
-\newcommand*{\LettrineOptionsFor}[2]{%
- \edef\L at tmpa{#1}%
- \begingroup
- \def\color##1##{\L at color{##1}}%
- \let\L at color\@gobbletwo
- \def\textcolor##1##{\L at textcolor{##1}}%
- \def\L at textcolor##1##2##3{##3}%
- \xdef\L at tmpb{\L at initial}%
- \endgroup
- \ifx\L at tmpa\L at tmpb \SetKeys[LettrineLocal]{#2}\fi
- }
\def\lettrine{\@ifnextchar[\@lettrine{\@lettrine[]}}
\def\@lettrine[#1]#2#3{%
\def\L at initial{#2}\def\L at refstring{}\def\L at viewport{}%
@@ -208,19 +221,12 @@
\sbox{\L at tbox}{{\LettrineTextFont{#3}}}%
\fi
\fi
- \if\DefaultOptionsFile\relax
- \else
- \setupL at lbox
- \setlength{\LettrineWidth}{\wd\L at lbox}%
- \InputIfFileExists{\DefaultOptionsFile}%
- {}%
- {\PackageWarning{lettrine.sty}%
- {File \DefaultOptionsFile\space not found}%
- }%
- \SetKeys[LettrineLocal]{#1}%
- \fi
\setupL at lbox
\setlength{\LettrineWidth}{\wd\L at lbox}%
+ \the\Lettrine at tweaks
+ \SetKeys[LettrineLocal]{#1}%
+ \setupL at lbox
+ \setlength{\LettrineWidth}{\wd\L at lbox}%
\setlength{\LettrineHeight}{\ht\L at lbox}%
\setlength{\LettrineDepth}{\dp\L at lbox}%
\sbox{\L at tbox}{{\LettrineTextFont{#3}}}%
More information about the tex-live-commits
mailing list.