Debian Codegraph @

texmf-dist/source/latex/lettrine/lettrine.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright © 1999-2025 Daniel Flipo.
4 %
5 % This program can be distributed and/or modified under the terms
6 % of the LaTeX Project Public License either version 1.3c of this
7 % license or (at your option) any later version.
8 % The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3c or later is part of all distributions of LaTeX
11 % version 2005/12/01 or later.
12 %
13 % This file has the LPPL maintenance status "maintained".
14 %
15 %<*batch>
16 %<*gobble>
17 \ifx\jobname\relax\let\documentclass\undefined\fi
18 \ifx\documentclass\undefined
19 \csname fi\endcsname
20 %</gobble>
21 \input docstrip.tex
22 \keepsilent
23 \let\MetaPrefix\relax
24 \preamble
25 \endpreamble
26 \postamble
27 \endpostamble
28 \let\MetaPrefix\DoubleperCent
29 \askforoverwritefalse
30 \generate{\file{lettrine.sty}{\from{lettrine.dtx}{sty}}
31 \nopreamble
32 \file{lettrine.cfg}{\from{lettrine.dtx}{cfg}}
33 }
34 \endbatchfile
35 %</batch>
36 %<*gobble>
37 \fi
38 \expandafter\ifx\csname @currname\endcsname\empty
39 \csname fi\endcsname
40 %</gobble>
41 %<*driver>
42 \DocumentMetadata{pdfstandard=UA-2, lang=en-GB}
43 \documentclass[a4paper,british]{ltxdoc}
44 \usepackage{babel,varioref}
45 \usepackage[dvipsnames]{xcolor}
46 \usepackage{unicode-math}
47 \setmainfont{erewhon}
48 \setsansfont{Cabin}[Scale=MatchLowercase]
49 \setmonofont{Inconsolatazi4}[Scale=MatchLowercase, Color=Sepia,
50 HyphenChar=None,StylisticSet={2,3},
51 ]
52 \setmathfont{Erewhon-Math.otf}
53 \usepackage{fourier-orns}
54 \usepackage[expansion=true,protrusion=true]{microtype}
55 \usepackage{url}
56 \usepackage[numbered]{hypdoc}
57 \hypersetup{pdftitle={Lettrine User’s Guide},
58 pdfauthor={Daniel FLIPO},
59 colorlinks
60 }
61 \usepackage{lettrine}
62 \usepackage{tikz}
63 \usetikzlibrary{shapes.arrows}
64 \renewcommand{\labelitemi}{\starredbullet}
65 %
66 \RecordChanges
67 \AtEndDocument{%
68 \clearpage
69 \section{Change History}%
70 \GlossaryPrologue{}%
71 Changes are listed in reverse order (latest first) from version~1.5
72 \PrintChanges
73 }
74 %
75 \newcommand*\file[1]{\texttt{#1}}
76 \newcommand*\lopt[1]{\texttt{#1}}
77 \renewcommand\meta[1]{\textit{\color{Sepia}<#1>}} % no math mode (see doc.sty)
78 %
79 \setlength{\parindent}{0pt}
80 \setlength{\parskip}{.3\baselineskip}
81 \begin{document}
82 \GetFileInfo{lettrine.sty}
83 \begin{center}
84 \textbf{\Large Typesetting dropped capitals with LaTeX}
85 \\[.5\baselineskip]^^A\]
86 {\large Daniel Flipo}\\
87 \texttt{[email protected]}
88 \end{center}
89 \DocInput{lettrine.dtx}
90 \end{document}
91 %</driver>
92 %<*gobble>
93 \fi
94 %</gobble>
95 % \fi
96 %
97 % \iffalse
98 %
99 %<*sty>
100 %% IMPORTANT NOTICE:
101 %% For the copyright see the source file `lettrine.dtx’.
102 %%
103 \NeedsTeXFormat{LaTeX2e}[2022-06-01]
104 \ProvidesFile{lettrine.sty}
105 %</sty>
106 %<*dtx>
107 \ProvidesFile{lettrine.dtx}
108 %</dtx>
109 %<*sty|dtx>
110 [2025-12-06 v2.83 (Daniel Flipo)]
111 %</sty|dtx>
112 % \fi
113 %
114 % \section{Introduction}
115 %
116 % The file \file{\filename}\footnote{The file described in this
117 % section has version number \fileversion\ and was last revised on
118 % \filedate.}, provides a command |\lettrine| which requires two
119 % mandatory arguments, and an optional one.
120 %
121 % \changes{v2.23}{2020/03/14}{Documentation cleanup.}
122 %
123 % Adding |\usepackage{lettrine}| in the preamble of a document
124 % defines the command |\lettrine|, the simplest use of which is
125 % |\lettrine{|\meta{letter}|}{|\meta{text}|}|.
126 % It produces a dropped capital \meta{letter} (2 lines high),
127 % followed by \meta{text} typeset in small caps, and the rest
128 % of the paragraph is wrapped around the dropped capital.
129 %
130 % The |\lettrine[|\meta{options}|]{|\meta{letter}|}{|\meta{text}|}|
131 % command accepts various optional arguments to control the size and
132 % layout of the dropped capital and match the requirements described
133 % in the books
134 % \begin{itemize}
135 % \item ``Lexique des règles typographiques en usage à
136 % l’Imprimerie nationale’’ troisième édition (1994),
137 % ISBN-2-11-081075-0,
138 % \item ``Mise en page et impression’’ Yves~Perrousseaux,
139 % ISBN-2-911220-01-3.
140 % \end{itemize}
141 % The parameters can be set using the \texttt{key=value} syntax:
142 % \begin{itemize}
143 % \item \lopt{lines=}\meta{integer} sets how many lines the
144 % dropped capital will occupy (default=2);
145 %
146 % \changes{v1.7}{2014/09/16}{New counter to add lines for
147 % dropped capitals with positive depth, like Q.}
148 %
149 % \item \lopt{depth=}\meta{integer} sets the number of lines to be
150 % reserved under the baseline, this is meant for dropped capital with
151 % positive depth, like Q (default=0);
152 % \item \lopt{lhang=}\meta{decimal} ($0\le|lhang|\le1$) sets how much
153 % of the dropped capital’s width should hang into the margin
154 % (default=0);
155 % \item \lopt{loversize=}\meta{decimal} ($-1<\lopt{loversize}\le1$)
156 % enlarges the dropped capital’s height: with \lopt{loversize=0.1}
157 % its height is enlarged by 10\% so that it raises above the top
158 % paragraph’s line (default=0);
159 % \item \lopt{lraise=}\meta{decimal} does not affect the dropped
160 % capital’s height, but moves it up (if positive), down (if
161 % negative); useful with capitals like |J| or |Q| which have
162 % a positive depth, (default=0);
163 % \item \lopt{findent=}\meta{dimen} (positive or negative) controls the
164 % horizontal gap between the dropped capital and the indented block
165 % of text (default=0pt);
166 % \item \lopt{nindent=}\meta{dimen} shifts all indented lines, starting
167 % from the second one, horizontally by \meta{dimen} (this shift is
168 % relative to the first line, default=0.5em);
169 % \item \lopt{slope=}\meta{dimen} can be used with dropped capitals
170 % like |A| or |V| to add \meta{dimen} (positive or negative) to the
171 % indentation of each line starting from the third one (no effect if
172 % \lopt{lines=2}, default=0pt);
173 % \item \lopt{ante=}\meta{string} can be used to typeset \meta{string}
174 % \emph{before} the dropped capital (typical use is for French
175 % guillemets starting the paragraph).
176 %
177 % \changes{v1.6}{2004/05/22}{Add a flag to switch to
178 % images in eps or pdf format. Suggested by Bill Jetzer.}
179 %
180 % \item \lopt{image[=true]} will force |\lettrine| to replace the
181 % letter normally used as dropped capital by an image in eps format
182 % (latex) or in pdf, jpg, png, etc.\ format (pdflatex, xelatex,
183 % lualatex); this requires the |graphicx| package to be loaded in the
184 % preamble.
185 % For instance |\lettrine[image=true]{A}{n exemple}|\hfil or\hfil just\\
186 % |\lettrine[image]{A}{n exemple}| will load |A.eps|,
187 % |A.jpg|, |A.png| or |A.pdf| instead of letter~A.
188 % The string |A| will be used as ``actualtext’’ for PDF tagging
189 % purposes. If your image is meant to be read as ``A’’ but is loaded
190 % under another name, you should add \lopt{actualtext=A} as an option
191 % to |\lettrine|.
192 %
193 % \changes{v2.52}{2023/08/14}{New option`viewport’ to be passed to
194 % \cs{includegraphics}.}
195 %
196 % \item \lopt{viewport=}\meta{llx lly urx ury} is passed to
197 % |\includegraphics| (same four dimen parameters); when present,
198 % |\lettrine| only considers the contents of the rectangle defined by
199 % its lower left and upper right corners to compute the scaling
200 % ratio (which will apply to the whole image). It’s up to the user to
201 % ensure that the rest of the image will not overwrite the
202 % surrounding text, f.i.\ providing a |\vspace*{...}| in case
203 % a significant part sticks out on top of the defined rectangle.
204 % This option may be useful in case the letter covers only a limited
205 % part of the image,
206 % see \url{https://tex.stackexchange.com/questions/693270/} for an
207 % example, or when the image’s bounding box is inaccurate.
208 %
209 % \changes{v1.8}{2015/02/06}{Added two keyval options:
210 % `grid’ (true/false) and `novskip’ to override \cs{DiscardVskip}.}
211 %
212 % \item \lopt{grid[=true]} will force the vertical skip added above the
213 % paragraph starting with |\lettrine| to be rounded up to an integer
214 % number of |\baselineskip|. This option is meant for grid
215 % typesetting.
216 %
217 % \changes{v2.80}{2025/01/30}{New keyval option:
218 % `nextpage’ (true/false), default is false.}
219 %
220 % \item \lopt{nextpage[=true]}; if a paragraph starting with a dropped
221 % cap begins too low on a page to fit in, a warning is issued; this
222 % flag controls whether the whole paragraph should be moved to the
223 % top of next page or not. This option is not recommended, there are
224 % often better fixes for such situations: reducing the dropped cap’s
225 % height, shortening some previous paragraph, enlarging the page…
226 %
227 % \item \lopt{novskip=}\meta{dimen} overrides |\DiscardVskip|
228 % (default=1pt). In some cases (see options \lopt{lraise},
229 % \lopt{loversize} or accentuated dropped capitals,…) the top of
230 % the dropped capital will raise above the top of following text
231 % (usually in small caps), this will trigger a corresponding vertical
232 % skip above the paragraph starting with |\lettrine|, \emph{only if}
233 % this skip exceeds |\DiscardVskip|. Consider enlarging |novskip|
234 % (or |\DiscardVskip|) to prevent small vertical skips from being
235 % rounded up to |\baselineskip| when using the `grid’ option.
236 %
237 % \changes{v1.9}{2015/08/31}{New keyval option: `realheight’
238 % (true/false) and new global flag \cs{ifLettrineRealHeight}.}
239 %
240 % \item \lopt{realheight[=true]} will compute the default height of the
241 % initial so that the top of it is exactly aligned with the top of
242 % the text entered as second mandatory argument of |\lettrine|
243 % taking possible accents into account. Otherwise, the default
244 % height is computed using a customisable string
245 % |\LettrineSecondString| instead of the real argument. For
246 % backward compatibility, option \lopt{realheight} defaults to
247 % \lopt{false} and |\LettrineSecondString| to `x’.
248 %
249 % You probably don’t need this option if you choose to typeset
250 % the second mandatory argument of |\lettrine| in small caps
251 % (the default). If you change |\LettrineTextFont| to |\relax|
252 % or |\upshape|, consider these two examples:
253 % \begin{description}
254 % \item |\lettrine{H}{ello}| you might like the top of the
255 % `H’ to be aligned with the top of the `ll’ rather than with the
256 % top of the `e’, adding option |realheight| does the trick:
257 % |\lettrine[realheight]{H}{ello}|.\par
258 % Global variants : |\LettrineRealHeighttrue| or (without the
259 % |realheight| option) |\renewcommand{\LettrineSecondString}{l}|.
260 % \item |\lettrine{L}{a misère}| option \lopt{realheight=true} would
261 % align with the top of the `L’ with the top of the grave accent,
262 % the default is probably better (top of the `L’ aligned with the
263 % top of the non accented letters).
264 % \end{description}
265 %
266 % \item \lopt{refstring} with no value, is meant for fancy initials
267 % with irregular heights (i.e.\ taken in fonts like Yinit (OpenType),
268 % \file{cfr-initials},…). Option \lopt{refstring} forces the
269 % |\fontsize| computations to be run on the initial given as
270 % |\lettrine|’s first mandatory argument instead of the reference
271 % string |\LettrineTestString|. In most cases, this option should
272 % \emph{not} be used: think of accentuated initials or capitals with
273 % optical correction.\par
274 % \lopt{refstring}=\meta{string} can be used to override
275 % |\LettrineTestString|, the default reference string
276 % (option \emph{seldom useful}).
277 %
278 % \end{itemize}
279 %
280 % Example: |\lettrine[lines=4, lraise=0.1, nindent=0em, |%
281 % |slope=-.5em]%|\\
282 % \mbox{}\phantom{\tt Example: lettrine}%
283 % |{V}{oici} un exemple |…
284 %
285 % Coloured initials are available in conjonction with package
286 % \file{color}, examples: \\
287 % |\lettrine{\textcolor{red}{A}}{n} example|\quad or\\
288 % |\lettrine{\textcolor[gray]{0.5}{A}}{nother} one| \\
289 % see package \file{color} for the syntax of colour commands.
290 % Another possibility to colour initials globally is described
291 % below, see |\LettrineFontHook|.
292 %
293 % Three dimensions, |\LettrineHeight|, |\LettrineDepth| and
294 % |\LettrineWidth| hold the final size of the initial
295 % (\textit{height} and \textit{depth} being measured from
296 % the paragraph’s $n$-th baseline if |lines=|$n$.
297 %
298 % Have a look at files \file{lettrine-demo-fr.tex} and
299 % \file{lettrine-demo-lua.tex} and at the resulting PDFs in the
300 % \file{doc} folder to see the possible usage of these parameters.
301 %
302 % \changes{v1.9}{2015/08/31}{New customisable string
303 % \cs{LettrineSecondString} to tune the initial’s height.}
304 %
305 % Starting with version~2.30, the default settings can easily be
306 % specified as options passed to the \pkg{lettrine} \emph{package}.
307 % These options are the same as those of the |\lettrine| command
308 % previously described%
309 % \footnote{With the exception of \lopt{ante} and \lopt{viewport}
310 % which do not make sense for a global usage.}:
311 % f.i.\ |\usepackage[lines=3]{lettrine}|
312 % will set the default to three lines of text.
313 % Options passed to the \pkg{lettrine} package override the defaults
314 % set in the \file{lettrine.cfg} file (see below) and will be
315 % overriden by options passed to the |\lettrine| command.
316 %
317 % The default settings can also be customized in a config file
318 % \file{lettrine.cfg} (backward compatibility). The following list
319 % shows the syntax to set them and their default values:
320 % \begin{itemize}
321 % \item |\setcounter{DefaultLines}{2}|,
322 % \item |\setcounter{DefaultDepth}{0}|,
323 % \item |\renewcommand{\DefaultLoversize}{0}|,
324 % \item |\renewcommand{\DefaultLraise}{0}|,
325 % \item |\renewcommand{\DefaultLhang}{0}|,
326 % \item |\setlength{\DefaultFindent}{0pt}|,
327 % \item |\setlength{\DefaultNindent}{0.5em}|,
328 % \item |\setlength{\DefaultSlope}{0pt}|.
329 % \item |\setlength{\DiscardVskip}{1pt}|,
330 % \item |\LettrineImagefalse|,
331 % \item |\LettrineOnGridfalse|,
332 % \item |\LettrineMoveAtEOPfalse|,
333 % \item |\LettrineRealHeightfalse|.
334 % \end{itemize}
335 %
336 % Instead of giving optional parameters to the |\lettrine| command,
337 % it is possible to set them on a per character basis
338 % in a second config file (suggested by Pascal Kockaert):
339 % |\renewcommand{\DefaultOptionsFile}{|\meta{filename}|}|
340 % in the preamble will force this file to be read `AtBeginDocument’.
341 % Alternatively, |\usepackage[optionsfile=|\meta{filename}|]{lettrine}|
342 % produces the same effect.
343 % See examples of such config files in the subdirectory \file{contrib}.
344 %
345 % The idea is to provide settings for specific fonts, or to define
346 % suitable parameters for some initials like A or V, for instance\\
347 % |\LettrineOptionsFor{A}{slope=0.5em, findent=-1.5em, nindent=.7em}|\\
348 % Options passed this way are meant to fine tune how the text will be
349 % wrapped around the initial; for convenience \emph{inside}
350 % |\LettrineOptionsFor| \emph{only}, |\LettrineWidth| can be used
351 % instead of~|em| as a unit length.
352 %
353 % Since version~2.70, these commands are also allowed in the document’s
354 % preamble. Mixing |\LettrineOptionsFor| commands in the preamble
355 % and in an external config file is not recommended: remember that
356 % if an options file is declared, the settings it holds will be taken
357 % into account `AtBeginDocument’ thus possibly overriding
358 % |\LettrineOptionsFor| commands in the preamble.
359 %
360 % Anyway, the settings read from this file will be overridden by the
361 % optional arguments eventually given to the |\lettrine| command.
362 %
363 % More customisation possibilities are offered by the next four
364 % commands:
365 % \begin{itemize}
366 % \item |\renewcommand{\LettrineFontHook}{}|,
367 % \item |\renewcommand{\LettrineTextFont}{\scshape}|,
368 % \item |\renewcommand{\LettrineTestString}{EFTZ}|,
369 % \item |\renewcommand{\LettrineSecondString}{x}|,
370 % \end{itemize}
371 % |\LettrineTextFont| sets the font used for the second argument
372 % of |\lettrine|, its default definition is
373 % |\newcommand{\LettrineTextFont}{\scshape}| (second argument in
374 % small caps), this can be changed using |\renewcommand|.
375 %
376 % |\LettrineTestString| and |\LettrineSecondString| provide
377 % reasonable defaults for Latin scripts (|EFTZ| and |x|).
378 % For other scripts they \emph{should be changed} respectively to
379 % uppercase and lowercase letters of the given script, as the
380 % dropped cap’s height computation is based on these strings;
381 % another possibility is to use the previously described
382 % \lopt{refstring} and \lopt{realheight} options.
383 %
384 % |\LettrineFont| \emph{is not customisable} see |\LettrineFontHook|
385 % below, it sets the font used for the dropped capital, usually the
386 % current font in a (large) size, computed automatically from the
387 % number of lines it will fill: the font size is computed so that,
388 % a \emph{standard} dropped capital (say Z, not À) when sitting on
389 % its baseline, gets its top aligned with the top of the following
390 % text (provided $|loversize|=0$ and $|lines|\ge 2$). When
391 % \lopt{lines=1}, size is computed as if \lopt{lines} was~2.
392 %
393 % A hook |\LettrineFontHook| is provided to change the font
394 % used for the dropped capital, syntax follows LaTeX’s
395 % low-level font interface (see LaTeX Companion III, section~I-9.3),
396 % the |\selectfont| command is issued by |\LettrineFont|:\\
397 % |\renewcommand{\LettrineFontHook}{\fontfamily{ppl}|\ignorespaces
398 % |\fontseries{bx}%|\\
399 % | \fontshape{sl}}|\\
400 % selects Palatino bold expanded slanted for the dropped capital.
401 %
402 % With LuaLaTeX or XeLaTeX changing the lettrine’s font is
403 % even easier, simply use the |\fontspec| command:\\
404 % |\renewcommand{\LettrineFontHook}{\fontspec{LinLibertine_I.otf}}|\\
405 % will switch to Linux Libertine Initials.
406 %
407 % |\LettrineFontHook| can also be used to change the colour of
408 % all initials in a (part of) document:
409 % |\renewcommand{\LettrineFontHook}{\color[gray]{0.5}}| \\
410 % will colour the initials following this command in grey.
411 % A |\color| command can be added in |\LettrineTextHook| if the text
412 % following the dropped cap requires the same or another colour.
413 %
414 % \changes{v1.3}{2002/08/23}{Correct the documentation to
415 % mention the cm-super fonts and the type1ec package by
416 % Vladimir Volovich.}
417 %
418 % \vspace{.5\baselineskip}
419 % \textbf{Important notice:}
420 % the sizing works fine with \emph{fully scalable} fonts (like the
421 % standard PostScript or OpenType fonts), but might not work well
422 % with CM/EC fonts which have two limitations: only a limited number
423 % of sizes is available by default (precise adjustments are
424 % impossible), and the largest size (25pt or 35pt) is often too
425 % small. The CM fonts are available in PostScript type1 format
426 % for free (courtesy of BlueSky/Y\&Y), to make them fully scalable,
427 % it is mandatory to add |\usepackage{type1cm}| in the preamble
428 % of your document.
429 % The EC fonts are also available in type1 format for free
430 % (thanks to Vladimir Volovich, they are called cm-super), and
431 % adding |\usepackage{type1ec}|\footnote{This package, available on
432 % CTAN, was first released on 2002/07/30.}
433 % in the preamble will make them fully scalable too.
434 % So, if you want \file{lettrine.sty} to work properly with CM
435 % or EC fonts, you will need \emph{PostScript versions} of these
436 % fonts \emph{and} one of the packages |type1cm.sty| or
437 % |type1ec.sty|.
438 %
439 % The LM fonts are a good replacement for both CM and EC fonts they
440 % are fully scalable, so you should use them instead of CM or EC
441 % fonts. |\usepackage{lmodern}| is the command to switch them on
442 % (add |\usepackage[T1]{fontenc}| when composing in one of the
443 % western languages other than English in order to get proper
444 % hyphenation).
445 %
446 % You can also consider using one of the standard PostScript fonts
447 % (Palatino, Times, Utopia…), or any OpenType font, they are
448 % fully scalable too!
449 %
450 % \vspace{.5\baselineskip}
451 % \textbf{Breaking change in version~2.50:} in order to improve the
452 % alignment of side by side parboxes starting with a dropped cap, the
453 % internals of the |\lettrine{}| command have changed. Formerly, the
454 % initial was completely smashed (\textit{height}=0,
455 % \textit{depth}=0) and a |\vskip| was added in case the initial
456 % sticked out too much above the paragraph’s first baseline. From
457 % version~2.50 on, the initial gets a null \textit{depth} and its
458 % proper \textit{height} (measured from the paragraph’s first
459 % baseline, please note that it is different from |\LettrineHeight|).
460 % This change has the following side effect: in multicolumn
461 % typesetting, when a dropped cap starts a column and sticks out
462 % significantly above the baseline, it might be necessary to `smash’
463 % the dropped cap and eventually to add a |\vspace{}| before
464 % the multicolumn environment. See \file{lettrine-demo-fr.pdf} p.~4
465 % for an example. Using the rollback mechanism to switch back to
466 % version~2.40 is another option: |\usepackage{lettrine}[=v2.4]|.
467 %
468 % \vspace{.5\baselineskip}
469 % \textbf{New in version~2.60:} the |\lettrine| command is now
470 % compatible with right to left typesetting, with LuaLaTeX and
471 % XeLaTeX (+\pkg{babel} or \pkg{polyglossia}). With XeLaTeX, file
472 % \file{lettrine-xetex-bidi.def} (v0.8 [2022/11/06]) is automatically
473 % loaded by the \pkg{bidi} package; it redefines the |\@lettrine|
474 % command based on version~2.30 of \pkg{lettrine}. This code is
475 % \emph{incompatible} with versions~2.50 and newer, you can safely
476 % remove \file{lettrine-xetex-bidi.def} when installing v2.60 or
477 % newer of \pkg{lettrine}.
478
479 % \vspace{.5\baselineskip}
480 % \textbf{Known issues:}
481 % \begin{itemize}
482 % \item Starting with version~2.80, the \pkg{lettrine} package
483 % issues a warning in case a paragraph starting with a dropped
484 % capital occurs at the end of some page thus requiring manual
485 % page-breaking; it’s up to the user to figure out how to best
486 % fix the issue (enlarging the page, shortening some previous
487 % paragraph…). A new option \lopt{nextpage} has also been added,
488 % when set to \lopt{true}, the whole paragraph is moved to the top
489 % of next page… leaving a blank at the end of the previous page.
490 % \item |\lettrine| works within `quote’ `quotation’, `abstract’
491 % environments but does not work within `verse’ environments.
492 % It doesn’t work either in `center’ environments except with
493 % option \texttt{[lines=1]}.
494 % \item |\lettrine| does not work within lists.
495 % \item If |\lettrine| is used inside any environment, it is
496 % \emph{mandatory} to end the paragraph starting with the dropped
497 % capital \emph{inside} the environment; adding a |\par| command
498 % before the end of environment usually fixes placement issues.
499 % \item The LaTeX |\raggedright| command doesn’t work well with the
500 % TeX |\parshape| command used internally by |\lettrine|.
501 % Please use the |\RaggedRight| command from the \pkg{ragged2e}
502 % package together with appropriate settings, f.i. \\
503 % |\setlength{\RaggedRightRightskip}{0pt plus .1\hsize}|. \\
504 % See \url{https://tex.stackexchange.com/questions/97808/} for
505 % details.
506 % \item If a \emph{list} has to be included in a paragraph starting
507 % with |\lettrine|, it is necessary to add the command
508 % |\parshape=0| just after the end of the list (starting a new
509 % paragraph just before or just after the list works too).
510 % Remember that `quote’, `quotation’, `abstract’ environments
511 % are implemented as \emph{lists} in LaTeX.
512 % \item If you are facing some slight height inaccuracy for a
513 % dropped capital, you can try option \lopt{refstring};
514 % this option is meant for fancy (unaccented) initials.
515 % Informations about targeted and effective initial’s
516 % height are available in the \file{.log} file. Using LuaTeX
517 % or XeTeX engines with OpenType fonts may be an option
518 % (some TFM files for Type1 fonts are slightly inaccurate).
519 % \item |\LettrineTestString|’s value has changed over the time;
520 % these changes may result in slight size differences for the
521 % initial. Starting with version~2.2, the lettrine package takes
522 % advantage of the rollback facilities recently introduced by
523 % the LaTeX Team\footnote{A LaTeX kernel dated 2018-04-01 or
524 % newer is required.}. Three rollback versions are provided in
525 % order to produce exactly the same output as with former
526 % versions: you can request
527 % |\usepackage{lettrine}[=v1.6]|\footnote{Don’t forget the
528 % \texttt{=} sign!} for 1999-2012 documents or\\
529 % |\usepackage{lettrine}[=v1.9]| (documents from 2012 to July 2018)
530 % or\\ |\usepackage{lettrine}[=v2.0]| (August 2018).
531 % Using any date in ISO format works too:
532 % |\usepackage{lettrine}[=2014-03-15]| will load v1.9.
533 % \end{itemize}
534 %
535 % \StopEventually{}
536 %
537 % \newpage
538 % \section{\TeX{}nical details}
539 %
540 % \iffalse
541 %<*sty>
542 % \fi
543 %
544 % \changes{v2.2}{2018/08/25}{Rollback mechanism used for recovering
545 % older versions.}
546 %
547 % \changes{v2.40}{2023/04/18}{lettrine.dtx auto-generates lettrine.sty
548 % and lettrine.cfg (lettrine.ins deleted).}
549 %
550 % The lettrine package uses the rollback mechanism
551 % introduced by the LaTeX Team to provide easier backward
552 % compatibility. The current release requires a LaTeX version
553 % not older than 2022-06-01 (kernel packages \pkg{ltkeys} and
554 % \pkg{xfp} are required).
555 % \begin{macrocode}
556 \DeclareRelease{v1.6}{1999-03-03}{lettrine-2006-03-17.sty}
557 \DeclareRelease{v1.9}{2012-07-20}{lettrine-2015-08-31.sty}
558 \DeclareRelease{v2.0}{2018-07-21}{lettrine-2018-08-18.sty}
559 \DeclareRelease{v2.3}{2022-09-25}{lettrine-2022-09-25.sty}
560 \DeclareRelease{v2.4}{2023-04-18}{lettrine-2023-04-18.sty}
561 \DeclareCurrentRelease{}{2025-11-25}
562 % \end{macrocode}
563 %
564 % Default initializations: define the necessary counters, lengths,
565 % and commands to hold the default settings and set these default
566 % settings. They can be overwritten in file |lettrine.cfg|.
567 %
568 % \changes{v1.2}{2002/03/13}{\cs{newlength} changed to
569 % \cs{newdimen}, to correct a bug with seminar.cls (pointed out
570 % by Peter Münster).}
571 %
572 % \changes{v1.6}{2004/05/22}{Added newif \cs{ifLettrineImage}.}
573 %
574 % \changes{v1.8}{2015/02/06}{Added newif \cs{ifLettrineOnGrid}
575 % and new dimen \cs{DiscardVskip}, default (0.2pt) set for
576 % compatibility with previous releases.}
577 %
578 % \changes{v2.1}{2018/08/14}{Newif \cs{ifLettrineVone} and
579 % new option `Vone’ (removed in v2.2, rollback prefered).}
580 %
581 % \changes{v2.1}{2018/08/14}{New option `refstring’.}
582 %
583 % \changes{v2.50}{2023/05/30}{\cs{DiscardVskip} default value enlarged
584 % from 0.2pt to 1pt.}
585 %
586 % \begin{macrocode}
587 \newcounter{DefaultLines}
588 \setcounter{DefaultLines}{2}
589 \newcounter{DefaultDepth}
590 \newcommand{\DefaultOptionsFile}{}
591 \newcommand{\DefaultLoversize}{0}
592 \newcommand{\DefaultLraise}{0}
593 \newcommand{\DefaultLhang}{0}
594 \newdimen\DefaultFindent
595 \setlength{\DefaultFindent}{\z@}
596 \newdimen\DefaultNindent
597 \setlength{\DefaultNindent}{0.5em}
598 \newdimen\DefaultSlope
599 \setlength{\DefaultSlope}{\z@}
600 \newdimen\DiscardVskip
601 \setlength{\DiscardVskip}{1pt}
602 \newif\ifLettrineImage
603 \newif\ifLettrineOnGrid
604 \newif\ifLettrineRealHeight
605 \newif\ifLettrineMoveAtEOP
606 % \end{macrocode}
607 %
608 % Then let’s define the necessary internal counters, lengths,
609 % and commands.
610 %
611 % \changes{v1.6}{2004/05/22}{Added newif \cs{ifL@image}.}
612 %
613 % \changes{v1.6}{2015/02/06}{Added newif \cs{ifL@grid}.}
614 %
615 % \changes{v2.81}{2025/11/25}{Added \cs{L@actual} and keyval option
616 % `actualtext’ for image tagging.}
617 %
618 % \begin{macrocode}
619 \newsavebox{\L@lbox}
620 \newcounter{L@lines}
621 \newcounter{L@depth}
622 \newdimen\L@Pindent
623 \newdimen\L@Findent
624 \newdimen\L@Nindent
625 \newdimen\L@lraise
626 \newdimen\L@first
627 \newdimen\L@next
628 \newdimen\L@slope
629 \newdimen\L@height
630 \newdimen\L@novskip
631 \newdimen\L@target@ht
632 \newdimen\L@target@dp
633 \newdimen\L@target@tht
634 \newdimen\LettrineWidth
635 \newdimen\LettrineHeight
636 \newdimen\LettrineDepth
637 \newdimen\L@finalht
638 \newdimen\L@finaldp
639 \newcommand*{\L@file}{}
640 \newcommand*{\L@hang}{}
641 \newcommand*{\L@oversize}{}
642 \newcommand*{\L@raise}{}
643 \newcommand*{\L@ante}{}
644 \newcommand*{\L@actual}{}
645 \newif\ifL@image
646 \newif\ifL@grid
647 \newif\ifL@nextpage
648 \newif\ifL@realh
649 \let\ifL@RTL\iffalse
650 \newcommand*{\L@viewport}{}
651 % \end{macrocode}
652 %
653 % \begin{macro}{\LettrineTestString}
654 % As some font designers apply optical correction to capitals C, G,
655 % O, or Q (they are slightly taller than `T’ or `Z’), they are better
656 % left out of |\LettrineTestString|. |EFTZ| should be a good default
657 % for most fonts.
658 %
659 % \changes{v1.63}{2012/07/20}{(new) it defaults to
660 % `ABCDEFGHIJKLMNOQPRSTUVWXYZ’. In previous versions height
661 % computations were based on letter `X’ which might not exist
662 % in some (rare) fonts. Pointed out by Raphaël Pinson.}
663 %
664 % \changes{v2.0}{2018/07/21}{changed from `ABCDEFGHIJKLMNOQPRSTUVWXYZ’
665 % to `EFTZ’ as some capitals like C, G, O, Q or X might be slightly
666 % taller (possible optical correction).}
667 %
668 % \begin{macrocode}
669 \newcommand*{\LettrineTestString}{EFTZ}
670 % \end{macrocode}
671 % \end{macro}
672 %
673 % Load a local config file if present in LaTeX’s search path.
674 % \begin{macrocode}
675 \InputIfFileExists{lettrine.cfg}
676 {\typeout{Loading lettrine.cfg}}
677 {\typeout{lettrine.cfg not found, using default values}}
678 % \end{macrocode}
679 %
680 % \changes{v2.30}{2022/09/23}{Added global options to package
681 % \pkg{lettrine}.}
682 %
683 % \changes{v2.40}{2023/04/18}{Package options and \cs{lettrine} options
684 % no longer depend on \pkg{xkeyval}, they are based on ltkeys.dtx.}
685 %
686 % Global package options enable to override the default values given
687 % above to generic parameters. These may be overriden again by
688 % options passed to the |\lettrine[]{}{}| command.
689 % This code is based on \pkg{ltkeys.dtx}.
690 % \begin{macrocode}
691 \DeclareKeys[LettrineGlobal]
692 {
693 lines.code = \setcounter{DefaultLines}{#1} ,
694 depth.code = \setcounter{DefaultDepth}{#1} ,
695 lhang.store = \DefaultLhang ,
696 loversize.store = \DefaultLoversize ,
697 lraise.store = \DefaultLraise ,
698 findent.code = \setlength{\DefaultFindent}{#1} ,
699 nindent.code = \setlength{\DefaultNindent}{#1} ,
700 slope.code = \setlength{\DefaultSlope}{#1} ,
701 novskip.code = \setlength{\DiscardVskip}{#1} ,
702 image.if = LettrineImage ,
703 grid.if = LettrineOnGrid ,
704 nextpage.if = LettrineMoveAtEOP ,
705 realheight.if = LettrineRealHeight ,
706 actualtext.store = \L@actual ,
707 refstring.default:n = \L@initial ,
708 refstring.store = \LettrineTestString ,
709 optionsfile.store = \DefaultOptionsFile
710 }
711 \ProcessKeyOptions[LettrineGlobal]
712 % \end{macrocode}
713 %
714 % Ditto for the |\lettrine| command’s options.
715 %
716 % \begin{macrocode}
717 \DeclareKeys[LettrineLocal]
718 {
719 lines.code = \setcounter{L@lines}{#1} ,
720 depth.code = \setcounter{L@depth}{#1} ,
721 lhang.store = \L@hang ,
722 loversize.store = \L@oversize ,
723 lraise.store = \L@raise ,
724 ante.store = \L@ante ,
725 findent.code = \setlength{\L@Findent}{#1} ,
726 nindent.code = \setlength{\L@Nindent}{#1} ,
727 slope.code = \setlength{\L@slope}{#1} ,
728 novskip.code = \setlength{\L@novskip}{#1} ,
729 image.if = L@image ,
730 viewport.store = \L@viewport ,
731 grid.if = L@grid ,
732 nextpage.if = L@nextpage ,
733 realheight.if = L@realh ,
734 actualtext.store = \L@actual ,
735 refstring.default:n = \L@initial ,
736 refstring.store = \L@refstring
737 }
738 % \end{macrocode}
739 %
740 %\changes{v2.70}{2024/11/14}{Read the config file only once, its
741 % content is added to token register \cs{Lettrine@tweaks}.}
742 %
743 % Read the per letter options file `AtBeginDocument’.
744 % \begin{macrocode}
745 \AtBeginDocument{%
746 \ifx\DefaultOptionsFile\@empty
747 \else
748 \InputIfFileExists{\DefaultOptionsFile}%
749 {\PackageWarning{lettrine.sty}%
750 {File \DefaultOptionsFile\space loaded!}%
751 }%
752 {\PackageWarning{lettrine.sty}%
753 {File \DefaultOptionsFile\space not found!}%
754 }%
755 \fi}
756 % \end{macrocode}
757 %
758 % \changes{v1.5}{2003/08/18}{\cs{LettrineOptionsFor} and
759 % \cs{LettrineWidth} added.}
760 %
761 % \begin{macro}{\LettrineOptionsFor}
762 % This command sets the values of parameters on a per character
763 % basis, for instance:\\
764 % |\LettrineOptionsFor{A}{slope=0.6em, findent=-1em, nindent=0.6em}|
765 %
766 % \begin{macrocode}
767 \newtoks\Lettrine@tweaks
768 \newcommand*{\LettrineOptionsFor}[2]{%
769 \Lettrine@tweaks=\expandafter{\the\Lettrine@tweaks
770 \@lettrine@optionsfor{#1}{#2,}}}
771 % \end{macrocode}
772 % The internal |\@lettrine@optionsfor| checks if its first argument
773 % matches the current initial, if so it passes the options (second
774 % argument) to |\SetKeys|.
775 % \begin{macrocode}
776 \newcommand*{\@lettrine@optionsfor}[2]{%
777 \edef\L@tmpa{#1}%
778 % \end{macrocode}
779 % Gobble potential color commands for the initial.
780 % \begin{macrocode}
781 \begingroup
782 \def\color##1##{\L@color{##1}}%
783 \let\L@color\@gobbletwo
784 \def\textcolor##1##{\L@textcolor{##1}}%
785 \def\L@textcolor##1##2##3{##3}%
786 \xdef\L@tmpb{\L@initial}%
787 \endgroup
788 \ifx\L@tmpa\L@tmpb \SetKeys[LettrineLocal]{#2}\fi
789 }
790 % \end{macrocode}
791 % \end{macro}
792 %
793 % \changes{v2.21}{2018/08/28}{Code clean up, new commands
794 % \cs{computeL@height}, \cs{compute@fontsize}, \cs{setupL@lbox}.}
795 %
796 % \begin{macro}{\LettrineTextFont}
797 % In French, small caps usually follow the initial.
798 % \begin{macrocode}
799 \newcommand*{\LettrineTextFont}{\scshape}
800 \newcommand*{\LettrineSecondString}{x}
801 % \end{macrocode}
802 % \end{macro}
803 %
804 % \begin{macro}{\LettrineFontHook}
805 % |\LettrineFontHook| enables to select another font for the
806 % dropped capital. Its default definition is empty (the current
807 % text font is used).
808 % \begin{macrocode}
809 \newcommand*{\LettrineFontHook}{}
810 % \end{macrocode}
811 % \end{macro}
812 %
813 % \begin{macro}{\computeL@height}
814 % The default size for the dropped capital is computed so that the
815 % top of it is exactly aligned with the top of the following text;
816 % an extra height (positive or negative) may be added globally by
817 % redefining |\Defaultloversize| or locally using optional
818 % argument \lopt{loversize=}.
819 % If \lopt{lines=1}, the default size for the dropped capital is
820 % computed as if \lopt{lines=2}.
821 % \begin{figure}[ht]
822 % \centering
823 % \begin{tikzpicture}[>=stealth]
824 % \node[font=\fontfamily{lmr}\fontsize{160}{160}\mdseries]
825 % at (3,2) {F} ;
826 % \node[right, font=\fontfamily{lmr}\fontsize{20}{20}\bfseries]
827 % at (4.6,3.65) {IRST};
828 % \node[right, font=\fontfamily{lmr}\fontsize{28}{28}\bfseries]
829 % at (5,2.63) {bla bla};
830 % \node[right, font=\fontfamily{lmr}\fontsize{28}{28}\bfseries]
831 % at (5,1.53) {bla bla};
832 % \node[right, font=\fontfamily{lmr}\fontsize{28}{28}\bfseries]
833 % at (5,0.43) {bla bla};
834 % \draw[dotted] (0,3.9) -- (9,3.9);
835 % \draw (1,3.4) -- (9,3.4);
836 % \draw[dashed] (1.5,2.3) -- (9,2.3);
837 % \draw[dashed] (1.5,1.2) -- (9,1.2);
838 % \draw[dashed] (0,0.1) -- (9,0.1);
839 % \draw[<->] (-0.3,0.1) -- (-0.3,3.9);
840 % \node[left] at (-0.3,2.1) {tht};
841 % \draw[<->] (1.3,0.1) -- (1.3,3.4);
842 % \node[left] at (1.3,1.8) {finaldp};
843 % \draw[<->] (1,3.4) -- (1,3.9);
844 % \node[left] at (1,3.7) {finalht};
845 % \end{tikzpicture}
846 % \caption{Initial’s targeted dimensions
847 % ($\mbox{\cs{lines}}=4$, $\mbox{\cs{lraise}}=0$)}
848 % \label{fig:target}
849 % \end{figure}
850 %
851 % |\computeL@height| computes the targeted height for the
852 % dropped capital and stores it into |\L@target@tht|. This height
853 % only depends on |L@lines| and |\L@target@ht| (the height of the
854 % following text, see fig.~\ref{fig:target}). So options \emph{must}
855 % be read and |\L@target@ht| be properly initialised \emph{before}
856 % executing |\computeL@height| (see below in |\lettrine| code).
857 % |\L@height| is set to |\L@target@tht| raised by the |\L@oversize|
858 % factor.
859 %
860 % \changes{v1.2}{2002/03/13}{\cs{baselineskip} may be a
861 % rubber length, we convert it to a dimen.}
862 %
863 % \changes{v1.9}{2015/08/31}{\cs{theL@lines} changed
864 % to \cs{value\{L@lines\}}. Needed for babel-hebrew which
865 % redefines \cs{@arabic}.}
866 %
867 % \changes{v2.0}{2018/07/21}{Store targeted dimensions of the
868 % dropped capital (ht, dp, tht) for further use.}
869 %
870 % \changes{v2.1}{2018/08/01}{Height computations moved out of
871 % \cs{LettrineFont}: \cs{global} settings no longer required.}
872 %
873 % \begin{macrocode}
874 \def\computeL@height{%
875 % \end{macrocode}
876 % As |\baselineskip| might be a rubber length, let’s convert it
877 % into a `dimen’ using |\@tempdima|.
878 % \begin{macrocode}
879 \@tempdima=\baselineskip
880 \setlength{\L@target@dp}{\value{L@lines}\@tempdima}%
881 \ifnum\value{L@lines}>1
882 \addtolength{\L@target@dp}{-\@tempdima}%
883 \else
884 \addtolength{\L@target@ht}{\L@target@dp}%
885 \setlength{\L@target@dp}{\z@}%
886 \fi
887 \setlength{\L@target@tht}{\L@target@ht}%
888 \addtolength{\L@target@tht}{\L@target@dp}%
889 \setlength{\L@height}{\L@target@tht}%
890 \addtolength{\L@height}{\L@oversize\L@target@tht}%
891 }
892 % \end{macrocode}
893 % \end{macro}
894 %
895 % \begin{macro}{\compute@fontsize}
896 % After executing |\computeL@height|, |\L@height| holds the exact
897 % height required for the dropped capital, nothing more is needed if
898 % the initial is a picture, otherwise we need to compute the matching
899 % |\fontsize|’s value. This is done by measuring the height of
900 % a ``reference’’ capital (i.e.\ either listed in
901 % |\LettrineTestString| or the initial itself).
902 % This command compares the height of a ``reference’’ capital scaled
903 % by |\fontsize| with argument |\L@height|, to |\L@height| (the
904 % required height for the initial) to compute a ratio |\L@factor|
905 % (decimal number). Then, the initial will be scaled by
906 % |\L@factor\L@height|. Starting with v2.40, |\L@factor| is computed
907 % by |\fpeval| which is now part of LaTeX kernel.
908 %
909 % \changes{v2.1}{2018/08/14}{Computation of \cs{L@factor} for
910 % \cs{fontsize} done by the minifp package.}
911 %
912 % \changes{v2.22}{2018/09/14}{Warn if \cs{fontsize} computation fails
913 % due to division by 0.}
914 %
915 % \changes{v2.40}{2023/04/18}{Computation of \cs{L@factor} for
916 % \cs{fontsize} done by the xfp package.}
917 %
918 % If the option \lopt{refstring} is set in the |\lettrine| command
919 % the initial itself is taken as reference to compute |\fontsize|,
920 % this can be handy when working with fancy fonts
921 % (i.e.\ cfr-initials, Yinit).
922 % In most cases, the default is a better choice.
923 % \begin{macrocode}
924 \def\compute@fontsize{%
925 \ifx\L@refstring\@empty
926 \def\Lettrine@RefString{\LettrineTestString}%
927 \else
928 \def\Lettrine@RefString{\L@refstring}%
929 \fi
930 \settoheight{\@tempdima}{\LettrineFontHook
931 \fontsize{\L@height}{\L@height}\selectfont
932 \Lettrine@RefString}%
933 \ifdim\@tempdima=\z@
934 \PackageWarning{lettrine}{Unable to compute \protect\fontsize!%
935 \MessageBreak \protect\LettrineTestString\space empty? reported}%
936 \def\L@factor{1}%
937 \else
938 \def\L@factor{\fpeval{\the\L@height/\the\@tempdima}}%
939 \fi
940 }
941 % \end{macrocode}
942 % \end{macro}
943 %
944 % \begin{macro}{\LettrineFont}
945 % |\fontsize|’s argument providing the requested |\L@height| is
946 % |\L@factor\L@height|.
947 % \begin{macrocode}
948 \newcommand*{\LettrineFont}{%
949 \LettrineFontHook
950 \fontsize{\L@factor\L@height}{\L@factor\L@height}%
951 \selectfont
952 }
953 % \end{macrocode}
954 % \end{macro}
955 %
956 % \begin{macro}{\setupL@lbox}
957 % \begin{macro}{\computeL@dimens}
958 %
959 % \changes{v2.82}{2025/11/27}{Stop using \cs{L@lbox} to compute
960 % the initial’s dimens (solves tagging issues with images).}
961 %
962 % The next (internal) command computes the width, height and depth
963 % requested for the initial (letter or image) and stores them in
964 % |\LettrineWidth|, |\LettrineHeight| and |\LettrineDepth|.
965 % \begin{macrocode}
966 \def\computeL@dimens{%
967 \computeL@height
968 \ifL@image
969 \ifx\L@viewport\@empty
970 \settowidth{\LettrineWidth}{%
971 \includegraphics[height=\L@height]{\L@initial}}%
972 \else
973 \settowidth{\LettrineWidth}{%
974 \expanded{\noexpand\includegraphics%
975 [viewport=\L@viewport, height=\L@height]{\L@initial}}%
976 }%
977 \fi
978 \setlength{\LettrineHeight}{\L@height}%
979 \setlength{\LettrineDepth}{\z@}%
980 \else
981 \compute@fontsize
982 \settowidth{\LettrineWidth}{\LettrineFont \L@initial}%
983 \settoheight{\LettrineHeight}{\LettrineFont \L@initial}%
984 \settodepth{\LettrineDepth}{\LettrineFont \L@initial}%
985 \fi
986 }
987 % \end{macrocode}
988 % The next command actually stores the dropped cap in the |\L@lbox|
989 % box, it will be executed (only once) in horizontal mode to prevent
990 % tagging issues.
991 % \begin{macrocode}
992 \def\setupL@lbox{%
993 \ifL@image
994 \ifx\L@actual\@empty \edef\L@actual{\L@initial}\fi
995 \ifx\L@viewport\@empty
996 \sbox{\L@lbox}{\includegraphics%
997 [height=\L@height, actualtext=\L@actual]{\L@initial}%
998 }%
999 \else
1000 \sbox{\L@lbox}{%
1001 \expanded{\noexpand\includegraphics%
1002 [viewport=\L@viewport, height=\L@height,
1003 actualtext=\L@actual]{\L@initial}}%
1004 }%
1005 \fi
1006 \else
1007 \compute@fontsize
1008 \sbox{\L@lbox}{\LettrineFont \L@initial}%
1009 \fi
1010 }
1011 % \end{macrocode}
1012 % \end{macro}
1013 % \end{macro}
1014 %
1015 % \begin{macro}{\lettrine}
1016 % \changes{v2.83}{2025/12/06}{now defined using
1017 % \cs{NewDocumentCommand}.}
1018 %
1019 % Now let’s define the |\lettrine| command.
1020 % \begin{macrocode}
1021 \NewDocumentCommand\lettrine{ O{} m m }{%
1022 \def\L@initial{#2}\def\L@refstring{}\def\L@viewport{}%
1023 % \end{macrocode}
1024 %
1025 % \changes{v1.9}{2015/08/31}{\cs{theDefaultLines} changed to
1026 % \cs{value\{DefaultLines\}}, same with \cs{theDefaultDepth}.
1027 % Needed for babel-hebrew which redefines \cs{@arabic}.
1028 % Thanks to Ulrike Fischer for providing the fix.}
1029 %
1030 % First reset the parameters to their default values:
1031 % \begin{macrocode}
1032 \setcounter{L@lines}{\value{DefaultLines}}%
1033 \setcounter{L@depth}{\value{DefaultDepth}}%
1034 \renewcommand*{\L@hang}{\DefaultLhang}%
1035 \renewcommand*{\L@oversize}{\DefaultLoversize}%
1036 \renewcommand*{\L@raise}{\DefaultLraise}%
1037 \renewcommand*{\L@ante}{}%
1038 \renewcommand*{\L@actual}{}%
1039 \setlength{\L@Findent}{\DefaultFindent}%
1040 \setlength{\L@Nindent}{\DefaultNindent}%
1041 \setlength{\L@slope}{\DefaultSlope}%
1042 \setlength{\L@novskip}{\DiscardVskip}%
1043 \ifLettrineImage\L@imagetrue\else\L@imagefalse\fi
1044 \ifLettrineOnGrid\L@gridtrue\else\L@gridfalse\fi
1045 \ifLettrineMoveAtEOP\L@nextpagetrue\else\L@nextpagefalse\fi
1046 \ifLettrineRealHeight\L@realhtrue\else\L@realhfalse\fi
1047 % \end{macrocode}
1048 %
1049 % Take the local options passed to |\lettrine| into account
1050 % to compute |\L@target@ht| which depends on option |realheight|,
1051 % before eventually reading the per character config file.
1052 %
1053 % \changes{v1.6}{2004/05/22}{Add braces around \#3 to allow
1054 % commands taking an argument (such as \cs{MakeLowercase}) in
1055 % \cs{LettrineTextFont}. Suggested by Philipp Lehman.}
1056 %
1057 % \changes{v1.9}{2015/08/31}{Use the second mandatory
1058 % argument of \cs{lettrine} or \cs{LettrineSecondString} (which
1059 % defaults to `x’) to compute \cs{L@height}. This is controlled by
1060 % the `realheight’ flag.}
1061 %
1062 % \begin{macrocode}
1063 \SetKeys[LettrineLocal]{#1}%
1064 \settoheight{\L@target@ht}{\LettrineTextFont{\LettrineSecondString}}%
1065 \ifL@realh
1066 \def\@tempa{#3}%
1067 \ifx\@tempa\@empty
1068 \PackageWarning{lettrine.sty}%
1069 {Empty second argument,\MessageBreak
1070 ignoring option `realheight';}%
1071 \else
1072 \settoheight{\L@target@ht}{{\LettrineTextFont{#3}}}%
1073 \fi
1074 \fi
1075 % \end{macrocode}
1076 %
1077 % \changes{v2.40}{2023/04/18}{Options from the per letter config file
1078 % are now handled by LaTeX command \cs{SetKeys}.}
1079 %
1080 % Take the per character options into account if any. For these
1081 % options some parameters’ values \lopt{findent}, \lopt{nindent} and
1082 % \lopt{slope} ---which do not influence the initial’s size--- may
1083 % be given relative to |\LettrineWidth|, which needs to be computed
1084 % before.
1085 % \begin{macrocode}
1086 \edef\@tempa{\the\Lettrine@tweaks}%
1087 \ifx\@tempa\@empty
1088 \else
1089 \computeL@dimens
1090 \the\Lettrine@tweaks
1091 % \end{macrocode}
1092 % As local options always prevail, read again the optionnal
1093 % argument of |\lettrine|.
1094 % \begin{macrocode}
1095 \SetKeys[LettrineLocal]{#1}%
1096 \fi
1097 % \end{macrocode}
1098 % \changes{v1.65}{2014/09/04}{Measure and store the initial’s
1099 % final dimensions.}
1100 % Compute the final values of |\LettrineWidth|, |\LettrineHeight|
1101 % and |\LettrineDepth|:
1102 % \begin{macrocode}
1103 \computeL@dimens
1104 % \end{macrocode}
1105 %
1106 % Start a new paragraph and compute in |\L@finalht| the height of
1107 % the top part of the dropped capital which finally raises above
1108 % the paragraph’s first baseline and in |\L@finaldp| the final
1109 % depth of the dropped capital.
1110 %
1111 % \changes{v0.9}{1998/02/23}{Calculations of length
1112 % \cs{L@first} changed. Do not `vskip’ small lengths ($<$0.2pt),
1113 % they are just rounding errors.}
1114 %
1115 % \changes{v1.8}{2015/02/06}{The 0.2pt limit for discarded
1116 % vskips is now customisable through \cs{DiscardVskip} and option
1117 % `novskip’.}
1118 %
1119 % The basis for |\L@raise| (and |\L@oversize|, see
1120 % |\LettrineFont|) is |\L@target@tht|.
1121 %
1122 % \begin{macrocode}
1123 \par
1124 \setlength{\L@finalht}{\LettrineHeight}%
1125 \setlength{\L@lraise}{\L@raise\L@target@tht}%
1126 \addtolength{\L@finalht}{\L@lraise}%
1127 \ifnum\value{L@lines}>\@ne
1128 \@tempcnta=\value{L@lines}%
1129 \advance\@tempcnta \m@ne
1130 \@tempdima=\@tempcnta\baselineskip
1131 \addtolength{\L@finalht}{-\@tempdima}%
1132 \setlength{\L@finaldp}{\@tempdima}%
1133 \addtolength{\L@finaldp}{-\L@lraise}%
1134 \addtolength{\L@finaldp}{\LettrineDepth}%
1135 \addtolength{\L@lraise}{-\@tempdima}%
1136 \fi
1137 % \end{macrocode}
1138 %
1139 % Print some informations about accuracy to the log file,
1140 % \begin{macrocode}
1141 \begingroup
1142 \def\IeC##1{##1}%
1143 \@tempdima=\L@oversize pt\relax
1144 \PackageInfo{lettrine.sty}%
1145 {Targeted height = \the\L@target@tht\MessageBreak
1146 (for loversize=0, accent excluded),\MessageBreak
1147 Lettrine height = \the\LettrineHeight\space (#2)%
1148 \ifdim\@tempdima>\z@\space loversize=\L@oversize\fi;%
1149 \MessageBreak reported}%
1150 \endgroup
1151 % \end{macrocode}
1152 %
1153 % When |\L@finalht| is larger than |\baselineskip - \L@novskip| and
1154 % the \lopt{grid} option is \lopt{true}, let’s skip an integer number
1155 % of |\baselineskip| (and smash the dropped cap, see below).
1156 % \begin{macrocode}
1157 \@tempdima=\L@finalht
1158 \advance\@tempdima \L@novskip
1159 \@tempdimb=\baselineskip
1160 \ifdim\@tempdima>\@tempdimb
1161 \ifL@grid
1162 \@tempcnta=\z@
1163 \loop\ifdim\@tempdima>\@tempdimb
1164 \advance\@tempcnta \@ne
1165 \advance\@tempdima -\@tempdimb
1166 \repeat
1167 \vskip\@tempcnta\baselineskip
1168 \fi
1169 \fi
1170 % \end{macrocode}
1171 %
1172 % \changes{v2.0}{2018/07/21}{Add informations about targeted
1173 % and actual height of the initial to the .log file.}
1174 %
1175 % \changes{v2.80}{2025/01/30}{Move the paragraph to next page if the
1176 % dropped cap doesn’t fit in the current one.}
1177 %
1178 % Compute the remaining vertical space left on the current page
1179 % using TeX lengths |\pagetotal| and |\pagegoal|; always warn if
1180 % the remaining space is less than the depth of the dropped cap’
1181 % depth |\L@finaldp|.
1182 % Move the whole paragraph to next page if \lopt{nextpage=true}
1183 % (default is false).
1184 % \begin{macrocode}
1185 \@tempdima=\pagegoal
1186 \advance\@tempdima by -\pagetotal
1187 \advance\@tempdima by -\baselineskip
1188 \ifdim\@tempdima < \L@finaldp
1189 \@tempdimb=\L@finaldp
1190 \advance\@tempdimb by -\@tempdima
1191 \PackageWarning{lettrine}{%
1192 *** ATTENTION REQUIRED ***\MessageBreak
1193 The dropped cap #2 doesn't fit on page \thepage.%
1194 \MessageBreak Missing vertical space: \the\@tempdimb.
1195 \MessageBreak
1196 \ifL@nextpage The whole paragraph will be moved to
1197 next page.\MessageBreak \fi
1198 Reported}%
1199 \ifL@nextpage \newpage \fi
1200 \fi
1201 % \end{macrocode}
1202 %
1203 % We (mis)use the length |\L@first| to compute the width of
1204 % the text eventually coming before the dropped capital. It is
1205 % reset later on to hold the first line’s length.
1206 % \begin{macrocode}
1207 \setlength{\L@Pindent}{\LettrineWidth}%
1208 \addtolength{\L@Pindent}{-\L@hang\LettrineWidth}%
1209 \settowidth{\L@first}{\L@ante}%
1210 \addtolength{\L@Pindent}{\L@first}%
1211 \addtolength{\L@Pindent}{\L@Findent}%
1212 \setlength{\L@first}{\linewidth}%
1213 \addtolength{\L@first}{-\L@Pindent}%
1214 % \end{macrocode}
1215 % Now let’s compute |\L@Nindent| and |\L@next| for the next lines.
1216 % \begin{macrocode}
1217 \addtolength{\L@Nindent}{\L@Pindent}%
1218 \setlength{\L@next}{\linewidth}%
1219 \addtolength{\L@next}{-\L@Nindent}%
1220 % \end{macrocode}
1221 %
1222 % \changes{v1.1}{1999/08/18}{Add \cs{rightmargin} to
1223 % \cs{L@Pindent} for \cs{Lettrine} to work properly in quote,
1224 % quotation, abstract environments… but do not change
1225 % \cs{linewidth} which is set by these environments.}
1226 %
1227 % \changes{v1.4}{2002/10/26}{\cs{lettrine} still didn’t
1228 % work properly in quote, quotation, abstract environments,
1229 % pointed out by Matthias C.\ Schmidt. \cs{rightmargin} was added
1230 % too early to \cs{L@Nindent}, thus making \cs{\L@next} too short
1231 % by \cs{rightmargin}.}
1232 %
1233 % \changes{v2.22}{2019/04/04}{\cs{@totalleftmargin} is the correct
1234 % indentation for quote, quotation and abstract environments.}
1235 %
1236 % This is for quotation, quote, abstract… environments:
1237 % |\linewidth| is set by these environments, all we have to do
1238 % is to shift our text left by |\@totalleftmargin|.
1239 % \begin{macrocode}
1240 \addtolength{\L@Pindent}{\@totalleftmargin}%
1241 \addtolength{\L@Nindent}{\@totalleftmargin}%
1242 % \end{macrocode}
1243 % Now, set up the shape of the new paragraph (designed by
1244 % |\parshape|). It obiously depends on the text direction,
1245 % the code previously available in \file{lettrine-xetex-bidi.def}
1246 % for right to left scripts is integrated here now.
1247 %
1248 % \changes{v1.9}{2015/08/31}{\cs{theL@depth} changed to
1249 % \cs{value\{L@depth\}}.}
1250 %
1251 % \changes{v2.60}{2024/01/20}{\cs{L@parshape} compatible with
1252 % xetex bidi RTL typesetting.}
1253 %
1254 % \begin{macrocode}
1255 \addtocounter{L@lines}{1}%
1256 \addtocounter{L@lines}{\value{L@depth}}%
1257 \ifL@RTL
1258 \def\L@parshape{\c@L@lines \z@ \the\L@first}%
1259 \else
1260 \def\L@parshape{\c@L@lines \the\L@Pindent \the\L@first}%
1261 \fi
1262 \@tempcnta=\tw@
1263 \@whilenum \@tempcnta<\c@L@lines\do{%
1264 \ifL@RTL
1265 \edef\L@parshape{\L@parshape \z@ \the\L@next}%
1266 \else
1267 \edef\L@parshape{\L@parshape \the\L@Nindent \the\L@next}%
1268 \fi
1269 \addtolength{\L@Nindent}{\L@slope}%
1270 \addtolength{\L@next}{-\L@slope}%
1271 \advance\@tempcnta\@ne}%
1272 \ifL@RTL
1273 \edef\L@parshape{\L@parshape \z@ \the\linewidth}%
1274 \else
1275 \edef\L@parshape{\L@parshape \@totalleftmargin \the\linewidth}%
1276 \fi
1277 % \end{macrocode}
1278 %
1279 % \changes{v2.83}{2025/12/06}{Remove unnecessary usage of \cs{L@tbox}
1280 % (safer for tagging).}
1281 %
1282 % \changes{v2.81}{2025/11/25}{Reset \cs{L@lbox} and \cs{L@tbox}
1283 % after starting the new paragraph as suggested by Ulrike Fischer
1284 % for tagging.}
1285 %
1286 % Set the |\L@lbox| box in horizontal mode for tagging, see
1287 % \url{https://github.com/latex3/tagging-project/issues/481}.
1288 % \begin{macrocode}
1289 \noindent
1290 \parshape=\L@parshape\relax
1291 \setupL@lbox
1292 % \end{macrocode}
1293 % \changes{v1.64}{2013/03/14}{Remove \$ around \cs{smash}
1294 % and add \cs{relax}. Bug pointed out by David Monniaux.
1295 % Correction by Enrico Gregorio.}
1296 %
1297 % \changes{v2.40}{2023/04/18}{Replace \cs{usebox} by \cs{unhcopy}
1298 % for box \cs{L@tbox} to allow footnote calls and microtype action.}
1299 %
1300 % \changes{v2.50}{2023/07/02}{Remove the top \cs{vskip}, smash the
1301 % dropped cap, add a \cs{rule} to mimic its height above the baseline
1302 % instead.}
1303 %
1304 % \changes{v2.61}{2024/06/26}{Include the `ante’ box into the \cs{smash}
1305 % command in case it is shifted down.}
1306 %
1307 % Write the dropped capital into the left margin, and wrap
1308 % the rest of paragraph around it.
1309 % \begin{macrocode}
1310 \llap{\smash{\mbox{\L@ante}\raisebox{\L@lraise}{\usebox{\L@lbox}}}%
1311 \ifL@grid\else\rule{\z@}{\L@finalht}\fi
1312 \hskip \the\L@Findent}%
1313 {\LettrineTextFont{#3}}%
1314 % \end{macrocode}
1315 %
1316 % \changes{v2.22}{2019/03/30}{\cs{parshape} reset added in lists.}
1317 %
1318 % A |\parshape| reset is required in abstract, quote and quotation
1319 % environments beginning with |\lettrine| and spreading over several
1320 % paragraphs. When the list ends, |\parshape| returns to~|0|.
1321 % \begin{macrocode}
1322 \ifnum\@listdepth>0 \Lreset@listparshape \fi
1323 }
1324 % \end{macrocode}
1325 % \end{macro}
1326 % This ends the definition of |\lettrine|; |\Lreset@listparshape|
1327 % adds the parshape reset to the first occurence of |\everypar|
1328 % following the |\lettrine| command.
1329 % \begin{macrocode}
1330 \newtoks\Llist@everypar
1331 \def\Lreset@listparshape{%
1332 \let\Lnew@everypar\everypar
1333 \Llist@everypar=\expandafter{\the\everypar}%
1334 \Lnew@everypar={\the\Llist@everypar
1335 \parshape=\@ne \@totalleftmargin \linewidth \relax
1336 \let\everypar\Llist@everypar
1337 }%
1338 }
1339 % \end{macrocode}
1340 % Compatibility with the \pkg{bidi} package (loaded \emph{after}
1341 % \pkg{lettrine}).
1342 % \begin{macrocode}
1343 \AtBeginDocument{%
1344 \IfPackageLoadedTF{bidi}{\eqnewif{\ifL@RTL}{\if@RTL}}{}%
1345 }
1346 % \end{macrocode}
1347 %
1348 % \iffalse
1349 %</sty>
1350 % \fi
1351 % \clearpage
1352 % \section{Configuration file}
1353 %
1354 % \iffalse
1355 %<*cfg>
1356 % \fi
1357 % \begin{macrocode}
1358 %% lettrine.cfg: configuration file for lettrine.sty
1359 %%
1360 %% If you want to customize lettrine, please *do not* hack into the
1361 %% code, copy this file to your working directory and customize the
1362 %% copy as you like.
1363 %%
1364 %% Uncomment any of these lines and change the parameters’ values
1365 %% to fit your needs (see lettrine.dtx).
1366 %%
1367 %%\setcounter{DefaultLines}{2}
1368 %%\setcounter{DefaultDepth}{0}
1369 %%
1370 %% These are *decimal* numbers:
1371 %%\renewcommand{\DefaultLoversize}{0}
1372 %%\renewcommand{\DefaultLraise}{0}
1373 %%\renewcommand{\DefaultLhang}{0}
1374 %%
1375 %% These are *lengths* (don't forget the unit):
1376 %%\setlength{\DefaultFindent}{0pt}
1377 %%\setlength{\DefaultNindent}{0.5em}
1378 %%\setlength{\DefaultSlope}{0mm}
1379 %%\setlength{\DiscardVskip}{1pt}
1380 %%
1381 %% Theses are *flags* (value=true/false):
1382 %%\LettrineImagefalse
1383 %%\LettrineOnGridfalse
1384 %%\LettrineRealHeightfalse
1385 %%\LettrineMoveAtEOPfalse
1386 %%
1387 %% This is a *command*, define it as \relax if you dont want the second
1388 %% mandatory argument of \lettrine[]{}{} to be typset in small caps.
1389 %%\renewcommand*{\LettrineTextFont}{\scshape}|
1390 %%
1391 %% Theses are *commands* (value=string, only height matters):
1392 %%\renewcommand{\LettrineTestString}{EFTZ}
1393 %%\renewcommand{\LettrineSecondString}{x}
1394 %%
1395 %% In case you want to set parameters for some letters
1396 %% in file `optfile.cfl'
1397 %%\renewcommand{\DefaultOptionsFile}{optfile.cfl}
1398 % \end{macrocode}
1399 % \iffalse
1400 %</cfg>
1401 % \fi
1402 %
1403 % \Finale
1404 \endinput
1405
1406 %%% Local Variables:
1407 %%% fill-column: 72
1408 %%% coding: utf-8
1409 %%% TeX-engine: luatex
1410 %%% End: