diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/lettrine/lettrine.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/lettrine/lettrine.dtx | 384 |
1 files changed, 221 insertions, 163 deletions
diff --git a/Master/texmf-dist/source/latex/lettrine/lettrine.dtx b/Master/texmf-dist/source/latex/lettrine/lettrine.dtx index 46391279324..13b9b7990e0 100644 --- a/Master/texmf-dist/source/latex/lettrine/lettrine.dtx +++ b/Master/texmf-dist/source/latex/lettrine/lettrine.dtx @@ -1,9 +1,9 @@ % -% \CheckSum{567} +% \CheckSum{596} % % \iffalse meta-comment % -% Copyright (C) 1999-2015 Daniel Flipo. +% Copyright © 1999-2018 Daniel Flipo. % % This program can be distributed and/or modified under the terms % of the LaTeX Project Public License either version 1.3c of this @@ -15,9 +15,6 @@ % % This file has the LPPL maintenance status "maintained". % -% NO PERMISSION is granted to produce or to distribute a -% modified version of this file under its original name. -% % \fi % % \iffalse @@ -30,37 +27,46 @@ \ProvidesFile{lettrine.dtx} %</dtx> %<*!cfg> - [2015/08/31 v1.9 (Daniel Flipo)] + [2018/07/21 v2.0 (Daniel Flipo)] %</!cfg> % % Lettrine package for LaTeX version 2e % -% Copyright (C) 1999-2015 by Daniel Flipo +% Copyright © 1999-2018 by Daniel Flipo % % Please report errors to: daniel.flipo at free.fr % %<*driver> \documentclass[a4paper]{ltxdoc} -\usepackage[utf8]{inputenc} +\usepackage{unicode-math} +\setmainfont{Latin Modern Roman} +\setmathfont{XITS Math} +\usepackage[expansion=true,protrusion=true]{microtype} +\usepackage{url} +\usepackage[numbered]{hypdoc} +\hypersetup{colorlinks,urlcolor=blue,unicode} \usepackage{lettrine} -\GetFileInfo{lettrine.dtx} -\RecordChanges -%\OnlyDescription % -\newenvironment{key}[2]{\expandafter\macro\expandafter{% - \csname KV@#1@#2\endcsname}}{\endmacro} +\RecordChanges +\AtEndDocument{% + \section{Change History}% + \GlossaryPrologue{}% + Changes are listed in reverse order (latest first) from version~1.0 + \PrintChanges +} % \newcommand*\file[1]{\texttt{#1}} +\renewcommand\meta[1]{\textit{<#1>}} % no math mode (see doc.sty) % -\newcommand{\at}{@} \setlength{\parindent}{0pt} \setlength{\parskip}{.3\baselineskip} \begin{document} +\GetFileInfo{lettrine.dtx} \begin{center} - \textbf{\Large Typesetting `lettrines' in \LaTeXe{} documents} + \textbf{\Large Typesetting dropped capitals in \LaTeXe{} documents} \\[.2\baselineskip]^^A\] - {\large Daniel \textsc{Flipo}}\\ - \texttt{daniel.flipo\at free.fr} + {\large Daniel Flipo}\\ + \texttt{daniel.flipo@free.fr} \end{center} \DocInput{lettrine.dtx} \end{document} @@ -77,9 +83,9 @@ % % Adding |\usepackage{lettrine}| in the preamble of a document % defines the command |\lettrine|, the simplest use of which is -% |\lettrine{|\emph{$<$letter$>$}|}{|\emph{$<$text$>$}|}|. -% It produces a dropped capital \emph{$<$letter$>$} (2 lines high), -% followed by \emph{$<$text$>$} typeset in small caps, and the rest +% |\lettrine{|\meta{letter}|}{|\meta{text}|}|. +% It produces a dropped capital \meta{letter} (2 lines high), +% followed by \meta{text} typeset in small caps, and the rest % of the paragraph is wrapped around the dropped capital. % % Various parameters are provided to control the size and layout @@ -89,53 +95,52 @@ % \item ``Lexique des règles typographiques en usage à % l'Imprimerie nationale'' troisième édition (1994), % ISBN-2-11-081075-0, -% \item ``Mise en page et impression'' Yves~\textsc{Perrousseaux}, +% \item ``Mise en page et impression'' Yves~Perrousseaux, % ISBN-2-911220-01-3. % \end{itemize} % The parameters can be set using David Carlisle's % \texttt{keyval.sty} syntax: % \begin{itemize} -% \item |lines=|\emph{$<$integer$>$} sets how many lines the +% \item |lines=|\meta{integer} sets how many lines the % dropped capital will occupy (default=2); % -% \changes{lettrine-1.7}{2014/09/16}{New counter to add lines for +% \changes{v1.7}{2014/09/16}{New counter to add lines for % dropped capitals with positive depth, like Q.} % -% \item |depth=|\emph{$<$integer$>$} sets the number of lines to +% \item |depth=|\meta{integer} sets the number of lines to % be reserved under the baseline, this is meant for dropped % capital with positive depth, like Q (default=0); -% \item |lhang=|\emph{$<$decimal$>$} ($0\le|lhang|\le1$) sets +% \item |lhang=|\meta{decimal} ($0\le|lhang|\le1$) sets % how much of the dropped capital's width should hang into % the margin (default=0); -% \item |loversize=|\emph{$<$decimal$>$} ($-1<|loversize|\le1$) +% \item |loversize=|\meta{decimal} ($-1<|loversize|\le1$) % enlarges the dropped capital's height: with % |loversize=0.1| its height is enlarged by 10\% so that % it raises above the top paragraph's line (default=0); -% \item |lraise=|\emph{$<$decimal$>$} does not affect the dropped +% \item |lraise=|\meta{decimal} does not affect the dropped % capital's height, but moves it up (if positive), % down (if negative); useful with capitals like |J| or |Q| % which have a positive depth, (default=0); -% \item |findent=|\emph{$<$dimen$>$} (positive or negative) +% \item |findent=|\meta{dimen} (positive or negative) % controls the horizontal gap between the dropped capital % and the indented block of text (default=0pt); -% \item |nindent=|\emph{$<$dimen$>$} shifts all indented lines, +% \item |nindent=|\meta{dimen} shifts all indented lines, % starting from the second one, horizontally by -% \emph{$<$dimen$>$} (this shift is relative to the first +% \meta{dimen} (this shift is relative to the first % line, default=0.5em); -% \item |slope=|\emph{$<$dimen$>$} can be used with dropped -% capitals like |A| or |V| to add \emph{$<$dimen$>$} +% \item |slope=|\meta{dimen} can be used with dropped +% capitals like |A| or |V| to add \meta{dimen} % (positive or negative) to the indentation of each line % starting from the third one (no effect if |lines=2|, % default=0pt); -% \item |ante=|\emph{$<$text$>$} can be used to typeset -% \emph{$<$text$>$} \emph{before} the dropped capital -% (typical use is for French guillemets starting -% the paragraph). +% \item |ante=|\meta{text} can be used to typeset \meta{text} +% \emph{before} the dropped capital (typical use is for +% French guillemets starting the paragraph). % -% \changes{lettrine-1.6}{2004/05/22}{Add a flag to switch to +% \changes{v1.6}{2004/05/22}{Add a flag to switch to % images in eps or pdf format. Suggested by Bill Jetzer.} % -% \item |image=|\emph{$<$true$>$} (new to version 1.6) will force +% \item |image=|\meta{true} (new to version 1.6) will force % |\lettrine| to replace the letter normally used as % dropped capital by an image in eps format (latex) or % in pdf, jpg, etc.\ format (pdflatex); this needs the @@ -147,15 +152,15 @@ % \verb+\LettrineFontEPS+ still works for compatibility % but is deprecated. % -% \changes{lettrine-1.8}{2015/02/06}{Added two keyval options: +% \changes{v1.8}{2015/02/06}{Added two keyval options: % `grid' (true/false) and `novskip' to override \cs{DiscardVskip}.} % -% \item |grid=|\emph{$<$true$>$} (new to version 1.8) will force +% \item |grid=|\meta{true} (new to version 1.8) will force % the vertical skip added above the paragraph starting with % |\lettrine| to be rounded up to an integer number of % |\baselineskip|. % This option is meant for grid typesetting. -% \item |novskip=|\emph{$<$dimen$>$} (new to version 1.8) +% \item |novskip=|\meta{dimen} (new to version 1.8) % overrides |\DiscardVskip| (default=0.2pt). In some cases % (see options |lraise|, |loversize| or accentuated dropped % capitals,\dots) the top of the dropped capital will raise @@ -167,11 +172,11 @@ % prevent small vertical skips from being rounded up to % |\baselineskip| when using the `grid' option. % -% \changes{lettrine-1.9}{2015/08/31}{New keyval option: `realheight' +% \changes{v1.9}{2015/08/31}{New keyval option: `realheight' % (true/false) and new global flag \cs{ifLettrineRealHeight}.} % -% \item |realheight=|\emph{$<$true$>$} (new to version 1.9) will -% compute the default height of the lettrine so that the +% \item |realheight=|\meta{true} (new to version 1.9) will +% compute the default height of the initial so that the % top of it is exactly aligned with the top of the text % entered as second mandatory argument of |\lettrine| % taking possible accents into account. @@ -188,13 +193,13 @@ % these two examples: % \begin{description} % \item |\lettrine{H}{ello}| you probably would like the -% top of the `L' to be aligned with the top of the `ll' +% top of the `H' to be aligned with the top of the `ll' % rather than with the top of the `e', adding option % |realheight| does the trick: % |\lettrine[realheight]{H}{ello}|.\par % Global variants : |\LettrineRealHeighttrue| or (without -% the |realheight| option) -% |\renewcommand{\LettrineSecondString}{l}|. +% |realheight| option) +% |\renewcommand*{\LettrineSecondString}{l}|. % \item |\lettrine{L}{a misère}| option |realheight=true| % would align with the top of the `L' with the top of the % grave accent, the default is probably better (top of @@ -209,22 +214,22 @@ % \mbox{}\phantom{\tt Example: lettrine}% % |{V}{oici} un exemple |\dots % -% Coloured lettrines are possible in conjonction with package +% Coloured initials are possible in conjonction with package % \file{color}, examples: |\lettrine{\textcolor{red}{A}}{n} example| % \quad or\\ |\lettrine{\textcolor[gray]{0.5}{A}}{nother} one| \\ % see package \file{color} for the syntax of colour commands. -% Another possibility to colour lettrines globally is described +% Another possibility to colour initials globally is described % below, see |\LettrineFontHook|. % % Three dimensions, |\LettrineWidth|, |\LettrineHeight| and -% |\LettrineDepth|, store the final size of the lettrine. +% |\LettrineDepth|, store the final size of the initial. % % Once \file{lettrine.sty} will be installed (run \texttt{latex} % on \file{lettrine.ins} to extract it), compile and print % \file{demo.tex} to see the possible usage of these parameters. % -% \changes{lettrine-1.9}{2015/08/31}{New customisable string -% \cs{LettrineSecondString} to tune the lettrine's height.} +% \changes{v1.9}{2015/08/31}{New customisable string +% \cs{LettrineSecondString} to tune the initial's height.} % % The default settings can be customized either in a config file % \file{lettrine.cfg} (for a global usage), or on a per document @@ -268,7 +273,7 @@ % usually the current font in a (large) size, computed % automatically from the number of lines it will fill: % the font size is computed so that, a \emph{standard} dropped -% capital (say X, not À) when sitting on its baseline, gets +% capital (say Z, not À) when sitting on its baseline, gets % its top aligned with the top of the following text (provided % $|loversize|=0$ and $|lines|\ge 2$). When $|lines|=1$, % size is computed as if |lines| was~2.\\ @@ -283,9 +288,9 @@ % |\LettrineFontHook| can also be used to change the colour of % all lettrines in a (part of) document: % |\renewcommand{\LettrineFontHook}{\color[gray]{0.5}}| \\ -% will colour the lettrines following this command in grey. +% will colour the initials following this command in grey. % -% \changes{lettrine-1.3}{2002/08/23}{Correct the documentation to +% \changes{v1.3}{2002/08/23}{Correct the documentation to % mention the cm-super fonts and the type1ec package by % Vladimir Volovich.} % @@ -323,7 +328,7 @@ % fully scalable too! % % \vspace{\baselineskip} -% \textbf{Known problems:} +% \textbf{Known issues:} % \begin{itemize} % \item nothing is done to prevent page-breaking in a paragraph % starting with a dropped capital; when it happens to hang @@ -333,17 +338,27 @@ % (except with option \texttt{[lines=1]}); % \item |\lettrine| does not work within lists; % \item if a \emph{list} has to be included in a paragraph starting -% with a `lettrine', it is necessary to add the command +% with |\lettrine|, it is necessary to add the command % |\parshape=0| just after the end of the list (starting a new % paragraph just before or just after the list works too). % Remember that `quote', `quotation', `abstract' environments % are implemented as \emph{lists} in \LaTeX{}. +% \item if you are facing some slight height inaccuracy for a +% dropped capital, you can try changing |\LettrineTestString|:\\ +% |\renewcommand*{\LettrineTestString}{|\meta{letter}|}|\\ +% where \meta{letter} is the used dropped capital \emph{without +% accent}. Informations about targeted and effective initial’s +% height are available in the \file{.log} file. Using LuaTeX +% or XeTeX engines with OpenType fonts may be an option +% (some TFM files for Type1 fonts are slightly inaccurate). +% \item |\LettrineTestString|’s value has changed over the time; +% to achieve strict backward compatibility with previous versions, +% please look at the end of \file{lettrine.cfg}. % \end{itemize} % -% \StopEventually{\PrintChanges} +% \StopEventually{} % -% \pagebreak[3] -% \section{\TeX{}nical details} +% \section{\TeX{}nical details} % % This package only runs with \LaTeXe{} and requires keyval.sty % \iffalse @@ -359,13 +374,13 @@ % and commands to hold the default settings and set these default % settings. They can be overwritten in file |lettrine.cfg|. % -% \changes{lettrine-1.2}{2002/03/13}{\cs{newlength} changed to +% \changes{v1.2}{2002/03/13}{\cs{newlength} changed to % \cs{newdimen}, to correct a bug with seminar.cls (pointed out % by Peter Münster).} % -% \changes{lettrine-1.6}{2004/05/22}{Added newif \cs{ifLettrineImage}.} +% \changes{v1.6}{2004/05/22}{Added newif \cs{ifLettrineImage}.} % -% \changes{lettrine-1.8}{2015/02/06}{Added newif \cs{ifLettrineOnGrid} +% \changes{v1.8}{2015/02/06}{Added newif \cs{ifLettrineOnGrid} % and new dimen \cs{DiscardVskip}, default (0.2pt) set for % compatibility with previous releases.} % @@ -393,9 +408,9 @@ % Then let's define the necessary internal counters, lengths, % and commands. % -% \changes{lettrine-1.6}{2004/05/22}{Added newif \cs{ifL@image}.} +% \changes{v1.6}{2004/05/22}{Added newif \cs{ifL@image}.} % -% \changes{lettrine-1.6}{2015/02/06}{Added newif \cs{ifL@grid}.} +% \changes{v1.6}{2015/02/06}{Added newif \cs{ifL@grid}.} % % \begin{macrocode} \newsavebox{\L@lbox} @@ -411,6 +426,12 @@ \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 \newcommand*{\L@file}{} \newcommand*{\L@hang}{} \newcommand*{\L@oversize}{} @@ -440,76 +461,107 @@ % If |lines=1|, the default size for the dropped capital is % computed as if |lines=2|. % -% |\Lettrine@height| computes the wished height for the dropped -% capital and stores it into |\L@height|. |\L@height| depends only -% on |L@lines|, |\L@oversize| and, in case option |realheight=true| -% on the height of |\L@tbox|. So options \emph{must} be read and -% |\L@tbox| must be properly initialised \emph{before} executing -% |\Lettrine@height| (see below in |\@lettrine| code). A default -% initialisation of |\L@tbox| is provided just in case +% |\Lettrine@height| computes the targeted height for the dropped +% capital and stores it into |\L@target@tht| which depends only +% on |L@lines| and on the height of |\L@tbox|. So options +% \emph{must} be read and |\L@tbox| must be properly initialised +% \emph{before} executing |\Lettrine@height| (see below in +% |\@lettrine| code). +% A default initialisation of |\L@tbox| is provided just in case % |\LettrineFont| would be used outside |\lettrine|. % -% As |\baselineskip| might be a rubber length, we convert it into -% a `dimen' using |\@tempdima|. -% |\LettrineFontHook| enables to select another font for the -% dropped capital. Its default definition is empty (the current -% text font is used). +% |\L@height| is set to |\L@target@tht| raised by the |\L@oversize| +% factor. % -% \changes{lettrine-0.9}{1998/02/23}{Size of the dropped capital +% \changes{v0.9}{1998/02/23}{Size of the dropped capital % changed when `lines' value is 1 (was \cs{Huge}).} -% \changes{lettrine-0.9}{1998/03/13}{\cs{Lettrine@height} added.} -% \changes{lettrine-0.9}{1998/03/13}{\cs{LettrineFontHook} added.} -% \changes{lettrine-1.2}{2002/03/13}{\cs{baselineskip} may be a +% \changes{v0.9}{1998/03/13}{\cs{Lettrine@height} added.} +% \changes{v0.9}{1998/03/13}{\cs{LettrineFontHook} added.} +% \changes{v1.2}{2002/03/13}{\cs{baselineskip} may be a % rubber length, we convert it to a dimen.} % -% \changes{lettrine-1.63}{2012/07/20}{Added command +% \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{lettrine-1.9}{2015/08/31}{\cs{theL@lines} changed +% \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.} +% % \begin{macrocode} \def\Lettrine@height{% - \@tempdima=\baselineskip - \setlength{\L@height}{\value{L@lines}\@tempdima}% - \ifnum\value{L@lines}>1 - \addtolength{\L@height}{-\@tempdima}% - \fi \ifvoid\L@tbox \sbox{\L@tbox}{\LettrineTextFont{\LettrineSecondString}}% \fi - \addtolength{\L@height}{\ht\L@tbox}% - \addtolength{\L@height}{\L@oversize\L@height}% + \global\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 + \global\setlength{\L@target@dp}{\value{L@lines}\@tempdima}% + \ifnum\value{L@lines}>1 + \global\addtolength{\L@target@dp}{-\@tempdima}% + \else + \global\addtolength{\L@target@ht}{\L@target@dp}% + \global\setlength{\L@target@dp}{0pt}% + \fi + \global\setlength{\L@target@tht}{\L@target@ht}% + \global\addtolength{\L@target@tht}{\L@target@dp}% + \setlength{\L@height}{\L@target@tht}% + \addtolength{\L@height}{\L@oversize\L@target@tht}% } +% \end{macrocode} +% +% |\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}{} -\newcommand*{\LettrineTestString}{ABCDEFGHIJKLMNOQPRSTUVWXYZ} +\newcommand*{\LettrineTestString}{EFTZ} \newcommand*{\LettrineSecondString}{x} \newcommand*{\LettrineFont}{% \Lettrine@height % \end{macrocode} % |\L@height| now holds the exact height required for the dropped -% capital, setting |\fontsize| to that height would not give the -% expected result (capital too small), some computing has to be -% done: we measure the maximal capitals' height and compute a -% scaling factor (always $\ge1$). All capitals are expected to -% have the same height, in case this assumption would be wrong for -% some special font, |\LettrineTestString| can be customised to any -% non empty subset of capitals. +% capital, let’s compute the matching |\fontsize|’s value: +% we divide |\L@height| (converted into sp) by the ``standard’’ +% capitals’ height (see the list in |\LettrineTestString|) to get +% a scaling factor (always $\ge1$). +% All capitals in |\LettrineTestString| are expected to have the +% same height, in case this assumption would be wrong for some +% special font, |\LettrineTestString| can be customised to any +% non empty subset of capitals, the maximal height of these +% capitals will be taken into account. +% Mind that some fonts 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|. % \begin{macrocode} \sbox{\@tempboxa}{\LettrineFontHook\fontsize{\L@height}{\L@height}% \selectfont \LettrineTestString}% % \end{macrocode} % Arithmetic calculations convert the dimensions into integers % (in sp) and compute a (4 decimal accurate) scaling factor. +% +% \changes{v2.0}{2018/07/21}{Change factors 100/100 to 50/200 +% to reach larger sizes (height up to 600pt).} +% % \begin{macrocode} \@tempcntb=\ht\@tempboxa \@tempcnta=\L@height - \multiply\@tempcnta by 100 - \divide\@tempcntb by 100 + \multiply\@tempcnta by 50 + \divide\@tempcntb by 200 \divide\@tempcnta by \@tempcntb \advance\@tempcnta by -9999 \ifnum\@tempcnta>0 @@ -525,7 +577,7 @@ % \end{macro} % \end{macro} % -% \changes{lettrine-0.9}{1998/03/13}{\cs{LettrineFontEPS} added.} +% \changes{v0.9}{1998/03/13}{\cs{LettrineFontEPS} added.} % % \begin{macro}{\LettrineFontEPS} % The following definition is for use with dropped capitals defined @@ -535,7 +587,7 @@ % computed just as in the standard case, |\includegraphics| % prints the EPS file at this size. % -% \changes{lettrine-1.6}{2004/05/22}{Added \cs{LettrineFontHook} +% \changes{v1.6}{2004/05/22}{Added \cs{LettrineFontHook} % to \cs{LettrineFontEPS}. This is needed for color options.} % % \begin{macrocode} @@ -564,7 +616,7 @@ \define@key{L}{novskip}{\setlength{\L@novskip}{#1}} % \end{macrocode} % -% \changes{lettrine-1.5}{2003/08/18}{\cs{LettrineOptionsFor} and +% \changes{v1.5}{2003/08/18}{\cs{LettrineOptionsFor} and % \cs{LettrineWidth} added.} % % \begin{macro}{\LettrineOptionsFor} @@ -578,9 +630,6 @@ % % \begin{macrocode} \newcommand*{\LettrineOptionsFor}[2]{\@namedef{l@#1-keys}{#2}} -\newdimen\LettrineWidth -\newdimen\LettrineHeight -\newdimen\LettrineDepth % \end{macrocode} % \end{macro} % @@ -592,9 +641,9 @@ \def\@lettrine[#1]#2#3{% % \end{macrocode} % -% \changes{lettrine-0.81}{1997/02/26}{\cs{DefaultLoversize} added.} +% \changes{v0.81}{1997/02/26}{\cs{DefaultLoversize} added.} % -% \changes{lettrine-1.9}{2015/08/31}{\cs{theDefaultLines} changed to +% \changes{v1.9}{2015/08/31}{\cs{theDefaultLines} changed to % \cs{value\{DefaultLines\}}, same with \cs{theDefaultDepth}. % Needed for babel-hebrew which redefines \cs{@arabic}. % Thanks to Ulrike Fischer for providing the fix.} @@ -616,14 +665,14 @@ \ifLettrineRealHeight\L@realhtrue\else\L@realhfalse\fi % \end{macrocode} % -% |\LettrineFont| and |\LettrineFontEPS| both call +% |\LettrineFont| and |\LettrineFontEPS| both execute % |\Lettrine@height| to set |\L@height| which depends on % |\L@tbox|. The content of |\L@tbox| depends on option -% |realheight|, so we have to read the lettrine's options +% |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{lettrine-1.9}{2015/08/31}{Use the second mandatory +% \changes{v1.9}{2015/08/31}{Use the second mandatory % argument of \cs{lettrine} or \cs{LettrineSecondString} (which % defaults to `x') to compute \cs{L@height}. This is controlled by % the `realheight' flag.} @@ -642,12 +691,12 @@ \fi \fi % \end{macrocode} -% \changes{lettrine-1.5}{2003/08/18}{Added reading of an optional +% \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@LOKeys| which will expand to the list of -% options given by |\LettrineOptionsFor| for the current lettrine +% options given by |\LettrineOptionsFor| for the current initial % (defined by |#2|)\dots % \begin{macrocode} \if\DefaultOptionsFile\relax @@ -685,7 +734,7 @@ \expandafter\KV@do\l@LOKeys,\relax, % \end{macrocode} % As some parameters' values |findent|, |nindent| and |slope| -% ---which do not influence the lettrine size--- may be given +% ---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. % \begin{macrocode} @@ -712,10 +761,36 @@ \sbox{\L@lbox}{\LettrineFont #2}% \fi % \end{macrocode} -% Height calculations done, let's reset |\L@tbox|'s content -% (mandatory in case |realheight=false|): % -% \changes{lettrine-1.6}{2004/05/22}{Add braces around \#3 to allow +% \changes{v1.65}{2014/09/04}{Measure and store the initial's +% final dimensions.} +% Store the initial’s final dimensions, +% \begin{macrocode} + \setlength{\LettrineWidth}{\wd\L@lbox}% + \setlength{\LettrineHeight}{\ht\L@lbox}% + \setlength{\LettrineDepth}{\dp\L@lbox}% +% \end{macrocode} +% +% \changes{v2.0}{2018/07/21}{Add informations about targeted +% and actual height of the initial to the .log file.} +% +% print some informations about accuracy to the log file, +% \begin{macrocode} + \begingroup + \def\IeC##1{##1}% + \@tempdima=\L@oversize pt\relax + \PackageInfo{lettrine.sty}% + {Targeted height = \the\L@target@tht\MessageBreak + (no accent, loversize=0),\MessageBreak + Lettrine height = \the\LettrineHeight\space (#2)% + \ifdim\@tempdima=\z@\else\space loversize=\L@oversize\fi;% + \MessageBreak reported}% + \endgroup +% \end{macrocode} +% and reset |\L@tbox|'s content (mandatory in case +% |realheight=false|): +% +% \changes{v1.6}{2004/05/22}{Add braces around \#3 to allow % commands taking an argument (such as \cs{MakeLowercase}) in % \cs{LettrineTextFont}. Suggested by Philipp Lehman.} % @@ -724,44 +799,32 @@ % \end{macrocode} % % Start a new paragraph, skipping the necessary amount of space -% if the dropped capital sticks out the top of paragraph. +% if the dropped capital sticks out of the top of paragraph. % We use |\L@first| to compute the amount of space to be skipped. -% Again, as |\baselineskip| might be a rubber length, we convert -% it into a `dimen' using |\@tempdima|. % -% \changes{lettrine-0.9}{1998/02/23}{Calculations of length +% \changes{v0.9}{1998/02/23}{Calculations of length % \cs{L@first} changed. Do not `vskip' small lengths ($<$0.2pt), % they are just rounding errors.} % -% \changes{lettrine-1.8}{2015/02/06}{The 0.2pt limit for discarded +% \changes{v1.8}{2015/02/06}{The 0.2pt limit for discarded % vskips is now customisable through \cs{DiscardVskip} and option % `novskip'.} % -% \changes{lettrine-1.2}{2002/03/13}{\cs{baselineskip} may be a +% \changes{v1.2}{2002/03/13}{\cs{baselineskip} may be a % rubber length, we convert it to a dimen.} % +% The basis for |\L@raise| (and |\L@oversize|, see +% |\LettrineFont|) is |\L@target@tht|. +% % \begin{macrocode} - \@tempdima=\baselineskip + \setlength{\L@first}{\LettrineHeight}% + \setlength{\L@lraise}{\L@raise\L@target@tht}% + \addtolength{\L@first}{\L@lraise}% \ifnum\value{L@lines}=1 - \setlength{\L@first}{\ht\L@lbox}% \addtolength{\L@first}{-\ht\L@tbox}% - \setlength{\L@lraise}{\z@}% \else - \setlength{\L@first}{-\value{L@lines}\@tempdima}% - \addtolength{\L@first}{\@tempdima}% - \sbox{\@tempboxa}{\LettrineTextFont x}% - \addtolength{\L@first}{-\ht\@tempboxa}% -% \end{macrocode} -% Now, |\L@first| holds (the opposite of) the raw height of a -% standard dropped capital (like~'X'), excluding the effect of -% |\L@oversize|. This is the basis for |\L@raise| -% (and |\L@oversize|, see |\LettrineFont|). -% \begin{macrocode} - \setlength{\L@lraise}{-\L@raise\L@first}% - \addtolength{\L@first}{\L@lraise}% - \addtolength{\L@first}{\ht\L@lbox}% - \addtolength{\L@lraise}{-\value{L@lines}\@tempdima}% - \addtolength{\L@lraise}{\@tempdima}% + \addtolength{\L@first}{-\L@target@tht}% + \addtolength{\L@lraise}{-\L@target@dp}% \fi \par % \end{macrocode} @@ -782,10 +845,9 @@ \advance\@tempcnta by 1 \advance\L@first by -\@tempdima \repeat - \vskip\@tempcnta\baselineskip - \else - \vskip\L@first + \L@first=\@tempcnta\baselineskip \fi + \vskip\L@first \fi % \end{macrocode} % Again, we (mis)use the length |\L@first| to compute the width of @@ -807,12 +869,12 @@ \addtolength{\L@next}{-\L@Nindent}% % \end{macrocode} % -% \changes{lettrine-1.1}{1999/08/18}{Add \cs{rightmargin} to +% \changes{v1.1}{1999/08/18}{Add \cs{rightmargin} to % \cs{L@Pindent} for \cs{Lettrine} to work properly in quote, % quotation, abstract environments\dots{} but do not change % \cs{linewidth} which is set by these environments.} % -% \changes{lettrine-1.4}{2002/10/26}{\cs{lettrine} still didn't +% \changes{v1.4}{2002/10/26}{\cs{lettrine} still didn't % work properly in quote, quotation, abstract environments, % pointed out by Matthias C.\ Schmidt. \cs{rightmargin} was added % too early to \cs{L@Nindent}, thus making \cs{\L@next} too short @@ -826,18 +888,10 @@ \addtolength{\L@Pindent}{\rightmargin}% \addtolength{\L@Nindent}{\rightmargin}% % \end{macrocode} -% \changes{lettrine-1.65}{2014/09/04}{Measure and store the lettrine's -% final dimensions.} -% Store the lettrine's final dimensions: -% \begin{macrocode} - \setlength{\LettrineWidth}{\wd\L@lbox}% - \setlength{\LettrineHeight}{\ht\L@lbox}% - \setlength{\LettrineDepth}{\dp\L@lbox}% -% \end{macrocode} % Now, set up the shape of the new paragraph (designed by % |\parshape|). % -% \changes{lettrine-1.9}{2015/08/31}{\cs{theL@depth} changed to +% \changes{v1.9}{2015/08/31}{\cs{theL@depth} changed to % \cs{value\{L@depth\}}.} % % \begin{macrocode} @@ -854,7 +908,7 @@ \noindent \parshape=\L@parshape\relax % \end{macrocode} -% \changes{lettrine-1.64}{2013/03/14}{Remove \$ around \cs{smash} +% \changes{v1.64}{2013/03/14}{Remove \$ around \cs{smash} % and add \cs{relax}. Bug pointed out by David Monniaux. % Correction by Enrico Gregorio.} % Write the dropped capital into the left margin, and wrap @@ -887,11 +941,11 @@ %% lettrine.cfg: configuration file for lettrine.sty %% %% If you want to customize lettrine, please *do not* hack into the -%% code, copy this file to the directory where lettrine.sty lies -%% and customize it as you like. +%% code, copy this file to your working directory and customize the +%% copy as you like. %% -%% Uncomment these lines and change the parameters' values to fit -%% your needs (see lettrine.dtx). +%% Uncomment any of these lines and change the parameters' values +%% to fit your needs (see lettrine.dtx). %% %%\setcounter{DefaultLines}{2} %%\setcounter{DefaultDepth}{0} @@ -912,13 +966,17 @@ %%\LettrineOnGridfalse %%\LettrineRealHeightfalse %% -%% Theses are *commands* (value=string, only its height matters): -%%\renewcommand*{\LettrineTestString}{ABCDEFGHIJKLMNOQPRSTUVWXYZ} +%% Theses are *commands* (value=string, only height matters): +%%\renewcommand*{\LettrineTestString}{EFTZ} %%\renewcommand*{\LettrineSecondString}{x} +%% For backward compatibility with versions 1.63 to 1.9: +%%\renewcommand*{\LettrineTestString}{ABCDEFGHIJKLMNOQPRSTUVWXYZ} +%% For backward compatibility with versions up to 1.62: +%%\renewcommand*{\LettrineTestString}{X} %% %% In case you want to set parameters for some letters %% in file `optfile.cfl' -%%\renewcommand{\DefaultOptionsFile}{optfile.cfl} +%% \renewcommand{\DefaultOptionsFile}{optfile.cfl} % \end{macrocode} % \iffalse %</cfg> |