summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/swfigure/README.txt34
-rw-r--r--Master/texmf-dist/doc/latex/swfigure/VSSfake.jpgbin0 -> 81784 bytes
-rw-r--r--Master/texmf-dist/doc/latex/swfigure/swfigure-examples.pdfbin547330 -> 593358 bytes
-rw-r--r--Master/texmf-dist/doc/latex/swfigure/swfigure-examples.tex37
-rw-r--r--Master/texmf-dist/doc/latex/swfigure/swfigure.pdfbin456448 -> 456490 bytes
-rw-r--r--Master/texmf-dist/source/latex/swfigure/swfigure.dtx183
-rw-r--r--Master/texmf-dist/tex/latex/swfigure/swfigure.sty67
7 files changed, 164 insertions, 157 deletions
diff --git a/Master/texmf-dist/doc/latex/swfigure/README.txt b/Master/texmf-dist/doc/latex/swfigure/README.txt
index d92234b94d4..50131c97c3c 100644
--- a/Master/texmf-dist/doc/latex/swfigure/README.txt
+++ b/Master/texmf-dist/doc/latex/swfigure/README.txt
@@ -2,31 +2,29 @@
%% This is file `README.txt',
%% generated with the docstrip utility.
%%
-%% The original source files were:
-%%
-%% swfigure.dtx (with options: `readme')
-%%
%% Copyright (C) 2020 Claudio Beccari all rights reserved.
%% License information appended
%%
File README.txt for package swfigure
- [2020-10-13 v.0.9.08 Managing large and spread wide figures]
-This bundle contains file the swfigure.dtx and README.txt files.
+ [2020-10-18 v.0.9.11 Managing large and spread wide figures]
+This bundle contains the swfigure.dtx, swfigure-examples.tex,
+and README.txt files plus six fake figures with extension .jpg.
This file README.txt contains the licence, the status, and some
-general information. Save both in a .../source/latex/swfigure
-folder either in the main TeX system tree or in your personal
-tree.
+general information. Save the README.txt and swfigure.dtx file
+in a .../source/latex/swfigure folder either in the main TeX
+system tree or in your personal tree.
+Save the swfigure-examples.tex, the derived swfigures-examples.pdf,
+and the six .jpg files in folder .../doc/latex/swfigure.
-This swfigure.dtx file is a self extracting documented one.
-Run pdfLaTeX at least twice on this file in order to get all
-references correct, and you obtain the swfigure.pdf and the
-swfigure.sty files. After extraction move the .sty file to
-the .../tex/latex/swfigure folder, and move the .pdf file to
-the .../doc/latex/swfigure folder. From the original folder
-.../source/latex/swfigure move all files, except the .dtx and
-the .txt files, to the bin.
+Process the self extracting swfigure.dtx file with pdfLaTeX;
+repeat at least twice in order to get all references correct;
+you obtain the swfigure.pdf and the swfigure.sty files.
+After extraction move the .sty file to the .../tex/latex/swfigure
+folder, and move the .pdf file to the .../doc/latex/swfigure folder.
+From the original folder .../source/latex/swfigure move to the bin
+all files except the .dtx and the .txt ones.
The author disclaims any liability from every possible inconvenience
deriving from the use of this software; you use it at your own risk.
@@ -41,5 +39,3 @@ deriving from the use of this software; you use it at your own risk.
%% This work consists of files swfigure.dtx and READEME.txt, and the
%% derived files swfigure.sty and swfigure.pdf
%%
-%%
-%% End of file `README.txt'.
diff --git a/Master/texmf-dist/doc/latex/swfigure/VSSfake.jpg b/Master/texmf-dist/doc/latex/swfigure/VSSfake.jpg
new file mode 100644
index 00000000000..62119aedba7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/swfigure/VSSfake.jpg
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.pdf b/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.pdf
index 3cb6b772f8b..e20f001fd6a 100644
--- a/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.pdf
+++ b/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.tex b/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.tex
index b16d24431c7..b37eea4bc9f 100644
--- a/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.tex
+++ b/Master/texmf-dist/doc/latex/swfigure/swfigure-examples.tex
@@ -8,7 +8,7 @@
\providecommand*\diff{\mathop{}\!\mathrm{d}}
\providecommand\cs{}
- \renewcommand\cs[1]{\normalfont{\texttt{\char92#1}}}
+ \renewcommand\cs[1]{{\normalfont{\texttt{\char92#1}}}}
\providecommand\meta{}
\renewcommand\meta[1]{{\normalfont\textlangle\textit{#1}\textrangle}}
\providecommand\marg{}
@@ -60,10 +60,10 @@
\counterwithout{section}{chapter}
-\begin{document}
+\begin{document}\frenchspacing
\GetFileInfo{swfigure.sty}
\title{The \pack{swfigure} package --- Usage examples}
-\author{Claudio Beccari\thanks{Email: \texttt{claudio dot beccari at gmail dot com}}}
+\author{Claudio Beccari\qquad\texttt{\texttt{claudio dot beccari at gmail dot com}}}
\date{Version \fileversion~---~ Last revised \filedate}
\maketitle
@@ -83,25 +83,25 @@ As far as we can say, we know that Preview.app on Macs does not use any gap. Oku
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]%
+\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
+\begin{ttsyntax}\setfontsize{9.85}%
... takes
-\cs{DFimage}Oarg{SW}\Marg{SWfakeimage}\Marg{A Spread Wide fake image}\Oarg{fig:SWfake}%
+\cs{DFimage}\Oarg{SW}\Marg{SWfakeimage}\Marg{A Spread Wide fake image}\Oarg{fig:SWfake}\%
place ...
-\end{flushleft}
+\end{ttsyntax}
-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.
+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; those sentences appear as translations of Immanuel Kant's philosophic theories, although we doubt that he wrote those very texts.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The user macro}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The only user macro defined by this package has the following syntax:
-\begin{ttsyntax}
+\begin{ttsyntax}\setfontsize{9.5}%
\cs{DFimage}\oarg{display mode}\marg{image file name}\oarg{lof entry}\%
-\qquad\marg{caption}\oarg{label}\parg{height correction}\aarg{line correction}
+\qquad\marg{caption}\oarg{label}\parg{height correction}\aarg{line correction}|\meta{width test}|
\end{ttsyntax}
The arguments are described in detail in the twin document \file{swfigure.pdf}. We shortly repeat their meanings.
\begin{description}[noitemsep]
@@ -118,16 +118,17 @@ The arguments are described in detail in the twin document \file{swfigure.pdf}.
%
\item[\meta{height correction}] is an optional argument with a preset value of 0.8, it reduces the image height by that value, in order to assure that the figure has enough space for the image and its caption; if captions are not “narrative” (too many sentences) the value of 0.8 should be suited in most cases; the user, while revising the document drafts might decide to use a different value, of course always not greater than~1. This correction may be used with some display modes that concern only one page, not a full spread.
%
-\item[\meta{line correction}] This optional integer number may correct the number of lines of the indention of the wrapping text around a tall and slim figure.
+\item[\meta{line correction}] This optional integer number may correct the number of lines of the indentation of the wrapping text around a tall and slim figure.
%
+\item[\meta{width test}] is an optional fractional number smaller than~0.5 (default \texttt{0.25}) used to check that in Vertical Slim mode the width of the scaled image does not get too small so as to leave sufficient space for e decently typeset caption; the zero value implies no test. See in page~\pageref{fig:VSSmessage} the message that is output if this width becomes too small.
\end{description}
We stress the first optional argument meaning, whose default value is \texttt{SW}. It specifies the \meta{display mode}.
\begin{description}[noitemsep]
%
-\item[\texttt{SW}] is the acronym that specifies the \meta{display mode} for a Spread Wide figure; it consists into a full spread, without any text, and with its caption typeset in the external margin of the odd numbered page in a vertical fashion. Since this display mode needs to start on an even page, the user should carefully find the proper place where to insert the user macro \cs{DGimage} (named as “steering” macro, since it decides which large figure style to use), because it starts a new page and possibly inserts a blank page if the new one is odd numbered.
+\item[\texttt{SW}] is the acronym that specifies the \meta{display mode} for a Spread Wide figure; it consists into a full spread, without any text, and with its caption typeset in the external margin of the odd numbered page typeset in vertical mode. Since this display mode needs to start on an even page, the user should carefully find the proper place where to insert the user macro \cs{DFimage} (named as “steering” macro, since it decides which large figure style to use), because it starts a new page and possibly inserts a blank page if the new one is odd numbered. The steering macro can be also inserted within a paragraph\footnote{remeber to leave a space before \cs{DFimage} and no space after the last argument.}, and after its complete expansion restores the vertical mode; nevertheless, even so, it may insert a blank page if the next page is odd numbered.
%
-\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{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 below the right half, the space occupied by this part of the image would be 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) 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}.
%
@@ -147,7 +148,11 @@ 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
used as a canon for our understanding. The paralogisms of practical
reason are what first give rise to the architectonic of practical
-reason. As will easily be shown in the next section, reason would
+reason.
+
+\DFimage[HS]{HSfakeimage}{A Horizontal Slim fake image}[fig:HSfake]
+
+As will easily be shown in the next section, reason would
thereby be made to contradict, in view of these considerations, the
Ideal of practical reason, yet the manifold depends on the phenomena.
Necessity depends on, when thus treated as the practical employment of
@@ -156,8 +161,6 @@ Human reason depends on our sense perceptions, by means of analytic
unity. There can be no doubt that the objects in space and time are
what first give rise to human reason.
-\DFimage[HS]{HSfakeimage}{A Horizontal Slim fake image}[fig:HSfake]
-
Let us suppose that the noumena have nothing to do
with necessity, since knowledge of the Categories is a
posteriori. Hume tells us that the transcendental unity of
@@ -275,7 +278,6 @@ absolved.
\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
@@ -338,6 +340,7 @@ This could not be passed over in a complete system of transcendental
philosophy, but in a merely critical essay the simple mention of the
fact may suffice.
+\DFimage[VS]{VSSfake}{A tall very slim image}[fig:VSSfake](0.65)<2>\label{fig:VSSmessage}
Therefore, we can deduce that the objects in space and
time (and I assert, however, that this is the case) have lying before
them the objects in space and time. Because of our necessary ignorance
diff --git a/Master/texmf-dist/doc/latex/swfigure/swfigure.pdf b/Master/texmf-dist/doc/latex/swfigure/swfigure.pdf
index bf2200369fa..b0501e26b61 100644
--- a/Master/texmf-dist/doc/latex/swfigure/swfigure.pdf
+++ b/Master/texmf-dist/doc/latex/swfigure/swfigure.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/swfigure/swfigure.dtx b/Master/texmf-dist/source/latex/swfigure/swfigure.dtx
index 4629fb398ce..5da66dfc6f4 100644
--- a/Master/texmf-dist/source/latex/swfigure/swfigure.dtx
+++ b/Master/texmf-dist/source/latex/swfigure/swfigure.dtx
@@ -4,7 +4,7 @@
%<*internal>
\begingroup
\input docstrip.tex
-\keepsilent
+%\keepsilent
\preamble
Copyright (C) 2020 Claudio Beccari all rights reserved.
@@ -45,7 +45,7 @@ files swfigure.sty and swfigure.pdf
%<+package>\ProvidesPackage{swfigure}%
%<+readme>File README.txt for package swfigure
%<*package|readme>
- [2020-10-13 v.0.9.08 Managing large and spread wide figures]
+ [2020-10-18 v.0.9.11 Managing large and spread wide figures]
%</package|readme>
%<*driver>
\documentclass[a4paper]{ltxdoc}\errorcontextlines=9
@@ -102,7 +102,7 @@ Managing large and spread wide figures}
\end{document}
%</driver>
% \fi
-%^^A \CheckSum{10}^^A Doesn't this work any more?
+% \CheckSum{10}^^A Doesn't this work any more?
%
% \begin{abstract}
% This package defines a single command that with different options can
@@ -116,8 +116,6 @@ Managing large and spread wide figures}
% uses.
% \end{abstract}
%
-%^^A \DFimage[SW]{SWfakeimage}{A large fake image}[fig:SWfake]
-%^^A It does not work with the page design of this document.
%
%^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section{Introduction}
@@ -203,7 +201,7 @@ Managing large and spread wide figures}
% the |swfigure.zip| file from the Comprehensive \TeX\ Archive Network
% (CTAN), and decompress it either in the very folder where there is
% the document main or single document file or, for a general use, in
-% the user personal |texmf| tree; it is possible that the user should
+% the user |texmf| personal tree; it is possible that the user should
% directly create this personal tree; how to do it is described in the
% documentation of the user \TeX\ system distribution.
%
@@ -232,7 +230,7 @@ Managing large and spread wide figures}
% \texttt{SW} (Spread Wide image), \texttt{HS} (Horizontal Spread-wide
% image), and \texttt{VS} (Vertical Slim image).
%\item[\meta{image fie name}]
-% Is the name of the image graphic file; remember that the \LaTeX based
+% is the name of the image graphic file; remember that the \LaTeX based
% \TeX\ system typesetting programs accept graphic files in the formats
% with extensions \texttt{.pdf}, \texttt{.eps}, \texttt{.jpg},
% \texttt{.png}, and few other less common ones. It is not necessary to
@@ -242,14 +240,14 @@ Managing large and spread wide figures}
% \meta{caption} text, but if the latter is sort of lengthy, it is
% better to enter a shorter text in that list.
%\item[\meta{caption}]
-% is the caption text.
+% is the caption text.
%\item[\meta{label}]
-% this optional argument is the string that forms the argument of the
-% \cs{label} command; of course, if this argument is not specified,
-% the figure number and its page cannot be referenced with \cs{ref},
-% \cs{pageref} and other similar commands.
+% this optional argument is the string that forms the \cs{label} command
+% argument; of course, if this argument is not specified, the figure
+% number and its page cannot be referenced with \cs{ref}, \cs{pageref}
+% and other similar commands.
%\item[\meta{height correction}]
-% This normal parenthesis delimited optional argument is a fractional
+% is a round parenthesis delimited optional argument; it is a fractional
% number lower than~1 (default 0.8) with which to further scale the
% scaled image height to be included; it is used by some display modes,
% and it is ignored by others.
@@ -263,7 +261,7 @@ Managing large and spread wide figures}
%\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
+% become too small to allow a decently typeset caption below 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
@@ -287,33 +285,28 @@ Managing large and spread wide figures}
% does not know in advance the vertical space occupied by the caption,
% therefore the optional \meta{height correction} comes handy for
% small adjustments; this display mode is fully and freely floating,
-% although its positioning is fixed to~|[p]|.
+% although its positioning is fixed to~|[p]|, full only-float page.
%
%\item[\texttt{RF}]
% This display mode is convenient when the image
% aspect ratio is close to the reciprocal of the text block one. This
% mode accepts the \meta{height correction} in order to leave space
-% to the caption. It is a fully and freely floating object with the
+% for the caption. It is a fully and freely floating object with the
% same pros and cons as the \texttt{NF} display mode.
%
%\item[\texttt{SW}]
% This display mode is convenient when a really large
% image requires two pages to display all its details; its aspect ratio
-% should be close to the two page aspect ratio of the total space
+% should be close to the aspect ratio of the total space
% available for the two page spread; depending on the page design this
-% total space approximate value probably is close to~0.5.
+% total space approximate value is probably around~0.5.
% The object to be included in the document should start on an even
-% page, therefore it moves to the first even page available; this
-% implies that the last document page before the spread wide image
-% may be blank or may be shorter than the other text pages; the user
+% page, therefore it floats to the first even page available; this may
+% force a page break where the current page is not fully completed and
+% may be shorter than the other text pages; the user
% then should help the automatic positioning by choosing very carefully
-% where to insert the \cs{DFfigure} command in the source text; it can
-% even set it within a paragraph and the command provides a new page
-% just after the line that contains the \cs{DFfigure} command;
-% therefore if the paragraph is close to the end of an odd page and
-% the position of \cs{DFfigure} command is properly positioned within this
-% paragraph, the spread wide insertion would not disturb the quality
-% of the typeset document.
+% where to insert the \cs{DFfigure} command in the source text; possibly
+% the user should chose an end of paragraph close to the end of a page.
%
%\item[\texttt{HS}]
% This display mode is convenient when the initial image aspect
@@ -326,13 +319,13 @@ Managing large and spread wide figures}
%\item[\texttt{VS}]
% This mode is convenient for tall and slim figures with aspect ratio
% not lower than~2; but for obvious reasons, it should not be too
-% large, let's say not higher than about~3. As always this depends on
+% large, let's say not higher than about~3 or~4. As always this depends on
% the page design and the caption size. The limitations of the
-% underlying of the |wrapfig| package forbids its usage too close to
-% section headings, explicit lists and texts typeset in special modes
-% 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
+% underlying |wrapfig| package forbids its usage too close to
+% explicit lists and texts typeset in special modes with a 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 |#1|
% replaced by the actual image file name):\\
%\begin{minipage}{0.7\textwidth}
@@ -490,16 +483,35 @@ Managing large and spread wide figures}
}
% \end{macrocode}
-% The |\cleartoevenpage| command may already exist in the document class.
+% The |\cleartoeven| command may already exist in the document class.
% We prefer to make an absolute redefinition so as to be sure that it
-% performs as we need in this package. We tested with the |memoir|
-% class that already has such a command, and no problems were found
+% performs as we need in this package. In any case this new definition
+% may be used in such a way that the |\DFimage| user command may be used
+% also while typesetting in text mode, resuming text mode after complete
+% expansion. This is useful, especially for spread wide display modes,
+% to chose the most suitable place in the suorce file to place the
+% |\DFimace| command with its arguments; only with the |SW| mode it
+% is necessary to avoid any space after the last macro argument and the
+% text that follows it.
%
% \begin{macrocode}
-\DeclareRobustCommand\cleartoevenpage{%
- \clearpage\ifodd\value{page}\null\clearpage\fi}
+\newcommand\set@tmode@newpage{%
+\ifvmode
+ \@SWtmodefalse
+\else
+ \@SWtmodetrue
+ \@bsphack\vadjust{\vspace{0pt plus1fill}\@esphack\newpage}%
+\fi}
+
+\newcommand\reset@tmode{\if@SWtmode\expandafter\noindent\ignorespaces\fi}
+
+\NewDocumentCommand\cleartoeven{ o }{%
+ \IfValueTF{#1}%
+ {\set@tmode@newpage
+ \ifodd\value{page}\afterpage{#1}\else#1\fi}%
+ {\ifodd\value{page}\null\clearpage\fi}}
+
% \end{macrocode}
-%
% Now we define the “real” user macro necessary to chose the
% \meta{display mode} and the various parameters necessary for the
% desired one. See section~\ref{sec:Usage} on page\pageref{sec:Usage}
@@ -544,9 +556,9 @@ Managing large and spread wide figures}
{\PackageWarning{swfigure}%
{%
**************************************\MessageBreak
- Option #1\space is not valid \MessageBreak
- Nothing done \MessageBreak
- Image #2\space was not processed \MessageBreak
+ Option #1\space is not valid \MessageBreak
+ Nothing done \MessageBreak
+ Image #2\space was not processed \MessageBreak
**************************************\MessageBreak}%
}%
}%
@@ -556,7 +568,7 @@ Managing large and spread wide figures}
}%
% \end{macrocode}
-% In the following subsection the five specific display mode macros
+% In the following subsections the five specific display mode macros
% are examined and commented.
%^^A=====================================
% \subsection{The \cs{SWfigure} macro for Spread Wide images}
@@ -567,35 +579,34 @@ Managing large and spread wide figures}
%\end{ttsyntax}
% The various arguments have already been described; as you see the
% \meta{display mode} argument is not there anymore, as well as the
-% last two optional arguments of |\DFfigure|.
-%
-% The working strategy is the following: first the typesetting mode is
-% tested and, in case, a filling of the current line is
-% performed and, by means of a |\vadjust| \TeX\ native macro, a
-% |\newpage| command is executed; in any case a |\cleartoevenpapge|
-% is executed so as to be sure to start any action while an even page
-% is being processed. Then the initial image to be divided in two
-% halves is stored in a box; this box is examined in order
+% last two optional arguments of |\DFfigure|.Notice that the
+% \meta{caption} text, the third argument of this macro, is used also
+% to initialise the \meta{lof entry}, so that if the user doe not
+% specify such short caption entry, the default is identica to the
+% full caption.
+%
+% The working strategy is the following: the initial image to be divided
+% in two halves is stored in a box; this box is examined in order
% to find its total width and heigh, so as to be able to compute the
% aspect ratio. All other dimensions are examined to have available
% all the necessary data to display the image halves in the requested
% way.
%
% Notice that the |trim| option to |\includegraphics|, used to
-% divide the initial image in two exact halves, (apparently) must
+% divide the initial image in two exact halves, maybe should
% be used without specifying other options; but, most important,
-% it requires real numbers, not macros; therefore we have to make
+% it requires actual numbers, not macros; therefore we have to make
% use of the usual dirty trick of defining an expanded macro
% |\x| within a group that the macro itself closes upon its
-% expansion; in this way the principal part of the |\includegraphics|
+% expansion; in this way the optional argument of the |\includegraphics|
% macro contains only keywords and numbers and may be executed
% without errors.
%
% Let $W$ be the total spread width and $w$ be the initial image
% width; let $H$ be the text height and $h$ the initial image height;
% compute the $A_\mathrm{W}$ to be the aspect ratio of the spread
-% available space $H/W$. Similarly let $A_\mathrm{fig}$ aspect
-% ratio of the initial image; we have to scale the image with a
+% available space $H/W$. Similarly let $A_\mathrm{fig}$ be the initial
+% image aspect ratio; we have to scale the image with a
% scaling factor such that the image keeps its aspect ratio, but
% its scaled height does not exceed the text block height, and
% its scaled width does not exceed the spread width; of course the
@@ -615,27 +626,21 @@ Managing large and spread wide figures}
%\label{equ:ScalingFactor}
%\end{equation}
% This choice is made by testing the various ratios by means of
-% the L3 |\fptest| macro, that computes such ratios and compares them.
-% The commented line below shows exactly which lengths are used to
-% compute the ratios, and which comparison is executed. Once the
+% the L3 |\fptest| function, that computes such ratios and compares them.
+% The \meta{test} shows exactly which lengths are used to
+% compute the ratios, and which comparison is executed; the commented
+% line over the |\fptest| macro emphasises this correspondence. Once the
% scaling factors are found the boxes containing the half figures
% are scaled and further on are inserted in floating figure
-% environments; we use another dirty trick of matrioska dolls; this
+% environments; we use une of the dirty tricks: the matrioska dolls; this
% metaphor describes nested |\makeboxe|s used to mask their actual
-% widths, but capable to push the images towards the spread
-% spine.
+% widths, but capable to push the images towards the spread spine.
% Eventually the caption is set in the right margin of the right
% spread page, rotated $90^\circ$ counterclockwise.
+% The |cleartoeven| guaranties that the first float is set into an even
+% numbered page. A final |\clearpage| ensures that both floats are output.
% \begin{macrocode}
\NewDocumentCommand\SWfigure{m O{#3} m o}{%
-\ifvmode
- \@SWtmodefalse
-\else
- \@SWtmodetrue
- \csuse{@bsphack}%
- \vadjust{\vspace{0pt plus1fill}\csuse{@esphack}\newpage}%
-\fi
-\cleartoevenpage
\setbox\DFtotalimage=\hbox{\includegraphics{#1}}%
\DFwidth=\wd\DFtotalimage \DFhalfwidth=0.5\DFwidth
\DFheight=\ht\DFtotalimage
@@ -657,20 +662,22 @@ trim = \the\DFhalfwidth\space 0 0 0]}\x{#1}}%
\setbox\DFimageI=\hbox{\scalebox{\DFscalefactor}{\usebox{\DFimageI}}}%
\setbox\DFimageII=\hbox{\scalebox{\DFscalefactor}{\usebox{\DFimageII}}}%
%
-\begin{figure}[p]%
-\vbox to\textheight{\vss\hsize=\textwidth%\
-\makebox[\hsize][l]{\makebox[\FigSpace][r]{\box\DFimageI}}\vss}%
-\end{figure}\clearpage
+\cleartoeven[%
+ \begin{figure}[p]%
+ \vbox to\textheight{\vss\hsize=\textwidth%\
+ \makebox[\hsize][l]{\makebox[\FigSpace][r]{\box\DFimageI}}\vss}%
+ \end{figure}\clearpage
%
-\begin{figure}[p]%
-\vbox to\textheight{\vss\hsize=\textwidth
-\makebox[\hsize][r]{\makebox[\FigSpace][l]{\box\DFimageII}%
+ \begin{figure}[p]%
+ \vbox to\textheight{\vss\hsize=\textwidth
+ \makebox[\hsize][r]{\makebox[\FigSpace][l]{\box\DFimageII}%
% Rotated caption in the right page
-\makebox(0,0)[lb]{\hspace*{1em}\raisebox{0.5\textheight}{%
-\rotatebox[origin=tc]{90}{\DFcaption[#2]{#3}[#4]%
-%
-}}}}\vss}%
-\end{figure}\clearpage\if@SWtmode\noindent\fi}
+ \makebox(0,0)[lb]{\hspace*{1em}\raisebox{0.5\textheight}{%
+ \rotatebox[origin=tc]{90}{\DFcaption[#2]{#3}[#4]%
+ %
+ }}}}\vss}%
+ \end{figure}%
+]\clearpage\reset@tmode}
% \end{macrocode}
%^^A========================================
@@ -830,14 +837,10 @@ trim = \the\DFhalfwidth\space 0 0 0]}\x{#1}}%
% the same hight and depth as the right page one.
% \begin{macrocode}
\NewDocumentCommand\HSfigure{m o m o d()}{%
- \unless\ifvmode
- \csuse{@bsphack}%
- \vadjust{\vspace{0pt plus1fill}\csuse{@esphack}\newpage}%
- \fi
- \cleartoevenpage
+ \cleartoeven
\setbox\DFtotalimage=\hbox{\includegraphics{#1}}
\DFwidth=\wd\DFtotalimage \DFhalfwidth=0.5\DFwidth
- \FigSpace=0.5\spreadwidth% W
+ \FigSpace=0.5\spreadwidth%
%
\setbox\DFimageI\hbox{\bgroup
\edef\x{\egroup\noexpand\includegraphics*[%
diff --git a/Master/texmf-dist/tex/latex/swfigure/swfigure.sty b/Master/texmf-dist/tex/latex/swfigure/swfigure.sty
index 8b6fdca0b9b..a12aaee0882 100644
--- a/Master/texmf-dist/tex/latex/swfigure/swfigure.sty
+++ b/Master/texmf-dist/tex/latex/swfigure/swfigure.sty
@@ -11,7 +11,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2020/01/01]
\ProvidesPackage{swfigure}%
- [2020-10-13 v.0.9.08 Managing large and spread wide figures]
+ [2020-10-18 v.0.9.11 Managing large and spread wide figures]
\RequirePackage{etoolbox}
\RequirePackage{xfp}
@@ -52,8 +52,22 @@
\IfValueT{#3}{\label{#3}}\relax%
}
-\DeclareRobustCommand\cleartoevenpage{%
- \clearpage\ifodd\value{page}\null\clearpage\fi}
+\newcommand\set@tmode@newpage{%
+\ifvmode
+ \@SWtmodefalse
+\else
+ \@SWtmodetrue
+ \@bsphack\vadjust{\vspace{0pt plus1fill}\@esphack\newpage}%
+\fi}
+
+\newcommand\reset@tmode{\if@SWtmode\expandafter\noindent\ignorespaces\fi}
+
+\NewDocumentCommand\cleartoeven{ o }{%
+ \IfValueTF{#1}%
+ {\set@tmode@newpage
+ \ifodd\value{page}\afterpage{#1}\else#1\fi}%
+ {\ifodd\value{page}\null\clearpage\fi}}
+
\NewDocumentEnvironment{DFimage}{%
O{SW} m O{#4} m o D(){0.8} D<>{0} D||{0.25}}{%
\ifstrequal{#1}{SW}%
@@ -79,9 +93,9 @@
{\PackageWarning{swfigure}%
{%
**************************************\MessageBreak
- Option #1\space is not valid \MessageBreak
- Nothing done \MessageBreak
- Image #2\space was not processed \MessageBreak
+ Option #1\space is not valid \MessageBreak
+ Nothing done \MessageBreak
+ Image #2\space was not processed \MessageBreak
**************************************\MessageBreak}%
}%
}%
@@ -91,14 +105,6 @@
}%
\NewDocumentCommand\SWfigure{m O{#3} m o}{%
-\ifvmode
- \@SWtmodefalse
-\else
- \@SWtmodetrue
- \csuse{@bsphack}%
- \vadjust{\vspace{0pt plus1fill}\csuse{@esphack}\newpage}%
-\fi
-\cleartoevenpage
\setbox\DFtotalimage=\hbox{\includegraphics{#1}}%
\DFwidth=\wd\DFtotalimage \DFhalfwidth=0.5\DFwidth
\DFheight=\ht\DFtotalimage
@@ -114,17 +120,20 @@ trim = \the\DFhalfwidth\space 0 0 0]}\x{#1}}%
{\edef\DFscalefactor{\fpeval{\FigSpace/\DFhalfwidth}}}%
\setbox\DFimageI=\hbox{\scalebox{\DFscalefactor}{\usebox{\DFimageI}}}%
\setbox\DFimageII=\hbox{\scalebox{\DFscalefactor}{\usebox{\DFimageII}}}%
-\begin{figure}[p]%
-\vbox to\textheight{\vss\hsize=\textwidth%\
-\makebox[\hsize][l]{\makebox[\FigSpace][r]{\box\DFimageI}}\vss}%
-\end{figure}\clearpage
-\begin{figure}[p]%
-\vbox to\textheight{\vss\hsize=\textwidth
-\makebox[\hsize][r]{\makebox[\FigSpace][l]{\box\DFimageII}%
-\makebox(0,0)[lb]{\hspace*{1em}\raisebox{0.5\textheight}{%
-\rotatebox[origin=tc]{90}{\DFcaption[#2]{#3}[#4]%
-}}}}\vss}%
-\end{figure}\clearpage\if@SWtmode\noindent\fi}
+\cleartoeven[%
+ \begin{figure}[p]%
+ \vbox to\textheight{\vss\hsize=\textwidth%\
+ \makebox[\hsize][l]{\makebox[\FigSpace][r]{\box\DFimageI}}\vss}%
+ \end{figure}\clearpage
+ \begin{figure}[p]%
+ \vbox to\textheight{\vss\hsize=\textwidth
+ \makebox[\hsize][r]{\makebox[\FigSpace][l]{\box\DFimageII}%
+ \makebox(0,0)[lb]{\hspace*{1em}\raisebox{0.5\textheight}{%
+ \rotatebox[origin=tc]{90}{\DFcaption[#2]{#3}[#4]%
+ %
+ }}}}\vss}%
+ \end{figure}%
+]\clearpage\reset@tmode}
\NewDocumentCommand\NFfigure{m O{#3} m o d()}{%
\begin{figure}[p]
@@ -196,14 +205,10 @@ trim = \the\DFhalfwidth\space 0 0 0]}\x{#1}}%
}%
\NewDocumentCommand\HSfigure{m o m o d()}{%
- \unless\ifvmode
- \csuse{@bsphack}%
- \vadjust{\vspace{0pt plus1fill}\csuse{@esphack}\newpage}%
- \fi
- \cleartoevenpage
+ \cleartoeven
\setbox\DFtotalimage=\hbox{\includegraphics{#1}}
\DFwidth=\wd\DFtotalimage \DFhalfwidth=0.5\DFwidth
- \FigSpace=0.5\spreadwidth% W
+ \FigSpace=0.5\spreadwidth%
\setbox\DFimageI\hbox{\bgroup
\edef\x{\egroup\noexpand\includegraphics*[%
trim = 0 0 \the\DFhalfwidth\space 0]}\x{#1}}%