summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lettrine
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-01-21 03:01:05 +0000
committerNorbert Preining <norbert@preining.info>2024-01-21 03:01:05 +0000
commitb2fc73208c72c65ca8f9ce068898291b69322d32 (patch)
treec5027d520af6b383a642459af510e38224cf97d5 /macros/latex/contrib/lettrine
parent2fd07558ccd8d3c8e354f8ea0b342ef7ac1e87a3 (diff)
CTAN sync 202401210301
Diffstat (limited to 'macros/latex/contrib/lettrine')
-rw-r--r--macros/latex/contrib/lettrine/README.md6
-rw-r--r--macros/latex/contrib/lettrine/doc/lettrine-demo-arabic.pdfbin0 -> 13371 bytes
-rw-r--r--macros/latex/contrib/lettrine/doc/lettrine-demo-arabic.tex38
-rw-r--r--macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdfbin128252 -> 128252 bytes
-rw-r--r--macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdfbin168279 -> 168279 bytes
-rw-r--r--macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdfbin74185 -> 73166 bytes
-rw-r--r--macros/latex/contrib/lettrine/doc/lettrine-xetex-bidi.def12
-rw-r--r--macros/latex/contrib/lettrine/doc/lettrine.pdfbin126080 -> 131712 bytes
-rw-r--r--macros/latex/contrib/lettrine/lettrine.dtx98
9 files changed, 133 insertions, 21 deletions
diff --git a/macros/latex/contrib/lettrine/README.md b/macros/latex/contrib/lettrine/README.md
index 57f41e59ff..88e1a9e9d4 100644
--- a/macros/latex/contrib/lettrine/README.md
+++ b/macros/latex/contrib/lettrine/README.md
@@ -33,7 +33,7 @@ This bundle is included in most TeX distributions, but if you need
to install it by yourself
1. run luatex on lettrine.dtx to strip the comments and create
lettrine.sty and lettrine.cfg;
-2. run lualatex on lettrine.dtx to get the documentation (lettrine.pdf).
+2. move all the files to the `right' place:
Files lettrine.sty, lettrine.cfg, lettrine-*.sty and *.cfl go to to
a directory searched by TeX, typically $TEXMF/tex/latex/lettrine.
@@ -41,7 +41,7 @@ a directory searched by TeX, typically $TEXMF/tex/latex/lettrine.
Files README, lettrine-demo*, lettrine.pdf go to a doc directory,
typically $TEXMF/doc/latex/lettrine.
-Files lettrine.dtx goes to a source directory, typically
+Files lettrine.dtx goes to a source directory, typically
$TEXMF/source/latex/lettrine
Changes
@@ -50,5 +50,5 @@ Changes
See the included manual lettrine.pdf, section "Change History".
--
-Copyright 1999--2023 Daniel Flipo
+Copyright 1999--2024 Daniel Flipo
E-mail: daniel (dot) flipo (at) free (dot) fr
diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-arabic.pdf b/macros/latex/contrib/lettrine/doc/lettrine-demo-arabic.pdf
new file mode 100644
index 0000000000..b2e843d1b7
--- /dev/null
+++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-arabic.pdf
Binary files differ
diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-arabic.tex b/macros/latex/contrib/lettrine/doc/lettrine-demo-arabic.tex
new file mode 100644
index 0000000000..0fd1799823
--- /dev/null
+++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-arabic.tex
@@ -0,0 +1,38 @@
+%%% This example is adapted from
+%%% https://tex.stackexchange.com/questions/152184/lettrine-and-arabic-script/
+%%%
+%%% This file can be compiled either with LuaLaTeX or XeLaTeX.
+%%% The syntax for loading babel slightly differs between Lua- and Xe-LaTeX.
+%%% Compiling this file with XeLaTeX works within this directory which holds
+%%% a specific version of "lettrine-xetex-bidi.def", or requires to
+%%% remove the official file "lettrine-xetex-bidi.def" (v0.8).
+
+\documentclass{article}
+\usepackage{iftex}
+\usepackage{fontspec}
+\setmainfont{FreeSerif}
+\usepackage{lettrine}
+\renewcommand{\LettrineTextFont}{\upshape} % No small caps
+\renewcommand{\LettrineTestString}{۱‬‬} % No Latin letter
+\renewcommand{\LettrineSecondString}{‫ه‬‬‬‫د‬} % No Latin letter
+\ifluatex
+ \usepackage[bidi=basic]{babel}
+ \babelprovide[import, main]{persian}
+\fi
+\ifxetex
+ \usepackage[bidi=bidi-r]{babel}
+ \babelprovide[import, main]{persian}
+\fi
+\begin{document}
+\lettrine[lines=3]{۱‬‬}{} تقدیم به عالیجناب تئوفیلوس:\\
+تا به حال نویسندگان بسیاری به نوشتن شرح وقایعی كه در بین ما رخ داده است، اقدام کردهاند
+تا به حال نویسندگان بسیاری به نوشتن شرح وقایعی كه در بین ما رخ داده است، اقدام کردهاند
+تا به حال نویسندگان بسیاری به نوشتن شرح وقایعی كه در بین ما رخ داده است، اقدام کردهاند
+\end{document}
+
+%%% Local Variables:
+%%% coding: utf-8-unix
+%%% mode: latex
+%%% TeX-master: t
+%%% TeX-engine: luatex
+%%% End:
diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf b/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf
index 84ba7a4344..f8c0fc77c2 100644
--- a/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf
+++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-de.pdf
Binary files differ
diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf b/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf
index a780c1c0a6..f85a80ef42 100644
--- a/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf
+++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-fr.pdf
Binary files differ
diff --git a/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf b/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf
index a88972db81..a0c3aa3bdc 100644
--- a/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf
+++ b/macros/latex/contrib/lettrine/doc/lettrine-demo-lua.pdf
Binary files differ
diff --git a/macros/latex/contrib/lettrine/doc/lettrine-xetex-bidi.def b/macros/latex/contrib/lettrine/doc/lettrine-xetex-bidi.def
new file mode 100644
index 0000000000..0f3dbc8120
--- /dev/null
+++ b/macros/latex/contrib/lettrine/doc/lettrine-xetex-bidi.def
@@ -0,0 +1,12 @@
+%%
+%% This is file `lettrine-xetex-bidi.def', by Daniel Flipo,
+%% as a replacement for Vafa Khalighi's original (outdated) file.
+%%
+\ProvidesFile{lettrine-xetex-bidi.def}%
+ [2024/01/20 v1.0 bidi adaptations for lettrine package for XeTeX engine]
+\IfPackageAtLeastTF{lettrine}{2024-01-20}{}%
+{\PackageWarning{bidi}{Please upgrade your lettrine package\MessageBreak
+ to version 2.60 or higher}}
+\endinput
+%%
+%% End of file `lettrine-xetex-bidi.def'.
diff --git a/macros/latex/contrib/lettrine/doc/lettrine.pdf b/macros/latex/contrib/lettrine/doc/lettrine.pdf
index 0fde23f12d..2866dec763 100644
--- a/macros/latex/contrib/lettrine/doc/lettrine.pdf
+++ b/macros/latex/contrib/lettrine/doc/lettrine.pdf
Binary files differ
diff --git a/macros/latex/contrib/lettrine/lettrine.dtx b/macros/latex/contrib/lettrine/lettrine.dtx
index 4f17f5f6b6..c4bf9472c5 100644
--- a/macros/latex/contrib/lettrine/lettrine.dtx
+++ b/macros/latex/contrib/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}