diff options
author | Karl Berry <karl@freefriends.org> | 2023-09-01 21:19:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-09-01 21:19:44 +0000 |
commit | 27d05e705e75259a904502763104b47814ebcf3e (patch) | |
tree | 679f96665b70ed713b41d523c208d1f56b1cfa28 /Master/texmf-dist/source | |
parent | 63b1de3dc657c563490e2d8fe79b9145c7df5982 (diff) |
wrapfig2 (1sep23)
git-svn-id: svn://tug.org/texlive/trunk@68142 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/wrapfig2/wrapfig2.dtx | 194 |
1 files changed, 54 insertions, 140 deletions
diff --git a/Master/texmf-dist/source/latex/wrapfig2/wrapfig2.dtx b/Master/texmf-dist/source/latex/wrapfig2/wrapfig2.dtx index f54c71c6c28..c7a30fa3168 100644 --- a/Master/texmf-dist/source/latex/wrapfig2/wrapfig2.dtx +++ b/Master/texmf-dist/source/latex/wrapfig2/wrapfig2.dtx @@ -45,14 +45,14 @@ wrapfig2.sty and wrapfig2.pdf, plus this file README.txt. %<+package>\ProvidesPackage{wrapfig2}% %^^A<+readme>File README.txt for package wrapfig2 %<*package|readme> - [2023-02-23 v.6.1.1 Wrap text around figures, tables, framed text blocks] + [2023-09-01 v.6.2.0 Wrap text around figures, tables, framed text blocks] %</package|readme> %<*driver> % \documentclass{ltxdoc}\errorcontextlines=100 \hfuzz 10pt \usepackage[greek.ancient, english]{babel} -\usepackage[utf8]{inputenc} +\usepackage[utf8]{inputenc}% for vintage exec.s \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{mflogo} @@ -644,62 +644,21 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %^^A %\end{description} % -% This version~6 has a more flexible way compared to version~5 -% to specify the details relative to the framed text, but they are -% relevant only for the \cs{includeframedtext} command; the syntax -% for the \Env{wraptext} environment opening command is identical. -% As it was previously shown, the syntax of environment \Env{wraptext} -% for version~6 and~5 is practically identical to the one used for the -% other two environments; actually, as it can be seen below in -% the code description of version~6 and~5, it has a fairly -% longer definition; it is required by the necessity of avoiding -% the \cs{caption} changes foreseen in package{wrapfig} when -% \pack{float} is used to define another floating object, but in -% effects the new definition of the \Env{wraptext} environment uses -% the same \cs{wrapfloat} and \cs{endwrapfloat} commands. -% -% In all three cases the \meta{width} parameter is a \emph{braced optional -% argument}; for the \Env{wraptext} environment its preset value is -% half the column width, that in one column typesetting mode -% coincides with the text width. The wrapped text is typeset -% in justified mode within a \cs{parbox} argument; the -% measure of this text box should not be too small (unless -% the text is less than one line long) otherwise the inter -% word spacing might be too large; at the same time the measure -% of the mini paragraph cannot be too large, otherwise the indented -% wrapping lines, generally justified, might get a bad word -% spacing. As it was already explained, it is reccommended to avoid -% specifying the optional \meta{widh} outside the range of 40\% to 60\% -% the column width. Actually specifying \texttt{0.2\cs{textwidth}} -% or \texttt{0.4\cs{columnwidth}} when typesetting in two column -% mode produces approximately the same result, because -% \cs{columnwidth} is a little less than half the \cs{textwidth}. -% In any case versions~6 and~5 of \Env{wrapfig2} reset any specified -% width outside the above range to the nearest range bound. +% This version~6 has a more flexible way compared to version~5 to specify the details relative to the framed text, but they are relevant only for the \cs{includeframedtext} command; the syntax for the \Env{wraptext} environment opening command is identical. As it was previously shown, the syntax of environment \Env{wraptext} for version~6 and~5 is practically identical to the one used for both other environments; actually, as it can be seen below in the code description of version~6 and~5, it has a fairly longer definition; it is required by the necessity of avoiding the \cs{caption} changes foreseen in package{wrapfig} when \pack{float} is used to define another floating object, but in effects the new definition of the \Env{wraptext} environment uses the same \cs{wrapfloat} and \cs{endwrapfloat} commands. +% +% In all three cases the \meta{width} parameter is a \emph{braced optional argument}; for the \Env{wraptext} environment its preset value is half the column width, that in one column typesetting mode coincides with the text width. The wrapped text is typeset in justified mode within a \cs{parbox} argument; the measure of this text box should not be too small (unless the text is less than one line long) otherwise the inter word spacing might be too large; at the same time the measure of the mini paragraph cannot be too large, otherwise the indented wrapping lines, generally justified, might get a bad word spacing. As it was already explained, it is recommended to avoid specifying the optional \meta{widh} outside the range of 40\% to 60\% the column width. Actually specifying \texttt{0.2\cs{textwidth}} or \texttt{0.4\cs{columnwidth}} when typesetting in two column mode produces approximately the same result, because \cs{columnwidth} is a little less than half the \cs{textwidth}. In any case versions~6 and~5 of \Env{wrapfig2} reset any specified width outside the above range to the nearest range bound. % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \section{Remarks} %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% The syntax of the original environments \amb{wrapfigure} and -% \amb{wraptable} has not been changed, except for a last optional -% star. The fact that the last \emph{braced argument is optional} does not -% change the backward compatibility with the original environments. -% -% Therefore the optional \meta{line number} argument maintains its -% meaning, unless the optional star is specified; in such a case that -% number assumes the meaning of a correction to the computed number -% of the indented lines. -% -% The mandatory \meta{location} maintains its meaning and the legal -% values are \texttt{l} (left), \texttt{r} (right), \texttt{L} -% (floating left), \texttt{R} (floating right), \texttt{i} -% (inner margin), \texttt{o} (outer margin), \texttt{I} -% (floating inner margin), \texttt{O} (floating outer margin). +% The syntax of the original environments \amb{wrapfigure} and \amb{wraptable} has not been changed, except for a last optional star. The fact that the last \emph{braced argument is optional} does not change the backward compatibility with the original environments. +% +% Therefore the optional \meta{line number} argument maintains its meaning, unless the optional star is specified; in such a case that number assumes the meaning of a correction to the computed number of the indented lines. +% +% The mandatory \meta{location} maintains its meaning and the legal values are \texttt{l} (left), \texttt{r} (right), \texttt{L} (floating left), \texttt{R} (floating right), \texttt{i} (inner margin), \texttt{o} (outer margin), \texttt{I} (floating inner margin), \texttt{O} (floating outer margin). % -% We tested all of them, but as a (possibly questionable) personal -% choice we prefer to place the wrapped object at the left of the text, -% without floating it and irrespective of the folio parity. +% We tested all of them, but as a (possibly questionable) personal choice we prefer to place the wrapped object at the left of the text, without floating it and irrespective of the folio parity. % %\begin{wraptext}{l}{0.5\textwidth}% %\includegraphics[width=\hsize]{stele-todi-small} @@ -884,15 +843,18 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % scenes uses a very heavy set of multifunctional macros that offer % functionalities that are not required for this problem. % -% Warm thanks also to Juan Luis Varona Malumbres for his precious -% feedback and his suggestions. +% Warm thanks also to Juan Luis Varona +% Malumbresfor his precious feedback and his +% suggestions. % -% Herbert Voß spotted the necessity to follow a specific loading -% order if the \pack{amsmath} needs to be used; he was so kind to -% send me a bug notice together with a minimum working example. -% Thanks a lot Herbert! The best I could do to manage this bug -% consisted in adding an error message, if \pack{wrapfig2} during its -% loading process found \pack{amsmath} already loaded. +% Herbert Voß spotted the necessity to follow a +% specific loading order if the \pack{amsmath} +% needs to be used; he was so kind to send me a +% bug notice together with a minimum working +% example. +% Thanks to Bruno Pagani whos pinpointed the exact +% point that conflicts with \pack{wrapfig2} so +% that I could fix this conflict. % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \CheckSum{1428} @@ -938,13 +900,14 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % % \begin{macrocode} \ifcsname c@WF@wrappedlines\endcsname -\PackageError{wrapfig2}{ \MessageBreak - ****************************************************\MessageBreak +\PackageError{wrapfig2}{ +\MessageBreak +**************************************************\MessageBreak Package `wrapfig' has already been loaded perhaps \MessageBreak by other packages, for example caption or subcaption.\MessageBreak Such packages are incompatible with wrapfig2 \MessageBreak Loading of`wrapfig2' is aborted \MessageBreak - ****************************************************\MessageBreak +**************************************************\MessageBreak }{You might type X <return> and might get along without\MessageBreak this package if you don't use the new environment \MessageBreak `wraptext' and the new commands; otherwise you get \MessageBreak @@ -954,31 +917,13 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % \end{macrocode} % -% {\color{red}{\paragraph{Loading order} Some users needed to use -% \pack{wrapfig2} in documents where they required also the -% \pack{amsmath} package functionalities; they noticed that some -% incompatibility showed up if package \pack{amsmath} was input -% before \pack{wrapfig2}. Such incompatibility vanishes if -% \pack{amsmath} is loaded \emph{after} \pack{wrapfig2}. This -% package now issues an error message if it finds \pack{amsmath} -% already loaded.}} -% \begin{macrocode} -\@ifpackageloaded{amsmath}{% - \PackageError{wrapfig2}{ \MessageBreak - +++++++++++++++++++++++++++++++++++++++++++\MessageBreak - Package amsmath already loaded \MessageBreak - If you need amsmath, load it after wrapfig2\MessageBreak - Expect error messages \MessageBreak - +++++++++++++++++++++++++++++++++++++++++++\MessageBreak - \MessageBreak - }{Abort the job}}{\relax} -% \end{macrocode} -% -% We keep the original definition of the \cs{WF@warning} and the -% original definition of the \opt{verbose} option; but we add the -% new \opt{WFold} and \opt{WFfive} options in order to fall back -% to the functionalities of the previous version~4 or~5, at least -% for what concerns the \Env{wraptext} environment. +% We keep the original definition of the +% \cs{WF@warning} and the original definition of +% the \opt{verbose} option; but we add the new +% \opt{WFold} and \opt{WFfive} options in order to +% fall back to the functionalities of the previous +% version~4 or~5, at least for what concerns the +% \Env{wraptext} environment. % % % \begin{macrocode} @@ -1040,6 +985,16 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % redefines some \pack{color} internal commands; everything is % explained in the \pack{xcolor} documentation.} % +% Here we have a little trick for avoiding +% conflicts with \pack{amsmath} and its|\text| +% command- +% \begin{macrocode} +\@ifpackageloaded{amsmath}{% +\let\amsmathtext\text +\AtEndPreamble{\let\text\amsmathtext}% +}{\relax} +% \end{macrocode} +% % In order to define the new floating object \texttt{text} we have % to load the package \pack{float}, but only if versions~5 or~6 % are used; in other words only if the \cs{ifWFnew} switch @@ -1210,13 +1165,11 @@ backgroundcolor, textcolor, fontstyle, radius, insertionwidth} % Here is the code of some extra macros and of the \Env{wraptext} % environment. % -% We start with two different \cs{includeframedtext}, one for -% version~6, that accepts \texttt{key=velue} options, and -% another one for version~5, that requires only a comma -% separated list of dimensional values. +% We start with two different \cs{includeframedtext}, one for version~6, that accepts \texttt{key=velue} options, and another one for version~5, that requires only a comma separated list of dimensional values. % \begin{macrocode} \ifbool{WFnew}{% -\NewDocumentCommand\includeframedtext{O{\insertwidth} m O{} o}{\bgroup% +\NewDocumentCommand\includeframedtext{% + O{\insertwidth} m O{} o}{\bgroup% \ExecuteOptionsX<wraptext>{#3}% executes possible key=value options \insertwidth=#1\WFscalewidth \framedbox{#2}{\fboxrule}{\fboxsep}[\radius]\egroup} @@ -1244,48 +1197,9 @@ backgroundcolor, textcolor, fontstyle, radius, insertionwidth} %\cs{includeframedtext}\oarg{text width}\marg{text}\oarg{dimensions}\oarg{radius} %\end{ttsintassi} % -% The optional \meta{text width} is the (possibly scaled) width computed -% by the \Env{wraptext} environment; but if the authors use this command -% outside the \Env{wraptext} environment, they should specify a width; -% in any case the default value is half the current measure -% \cs{linewidth}. The \meta{text} is the unformatted text to be wrapped; -% it will be boxed and framed by the service macro \cs{framedbox}; the -% \meta{dimensions} are passed on to \cs{framedbox} command; they are a -% comma separated list of dimensions, namely the thickness of the frame -% and the necessary frame distance from the formatted text. The -% \meta{options} contains a comma separated list of zero to nine options -% with the syntax \texttt{key=vale} that are going to be used by both -% the \cs{includeframedtext} and \cs{framedbox}. The last optional -% \meta{radius} is the curvature radius of the rounded frame corners; -% the default value is going to be set to \cs{fboxsep}: in -% version~5 \cs{framedbox} by default sets it equal to the frame -% separation width, while with version~6 its value is received with -% the option \texttt{radius=\meta{dimension}}; the default value is -% certainly the best one, but the users can specify a different value, -% of course not too different from the default one. See some examples -% in figure~\ref{fig:framed text}. -% -% The definition of the \cs{framedbox} command appears to be -% complicated; it is just an apparent complication due to the -% fact that it uses the powerful \cs{Curve} command that draws an -% arbitrary curved line or fills the area delimited by such -% curved line; it suffices to specify the nodes and the tangents -% to each node; the nodes are the points the line should pass -% through, their tangents may be specified with arbitrary vector -% components along the horizontal and vertical axes. For a -% rectangle such vector components are just 0 or $\pm 1$. The -% node coordinates of the rounded corners, on the opposite, must be -% determined with accuracy; we used the \cs{fpeval} function of -% package \pack{xfp}, that performs precise computations on operands -% in fractional decimal numbers; if the operands are dimensions, the -% operands are their fractional decimal values in printer points, the -% results of such operations are pure fractional decimal numbers -% without units; if the numerical result is to be interpreted again -% as the measure of a dimensional entity, \texttt{pt} must be appended -% to the assignments to a dimension register; within the \Env{picture} -% environment, any coordinate is expressed in multiples of -% \cs{unitlength}, therefore no unit of measure is necessary, once -% \cs{unitlength} has been specified. +% The optional \meta{text width} is the (possibly scaled) width computed by the \Env{wraptext} environment; but if the authors use this command outside the \Env{wraptext} environment, they should specify a width; in any case the default value is half the current measure \cs{linewidth}. The \meta{text} is the unformatted text to be wrapped; it will be boxed and framed by the service macro \cs{framedbox}; the \meta{dimensions} are passed on to \cs{framedbox} command; they are a comma separated list of dimensions, namely the thickness of the frame and the necessary frame distance from the formatted text. The \meta{options} contains a comma separated list of zero to nine options with the syntax \texttt{key=vale} that are going to be used by both the \cs{includeframedtext} and \cs{framedbox}. The last optional \meta{radius} is the curvature radius of the rounded frame corners; the default value is going to be set to \cs{fboxsep}: in version~5 \cs{framedbox} by default sets it equal to the frame separation width, while with version~6 its value is received with the option \texttt{radius=\meta{dimension}}; the default value is certainly the best one, but the users can specify a different value, of course not too different from the default one. See some examples in figure~\ref{fig:framed text}. +% +% The definition of the \cs{framedbox} command appears to be complicated; it is just an apparent complication due to the fact that it uses the powerful \cs{Curve} command that draws an arbitrary curved line or fills the area delimited by such curved line; it suffices to specify the nodes and the tangents to each node; the nodes are the points the line should pass through, their tangents may be specified with arbitrary vector components along the horizontal and vertical axes. For a rectangle such vector components are just 0 or $\pm 1$. The node coordinates of the rounded corners, on the opposite, must be determined with accuracy; we used the \cs{fpeval} function of package \pack{xfp}, that performs precise computations on operands in fractional decimal numbers; if the operands are dimensions, the operands are their fractional decimal values in printer points, the results of such operations are pure fractional decimal numbers without units; if the numerical result is to be interpreted again as the measure of a dimensional entity, \texttt{pt} must be appended to the assignments to a dimension register; within the \Env{picture} environment, any coordinate is expressed in multiples of \cs{unitlength}, therefore no unit of measure is necessary, once \cs{unitlength} has been specified. % % For a rectangle with curved corners of a given radius \cs{R} % we have four quarter circles joined by straight lines; therefore @@ -1307,10 +1221,10 @@ backgroundcolor, textcolor, fontstyle, radius, insertionwidth} \NewDocumentCommand\framedbox{ m m m O{#3}}{\bgroup \fboxrule=#2\fboxsep=#3\relax \setbox0\hbox{\fboxrule=\z@\fboxsep=#3\relax -\framebox{\parbox{% draw a framed box without the frame +\framebox{\parbox{% draw a framed box without the frame \fpeval{\insertwidth-2\fboxrule-2\fboxsep}\p@}{\textcolor{WFtext}{#1}}}} -\unitlength=\fpeval{\wd0/100}\p@ % set the picture \unitlength +\unitlength=\fpeval{\wd0/100}\p@ % set the picture \unitlength % determine the picture coordinates and displacement of the axes origin \edef\x{100}% \edef\y{\fpeval{(\ht0 +\dp0)/\unitlength}}% @@ -1464,15 +1378,15 @@ backgroundcolor, textcolor, fontstyle, radius, insertionwidth} \def\textplacement{#2}% \def\textcorrection{#1}% \def\textoverhang{#3}% - \IfBooleanTF{#5}{\PackageWarning{wrapfig2}{% + \IfBooleanT{#5}{\PackageWarning{wrapfig2}{% *********************************************\MessageBreak With wraptext the optional star is useless \MessageBreak because the first optional argument always \MessageBreak means the "lines number CORRECTION" \MessageBreak - *********************************************\MessageBreak}}{}%%%<------------------ + *********************************************\MessageBreak}} \bgroup\edef\x{\egroup\noexpand\wrapfloat{text}% [\textcorrection]{\textplacement}[\textoverhang]{\insertwidth}*}\x% - \def\caption{\unskip + \def\caption{\unskip\unskip \refstepcounter\@captype \let\@tempf\@caption \unless\ifcsname @float@c@\@captype\endcsname |