diff options
author | Karl Berry <karl@freefriends.org> | 2023-07-03 20:12:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-07-03 20:12:32 +0000 |
commit | 45681614ba25135d55252830ace1dcfee1e87068 (patch) | |
tree | 6ad43879408ecdfe1330003b4f2c0d68584fbbd5 /Master/texmf-dist/source | |
parent | d3c5a4dd86e9d62ac12751e4c4f87de5a584c34f (diff) |
lettrine (3jul23)
git-svn-id: svn://tug.org/texlive/trunk@67537 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/lettrine/lettrine.dtx | 137 |
1 files changed, 82 insertions, 55 deletions
diff --git a/Master/texmf-dist/source/latex/lettrine/lettrine.dtx b/Master/texmf-dist/source/latex/lettrine/lettrine.dtx index be96ffe2f86..8403bc644b4 100644 --- a/Master/texmf-dist/source/latex/lettrine/lettrine.dtx +++ b/Master/texmf-dist/source/latex/lettrine/lettrine.dtx @@ -106,7 +106,7 @@ \ProvidesFile{lettrine.dtx} %</dtx> %<*sty|dtx> - [2023-04-18 v2.40 (Daniel Flipo)] + [2023-07-02 v2.50 (Daniel Flipo)] %</sty|dtx> % \fi % @@ -195,7 +195,7 @@ % number of |\baselineskip|. This option is meant for grid % typesetting. % \item \lopt{novskip=}\meta{dimen} overrides |\DiscardVskip| -% (default=0.2pt). In some cases (see options \lopt{lraise}, +% (default=1pt). In some cases (see options \lopt{lraise}, % \lopt{loversize} or accentuated dropped capitals,…) the top of % the dropped capital will raise above the top of following text % (usually in small caps), this will trigger a corresponding vertical @@ -260,8 +260,10 @@ % Another possibility to colour initials globally is described % below, see |\LettrineFontHook|. % -% Three dimensions, |\LettrineWidth|, |\LettrineHeight| and -% |\LettrineDepth|, store the final size of the initial. +% Three dimensions, |\LettrineHeight|, |\LettrineDepth| and +% |\LettrineWidth| hold the final size of the initial +% (\textit{height} and \textit{depth} being measured from +% the paragraph’s $n$-th baseline if |lines=|$n$. % % Have a look at files \file{lettrine-demo-fr.tex} and % \file{lettrine-demo-lua.tex} and at the resulting PDFs in the @@ -293,7 +295,7 @@ % \item |\setlength{\DefaultFindent}{0pt}|, % \item |\setlength{\DefaultNindent}{0.5em}|, % \item |\setlength{\DefaultSlope}{0pt}|. -% \item |\setlength{\DiscardVskip}{0.2pt}|, +% \item |\setlength{\DiscardVskip}{1pt}|, % \item |\LettrineImagefalse|, % \item |\LettrineOnGridfalse|, % \item |\LettrineRealHeightfalse|. @@ -384,7 +386,24 @@ % (Palatino, Times, Utopia…), or any OpenType font, they are % fully scalable too! % -% \newpage{} +% \newpage +% \textbf{Breaking change in version~2.50:} in order to improve the +% alignment of side by side parboxes starting with a dropped cap, the +% internals of the |\lettrine{}| command have changed. Formerly, the +% initial was completely smashed (\textit{height}=0, +% \textit{depth}=0) and a |\vskip| was added in case the initial +% sticked out too much above the paragraph’s first baseline. From +% version~2.50 on, the initial gets a null \textit{depth} and its +% proper \textit{height} (measured from the paragraph’s first +% baseline, please note that it is different from |\LettrineHeight|). +% This change has the following side effect: in multicolumn +% typesetting, when a dropped cap starts a column and sticks out +% significantly above the baseline, it might be necessary to `smash’ +% the dropped cap and eventually to add a |\vspace{}| before +% the multicolumn environment. See \file{lettrine-demo-fr.pdf} p.~4 +% for an example. Using the rollback mechanism to switch back to +% version~2.40 is another option: |\usepackage{lettrine}[=v2.4]|. +% % \textbf{Known issues:} % \begin{itemize} % \item Nothing is done to prevent page-breaking in a paragraph @@ -425,6 +444,7 @@ % % \StopEventually{} % +% \newpage % \section{\TeX{}nical details} % % \iffalse @@ -447,7 +467,8 @@ \DeclareRelease{v1.9}{2012-07-20}{lettrine-2015-08-31.sty} \DeclareRelease{v2.0}{2018-07-21}{lettrine-2018-08-18.sty} \DeclareRelease{v2.3}{2022-09-25}{lettrine-2022-09-25.sty} -\DeclareCurrentRelease{}{2023-04-18} +\DeclareRelease{v2.4}{2023-04-18}{lettrine-2023-04-18.sty} +\DeclareCurrentRelease{}{2023-07-02} \RequirePackage{xfp} % \end{macrocode} % @@ -470,6 +491,9 @@ % % \changes{v2.1}{2018/08/14}{New option `refstring’.} % +% \changes{v2.50}{2023/05/30}{\cs{DiscardVskip} default value enlarged +% from 0.2pt to 1pt.} +% % \begin{macrocode} \newcounter{DefaultLines} \setcounter{DefaultLines}{2} @@ -485,7 +509,7 @@ \newdimen\DefaultSlope \setlength{\DefaultSlope}{\z@} \newdimen\DiscardVskip -\setlength{\DiscardVskip}{0.2\p@} +\setlength{\DiscardVskip}{1\p@} \newif\ifLettrineImage \newif\ifLettrineOnGrid \newif\ifLettrineRealHeight @@ -499,6 +523,7 @@ % \changes{v1.6}{2015/02/06}{Added newif \cs{ifL@grid}.} % % \begin{macrocode} +\newsavebox{\L@lettrine} \newsavebox{\L@lbox} \newsavebox{\L@tbox} \newcounter{L@lines} @@ -512,6 +537,7 @@ \newdimen\L@slope \newdimen\L@height \newdimen\L@novskip +\newdimen\L@ruleht \newdimen\L@target@ht \newdimen\L@target@dp \newdimen\L@target@tht @@ -944,23 +970,6 @@ \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.} -% -% and 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 - (for loversize=0, accent excluded),\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 % \lopt{realheight=false}): % @@ -972,9 +981,9 @@ \sbox{\L@tbox}{{\LettrineTextFont{#3}}}% % \end{macrocode} % -% Start a new paragraph, skipping the necessary amount of space -% if the dropped capital sticks out of the top of paragraph. -% We use |\L@first| to compute the amount of space to be skipped. +% Start a new paragraph and compute in |\L@ruleht| the height of +% the top part of the dropped capital which raises above the +% paragraph’s first baseline. % % \changes{v0.9}{1998/02/23}{Calculations of length % \cs{L@first} changed. Do not `vskip’ small lengths ($<$0.2pt), @@ -991,40 +1000,53 @@ % |\LettrineFont|) is |\L@target@tht|. % % \begin{macrocode} - \setlength{\L@first}{\LettrineHeight}% + \par + \setlength{\L@ruleht}{\LettrineHeight}% \setlength{\L@lraise}{\L@raise\L@target@tht}% - \addtolength{\L@first}{\L@lraise}% - \ifnum\value{L@lines}=1 - \addtolength{\L@first}{-\ht\L@tbox}% - \else - \addtolength{\L@first}{-\L@target@tht}% + \addtolength{\L@ruleht}{\L@lraise}% + \ifnum\value{L@lines}>\@ne + \@tempcnta=\value{L@lines}% + \advance\@tempcnta \m@ne + \addtolength{\L@ruleht}{-\@tempcnta\baselineskip}% \addtolength{\L@lraise}{-\L@target@dp}% \fi - \par -% \end{macrocode} -% |\L@first| now holds the height of the needed |\vskip|; if too -% small it will be discarded. -% \begin{macrocode} - \ifdim\L@first>\L@novskip % \end{macrocode} -% When the \lopt{grid} option is \lopt{true}, let’s round up -% |\L@first| to the next integer number of |\baselineskip|. +% When |\L@ruleht| is larger than |\baselineskip - \L@novskip| and +% the \lopt{grid} option is \lopt{true}, let’s skip an integer number +% of |\baselineskip| (and smash the dropped cap, see below). % \begin{macrocode} + \@tempdima=\L@ruleht + \advance\@tempdima \L@novskip + \@tempdimb=\baselineskip + \ifdim\@tempdima>\@tempdimb \ifL@grid - \@tempdima=\baselineskip - \@tempdimb=\@tempdima - \advance\@tempdimb by \L@novskip - \@tempcnta=1 - \loop\ifdim\L@first>\@tempdimb - \advance\@tempcnta by 1 - \advance\L@first by -\@tempdima + \@tempcnta=\z@ + \loop\ifdim\@tempdima>\@tempdimb + \advance\@tempcnta \@ne + \advance\@tempdima -\@tempdimb \repeat - \L@first=\@tempcnta\baselineskip + \vskip\@tempcnta\baselineskip \fi - \vskip\L@first \fi % \end{macrocode} -% Again, we (mis)use the length |\L@first| to compute the width of +% +% \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 + (for loversize=0, accent excluded),\MessageBreak + Lettrine height = \the\LettrineHeight\space (#2)% + \ifdim\@tempdima>\z@\space loversize=\L@oversize\fi;% + \MessageBreak reported}% + \endgroup +% \end{macrocode} +% We (mis)use the length |\L@first| to compute the width of % the text eventually coming before the dropped capital. It is % reset later on to hold the first line’s length. % \begin{macrocode} @@ -1091,11 +1113,16 @@ % \changes{v2.40}{2023/04/18}{Replace \cs{usebox} by \cs{unhcopy} % for box \cs{L@tbox} to allow footnote calls and microtype action.} % +% \changes{v2.50}{2023/07/02}{Remove the top \cs{vskip}, smash the +% dropped cap, add a \cs{rule} to mimic its height above the baseline +% instead.} +% % Write the dropped capital into the left margin, and wrap % the rest of paragraph around it. % \begin{macrocode} - \smash{\llap{\mbox{\L@ante}\raisebox{\L@lraise}{\usebox{\L@lbox}}% - \hskip \the\L@Findent}}% + \llap{\mbox{\L@ante}\smash{\raisebox{\L@lraise}{\usebox{\L@lbox}}}% + \ifL@grid\else\rule{0pt}{\L@ruleht}\fi + \hskip \the\L@Findent}% \unhcopy\L@tbox\relax % \end{macrocode} % @@ -1155,7 +1182,7 @@ %%\setlength{\DefaultFindent}{0pt} %%\setlength{\DefaultNindent}{0.5em} %%\setlength{\DefaultSlope}{0mm} -%%\setlength{\DiscardVskip}{0.2pt} +%%\setlength{\DiscardVskip}{1pt} %% %% Theses are *flags* (value=true/false): %%\LettrineImagefalse |