summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lwarp/lwarp.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/lwarp/lwarp.dtx')
-rw-r--r--macros/latex/contrib/lwarp/lwarp.dtx277
1 files changed, 195 insertions, 82 deletions
diff --git a/macros/latex/contrib/lwarp/lwarp.dtx b/macros/latex/contrib/lwarp/lwarp.dtx
index 0692faa1a3..54b4857907 100644
--- a/macros/latex/contrib/lwarp/lwarp.dtx
+++ b/macros/latex/contrib/lwarp/lwarp.dtx
@@ -16,7 +16,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{lwarp}
-%<package> [2021/05/24 v0.898 Allows LaTeX to directly produce HTML5 output.]
+%<package> [2021/06/29 v0.899 Allows LaTeX to directly produce HTML5 output.]
%
%<*driver>
\documentclass{ltxdoc}
@@ -2828,6 +2828,8 @@ use an absolute width for
\cs{keyfig}, instead of \optn{lw}-proportional widths.
(The \optn{[H]} option forces the use of a minipage, which internally adjusts for
a virtual 6-inch wide minipage, which then corrupts the \optn{lw} option.)
+
+For wrapped figures, overhang and number of lines are ignored.
}
\newcommand{\limitssiunitx}{%
@@ -3098,7 +3100,7 @@ This boolean may be tested by the user for later use.
%<*package>
% \fi
%
-% \CheckSum{54272}
+% \CheckSum{54297}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -3238,6 +3240,7 @@ This boolean may be tested by the user for later use.
% \changes{v0.896}{2021/04/08}{\ 2021/04/08}
% \changes{v0.897}{2021/05/24}{\ 2021/05/24}
% \changes{v0.898}{2021/05/29}{\ 2021/05/29}
+% \changes{v0.899}{2021/06/29}{\ 2021/06/29}
@@ -3341,6 +3344,8 @@ This boolean may be tested by the user for later use.
% \begin{center}
% \setlength{\parskip}{1ex}
% \color{blue}
+% For a quick-start tutorial, see \cref{sec:tutorial}, \nameref{sec:tutorial}.
+%
% For a list of supported features, see \cref{tab:supported}: \nameref{tab:supported}.
%
% To update existing projects, see \cref{sec:updates}: \nameref{sec:updates}.
@@ -3461,6 +3466,15 @@ This boolean may be tested by the user for later use.
%
% \begin{description}
% \needspace{2\baselineskip}
+% \item[v0.899:] Minor updates.
+% \begin{itemize}
+% \item \prog{lwarpmk}: Warns if |\usepackage{lwarp}| is not detected.
+% \item \pkg{graphics}: Added support for \optn{keepaspectratio}.
+% \margintag{packages}
+% \item \pkg{keyfloat}: Fix: \optn{lw} with \optn{h}.
+% \item \pkg{multicol}: Improved \CSS.
+% \end{itemize}
+% \needspace{2\baselineskip}
% \item[v0.898:] Minor updates.
% \begin{itemize}
% \item Fewer underfull \cs{hbox} warnings.
@@ -6790,6 +6804,16 @@ This boolean may be tested by the user for later use.
%
% \subsection{Compiling the print version with \prog{lwarpmk}}
%
+% \newcommand*{\LWRenablelwarpmk}{%
+% If you have not yet done so,
+% \trouble[Enable \prog{lwarpmk}]{lwarpmk=\filenm{lwarpmk.conf}}
+% \trouble{lwarpmk=\prog{lwarpmk}}
+% add \texttt{\cs{usepackage}\{lwarp\}} to the document,
+% then compile the project a single time using \prog{pdflatex}, \prog{lualatex},
+% or \prog{xelatex}. This generates the file \filenm{lwarpmk.conf},
+% which then allows the \prog{lwarpmk} program to be used.
+% }
+%
% The \prog{lwarpmk} utility program is used to compile either the printed or
% the \HTML\ version of the document.
%
@@ -6797,6 +6821,8 @@ This boolean may be tested by the user for later use.
%
% \begin{enumerate}
%
+% \item \LWRenablelwarpmk
+%
% \item Re-compile the print version: \userentry{lwarpmk print}
%
% \prog{lwarpmk} prints an introduction then checks to see if the document
@@ -6846,6 +6872,7 @@ This boolean may be tested by the user for later use.
% |lwarpmk html| is used to recompile an \HTML\ version of the document.
%
% \begin{enumerate}
+% \item \LWRenablelwarpmk
% \item Compile the \HTML\ version:
% \userentry{lwarpmk html}
%
@@ -17720,6 +17747,7 @@ This boolean may be tested by the user for later use.
% \changes{v0.893}{2020/10/18}{\filenm{lwarp.css}: Added \pkg{keystroke}.}
% \changes{v0.894}{2020/12/15}{\filenm{lwarp.css}: \TeX\ logos no longer below baseline.}
% \changes{v0.896}{2021/03/04}{\filenm{lwarp.css}: Added \element{main}, adjusted \element{sidetoccontainer} margin.}
+% \changes{v0.899}{2021/06/25}{\filenm{lwarp.css}: Improved \pkg{multicol}.}
%
% ^^A *lwarp.css
%
@@ -19103,8 +19131,11 @@ section.textbody { margin: 0ex 1em 0ex 1em ;}
div.multicolsheading { -webkit-column-span: all;
-moz-column-span: all; column-span: all; }
-div.multicols { -webkit-columns: 3 380px ;
- -moz-columns: 3 380px ; columns: 3 380px ; }
+div.multicols {
+ -webkit-columns: 3 auto ;
+ -moz-columns: 3 auto ;
+ columns: 3 auto ;
+}
div.multicols p {margin-top: 0ex}
@@ -19412,6 +19443,14 @@ nav.botnavigation { display:none; }
/* Only display the sidetoc's webpage title if a small screen */
span.sidetocthetitle { display: none }
+@media screen and (max-width: 100em) {
+ div.multicols {
+ -webkit-columns: 2 auto ;
+ -moz-columns: 2 auto ;
+ columns: 2 auto ;
+ }
+}
+
@media screen and (max-width: 50em) {
div.sidetoccontainer {
float: none ;
@@ -19432,6 +19471,11 @@ span.sidetocthetitle { display: none }
display:block ;
margin: 1ex 1em 1ex 1em ;
}
+ div.multicols {
+ -webkit-columns: 1 auto ;
+ -moz-columns: 1 auto ;
+ columns: 1 auto ;
+ }
}
@media print {
@@ -20505,6 +20549,7 @@ MathJax = {
% \changes{v0.81}{2020/03/04}{\prog{lwarpmk}: Improved error if in \pkg{lwarp} source directory.}
% \changes{v0.84}{2020/03/30}{\prog{lwarpmk}: \optn{clean} also removes \filenm{comment_*.cut}}
% \changes{v0.89}{2020/08/29}{\prog{lwarpmk}: \optn{clean} also removes \filenm{*.bbl}}
+% \changes{v0.899}{2021/05/30}{\prog{lwarpmk}: Warn if \pkg{lwarp} package not detected.}
%
% The following is only generated if the \optn{lwarpmk} option
% was given to \pkg{lwarp}.
@@ -20520,7 +20565,7 @@ MathJax = {
-- Copyright 2016-2021 Brian Dunn
-printversion = "v0.898"
+printversion = "v0.899"
requiredconfversion = "2" -- also at *lwarpmk.conf
function printhelp ()
@@ -20587,7 +20632,9 @@ function splitfile (destfile,sourcefile)
-- Split one large sourcefile into a number of files,
-- starting with destfile.
-- The file is split at each occurance of <!--|Start file|newfilename|*
+-- If lwarp is in use, sets usinglwarp.
--
+usinglwarp = false ;
print ("lwarpmk: Splitting " .. sourcefile .. " into " .. destfile) ;
local sfile = io.open(sourcefile)
io.output(destfile)
@@ -20597,11 +20644,23 @@ if ( (i~= nil) and (copen == "<!--") and (cstart == "Start file")) then
-- split the file
io.output(newfilename) ;
else
+if ( (i~= nil) and (copen == "<!--") and (cstart == "Using lwarp")) then
+ -- verified the use of \usepackage{lwarp}
+ usinglwarp = true ;
+else
-- not a splitpoint
io.write (line .. "\n") ;
-end
+end end
end -- do
io.close(sfile)
+if ( usinglwarp == false ) then
+ print ("lwarpmk: ===")
+ print ("lwarpmk: \\usepackage{lwarp} was not detected.")
+ print ("lwarpmk: The HTML output will not be correct.")
+ print ("lwarpmk: Ensured that \\usepackage{lwarp} is enabled,")
+ print ("lwarpmk: then lwarpmk print and lwarpmk HTML again.")
+ print ("lwarpmk: ===")
+end
end -- function
@@ -27173,10 +27232,23 @@ end -- not --version
% \begin{macrocode}
\LWR@traceinfo{LWR@lwarpStart: Starting new file.}
\LWR@filestart
-\LWR@traceinfo{LWR@lwarpStart: Generating first header.}
+% \end{macrocode}
+% Tell \prog{lwarpmk} that the \pkg{lwarp} package is in use.
+% This allows \prog{lwarpmk} to warn if |usepackage{lwarp}| was somehow
+% disabled.
+% \changes{v0.899}{2021/05/30}{Warn if \pkg{lwarp} package not detected.}
+% \begin{macrocode}
+\begingroup%
+\LWR@nullfonts%
+\LWR@htmlblockcomment{%
+|Using lwarp|%
+\LWR@htmlsectionfilename{\LWR@thisfilename}|%
+}
+\endgroup%
% \end{macrocode}
% \changes{v0.73}{2019/06/23}{Fix: Empty header/footer.}
% \begin{macrocode}
+\LWR@traceinfo{LWR@lwarpStart: Generating first header.}
\ifdefempty{\LWR@firstpagetop}{}{%
\LWR@htmltag{header}\LWR@orignewline
\LWR@startpars
@@ -39611,6 +39683,7 @@ end -- not --version
\setcounter{LWR@virtualpagedepth}{0}
% \end{macrocode}
%
+%
% \begin{environment}{LWR@setvirtualpage} * \oarg{columns}
%
% If not nesting a minipage, adjust \cs{linewidth}, \cs{textwidth},
@@ -58518,6 +58591,10 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
\newcommand*{\LWR@igangle}{}
\newcommand*{\LWR@igxscale}{1}
\newcommand*{\LWR@igyscale}{1}
+
+\newbool{LWR@igkeepaspectratio}
+\boolfalse{LWR@igkeepaspectratio}
+
\newcommand*{\LWR@igclass}{inlineimage}
% \end{macrocode}
% \changes{v0.65}{2018/12/19}{\pkg{graphics}: Added \cs{includegraphics} \attribute{alt} key.}
@@ -58589,6 +58666,14 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
% \end{macrocode}
%
%
+% Handle \optn{keepaspectratio} key:
+% \changes{v0.899}{2021/06/25}{\pkg{graphics}: Supports \optn{keepaspectratio}.}
+% \begin{macrocode}
+\define@key{igraph}{keepaspectratio}[false]{%
+ \booltrue{LWR@igkeepaspectratio}%
+}
+% \end{macrocode}
+%
% Handle \optn{origin} key:
% \changes{v0.52}{2018/03/27}{\pkg{graphics}: Added defaults.}
% \begin{macrocode}
@@ -58648,7 +58733,6 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
\define@key{igraph}{viewport}{}
\define@key{igraph}{trim}{}
\define@key{igraph}{totalheight}{}
-\define@key{igraph}{keepaspectratio}[true]{}
\define@key{igraph}{clip}[true]{}
\define@key{igraph}{draft}[true]{}
\define@key{igraph}{type}{}
@@ -58772,7 +58856,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
% \end{noindmacro}
-% \begin{noindmacro}{\LWR@ig@wpimagesizes} * \oarg{2: options} \oarg{3: options} \marg{4: filename}
+% \begin{noindmacro}{\LWR@ig@useactualimagesize} * \oarg{2: options} \oarg{3: options} \marg{4: filename}
%
% If formatting for a word processor, find and set the actual image size,
% without rotation, using \PDF\ instead of \SVG\ to find the original bounding box:
@@ -58781,83 +58865,86 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
% \changes{v0.62}{2018/10/27}{\pkg{graphics}: Fix: \bool{FormatWP}.}
% \changes{v0.79}{2019/12/09}{\pkg{graphics}: Factored from \cs{LWR@includegraphicsb}.}
% \begin{macrocode}
-\newcommand*{\LWR@ig@wpimagesizes}[4]{%
- \ifbool{FormatWP}{%
- \begingroup%
- \LWR@restoreorigformatting%
- \ifpdf%
- \appto\LWR@restoreorigformatting{%
- \DeclareGraphicsExtensions{%
- .pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
- }%
+\newcommand*{\LWR@ig@useactualimagesize}[4]{%
+ \begingroup%
+ \LWR@restoreorigformatting%
+ \ifpdf%
+ \appto\LWR@restoreorigformatting{%
+ \DeclareGraphicsExtensions{%
+ .pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
}%
- \else% \ifpdf
- \ifXeTeX%
- \appto\LWR@restoreorigformatting{%
- \DeclareGraphicsExtensions{%
- .pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
- }%
+ }%
+ \else% \ifpdf
+ \ifXeTeX%
+ \appto\LWR@restoreorigformatting{%
+ \DeclareGraphicsExtensions{%
+ .pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
+ }%
+ }%
+ \else%
+ \appto\LWR@restoreorigformatting{%
+ \DeclareGraphicsExtensions{%
+ .eps,.EPS,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
}%
- \else%
- \appto\LWR@restoreorigformatting{%
- \DeclareGraphicsExtensions{%
- .eps,.EPS,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
+ }%
+ \fi%
+ \fi% \ifpdf
+% \end{macrocode}
+% For a word processor, do not use rotation:
+% \begin{macrocode}
+ \ifbool{FormatWP}{\define@key{Gin}{angle}{}}{}%
+% \end{macrocode}
+% \begin{macrocode}
+ \IfBooleanTF{#1}%
+ {% starred
+ \IfValueTF{#3}%
+ {%
+ \global\sbox{\LWR@imagesizebox}{%
+ \LWR@origincludegraphics*[#2][#3]{#4}%
}%
}%
- \fi%
- \fi% \ifpdf
- \define@key{Gin}{angle}{}%
- \IfBooleanTF{#1}%
- {% starred
- \IfValueTF{#3}%
+ {%
+ \IfValueTF{#2}%
{%
\global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics*[#2][#3]{#4}%
+ \LWR@origincludegraphics*[#2]{#4}%
}%
- }%
- {%
- \IfValueTF{#2}%
- {%
- \global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics*[#2]{#4}%
- }%
- }{%
- \global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics*{#4}%
- }%
+ }{%
+ \global\sbox{\LWR@imagesizebox}{%
+ \LWR@origincludegraphics*{#4}%
}%
}%
- }% starred
- {% not starred
- \IfValueTF{#3}%
+ }%
+ }% starred
+ {% not starred
+ \IfValueTF{#3}%
+ {%
+ \global\sbox{\LWR@imagesizebox}{%
+ \LWR@origincludegraphics[#2][#3]{#4}%
+ }%
+ }%
+ {%
+ \IfValueTF{#2}%
{%
\global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics[#2][#3]{#4}%
+ \LWR@origincludegraphics[#2]{#4}%
}%
- }%
- {%
- \IfValueTF{#2}%
- {%
- \global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics[#2]{#4}%
- }%
- }{%
- \global\sbox{\LWR@imagesizebox}{%
- \LWR@origincludegraphics{#4}%
- }%
+ }{%
+ \global\sbox{\LWR@imagesizebox}{%
+ \LWR@origincludegraphics{#4}%
}%
}%
- }% not starred
- \endgroup%
- \settowidth{\LWR@igwidth}{\usebox{\LWR@imagesizebox}}%
- \global\renewcommand*{\LWR@igwidthstyle}{%
- width:\LWR@printlength{\LWR@igwidth}%
- }%
- \settoheight{\LWR@igheight}{\usebox{\LWR@imagesizebox}}%
- \global\renewcommand*{\LWR@igheightstyle}{%
- height:\LWR@printlength{\LWR@igheight}%
}%
- }{}% FormatWP
+ }% not starred
+ \endgroup%
+ \settowidth{\LWR@igwidth}{\usebox{\LWR@imagesizebox}}%
+ \global\renewcommand*{\LWR@igwidthstyle}{%
+ width:\LWR@printlength{\LWR@igwidth}%
+ }%
+ \settoheight{\LWR@igheight}{\usebox{\LWR@imagesizebox}}%
+ \global\renewcommand*{\LWR@igheightstyle}{%
+ height:\LWR@printlength{\LWR@igheight}%
+ }%
}
% \end{macrocode}
% \end{noindmacro}
@@ -59002,6 +59089,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
\renewcommand*{\LWR@igxscale}{1}%
\renewcommand*{\LWR@igyscale}{1}%
\renewcommand*{\LWR@igclass}{inlineimage}%
+ \boolfalse{LWR@igkeepaspectratio}%
% \end{macrocode}
% \changes{v0.65}{2018/12/19}{\pkg{graphics}: Added \cs{includegraphics} \attribute{alt} key.}
% \changes{v0.74}{2019/08/20}{\pkg{graphics}: Add \cs{ThisAltText}.}
@@ -59055,10 +59143,15 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space
% \end{macrocode}
% ^^A \LWR@sanitize{\LWR@parsedfilename}%
%
-% If formatting for a word processor, find and set the actual image size,
+% If formatting for a word processor, or if using \optn{keepaspectratio},
+% find and set the actual image size,
% without rotation, using \PDF\ instead of \SVG\ to find the original bounding box:
+% \changes{v0.899}{2021/06/25}{\pkg{graphics}: Supports \optn{keepaspectratio}.}
% \begin{macrocode}
- \LWR@ig@wpimagesizes{#1}{#2}{#3}{#4}%
+ \ifboolexpr{
+ bool {FormatWP} or
+ bool {LWR@igkeepaspectratio}
+ }{\LWR@ig@useactualimagesize{#1}{#2}{#3}{#4}}{}%
% \end{macrocode}
%
% Create the \HTML\ reference with the graphicspath, filename, extension,
@@ -61926,10 +62019,10 @@ do not attempt to patch lwarp's version of `hyperref'.)\MessageBreak}
\renewcommand*{\KFLT@maybeendfloatrow}{%
\ifnumless{\value{KFLT@thiscol}}{\value{KFLT@numcols}}%
- {}% thiscol < numcols
- {% >=
- \defcounter{KFLT@thiscol}{0}%
- }%
+ {}% thiscol < numcols
+ {% >=
+ \defcounter{KFLT@thiscol}{0}%
+ }%
}%
\renewcommand{\KFLT@trackrows}%
@@ -61967,17 +62060,37 @@ do not attempt to patch lwarp's version of `hyperref'.)\MessageBreak}
% \begin{lrbox}{\KFLT@envbox}%
\ifthenelse{\NOT\equal{\KFLT@lw}{}}%
{%
- \KFLT@frame{\includegraphics%
- [scale=\KFLT@s,width=\KFLT@imagewidth]{#1}}%
+% \end{macrocode}
+% \changes{v0.899}{2021/06/25}{\pkg{keyfloat}: Fix: \optn{lw} w/ \optn{h}.}
+% \begin{macrocode}
+ \ifdimgreater{\KFLT@h}{0pt}%
+ {%
+ \KFLT@frame{%
+ \includegraphics%
+ [%
+ scale=\KFLT@s,%
+ width=\KFLT@imagewidth,%
+ height=\KFLT@h,%
+ \KFLT@keepaspectratio,%
+ ]{#1}%
+ }%
+ }%
+ {%
+ \KFLT@frame{\includegraphics%
+ [scale=\KFLT@s,width=\KFLT@imagewidth]{#1}}%
+ }%
}%
{% not linewidth
\ifthenelse{\dimtest{\KFLT@w}{>}{0pt}}%
{% width is given
\ifthenelse{\dimtest{\KFLT@h}{>}{0pt}}%
{% w and h
- \KFLT@frame{\includegraphics%
- [scale=\KFLT@s,%
- width=\KFLT@imagewidth,height=\KFLT@h]{#1}}%
+ \KFLT@frame{\includegraphics[%
+ scale=\KFLT@s,%
+ width=\KFLT@imagewidth,%
+ height=\KFLT@h,%
+ \KFLT@keepaspectratio,%
+ ]{#1}}%
}% w and h
{% only w
\KFLT@frame{\includegraphics%