texlive[56651] Master/texmf-dist: swfigure (13oct20)

commits+karl at tug.org commits+karl at tug.org
Tue Oct 13 22:52:25 CEST 2020


Revision: 56651
          http://tug.org/svn/texlive?view=revision&revision=56651
Author:   karl
Date:     2020-10-13 22:52:25 +0200 (Tue, 13 Oct 2020)
Log Message:
-----------
swfigure (13oct20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/swfigure/README.txt
    trunk/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.pdf
    trunk/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.tex
    trunk/Master/texmf-dist/doc/latex/swfigure/swfigure.pdf
    trunk/Master/texmf-dist/source/latex/swfigure/swfigure.dtx
    trunk/Master/texmf-dist/tex/latex/swfigure/swfigure.sty

Modified: trunk/Master/texmf-dist/doc/latex/swfigure/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/swfigure/README.txt	2020-10-13 20:52:08 UTC (rev 56650)
+++ trunk/Master/texmf-dist/doc/latex/swfigure/README.txt	2020-10-13 20:52:25 UTC (rev 56651)
@@ -11,7 +11,7 @@
 %% 
 
 File README.txt for package swfigure
-        [2020-10-11 v.0.9.07 Managing large and spread wide figures]
+        [2020-10-13 v.0.9.08 Managing large and spread wide figures]
 This bundle contains file the swfigure.dtx and README.txt files.
 
 This file README.txt contains the licence, the status, and some 
@@ -38,8 +38,8 @@
 %% 
 %% This work is "maintained"
 %% 
-%% This work consists of files swfigure.dtx and READEME.txt, and the derived
-%% files swfigure.sty and swfigure.pdf
+%% This work consists of files swfigure.dtx and READEME.txt, and the
+%% derived files swfigure.sty and swfigure.pdf
 %% 
 %%
 %% End of file `README.txt'.

Modified: trunk/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.tex	2020-10-13 20:52:08 UTC (rev 56650)
+++ trunk/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.tex	2020-10-13 20:52:25 UTC (rev 56651)
@@ -4,6 +4,7 @@
 \usepackage[utf8]{inputenc}
 \usepackage{lmodern,textcomp,multicol,enumitem,mflogo,xcolor,fancyvrb}
 \usepackage{swfigure}
+\usepackage{hyperref}\hypersetup{pdfpagelayout=TwoColumnRight}
 
 \providecommand*\diff{\mathop{}\!\mathrm{d}}
 \providecommand\cs{}
@@ -77,14 +78,19 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 Please, before going on reading, set your PDF viewer so that it displays two pages at time, and with the even numbered pages on the left. Only with these settings you can see the spread wide images. Some viewers display the facing pages with a little gap between them; if you don't have available a viewer that avoids this gap, simply imagine that the gap did not exist.
 
-As far as we can say, we know that Preview.app on Macs does not use any gap. Okular on Linux does not use any gap, but traces a thin black line were the facing pages join. Adobe Reader for Windows and other platforms, has several settings for displaying two pages at a time, but only one eliminates the gap while displaying the even numbered page on the left. 
+As far as we can say, we know that Preview.app on Macs does not use any gap. Okular on Linux does not use any gap, but traces a thin black line were the facing pages join. Adobe Reader for Windows and other platforms, has several settings for displaying two pages at a time, but only one eliminates the gap while displaying the even numbered page on the left.
 
-It is possible to see a spread wide figure in the next two pages; a fake figure is displayed and you see that the crossing of the diagonal and medial lines takes place exactly on the spine. It was composed with the following command:
-\begin{flushleft}\ttfamily\obeylines
-\cs{DFimage}Oarg{SW}\Marg{SWfakeimage}\Marg{A Spread Wide fake image}\Oarg{fig:SWfake}
+If the \pack{hyperref} package is used the option \texttt{pdfpagelayout=TwoColumnRight} may be specified; some PDF viewers understand this setting, but not necessarily the spread view lacks the gap between the facing pages.
+
+It is possible to see a spread wide figure in the next two pages; a fake figure is displayed and you see that the crossing of the diagonal and medial lines takes 
+\DFimage[SW]{SWfakeimage}{A spread wide fake image}[fig:SWfake]%
+place exactly on the spine. It was composed with the following command:
+\begin{flushleft}\setfontsize{9.85}\ttfamily\obeylines
+... takes
+\cs{DFimage}Oarg{SW}\Marg{SWfakeimage}\Marg{A Spread Wide fake image}\Oarg{fig:SWfake}%
+place ...
 \end{flushleft}
 
-\DFimage[SW]{SWfakeimage}{A spread wide fake image}[fig:SWfake]
 
 Other examples are shown in the following pages; the filling text is a generic text, not actually a non sense fake Latin wording such as that provided by the \pack{lipsum} package, but it is taken form package \pack{kantlipsum} where sentences appear as plain English, although we doubt that Emmanuel Kant wrote those very texts. 
 
@@ -92,7 +98,7 @@
 \section{The user macro}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-The only user macro defined by this pckge has the following syntax:
+The only user macro defined by this package has the following syntax:
 \begin{ttsyntax}
 \cs{DFimage}\oarg{display mode}\marg{image file name}\oarg{lof entry}\%
 \qquad\marg{caption}\oarg{label}\parg{height correction}\aarg{line correction}
@@ -123,11 +129,11 @@
 %
 \item[\texttt{HS}] refers to a Horizontal Slim image, that requires a spread wide display mode, such that the first of the facing pages is an even numbered one, and with some text beneath both half images; since the caption is under the right half, the space occupied by this part of the image is higher than that in the facing page, it is necessary to equalise these vertical spaces, and the specific code takes care of this constraint. Also in this case the user should carefully chose the place where to insert the steering macro.
 %
-\item[\texttt{VS}] This case refers to a Vertical Slim image. this situation requires a really slim image, so that if its “height over width” ratio (its aspect ratio) si smaller than~2, the macro does not insert anything, except a message in its place, that informs the user about the cause of this refusal and suggests other display modes. The procedure is based on the use of the \pack{wrapfig} functionalities; this package has several limitations that the user should check in its documentation. Nevertheless, if there is enough “normal” text available to wrap the figure, the result is quite good. There are two parameters to fine tune the wrapped image with its caption: the \meta{height correction} and the \meta{line correction}.
+\item[\texttt{VS}] This case refers to a Vertical Slim image. This situation requires a really slim image, so that if its “height over width” ratio (its aspect ratio) is smaller than~2, the macro does not insert anything, except a message in its place, that informs the user about the cause of this refusal and suggests other display modes. The procedure is based on the use of the \pack{wrapfig} functionalities; this package has several limitations that the user should check in its documentation. Nevertheless, if there is enough “normal” text available to wrap the figure, the result is quite good. There are two parameters to fine tune the wrapped image with its caption: the \meta{height correction} and the \meta{line correction}.
 %
 \item[\texttt{NF}] This display mode is the Normal Figure \LaTeX\ kernel mode; the floating figure is floated to a “floats only” page; since it contains a large image this is a reasonable solution; if the caption is pretty lengthy, the \meta{height correction} comes handy to fine tune the space necessary to the caption.
 %
-\item[\texttt{RF}] This fifth display mode refers to the Rotated Figure obtainable by means of the \pack{lscape} package; here the package is not used, but a direct rotation is performed by the macro. Again the \meta{height correction} optional value may be useful in order to leave more or less space to the caption; if the latter is pretty wordy, a smaller value of the preset 0.8 value mai be chosen, while for a single line caption a slightly higher value may be convenient.
+\item[\texttt{RF}] This fifth display mode refers to the Rotated Figure obtainable by means of the \pack{lscape} package; here the package is not used, but a direct rotation is performed by the macro. Again the \meta{height correction} optional value may be useful in order to leave more or less space to the caption; if the latter is pretty wordy, a smaller value of the preset 0.8 value may be chosen, while for single line captions a slightly higher value may be convenient.
 %
 \end{description}
 
@@ -269,6 +275,7 @@
 
 \DFimage[RF]{RFfakeimage}{A large Rotated Figure fake image}[fig:RFfake]
 
+\DFimage[VS]{VSSfake}{A tall very slim image}[fig:VSSfale](0.65)<2>
 As any dedicated reader can clearly see, the Ideal of
 practical reason is a representation of, as far as I know, the things
 in themselves; as I have shown elsewhere, the phenomena should only be

Modified: trunk/Master/texmf-dist/doc/latex/swfigure/swfigure.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/swfigure/swfigure.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/swfigure/swfigure.dtx	2020-10-13 20:52:08 UTC (rev 56650)
+++ trunk/Master/texmf-dist/source/latex/swfigure/swfigure.dtx	2020-10-13 20:52:25 UTC (rev 56651)
@@ -20,7 +20,7 @@
 
 This work is "maintained"
 
-This work consists of files swfigure.dtx and READEME.txt, and the derived
+This work consists of files swfigure.dtx and README.txt, and the derived
 files swfigure.sty and swfigure.pdf
 
 \endpostamble
@@ -45,7 +45,7 @@
 %<+package>\ProvidesPackage{swfigure}%
 %<+readme>File README.txt for package swfigure
 %<*package|readme>
-        [2020-10-11 v.0.9.07 Managing large and spread wide figures]
+        [2020-10-13 v.0.9.08 Managing large and spread wide figures]
 %</package|readme>
 %<*driver>
 \documentclass[a4paper]{ltxdoc}\errorcontextlines=9
@@ -222,7 +222,7 @@
 % with the following syntax:
 %\begin{ttsyntax}
 %\cs{DFimage}\oarg{display mode}\marg{image file name}\oarg{lof entry}\marg{caption}\oarg{label}\%
-%\qquad\parg{heigth correction}\aarg{line correction}
+%\qquad\parg{heigth correction}\aarg{line correction}|\meta{width test}|
 %\end{ttsyntax} 
 % where:
 %\begin{description}[noitemsep]
@@ -260,6 +260,16 @@
 % little vertical space around the image and its caption; by examining
 % the document drafts it is possible to increase or decrease the
 % vertical space by any (integer) number of lines.
+%\item[\meta{width test}] this further vertical bars delimited argument
+% is used only when dealing with vertical slim images; when they are
+% scaled down in order to fit in the available space, their width may
+% become too small to allow a decently typeset caption underneath the
+% image. A test is made to compare the scaled image width with a
+% fraction of the text block width in order to skip the image insertion
+% if the image width becomes too small; the default value for this
+% \meta{width test} fraction is \texttt{0.25}, but the user can specify
+% a different value, even zero; with the zero value the width test is
+% skipped.
 %\end{description}
 %
 %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -323,10 +333,12 @@
 % with different measure than normal text. Again it is up to the user
 % to chose where to insert the \cs{DFfigure} command. If the aspect
 % ratio of the image to include is lower than~2, this message is printed
-% in the document where the image should appear (of course with |#2| replaced by the actual image file name):
+% in the document where the image should appear (of course with |#1|
+% replaced by the actual image file name):\\
+%\begin{minipage}{0.7\textwidth}
 %\begin{verbatim}
 %      ===========================================
-%      Figure #2 is not tall enough.
+%      Figure #1 is not tall enough.
 %      Consider using a display mode different
 %      from VS; may be NF or RF are better suited.
 %      ===========================================
@@ -333,7 +345,10 @@
 %      Nothing done!
 %      ===========================================
 %\end{verbatim}
-%^^A
+%\end{minipage}\\[2ex]
+% A similar action and a similar message is output if the scaled image
+% width becomes too small.
+%
 %\end{description}
 %
 %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -348,6 +363,9 @@
 % me to submit the result to the \TeX\ community, and here it is.
 % Heinrich did not want his name as an author, because he insists
 % that he was “just” a tester. He was precious and I warmly thank him.
+% 
+% Thanks also to Benedict Wilde who spotted some errors and suggested
+% the use of a specific setting for the PDF viewer.
 %
 %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %\begin{thebibliography}{9}
@@ -404,7 +422,6 @@
 %\fi
 %    \begin{macrocode}
 \RequirePackage{etoolbox}
-\RequirePackage{xparse}
 \RequirePackage{xfp}
 
 \ExplSyntaxOn
@@ -425,7 +442,14 @@
 % we assign parameters relating to the page design. We also compute
 % the dimensions of the available spread space so as to have available
 % the elements to compare the aspect ratios of the images and of the
-% available spaces.
+% available spaces. The |\if at SWtmode| switch is used only by the |SW|
+% display mode in order to save the typesetting mode that was active
+% when the |\DFimage| command was used in the source file; if it was
+% in text mode, the switch is set to |true| and no spaces should be
+% present after the last argument of that macro; the result is that
+% the |\SWfigure| service macro shifts to vertical mode, but as soon
+% as it is completed the switch test restores the text mode.
+%
 %    \begin{macrocode}
 \newdimen\internalmargin 
 \internalmargin=\dimexpr\oddsidemargin+1in+1bp\relax
@@ -443,6 +467,7 @@
 \newsavebox\RFbox
 \newdimen\VS at textwidth
 \newcount\VS at lines
+\newif\if at SWtmode
 
 %    \end{macrocode}
 % The following caption-like command recompiles the captions within
@@ -494,7 +519,8 @@
 % that implement the various mode displays. It outputs an error
 % message if the \meta{display mode} acronym was misspelt. 
 %    \begin{macrocode}
-\NewDocumentEnvironment{DFimage}{O{SW} m O{#4} m o D(){0.8} D<>{0}}{%
+\NewDocumentEnvironment{DFimage}{%
+    O{SW} m O{#4} m o D(){0.8} D<>{0} D||{0.25}}{%
 \ifstrequal{#1}{SW}%
   {%
     \SWfigure{#2}[#3]{#4}[#5]%
@@ -509,7 +535,7 @@
       }%
       {\ifstrequal{#1}{VS}%
         {%
-          \VSfigure{#2}[#3]{#4}[#5](#6)<#7>%
+          \VSfigure{#2}[#3]{#4}[#5](#6)<#7>|#8|%
         }%
         {\ifstrequal{#1}{HS}
           {%
@@ -533,7 +559,7 @@
 % In the following subsection the five specific display mode macros
 % are examined and commented.
 %^^A=====================================
-% \subsection{The specific \cs{SWfigure} macro for Spread Wide images}
+% \subsection{The \cs{SWfigure} macro for Spread Wide images}
 %^^A=====================================
 %The specific macro for spread-wide images has the following syntax:
 %\begin{ttsyntax}
@@ -602,7 +628,10 @@
 % spread page, rotated $90^\circ$ counterclockwise.
 %    \begin{macrocode}
 \NewDocumentCommand\SWfigure{m O{#3} m o}{%
-\unless\ifvmode
+\ifvmode
+  \@SWtmodefalse
+\else
+  \@SWtmodetrue
   \csuse{@bsphack}%
   \vadjust{\vspace{0pt plus1fill}\csuse{@esphack}\newpage}%
 \fi
@@ -641,11 +670,11 @@
 \rotatebox[origin=tc]{90}{\DFcaption[#2]{#3}[#4]%
 %
 }}}}\vss}%
-\end{figure}\clearpage}
+\end{figure}\clearpage\if at SWtmode\noindent\fi}
 
 %    \end{macrocode}
 %^^A========================================
-%\subsection{The specific \cs{NFfigure} macro for normal full
+%\subsection{The \cs{NFfigure} macro for normal full
 % page figures}
 %^^A========================================
 % This code is without surprises, except that it receives from the
@@ -668,7 +697,7 @@
 
 %    \end{macrocode}
 %^^A========================================
-% \subsection{The specific \cs{RFfigure} macro for rotated figures}
+% \subsection{The \cs{RFfigure} macro for rotated figures}
 %^^A========================================
 % There are no new comments to make about this almost standard
 % way of displaying a large figure, except, perhaps, the fact
@@ -699,10 +728,10 @@
         
 %    \end{macrocode}
 %^^A========================================
-% \subsection{The specific \cs{VSfigure} macro for tall and slim figures}
+% \subsection{The \cs{VSfigure} macro for tall and slim figures}
 %^^A========================================
-% This is the most troublesome macro, because it needs to depend
-% on the |wrapfig| package, in order to set the image with its
+% This is the most critical macro (because it depends
+% on the |wrapfig| package) in order to set the image with its
 % caption on the external side of the text block, with the text flowing
 % around it. Package |wrapfig| has several limitations concerning
 % the text that flows around the image. Nevertheless with a “normal”
@@ -721,8 +750,23 @@
 % in the output document that informs the user and recommends to
 % use another \meta{display mode} acronym.
 %
+% Furthermore, should the image be very slim and tall, the 
+% \meta{height correction} may conveniently reduce its height,
+% but, in order to avoid changing its aspect ratio, it reduces
+% also its width; eventually the withs is reduced to the point that
+% beneath the image there would not be enough space for a decently
+% typeset caption. A further optional delimited argument is available:
+% its delimiting tokens are two vertical bars, \verb+| |+, and its
+% default value is \texttt{0.25}. This means that if the scaled
+% image becomes narrower than this coefficient times the text width,
+% an other message is typeset in place of the figure. Depending of the
+% various elements that influence these tests, the user can try
+% different values for this coefficient, even reaching the value zero,
+% that eliminates such test on the scaled image width.
+%
+%
 %    \begin{macrocode}
-\NewDocumentCommand\VSfigure{m O{#3} m o d() D<>{0}}{%
+\NewDocumentCommand\VSfigure{m O{#3} m o d() d<> d||}{%
    \setbox\DFtotalimage=\hbox{\includegraphics{#1}}
    \DFwidth=\wd\DFtotalimage \DFheight=\ht\DFtotalimage
    \edef\VS at aspectratio{\fpeval{\DFheight/\DFwidth}}
@@ -729,7 +773,7 @@
    \fptest{ \VS at aspectratio < 2 }%
      {\begin{center}\ttfamily
       ===========================================\\
-      Figure #2 is not tall enough.\\
+      Image \textit{#1} is not tall enough.\\
       Consider using a display mode different\\
       from VS; may be NF or RF are better suited.\\
       ===========================================\\
@@ -738,24 +782,38 @@
       \end{center}
      }%
      {\edef\VS at factor{\fpeval{#5\textheight/\DFheight}}%
-   \setbox\DFtotalimage=
-     \hbox{\scalebox{\VS at factor}{\box\DFtotalimage}}%
-   \edef\VS at width{\fpeval{\VS at factor*\DFwidth}\p@}%
-   \setbox\DFtotalimage=\vbox{\hsize=\VS at width%
-   \def\@captype{figure}\box\DFtotalimage
-   \caption[#2]{#3}%
-   \IfValueT{#4}{\label{#4}}\relax}
-   \VS at lines=
-   \fpeval{round(\ht\DFtotalimage/\baselineskip,0)+#6}%
-   \begin{wrapfigure}[\VS at lines]{O}[0pt]{\VS at width}%
-   \box\DFtotalimage
-   \end{wrapfigure}}%
-}
+      \fptest{\VS at factor>1 || \VS at factor\DFwidth < #7\textwidth}%
+       {%
+         \begin{center}\ttfamily
+         =================================================\\
+         The scaled image \textit{#1} is too slim.        \\
+         Maybe directly using the wrapfig package might   \\
+         solve this problem.                              \\
+         =================================================\\
+         Nothing done!\\
+         =================================================
+         \end{center}
+       }%
+       {\setbox\DFtotalimage=
+        \hbox{\scalebox{\VS at factor}{\box\DFtotalimage}}%
+        \edef\VS at width{\fpeval{\VS at factor*\DFwidth}\p@}%
+        \setbox\DFtotalimage=\vbox{\hsize=\VS at width%
+        \def\@captype{figure}\box\DFtotalimage
+        \caption[#2]{#3}%
+        \IfValueT{#4}{\label{#4}}\relax}
+        \VS at lines=
+        \fpeval{round(\ht\DFtotalimage/\baselineskip,0)+#6}%
+        \begin{wrapfigure}[\VS at lines]{O}[0pt]{\VS at width}%
+        \box\DFtotalimage
+        \end{wrapfigure}%
+      }%
+    }%
+  }%
 
 %    \end{macrocode}
 %
 %^^A=====================================
-% \subsection{The specific \cs{HSfigure} macro for spread wide slim
+% \subsection{The  \cs{HSfigure} macro for spread wide slim
 % figures}
 %^^A=====================================
 %

Modified: trunk/Master/texmf-dist/tex/latex/swfigure/swfigure.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/swfigure/swfigure.sty	2020-10-13 20:52:08 UTC (rev 56650)
+++ trunk/Master/texmf-dist/tex/latex/swfigure/swfigure.sty	2020-10-13 20:52:25 UTC (rev 56651)
@@ -11,9 +11,8 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[2020/01/01]
 \ProvidesPackage{swfigure}%
-        [2020-10-11 v.0.9.07 Managing large and spread wide figures]
+        [2020-10-13 v.0.9.08 Managing large and spread wide figures]
 \RequirePackage{etoolbox}
-\RequirePackage{xparse}
 \RequirePackage{xfp}
 
 \ExplSyntaxOn
@@ -44,6 +43,7 @@
 \newsavebox\RFbox
 \newdimen\VS at textwidth
 \newcount\VS at lines
+\newif\if at SWtmode
 
 \NewDocumentCommand\DFcaption{O{#2} m o}{\refstepcounter{figure}%
   \vtop to 0pt{\hsize=\textheight\parindent=0pt\leavevmode
@@ -54,7 +54,8 @@
 
 \DeclareRobustCommand\cleartoevenpage{%
   \clearpage\ifodd\value{page}\null\clearpage\fi}
-\NewDocumentEnvironment{DFimage}{O{SW} m O{#4} m o D(){0.8} D<>{0}}{%
+\NewDocumentEnvironment{DFimage}{%
+    O{SW} m O{#4} m o D(){0.8} D<>{0} D||{0.25}}{%
 \ifstrequal{#1}{SW}%
   {%
     \SWfigure{#2}[#3]{#4}[#5]%
@@ -69,7 +70,7 @@
       }%
       {\ifstrequal{#1}{VS}%
         {%
-          \VSfigure{#2}[#3]{#4}[#5](#6)<#7>%
+          \VSfigure{#2}[#3]{#4}[#5](#6)<#7>|#8|%
         }%
         {\ifstrequal{#1}{HS}
           {%
@@ -90,7 +91,10 @@
 }%
 
 \NewDocumentCommand\SWfigure{m O{#3} m o}{%
-\unless\ifvmode
+\ifvmode
+  \@SWtmodefalse
+\else
+  \@SWtmodetrue
   \csuse{@bsphack}%
   \vadjust{\vspace{0pt plus1fill}\csuse{@esphack}\newpage}%
 \fi
@@ -120,7 +124,7 @@
 \makebox(0,0)[lb]{\hspace*{1em}\raisebox{0.5\textheight}{%
 \rotatebox[origin=tc]{90}{\DFcaption[#2]{#3}[#4]%
 }}}}\vss}%
-\end{figure}\clearpage}
+\end{figure}\clearpage\if at SWtmode\noindent\fi}
 
 \NewDocumentCommand\NFfigure{m O{#3} m o d()}{%
   \begin{figure}[p]
@@ -147,7 +151,7 @@
           {\scalebox{\RFy}{\box\RFbox}}%
         \endfigure}
 
-\NewDocumentCommand\VSfigure{m O{#3} m o d() D<>{0}}{%
+\NewDocumentCommand\VSfigure{m O{#3} m o d() d<> d||}{%
    \setbox\DFtotalimage=\hbox{\includegraphics{#1}}
    \DFwidth=\wd\DFtotalimage \DFheight=\ht\DFtotalimage
    \edef\VS at aspectratio{\fpeval{\DFheight/\DFwidth}}
@@ -154,7 +158,7 @@
    \fptest{ \VS at aspectratio < 2 }%
      {\begin{center}\ttfamily
       ===========================================\\
-      Figure #2 is not tall enough.\\
+      Image \textit{#1} is not tall enough.\\
       Consider using a display mode different\\
       from VS; may be NF or RF are better suited.\\
       ===========================================\\
@@ -163,19 +167,33 @@
       \end{center}
      }%
      {\edef\VS at factor{\fpeval{#5\textheight/\DFheight}}%
-   \setbox\DFtotalimage=
-     \hbox{\scalebox{\VS at factor}{\box\DFtotalimage}}%
-   \edef\VS at width{\fpeval{\VS at factor*\DFwidth}\p@}%
-   \setbox\DFtotalimage=\vbox{\hsize=\VS at width%
-   \def\@captype{figure}\box\DFtotalimage
-   \caption[#2]{#3}%
-   \IfValueT{#4}{\label{#4}}\relax}
-   \VS at lines=
-   \fpeval{round(\ht\DFtotalimage/\baselineskip,0)+#6}%
-   \begin{wrapfigure}[\VS at lines]{O}[0pt]{\VS at width}%
-   \box\DFtotalimage
-   \end{wrapfigure}}%
-}
+      \fptest{\VS at factor>1 || \VS at factor\DFwidth < #7\textwidth}%
+       {%
+         \begin{center}\ttfamily
+         =================================================\\
+         The scaled image \textit{#1} is too slim.        \\
+         Maybe directly using the wrapfig package might   \\
+         solve this problem.                              \\
+         =================================================\\
+         Nothing done!\\
+         =================================================
+         \end{center}
+       }%
+       {\setbox\DFtotalimage=
+        \hbox{\scalebox{\VS at factor}{\box\DFtotalimage}}%
+        \edef\VS at width{\fpeval{\VS at factor*\DFwidth}\p@}%
+        \setbox\DFtotalimage=\vbox{\hsize=\VS at width%
+        \def\@captype{figure}\box\DFtotalimage
+        \caption[#2]{#3}%
+        \IfValueT{#4}{\label{#4}}\relax}
+        \VS at lines=
+        \fpeval{round(\ht\DFtotalimage/\baselineskip,0)+#6}%
+        \begin{wrapfigure}[\VS at lines]{O}[0pt]{\VS at width}%
+        \box\DFtotalimage
+        \end{wrapfigure}%
+      }%
+    }%
+  }%
 
 \NewDocumentCommand\HSfigure{m o m o d()}{%
   \unless\ifvmode
@@ -227,7 +245,7 @@
 %% 
 %% This work is "maintained"
 %% 
-%% This work consists of files swfigure.dtx and READEME.txt, and the derived
+%% This work consists of files swfigure.dtx and README.txt, and the derived
 %% files swfigure.sty and swfigure.pdf
 %% 
 %%



More information about the tex-live-commits mailing list.