summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-08-30 19:35:26 +0000
committerKarl Berry <karl@freefriends.org>2018-08-30 19:35:26 +0000
commit34cdddfd71f044f50f5d08ee9ddeaab7bb061574 (patch)
tree11f6f0ada99e68f21a090661f04da8aad9df17d5 /Master/texmf-dist/source/latex
parenta05022b9d4b59c110ad226ec4428e762919fa82d (diff)
lettrine (30aug18)
git-svn-id: svn://tug.org/texlive/trunk@48513 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/lettrine/lettrine.dtx252
-rw-r--r--Master/texmf-dist/source/latex/lettrine/lettrine.ins2
2 files changed, 138 insertions, 116 deletions
diff --git a/Master/texmf-dist/source/latex/lettrine/lettrine.dtx b/Master/texmf-dist/source/latex/lettrine/lettrine.dtx
index 9d4e9b4bf52..abfa0e742cb 100644
--- a/Master/texmf-dist/source/latex/lettrine/lettrine.dtx
+++ b/Master/texmf-dist/source/latex/lettrine/lettrine.dtx
@@ -1,5 +1,5 @@
%
-% \CheckSum{609}
+% \CheckSum{611}
%
% \iffalse meta-comment
%
@@ -27,7 +27,7 @@
\ProvidesFile{lettrine.dtx}
%</dtx>
%<*!cfg>
- [2018-08-25 v2.2 (Daniel Flipo)]
+ [2018-08-28 v2.21 (Daniel Flipo)]
%</!cfg>
%
% Lettrine package for LaTeX version 2e
@@ -150,10 +150,12 @@
% in pdf, jpg, etc.\ format (pdflatex); this needs the
% |graphicx| package to be loaded in the preamble of course.
% |\lettrine[image=true]{A}{n exemple}| or just
-% |\lettrine[image]{A}{n exemple}| will load |A.eps|
-% or |A.pdf| instead of letter~A. This was suggested
-% by Bill Jetzer. Redefining \verb+\LettrineFont+ as
-% \verb+\LettrineFontEPS+ is no longer supported.
+% |\lettrine[image]{A}{n exemple}| will load |A.eps|,
+% |A.jpg|, |A.png| or |A.pdf| instead of letter~A.
+% This was suggested by Bill Jetzer.\\
+% N.B.: Redefining |\LettrineFont| as |\LettrineFontEPS|
+% is no longer supported and |\LettrineFontEPS| has been
+% renamed as |\LettrineImage|.
%
% \changes{v1.8}{2015/02/06}{Added two keyval options:
% `grid' (true/false) and `novskip' to override \cs{DiscardVskip}.}
@@ -506,17 +508,27 @@
% Provide commands for the fonts used to typeset the two
% mandatory arguments of |\lettrine|.
%
+% \changes{v2.21}{2018/08/28}{Code clean up, new commands
+% \cs{computeL@height}, \cs{compute@fontsize}, \cs{setupL@lbox}.}
+%
% \begin{macro}{\LettrineTextFont}
% In French, small caps usually follow the dropped capital.
% \begin{macrocode}
\newcommand*{\LettrineTextFont}{\scshape}
+\newcommand*{\LettrineSecondString}{x}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\LettrineTestString}
-% \begin{macro}{\LettrineSecondString}
% \begin{macro}{\LettrineFontHook}
-% \begin{macro}{\LettrineFont}
+% |\LettrineFontHook| enables to select another font for the
+% dropped capital. Its default definition is empty (the current
+% text font is used).
+% \begin{macrocode}
+\newcommand*{\LettrineFontHook}{}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\computeL@height}
% The default size for the dropped capital is computed so that the
% top of it is exactly aligned with the top of the following text;
% an extra height (positive or negative) may be added globally by
@@ -553,12 +565,12 @@
% \label{fig:target}
% \end{figure}
%
-% |\Lettrine@height| computes the targeted height for the dropped
-% capital and stores it into |\L@target@tht| which depends only on
-% on |L@lines| and on the height of |\L@tbox| (see
+% |\computeL@height| first computes the targeted height for the
+% dropped capital and stores it into |\L@target@tht|. This height
+% only depends on |L@lines| and on the height of |\L@tbox| (see
% fig.~\ref{fig:target}). So options \emph{must} be read and
% |\L@tbox| must be properly initialised \emph{before} executing
-% |\Lettrine@height| (see below in |\@lettrine| code).
+% |\computeL@height| (see below in |\@lettrine| code).
%
% |\L@height| is set to |\L@target@tht| raised by the |\L@oversize|
% factor.
@@ -566,106 +578,103 @@
% \changes{v1.2}{2002/03/13}{\cs{baselineskip} may be a
% rubber length, we convert it to a dimen.}
%
-% \changes{v1.63}{2012/07/20}{Added command
-% \cs{LettrineTestString} which defaults to
-% `ABCDEFGHIJKLMNOQPRSTUVWXYZ'. In previous versions height
-% computations were based on letter `X' which might not exist
-% in some (rare) fonts. Pointed out by Raphaël Pinson.}
-%
% \changes{v1.9}{2015/08/31}{\cs{theL@lines} changed
% to \cs{value\{L@lines\}}. Needed for babel-hebrew which
% redefines \cs{@arabic}.}
%
-% \changes{v2.0}{2018/07/21}{\cs{LettrineTestString} changed
-% from `ABCDEFGHIJKLMNOQPRSTUVWXYZ' to `EFTZ' as
-% some capitals like C, G, O, Q or X might be slightly taller
-% (possible optical correction).}
-%
% \changes{v2.0}{2018/07/21}{Store targeted dimensions of the
% dropped capital (ht, dp, tht) for further use.}
%
-%\changes{v2.1}{2018/08/01}{\cs{Lettrine@height} moved out of
-% \cs{LettrineFont}: \cs{global} settings no longer required.
-% \cs{fontsize} computations moved into \cs{Lettrine@height}.}
+% \changes{v2.1}{2018/08/01}{Height computations moved out of
+% \cs{LettrineFont}: \cs{global} settings no longer required.}
%
% \begin{macrocode}
-\newcommand*{\LettrineTestString}{EFTZ}
-\newcommand*{\LettrineSecondString}{x}
-\def\Lettrine@height{%
- \setlength{\L@target@ht}{\ht\L@tbox}%
+\def\computeL@height{%
+ \setlength{\L@target@ht}{\ht\L@tbox}%
% \end{macrocode}
% As |\baselineskip| might be a rubber length, let’s convert it
% into a `dimen’ using |\@tempdima|.
% \begin{macrocode}
- \@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}{0pt}%
- \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}%
- \ifL@image
- \else
+ \@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}{0pt}%
+ \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}%
+}
% \end{macrocode}
-% |\L@height| now holds the exact height required for the
-% dropped capital, let’s compute the matching |\fontsize|’s value
-% (unless the initial is a picture);
-% we first measure the height of a ``standard’’ capital
-% (i.e.\ either listed in |\LettrineTestString| or the initial
-% itself) scaled by |\fontsize| with argument |\L@height|.
-% Mind that some font designers apply optical correction to
-% capitals C, G, O, or Q (they are slightly taller than `T’ or
-% `Z’), that’s why they are not part of |\LettrineTestString|.
-% When optional argument \lopt{selfref} is \lopt{true} the initial
-% itself is taken as reference to compute |\fontsize|, this can be
-% handy when working with fancy fonts (i.e.\ cfr-initials, Yinit).
+% \end{macro}
+%
+% \begin{macro}{\LettrineTestString}
+% After executing |\computeL@height|, |\L@height| holds the exact
+% height required for the dropped capital, nothing more is needed if
+% the initial is a picture, otherwise we need to compute the matching
+% |\fontsize|’s value. This is done by measuring the height of
+% a ``reference’’ capital (i.e.\ either listed in
+% |\LettrineTestString| or the initial itself).
+% As some font designers apply optical correction to capitals C, G,
+% O, or Q (they are slightly taller than `T’ or `Z’), they are better
+% left out of |\LettrineTestString|. |EFTZ| should be a good default
+% for most fonts.
+%
+% \changes{v1.63}{2012/07/20}{(new) it defaults to
+% `ABCDEFGHIJKLMNOQPRSTUVWXYZ'. In previous versions height
+% computations were based on letter `X' which might not exist
+% in some (rare) fonts. Pointed out by Raphaël Pinson.}
+%
+% \changes{v2.0}{2018/07/21}{changed from `ABCDEFGHIJKLMNOQPRSTUVWXYZ'
+% to `EFTZ' as some capitals like C, G, O, Q or X might be slightly
+% taller (possible optical correction).}
+%
% \begin{macrocode}
- \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
+\newcommand*{\LettrineTestString}{EFTZ}
% \end{macrocode}
-% |\@tempcntb| holds the target height converted into sp (integer)
-% and |\@tempcnta| holds the height in sp of the ``standard’’
-% initial scaled by |\fontsize| with |\L@height| as argument;
-% let’s divide |\@tempcntb| by |\@tempcnta| to compute a (4 decimal
-% accurate) scaling factor |\L@factor|.
-% |\fontsize|’s argument providing the requested |\L@height| is
-% |\L@factor\L@height|.
+% \end{macro}
%
-% \changes{v2.0}{2018/07/21}{Change factors 100/100 to 50/200
-% to reach larger sizes (initial's height up to 20cm).}
+% \begin{macro}{\compute@fontsize}
+% This command compares the height of a ``reference’’ capital scaled
+% by |\fontsize| with argument |\L@height| to |\L@height| (the
+% required height for the initial); both are converted into integers
+% (in sp) to compute a ratio |\L@factor|.
+% Up to v2.01, possible values for |\L@factor| were either 1 or any
+% value $\geq 1.1$ which was fine for almost every font but not
+% all (i.e.\ \file{cfr-initials}). Starting with v2.1, |\L@factor|
+% is computed more accurately by |\MFPdiv| from \file{minifp.sty}.
%
% \changes{v2.1}{2018/08/14}{Computation of \cs{L@factor} for
% \cs{fontsize} done by the minifp package.}
%
-% Up to v2.01, possible values for |\L@factor| were either 1 or any
-% value $\geq 1.1$ which was fine for almost every font but not
-% all (i.e.\ \file{cfr-initials}). Starting with v2.1, |\L@factor|
-% is computed more accurately by \file{minifp.sty}.
+% When optional argument \lopt{selfref} is \lopt{true} the initial
+% itself is taken as reference to compute |\fontsize|, this can be
+% handy when working with fancy fonts (i.e.\ cfr-initials, Yinit).
+% In most cases, the default is a better choice.
% \begin{macrocode}
- \MFPdiv{\the\@tempcntb}{\the\@tempcnta}\L@factor
- \fi
+\def\compute@fontsize{%
+ \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
+ \MFPdiv{\the\@tempcntb}{\the\@tempcnta}\L@factor
}
% \end{macrocode}
+% \end{macro}
%
-% |\LettrineFontHook| enables to select another font for the
-% dropped capital. Its default definition is empty (the current
-% text font is used).
-%
+% \begin{macro}{\LettrineFont}
+% |\fontsize|’s argument providing the requested |\L@height| is
+% |\L@factor\L@height|.
% \begin{macrocode}
-\newcommand*{\LettrineFontHook}{}
\newcommand*{\LettrineFont}{%
\LettrineFontHook
\fontsize{\L@factor\L@height}{\L@factor\L@height}%
@@ -673,30 +682,46 @@
}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
%
% \changes{v0.9}{1998/03/13}{\cs{LettrineFontEPS} added.}
%
-% \begin{macro}{\LettrineFontEPS}
+% \changes{v2.21}{2018/08/28}{\cs{LettrineFontEPS} renamed as
+% \cs{LettrineImage}.}
+%
+% \begin{macro}{\LettrineImage}
% The following definition is for use with dropped capitals defined
% as images: EPS, PDF, JPG, PNG files (see examples in demo.tex).
% Its use requires the |graphicx| package to be loaded in the
% preamble with |\usepackage{graphicx}|. The required size is
% computed just as in the standard case, |\includegraphics|
-% prints the EPS file at this size.
+% prints the image at this size.
%
% \changes{v1.6}{2004/05/22}{Added \cs{LettrineFontHook}
% to \cs{LettrineFontEPS}. This is needed for color options.}
%
% \begin{macrocode}
-\newcommand*{\LettrineFontEPS}{%
+\newcommand*{\LettrineImage}{%
\LettrineFontHook\includegraphics[height=\L@height]%
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\setupL@lbox}
+% The next (internal) command computes the requested size for the
+% initial (letter or image) and prepares a box |\L@lbox| holding it.
+% \begin{macrocode}
+\def\setupL@lbox{%
+ \computeL@height
+ \ifL@image
+ \sbox{\L@lbox}{\LettrineImage{\l@initial}}%
+ \else
+ \compute@fontsize
+ \sbox{\L@lbox}{\LettrineFont \l@initial}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
% Set up keyval initializations.
%
% \begin{macrocode}
@@ -766,12 +791,11 @@
\ifLettrineSelfRef\L@selfreftrue\else\L@selfreffalse\fi
% \end{macrocode}
%
-% |\LettrineFont| and |\LettrineFontEPS| both rely on |\L@height|
-% which depends on |\L@tbox|, thus requiring prior execution of
-% |\Lettrine@height|. The content of |\L@tbox| depends on option
-% |realheight|, so we have to read |\lettrine|'s optional argument
-% and initialise the |\L@tbox| content now%
-% \footnote{Now means before eventually reading the config file.}.
+% The final initial size depends on the height of |\L@tbox|; the
+% content of |\L@tbox| depends on option |realheight|, so we have
+% to read |\lettrine|'s optional argument and initialise the
+% |\L@tbox| content now\footnote{Now means before eventually
+% reading the config file.}.
%
% \changes{v1.9}{2015/08/31}{Use the second mandatory
% argument of \cs{lettrine} or \cs{LettrineSecondString} (which
@@ -782,7 +806,7 @@
\setkeys{L}{#1}%
\sbox{\L@tbox}{\LettrineTextFont{\LettrineSecondString}}%
\ifL@realh
- \def\@tempa{#3}
+ \def\@tempa{#3}%
\ifx\@tempa\@empty
\PackageWarning{lettrine.sty}%
{Empty second argument,\MessageBreak
@@ -836,12 +860,15 @@
% \end{macrocode}
% As some parameters' values \lopt{findent}, \lopt{nindent} and
% \lopt{slope} ---which do not influence the initial’s size--- may
-% be given relative to |\LettrineWidth|, this has to be done again
-% after measuring the lettrine for |\LettrineWidth| to be set
-% properly.
+% be given relative to |\LettrineWidth|, the |\L@lbox| has to be
+% set up to evaluate |\LettrineWidth|.
+%
+% \changes{v2.21}{2018/08/28}{\lopt{findent} computation
+% relative to \cs{LettrineWidth} in \lopt{.cfl} files fixed;
+% thanks to Frank Mittelbach for raising the issue.}
+%
% \begin{macrocode}
- \Lettrine@height
- \sbox{\L@lbox}{\LettrineFont #2}%
+ \setupL@lbox
\setlength{\LettrineWidth}{\wd\L@lbox}%
\def\KV@prefix{KV@L@}%
\let\@tempc\relax
@@ -854,16 +881,10 @@
\fi
% \end{macrocode}
% Options and optional config file have be taken into account, we
-% can now save the first mandatory argument of |\lettrine| properly
-% scaled into |\L@lbox|. Depending on the boolean |image|,
-% |\LettrineFont| or |\LettrineFontEPS| is used.
+% can now finally save the first mandatory argument of |\lettrine|
+% properly scaled into |\L@lbox|.
% \begin{macrocode}
- \Lettrine@height
- \ifL@image
- \sbox{\L@lbox}{\LettrineFontEPS{#2}}%
- \else
- \sbox{\L@lbox}{\LettrineFont #2}%
- \fi
+ \setupL@lbox
% \end{macrocode}
%
% \changes{v1.65}{2014/09/04}{Measure and store the initial's
@@ -1024,6 +1045,7 @@
}
% \end{macrocode}
% \end{macro}
+%
% This ends the definition of |\lettrine|.
%
% Load a local config file if present in \LaTeX{}'s search path.
@@ -1111,6 +1133,6 @@
\endinput
%%% Local Variables:
-%%% fill-column: 70
+%%% fill-column: 72
%%% coding: utf-8
%%% End:
diff --git a/Master/texmf-dist/source/latex/lettrine/lettrine.ins b/Master/texmf-dist/source/latex/lettrine/lettrine.ins
index 2f74f98f4df..330ff2f5768 100644
--- a/Master/texmf-dist/source/latex/lettrine/lettrine.ins
+++ b/Master/texmf-dist/source/latex/lettrine/lettrine.ins
@@ -41,7 +41,7 @@
This file is a generated file part of the lettrine package.
-----------------------------------------------------------
-For the copyright see the source file lettine.dtx.
+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