diff options
author | Karl Berry <karl@freefriends.org> | 2024-01-20 21:08:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-01-20 21:08:05 +0000 |
commit | a8c780c3a68a007f347bab71ff7f0d22a59e9fee (patch) | |
tree | b6706ae7ddc3a9c43470d77d1289d509963b2908 /Master/texmf-dist/source | |
parent | 5d17095d877f91c1b9365e78e280fb9ba368b035 (diff) |
lettrine (20jan24)
git-svn-id: svn://tug.org/texlive/trunk@69508 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/lettrine/lettrine.dtx | 98 |
1 files changed, 80 insertions, 18 deletions
diff --git a/Master/texmf-dist/source/latex/lettrine/lettrine.dtx b/Master/texmf-dist/source/latex/lettrine/lettrine.dtx index 4f17f5f6b6b..c4bf9472c53 100644 --- a/Master/texmf-dist/source/latex/lettrine/lettrine.dtx +++ b/Master/texmf-dist/source/latex/lettrine/lettrine.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright © 1999-2023 Daniel Flipo. +% Copyright © 1999-2024 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 @@ -47,7 +47,8 @@ \setmainfont{erewhon} \setsansfont{Cabin}[Scale=MatchLowercase] \setmonofont{Inconsolatazi4}[Scale=MatchLowercase, Color=Sepia, - HyphenChar=None,StylisticSet={2,3}] + HyphenChar=None,StylisticSet={2,3}, + ] \setmathfont{Erewhon-Math.otf} \usepackage{fourier-orns} \usepackage[expansion=true,protrusion=true]{microtype} @@ -97,7 +98,7 @@ % %<*sty> %% IMPORTANT NOTICE: -%% For the copyright see the source file `lua-typo.dtx’. +%% For the copyright see the source file `lettrine.dtx’. %% \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesFile{lettrine.sty} @@ -106,7 +107,7 @@ \ProvidesFile{lettrine.dtx} %</dtx> %<*sty|dtx> - [2023-08-14 v2.52 (Daniel Flipo)] + [2024-01-20 v2.60 (Daniel Flipo)] %</sty|dtx> % \fi % @@ -178,7 +179,7 @@ % % \item \lopt{image[=true]} 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, xelatex, lualatex); +% or in pdf, jpg, png, etc.\ format (pdflatex, xelatex, lualatex); % this requires the |graphicx| package to be loaded in the preamble. % |\lettrine[image=true]{A}{n exemple}|\quad or just\\ % |\lettrine[image]{A}{n exemple}|\\ @@ -190,13 +191,15 @@ % \item \lopt{viewport=}\meta{llx lly urx ury} is passed to % |\includegraphics| (same four dimen parameters); when present, % |\lettrine| only considers the contents of the rectangle defined by -% its lower left and upper right corners to compute the size of the -% final image. It’s up to the user to deal with the rest of the -% image… f.i.\ providing a |\vspace*{...}| in case a significant part -% sticks out on top of the defined rectangle. This option may be -% useful in some special cases, see -% \url{https://tex.stackexchange.com/questions/693270/} or when the -% image’s bounding box is inaccurate. +% its lower left and upper right corners to compute the scaling +% ratio (which will apply to the whole image). It’s up to the user to +% ensure that the rest of the image will not overwrite the +% surrounding text, f.i.\ providing a |\vspace*{...}| in case +% a significant part sticks out on top of the defined rectangle. +% This option may be useful in case the letter covers only a limited +% part of the image, +% see \url{https://tex.stackexchange.com/questions/693270/} for an +% example, or when the image’s bounding box is inaccurate. % % \changes{v1.8}{2015/02/06}{Added two keyval options: % `grid’ (true/false) and `novskip’ to override \cs{DiscardVskip}.} @@ -310,7 +313,11 @@ % \item |\setlength{\DiscardVskip}{1pt}|, % \item |\LettrineImagefalse|, % \item |\LettrineOnGridfalse|, -% \item |\LettrineRealHeightfalse|. +% \item |\LettrineRealHeightfalse|, +% \item |\renewcommand*{\LettrineTextFont}{\scshape}|, +% \item |\renewcommand*{\LettrineTestString}{EFTZ}|, +% \item |\renewcommand*{\LettrineSecondString}{x}|, +% \item |\renewcommand{\DefaultOptionsFile}{optfile.cfl}|. % \end{itemize} % % Instead of giving optional parameters to the |\lettrine| command, @@ -334,6 +341,14 @@ % |\newcommand{\LettrineTextFont}{\scshape}| (second argument in % small caps), this can be changed using |\renewcommand|. % +% |\LettrineTestString| and |\LettrineSecondString| provide +% reasonable defaults for Latin scripts (|EFTZ| and |x|). +% For other scripts they \emph{should be changed} respectively to +% uppercase and lowercase letters of the given script, as the +% dropped cap’s height computation is based on these strings; +% another possibility is to use the previously described +% \lopt{refstring} and \lopt{realheight} options. +% % |\LettrineFont| \emph{is not customisable} see |\LettrineFontHook| % below, it sets the font used for the dropped capital, usually the % current font in a (large) size, computed automatically from the @@ -417,6 +432,17 @@ % version~2.40 is another option: |\usepackage{lettrine}[=v2.4]|. % % \vspace{.5\baselineskip} +% \textbf{New in version~2.60:} the |\lettrine| command is now +% compatible with right to left typesetting, with LuaLaTeX and +% XeLaTeX (+\pkg{babel} or \pkg{polyglossia}). With XeLaTeX, file +% \file{lettrine-xetex-bidi.def} (v0.8 [2022/11/06]) is automatically +% loaded by the \pkg{bidi} package; it redefines the |\@lettrine| +% command based on version~2.30 of \pkg{lettrine}. This code is +% \emph{incompatible} with versions~2.50 and newer, you can safely +% remove \file{lettrine-xetex-bidi.def} when installing v2.60 of +% \pkg{lettrine}. + +% \vspace{.5\baselineskip} % \textbf{Known issues:} % \begin{itemize} % \item Nothing is done to prevent page-breaking in a paragraph @@ -426,6 +452,13 @@ % environments but does not work within `center’ environments % except with option \texttt{[lines=1]}. % \item |\lettrine| does not work within lists. +% \item The LaTeX |\raggedright| command doesn’t work well with the +% TeX |\parshape| command used internally by |\lettrine|. +% Please use the |\RaggedRight| command from the \pkg{ragged2e} +% package together with appropriate settings, f.i. \\ +% |\setlength{\RaggedRightRightskip}{0pt plus .1\hsize}|. \\ +% See \url{https://tex.stackexchange.com/questions/97808/} for +% details. % \item If a \emph{list} has to be included in a paragraph starting % with |\lettrine|, it is necessary to add the command % |\parshape=0| just after the end of the list (starting a new @@ -481,7 +514,7 @@ \DeclareRelease{v2.0}{2018-07-21}{lettrine-2018-08-18.sty} \DeclareRelease{v2.3}{2022-09-25}{lettrine-2022-09-25.sty} \DeclareRelease{v2.4}{2023-04-18}{lettrine-2023-04-18.sty} -\DeclareCurrentRelease{}{2023-07-02} +\DeclareCurrentRelease{}{2023-01-20} \RequirePackage{xfp} % \end{macrocode} % @@ -565,6 +598,7 @@ \newif\ifL@image \newif\ifL@grid \newif\ifL@realh +\let\ifL@RTL\iffalse \newcommand*{\L@viewport}{} % \end{macrocode} % @@ -1085,22 +1119,39 @@ \addtolength{\L@Nindent}{\@totalleftmargin}% % \end{macrocode} % Now, set up the shape of the new paragraph (designed by -% |\parshape|). +% |\parshape|). It obiously depends on the text direction, +% the code previously available in \file{lettrine-xetex-bidi.def} +% for right to left scripts is integrated here now. % % \changes{v1.9}{2015/08/31}{\cs{theL@depth} changed to % \cs{value\{L@depth\}}.} % +% \changes{v2.60}{2024/01/20}{\cs{L@parshape} compatible with +% xetex bidi RTL typesetting.} +% % \begin{macrocode} \addtocounter{L@lines}{1}% \addtocounter{L@lines}{\value{L@depth}}% - \def\L@parshape{\c@L@lines \the\L@Pindent \the\L@first}% + \ifL@RTL + \def\L@parshape{\c@L@lines \z@ \the\L@first}% + \else + \def\L@parshape{\c@L@lines \the\L@Pindent \the\L@first}% + \fi \@tempcnta=\tw@ \@whilenum \@tempcnta<\c@L@lines\do{% - \edef\L@parshape{\L@parshape \the\L@Nindent \the\L@next}% + \ifL@RTL + \edef\L@parshape{\L@parshape \z@ \the\L@next}% + \else + \edef\L@parshape{\L@parshape \the\L@Nindent \the\L@next}% + \fi \addtolength{\L@Nindent}{\L@slope}% \addtolength{\L@next}{-\L@slope}% \advance\@tempcnta\@ne}% - \edef\L@parshape{\L@parshape \@totalleftmargin \the\linewidth}% + \ifL@RTL + \edef\L@parshape{\L@parshape \z@ \the\linewidth}% + \else + \edef\L@parshape{\L@parshape \@totalleftmargin \the\linewidth}% + \fi \noindent \parshape=\L@parshape\relax % \end{macrocode} @@ -1148,6 +1199,13 @@ }% } % \end{macrocode} +% Compatibility with the \pkg{bidi} package (loaded \emph{after} +% \pkg{lettrine}). +% \begin{macrocode} +\AtBeginDocument{% + \IfPackageLoadedTF{bidi}{\eqnewif{\ifL@RTL}{\if@RTL}}{}% +} +% \end{macrocode} % % \iffalse %</sty> @@ -1187,6 +1245,10 @@ %%\LettrineOnGridfalse %%\LettrineRealHeightfalse %% +%% This is a *command*, define it as \relax if you dont want the second +%% mandatory argument of \lettrine[]{}{} to be typset in small caps. +%%\renewcommand*{\LettrineTextFont}{\scshape}| +%% %% Theses are *commands* (value=string, only height matters): %%\renewcommand*{\LettrineTestString}{EFTZ} %%\renewcommand*{\LettrineSecondString}{x} |