diff options
author | Karl Berry <karl@freefriends.org> | 2018-06-06 20:52:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-06-06 20:52:12 +0000 |
commit | 0287311bafc0bdd253df0c8d6df3ef85f804d263 (patch) | |
tree | 151b584accf0b823a70c9bb86673bb0ad79f2991 /Master/texmf-dist/source/latex/lwarp/lwarp.dtx | |
parent | e0b44a591ea65a8c11f15d8e4c0cfb50a6058782 (diff) |
lwarp (6jun18)
git-svn-id: svn://tug.org/texlive/trunk@47944 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/lwarp/lwarp.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/lwarp/lwarp.dtx | 3664 |
1 files changed, 2630 insertions, 1034 deletions
diff --git a/Master/texmf-dist/source/latex/lwarp/lwarp.dtx b/Master/texmf-dist/source/latex/lwarp/lwarp.dtx index 147c859e0f6..355a913cfd6 100644 --- a/Master/texmf-dist/source/latex/lwarp/lwarp.dtx +++ b/Master/texmf-dist/source/latex/lwarp/lwarp.dtx @@ -16,7 +16,7 @@ % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{lwarp} -%<package> [2018/05/12 v0.56 Allows LaTeX to directly produce HTML5 output.] +%<package> [2018/06/06 v0.57 Allows LaTeX to directly produce HTML5 output.] % %<*driver> \documentclass{ltxdoc} @@ -440,6 +440,34 @@ code apply to the generation of \HTML, print, or both forms of output. } +\newcommand{\describemathimagename}{% +When creating an \SVG\ math image, its \attribute{alt} tag may be set +to the math expression, which may be hashed for image reuse. +In the case of \cs{ensuremath} or after \cs{StartDynamicMath}, +where the contents require a unique image for each instance of the same expression, +the \attribute{alt} tag is set to \cs{mathimagename}, and the image is not reused. + +This expression is visible in the browser if images are not loaded, +and appears when the text is copied and pasted. +The default is ``math image'', and it may be changed according to the document's language. +This may be set in the preamble, or changed as necessary inside the document, +where it will affect the following \SVG\ math images. +} + +\newcommand{\describepackagediagramname}{% +For many packages, the output is placed inside a \env{lateximage} with an +\HTML\ \attribute{alt} tag set to the package name followed by \cs{packagediagramname}. +For example: +\begin{sourcedisplay} +(-xy- diagram) +\end{sourcedisplay} +This expression is visible in the browser if images are not loaded, +and appears when the text is copied and pasted. +The default is ``diagram'', and may it be changed according to the document's language. +This may be set in the preamble, or changed as necessary inside the document, +where it will affect the following \env{lateximage}s. +} + \newcommand{\limitscpageref}{\pkg{cleveref} and \pkg{varioref} are supported, \watchout[\pkg{cleveref} page numbers] but printed page numbers do not map to \HTML, @@ -985,7 +1013,6 @@ Examples: \newcommand{\limitsmath}{% - \subsubsection{Rendering tradeoffs} Math may be rendered @@ -1125,6 +1152,39 @@ Limitations when using \brand{MathJax} include: \end{itemize} } +\newcommand{\limitsmathcatcode}{ +The math shift character \texttt{\$} is not set for \HTML\ output until +\margintag{preamble macros with math} +after the preamble. Macros defined in the preamble which contain \texttt{\$} +must be enclosed between \cs{StartDefiningMath} and \cs{StopDefiningMath} +to temporarily change to the \HTML\ meaning of \texttt{\$}: +\begin{sourcedisplay} +\textcolor{red}{\cs{StartDefiningMath}} \\ +\cs{newcommand}\{\dots\} \\ +\textcolor{red}{\cs{StopDefiningMath}} +\end{sourcedisplay} + +As an alternative, use \cs{(} and \cs{)} instead of \texttt{\$}, in which +case \cs{StartDefiningMath} and \cs{StopDefiningMath} are not necessary. + +If a package defines macros using \texttt{\$}, it may be nessary to use +\cs{StartDefiningMath} and \cs{StopDefiningMath} before and after loading the +package. +} + +\newcommand{\limitsmathdynamic}{ +An inline math expression is usually converted to a reusable hashed \SVG\ math +\margintag{inline dynamic math} +image, or a MathJax expression. The hash or expression depends on the contents +of the math expression. In most cases this math expression is static, such as \texttt{\$x+1\$}, +so the image can be reused for multiples instances of the same expression. +In some cases, the math expression includes a counter or other object which may +change between uses. The macro \cs{StartDynamicMath} may be used before a dynamic +math expression, and \cs{StopDynamicMath} after. Doing so tells \pkg{lwarp} to +use an unhashed \SVG\ math image, even if MathJax is in use. +See \cref{sec:localizingdynamicmath}. +} + \newcommand{\limitschemformula}{% \pkg{chemformula} works best without \brand{MathJax}. \watchout[\pkg{chemformula} with \brand{MathJax}] @@ -1401,7 +1461,7 @@ or the packages \pkg{multirow}, \pkg{longtable}, \pkg{supertabular}, or \pkg{xta \begin{sourcedisplay} \textcolor{red}{\cs{StartDefiningTabulars}} \\ <define macros or environments using \env{tabular} and \texttt{\&} here> \\ - \textcolor{red}{\cs{EndDefiningTabulars}} + \textcolor{red}{\cs{StopDefiningTabulars}} \end{sourcedisplay} This includes before and after defining any macro \watchout[floatrow] @@ -1603,7 +1663,7 @@ left \& right \textbackslash\textbackslash \\ left \& right \textbackslash\textbackslash \\ \cs{endtabular} \\ \} \\ -\textcolor{red}{\cs{EndDefiningTabulars}} \\ +\textcolor{red}{\cs{StopDefiningTabulars}} \\ \end{sourcedisplay} } @@ -1640,7 +1700,7 @@ For \cs{tablefirsthead}, etc., enclose them as follows: \textcolor{red}{\cs{StartDefiningTabulars}} \\ \cs{tablefirsthead} \\ \dots \\ -\textcolor{red}{\cs{EndDefiningTabulars}} +\textcolor{red}{\cs{StopDefiningTabulars}} \end{sourcedisplay} See \cref{sec:limitstabular}. @@ -1930,7 +1990,7 @@ they are the first command inside the float: } \newcommand{\limitsfloatrow}{% -Use \cs{StartDefiningTabulars} and \cs{EndDefiningTabulars} before and after +Use \cs{StartDefiningTabulars} and \cs{StopDefiningTabulars} before and after \watchout[misplaced alignment alignment tab character \&] defining macros using \cs{ttabbox} with a tabular inside. See \cref{sec:limitstabular}. @@ -2167,7 +2227,7 @@ This boolean may be tested by the user for later use. %<*package> % \fi % -% \CheckSum{24234} +% \CheckSum{24592} % % \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 @@ -2265,6 +2325,7 @@ This boolean may be tested by the user for later use. % \changes{v0.54}{2018/04/22}{\ 2018/04/22} % \changes{v0.55}{2018/04/26}{\ 2018/04/26} % \changes{v0.56}{2018/05/12}{\ 2018/05/12} +% \changes{v0.57}{2018/06/06}{\ 2018/06/06} @@ -2324,7 +2385,7 @@ This boolean may be tested by the user for later use. % % A modular package-loading system uses the \pkg{lwarp} version of a package for % \HTML\ when available. -% More than 270 \LaTeX\ packages are supported with these high-level source +% Almost 300 \LaTeX\ packages are supported with these high-level source % compatibility replacements, and many others work as-is. % % A tutorial is provided to quickly introduce the user to the major components @@ -2462,6 +2523,50 @@ This boolean may be tested by the user for later use. % % \begin{description} % \needspace{2\baselineskip} +% \item[v0.57:] \ +% \begin{itemize} +% \item Added support for MathJax equations with \cs{footnote}, \cs{footnotemark}. +% \margintag{MathJax} +% \item Added \cs{StartDefiningMath} and \cs{StopDefiningMath} for +% \margintag{math macros} +% use when defining macros in the preamble which contain \$. +% See \cref{sec:mathcatcode}. +% \item Added \cs{StartDynamicMath} and \cs{StopDynamicMath} to +% \margintag{dynamic math} +% delimit math expressions which depend on a variable condition +% such as a counter. Such expressions will not be hashed for reuse, +% and will be converted to \SVG\ math images even when MathJax is enabled. +% See \cref{sec:mathdynamic}. +% \item Renamed \cs{EndDefiningTabulars} to \cs{StopDefiningTabulars}. +% \watchout[new name] +% \item Improved localization for \env{lateximage} \HTML\ \attribute{alt} tags. +% \margintag{\env{lateximage} \attribute{alt} tags} +% For \SVG\ math images, the \attribute{alt} tag under some conditions +% will be set to \cs{mathimagename}, which defaults to ``math image''. +% For packages, the \attribute{alt} tag is set using the package name followed by +% \cs{packagediagramname}, which defaults to ``diagram''. Ex: +% \begin{sourcedisplay} +% (-xy- diagram) +% \end{sourcedisplay} +% See \cref{sec:packagediagramname}. +% \item Fix: Restoring various macros in a \env{lateximage} and similar situations. +% \item Fix: \cs{href} text catcodes. +% \margintag{misc. fixes} +% \item Fix: \cs{subref} text. +% \item Fixes: Colored \cs{rule} and \cs{boxframe}. +% \item \pkg{float}, \pkg{rotfloat}: Adds support for float styles |ruled| and |boxed|. +% \margintag{packages} +% \item \pkg{float}: Fix: Do not create \cs{l@<type>} until \cs{listof} is used. +% \item \pkg{marginnote}: Fix: Long optional argument. +% \item \pkg{ellipsis}: Adds \cs{midwordellipsis}. +% \item \pkg{breakurl}: Fix for text catcodes. +% \item Added \pkg{algorithm2e}, \pkg{register}, \pkg{ltablex}, \pkg{xltabular}, +% \pkg{xellipsis}, \pkg{trimclip}, \pkg{errata}, \pkg{vowel}, \pkg{xpiano}. +% \item Prevents \pkg{glossary}. +% \item Verified works as-is with \pkg{gauss}, \pkg{phonrule}, \pkg{piano}, +% \pkg{SIunits}, \pkg{tikzcodeblocks}. +% \end{itemize} +% \needspace{2\baselineskip} % \item[v0.56:] \ % \begin{itemize} % \item Added @@ -2486,7 +2591,7 @@ This boolean may be tested by the user for later use. % \item Added \pkg{parnotes}, \pkg{quoting}, \pkg{lua-check-hyphen}, % \pkg{tocenter}, \pkg{underscore}. % \margintag{packages} -% \item Verified works with \pkg{babelbib}, \pkg{bibunits}, \pkg{bodegraph}, +% \item Verified works as-is with \pkg{babelbib}, \pkg{bibunits}, \pkg{bodegraph}, % \pkg{fast-diagram}, \pkg{nicematrix}, \pkg{structmech}. % \end{itemize} % \needspace{2\baselineskip} @@ -3086,12 +3191,13 @@ This boolean may be tested by the user for later use. % \needspace{2\baselineskip} % \item[v0.33:] \ % \begin{itemize} -% \item Tabular |@| and |!| columns now have their own \HTML\ columns. +% \item Tabular |@| and |!| columns now havetheir own \HTML\ columns. % \item |&| catcode changes are localized, perhaps causing errors % about the tab alignment character |&|, % so any definitions of macros or environments % which themselves contain \env{tabular} and |&| must be enclosed within \cs{StartDefiningTabulars} -% and \cs{EndDefiningTabulars}. See \cref{sec:localizingampersand}. +% and \cs{StopDefiningTabulars} (previously called \cs{EndDefiningTabulars}. +% See \cref{sec:localizingcatcodes}. % This change is not required for the routine use of tables, % but only when a table is defined inside another macro or environment, % and while also using the |&| character inside the definition. @@ -3605,7 +3711,7 @@ This boolean may be tested by the user for later use. % Additional math: & Math fonts via \SVG\ images, \pkg{resizegather}, \pkg{xy}. % % Tested to work as-is: -% \pkg{amscd}, \pkg{bm}, \pkg{braket}, \pkg{delarray}, \pkg{nicematrix}, +% \pkg{amscd}, \pkg{bm}, \pkg{braket}, \pkg{delarray}, \pkg{guass}, \pkg{nicematrix}, % \pkg{pb-diagram}, \pkg{tikz-cd}, etc. \\ % % Display math with \cs{displaymathother}: & % @@ -3613,7 +3719,9 @@ This boolean may be tested by the user for later use. % % \midrule % -% Units and fractions: & \pkg{nicefrac}, \pkg{siunitx}, \pkg{units}, \pkg{xfrac}. \\ +% Units and fractions: & \pkg{nicefrac}, \pkg{siunitx}, \pkg{units}, \pkg{xfrac}. +% +% Tested to work as-is: \pkg{SIunits}. \\ % % \midrule % @@ -3630,9 +3738,9 @@ This boolean may be tested by the user for later use. % % Tabular: & % \env{tabular} environment, \pkg{array}, \pkg{arydshln}, \pkg{bigdelim}, \pkg{booktabs}, -% \pkg{colortbl}, \pkg{diagbox}, \pkg{longtable}, \pkg{ltxtable}, +% \pkg{colortbl}, \pkg{diagbox}, \pkg{longtable}, \pkg{ltablex}, \pkg{ltxtable}, % \pkg{multirow}, \pkg{supertabular}, \pkg{tabularx}, \pkg{tabulary}, -% \pkg{threeparttable}, \pkg{xtab}. \\ +% \pkg{threeparttable}, \pkg{xltabular}, \pkg{xtab}. \\ % % \midrule % @@ -3692,7 +3800,7 @@ This boolean may be tested by the user for later use. % % Acronyms: & \pkg{acro}, \pkg{acronym}. \\ % -% Todo notes: & \pkg{changebar}, \pkg{easy-todo}, \pkg{fixme}, +% Todo notes: & \pkg{changebar}, \pkg{easy-todo}, \pkg{errata}, \pkg{fixme}, % \pkg{fixmetodonotes}, \pkg{todo}, \pkg{todonotes}. \\ % % \midrule @@ -3700,10 +3808,11 @@ This boolean may be tested by the user for later use. % Direct formatting: & \cs{emph}, \cs{textsuperscript}, % \cs{textbf}, etc are supported. % \cs{bfseries}, etc.\ are only supported in some cases. -% \pkg{cancel}, \pkg{hyphenat}, \pkg{lettrine}, \pkg{lua-check-hyphen}, \pkg{luacolor}, +% \pkg{cancel}, \pkg{ellipsis}, \pkg{hyphenat}, \pkg{lettrine}, \pkg{lips}, +% \pkg{lua-check-hyphen}, \pkg{luacolor}, % \pkg{magaz}, \pkg{pdfrender}, \pkg{realscripts}, \pkg{relsize}, % \pkg{scalefnt}, \pkg{soul}, \pkg{soulpos}, \pkg{soulutf8}, -% \pkg{textfit}, \pkg{ulem}, \pkg{underscore}. \\ +% \pkg{textfit}, \pkg{trimclip}, \pkg{ulem}, \pkg{underscore}, \pkg{xellipsis}. \\ % % Ordinals: & \pkg{engord}, \pkg{fmtcount}, \pkg{nth}. \\ % @@ -3731,24 +3840,24 @@ This boolean may be tested by the user for later use. % \midrule % % Science and engineering: & -% \pkg{algorithmicx}, \pkg{axodraw2}, \pkg{bytefield}, +% \pkg{algorithm2e}, \pkg{algorithmicx}, \pkg{axodraw2}, \pkg{bytefield}, % \pkg{chemfig}, \pkg{chemformula}, \pkg{chemgreek}, \pkg{chemmacros}, \pkg{chemnum}, -% \pkg{listings}, \pkg{mhchem}, \pkg{phfqit}. +% \pkg{listings}, \pkg{mhchem}, \pkg{phfqit}, \pkg{register}. % % Tested to work as-is: % \pkg{blochsphere}, \pkg{bodegraph}, \pkg{bohr}, \pkg{circuitikz}, % \pkg{elements}, \pkg{fast-diagram}, % \pkg{hepnicenames}, \pkg{heppennames}, % \pkg{linop}, \pkg{pgfgantt}, \pkg{physics}, \pkg{simpler-wick}, \pkg{slashed}, -% \pkg{structmech}. +% \pkg{structmech}, \pkg{tikzcodeblocks}. % \\ % % \midrule % -% Liberal arts and humanities: & \pkg{forest}, \pkg{schemata}. +% Liberal arts and humanities: & \pkg{forest}, \pkg{schemata}, \pkg{vowel}, \pkg{xpiano}. % % Tested to work as-is: -% \pkg{tikz-dependency}. \\ +% \pkg{phonrule}, \pkg{piano}, \pkg{tikz-dependency}. \\ % % \midrule % @@ -5242,6 +5351,8 @@ This boolean may be tested by the user for later use. % FileSectionNames & Use section names for file names, else use numbers. \\ % FootnoteDepth & Sectioning depth of footnotes. \\ % \cs{abstractname} & The name of the abstract. \\ +% \cs{mathimagename} & The \SVG\ math image \env{lateximage} \attribute{alt} tag. \\ +% \cs{packagediagramname} & The suffix for a package's \env{lateximage} \attribute{alt} tags. \\ % \cs{CSSFilename} & The \CSS\ for the following files. \\ % \cs{HTMLLanguage} & The |html lang| tag. \\ % \cs{HTMLTitle} & The \HTML\ |title| meta tag, overriding \cs{title}. \\ @@ -5509,6 +5620,14 @@ This boolean may be tested by the user for later use. % \item[Placed in the document wherever necessary:] \ % % \begin{description} +% \ItemDescribeMacro{\mathimagename} \DescribeDefault{math image} +% \label{sec:mathimagename} +% \describemathimagename +% +% \ItemDescribeMacro{\packagediagramname} \DescribeDefault{diagram} +% \label{sec:packagediagramname} +% \describepackagediagramname +% % \ItemDescribeEnv{warpprint} An environment which is only used % while generating print output. Place inside anything which does not % apply to \HTML\ and which may cause problems with \pkg{lwarp}. @@ -6097,7 +6216,7 @@ This boolean may be tested by the user for later use. % \watchout[Misplaced alignment tab character \&] % you will have to use \cs{StartDefiningTabulars} % before the start of the macro which uses \cs{fboxBlock} and the \env{tabular}, -% and \cs{EndDefiningTabulars} afterwards. +% and \cs{StopDefiningTabulars} afterwards. % Also see the \pkg{lwarp} documentation for the \pkg{fancybox} package. % \item [To frame equations:] See \cref{sec:fancybox} for the \pkg{fancybox} package. % \item [For fancy framed minipages:] See packages \pkg{boxedminipage}, @@ -6334,6 +6453,14 @@ This boolean may be tested by the user for later use. % \label{sec:limitsmath} % \limitsmath % +% \subsubsection{Catcode changes} +% \label{sec:mathcatcode} +% \limitsmathcatcode +% +% \subsubsection{Dynamic math} +% \label{sec:mathdynamic} +% \limitsmathdynamic +% % \subsubsection{Display math} % \label{sec:displaymathother} % \index{math>\cs{displayingmath}}\index{math>\cs{displayingmore}} @@ -7031,7 +7158,9 @@ This boolean may be tested by the user for later use. % \section{Modifying \pkg{lwarp}} % \pagestyle{pageheadfoot} % -% To quickly find the source for a package in |lwarp.dtx|, search for |*packagename|, +% To quickly find the source for a package in |lwarp.dtx|, +% \margintag{locating something} +% search for |*packagename|, % such as |*siunitx|. % % Likewise, to quickly find the source for a file in |lwarp.dtx|, @@ -7043,16 +7172,30 @@ This boolean may be tested by the user for later use. % Look to existing code for ideas on how to expand into new code. % % An environment may be converted to a |lateximage| then displayed +% \margintag{image of \TeX\ output} % with an image of the resulting \LaTeX{} output. % See \cref{sec:picture} for an example of the |picture| environment. % % To create a custom \HTML\ block or inline \CSS\ class, +% \margintag{CSS classes} % see \cref{sec:highlevelclasses}. % +% To create print and \HTML\ versions of the same macro or environment, +% \margintag{print/HTML macros} +% see \cref{sec:definingprinthtml}. +% % Any \TeX\ boxes must be undone, as \SVG\ math or \env{lateximage}s % \watchout[\TeX\ boxes] % require \cs{newpage}, which will not work in a \TeX\ box. % +% \changes{v0.57}{2018/05/28}{Docs: Recreating the index for \pkg{lwarp} source.} +% To recreate the index for the \pkg{lwarp} documentation: +% \margintag{index recreation} +% \begin{Verbatim}[gobble=2,obeytabs,tabsize=4,frame=lines] +% makeindex -s gglo.ist -o lwarp.gls lwarp.glo +% makeindex -s gind.ist lwarp.idx +% \end{Verbatim} +% % % \subsection{Modifying a package for \pkg{lwarp}} % @@ -7098,7 +7241,7 @@ This boolean may be tested by the user for later use. % will not need to be emulated for \HTML\ output. Only the ``user-facing'' % macros need to be nullified or emulated. % -% \needspace{10\baselineskip} +% \needspace{5\baselineskip} % Each |lwarp-| package should first call either % \begin{sourcedisplay} % \cs{LWR@ProvidesPackageDrop} @@ -7158,6 +7301,21 @@ This boolean may be tested by the user for later use. % Remember that the configuration files are only rewritten when compiling the % printed version of the document. % +% \changes{v0.57}{2018/05/28}{Docs: Recompiling \prog{lwarpmk} or \CSS\ files.} +% When changing the source to \prog{lwarpmk} or a \CSS\ file in \filenm{lwarp.dtx}: +% \begin{enumerate} +% \item Change the source in \filenm{lwarp.dtx}. +% \item |pdflatex lwarp.ins| +% \item |pdflatex lwarp.dtx| +% \item If modifying \prog{lwarpmk} the new version should now be active. +% \item If modifying \CSS\ files: +% \begin{enumerate} +% \item For the document, |lwarpmk print| to update the \CSS\ files +% in the project. +% \item Reload the \HTML\ document to see the effect of the new \CSS\ files. +% \end{enumerate} +% \end{enumerate} +% % Sometimes it is worth checking the |<project>_html.pdf| file, which is the % \PDF\ containing \HTML\ tags. Also, |<project>_html.html| has % the text conversion of these tags, before the file is split into individual @@ -7721,7 +7879,7 @@ This boolean may be tested by the user for later use. % \end{macrocode} % % -% +%macrocode % % \section{Miscellaneous tools} % @@ -7782,9 +7940,8 @@ This boolean may be tested by the user for later use. % \end{macrocode} % -% \clearpage -% -% + + % \section{Operating-System portability} % \label{sec:OSportability} % \changes{v0.11}{2016/03/11}{Added section: Operating-System portability.} @@ -8346,6 +8503,7 @@ For a possible alternative, see package(s) #2.} \LWR@earlyloadnever{caption2}{caption} % \LWR@earlyloadnever{ccaption}{caption}% might be preloaded by memoir \LWR@earlyloadnever{fancyheadings}{fancyhdr} +\LWR@earlyloadnever{glossary}{glossaries} \LWR@earlyloadnever{t1enc}{fontenc, inputenc, inputenx} \LWR@earlyloadnever{wasysym}{textcomp, amssymb, amsfonts, mnsymbol, fdsymbol} % \end{macrocode} @@ -8371,7 +8529,10 @@ For a possible alternative, see package(s) #2.} \LWR@loadafter{acronym} \LWR@loadafter{adjmulticol} \LWR@loadafter{addlines} +\LWR@loadafter{ae} +\LWR@loadafter{aecc} \LWR@loadafter{afterpage} +\LWR@loadafter{algorithm2e} \LWR@loadafter{algorithmicx} \LWR@loadafter{alltt} \LWR@loadafter{amsmath} @@ -8397,6 +8558,8 @@ For a possible alternative, see package(s) #2.} \LWR@loadafter{bytefield} \LWR@loadafter{cancel} \LWR@loadafter{caption} +\LWR@loadafter{caption2} +\LWR@loadafter{ccaption} \LWR@loadafter{changebar} \LWR@notmemoirloadafter{changepage} \LWR@notmemoirloadafter{chngpage} @@ -8431,12 +8594,14 @@ For a possible alternative, see package(s) #2.} \LWR@notmemoirloadafter{epigraph} \LWR@loadafter{epstopdf} \LWR@loadafter{epstopdf-base} +\LWR@loadafter{errata} \LWR@loadafter{eso-pic} \LWR@loadafter{everypage} \LWR@loadafter{everyshi} \LWR@loadafter{extramarks} \LWR@loadafter{fancybox} \LWR@loadafter{fancyhdr} +\LWR@loadafter{fancyheadings} \LWR@loadafter{fancyref} \LWR@loadafter{fancyvrb} \LWR@loadafter{figcaps} @@ -8470,6 +8635,7 @@ For a possible alternative, see package(s) #2.} \LWR@loadafter{glossaries} % \LWR@loadafter{graphics}% pre-loaded by xunicode % \LWR@loadafter{graphicx}% pre-loaded by xunicode +\LWR@loadafter{glossary} \LWR@loadafter{grffile} \LWR@loadafter{grid} \LWR@loadafter{gridset} @@ -8495,6 +8661,7 @@ For a possible alternative, see package(s) #2.} \LWR@loadafter{listings} \LWR@loadafter{longtable} \LWR@loadafter{lscape} +\LWR@loadafter{ltablex} \LWR@loadafter{ltcaption} \LWR@loadafter{ltxgrid} \LWR@loadafter{ltxtable} @@ -8554,6 +8721,7 @@ For a possible alternative, see package(s) #2.} \LWR@loadafter{quoting} \LWR@loadafter{ragged2e} \LWR@loadafter{realscripts} +\LWR@loadafter{register} \LWR@loadafter{relsize} \LWR@loadafter{resizegather} \LWR@loadafter{romanbar} @@ -8586,6 +8754,7 @@ For a possible alternative, see package(s) #2.} \LWR@loadafter{subfig} \LWR@loadafter{subfigure} \LWR@loadafter{supertabular} +\LWR@loadafter{t1inc} \LWR@loadafter{tabls} \LWR@notmemoirloadafter{tabularx} \LWR@loadafter{tabulary} @@ -8608,6 +8777,7 @@ For a possible alternative, see package(s) #2.} \LWR@loadafter{todo} \LWR@loadafter{todonotes} \LWR@loadafter{transparent} +\LWR@loadafter{trimclip} \LWR@loadafter{trivfloat} \LWR@loadafter{turnthepage} % \end{macrocode} @@ -8622,14 +8792,19 @@ For a possible alternative, see package(s) #2.} \LWR@notmemoirloadafter{verse} \LWR@loadafter{vertbars} \LWR@loadafter{vmargin} +\LWR@loadafter{vowel} \LWR@loadafter{vwcol} \LWR@loadafter{wallpaper} +\LWR@loadafter{wasysym} \LWR@loadafter{watermark} \LWR@loadafter{wrapfig} \LWR@loadafter{xcolor} +\LWR@loadafter{xellipsis} \LWR@loadafter{xfrac} +\LWR@loadafter{xltabular} \LWR@loadafter{xltxtra} \LWR@loadafter{xmpincl} +\LWR@loadafter{xpiano} \LWR@loadafter{xtab} \LWR@loadafter{xurl} \LWR@loadafter{xy} @@ -9144,7 +9319,7 @@ top=1in,bottom=1in,% % Remember the original \cs{RequirePackage}: % \begin{macrocode} -\LetLtxMacro{\LWR@origRequirePackage}{\RequirePackage} +\LetLtxMacro\LWR@origRequirePackage\RequirePackage % \end{macrocode} % \begin{macro}{\LWR@requirepackagenames} @@ -9274,7 +9449,7 @@ top=1in,bottom=1in,% {\LWR@origRequirePackage{\LWR@parsedrequirepackagenames}}% }% } -\LetLtxMacro{\usepackage}{\RequirePackage} +\LetLtxMacro\usepackage\RequirePackage % \end{macrocode} % \end{macro} @@ -9531,7 +9706,6 @@ top=1in,bottom=1in,% \ifbool{LWR@tracinglwarp}% {% \typeout{*** lwarp: #1}% - % \PackageInfo{lwarp}{#1 : }% }% {}% } @@ -9572,6 +9746,264 @@ top=1in,bottom=1in,% +% \section{Defining print and HTML versions of macros and environments} +% \label{sec:definingprinthtml} +% \index{print>selecting print/HTML definitions} +% \index{HTML>selecting print/HTML definitions} +% +% The following refers to defining objects inside \pkg{lwarp}, and is not +% for the user's document. +% +% Many macros and environments must be provided as both print and \HTML\ versions. +% +% While generating the print version of a document, the original macros +% as defined by \LaTeX\ and its packages are used as-is. +% +% While generating the \HTML\ version of a document, +% the original macro or environment is redefined to call a new \HTML\ version +% or a copy of the original print version. +% The new \HTML\ versions of macros and environments are used most of the time. +% Copies of the print versions are used inside a \env{lateximage} environment, +% which draws and remembers an image of the printed output, and also several +% other places. +% +% The general structure for providing print and \HTML\ versions of a macro or +% environment is as follows: +% +% \begin{description} +% +% \item[For a preexisting macro, not defined with \pkg{xparse}:] An \HTML\ version +% is provided with a special name, inside a \env{warpHTML} environment, +% then \cs{LWR@formatted} is used to redefine and patch various macros: +% \begin{Verbatim}[gobble=2,obeytabs,tabsize=4,frame=lines] +% \begin{warpHTML} +% \newcommand{\LWR@HTML@name}{...}% may also use xparse +% +% \LWR@formatted{name} +% \end{warpHTML} +% \end{Verbatim} +% |\LWR@formatted{name}| copies the original print version, +% then redefines \cs{name} to use either the print or \HTML\ version depending +% on which mode \pkg{lwarp} is using. \pkg{xparse} may be used to +% define the new \HTML\ version, even if the original did not use \pkg{xparse}. + +% \item[For a preexisiting environment, not defined with \pkg{xparse}:] The process +% is similar. Note the use of \cs{LWR@formattedenv} instead of \cs{LWR@formatted}. +% \begin{Verbatim}[gobble=2,obeytabs,tabsize=4,frame=lines] +% \begin{warpHTML} +% \newenvironment{LWR@HTML@name}{...}% may also use xparse +% +% \LWR@formattedenv{name} +% \end{warpHTML} +% \end{Verbatim} + +% \item[If the original used \pkg{xparse}:] A copy must be made using a new name: +% \begin{Verbatim}[gobble=2,obeytabs,tabsize=4,frame=lines] +% \begin{warpHTML} +% \NewDocumentCommand{\LWR@print@name}{..}{..}% copy the original +% +% \NewDocumentCommand{\LWR@HTML@name}{..}{..}% or use \newcommand +% +% \LWR@formatted{name} +% \end{warpHTML} +% \end{Verbatim} +% Similar for an environment, using \cs{LWR@formattedenv}. +% (\cs{LWR@formatted} and \cs{LWR@formattedenv} use \cs{LetLtxMacro} to +% copy the original print definiton, +% which may not work with macros and environments created by \pkg{xparse}, +% so the print version must be manually recreated in the \pkg{lwarp} source.) + +% \item[For a new macro or environment, not using \pkg{xparse} for the print version:] \ +% \begin{Verbatim}[gobble=2,obeytabs,tabsize=4,frame=lines] +% \begin{warpall} +% \newcommand{\name}{...}% NOT xparse! +% \end{warpall} +% +% \begin{warpHTML} +% \newcommand{\LWR@HTML@name}{...}% may use xparse for HTML +% +% \LWR@formatted{name} +% \end{warpHTML} +% \end{Verbatim} +% Similar for an environment. +% The plain \cs{name} or environment \env{name} is used for the printed +% version, and is placed inside \env{warpall}. +% \pkg{xparse} may be used for the \cs{LWR@HTML@<name>} version. +% +% \item [For a new macro or environment, using \pkg{xparse}:] +% It is possible to use \pkg{xparse} for an entirely new macro or environment +% by defining the \cs{LWR@print@<name>} version with \pkg{xparse}, along with +% \cs{name} defined without \pkg{xparse} to refer directly to the \cs{LWR@print} +% version: +% \begin{Verbatim}[gobble=2,obeytabs,tabsize=4,frame=lines] +% \begin{warpall} +% \NewDocumentCommand{\LWR@print@name}{...} {...}% -or- +% \NewDocumentEnvironment{\LWR@print@name}{...} {...} {...} +% +% % Simply a call to \LWR@print@name: +% \newcommand{\name}{\LWR@print@name}% -or- +% \newenvironment{name}{\LWR@print@name}{\endLWR@print@name} +% \end{warpall} +% +% \begin{warpHTML} +% \NewDocumentCommand{\LWR@HTML@name}{...} {...}% -or- +% \NewDocumentEnvironment{\LWR@HTML@name}{...} {...} {...} +% +% \LWR@formatted{name}% -or- +% \LWR@formattedenv{name} +% \end{warpHTML} +% \end{Verbatim} +% +% \end{description} +% +% In general, \cs{LWR@formatted} or \cs{LWR@formattedenv} are placed inside +% a \env{warpHTML} environment, and while producing an \HTML\ document +% they do the following: +% \begin{itemize} +% \item Macros are modified: +% \begin{enumerate} +% \item The pre-existing print version \cs{name} is saved as \cs{LWR@print@<name>}, +% unless \cs{LWR@print@<name>} is already defined. +% \item The original \cs{name} is redefined to call either the print or \HTML\ version +% depending on which format is in use at the moment, as set by \cs{LWR@formatting}, +% which is defined as either ``|print|'' or ``|HTML|''. +% \end{enumerate} +% \item When \pkg{lwarp} is producing a print document, the original definitions are +% used, as well as any new definitions defined in \env{warpall} above. +% \item When \pkg{lwarp} is generating \HTML\ output, \cs{LWR@formatting} is +% set to ``|HTML|'', and \cs{name} is directed to \cs{LWR@HTML@<name>}. +% \item When \pkg{lwarp} is generating \HTML\ output +% but enters a \env{lateximage} environment, +% or for some other reason needs to draw images using the original print +% defintions, \cs{LWR@formatting} is changed to ``|print|'' and \cs{name} is +% then redirected to \cs{LWR@print@<name>}, which was the original \cs{name}. +% \end{itemize} +% +% Since arguments are not handled by the new \cs{name}, any star and other arguments +% are processed by the print or \HTML\ version. +% +% Expandable versions are also provided as well: +% \begin{sourcedisplay} +% \cs{LWR@expandableformatted} \\ +% \cs{LWR@expandableformattedenv} +% \end{sourcedisplay} +% +% (Older versions of \pkg{lwarp} used \cs{LetLtxMacro} for everything, +% but this could fail when using macros defined by \pkg{xparse}. +% This older system is still in use for many definitions.) +% ^^A *8* Modify the above when all old \lets are removed. +% +% \changes{v0.57}{2018/05/28}{New system for switching print and HTML outputs.} +% +% \codehtml +% \begin{macrocode} +\begin{warpHTML} +% \end{macrocode} +% +% +% \begin{macro}{\LWR@formatting} Remembers if selected print/\HTML\ formatting. +% +% Used while \cs{LWR@restoreorigformatting}, such as in an \env{lateximage}. +% May be set to either ``|print|'' or ``|HTML|''. +% +% \begin{macrocode} +\newcommand*{\LWR@formatting}{HTML} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\LWR@formatted} \marg{macroname} \qquad No backslash in the macro name. +% +% If not yet defined, defines \cs{LWR@print@<name>} as +% the original print-mode \cs{<name>}. +% Also redefines \cs{<name>} to use \cs{LWR@<format>@<name>}, +% where <format> is set by \cs{LWR@formatting}, and is |print| or |HTML|. +% \begin{macrocode} +\newcommand*{\LWR@formatted}[1]{% + \ifcsundef{LWR@print@#1}{% + \expandafter\LetLtxMacro\csname LWR@print@#1\expandafter\endcsname% + \csname#1\endcsname% + }{}% + \ifcsundef{#1}{% + \expandafter\newrobustcmd\csname #1\endcsname{% + \csuse{LWR@\LWR@formatting @#1}% + }% + }{% + \expandafter\renewrobustcmd\csname #1\endcsname{% + \csuse{LWR@\LWR@formatting @#1}% + }% + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\LWR@expandableformatted} \marg{macroname} \qquad No backslash +% in the macro name. +% +% An expandable version of \cs{LWR@formatted}. +% \begin{macrocode} +\newcommand*{\LWR@expandableformatted}[1]{% + \ifcsundef{LWR@print@#1}{% + \expandafter\LetLtxMacro\csname LWR@print@#1\expandafter\endcsname% + \csname#1\endcsname% + }{}% + \ifcsundef{#1}{% + \expandafter\newcommand\csname #1\endcsname{% + \csuse{LWR@\LWR@formatting @#1}% + }% + }{% + \expandafter\renewcommand\csname #1\endcsname{% + \csuse{LWR@\LWR@formatting @#1}% + }% + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\LWR@formattedenv} \marg{environmentname} +% +% If not yet defined, defines the environment \env{LWR@print@<name>} as +% the original print-mode \env{<name>}. +% Also redefines the environment |<name>| to use environment |LWR@<format>@<name>|, +% where <format> is set by \cs{LWR@formatting}, and is |print| or |HTML|. +% \begin{macrocode} +\newcommand*{\LWR@formattedenv}[1]{% + \ifcsundef{LWR@print@#1}{% + \expandafter\LetLtxMacro\csname LWR@print@#1\expandafter\endcsname% + \csname#1\endcsname% + \csletcs{endLWR@print@#1}{end#1}% + }{}% + \DeclareDocumentEnvironment{#1}{}% + {\csuse{LWR@\LWR@formatting @#1}}% + {\csuse{endLWR@\LWR@formatting @#1}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\LWR@expandableformattedenv} \marg{environmentname} +% +% An expandable version of \env{LWR@formattedenv}. +% \begin{macrocode} +\newcommand*{\LWR@expandableformattedenv}[1]{% + \ifcsundef{LWR@print@#1}{% + \expandafter\LetLtxMacro\csname LWR@print@#1\expandafter\endcsname% + \csname#1\endcsname% + \csletcs{endLWR@print@#1}{end#1}% + }{}% + \DeclareExpandableDocumentEnvironment{#1}{}% + {\csuse{LWR@\LWR@formatting @#1}}% + {\csuse{endLWR@\LWR@formatting @#1}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\end{warpHTML} +% \end{macrocode} + + % \section{HTML-conversion output modifications} % % These booleans modify the \HTML\ output in various ways @@ -9776,10 +10208,7 @@ top=1in,bottom=1in,% % Will be changed to \HTML\ commands for most uses. % Will be temporarily restored to original meaning inside any lateximage environment. % Also nullify unused commands. -% \begin{macrocode} -\LetLtxMacro\LWR@origmbox\mbox -\LetLtxMacro\LWR@origmakebox\makebox -% \end{macrocode} +% % Some packages redefine \cs{\#}, which is used to generate \HTML, so the original must % be remembered here. % \changes{v0.51}{2018/03/12}{Fix: Remember original \cs{\#} in case is redefined.} @@ -9793,17 +10222,13 @@ top=1in,bottom=1in,% \let\LWR@origenskip\enskip \let\LWR@origquad\quad \let\LWR@origqquad\qquad - -\let\LWR@orighspace\hspace \let\LWR@orighfill\hfill \let\LWR@orighfil\hfil -\let\LWR@origvspace\vspace \let\LWR@orighss\hss \let\LWR@origllap\llap \let\LWR@origrlap\rlap \let\LWR@orighfilneg\hfilneg -\let\LWR@origrule\rule \let\LWR@orighrulefill\hrulefill \let\LWR@origdotfill\dotfill @@ -9823,29 +10248,29 @@ top=1in,bottom=1in,% \let\LWR@orighuge\huge \let\LWR@origHuge\Huge -\LetLtxMacro{\LWR@origtextrm}{\textrm} -\LetLtxMacro{\LWR@origtextsf}{\textsf} -\LetLtxMacro{\LWR@origtexttt}{\texttt} -\LetLtxMacro{\LWR@origtextnormal}{\textnormal} -\LetLtxMacro{\LWR@origtextbf}{\textbf} -\LetLtxMacro{\LWR@origtextmd}{\textmd} -\LetLtxMacro{\LWR@origtextit}{\textit} -\LetLtxMacro{\LWR@origtextsl}{\textsl} -\LetLtxMacro{\LWR@origtextsc}{\textsc} -\LetLtxMacro{\LWR@origtextup}{\textup} -\LetLtxMacro{\LWR@origemph}{\emph} - -\LetLtxMacro{\LWR@origrmfamily}{\rmfamily} -\LetLtxMacro{\LWR@origsffamily}{\sffamily} -\LetLtxMacro{\LWR@origttfamily}{\ttfamily} -\LetLtxMacro{\LWR@origbfseries}{\bfseries} -\LetLtxMacro{\LWR@origmdseries}{\mdseries} -\LetLtxMacro{\LWR@origupshape}{\upshape} -\LetLtxMacro{\LWR@origslshape}{\slshape} -\LetLtxMacro{\LWR@origscshape}{\scshape} -\LetLtxMacro{\LWR@origitshape}{\itshape} -\LetLtxMacro{\LWR@origem}{\em} -\LetLtxMacro{\LWR@orignormalfont}{\normalfont} +\LetLtxMacro\LWR@origtextrm\textrm +\LetLtxMacro\LWR@origtextsf\textsf +\LetLtxMacro\LWR@origtexttt\texttt +\LetLtxMacro\LWR@origtextnormal\textnormal +\LetLtxMacro\LWR@origtextbf\textbf +\LetLtxMacro\LWR@origtextmd\textmd +\LetLtxMacro\LWR@origtextit\textit +\LetLtxMacro\LWR@origtextsl\textsl +\LetLtxMacro\LWR@origtextsc\textsc +\LetLtxMacro\LWR@origtextup\textup +\LetLtxMacro\LWR@origemph\emph + +\LetLtxMacro\LWR@origrmfamily\rmfamily +\LetLtxMacro\LWR@origsffamily\sffamily +\LetLtxMacro\LWR@origttfamily\ttfamily +\LetLtxMacro\LWR@origbfseries\bfseries +\LetLtxMacro\LWR@origmdseries\mdseries +\LetLtxMacro\LWR@origupshape\upshape +\LetLtxMacro\LWR@origslshape\slshape +\LetLtxMacro\LWR@origscshape\scshape +\LetLtxMacro\LWR@origitshape\itshape +\LetLtxMacro\LWR@origem\em +\LetLtxMacro\LWR@orignormalfont\normalfont \let\LWR@origraggedright\raggedright \let\LWR@origonecolumn\onecolumn @@ -9876,10 +10301,6 @@ top=1in,bottom=1in,% \let\LWR@origthispagestyle\thispagestyle \LetLtxMacro\LWR@origpagenumbering\pagenumbering -\LetLtxMacro\LWR@origminipage\minipage -\let\LWR@origendminipage\endminipage -\LetLtxMacro{\LWR@origparbox}{\parbox} - \let\LWR@orignewline\newline @@ -9903,7 +10324,7 @@ top=1in,bottom=1in,% \let\LWR@origpar\par -\LetLtxMacro{\LWR@origfootnote}{\footnote} +\LetLtxMacro\LWR@origfootnote\footnote \let\LWR@orig@mpfootnotetext\@mpfootnotetext \let\LWR@origclearpage\clearpage @@ -9941,18 +10362,18 @@ top=1in,bottom=1in,% % % For Unicode engines, only \cs{t} needs to be redefined: % \begin{macrocode} -\LetLtxMacro{\LWR@origt}{\t} +\LetLtxMacro\LWR@origt\t % \end{macrocode} % For pdf\LaTeX, additional work is required: % \begin{macrocode} \ifPDFTeX -\LetLtxMacro{\LWR@origequalaccent}{\=} -\LetLtxMacro{\LWR@origdotaccent}{\.} -\LetLtxMacro{\LWR@origu}{\u} -\LetLtxMacro{\LWR@origv}{\v} -\LetLtxMacro{\LWR@origc}{\c} -\LetLtxMacro{\LWR@origd}{\d} -\LetLtxMacro{\LWR@origb}{\b} +\LetLtxMacro\LWR@origequalaccent\= +\LetLtxMacro\LWR@origdotaccent\. +\LetLtxMacro\LWR@origu\u +\LetLtxMacro\LWR@origv\v +\LetLtxMacro\LWR@origc\c +\LetLtxMacro\LWR@origd\d +\LetLtxMacro\LWR@origb\b % \end{macrocode} % The \HTML\ redefinitions follow. % @@ -9978,18 +10399,18 @@ top=1in,bottom=1in,% % \begin{macrocode} \ifPDFTeX \newcommand*{\LWR@restoreorigaccents}{% -\LetLtxMacro{\=}{\LWR@origequalaccent}% -\LetLtxMacro{\.}{\LWR@origdotaccent}% -\LetLtxMacro{\u}{\LWR@origu}% -\LetLtxMacro{\v}{\LWR@origu}% -\LetLtxMacro{\t}{\LWR@origt}% -\LetLtxMacro{\c}{\LWR@origc}% -\LetLtxMacro{\d}{\LWR@origd}% -\LetLtxMacro{\b}{\LWR@origb}% +\LetLtxMacro\=\LWR@origequalaccent% +\LetLtxMacro\.\LWR@origdotaccent% +\LetLtxMacro\u\LWR@origu% +\LetLtxMacro\v\LWR@origu% +\LetLtxMacro\t\LWR@origt% +\LetLtxMacro\c\LWR@origc% +\LetLtxMacro\d\LWR@origd% +\LetLtxMacro\b\LWR@origb% }% \else% XeLaTeX, LuaLaTeX: \newcommand*{\LWR@restoreorigaccents}{% -\LetLtxMacro{\t}{\LWR@origt}% +\LetLtxMacro\t\LWR@origt% }% \fi% }% AtBeginDocument @@ -10173,6 +10594,8 @@ homehtmlfilename = "\HomeHTMLFilename"% % \changes{v0.54}{2018/04/24}{\filenm{lwarp.css}: Fix: Text-decoration-skip: auto.} % \changes{v0.56}{2018/04/27}{\filenm{lwarp.css}: Added \attribute{span.textbf}, etc.} % \changes{v0.56}{2018/05/09}{\filenm{lwarp.css}: Added \attribute{div.textbf}, etc.} +% \changes{v0.57}{2018/05/21}{\filenm{lwarp.css}: Added ruled, boxed, boxruled floats.} +% \changes{v0.57}{2018/05/21}{\filenm{lwarp.css}: Increased float vertical margins.} % % ^^A *lwarp.css % \begin{macrocode} @@ -11000,7 +11423,7 @@ img.logoimage{ figure { - margin: 3ex auto 3ex auto ; + margin: 5ex auto 5ex auto ; padding: 1ex 1em 1ex 1em ; overflow-x: auto ; } @@ -11065,6 +11488,28 @@ figure div.floatrow div.minipage figcaption { } +/* For packages such as float, rotfloat, and algorithm2e: */ + +figure.boxed, figure.boxruled { + border: 1px solid black ; +} + +figure.ruled { + border-top: 1px solid black ; + border-bottom: 1px solid black ; + border-left: 0px ; + border-right: 0px ; + border-radius: 0px ; + background: none ; + box-shadow: none ; +} + +figure.ruled figcaption, figure.boxruled figcaption { + border-top: 1px solid silver ; + border-bottom: 1px solid silver ; +} + + table { margin: 1ex auto 1ex auto ; border-collapse: separate ; @@ -11366,8 +11811,33 @@ div.multicols { -webkit-columns: 3 380px ; div.multicols p {margin-top: 0ex} +/* Used for algorithm2e: */ +div.alg2evline{ + margin-left: 1em ; + padding-left: 1em ; + border-left: 1px solid black ; + border-radius: 0px 0px 0px 1ex ; +} -/* Used to support algorithmicx: */ +div.alg2evsline{ + margin-left: 1em ; + padding-left: 1em ; + border-left: 1px solid black ; +} + +div.alg2enoline{ + margin-left: 1em ; + padding-left: 1em ; +} + +span.alg2elinenumber{ + margin-right: .5em ; + font-size: 50% ; + color: red ; +} + + +/* Used for algorithmicx: */ span.floatright { float: right ; } @@ -11997,7 +12467,7 @@ div.fancyvrblabel{ figure { - margin: 3ex 5% 3ex 5% ; + margin: 5ex 5% 5ex 5% ; padding: 1ex 1em 1ex 1em ; background-color: #fffcf5 ; overflow-x: auto ; @@ -12309,7 +12779,7 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX- -% \subsection{lwarpmk option} +% \subsection{lwarpmk.lua — lwarpmk option} % \DescribeOption{lwarpmk} Creates a local copy of \prog{lwarpmk}. % @@ -12368,6 +12838,8 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX- % \changes{v0.54}{2018/04/19}{\prog{lwarpmk}: Improved error if configuration file does not exist.} % \changes{v0.56}{2018/04/29}{\prog{lwarpmk}: Added \progcode{lwarpmk pdftosvg}.} % \changes{v0.56}{2018/05/11}{\prog{lwarpmk}: Supports \texttt{-shell-escape}.} +% \changes{v0.57}{2018/05/20}{\prog{lwarpmk}: Improved code factoring.} +% \changes{v0.57}{2018/05/20}{\prog{lwarpmk}: Improved error handling.} % % The following is only generated if the \optn{lwarpmk} option % was given to \pkg{lwarp}. @@ -12382,15 +12854,19 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX- -- Copyright 2016-2018 Brian Dunn --- Print the usage of the lwarpmk command: -printversion = "v0.56" +printversion = "v0.57" + function printhelp () print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ; end + function printusage () +-- +-- Print the usage of the lwarpmk command: +-- print ( [[ lwarpmk print [project]: Compile the print version if necessary. @@ -12418,9 +12894,11 @@ lwarpmk --help: Print this help message. printconf () end --- Print the format of the configuration file lwarpmk.conf: function printconf () +-- +-- Print the format of the configuration file lwarpmk.conf: +-- print ( [[ An example lwarpmk.conf or <project>.lwarpmkconf project file: -- @@ -12443,11 +12921,13 @@ Values must be in upright "quotes". end + +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|* - -function splitfile (destfile,sourcefile) +-- print ("lwarpmk: Splitting " .. sourcefile .. " into " .. destfile) ; local sfile = io.open(sourcefile) io.output(destfile) @@ -12464,20 +12944,27 @@ end -- do io.close(sfile) end -- function --- Incorrect value, so print an error and exit. function cvalueerror ( line, linenum , cvalue ) +-- +-- Incorrect value, so print an error and exit. +-- print ("lwarpmk: ===") print ("lwarpmk: " .. linenum .. " : " .. line ) ; - print ("lwarpmk: incorrect variable value \"" .. cvalue .. "\" in lwarpmk.conf.\n" ) ; + print ( + "lwarpmk: incorrect variable value \"" .. cvalue .. + "\" in lwarpmk.conf.\n" + ) ; print ("lwarpmk: ===") printconf () ; os.exit(1) ; end --- Load settings from the project's "lwarpmk.conf" file: function loadconf () +-- +-- Load settings from the project's "lwarpmk.conf" file: +-- -- Default configuration filename: local conffile = "lwarpmk.conf" -- Optional configuration filename: @@ -12499,7 +12986,10 @@ if (lfs.attributes(conffile,"mode")==nil) then print ("lwarpmk: recompile using pdflatex, xelatex, or lualatex,") print ("lwarpmk: then try using lwarpmk again.") if ( arg[2] ~= nil ) then - print ("lwarpmk: (\"" .. arg[2] .. "\" does not appear to be a project name.)") + print ( + "lwarpmk: (\"" .. arg[2] .. + "\" does not appear to be a project name.)" + ) end print ("lwarpmk: ===") printhelp () ; @@ -12552,7 +13042,10 @@ elseif ( cvarname == "pdftotextenc" ) then pdftotextenc = cvalue else print ("lwarpmk: ===") print ("lwarpmk: " .. linenum .. " : " .. line ) ; - print ("lwarpmk: Incorrect variable name \"" .. cvarname .. "\" in " .. conffile ..".\n" ) ; + print ( + "lwarpmk: Incorrect variable name \"" .. cvarname .. "\" in " .. + conffile ..".\n" + ) ; print ("lwarpmk: ===") printconf () ; os.exit(1) ; @@ -12584,7 +13077,7 @@ if opsystem=="Unix" then -- For Unix / Linux / Mac OS: opquote= "\'" cmdgroupopenname = " ( " cmdgroupclosename = " ) " - seqname = " ; " + seqname = " && " bgname = " &" elseif opsystem=="Windows" then -- For Windows rmname = "DEL" @@ -12614,16 +13107,34 @@ end end -- loadconf +function executecheckerror ( executecommands , errormessage ) +-- +-- Execute an operating system call, +-- and maybe exit with an error message. +-- +local err +err = os.execute ( executecommands ) +if ( err ~= 0 ) then + print ("lwarpmk: ===") + print ("lwarpmk: " .. errormessage ) + print ("lwarpmk: ===") + os.exit(1) +end +end -- executecheckerror + + function refreshdate () os.execute(touchnamepre .. " " .. sourcename .. ".tex " .. touchnamepost) end + +function reruntoget (filesource) +-- -- Scan the LaTeX log file for the phrase "Rerun to get", -- indicating that the file should be compiled again. -- Return true if found. - -function reruntoget (filesource) +-- local fsource = io.open(filesource) for line in fsource:lines() do if ( string.find(line,"Rerun to get") ~= nil ) then @@ -12636,10 +13147,12 @@ return false end --- Compile one time, return true if should compile again. --- fsuffix is "" for print, "_html" for HTML output. function onetime (fsuffix) +-- +-- Compile one time, return true if should compile again. +-- fsuffix is "" for print, "_html" for HTML output. +-- print("lwarpmk: Compiling with " .. latexname .. " " .. sourcename..fsuffix) local thisshellescape = " " if ( shellescape == "true" ) then @@ -12647,21 +13160,19 @@ if ( shellescape == "true" ) then else thisshellescape = " " end -err = os.execute(latexname .. thisshellescape .. sourcename..fsuffix) -if ( err ~= 0 ) then - print ("lwarpmk: ===") - print ("lwarpmk: Compile error.") - print ("lwarpmk: ===") - os.exit(1) -end +executecheckerror ( + latexname .. thisshellescape .. sourcename..fsuffix , + "Compile error." +) return (reruntoget(sourcename .. fsuffix .. ".log") ) ; end +function manytimes (fsuffix) +-- -- Compile up to five times. -- fsuffix is "" for print, "_html" for HTML output - -function manytimes (fsuffix) +-- if onetime(fsuffix) == true then if onetime(fsuffix) == true then if onetime(fsuffix) == true then @@ -12670,9 +13181,11 @@ if onetime(fsuffix) == true then end end end end end end --- Exit if the given file does not exist. function verifyfileexists (filename) +-- +-- Exit if the given file does not exist. +-- if (lfs.attributes ( filename , "modification" ) == nil ) then print ("lwarpmk: ===") print ("lwarpmk: " .. filename .. " not found." ) ; @@ -12682,9 +13195,11 @@ end end --- Convert <project>_html.pdf into HTML files: function pdftohtml () +-- +-- Convert <project>_html.pdf into HTML files: +-- -- Convert to text: print ("lwarpmk: Converting " .. sourcename .."_html.pdf to " .. sourcename .. "_html.html") @@ -12695,9 +13210,11 @@ splitfile (homehtmlfilename .. ".html" , sourcename .. "_html.html") end +function removeaux () +-- -- Remove auxiliary files: -- All aux files are removed since there may be many bbl*.aux files. -function removeaux () +-- os.execute ( rmname .. " *.aux " .. sourcename ..".toc " .. sourcename .. "_html.toc " .. sourcename ..".lof " .. sourcename .. "_html.lof " .. @@ -12710,10 +13227,12 @@ os.execute ( rmname .. " *.aux " .. ) end +function checkhtmlpdfexists () +-- -- Error if the HTML document does not exist. --- The lateximages are drawn from the HTML PDF verison of the document, +-- The lateximages are drawn from the HTML PDF version of the document, -- so "lwarpmk html" must be done before "lwarpmk limages". -function checkhtmlpdfexists () +-- local htmlpdffile = io.open(sourcename .. "_html.pdf", "r") if ( htmlpdffile == nil ) then print ("") @@ -12726,8 +13245,11 @@ end io.close (htmlpdffile) end -- checkhtmlpdfexists --- Warning of a missing lateximages.txt file: + function warnlimages () +-- +-- Warning of a missing lateximages.txt file: +-- print ("lwarpmk: ===") print ("lwarpmk: \"lateximages.txt\" does not exist.") print ("lwarpmk: Your project does not use SVG math or other lateximages,") @@ -12741,9 +13263,11 @@ function warnlimages () end -- warnlimages +function checklimages () +-- -- Check lateximages.txt to see if need to recompile first. -- If any entry has a page number of zero, then there were incorrect images. -function checklimages () +-- print ("lwarpmk: Checking for a valid lateximages.txt file.") local limagesfile = io.open("lateximages.txt", "r") if ( limagesfile == nil ) then @@ -12775,91 +13299,34 @@ if ( pagezerowarning ) then print ("lwarpmk: ===") os.exit(1) ; end -- pagezerowarning -end -- checklateximages +end -- checklimages --- Create lateximages based on lateximages.txt: -function createlateximages () --- See if the document must be recompiled first: -checklimages () --- See if the print version exists: -checkhtmlpdfexists () --- Attempt to create the lateximages: -print ("lwarpmk: Creating lateximages.") -local limagesfile = io.open("lateximages.txt", "r") -if ( limagesfile == nil ) then - warnlateximages () - os.exit(1) -end --- Create the lateximages directory, ignore error if already exists -err = os.execute("mkdir lateximages") --- For Windows, create lwarp_one_limage.cmd from lwarp_one_limage.txt: -if opsystem=="Windows" then - err = os.execute ( - cpname .. " lwarp_one_limage.txt lwarp_one_limage.cmd" - ) - if ( err ~= 0 ) then - print ("lwarpmk: ===") - print ("lwarpmk: File error trying to copy") - print (" lwarp_one_limage.txt to lwarp_one_limage.cmd") - print ("lwarpmk: ===") - os.exit(1) ; - end -end -- create lwarp_one_limage.cmd --- Track the number of parallel processes -numimageprocesses = 0 --- Track warning to recompile if find a page 0 -pagezerowarning = false --- Scan lateximages.txt -for line in limagesfile:lines() do --- lwimgpage is the page number in the PDF which has the image --- lwimghash is true if this filename is a hash --- lwimgname is the lateximage filename root to assign for the image -i,j,lwimgpage,lwimghash,lwimgname = string.find (line,"|(.*)|(.*)|(.*)|") --- For each entry: -if ( (i~=nil) ) then --- Skip if the page number is 0: -if ( lwimgpage == "0" ) then - pagezerowarning = true -else --- Skip is this image is hashed and already exists: -local lwimgfullname = "lateximages" .. dirslash .. lwimgname .. ".svg" -if ( - (lwimghash ~= "true") or - (lfs.attributes(lwimgfullname,"mode")==nil) -- file not exists -) -then -- not hashed or not exists: --- Print the name of the file being generated: -print ( "lwarpmk: " .. lwimgname ) --- Touch/create the dest so that only once instance tries to build it: -err = os.execute(newtouchname .. " " .. lwimgfullname) -if ( err ~= 0 ) then - print ("lwarpmk: ===") - print ("lwarpmk: File error trying to touch " .. lwimgfullname) - print ("lwarpmk: ===") - os.exit(1) ; -end --- Separate out the image into its own single-page pdf: -if opsystem=="Unix" then --- For Unix / Linux / Mac OS: -err = os.execute( -cmdgroupopenname .. -"pdfseparate -f " .. lwimgpage .. " -l " .. lwimgpage .. " " .. - sourcename .."_html.pdf " .. - "lateximages" .. dirslash .."lateximagetemp-%d" .. ".pdf" .. - seqname .. --- Crop the image: -"pdfcrop --hires lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf " .. - "lateximages" .. dirslash .. lwimgname .. ".pdf" .. - seqname .. --- Convert the image to svg: -"pdftocairo -svg -noshrink lateximages" .. dirslash .. lwimgname .. ".pdf " .. - "lateximages" .. dirslash .. lwimgname ..".svg" .. - seqname .. --- Remove the temporary files: -rmname .. " lateximages" .. dirslash .. lwimgname .. ".pdf" .. seqname .. -rmname .. " lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf" .. -cmdgroupclosename .. " >/dev/null " .. bgname +function createuniximage ( lwimgfullname ) +-- +-- Create one lateximage for Unix / Linux / Mac OS. +-- +executecheckerror ( + cmdgroupopenname .. + "pdfseparate -f " .. lwimgpage .. " -l " .. lwimgpage .. " " .. + sourcename .."_html.pdf " .. + "lateximages" .. dirslash .."lateximagetemp-%d" .. ".pdf" .. + seqname .. + -- Crop the image: + "pdfcrop --hires lateximages" .. dirslash .. "lateximagetemp-" .. + lwimgpage .. ".pdf " .. + "lateximages" .. dirslash .. lwimgname .. ".pdf" .. + seqname .. + -- Convert the image to svg: + "pdftocairo -svg -noshrink lateximages" .. dirslash .. lwimgname .. ".pdf " .. + "lateximages" .. dirslash .. lwimgname ..".svg" .. + seqname .. + -- Remove the temporary files: + rmname .. " lateximages" .. dirslash .. lwimgname .. ".pdf" .. seqname .. + rmname .. " lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf" .. + cmdgroupclosename .. " >/dev/null " .. bgname + , + "File error trying to convert " .. lwimgfullname ) -- Every 32 images, wait for completion at below normal priority, -- allowing other image tasks to catch up. @@ -12867,10 +13334,15 @@ numimageprocesses = numimageprocesses + 1 if ( numimageprocesses > 32 ) then numimageprocesses = 0 print ( "lwarpmk: waiting" ) - err = os.execute ( "wait" ) + executecheckerror ( "wait" , "File error trying to wait.") end -elseif opsystem=="Windows" then --- For Windows +end -- createuniximage + + +function createwindowsimage ( lwimgfullname ) +-- +-- Create one lateximage for Windows. +-- -- Every 32 images, wait for completion at below normal priority, -- allowing other image tasks to catch up. numimageprocesses = numimageprocesses + 1 @@ -12882,30 +13354,96 @@ else thiswaitcommand = "" end -- Execute the image generation command -err = os.execute ( +executecheckerror ( "start /B " .. thiswaitcommand .. " \"\" lwarp_one_limage " .. lwimgpage .. " " .. lwimghash .. " " .. lwimgname .. " " .. sourcename .. " <nul >nul" + , + "File error trying to create image." ) -end -- Windows -if ( err ~= 0 ) then - print ("lwarpmk: ===") - print ("lwarpmk: File error trying to create one lateximage.") - print ("lwarpmk: ===") +end -- createwindowsimage + + +function createonelateximage ( line ) +-- +-- Given the next line of lateximages.txt, convert a single image. +-- +-- lwimgpage is the page number in the PDF which has the image +-- lwimghash is true if this filename is a hash +-- lwimgname is the lateximage filename root to assign for the image +i,j,lwimgpage,lwimghash,lwimgname = string.find (line,"|(.*)|(.*)|(.*)|") +-- For each entry: +if ( (i~=nil) ) then + -- Skip if the page number is 0: + if ( lwimgpage == "0" ) then + pagezerowarning = true + else + -- Skip is this image is hashed and already exists: + local lwimgfullname = "lateximages" .. dirslash .. lwimgname .. ".svg" + if ( + (lwimghash ~= "true") or + (lfs.attributes(lwimgfullname,"mode")==nil) -- file not exists + ) + then -- not hashed or not exists: + -- Print the name of the file being generated: + print ( "lwarpmk: " .. lwimgname ) + -- Touch/create the dest so that only once instance tries to build it: + executecheckerror ( + newtouchname .. " " .. lwimgfullname , + "File error trying to touch " .. lwimgfullname + ) + -- Separate out the image into its own single-page pdf: + if opsystem=="Unix" then + createuniximage (lwimgfullname) + elseif opsystem=="Windows" then + createwindowsimage (lwimgfullname) + end + end -- not hashed or not exists + end -- not page 0 +end -- not nil +end -- createonelateximage + + +function createlateximages () +-- +-- Create lateximages based on lateximages.txt: +-- +-- See if the document must be recompiled first: +checklimages () +-- See if the print version exists: +checkhtmlpdfexists () +-- Attempt to create the lateximages: +print ("lwarpmk: Creating lateximages.") +local limagesfile = io.open("lateximages.txt", "r") +if ( limagesfile == nil ) then + warnlateximages () os.exit(1) end -end -- not hashed or not exists -end -- not page 0 -end -- not nil +-- Create the lateximages directory, ignore error if already exists +err = os.execute("mkdir lateximages") +-- For Windows, create lwarp_one_limage.cmd from lwarp_one_limage.txt: +if opsystem=="Windows" then + executecheckerror ( + cpname .. " lwarp_one_limage.txt lwarp_one_limage.cmd" , + "File error trying to copy lwarp_one_limage.txt to lwarp_one_limage.cmd" + ) +end -- create lwarp_one_limage.cmd +-- Track the number of parallel processes +numimageprocesses = 0 +-- Track warning to recompile if find a page 0 +pagezerowarning = false +-- Scan lateximages.txt +for line in limagesfile:lines() do + createonelateximage ( line ) end -- do io.close(limagesfile) print ( "lwarpmk limages: ===") print ( "lwarpmk limages: Wait a moment for the images to complete" ) -print ( "lwarpmk limages: before reloading the page." ) +print ( "lwarpmk limages: before reloading the page." ) print ( "lwarpmk limages: ===") -print ( "lwarpmk limages: done" ) +print ( "lwarpmk limages: Done." ) if ( pagezerowarning == true ) then print ( "lwarpmk limages: WARNING: Images will be incorrect." ) print ( "lwarpmk limages: Enter \"lwarpmk cleanlimages\", then" ) @@ -12915,9 +13453,11 @@ end -- pagezerowarning end -- function +function compilelatexmk ( fsuffix ) +-- -- Use latexmk to compile source and index: -- fsuffix is "" for print, or "_html" for HTML -function compilelatexmk ( fsuffix ) +-- -- Maybe select the shell-escape option: local thisshellescape = " " if ( shellescape == "true" ) then @@ -12927,7 +13467,8 @@ else end -- The recorder option is required to detect changes in <project>.tex -- while we are loading <project>_html.tex. -err=os.execute ( "latexmk -pdf -dvi- -ps- -recorder " +executecheckerror ( + "latexmk -pdf -dvi- -ps- -recorder " .. "-e " .. opquote .. "$makeindex = q/" -- $ @@ -12937,19 +13478,19 @@ err=os.execute ( "latexmk -pdf -dvi- -ps- -recorder " .. " -L " .. xindylanguage .. " /" .. opquote .. " -pdflatex=\"" .. latexname .. thisshellescape .." %O %S\" " - .. sourcename..fsuffix ..".tex" ) ; -if ( err ~= 0 ) then - print ("lwarpmk: ===") - print ("lwarpmk: Compile error.") - print ("lwarpmk: ===") - os.exit(1) -end + .. sourcename..fsuffix ..".tex" + , + "Compile error." +) end -- function + +function convertpdftosvg () +-- -- Converts PDF files to SVG files. -- The filenames are arg[2] and up. -- arg[1] is the command "pdftosvg". -function convertpdftosvg () +-- for i = 2 , #arg do if (lfs.attributes(arg[i],"mode")==nil) then print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.") @@ -12960,6 +13501,11 @@ for i = 2 , #arg do end -- do end --function + + +-- Start of the main code: -- + + -- lwarpmk --version : if (arg[1] == "--version") then @@ -12967,10 +13513,12 @@ print ( "lwarpmk: " .. printversion ) else -- not --version + -- print intro: print ("lwarpmk: " .. printversion .. " Automated make for the LaTeX lwarp package.") + -- lwarpmk print: if arg[1] == "print" then @@ -12996,12 +13544,16 @@ else -- not latexmk end end -- not latexmk + +-- lwarpmk print1: + elseif arg[1] == "print1" then loadconf () verifyfileexists (sourcename .. ".tex") ; onetime("") print ("lwarpmk: Done.") ; + -- lwarp printindex: -- Compile the index then touch the source -- to trigger a recompile of the document: @@ -13020,6 +13572,7 @@ refreshdate () print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.") print ("lwarpmk: Done.") + -- lwarp printglossary: -- Compile the glossary then touch the source -- to trigger a recompile of the document: @@ -13039,6 +13592,7 @@ refreshdate () print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.") print ("lwarpmk: Done.") + -- lwarpmk html: elseif arg[1] == "html" then @@ -13066,6 +13620,9 @@ else -- not latexmk end end -- not latexmk + +-- lwarpmk html1: + elseif arg[1] == "html1" then loadconf () verifyfileexists ( sourcename .. ".tex" ) ; @@ -13073,10 +13630,13 @@ elseif arg[1] == "html1" then pdftohtml () print ("lwarpmk: Done.") + +-- lwarpmk pdftohtml: elseif arg[1] == "pdftohtml" then loadconf () pdftohtml () + -- lwarpmk htmlindex: -- Compile the index then touch the source -- to trigger a recompile of the document: @@ -13096,6 +13656,7 @@ refreshdate () print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.") print ("lwarpmk: Done.") + -- lwarpmk htmlglossary: -- Compile the glossary then touch the source -- to trigger a recompile of the document: @@ -13116,6 +13677,7 @@ refreshdate () print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.") print ("lwarpmk: Done.") + -- lwarpmk limages: -- Scan the lateximages.txt file to create lateximages. @@ -13125,6 +13687,7 @@ print ("lwarpmk: Processing images.") createlateximages () print ("lwarpmk: Done.") + -- lwarpmk again: -- Touch the source to trigger a recompile. @@ -13135,6 +13698,7 @@ refreshdate () print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.") print ("lwarpmk: Done.") + -- lwarpmk clean: -- Remove project.aux, .toc, .lof, .lot, .idx, .ind, .log, *_html_inc.*, .gl* @@ -13143,6 +13707,7 @@ loadconf () removeaux () print ("lwarpmk: Done.") + -- lwarpmk cleanall -- Remove project.aux, .toc, .lof, .lot, .idx, .ind, .log, *_html_inc.*, .gl* -- and also project.pdf, *.html @@ -13156,6 +13721,7 @@ os.execute ( rmname .. " " .. ) print ("lwarpmk: Done.") + -- lwarpmk cleanlimages -- Remove images from the lateximages directory. @@ -13170,16 +13736,21 @@ elseif arg[1] == "pdftosvg" then convertpdftosvg () print ("lwarpmk: Done.") + -- lwarpmk with no argument : elseif (arg[1] == nil) then printhelp () + -- lwarpmk -h or lwarpmk --help : elseif (arg[1] == "-h" ) or (arg[1] == "--help") then printusage () + +-- Unknown command: + else printhelp () print ("\nlwarpmk: ****** Unknown command \""..arg[1].."\". ******\n") @@ -13425,6 +13996,152 @@ end -- not --version % \end{macrocode} + +% \section{Localizing catcodes} +% \label{sec:localizingcatcodes} +% +% \codeall +% \begin{macrocode} +\begin{warpall} +% \end{macrocode} +% +% Place \cs{StartDefiningTabulars} and +% \cs{StopDefiningTabulars}\watchout[misplaced alignment tab character \&] +% \index{alignment tab character \&, misplaced} +% \index{misplaced alignment tab character \&} +% before and after defining macros or environments which include +% the tabular |&| character in their definitions. +% +% The catcode of |&| must be changed before the definitions begin, +% and must be restored afterwards. Doing so avoids the error\\ +% \hspace*{.5in}\texttt{misplaced alignment tab character \&} +% +% \begin{macro}{\StartDefiningTabulars} Place before defining something with |&| in it. +% \changes{v0.33}{2017/06/20}{Add: Avoids error: \protect\texttt{misplaced alignment tab character \&}.} +% \begin{macrocode} +\newcommand{\StartDefiningTabulars}{% +\LWR@traceinfo{StartDefiningTabulars}% +\warpHTMLonly{\catcode`\&=\active}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\StopDefiningTabulars} Place after defining something with |&| in it. +% \begin{macrocode} +\newcommand{\StopDefiningTabulars}{% +\LWR@traceinfo{StopDefiningTabulars}% +\warpHTMLonly{\catcode`\&=4}% +} +% \end{macrocode} +% \end{macro} + + +% \DescribeBoolean{LWR@mathmacro} True if currently defining math macros. +% Used to disable \SVG\ math hashing and MathJax math contents while +% defining a macro using inline math. +% Begin a macro, it is not guaranteed that the contents are static, and so +% the image must be unique. The contents also almost certainly will not be +% parsed correctly by MathJax. +% \begin{macrocode} +\newbool{LWR@mathmacro} +\boolfalse{LWR@mathmacro} +% \end{macrocode} + +% \begin{macro}{\StartDefiningMath} Place before defining something with |$| in it. +% \changes{v0.57}{2018/05/23}{Added.} +% \begin{macrocode} +\newcommand{\StartDefiningMath}{% +\LWR@traceinfo{StartDefiningMath}% +\warpHTMLonly{\catcode`\$=\active}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\StopDefiningMath} Place after defining something with |$| in it. +% \begin{macrocode} +\newcommand{\StopDefiningMath}{% +\LWR@traceinfo{StopDefiningMath}% +\warpHTMLonly{\catcode`\$=3}% math shift +} +% \end{macrocode} +% \end{macro} + +% \begin{macrocode} +\end{warpall} +% \end{macrocode} + + +% \section{Localizing dynamic math} +% \label{sec:localizingdynamicmath} +% \index{SVG>math incorrect images} +% \index{SVG>dynamic math} +% \index{math>images incorrect} +% \index{math>dynamic} +% \index{dynamic math expressions} +% +% Inline \SVG\ math usually uses a hash of its contents to generate \env{lateximage}s +% which are reusable for multiple instances with the same contents. +% If the contents may change for each use, such as depending on the current +% value of a counter, then \cs{StartDynamicMath} must be used before the +% inline math expression, and \cs{StopDynamicMath} must be used after. +% +% For MathJax, the inline math expression is usually printed for MathJax to +% interpret. When marked as dynamic math, the following inline math expression +% will be displayed as an unhashed inline \SVG\ image instead. +% +% For existing code and packages, it may be possible to patch macros after +% they have been defined, using the \pkg{xpatch} package, +% which is pre-loaded by \pkg{lwarp}: +% \begin{Verbatim}[gobble=2,obeytabs,tabsize=4,frame=lines] +% \xpatchcmd{\macroname} +% {$math expression$} +% {\StartDynamicMath$math expression$\StopDynamicMath} +% {} +% {\typeout{Error patching macroname.}} +% \end{Verbatim} +% +% +% \codeall +% \begin{macrocode} +\begin{warpall} +% \end{macrocode} +% +% \DescribeBoolean{LWR@dynamicmath} True to mark inline math which is dynamic in +% nature, thus should not be hashed for reuse. +% \DescribeDefault{false} +% \begin{macrocode} +\newbool{LWR@dynamicmath} +\boolfalse{LWR@dynamicmath} +% \end{macrocode} +% +% \begin{macro}{\StartDynamicMath} Place before using |$| \dots\ |$| or \cs{(} \dots \cs{)} +% if the contents of the math are not static, depending on counters or dynamic macros. +% \changes{v0.57}{2018/05/23}{Added.} +% \begin{macrocode} +\newcommand{\StartDynamicMath}{% +\LWR@traceinfo{StartDynamicMath}% +\booltrue{LWR@dynamicmath}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\StopDynamicMath} Place after using |$| \dots\ |$| or \cs{(} \dots \cs{)} +% with dynamic contents. +% \begin{macrocode} +\newcommand{\StopDynamicMath}{% +\LWR@traceinfo{StopDynamicMath}% +\boolfalse{LWR@dynamicmath}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\end{warpall} +% \end{macrocode} + + + + % \section{Sanitizing labels and filenames} % % Special handling for underscores in labels and filenames. @@ -13704,9 +14421,7 @@ end -- not --version % The filename must be detokenized for underscores. % \begin{macrocode} \newcommand*{\LinkHome}{% -\LWR@subhyperrefclass{% -\HomeHTMLFilename.html}% -{Home}{linkhome}% +\LWR@subhyperrefclass{\HomeHTMLFilename.html}{Home}{linkhome}% } % \end{macrocode} % \end{macro} @@ -14188,7 +14903,7 @@ end -- not --version \begingroup% \LWR@FBcancel% \ifmmode\else\protect\LWR@origttfamily\fi% -\LWR@origmbox{\LWR@origtextless{}!{-}{-}}% +\LWR@print@mbox{\LWR@origtextless{}!{-}{-}}% \endgroup% }% } @@ -14199,7 +14914,7 @@ end -- not --version \begingroup% \LWR@FBcancel% \ifmmode\else\protect\LWR@origttfamily\fi% -\LWR@origmbox{{-}{-}\LWR@origtextgreater}% +\LWR@print@mbox{{-}{-}\LWR@origtextgreater}% \endgroup% }% } @@ -14382,49 +15097,58 @@ end -- not --version % \changes{v0.20}{2017/01/03}{Renamed from "blockclass".} % \changes{v0.20}{2017/01/17}{Added optional style.} % \changes{v0.34}{2017/08/02}{Moved optional argument in front of mandatory.} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} +% +% \codeprint +% \begin{macrocode} +\begin{warpprint} +\NewDocumentEnvironment{BlockClass}{o m}{}{}% +\end{warpprint} +% \end{macrocode} +% \end{environment} % % \codehtml % \begin{macrocode} \begin{warpHTML} -\NewDocumentEnvironment{BlockClass}{o m}% +\NewDocumentEnvironment{LWR@print@BlockClass}{o m}{}{}% +\NewDocumentEnvironment{LWR@HTML@BlockClass}{o m}% {% \LWR@origpar% \LWR@htmldivclass[#1]{#2}% } {\LWR@htmldivclassend{#2}} + +\LWR@formattedenv{BlockClass} \end{warpHTML} % \end{macrocode} % -% \codeprint -% \begin{macrocode} -\begin{warpprint} -\NewDocumentEnvironment{BlockClass}{o m}{}{}% -\end{warpprint} -% \end{macrocode} -% \end{environment} % % % \begin{macro}{\BlockClassSingle} \marg{class} \marg{text} \quad % A single-line \element{div}, without a paragraph tag for the line of text. % % \changes{v0.20}{2017/01/03}{Renamed from "LWR@htmldivclassline".} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} +% +% \codeall +% \begin{macrocode} +\begin{warpall} +\newcommand{\BlockClassSingle}[2]{#2} +\end{warpall} +% \end{macrocode} % % \codehtml % \begin{macrocode} \begin{warpHTML} -\newcommand{\BlockClassSingle}[2]{% +\newcommand{\LWR@HTML@BlockClassSingle}[2]{% \LWR@origpar% \LWR@htmlelementclassline{div}{#1}{#2}% } + +\LWR@formatted{BlockClassSingle} \end{warpHTML} % \end{macrocode} % -% \codeprint -% \begin{macrocode} -\begin{warpprint} -\newcommand{\BlockClassSingle}[2]{#2} -\end{warpprint} -% \end{macrocode} % % \end{macro} @@ -14434,15 +15158,8 @@ end -- not --version % % \changes{v0.20}{2017/01/03}{Renamed from "inlineclass".} % \changes{v0.34}{2017/08/02}{Moved optional argument in front of mandatory.} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % -% \codehtml -% \begin{macrocode} -\begin{warpHTML} -\NewDocumentCommand{\InlineClass}{o m +m}{% -\LWR@htmlspanclass[#1]{#2}{#3}% -} -\end{warpHTML} -% \end{macrocode} % \codeprint % \begin{macrocode} \begin{warpprint} @@ -14450,6 +15167,19 @@ end -- not --version \end{warpprint} % \end{macrocode} % \end{macro} +% +% \codehtml +% \begin{macrocode} +\begin{warpHTML} +\NewDocumentCommand{\LWR@print@InlineClass}{o m +m}{#3}% + +\NewDocumentCommand{\LWR@HTML@InlineClass}{o m +m}{% + \LWR@htmlspanclass[#1]{#2}{#3}% +} + +\LWR@formatted{InlineClass} +\end{warpHTML} +% \end{macrocode} % \begin{environment}{LWR@BlockClassWP} \marg{WPstyle} \marg{HTMLstyle} \marg{class} \quad @@ -14458,11 +15188,21 @@ end -- not --version % % \changes{v0.42}{2017/10/26}{Added to factor code.} % \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} +% +% \codeprint +% \begin{macrocode} +\begin{warpprint} +\NewDocumentEnvironment{LWR@BlockClassWP}{m m m}{}{}% +\end{warpprint} +% \end{macrocode} +% \end{environment} % % \codehtml % \begin{macrocode} \begin{warpHTML} -\NewDocumentEnvironment{LWR@BlockClassWP}{m m m}% +\NewDocumentEnvironment{LWR@print@LWR@BlockClassWP}{m m m}{}{}% +\NewDocumentEnvironment{LWR@HTML@LWR@BlockClassWP}{m m m}% {% \LWR@stoppars% \ifbool{FormatWP}% @@ -14470,7 +15210,7 @@ end -- not --version \addtocounter{LWR@thisautoidWP}{1}% \LWR@htmltag{% div class="#3" % - id="\LWR@origmbox{autoidWP-\arabic{LWR@thisautoidWP}}"% + id="\LWR@print@mbox{autoidWP-\arabic{LWR@thisautoidWP}}"% \ifblank{#1}{}{ style="#1"}% }% }% FormatWP @@ -14483,19 +15223,10 @@ end -- not --version \LWR@startpars% } {\LWR@htmldivclassend{#3}} + +\LWR@formattedenv{LWR@BlockClassWP} \end{warpHTML} % \end{macrocode} -% -% \codeprint -% \begin{macrocode} -\begin{warpprint} -\NewDocumentEnvironment{LWR@BlockClassWP}{m m m}{}{}% -\end{warpprint} -% \end{macrocode} -% \end{environment} -% -% - % \subsection{Closing HTML tags} @@ -15420,7 +16151,7 @@ end -- not --version \ifvoid\LWR@mpfootnotes\else \LWR@forcenewpage \begin{BlockClass}{footnotes} - \LWR@origvspace*{\baselineskip} + \LWR@print@vspace*{\baselineskip} \unvbox\LWR@mpfootnotes \setbox\LWR@mpfootnotes=\vbox{} \end{BlockClass} @@ -15774,6 +16505,7 @@ end -- not --version % \begin{macro}{\LWR@customizeMathJax} % \changes{v0.51}{2018/03/18}{MathJax: Nullifies \cs{ensuremath}.} +% \changes{v0.57}{2018/05/24}{MathJax: Supports \cs{footnote}, \cs{footnotemark}.} % \begin{macrocode} \newcommand{\LWR@customizeMathJax}{% \ifbool{mathjax}{ @@ -15782,6 +16514,10 @@ end -- not --version \(\newcommand\ensuremath[1]{##1}\) +\(\newcommand\footnote[2][]{\text{( Footnote ##1 )}}\) + +\(\newcommand\footnotemark[1][]{\text{( Footnote ##1 )}}\) + \LWR@htmlcomment{Additional customizations for MathJax:} \LWR@customizedMathJax @@ -16162,7 +16898,7 @@ end -- not --version % \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.} % \begin{macrocode} \newcommand*{\LWR@createautosec}[1]{% -\LWR@htmltag{#1 id="\LWR@origmbox{autosec-\arabic{page}}"}% +\LWR@htmltag{#1 id="\LWR@print@mbox{autosec-\arabic{page}}"}% } % \end{macrocode} % \end{macro} @@ -16941,10 +17677,10 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % % Tabular: % \begin{macrocode} -\LetLtxMacro{\LWR@origtabular}{\tabular} -\LetLtxMacro{\LWR@origendtabular}{\endtabular} -\LetLtxMacro{\tabular}{\LWR@tabular} -\LetLtxMacro{\endtabular}{\endLWR@tabular} +\LetLtxMacro\LWR@origtabular\tabular +\LetLtxMacro\LWR@origendtabular\endtabular +\LetLtxMacro\tabular\LWR@tabular +\LetLtxMacro\endtabular\endLWR@tabular % \end{macrocode} % Float captions: % \begin{macrocode} @@ -18048,7 +18784,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% \ifthenelse{\equal{#1}{}}{}{style="#1"}% }% \LWR@orignewline% pre - \leavevmode\unskip\LWR@origvspace*{-#2\baselineskip}% + \leavevmode\unskip\LWR@print@vspace*{-#2\baselineskip}% }{}% % \end{macrocode} % Use a mono-spaced font to preserve horizontal positioning. @@ -18076,7 +18812,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % Do not produce \HTML\ tags for \cs{hspace} inside a verse |par|. % Restore plain \LaTeX{} \cs{hspace} functionality: % \begin{macrocode} -\LetLtxMacro{\hspace}{\LWR@orighspace}% +\LWR@select@print@hspace% } % \end{macrocode} % \end{macro} @@ -18095,7 +18831,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % At the end of the environment, close the |pre|: % \begin{macrocode} \ifbool{LWR@verbtags}{% - \LWR@origvspace*{-#1\baselineskip}% + \LWR@print@vspace*{-#1\baselineskip}% \noindent\LWR@htmltag{/pre}\LWR@orignewline% pre }{}% % \end{macrocode} @@ -18302,7 +19038,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % May be locally redefined by \env{enumerate} or \env{description}. % \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.} % \begin{macrocode} -\newcommand*{\LWR@printopenlist}{ul style="\LWR@origmbox{list-style-type:none}"} +\newcommand*{\LWR@printopenlist}{ul style="\LWR@print@mbox{list-style-type:none}"} % \end{macrocode} % \end{macro} @@ -18541,7 +19277,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \begin{macrocode} \newcommand*{\LWR@itemizestart}{% \renewcommand*{\LWR@printcloselist}{\LWR@printcloseitemize} -\renewcommand*{\LWR@printopenlist}{ul style="\LWR@origmbox{list-style-type:none}"} +\renewcommand*{\LWR@printopenlist}{ul style="\LWR@print@mbox{list-style-type:none}"} \let\item\LWR@itemizeitem% \LWR@nulllistfills% } @@ -18559,7 +19295,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \begin{macrocode} \newcommand*{\LWR@enumeratestart}{% \renewcommand*{\LWR@printcloselist}{\LWR@printcloseitemize} -\renewcommand*{\LWR@printopenlist}{ul style="\LWR@origmbox{list-style-type:none}"} +\renewcommand*{\LWR@printopenlist}{ul style="\LWR@print@mbox{list-style-type:none}"} \let\item\LWR@itemizeitem% \LWR@nulllistfills% } @@ -18583,7 +19319,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % This causes \pkg{lwarp} to mistakenly place an empty span between % \HTML\ list tags. % \begin{macrocode} -\LetLtxMacro\hspace\LWR@nohspace% +\LWR@select@html@nohspace% % \end{macrocode} % Process the original \cs{item} code: % \begin{macrocode} @@ -18591,7 +19327,9 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \end{macrocode} % Restore \cs{hspace} for use in the item text: % \begin{macrocode} -\LetLtxMacro\hspace\LWR@hspace% +\LWR@select@html@hspace% +% \end{macrocode} +% \begin{macrocode} \LWR@htmltag{dt}#1\LWR@htmltag{/dt}% \LWR@orignewline% \LWR@htmltag{dd}% @@ -19088,60 +19826,14 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % % % -% \subsubsection{Localizing \progcode{\&} catcodes} -% \label{sec:localizingampersand} -% -% \codeall -% \begin{macrocode} -\begin{warpall} -% \end{macrocode} -% -% Place \cs{StartDefiningTabulars} and -% \cs{EndDefiningTabulars}\watchout[misplaced alignment tab character \&] -% \index{alignment tab character \&, misplaced} -% \index{misplaced alignment tab character \&} -% before and after defining macros or environments which include -% the tabular |&| character in their definitions. -% -% The catcode of |&| must be changed before the definitions begin, -% and must be restored afterwards. Doing so avoids the error\\ -% \hspace*{.5in}\texttt{misplaced alignment tab character \&} -% -% \begin{macro}{\StartDefiningTabulars} Place before defining something with |&| in it. -% \changes{v0.33}{2017/06/20}{Add: Avoids error: \protect\texttt{misplaced alignment tab character \&}.} -% \begin{macrocode} -\newcommand{\StartDefiningTabulars}{% -\LWR@traceinfo{StartDefiningTabulars}% -\warpHTMLonly{\catcode`\&=\active}% -} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\EndDefiningTabulars} Place after defining something with |&| in it. -% \begin{macrocode} -\newcommand{\EndDefiningTabulars}{% -\LWR@traceinfo{EndDefiningTabulars}% -\warpHTMLonly{\catcode`\&=4}% -} -% \end{macrocode} -% \end{macro} - -% \begin{macrocode} -\end{warpall} -% \end{macrocode} -% % % \subsubsection{Handling \progcode{\&}} % -% % \codehtml % \begin{macrocode} \begin{warpHTML} % \end{macrocode} % -% - -% % \changes{v0.15}{2016/03/31}{Ampersand (\&): Fixed handling when passed as an argument.} % % \begin{macro}{&} Will behave depending on whether it is being used inside \env{tabular}. @@ -20010,69 +20702,37 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \end{macrocode} % \end{macro} % -% Inside an \HTML\ \env{tabular}, each of \cs{columncolor} etc. is \cs{let} to -% the \cs{LWR@HTML} versions below. When \pkg{colortbl} is loaded, -% its definitions override the following. -% -% \begin{macro}{\columncolor} \oarg{model} \marg{color} \oarg{left overhang} \oarg{right overhang} -% \begin{macro}{\LWR@HTMLcolumncolor} \oarg{model} \marg{color} \oarg{left overhang} \oarg{right overhang} -% \begin{macrocode} -\NewDocumentCommand{\LWR@HTMLcolumncolor}{O{named} m o o}{} -% \end{macrocode} -% \end{macro} -% \end{macro} - % \begin{macro}{\rowcolor} \oarg{model} \marg{color} \oarg{left overhang} \oarg{right overhang} -% \begin{macro}{\LWR@HTMLrowcolor} \oarg{model} \marg{color} \oarg{left overhang} \oarg{right overhang} +% Print version. The \HTML\ version is in \pkg{lwarp-colortbl}. % Used before starting a tabular data cell, thus \cs{LWR@getmynexttoken}. % \begin{macrocode} -\NewDocumentCommand{\LWR@HTMLrowcolor}{O{named} m o o}{\LWR@getmynexttoken} +\newcommand*{\rowcolor}{\LWR@getmynexttoken}% % \end{macrocode} % \end{macro} -% \end{macro} - -% \begin{macro}{\cellcolor} \oarg{model} \marg{color} \oarg{left overhang} \oarg{right overhang} -% \begin{macro}{\LWR@HTMLcellcolor} \oarg{model} \marg{color} \oarg{left overhang} \oarg{right overhang} -% \begin{macrocode} -\NewDocumentCommand{\LWR@HTMLcellcolor}{O{named} m o o}{} -% \end{macrocode} -% \end{macro} -% \end{macro} % \begin{macro}{\arrayrulecolor} \oarg{model} \marg{color} +% \begin{macro}{\arrayrulecolornexttoken} \oarg{model} \marg{color} % -% The version for use outside a \env{tabular}. +% Print versions for use outside and inside a \env{tabular}: % \begin{macrocode} \newcommand{\arrayrulecolor}[2][named]{} +\newcommand{\arrayrulecolornexttoken}[2][named]{\LWR@getmynexttoken} % \end{macrocode} % \end{macro} - -% \begin{macro}{\LWR@HTMLarrayrulecolor} \oarg{model} \marg{color} -% -% The version for use inside a \env{tabular}. -% \begin{macrocode} -\newcommand{\LWR@HTMLarrayrulecolor}[2][named]{\LWR@getmynexttoken} -% \end{macrocode} % \end{macro} % \begin{macro}{\doublerulesepcolor} \oarg{model} \marg{color} +% \begin{macro}{\doublerulesepcolornexttoken} \oarg{model} \marg{color} % -% The version for use outside a \env{tabular}. +% Print versions for use inside and outside a \env{tabular}: % \begin{macrocode} \newcommand{\doublerulesepcolor}[2][named]{} +\newcommand{\doublerulesepcolornexttoken}[2][named]{\LWR@getmynexttoken} % \end{macrocode} % \end{macro} - -% \begin{macro}{\LWR@HTMLdoublerulesepcolor} \oarg{model} \marg{color} -% -% The version for use inside a \env{tabular}. -% \begin{macrocode} -\newcommand{\LWR@HTMLdoublerulesepcolor}[2][named]{\LWR@getmynexttoken} -% \end{macrocode} % \end{macro} - % \subsection{Starting a new row} % \begin{macro}{\LWR@maybenewtablerow} @@ -20702,7 +21362,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \begin{macrocode} \newcommand*{\LWR@WPcell}[2]{% \LWR@tdaddstyle% -\LWR@origmbox{text-align:#1}; \LWR@origmbox{vertical-align:#2}% +\LWR@print@mbox{text-align:#1}; \LWR@print@mbox{vertical-align:#2}% } % \end{macrocode} % \end{macro} @@ -21309,8 +21969,8 @@ rowspan="#2" % % \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.} % \begin{macrocode} \IfValueT{#1}{% vpos? -\ifstrequal{#1}{b}{style="\LWR@origmbox{vertical-align:bottom}" }{}% -\ifstrequal{#1}{t}{style="\LWR@origmbox{vertical-align:top}" }{}% +\ifstrequal{#1}{b}{style="\LWR@print@mbox{vertical-align:bottom}" }{}% +\ifstrequal{#1}{t}{style="\LWR@print@mbox{vertical-align:top}" }{}% }% vpos? }% rows? % \end{macrocode} @@ -21480,7 +22140,8 @@ rowspan="#2" % {% \refstepcounter{\LTcaptype}% \protected@edef\@currentlabel{% - \csuse{p@\LTcaptype}\csuse{the\LTcaptype}}% + \csuse{p@\LTcaptype}\csuse{the\LTcaptype}% + }% }% }{}% % \end{macrocode} @@ -21636,6 +22297,15 @@ rowspan="#2" % % \end{macrocode} % % +% \subsection{Multirow if not loaded} +% +% A default defintion in case \pkg{multirow} is not loaded. +% This is used during table parsing. +% \begin{macrocode} +\begin{warpHTML} +\newcommand{\multirow}[2][c]{} +\end{warpHTML} +% \end{macrocode} % % % \subsection{Multicolumnrow} @@ -21665,17 +22335,25 @@ rowspan="#2" % % % \changes{v0.39}{2017/08/31}{Added.} % \changes{v0.40}{2017/09/22}{Fix: Adapts to older \pkg{multirow} and \pkg{xparse}.} +% \changes{v0.57}{2018/06/01}{Improved print/\HTML\ output selection.} % -% After the user may have +% \cs{AtBeginDocument} to adjust after the user may have loaded \pkg{multirow}, +% which requires several tests to determine which version is loaded +% and thus which options are available. % \begin{macrocode} \AtBeginDocument{ % \end{macrocode} % % |\@ifundefined{@xmultirow}| determines if \pkg{multirow} was never loaded. % +% Null action if not loaded: % \begin{macrocode} \@ifundefined{@xmultirow} -{}% no version of multirow was loaded +{ +\DeclareExpandableDocumentCommand{\LWR@print@multicolumnrow}% + {+m +m +O{c} +m +O{0} +m +O{0pt} +m}% + {}% +}% no version of multirow was loaded {% \@xmultirow defined, so some version of multirow was loaded % \end{macrocode} % @@ -21683,17 +22361,19 @@ rowspan="#2" % % \pkg{multirow} was used, which included the \cs{ProvidesPackage} macro. % % \begin{macrocode} +% The print version: +% \begin{macrocode} \@ifpackageloaded{multirow}{% v2.0 or newer \@ifpackagelater{multirow}{2016/09/01}% 2016/09/27 for v2.0 {% v2.0+: -\DeclareExpandableDocumentCommand{\LWR@origmulticolumnrow}% +\DeclareExpandableDocumentCommand{\LWR@print@multicolumnrow}% {+m +m +O{c} +m +O{0} +m +O{0pt} +m}% -{\multicolumn{#1}{#2}{\@xmultirow[#3]{#4}[#5]{#6}[#7]{#8}}}% + {\multicolumn{#1}{#2}{\@xmultirow[#3]{#4}[#5]{#6}[#7]{#8}}}% } {% loaded but older, probably not executed: -\DeclareExpandableDocumentCommand{\LWR@origmulticolumnrow}% +\DeclareExpandableDocumentCommand{\LWR@print@multicolumnrow}% {+m +m +O{c} +m +O{0} +m +O{0pt} +m}% -{\multicolumn{#1}{#2}{\@xmultirow{#4}[#5]{#6}[#7]{#8}}}% + {\multicolumn{#1}{#2}{\@xmultirow{#4}[#5]{#6}[#7]{#8}}}% } }% packageloaded{multirow} % \end{macrocode} @@ -21704,18 +22384,15 @@ rowspan="#2" % % % \begin{macrocode} {% v1.6 or older did not \ProvidePackage -\DeclareExpandableDocumentCommand{\LWR@origmulticolumnrow}% +\DeclareExpandableDocumentCommand{\LWR@print@multicolumnrow}% {+m +m +O{c} +m +O{0} +m +O{0pt} +m}% -{\multicolumn{#1}{#2}{\@xmultirow{#4}[#5]{#6}[#7]{#8}}}% + {\multicolumn{#1}{#2}{\@xmultirow{#4}[#5]{#6}[#7]{#8}}}% } -% \end{macrocode} -% -% The user-level interface. This is provided if the \HTML\ version was -% not already given. -% -% \begin{macrocode} -\providecommand*{\multicolumnrow}{\LWR@origmulticolumnrow} -}% \@xmultirow defined, so multirow was loaded + +}% \@ifundefined{@xmultirow} + +\providecommand*{\multicolumnrow}{\LWR@print@multicolumnrow} + }% AtBeginDocument % \end{macrocode} % \end{macro} @@ -22055,9 +22732,6 @@ rowspan="#2" % % \end{macro} - - - % \subsection{HTML \env{tabular} environment} % \codehtml @@ -22071,13 +22745,13 @@ rowspan="#2" % % % \changes{v0.34}{2017/08/08}{\pkg{booktabs}: Works inside \env{lateximage}.} % \begin{macrocode} -\newcommand*{\LWR@origtoprule}[1][]{\hline} -\newcommand*{\LWR@origmidrule}[1][]{\hline} -\LetLtxMacro\LWR@origcmidrule\cline -\newcommand*{\LWR@origbottomrule}[1][]{\hline} -\newcommand*{\LWR@origaddlinespace}[1][]{} -\newcommand*{\LWR@origmorecmidrules}{} -\newcommand*{\LWR@origspecialrule}[3]{\hline} +\newcommand*{\toprule}[1][]{\hline} +\newcommand*{\midrule}[1][]{\hline} +\LetLtxMacro\cmidrule\cline +\newcommand*{\bottomrule}[1][]{\hline} +\newcommand*{\addlinespace}[1][]{} +\newcommand*{\morecmidrules}{} +\newcommand*{\specialrule}[3]{\hline} % \end{macrocode} % % @@ -22238,14 +22912,11 @@ rowspan="#2" % \LetLtxMacro{\\}{\LWR@tabularendofline}% % \end{macrocode} % -% The following adjust for \pkg{colortbl}: +% The following adjust for \pkg{colortbl}. % \changes{v0.48}{2018/02/06}{\pkg{colortbl}: Added.} % \begin{macrocode} -\LetLtxMacro\columncolor\LWR@HTMLcolumncolor% -\LetLtxMacro\rowcolor\LWR@HTMLrowcolor% -\LetLtxMacro\cellcolor\LWR@HTMLcellcolor% -\LetLtxMacro\arrayrulecolor\LWR@HTMLarrayrulecolor% -\LetLtxMacro\doublerulesepcolor\LWR@HTMLdoublerulesepcolor% +\LetLtxMacro\arrayrulecolor\arrayrulecolornexttoken% +\LetLtxMacro\doublerulesepcolor\doublerulesepcolornexttoken% \renewcommand*{\LWR@columnHTMLcolor}{}% \renewcommand*{\LWR@rowHTMLcolor}{}% \renewcommand*{\LWR@cellHTMLcolor}{}% @@ -22273,60 +22944,6 @@ rowspan="#2" % \LetLtxMacro\hline\LWR@HTMLhline% \LetLtxMacro\cline\LWR@HTMLcline% % \end{macrocode} -% \changes{v0.41}{2017/10/03}{Improved rules.} -% \changes{v0.42}{2017/10/19}{If \progcode{FormatWP} force explicit border.} -% \begin{macrocode} -\DeclareDocumentCommand{\toprule}{o d()}% - {% - \IfValueTF{##1}% - {\LWR@docmidrule[##1](){1-\arabic{LWR@tabletotalcols}}}% - {% - \ifbool{FormatWP}% - {\LWR@docmidrule[##1](){1-\arabic{LWR@tabletotalcols}}}% - {\booltrue{LWR@doingtbrule}}% - }% - \LWR@getmynexttoken}% -% \end{macrocode} -% \begin{macrocode} -\DeclareDocumentCommand{\midrule}{o d()}% - {% - \IfValueTF{##1}% - {\LWR@docmidrule[##1](){1-\arabic{LWR@tabletotalcols}}}% - {% - \ifbool{FormatWP}% - {\LWR@docmidrule[##1](){1-\arabic{LWR@tabletotalcols}}}% - {\addtocounter{LWR@hlines}{1}}% - }% - \LWR@getmynexttoken}% -% \end{macrocode} -% \begin{macrocode} -\DeclareDocumentCommand{\cmidrule}{O{\LWR@cmidrulewidth} d() m}{% - \LWR@docmidrule[##1](##2){##3}% - \LWR@getmynexttoken% -}% -% \end{macrocode} -% \begin{macrocode} -\DeclareDocumentCommand{\bottomrule}{o d()}{% - \IfValueTF{##1}% - {\LWR@docmidrule[##1](){1-\arabic{LWR@tabletotalcols}}}% - {% - \ifbool{FormatWP}% - {\LWR@docmidrule[##1](){1-\arabic{LWR@tabletotalcols}}}% - {\booltrue{LWR@doingtbrule}}% - }% - \LWR@getmynexttoken% -}% -% \end{macrocode} -% \begin{macrocode} -\DeclareDocumentCommand{\addlinespace}{o}{}% -% \end{macrocode} -% \begin{macrocode} -\DeclareDocumentCommand{\morecmidrules}{}{}% -% \end{macrocode} -% \begin{macrocode} -\DeclareDocumentCommand{\specialrule}{m m m d()}% - {\LWR@docmidrule[##1](){1-\arabic{LWR@tabletotalcols}}\LWR@getmynexttoken}% -% \end{macrocode} % \begin{macrocode} \DeclareDocumentCommand{\hdashline}{o}{% \ifbool{FormatWP}% @@ -22442,11 +23059,11 @@ rowspan="#2" % % Restore |&| to its usual meaning: % \begin{macrocode} \protected\gdef&{\LWR@origampmacro}% -\EndDefiningTabulars% +\StopDefiningTabulars% \LWR@traceinfo{LWR@tabular finished ending}% } -\EndDefiningTabulars +\StopDefiningTabulars % \end{macrocode} % \end{environment} @@ -22456,7 +23073,6 @@ rowspan="#2" % - % \section{Cross-references} % % Sectioning commands have been emulated from scratch, so the cross-referencing @@ -22728,16 +23344,16 @@ rowspan="#2" % {% pars allowed \ifbool{LWR@doingapar}% {% par started - \LWR@htmltag{a \LWR@origmbox{id="\LWR@sanitized"}}\LWR@htmltag{/a}% + \LWR@htmltag{a \LWR@print@mbox{id="\LWR@sanitized"}}\LWR@htmltag{/a}% }% par started {% par not started \LWR@stoppars% - \LWR@htmltag{a \LWR@origmbox{id="\LWR@sanitized"}}\LWR@htmltag{/a}% + \LWR@htmltag{a \LWR@print@mbox{id="\LWR@sanitized"}}\LWR@htmltag{/a}% \LWR@startpars% }% par not started }% pars allowed {% pars not allowed - \LWR@htmltag{a \LWR@origmbox{id="\LWR@sanitized"}}\LWR@htmltag{/a}% + \LWR@htmltag{a \LWR@print@mbox{id="\LWR@sanitized"}}\LWR@htmltag{/a}% }% pars not allowed }% not lateximage } @@ -22804,7 +23420,7 @@ rowspan="#2" % % \begin{macrocode} \LWR@htmltag{a href="% \LWR@traceinfo{LWR@startref B}% -\LWR@origmbox{\LWR@htmlrefsectionfilename{#1}}% +\LWR@print@mbox{\LWR@htmlrefsectionfilename{#1}}% \LWR@traceinfo{LWR@startref C}% \LWR@origpound% % \end{macrocode} @@ -22840,7 +23456,7 @@ rowspan="#2" % % \cs{detokenize} is used to allow underscores in the labels: % \changes{v0.45}{2017/12/01}{Fix: Labels with underscores.} % \begin{macrocode} - \LWR@origmbox{\LWR@sanitized}% + \LWR@print@mbox{\LWR@sanitized}% }% }% \LWR@traceinfo{LWR@startref E}% @@ -22869,10 +23485,13 @@ rowspan="#2" % % \end{macrocode} % \end{macro} -% \begin{macro}{\ref} * \marg{label} \quad \cs{ref} is \cs{let} to \cs{LWR@newref} -% \begin{macro}{\LWR@newref} * \marg{label} \quad -% Create an internal document reference link, -% or without a link if starred per \pkg{hyperref}. +% \begin{macro}{\ref} * \marg{label} \quad +% \cs{ref} is redefined to \cs{LWR@newref}, +% except inside the text part of a \cs{hyperref}, +% where it is redefined to \cs{LWR@ref@ignorestar}. +% \begin{macro}{\LWR@newref} * \marg{label} +% Create an internal document reference link, +% or without a link if starred per \pkg{hyperref}. % \begin{macrocode} \NewDocumentCommand{\LWR@newref}{s m}{% \LWR@traceinfo{LWR@newref !#2!}% @@ -22883,6 +23502,17 @@ rowspan="#2" % % \end{macrocode} % \end{macro} % \end{macro} +% +% \begin{macro}{\LWR@ref@ignorestar} * \marg{label} \quad +% For use inside \cs{hyperref}. Ignores the star, then uses the original \cs{ref}. +% +% \changes{v0.57}{2018/06/05}{\pkg{subcaption}: Fix: \cs{subref}.} +% \begin{macrocode} +\NewDocumentCommand{\LWR@ref@ignorestar}{s m}{% + \LWR@origref{#2}% +} +% \end{macrocode} +% \end{macro} @@ -22975,26 +23605,43 @@ autopage-\theLWR@currentautosec% -% Create a link with a text name: - -% \begin{macro}{\LWR@subhyperref} \marg{URL} \marg{text} +% \begin{macro}{\LWR@subhyperref} \marg{URL} +% +% Starts a link for \cs{LWR@hrefb}. +% A group must have been opened first, with nullified catcodes. +% The text name is printed afterwards, after the group is closed and catcodes restored. +% % \changes{v0.18}{2016/04/14}{Improved \HTML\ output linebreaks.} % \changes{v0.45}{2017/12/29}{Improved URLs with underscores.} +% \changes{v0.57}{2018/06/05}{Fix: Text catcodes.} % \begin{macrocode} -\NewDocumentCommand{\LWR@subhyperref}{m +m}{% +\NewDocumentCommand{\LWR@subhyperref}{m}{% \LWR@traceinfo{LWR@subhyperref !#1!}% \LWR@sanitize{#1}% \LWR@htmltag{% a href="\LWR@sanitized" % target="\_{}blank"\LWR@orignewline% }% -#2% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\LWR@subhyperreftext} \marg{text} +% +% Finishes the hyperref for \cs{LWR@hrefb}. Catcodes must have been restored already. +% To be used after \cs{LWR@subhyperref}, and after its group has been closed. +% +% \changes{v0.57}{2018/06/05}{Fix: Text catcodes.} +% \begin{macrocode} +\newcommand{\LWR@subhyperreftext}[1]{% +#1% \LWR@htmltag{/a}% \LWR@ensuredoingapar% } % \end{macrocode} % \end{macro} + % \begin{macro}{\LWR@subhyperrefclass} \marg{URL} \marg{text} \marg{htmlclass} % \changes{v0.18}{2016/04/14}{Improved \HTML\ output linebreaks.} % \changes{v0.45}{2017/12/29}{Improved URLs with underscores.} @@ -23015,18 +23662,20 @@ autopage-\theLWR@currentautosec% -% \begin{macro}{\href} \oarg{options} \marg{URL} \marg{text} +% \begin{macro}{\href} \oarg{options} \marg{URL} % % Create a link with accompanying text: % % \changes{v0.43}{2017/10/31}{Made robust.} % \changes{v0.49}{2018/02/18}{Fix: Adapt to classes.} % \changes{v0.52}{2018/03/26}{Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} +% \changes{v0.57}{2018/06/05}{Fix: Text catcodes.} % \begin{macrocode} -\DeclareDocumentCommand{\LWR@hrefb}{O{} m +m}{% +\DeclareDocumentCommand{\LWR@hrefb}{O{} m}{% \LWR@ensuredoingapar% -\LWR@subhyperref{#2}{#3}% -\endgroup% +\LWR@subhyperref{#2}% +\endgroup% restore catcodes +\LWR@subhyperreftext% } \newrobustcmd*{\href}{% @@ -23197,11 +23846,19 @@ autopage-\theLWR@currentautosec% % \begin{macrocode} \LWR@origraggedright% % \end{macrocode} -% Open an \HTML\ |figure| tag: +% Open an \HTML\ |figure| tag. +% The figure is assigned a \attribute{class} equal to its type, +% and another class according to the \pkg{float} package style, if used. +% Note that \cs{csuse} returns an empty string if \cs{LWR@floatstyle@<type>} +% is note defined. % \changes{v0.42}{2017/10/26}{If \progcode{FormatWP} add a text frame.} % \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.} +% \changes{v0.56}{2018/05/14}{Adds a \element{class} per \pkg{float} package style.} % \begin{macrocode} -\LWR@htmltag{figure id="\LWR@origmbox{autoid-\arabic{LWR@thisautoid}}" class="#1"}% +\LWR@htmltag{% + figure id="\LWR@print@mbox{autoid-\arabic{LWR@thisautoid}}" % space + class="#1 \csuse{LWR@floatstyle@#1}"% +}% \ifbool{FormatWP}{% \LWR@orignewline% \LWR@BlockClassWP{}{}{wp#1}% @@ -23336,7 +23993,7 @@ autopage-\theLWR@currentautosec% { \ifbool{LWR@freezethisautoid}{}{% \addtocounter{LWR@thisautoid}{1}% - \LWR@htmltag{a id="\LWR@origmbox{autoid-\arabic{LWR@thisautoid}}"}% + \LWR@htmltag{a id="\LWR@print@mbox{autoid-\arabic{LWR@thisautoid}}"}% \LWR@htmltag{/a}% }% } @@ -23475,7 +24132,7 @@ autopage-\theLWR@currentautosec% \LWR@htmlblocktag{figcaption}% \ifbool{FormatWP}{% \begin{BlockClass}[font-style:italic]{italic} -\LWR@origvspace*{\baselineskip} +\LWR@print@vspace*{\baselineskip} }{}% \LWR@traceinfo{LWR@figcaption env start: done}% } @@ -23497,7 +24154,8 @@ autopage-\theLWR@currentautosec% } % \end{macrocode} -% \begin{macro}{\LWR@caption@begin} +% \begin{macro}{\LWR@caption@begin} \marg{type} +% % Low-level patches to create \HTML\ tags for captions. % \changes{v0.47}{2018/01/28}{Fix: Argument passed to \cs{LWR@origcaption@begin}.} % \begin{macrocode} @@ -23573,7 +24231,7 @@ autopage-\theLWR@currentautosec% \def\LWR@LTcaptionlistentry{% \LWR@ensuredoingapar% -\LWR@htmltag{a id="\LWR@origmbox{autoid-\arabic{LWR@thisautoid}}"}\LWR@htmltag{/a}% +\LWR@htmltag{a id="\LWR@print@mbox{autoid-\arabic{LWR@thisautoid}}"}\LWR@htmltag{/a}% \bgroup \@ifstar{\egroup\LWR@LT@captionlistentry}% gobble * {\egroup\LWR@LT@captionlistentry}}% @@ -23855,8 +24513,13 @@ autopage-\theLWR@currentautosec% % Emulate the \cs{listof} command from the \pkg{float} package (\cref{sec:newfloat}). % Used to create lists of custom float types. Also used to redefine % the standard \LaTeX{} \cs{listoffigures} and \cs{listoftables} commands. +% +% \changes{v0.57}{2018/05/26}{Fix: Provide \cs{l@name} if not defined.} % \begin{macrocode} \NewDocumentCommand{\listof}{m +m}{% +\@ifundefined{l@#1}{% + \csdef{l@#1}[2]{\hypertocfloat{1}{#1}{\csuse{ext@#1}}{##1}{##2}}% +}{}% \LWR@subtableofcontents{\@nameuse{ext@#1}}{#2} \expandafter\newwrite\csname tf@\csname ext@#1\endcsname\endcsname \immediate\openout \csname tf@\csname ext@#1\endcsname\endcsname @@ -24003,7 +24666,7 @@ autopage-\theLWR@currentautosec% % \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.} % \begin{macrocode} \LWR@subhyperrefclass{% - \LWR@htmlrefsectionfilename{autopage-#4}\LWR@origpound\LWR@origmbox{autosec-#4}% + \LWR@htmlrefsectionfilename{autopage-#4}\LWR@origpound\LWR@print@mbox{autosec-#4}% }{#3}{toc#2}% \LWR@stoppars% }% @@ -24068,7 +24731,7 @@ autopage-\theLWR@currentautosec% % \begin{macrocode} \LWR@subhyperrefclass{% \LWR@htmlrefsectionfilename{autopage-\arabic{LWR@nextautopage}}% - \LWR@origpound\LWR@origmbox{autoid-\arabic{LWR@nextautoid}}}% + \LWR@origpound\LWR@print@mbox{autoid-\arabic{LWR@nextautoid}}}% {#4}{toc#2}% \LWR@stoppars% }{}% @@ -24380,21 +25043,17 @@ autopage-\theLWR@currentautosec% - % \section{Restoring original formatting} % -% -% \codehtml -% \begin{macrocode} -\begin{warpHTML} -% \end{macrocode} -% -% -% % \begin{macro}{\LWR@restoreorigformatting} % Used to temporarily restore % the print-mode meaning of a number of formatting, graphics, and symbols-related % macros while generating \SVG\ math or a \env{lateximage}. +% +% Must be used inside a group. +% +% Sets \cs{LWR@formatting} to |print| until the end of the group. +% % A number of packages will \cs{appto} additional actions to this macro. % % Various packages add to this macro using \cs{appto}. @@ -24408,10 +25067,16 @@ autopage-\theLWR@currentautosec% % \changes{v0.40}{2017/09/09}{Improved symbols inside a \env{lateximage}.} % \changes{v0.40}{2017/09/09}{Improved \protect\LaTeX\ logos inside a \env{lateximage}.} % \changes{v0.40}{2017/09/09}{Nullified \cs{InlineClass}, etc. inside a \env{lateximage}.} -% + +% \codehtml +% \begin{macrocode} +\begin{warpHTML} +% \end{macrocode} + % \begin{macrocode} \newcommand*{\LWR@restoreorigformatting}{% \LWR@traceinfo{LWR@restoreorigformatting}% +\renewcommand*{\LWR@formatting}{print}% \linespread{1}% % \end{macrocode} % @@ -24423,7 +25088,7 @@ autopage-\theLWR@currentautosec% % % \changes{v0.43}{2017/10/31}{Fix: \cs{ref} in math or lateximage.} % \begin{macrocode} -\LetLtxMacro\ref\LWR@origref%{} syntax highlighting +\LetLtxMacro\ref\LWR@origref% {} syntax highlighting % \end{macrocode} % \changes{v0.48}{2018/02/04}{Fix: Font sizes in \SVG\ math, \env{lateximage}, \tikz.} % \begin{macrocode} @@ -24439,19 +25104,14 @@ autopage-\theLWR@currentautosec% \let\Huge\LWR@origHuge% % \end{macrocode} % \begin{macrocode} -\RenewDocumentCommand{\InlineClass}{o m +m}{##3}% -\RenewDocumentEnvironment{BlockClass}{o m}{}{}% -\renewcommand{\BlockClassSingle}[2]{##2}% -\LetLtxMacro\hspace\LWR@orighspace% +\LWR@select@print@hspace% % \end{macrocode} % \changes{v0.48}{2018/02/04}{Fix: Spacing in \SVG\ math, \env{lateximage}, \tikz.} % \begin{macrocode} \LetLtxMacro\hfill\LWR@orighfill% \LetLtxMacro\hfil\LWR@orighfil% -\LetLtxMacro\rule\LWR@origrule% \LetLtxMacro\hrulefill\LWR@orighrulefill% \LetLtxMacro\dotfill\LWR@origdotfill% -\let\vspace\LWR@origvspace% \let\hss\LWR@orighss% \let\llap\LWR@origllap% \let\rlap\LWR@origrlap% @@ -24469,28 +25129,28 @@ autopage-\theLWR@currentautosec% \let\textellipsis\LWR@origtextellipsis% \let\textless\LWR@origtextless% \let\textgreater\LWR@origtextgreater% -\LetLtxMacro{\textrm}{\LWR@origtextrm}% -\LetLtxMacro{\textsf}{\LWR@origtextsf}% -\LetLtxMacro{\texttt}{\LWR@origtexttt}% -\LetLtxMacro{\textbf}{\LWR@origtextbf}% -\LetLtxMacro{\textmd}{\LWR@origtextmd}% -\LetLtxMacro{\textit}{\LWR@origtextit}% -\LetLtxMacro{\textsl}{\LWR@origtextsl}% -\LetLtxMacro{\textsc}{\LWR@origtextsc}% -\LetLtxMacro{\textup}{\LWR@origtextup}% -\LetLtxMacro{\textnormal}{\LWR@origtextnormal}% -\LetLtxMacro{\emph}{\LWR@origemph}% -\LetLtxMacro{\rmfamily}{\LWR@origrmfamily}% -\LetLtxMacro{\sffamily}{\LWR@origsffamily}% -\LetLtxMacro{\ttfamily}{\LWR@origttfamily}% -\LetLtxMacro{\bfseries}{\LWR@origbfseries}% -\LetLtxMacro{\mdseries}{\LWR@origmdseries}% -\LetLtxMacro{\upshape}{\LWR@origupshape}% -\LetLtxMacro{\slshape}{\LWR@origslshape}% -\LetLtxMacro{\scshape}{\LWR@origscshape}% -\LetLtxMacro{\itshape}{\LWR@origitshape}% -\LetLtxMacro{\em}{\LWR@origem}% -\LetLtxMacro{\normalfont}{\LWR@orignormalfont}% +\LetLtxMacro\textrm\LWR@origtextrm% +\LetLtxMacro\textsf\LWR@origtextsf% +\LetLtxMacro\texttt\LWR@origtexttt% +\LetLtxMacro\textbf\LWR@origtextbf% +\LetLtxMacro\textmd\LWR@origtextmd% +\LetLtxMacro\textit\LWR@origtextit% +\LetLtxMacro\textsl\LWR@origtextsl% +\LetLtxMacro\textsc\LWR@origtextsc% +\LetLtxMacro\textup\LWR@origtextup% +\LetLtxMacro\textnormal\LWR@origtextnormal% +\LetLtxMacro\emph\LWR@origemph% +\LetLtxMacro\rmfamily\LWR@origrmfamily% +\LetLtxMacro\sffamily\LWR@origsffamily% +\LetLtxMacro\ttfamily\LWR@origttfamily% +\LetLtxMacro\bfseries\LWR@origbfseries% +\LetLtxMacro\mdseries\LWR@origmdseries% +\LetLtxMacro\upshape\LWR@origupshape% +\LetLtxMacro\slshape\LWR@origslshape% +\LetLtxMacro\scshape\LWR@origscshape% +\LetLtxMacro\itshape\LWR@origitshape% +\LetLtxMacro\em\LWR@origem% +\LetLtxMacro\normalfont\LWR@orignormalfont% \let\sp\LWR@origsp% \let\sb\LWR@origsb% \LetLtxMacro\textsuperscript\LWR@origtextsuperscript% @@ -24506,35 +25166,8 @@ autopage-\theLWR@currentautosec% \LetLtxMacro\endtabular\LWR@origendtabular% \LetLtxMacro\noalign\LWR@orignoalign% \LetLtxMacro\hline\LWR@orighline% -\LetLtxMacro\toprule\LWR@origtoprule% -\LetLtxMacro\midrule\LWR@origmidrule% -\LetLtxMacro\cmidrule\LWR@origcmidrule% -\LetLtxMacro\bottomrule\LWR@origbottomrule% -\LetLtxMacro\addlinespace\LWR@origaddlinespace% -\LetLtxMacro\morecmidrules\LWR@origmorecmidrules% -\LetLtxMacro\specialrule\LWR@origspecialrule% \let\newline\LWR@orignewline% -\LetLtxMacro{\raisebox}{\LWR@origraisebox}% \LetLtxMacro\includegraphics\LWR@origincludegraphics% -\LetLtxMacro{\scalebox}{\LWR@origscalebox}% -\LetLtxMacro{\rotatebox}{\LWR@origrotatebox}% -\let\reflectbox\LWR@origreflectbox% -\LetLtxMacro\resizebox\LWR@origresizebox% -\let\framebox\LWR@origframebox% -% \end{macrocode} -% \changes{v0.48}{2018/02/05}{Fix: \cs{mbox} in \SVG\ math, \env{lateximage}, \tikz.} -% \begin{macrocode} -\LetLtxMacro\mbox\LWR@origmbox% -% \end{macrocode} -% \begin{macrocode} -\LetLtxMacro\makebox\LWR@origmakebox% -\let\fbox\LWRprint@fbox% -\let\fboxBlock\LWRprint@fbox% -\LetLtxMacro\fminipage\LWRprint@fminipage% -\LetLtxMacro\endfminipage\endLWRprint@fminipage% -\LetLtxMacro\minipage\LWR@origminipage% -\let\endminipage\LWR@origendminipage% -\LetLtxMacro\parbox\LWR@origparbox% \let\TeX\LWR@origTeX% \let\LaTeX\LWR@origLaTeX% \let\LaTeXe\LWR@origLaTeXe% @@ -24567,21 +25200,56 @@ autopage-\theLWR@currentautosec% % % \limitsmath % +% \subsubsection{Catcode changes} +% \limitsmathcatcode +% +% \subsubsection{Dynamic math} +% \limitsmathdynamic +% % \subsubsection{Display math} % % \describedisplaymathother + + +% \subsection{HTML \attribute{alt} tag names} % +% Redefinable names for the \HTML\ \attribute{alt} tags, +% for translation according to the reader's native language. % -% +% \codeall +% \begin{macrocode} +\begin{warpall} +% \end{macrocode} + +% \begin{macro}{\mathimagename} The \HTML\ \attribute{alt} tag for +% an \SVG\ math image. \\ +% \DescribeDefault{``math image''} +% \changes{v0.57}{2018/05/22}{Added.} +% \begin{macrocode} +\newcommand*{\mathimagename}{math image} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\packagediagramname} Appended to the \env{lateximage} +% \HTML\ \attribute{alt} tag for the images generated by many packages. +% \DescribeDefault{``diagram''} +% \changes{v0.57}{2018/05/22}{Added.} +% \begin{macrocode} +\newcommand*{\packagediagramname}{diagram} +% \end{macrocode} +% \end{macro} + +% \begin{macrocode} +\end{warpall} +% \end{macrocode} + + % \subsection{Inline and display math} % -% % \codehtml % \begin{macrocode} \begin{warpHTML} % \end{macrocode} - - % % \DescribeCounter{LWR@externalfilecnt} % Counter for the external files which are generated and then referenced from the \HTML: @@ -24719,25 +25387,29 @@ autopage-\theLWR@currentautosec% % \end{macrocode} % MathJax cannot parse the often complicated \TeX\ expressions which % appear in the various uses of \cs{ensuredmath}. -% \cs{ensuremath} forces the \attribute{alt} tag to ``|(math image)|''. +% \cs{ensuremath} forces the \attribute{alt} tag to ``|(math image)|'', as +% translated according to \cs{mathimagename}. % If this is the case, force the use of a \env{lateximage} even if MathJax. % Likewise for \pkg{siunitx} if |parse-numbers=false|. % % If MathJax, or if formatting math for a word processor, and not \cs{ensuredmath}, -% print the math expression. +% and not a dynamic math expression, print the math expression: % \changes{v0.51}{2018/03/11}{Fix: \cs{ensuredmath} inside \SVG\ image.} +% \changes{v0.57}{2018/05/23}{Fix: Dynamic inline math expressions.} % \begin{macrocode} \ifboolexpr{% ( bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) ) and - ( not test { \ifstrequal {#2} {(math image)} } )% from \ensuredmath + ( not test { \ifstrequal {#2} {(\mathimagename)} } ) and % from \ensuredmath + ( not bool{LWR@dynamicmath} ) }% % \end{macrocode} % For \brand{MathJax}, print the math between |\(| and |\)|: % \begin{macrocode} {% + \LWR@traceinfo{LWR@subsingledollar: Mathjax}% {\textbackslash(\LWR@HTMLsanitize{#4}\textbackslash)}% }% mathjax % \end{macrocode} @@ -24746,7 +25418,7 @@ autopage-\theLWR@currentautosec% % and a \CSS\ style to control the baseline adjustment. % \begin{macrocode} {% not mathjax -\LWR@traceinfo{LWR@subsingledollar: not mathjax}% +\LWR@traceinfo{LWR@subsingledollar: NOT mathjax, or is ensuremath, or is dynamic}% % \end{macrocode} % Measure the depth, width, and height of the math image: % \changes{v0.51}{2018/03/04}{Fix: SVG math with enclosed \env{lateximage}.} @@ -24775,11 +25447,36 @@ autopage-\theLWR@currentautosec% % \begin{macrocode} \global\advance\c@LWR@lateximagedepth 1\relax% % \end{macrocode} -% Typeset and save the contents: +% Typeset and save the contents, depending on how they were generated: +% \begin{description} +% \item [SVG math:] \cs{LWR@origensuredmath} is part of argument \#4. +% \item [SVG math \cs{ensuremath}:] \cs{LWR@origensuredmath} is part of argument \#4. +% \item [SVG dynamic math:] \cs{LWR@origensuredmath} is part of argument \#4. +% \item [Mathjax:] Argument \#4 is the contents of the math expression +% without \cs{LWR@origensuredmath}. This case is handled above. +% \item [Mathjax \cs{ensuremath}:] \cs{LWR@origensuredmath} is part of argument \#4. +% \item [Mathjax dynamic math:] Argument \#4 is the contents of the math expression +% without \cs{LWR@origensuredmath}, so \cs{LWR@origensuredmath} is added below.\ +% \item [\cs{ifmmode}:] Included ``just in case''. +% \end{description} +% % \changes{v0.51}{2018/03/07}{Fix: \env{lateximage} inside \AmS\ \cs{text}.} % \changes{v0.51}{2018/03/12}{Typeset \SVG\ math only once during measurement.} +% \changes{v0.57}{2018/05/23}{Fix: Dynamic inline math expressions.} % \begin{macrocode} - \global\sbox{\LWR@singledollarbox}{#4}% + \ifmmode% + \global\sbox{\LWR@singledollarbox}{#4}% + \else% + \ifbool{LWR@dynamicmath}{% + \ifbool{mathjax}{% + \global\sbox{\LWR@singledollarbox}{\LWR@origensuredmath{#4}}% + }{% + \global\sbox{\LWR@singledollarbox}{#4}% + }% + }{% + \global\sbox{\LWR@singledollarbox}{#4}% + }% + \fi% % \end{macrocode} % Add a small and almost transparent marker at the depth of the image. % @@ -24875,7 +25572,7 @@ autopage-\theLWR@currentautosec% \ifdimgreater{\LWR@singledollardepth}{0.05ex}{% \def\LWR@singledollardepthstyle{% \ ; % extra space - \LWR@origmbox{% + \LWR@print@mbox{% vertical-align:-\LWR@convertto{em}{\the\LWR@singledollardepth} em% } % extra space }% @@ -24888,24 +25585,34 @@ autopage-\theLWR@currentautosec% % The star causes \env{lateximage} to use an MD5 hash as the filename. % When hashing, also include the current font and color in the hash. % \changes{v0.50}{2018/02/22}{MD5 hash avoids duplicate \SVG\ math.} +% \changes{v0.57}{2018/05/23}{Fix: Dynamic inline math expressions.} % \begin{macrocode} - \IfValueTF{#1}{% - \LWR@findcurrenttextcolor% sets \LWR@tempcolor - \begin{lateximage}*% use hashing - [#2]% alt - [% addl' hashing - #3% - FM\LWR@f@family% - SR\LWR@f@series% - SH\LWR@f@shape% - CL\LWR@tempcolor% - ]% - [\LWR@singledollarstyle \LWR@singledollardepthstyle]% CSS - }{% + \ifbool{LWR@dynamicmath}{% + \LWR@traceinfo{subsingledollar: dynamic}% \begin{lateximage}% no hashing - [#2]% alt + [(\mathimagename)]% alt tag []% no add'l hashing [\LWR@singledollarstyle \LWR@singledollardepthstyle]% CSS + }{% + \LWR@traceinfo{subsingledollar: static}% + \IfValueTF{#1}{% + \LWR@findcurrenttextcolor% sets \LWR@tempcolor + \begin{lateximage}*% use hashing + [#2]% alt + [% addl' hashing + #3% + FM\LWR@f@family% + SR\LWR@f@series% + SH\LWR@f@shape% + CL\LWR@tempcolor% + ]% + [\LWR@singledollarstyle \LWR@singledollardepthstyle]% CSS + }{% + \begin{lateximage}% no hashing + [#2]% alt + []% no add'l hashing + [\LWR@singledollarstyle \LWR@singledollardepthstyle]% CSS + }% }% % \end{macrocode} % Place small and almost transparent markers on the baseline @@ -25081,7 +25788,7 @@ autopage-\theLWR@currentautosec% \renewcommand{\@ensuredmath}[1]{% \ifbool{mathjax}{% - \LWR@subsingledollar*{(math image)}{% + \LWR@subsingledollar*{(\mathimagename)}{% \protect\LWR@HTMLsanitize{\detokenize\expandafter{#1}}% }{\relax% \LWR@origensuredmath{#1}% @@ -25100,7 +25807,7 @@ autopage-\theLWR@currentautosec% \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% {\LWR@origensuredmath{#1}}% {% - \LWR@subsingledollar*{(math image)}{% + \LWR@subsingledollar*{(\mathimagename)}{% \protect\LWR@HTMLsanitize{\detokenize\expandafter{#1}}% }{% \LWR@origensuredmath{#1}% @@ -26169,9 +26876,20 @@ autopage-\theLWR@currentautosec% % at a later time. The label is declared along with the image, and so it correctly remembers % where the image finally ended up. % +% The \HTML\ \attribute{alt} tag is set to the \LaTeX\ source for \SVG\ math, +% \margintag{\HTML\ \attribute{alt} tag} +% some chemistry expressions, and perhaps some other expressions which make sense +% for text copy/paste. In some other cases, the \attribute{alt} tag is set +% according to the package name. +% +% \describemathimagename +% +% \describepackagediagramname +% % \limitslateximagefontsize % % +% % \subsection{Support counters and macros} % % \codehtml @@ -26458,7 +27176,7 @@ autopage-\theLWR@currentautosec% % \end{macrocode} -% \subsection{HTML \element{alt} tags} +% \subsection{HTML \attribute{alt} tags} % \begin{macro}{\LWR@amsmathbody} \marg{envname} \qquad % For use inside the optional argument to a \env{lateximage} @@ -26495,7 +27213,7 @@ autopage-\theLWR@currentautosec% % \end{macro} -% \subsection{\env{lateximage}} +% \subsection{\env{lateximage} environment} % \begin{environment}{lateximage} * \oarg{2: \element{alt} tag} % \oarg{3: add'l hashing} \oarg{4: CSS style} @@ -26646,7 +27364,7 @@ autopage-\theLWR@currentautosec% % Typeset the image in a ``standard'' width page and font size: % \begin{macrocode} \LWR@traceinfo{lateximage: about to create minipage}% - \LWR@origminipage{6in}% + \LWR@print@minipage{6in}% \csuse{LWR@orig\LateximageFontSizeName}% % \end{macrocode} % Temporarily restore formatting to its \PDF\ definitions: @@ -26726,13 +27444,13 @@ autopage-\theLWR@currentautosec% % Finish the lateximage minipage and start a new \PDF\ page: % \begin{macrocode} \LWR@traceinfo{lateximage: ending outer-most lateximage}% - \LWR@origendminipage% + \endLWR@print@minipage% \LWR@orignewpage% \LWR@origscriptsize% % \end{macrocode} % Close the \HTML\ comment which encapsulated any traces of the lateximage picked up by \prog{pdftotext}: % \begin{macrocode} - \LWR@origvspace*{.5\baselineskip}% + \LWR@print@vspace*{.5\baselineskip}% \LWR@htmlclosecomment% \LWR@traceinfo{lateximage: The page after the image is \arabic{page}}% % \end{macrocode} @@ -26745,14 +27463,14 @@ autopage-\theLWR@currentautosec% \LWR@subinlineimage[#2]{lateximage}% {% lateximages\OSPathSymbol% - \LWR@origmbox{\LWR@hashedname}% + \LWR@print@mbox{\LWR@hashedname}% }{svg}{#4}% }% hash {% no hash \LWR@subinlineimage[#2]{lateximage}% {% lateximages\OSPathSymbol% - \LWR@origmbox{lateximage-\theLWR@externalfilecnt}% + \LWR@print@mbox{lateximage-\theLWR@externalfilecnt}% }{svg}{#4}% }% no hash % \end{macrocode} @@ -26820,7 +27538,7 @@ autopage-\theLWR@currentautosec% { \LWR@forcenewpage \ifbool{FormatWP} -{\BlockClass[\LWR@origmbox{text-align:center}]{center}} +{\BlockClass[\LWR@print@mbox{text-align:center}]{center}} {\BlockClass{center}} } {\endBlockClass} @@ -26835,7 +27553,7 @@ autopage-\theLWR@currentautosec% { \LWR@forcenewpage \ifbool{FormatWP} -{\BlockClass[\LWR@origmbox{text-align:right}]{flushright}} +{\BlockClass[\LWR@print@mbox{text-align:right}]{flushright}} {\BlockClass{flushright}} } {\endBlockClass} @@ -26849,7 +27567,7 @@ autopage-\theLWR@currentautosec% { \LWR@forcenewpage \ifbool{FormatWP} -{\BlockClass[\LWR@origmbox{text-align:left}]{flushleft}} +{\BlockClass[\LWR@print@mbox{text-align:left}]{flushleft}} {\BlockClass{flushleft}} } {\endBlockClass} @@ -27082,6 +27800,8 @@ autopage-\theLWR@currentautosec% \LWR@traceinfo{patching xcolor} % \end{macrocode} % +% +% The print version: % \begin{macro}{\colorboxBlock} % \cs{colorboxBlock} is the same as \cs{colorbox}: % \begin{macrocode} @@ -27091,14 +27811,9 @@ autopage-\theLWR@currentautosec% % % % -% In \HTML\ mode, the following is done when \pkg{xcolor} is loaded. -% Following is the print-mode action: +% The original definition is reused by the new versions: % \begin{macrocode} -\warpprintonly{ -\LetLtxMacro\LWRprint@colorboxBlock\colorbox -\LetLtxMacro\LWRorigprint@fcolorbox\fcolorbox -\LetLtxMacro\LWRorigprint@fcolorboxBlock\fcolorbox -} +\LetLtxMacro\LWR@orig@print@fcolorbox\fcolorbox % \end{macrocode} % \begin{macro}{\fcolorbox} @@ -27111,8 +27826,8 @@ autopage-\theLWR@currentautosec% % \begin{macrocode} \newsavebox{\LWR@colorminipagebox} -\DeclareDocumentCommand{\LWRprint@fcolorbox}{o m o m +m}{% -\LWR@traceinfo{LWRprint@fcolorbox #2 #4}% +\NewDocumentCommand{\LWR@print@fcolorbox}{o m o m +m}{% +\LWR@traceinfo{LWR@print@fcolorbox #2 #4}% % \end{macrocode} % Pre-load the contents into an LR box so that they can % be used inside a \cs{fcolorbox}: @@ -27144,17 +27859,19 @@ autopage-\theLWR@currentautosec% \IfValueTF{#1}% {% \IfValueTF{#3}% - {\LWRorigprint@fcolorbox[#1]{#2}[#3]{#4}{\usebox{\LWR@colorminipagebox}}}% - {\LWRorigprint@fcolorbox[#1]{#2}{#4}{\usebox{\LWR@colorminipagebox}}}% + {\LWR@orig@print@fcolorbox[#1]{#2}[#3]{#4}{\usebox{\LWR@colorminipagebox}}}% + {\LWR@orig@print@fcolorbox[#1]{#2}{#4}{\usebox{\LWR@colorminipagebox}}}% }% {% no value #1 \IfValueTF{#3}% - {\LWRorigprint@fcolorbox{#2}[#3]{#4}{\usebox{\LWR@colorminipagebox}}}% - {\LWRorigprint@fcolorbox{#2}{#4}{\usebox{\LWR@colorminipagebox}}}% + {\LWR@orig@print@fcolorbox{#2}[#3]{#4}{\usebox{\LWR@colorminipagebox}}}% + {\LWR@orig@print@fcolorbox{#2}{#4}{\usebox{\LWR@colorminipagebox}}}% }% no value #1 }% #4 not none -\LWR@traceinfo{LWRprint@fcolorbox done}% +\LWR@traceinfo{LWR@print@fcolorbox done}% } + +\renewcommand*{\fcolorbox}{\LWR@print@fcolorbox} % \end{macrocode} % \end{macro} % @@ -27164,17 +27881,19 @@ autopage-\theLWR@currentautosec% % % In print mode, \cs{fcolorboxBlock} is the same as \cs{fcolorbox}. % \begin{macrocode} -\LetLtxMacro\LWRprint@fcolorboxBlock\LWRprint@fcolorbox +\newcommand*{\LWR@print@fcolorboxBlock}{\LWR@print@fcolorbox} +\newcommand*{\fcolorboxBlock}{\LWR@print@fcolorboxBlock} % \end{macrocode} % \end{macro} + % \begin{environment}{fcolorminipage} % \oarg{1:framemodel} \marg{2:framecolor} \oarg{3:boxmodel} \marg{4:boxcolor} % \oarg{5:align} \oarg{6:height} \oarg{7:inner-align} \marg{8:width} % % In print mode, becomes a \cs{fcolorbox} containing a \env{minipage}: % \begin{macrocode} -\NewDocumentEnvironment{LWRprint@fcolorminipage}{o m o m O{c} O{} o m} +\NewDocumentEnvironment{LWR@print@fcolorminipage}{o m o m O{c} O{} o m} {% \LWR@traceinfo{*** fcolorminipage: #2 #4 #8}% % \end{macrocode} @@ -27215,44 +27934,25 @@ autopage-\theLWR@currentautosec% \IfValueTF{#1}% {% \IfValueTF{#3}% - {\LWRorigprint@fcolorbox[#1]{#2}[#3]{#4}{\usebox{\LWR@colorminipagebox}}}% - {\LWRorigprint@fcolorbox[#1]{#2}{#4}{\usebox{\LWR@colorminipagebox}}}% + {\LWR@orig@print@fcolorbox[#1]{#2}[#3]{#4}{\usebox{\LWR@colorminipagebox}}}% + {\LWR@orig@print@fcolorbox[#1]{#2}{#4}{\usebox{\LWR@colorminipagebox}}}% }% {% no value #1 \IfValueTF{#3}% - {\LWRorigprint@fcolorbox{#2}[#3]{#4}{\usebox{\LWR@colorminipagebox}}}% - {\LWRorigprint@fcolorbox{#2}{#4}{\usebox{\LWR@colorminipagebox}}}% + {\LWR@orig@print@fcolorbox{#2}[#3]{#4}{\usebox{\LWR@colorminipagebox}}}% + {\LWR@orig@print@fcolorbox{#2}{#4}{\usebox{\LWR@colorminipagebox}}}% }% no value #1 }% #4 not none \LWR@traceinfo{*** finished end fcolorminipage}% } + +\newenvironment*{fcolorminipage} + {\LWR@print@fcolorminipage} + {\endLWR@print@fcolorminipage} % \end{macrocode} % \end{environment} -% \begin{macro}{\LWR@restoreorigprintxcolor} -% Used to activate print-mode additions for \pkg{xcolor}. -% In print mode, this is used immediately following. -% In \HTML\ mode, this is used inside a \env{lateximage}. -% \begin{macrocode} -\newcommand*{\LWR@restoreorigprintxcolor}{% -\LWR@traceinfo{LWR@restoreorigprintxcolor}% -\LetLtxMacro\colorboxBlock\LWRprint@colorboxBlock% -\LetLtxMacro\fcolorbox\LWRprint@fcolorbox% -\LetLtxMacro\fcolorboxBlock\LWRprint@fcolorboxBlock% -\LetLtxMacro\fcolorminipage\LWRprint@fcolorminipage% -\LetLtxMacro\endfcolorminipage\endLWRprint@fcolorminipage% -} - -\appto\LWR@restoreorigformatting{% -\LWR@restoreorigprintxcolor% -} -% \end{macrocode} -% \end{macro} -% -% If print mode, immediately activate the print-mode enhancements for \pkg{xcolor}: % \begin{macrocode} -\warpprintonly{\LWR@restoreorigprintxcolor} - \LWR@traceinfo{xcolor patches done} }{}% xcolor loaded }% AtBeginDocument @@ -27388,7 +28088,7 @@ autopage-\theLWR@currentautosec% \renewcommand*{\@@@setcref}[2]{#1{\ref{#2}}{}{}} }{ \PackageWarning{lwarp-cleveref}{ - Unknown verison of cleveref. + Unknown version of cleveref. \protect\cref\space will fail. }% } @@ -27415,7 +28115,7 @@ autopage-\theLWR@currentautosec% } }{ \PackageWarning{lwarp-cleveref}{ - Unknown verison of cleveref. + Unknown version of cleveref. \protect\crefrange\space will fail. } } @@ -27462,7 +28162,7 @@ autopage-\theLWR@currentautosec% } { \PackageWarning{lwarp-cleveref}{ - Unknown verison of cleveref. + Unknown version of cleveref. \protect\cpageref\space will fail. } } @@ -27500,7 +28200,7 @@ autopage-\theLWR@currentautosec% } { \PackageWarning{lwarp-cleveref}{ - Unknown verison of cleveref. + Unknown version of cleveref. \protect\cpagerefrange\space will fail. } } @@ -27637,7 +28337,6 @@ autopage-\theLWR@currentautosec% % \end{macrocode} % % \codehtml -% % \begin{macrocode} \begin{warpHTML} % \end{macrocode} @@ -27657,6 +28356,7 @@ autopage-\theLWR@currentautosec% % \begin{environment}{minipage} \oarg{vert position} \oarg{height} % \oarg{inner vert position} \marg{width} % \changes{v0.18}{2016/05/17}{Fix: \cs{linewidth}, \cs{textwidth}, \cs{textheight} inside a minipage.} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % % The vertical positions may be 'c', 't', or 'b'. % The inner position may also be 's'. @@ -27665,7 +28365,7 @@ autopage-\theLWR@currentautosec% % 6\texttimes{}9 inch text area. % % \begin{macrocode} -\RenewDocumentEnvironment{minipage}{O{t} o O{t} m} +\NewDocumentEnvironment{LWR@HTML@minipage}{O{t} o O{t} m} {% \LWR@traceinfo{minipage}% % \end{macrocode} @@ -27720,7 +28420,10 @@ autopage-\theLWR@currentautosec% \ifbool{FormatWP}{% \addtocounter{LWR@thisautoidWP}{1}% -\LWR@htmltag{div id="\LWR@origmbox{autoidWP-\arabic{LWR@thisautoidWP}}" class="wpminipage"}% +\LWR@htmltag{% + div id="\LWR@print@mbox{autoidWP-\arabic{LWR@thisautoidWP}}" % + class="wpminipage"% +}% }{}% % \end{macrocode} @@ -27729,13 +28432,13 @@ autopage-\theLWR@currentautosec% % \begin{macrocode} \LWR@traceinfo{minipage: creating div class}% \LWR@htmltag{div class="minipage" style="% -\ifthenelse{\equal{#1}{t}}{\LWR@origmbox{vertical-align:bottom} ; }{}% -\ifthenelse{\equal{#1}{c}}{\LWR@origmbox{vertical-align:middle} ; }{}% -\ifthenelse{\equal{#1}{b}}{\LWR@origmbox{vertical-align:top} ; }{}% -\ifthenelse{\equal{#3}{t}}{\LWR@origmbox{justify-content:flex-start} ; }{}% -\ifthenelse{\equal{#3}{c}}{\LWR@origmbox{justify-content:center} ; }{}% -\ifthenelse{\equal{#3}{b}}{\LWR@origmbox{justify-content:flex-end} ; }{}% -\ifthenelse{\equal{#3}{s}}{\LWR@origmbox{justify-content:space-between} ; }{}% +\ifthenelse{\equal{#1}{t}}{\LWR@print@mbox{vertical-align:bottom} ; }{}% +\ifthenelse{\equal{#1}{c}}{\LWR@print@mbox{vertical-align:middle} ; }{}% +\ifthenelse{\equal{#1}{b}}{\LWR@print@mbox{vertical-align:top} ; }{}% +\ifthenelse{\equal{#3}{t}}{\LWR@print@mbox{justify-content:flex-start} ; }{}% +\ifthenelse{\equal{#3}{c}}{\LWR@print@mbox{justify-content:center} ; }{}% +\ifthenelse{\equal{#3}{b}}{\LWR@print@mbox{justify-content:flex-end} ; }{}% +\ifthenelse{\equal{#3}{s}}{\LWR@print@mbox{justify-content:space-between} ; }{}% % \end{macrocode} % Print the width and optional height styles: % \begin{macrocode} @@ -27826,6 +28529,8 @@ autopage-\theLWR@currentautosec% \global\booltrue{LWR@minipagethispar}% \LWR@traceinfo{LWR@minipage: done}% } + +\LWR@formattedenv{minipage} % \end{macrocode} % \end{environment} % @@ -27834,17 +28539,23 @@ autopage-\theLWR@currentautosec% % % \codehtml % +% \null +% % \begin{macro}{\parbox} \oarg{pos} \oarg{height} \oarg{inner-pos} \marg{width} \marg{text} % % A parbox uses the minipage code: +% +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % \begin{macrocode} -\RenewDocumentCommand{\parbox}{O{t} o O{t} m +m} +\NewDocumentCommand{\LWR@HTML@parbox}{O{t} o O{t} m +m} { \LWR@traceinfo{parbox of width #4}% \begin{minipage}[#1][#2][#3]{#4}% #5 \end{minipage}% } + +\LWR@formatted{parbox} % \end{macrocode} % \end{macro} % @@ -27853,8 +28564,11 @@ autopage-\theLWR@currentautosec% % \begin{macro}{\mbox} \marg{text} % \qquad Nullified for \HTML. % \changes{v0.48}{2018/02/04}{Nullified for \HTML.} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % \begin{macrocode} -\renewcommand*{\mbox}[1]{#1} +\newcommand*{\LWR@HTML@mbox}[1]{#1} + +\LWR@formatted{mbox} % \end{macrocode} % \end{macro} % @@ -27864,8 +28578,9 @@ autopage-\theLWR@currentautosec% % % \changes{v0.34}{2017/07/31}{Fix: Handles paren arg.} % \changes{v0.36}{2017/08/15}{Fix: Handles width and horiz position.} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % \begin{macrocode} -\RenewDocumentCommand{\makebox}{d() o o m}{% +\NewDocumentCommand{\LWR@HTML@makebox}{d() o o m}{% % \end{macrocode} % Check for the optional width: % \begin{macrocode} @@ -27890,8 +28605,8 @@ autopage-\theLWR@currentautosec% % \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.} % \begin{macrocode} \InlineClass[% - \LWR@origmbox{display:inline-block} ; % - \LWR@origmbox{text-align}:\LWR@align\ ; % + \LWR@print@mbox{display:inline-block} ; % + \LWR@print@mbox{text-align}:\LWR@align\ ; % width:\LWR@printlength{\LWR@tempwidth}% ]% {makebox}% @@ -27909,19 +28624,24 @@ autopage-\theLWR@currentautosec% % \begin{macrocode} {#4}% no width } + +\LWR@formatted{makebox} % \end{macrocode} % \end{macro} % % % \begin{macro}{\framebox} \oarg{width} \oarg{pos} \marg{text} % \changes{v0.36}{2017/08/15}{Fix: Handles width and horiz position.} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % % \begin{macrocode} \LetLtxMacro\LWR@origframebox\framebox -\RenewDocumentCommand{\framebox}{o o m}{% +\NewDocumentCommand{\LWR@HTML@framebox}{o o m}{% \fbox{\makebox[#1][#2]{#3}}% } + +\LWR@formatted{framebox} % \end{macrocode} % \end{macro} % @@ -27962,22 +28682,16 @@ padding:\LWR@printlength{\fboxsep}% % \end{macro} % % -% % \begin{macro}{\fbox} \marg{text} % % Creates a framed inline span enclosing the text. % % \changes{v0.36}{2017/08/10}{Fix: Uses \cs{fboxrule} and \cs{fboxsep}.} % -% Remember the print-mode version: -% \begin{macrocode} -\let\LWRprint@fbox\fbox -% \end{macrocode} -% % Create a new \HTML\ version, but don't use it until after \pkg{xcolor} % may have loaded: % \begin{macrocode} -\newcommand{\LWRhtml@fbox}[1]{% +\newcommand{\LWR@HTML@fbox}[1]{% \LWR@traceinfo{HTML fbox}% \LWR@forceminwidth{\fboxrule}% \InlineClass[% @@ -27989,20 +28703,33 @@ padding:\LWR@printlength{\fboxsep}% % and this must remain even for \HTML\ output while in a \env{lateximage}, % so \cs{fbox} is not modified until \cs{AtBeginDocument}: % \begin{macrocode} -\AtBeginDocument{\let\fbox\LWRhtml@fbox} +\AtBeginDocument{\LWR@formatted{fbox}} % \end{macrocode} % \end{macro} % - +% % \begin{macro}{\fboxBlock} \marg{text} % Creates a framed \HTML\ \element{div} of the text. % -% A print-output version is also supplied below. +% First, a print-mode version. +% This is newly defined for print mode, so it is defined inside \env{warpall}. +% +% \codeall +% \begin{macrocode} +\end{warpHTML} +\begin{warpall} +\let\fboxBlock\fbox +\end{warpall} +\begin{warpHTML} +% \end{macrocode} +% \codehtml % +% Next, an \HTML\ version: % \changes{v0.34}{2017/07/31}{Added.} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % % \begin{macrocode} -\newcommand{\fboxBlock}[1]{% +\newcommand{\LWR@HTML@fboxBlock}[1]{% \LWR@forceminwidth{\fboxrule}% \begin{BlockClass}[% \LWR@blackborderpadding% @@ -28010,75 +28737,29 @@ padding:\LWR@printlength{\fboxsep}% #1 \end{BlockClass} } -% \end{macrocode} -% \end{macro} -% \begin{environment}{fminipage} \oarg{align} \oarg{height} \oarg{align} \marg{width} -% -% Creates a framed \HTML\ \element{div} around its contents. -% -% A print-output version is also supplied below. -% -% \changes{v0.34}{2017/07/31}{Added.} -% -% \begin{macrocode} -\NewDocumentEnvironment{fminipage}{O{t} o O{t} m} -{% -\LWR@traceinfo{fminipage #1 #2 #3 #4}% -\LWR@forceminwidth{\fboxrule}% -\setlength{\LWR@tempwidth}{#4}% -\IfValueT{#2}{\setlength{\LWR@tempheight}{#2}}% -\begin{BlockClass}[% -\LWR@blackborderpadding ; % -\IfValueT{#2}{height:\LWR@printlength{\LWR@tempheight} ; }% -width:\LWR@printlength{\LWR@tempwidth}% -]{fminipage}% -} -{% -\end{BlockClass}% -\LWR@traceinfo{fminipage done}% -} -% \end{macrocode} -% \end{environment} -% -% -% \begin{macro}{\raisebox} \marg{raiselen} \oarg{height} \oarg{depth} \marg{text} -% \begin{macrocode} -\LetLtxMacro{\LWR@origraisebox}{\raisebox} - -\RenewDocumentCommand{\raisebox}{m o o m}{% -#4% -} -% \end{macrocode} -% \end{macro} +\LWR@formatted{fboxBlock} -% \begin{macrocode} \end{warpHTML} % \end{macrocode} - - - -% \codeall -% \begin{macrocode} -\begin{warpall} -% \end{macrocode} -% +% \end{macro} % % -% \env{LWRprint@fminipage} is defined inside \env{warpall}. -% For print output, it is \cs{let} to \env{fminipage}. -% For \HTML\ output, the \HTML\ version of \env{fminipage} is used instead, -% but the print version is still available for use inside a \env{lateximage}. +% \begin{environment}{fminipage} \oarg{align} \oarg{height} \oarg{align} \marg{width} % +% Creates a framed \HTML\ \element{div} around its contents. +% \changes{v0.34}{2017/07/31}{Added.} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % -% \begin{environment}{LWRprint@fminipage} -% \oarg{1:align} \oarg{2:height} \oarg{3:inner-align} \marg{4:width} +% Print version: +% \codeall \\ % -% Creates a frame around its contents. % \begin{macrocode} +\begin{warpall} + \newsavebox{\LWR@fminipagebox} -\NewDocumentEnvironment{LWRprint@fminipage}{O{t} o O{t} m} +\NewDocumentEnvironment{LWR@print@fminipage}{O{t} o O{t} m} {% % \end{macrocode} % An outer minipage will be used for vertical alignment. @@ -28122,53 +28803,64 @@ width:\LWR@printlength{\LWR@tempwidth}% % \begin{macrocode} \endminipage% } -% \end{macrocode} -% \end{environment} +\newenvironment{fminipage}{\LWR@print@fminipage}{\endLWR@print@fminipage} -% \begin{macrocode} \end{warpall} % \end{macrocode} +% \HTML\ version: +% \codehtml +% \begin{macrocode} +\begin{warpHTML} +\NewDocumentEnvironment{LWR@HTML@fminipage}{O{t} o O{t} m} +{% +\LWR@traceinfo{fminipage #1 #2 #3 #4}% +\LWR@forceminwidth{\fboxrule}% +\setlength{\LWR@tempwidth}{#4}% +\IfValueT{#2}{\setlength{\LWR@tempheight}{#2}}% +\begin{BlockClass}[% +\LWR@blackborderpadding ; % +\IfValueT{#2}{height:\LWR@printlength{\LWR@tempheight} ; }% +width:\LWR@printlength{\LWR@tempwidth}% +]{fminipage}% +} +{% +\end{BlockClass}% +\LWR@traceinfo{fminipage done}% +} -% \codeprint -% \begin{macrocode} -\begin{warpprint} +\LWR@formattedenv{fminipage} % \end{macrocode} +% \end{environment} % -% -% For print output, the following are \cs{let} to become active. +% \begin{macrocode} +\end{warpHTML} +% \end{macrocode} % % -% \begin{macro}{\fboxBlock} \marg{text} % -% Creates a framed \HTML\ \element{div} around the text. +% \begin{macro}{\raisebox} \marg{raiselen} \oarg{height} \oarg{depth} \marg{text} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % \begin{macrocode} -\let\fboxBlock\fbox -% \end{macrocode} -% \end{macro} +\begin{warpHTML} +\NewDocumentCommand{\LWR@HTML@raisebox}{m o o m}{% +#4% +} -% \begin{environment}{fminipage} \oarg{align} \oarg{height} \oarg{align} \marg{width} -% -% Creates a frame around its contents. -% \begin{macrocode} -\LetLtxMacro{\fminipage}{\LWRprint@fminipage} -\LetLtxMacro{\endfminipage}{\endLWRprint@fminipage} +\LWR@formatted{raisebox} % \end{macrocode} -% \end{environment} +% \end{macro} % \begin{macrocode} -\end{warpprint} +\end{warpHTML} % \end{macrocode} - - - % \section{Direct formatting} % \label{sec:directformatting} % @@ -28210,7 +28902,7 @@ width:\LWR@printlength{\LWR@tempwidth}% % \begin{macrocode} \DeclareRobustCommand{\LWR@HTMLemph}[1]{\LWR@htmlspan{em}{#1}} \DeclareRobustCommand{\LWR@nullemph}[1]{#1} -\LetLtxMacro{\emph}{\LWR@HTMLemph} +\LetLtxMacro\emph\LWR@HTMLemph % \end{macrocode} % \end{macro} @@ -28222,7 +28914,7 @@ width:\LWR@printlength{\LWR@tempwidth}% } \DeclareRobustCommand{\LWR@nulltextmd}[1]{#1} -\LetLtxMacro{\textmd}{\LWR@HTMLtextmd} +\LetLtxMacro\textmd\LWR@HTMLtextmd % \end{macrocode} % \end{macro} @@ -28231,7 +28923,7 @@ width:\LWR@printlength{\LWR@tempwidth}% % \begin{macrocode} \DeclareRobustCommand{\LWR@HTMLtextbf}[1]{\LWR@htmlspan{b}{#1}} \DeclareRobustCommand{\LWR@nulltextbf}[1]{#1} -\LetLtxMacro{\textbf}{\LWR@HTMLtextbf} +\LetLtxMacro\textbf\LWR@HTMLtextbf % \end{macrocode} % \end{macro} @@ -28244,7 +28936,7 @@ width:\LWR@printlength{\LWR@tempwidth}% \DeclareRobustCommand{\LWR@nulltextrm}[1]{#1} -\LetLtxMacro{\textrm}{\LWR@HTMLtextrm} +\LetLtxMacro\textrm\LWR@HTMLtextrm % \end{macrocode} % \end{macro} @@ -28255,7 +28947,7 @@ width:\LWR@printlength{\LWR@tempwidth}% \LWR@HTMLtextstyle{font-family:sans}{textsf}{#1}% } \DeclareRobustCommand{\LWR@nulltextsf}[1]{#1} -\LetLtxMacro{\textsf}{\LWR@HTMLtextsf} +\LetLtxMacro\textsf\LWR@HTMLtextsf % \end{macrocode} % \end{macro} @@ -28263,7 +28955,7 @@ width:\LWR@printlength{\LWR@tempwidth}% % \begin{macrocode} \DeclareRobustCommand{\LWR@HTMLtexttt}[1]{\LWR@htmlspan{kbd}{#1}} \DeclareRobustCommand{\LWR@nulltexttt}[1]{#1} -\LetLtxMacro{\texttt}{\LWR@HTMLtexttt} +\LetLtxMacro\texttt\LWR@HTMLtexttt % \end{macrocode} % \end{macro} @@ -28276,7 +28968,7 @@ width:\LWR@printlength{\LWR@tempwidth}% \DeclareRobustCommand{\LWR@nulltextup}[1]{#1} -\LetLtxMacro{\textup}{\LWR@HTMLtextup} +\LetLtxMacro\textup\LWR@HTMLtextup % \end{macrocode} % \end{macro} @@ -28284,7 +28976,7 @@ width:\LWR@printlength{\LWR@tempwidth}% % \begin{macrocode} \DeclareRobustCommand{\LWR@HTMLtextit}[1]{\LWR@htmlspan{i}{#1}} \DeclareRobustCommand{\LWR@nulltextit}[1]{#1} -\LetLtxMacro{\textit}{\LWR@HTMLtextit} +\LetLtxMacro\textit\LWR@HTMLtextit % \end{macrocode} % \end{macro} @@ -28296,7 +28988,7 @@ width:\LWR@printlength{\LWR@tempwidth}% \DeclareRobustCommand{\LWR@nulltextsc}[1]{#1} -\LetLtxMacro{\textsc}{\LWR@HTMLtextsc} +\LetLtxMacro\textsc\LWR@HTMLtextsc % \end{macrocode} % \end{macro} @@ -28308,7 +29000,7 @@ width:\LWR@printlength{\LWR@tempwidth}% \DeclareRobustCommand{\LWR@nulltextsl}[1]{#1} -\LetLtxMacro{\textsl}{\LWR@HTMLtextsl} +\LetLtxMacro\textsl\LWR@HTMLtextsl % \end{macrocode} % \end{macro} @@ -28318,7 +29010,7 @@ width:\LWR@printlength{\LWR@tempwidth}% % \begin{macrocode} \DeclareRobustCommand{\LWR@HTMLtextnormal}[1]{\textmd{\textrm{\textup{#1}}}} \DeclareRobustCommand{\LWR@nulltextnormal}[1]{#1} -\LetLtxMacro{\textnormal}{\LWR@HTMLtextnormal} +\LetLtxMacro\textnormal\LWR@HTMLtextnormal % \end{macrocode} % \end{macro} @@ -28353,28 +29045,28 @@ width:\LWR@printlength{\LWR@tempwidth}% % \changes{v0.48}{2018/02/04}{Fix: \cs{newline} in title.} % \begin{macrocode} \newcommand*{\LWR@nullfonts}{% -\LetLtxMacro{\emph}{\LWR@nullemph}% -\LetLtxMacro{\textmd}{\LWR@nulltextmd}% -\LetLtxMacro{\textbf}{\LWR@nulltextbf}% -\LetLtxMacro{\textrm}{\LWR@nulltextrm}% -\LetLtxMacro{\textsf}{\LWR@nulltextsf}% -\LetLtxMacro{\texttt}{\LWR@nulltexttt}% -\LetLtxMacro{\textup}{\LWR@nulltextup}% -\LetLtxMacro{\textit}{\LWR@nulltextit}% -\LetLtxMacro{\textsc}{\LWR@nulltextsc}% -\LetLtxMacro{\textsl}{\LWR@nulltextsl}% -\LetLtxMacro{\textnormal}{\LWR@nulltextnormal}% -\LetLtxMacro{\rmfamily}{\LWR@nullrmfamily}% -\LetLtxMacro{\sffamily}{\LWR@nullsffamily}% -\LetLtxMacro{\ttfamily}{\LWR@nullttfamily}% -\LetLtxMacro{\bfseries}{\LWR@nullbfseries}% -\LetLtxMacro{\mdseries}{\LWR@nullmdseries}% -\LetLtxMacro{\upshape}{\LWR@nullupshape}% -\LetLtxMacro{\slshape}{\LWR@nullslshape}% -\LetLtxMacro{\scshape}{\LWR@nullscshape}% -\LetLtxMacro{\itshape}{\LWR@nullitshape}% -\LetLtxMacro{\em}{\LWR@nullem}% -\LetLtxMacro{\normalfont}{\LWR@nullnormalfont}% +\LetLtxMacro\emph\LWR@nullemph% +\LetLtxMacro\textmd\LWR@nulltextmd% +\LetLtxMacro\textbf\LWR@nulltextbf% +\LetLtxMacro\textrm\LWR@nulltextrm% +\LetLtxMacro\textsf\LWR@nulltextsf% +\LetLtxMacro\texttt\LWR@nulltexttt% +\LetLtxMacro\textup\LWR@nulltextup% +\LetLtxMacro\textit\LWR@nulltextit% +\LetLtxMacro\textsc\LWR@nulltextsc% +\LetLtxMacro\textsl\LWR@nulltextsl% +\LetLtxMacro\textnormal\LWR@nulltextnormal% +\LetLtxMacro\rmfamily\LWR@nullrmfamily% +\LetLtxMacro\sffamily\LWR@nullsffamily% +\LetLtxMacro\ttfamily\LWR@nullttfamily% +\LetLtxMacro\bfseries\LWR@nullbfseries% +\LetLtxMacro\mdseries\LWR@nullmdseries% +\LetLtxMacro\upshape\LWR@nullupshape% +\LetLtxMacro\slshape\LWR@nullslshape% +\LetLtxMacro\scshape\LWR@nullscshape% +\LetLtxMacro\itshape\LWR@nullitshape% +\LetLtxMacro\em\LWR@nullem% +\LetLtxMacro\normalfont\LWR@nullnormalfont% % \end{macrocode} % \changes{v0.50}{2018/02/20}{Robustify macros.} % \begin{macrocode} @@ -28876,7 +29568,9 @@ width:\LWR@printlength{\LWR@tempwidth}% % \end{macrocode} % -% \begin{macro}{\LWR@hspace} * \marg{length} +% \begin{macro}{\LWR@select@html@hspace} +% +% \begin{macro}{\hspace} * \marg{length} * \marg{length} % % Handles special minipage \& horizontal space interactions. % \changes{v0.18}{2016/05/13}{\cs{hspace} supported.} @@ -28888,8 +29582,9 @@ width:\LWR@printlength{\LWR@tempwidth}% % % |\hspace{\fill}| is converted to |\hspace{2em}|, equal to \cs{qquad}. % \begin{macrocode} -\NewDocumentCommand{\LWR@hspace}{s m}{% -\setlength{\LWR@tempwidth}{#2}% +\newcommand{\LWR@select@html@hspace}{% +\RenewDocumentCommand{\hspace}{s m}{% +\setlength{\LWR@tempwidth}{##2}% % \end{macrocode} % If \cs{fill}, change to \cs{qquad}: % \begin{macrocode} @@ -28943,25 +29638,41 @@ width:\LWR@printlength{\LWR@tempwidth}% % \begin{macrocode} \LWR@minipagestartpars% }% width not 0 +}% } % \end{macrocode} % \end{macro} +% \end{macro} +% +% \begin{macro}{\LWR@select@html@nohspace} % -% \begin{macro}{\LWR@nohspace} * \marg{length} +% \begin{macro}{\hspace} * \marg{length} % % Used to disable \cs{hspace} while creating |description| \cs{item}s. % \begin{macrocode} -\NewDocumentCommand{\LWR@nohspace}{s m}{} +\newcommand{\LWR@select@html@nohspace}{% + \RenewDocumentCommand{\hspace}{s m}{}% +} +% \end{macrocode} +% \end{macro} +% \end{macro} + +% \begin{macro}{\LWR@select@print@hspace} +% \begin{macrocode} +\newcommand*{\LWR@select@print@hspace}{% + \renewrobustcmd\hspace{\@ifstar\@hspacer\@hspace}% +} % \end{macrocode} % \end{macro} + % % % \begin{macro}{\hspace} * \marg{length} % % Handles special minipage \& horizontal space interactions. % \begin{macrocode} -\LetLtxMacro\hspace\LWR@hspace +\LWR@select@html@hspace % \end{macrocode} % \end{macro} @@ -28969,19 +29680,17 @@ width:\LWR@printlength{\LWR@tempwidth}% % \begin{macro}{\LWR@vspace} * \marg{length} Nullified vspace. % % \changes{v0.33}{2017/06/21}{Add: \cs{vspace} nullified.} +% \changes{v0.50}{2018/02/20}{Robustify macros.} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % % \begin{macrocode} -\NewDocumentCommand{\LWR@vspace}{s m}{} +\NewDocumentCommand{\LWR@HTML@vspace}{s m}{} + +\LWR@formatted{vspace} % \end{macrocode} % \end{macro} % % -% \begin{macro}{\vspace} * \marg{length} Nullified. -% \changes{v0.50}{2018/02/20}{Robustify macros.} -% \begin{macrocode} -\LetLtxMacro\vspace\LWR@vspace -% \end{macrocode} -% \end{macro} % \begin{macro}{\linebreak} \oarg{num} \qquad @@ -29030,7 +29739,7 @@ width:\LWR@printlength{\LWR@tempwidth}% % % % -% \begin{macro}{\LWR@rule} \oarg{raise} \marg{width} \marg{height} +% \begin{macro}{\rule} \oarg{raise} \marg{width} \marg{height} % % Handles special minipage \& horizontal space interactions. % @@ -29038,7 +29747,7 @@ width:\LWR@printlength{\LWR@tempwidth}% % % \cs{fill} is zero-width, so |\hspace{\fill}| is ignored. % \begin{macrocode} -\NewDocumentCommand{\LWR@rule}{o m m}{% +\newcommand*{\LWR@HTML@rule}[3][]{% % \end{macrocode} % The width is copied into a temporary \LaTeX\ length, from which % comparisons and conversions may be made: @@ -29077,7 +29786,9 @@ width:\LWR@printlength{\LWR@tempwidth}% % Print the span with the converted width and height. % The width and height are NOT rounded, since a height of % less than 1pt is quite common in \LaTeX\ code. +% \changes{v0.57}{2018/06/02}{Fix: Colored rules.} % \begin{macrocode} + \LWR@findcurrenttextcolor% \LWR@htmltagc{% span style="% @@ -29100,7 +29811,8 @@ width:\LWR@printlength{\LWR@tempwidth}% % limits the allowable syntax. To do:\ A superior method would compute a % ratio of \LaTeX\ ex height, then print that to \HTML\ with an ex unit. % \begin{macrocode} - \IfValueT{#1}% + \ifblank{#1}% + {}% {% \setlength{\LWR@tempraise}{0pt-#1}% \setlength{\LWR@tempraise}{\LWR@tempraise*2}% @@ -29140,21 +29852,11 @@ width:\LWR@printlength{\LWR@tempwidth}% \LWR@minipagestartpars% }% non-zero width } + +\LWR@formatted{rule} % \end{macrocode} % \end{macro} % -% -% \begin{macro}{\rule} \oarg{raise} \marg{width} \marg{height} -% -% Handles special minipage \& horizontal space interactions. -% -% \changes{v0.19}{2016/06/01}{Added} -% \changes{v0.50}{2018/02/20}{Robustify macros.} -% \begin{macrocode} -\renewrobustcmd{\rule}{\LWR@rule} -% \end{macrocode} -% \end{macro} - % \begin{macrocode} \end{warpHTML} % \end{macrocode} @@ -29968,8 +30670,8 @@ width:\LWR@printlength{\LWR@tempwidth}% % \changes{v0.47}{2018/01/26}{\pkg{adjmulticol}: Fix: Line wrap at \HTML\ hyphen.} % \begin{macrocode} \BlockClass[% -\LWR@origmbox{margin-left:\LWR@printlength{\LWR@templengthone}} ; % -\LWR@origmbox{margin-right:\LWR@printlength{\LWR@templengthtwo}}% +\LWR@print@mbox{margin-left:\LWR@printlength{\LWR@templengthone}} ; % +\LWR@print@mbox{margin-right:\LWR@printlength{\LWR@templengthtwo}}% ]{\LWR@mcolstype}% } {\endBlockClass} @@ -30097,6 +30799,253 @@ width:\LWR@printlength{\LWR@tempwidth}% % % % +% \iffalse +%<*algorithm2e> +% \fi +% +% \part{lwarp-algorithm2e.sty} + +% \section{algorithm2e} +% +% \credits{Christophe Fiorio} +% +% \DescribePackage{algorithm2e} +% \pkg{algorithm2e} is patched for use by \pkg{lwarp}. +% +% \changes{v0.57}{2018/05/20}{\pkg{algorithm2e}: Added.} +% +% For print output, captions are placed according to package options, +% but for \HTML\ output captions are placed where used. +% Therefore, to have captions appear at the top of the algorithms for both +% print and \HTML, place each captions at the top of each algorithm. +% +% \codehtml +% +% \begin{macrocode} +\LWR@ProvidesPackagePass{algorithm2e} +% \end{macrocode} + +% For the list-of entries: +% \begin{macrocode} +\renewcommand{\l@algocf}[2]{\hypertocfloat{1}{algocf}{loa}{#1}{#2}} +% \end{macrocode} +% +% +% Select the \pkg{lwarp} float style according to the \pkg{algorithm2e} style: +% \begin{macrocode} +\newcommand*{\LWR@floatstyle@algocf}{ruled} + +\ifdefstring{\algocf@style}{boxed}{% +\renewcommand*{\LWR@floatstyle@algocf}{boxed} +}{} + +\ifdefstring{\algocf@style}{boxruled}{% +\renewcommand*{\LWR@floatstyle@algocf}{boxruled} +}{} + +\ifdefstring{\algocf@style}{plain}{% +\renewcommand*{\LWR@floatstyle@algocf}{plain} +}{} +% \end{macrocode} +% +% +% Paragraph handling to allow line numbers under certain conditions: +% \begin{macrocode} +\newbool{LWR@algocf@dopars} +\booltrue{LWR@algocf@dopars} + +\renewcommand{\algocf@everypar}{% +\ifbool{LWR@algocf@dopars}{% + \ifbool{LWR@doingstartpars}{% + \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% + {}% + {% + \algocf@everyparnl\algocf@everyparhanging% + }% + }{}% +}{}% +} +% \end{macrocode} +% +% +% \pkg{lwarp} caption handling: +% \begin{macrocode} +\renewcommand{\algocf@makecaption}[2]{% +\LWR@caption@begin{algocf}% +\algocf@captiontext{#1}{#2}% +\LWR@caption@end% +} +% \end{macrocode} +% +% +% Print any caption where it is declared: +% \begin{macrocode} +\renewcommand{\algocf@makecaption@plain}[2]{% + \LWR@caption@begin{algocf}% + \algocf@captiontext{#1}{#2}% + \LWR@caption@end% +} + +\renewcommand{\algocf@makecaption@boxed}[2]{% + \LWR@caption@begin{algocf}% + \algocf@captiontext{#1}{#2}% + \LWR@caption@end% +} + +\renewcommand{\algocf@makecaption@ruled}[2]{% + \LWR@caption@begin{algocf}% + \algocf@captiontext{#1}{#2}% + \LWR@caption@end% +} +% \end{macrocode} +% +% +% Turn off line numbering while making the caption: +% \begin{macrocode} +\long\def\algocf@latexcaption#1[#2]#3{% original definition of caption +\boolfalse{LWR@algocf@dopars}% lwarp + \par% + \addcontentsline{\csname ext@#1\endcsname}{#1}% + {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}% + \begingroup% + \@parboxrestore% + \if@minipage% + \@setminipage% + \fi% + \normalsize% + \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par% + \endgroup% +\booltrue{LWR@algocf@dopars}% lwarp +} +% \end{macrocode} +% +% +% Line numbers are printed in a \element{span} of class \attribute{alg2elinenumber}: +% \begin{macrocode} +\renewcommand{\algocf@printnl}[1]{% + \InlineClass{alg2elinenumber}{\NlSty{#1}}~% +}% +% \end{macrocode} +% +% +% While initializing an algorithm environment, +% locally declare the style of a regular figure to be the same as the algorithm style, +% in case the \optn{figure} option was used. +% \begin{macrocode} +\preto\@algocf@init{% + \edef\LWR@floatstyle@figure{\LWR@floatstyle@algocf}% +} +% \end{macrocode} +% +% +% For \pkg{lwarp}, the algorithm is not assembled inside a box, +% since \env{lateximage}s would not work, so the captions are +% printed where declared. +% \begin{macrocode} +\renewcommand{\@algocf@start}{% + \let\@mathsemicolon=\;\def\;{\ifmmode\@mathsemicolon\else\@endalgoln\fi}% +% \raggedright% + \AlFnt{}% + \booltrue{LWR@algocf@dopars}% lwarp +} + +\renewcommand{\@algocf@finish}{% + \boolfalse{LWR@algocf@dopars}% lwarp + \lineskip\normallineskip\setlength{\skiptotal}{\@defaultskiptotal}% + \let\;=\@mathsemicolon% + \let\]=\@emathdisplay% +} +% \end{macrocode} +% +% +% Use an \HTML\ break: +% \begin{macrocode} +\renewcommand{\BlankLine}{% +\LWR@stoppars% +\LWR@htmltagc{br /}% +\LWR@startpars% +} +% \end{macrocode} +% +% +% Simplified for \HTML. +% The paragraph handling must be preserved. +% \begin{macrocode} +\renewcommand{\SetKwInOut}[2]{% + \algocf@newcommand{#1}[1]{% + \ifthenelse{\boolean{algocf@hanginginout}}% + {\relax}% + {\algocf@seteveryparhanging{\relax}}% + \ifthenelse{\boolean{algocf@inoutnumbered}}% + {\relax}% + {\algocf@seteveryparnl{\relax}}% + {% + \KwSty{#2\algocf@typo:}% + ~##1\par% + }% + \algocf@linesnumbered% reset the numbering of the lines + \ifthenelse{\boolean{algocf@hanginginout}}% + {\relax}% + {\algocf@reseteveryparhanging}% + }% +}% + +\renewcommand{\ResetInOut}[1]{}% +% \end{macrocode} +% +% +% Each of the following creates a \element{div} of a given class, +% and turns off line numbering while creating the \element{div} tags: +% \begin{macrocode} +\renewcommand{\algocf@Vline}[1]{% +\boolfalse{LWR@algocf@dopars}% +\begin{BlockClass}{alg2evline} +\booltrue{LWR@algocf@dopars}% +#1 +\boolfalse{LWR@algocf@dopars}% +\end{BlockClass} +\booltrue{LWR@algocf@dopars}% +} +% \end{macrocode} +% +% \begin{macrocode} +\renewcommand{\algocf@Vsline}[1]{% +\boolfalse{LWR@algocf@dopars}% +\begin{BlockClass}{alg2evsline} +\booltrue{LWR@algocf@dopars}% +#1 +\boolfalse{LWR@algocf@dopars}% +\end{BlockClass} +\booltrue{LWR@algocf@dopars}% +} +% \end{macrocode} +% +% \begin{macrocode} +\renewcommand{\algocf@Noline}[1]{% +\boolfalse{LWR@algocf@dopars}% +\begin{BlockClass}{alg2enoline} +\booltrue{LWR@algocf@dopars}% +#1 +\boolfalse{LWR@algocf@dopars}% +\end{BlockClass} +\booltrue{LWR@algocf@dopars}% +} +% \end{macrocode} +% +% +% The |[H]| environment is converted to a regular float, which in \HTML\ +% is placed where declared. Reusing the regular float allows the |[H]| +% version to reuse the ruled and boxed options. +% \begin{macrocode} +\LetLtxMacro\algocf@Here\algocf +\LetLtxMacro\endalgocf@Here\endalgocf +% \end{macrocode} + +% \iffalse +%</algorithm2e> +% \fi +% +% % % \iffalse %<*algorithmicx> @@ -30883,7 +31832,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \end{macrocode} % \begin{macrocode} -\BeforeBeginEnvironment{axopicture}{\begin{lateximage}[(axopicture)]} +\BeforeBeginEnvironment{axopicture}{\begin{lateximage}[(-axopicture-~\packagediagramname)]} \AfterEndEnvironment{axopicture}{\end{lateximage}} % \end{macrocode} @@ -31027,6 +31976,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % % \changes{v0.39}{2017/08/31}{\pkg{bigdelim}: Added.} % \changes{v0.40}{2017/09/09}{\pkg{bigdelim}: Improved documentation.} +% \changes{v0.57}{2018/06/01}{\pkg{bigdelim}: Improved print/\HTML\ output selection.} % % \codehtml % @@ -31042,33 +31992,24 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \LWR@ProvidesPackagePass{bigdelim} % \end{macrocode} % -% Remember the print-mode versions: -% \begin{macrocode} -\LetLtxMacro\LWR@origldelim\ldelim -\LetLtxMacro\LWR@origrdelim\rdelim -% \end{macrocode} % % \marg{1:delimiter} \marg{2:\#rows} \marg{3:width} \oarg{4:text} % \marginpar{\hfill\cs{ldelim}}\marginpar{\hfill\cs{rdelim}} % \begin{macrocode} -\RenewDocumentCommand{\ldelim}{m m m O{}}{% +\NewDocumentCommand{\LWR@HTML@ldelim}{m m m O{}}{% \renewcommand{\LWR@multirowborder}{right}% \multirow{#2}{#3}{#4 \InlineClass{ldelim}{#1}}% } -\RenewDocumentCommand{\rdelim}{m m m O{}}{% +\LWR@formatted{ldelim} + +\NewDocumentCommand{\LWR@HTML@rdelim}{m m m O{}}{% \renewcommand{\LWR@multirowborder}{left}% \multirow{#2}{#3}{\InlineClass{rdelim}{#1} #4}% } + +\LWR@formatted{rdelim} % \end{macrocode} -% When entering a \env{lateximage}, restore the print-mode versions: -% \begin{macrocode} -\appto\LWR@restoreorigformatting{% -\LetLtxMacro{\ldelim}{\LWR@origldelim}% -\LetLtxMacro{\rdelim}{\LWR@origrdelim}% -} -% \end{macrocode} -% % % \iffalse %</bigdelim> @@ -31106,7 +32047,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \renewcommand\bigstrut[1][x]{} \appto\LWR@restoreorigformatting{% -\LetLtxMacro{\bigstrut}{\LWR@origbigstrut}% +\LetLtxMacro\bigstrut\LWR@origbigstrut% } % \end{macrocode} % @@ -31204,23 +32145,81 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \changes{v0.34}{2017/08/08}{\pkg{booktabs}: Works inside \env{lateximage}.} % % \codehtml +% +% First, forget the placeholder macros: % \begin{macrocode} +\LetLtxMacro\toprule\relax +\LetLtxMacro\midrule\relax +\LetLtxMacro\cmidrule\cline +\LetLtxMacro\bottomrule\relax +\LetLtxMacro\addlinespace\relax +\LetLtxMacro\morecmidrules\relax +\LetLtxMacro\specialrule\relax + \LWR@ProvidesPackagePass{booktabs} % \end{macrocode} % -% Booktabs emulation is spread among the tabular code. -% The original definitions are saved here for use in \HTML\ \env{lateximage}s. -% The \HTML\ versions temporarily overwrite these print versions -% when \env{tabular} is started. -% +% \changes{v0.41}{2017/10/03}{Improved rules.} +% \changes{v0.42}{2017/10/19}{If \progcode{FormatWP} force explicit border.} % \begin{macrocode} -\LetLtxMacro\LWR@origtoprule\toprule -\LetLtxMacro\LWR@origmidrule\midrule -\LetLtxMacro\LWR@origcmidrule\cmidrule -\LetLtxMacro\LWR@origbottomrule\bottomrule -\LetLtxMacro\LWR@origaddlinespace\addlinespace -\LetLtxMacro\LWR@origmorecmidrules\morecmidrules -\LetLtxMacro\LWR@origspecialrule\specialrule +\DeclareDocumentCommand{\LWR@HTML@toprule}{o d()}% + {% + \IfValueTF{#1}% + {\LWR@docmidrule[#1](){1-\arabic{LWR@tabletotalcols}}}% + {% + \ifbool{FormatWP}% + {\LWR@docmidrule[#1](){1-\arabic{LWR@tabletotalcols}}}% + {\booltrue{LWR@doingtbrule}}% + }% + \LWR@getmynexttoken} + +\LWR@expandableformatted{toprule} + +\DeclareDocumentCommand{\LWR@HTML@midrule}{o d()}% + {% + \IfValueTF{#1}% + {\LWR@docmidrule[#1](){1-\arabic{LWR@tabletotalcols}}}% + {% + \ifbool{FormatWP}% + {\LWR@docmidrule[#1](){1-\arabic{LWR@tabletotalcols}}}% + {\addtocounter{LWR@hlines}{1}}% + }% + \LWR@getmynexttoken} + +\LWR@expandableformatted{midrule} + +\DeclareDocumentCommand{\LWR@HTML@cmidrule}{O{\LWR@cmidrulewidth} d() m}{% + \LWR@docmidrule[#1](#2){#3}% + \LWR@getmynexttoken% +}% + +\LWR@expandableformatted{cmidrule} + +\DeclareDocumentCommand{\LWR@HTML@bottomrule}{o d()}{% + \IfValueTF{#1}% + {\LWR@docmidrule[#1](){1-\arabic{LWR@tabletotalcols}}}% + {% + \ifbool{FormatWP}% + {\LWR@docmidrule[#1](){1-\arabic{LWR@tabletotalcols}}}% + {\booltrue{LWR@doingtbrule}}% + }% + \LWR@getmynexttoken% +}% + +\LWR@expandableformatted{bottomrule} + +\DeclareDocumentCommand{\LWR@HTML@addlinespace}{o}{}% + +\LWR@expandableformatted{addlinespace} + +\DeclareDocumentCommand{\LWR@HTML@morecmidrules}{}{}% + +\LWR@expandableformatted{morecmidrules} + +\DeclareDocumentCommand{\LWR@HTML@specialrule}{m m m d()}% + {\LWR@docmidrule[#1](){1-\arabic{LWR@tabletotalcols}}\LWR@getmynexttoken}% + +\LWR@expandableformatted{specialrule} % \end{macrocode} % % \iffalse @@ -31231,8 +32230,6 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % % % -% -% % \iffalse %<*boxedminipage> % \fi @@ -31314,6 +32311,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \changes{v0.43}{2017/10/31}{\pkg{breakurl}: Added.} % \changes{v0.45}{2017/12/29}{\pkg{breakurl}: Fix: Underscore in \acro{URL}.} % \changes{v0.52}{2018/03/26}{\pkg{breakurl}: Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} +% \changes{v0.57}{2018/06/05}{\pkg{breakurl}: Fix: Text catcodes.} % % \codehtml % @@ -31326,13 +32324,9 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \NewDocumentCommand{\LWR@burlaltb}{O{} +m m}{% \LWR@ensuredoingapar% -\def\LWR@templink{#2}% -\@onelevel@sanitize\LWR@templink% -\def\LWR@templinktwo{#3}% -\@onelevel@sanitize\LWR@templinktwo% -\LWR@subhyperref{\LWR@templink}{\LWR@templinktwo}% -\LWR@ensuredoingapar% -\endgroup% +\LWR@subhyperref{#2}% +\LWR@subhyperreftext{#3}% +\endgroup% restore catcodes } \newrobustcmd*{\burlalt}{% @@ -31377,7 +32371,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \end{macrocode} % \begin{macrocode} -\BeforeBeginEnvironment{bytefield}{\begin{lateximage}[(bytefield)]} +\BeforeBeginEnvironment{bytefield}{\begin{lateximage}[(-bytefield-~\packagediagramname)]} \AfterEndEnvironment{bytefield}{\end{lateximage}} % \end{macrocode} @@ -31916,7 +32910,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \LetLtxMacro\LWR@chemfig@origchemfig\chemfig \DeclareDocumentCommand\chemfig{s O{} O{} m}{% - \begin{lateximage}[(chemfig)]% + \begin{lateximage}[(-chemfig-~\packagediagramname)]% \IfBooleanTF{#1}{% \LWR@chemfig@origchemfig*[#2][#3]{#4}% }{% @@ -31928,18 +32922,18 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \LetLtxMacro\LWR@chemfig@origCF@lewis@b\CF@lewis@b \def\CF@lewis@b#1#2{% -\begin{lateximage}[(chemfig)]% +\begin{lateximage}[(-chemfig-~\packagediagramname)]% \LWR@chemfig@origCF@lewis@b{#1}{#2}% \end{lateximage}% } -\preto{\schemestart}{\begin{lateximage}[(chemfig)]} +\preto{\schemestart}{\begin{lateximage}[(-chemfig-~\packagediagramname)]} \appto{\CF@schemestop}{\end{lateximage}} \LetLtxMacro\LWR@chemfig@origchemleft\chemleft \def\chemleft#1#2\chemright#3{% -\begin{lateximage}[(chemfig)]% +\begin{lateximage}[(-chemfig-~\packagediagramname)]% \LWR@chemfig@origchemleft#1#2\chemright#3% \end{lateximage}% } @@ -31947,7 +32941,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \LetLtxMacro\LWR@chemfig@origchemup\chemup \def\chemup#1#2\chemdown#3{% -\begin{lateximage}[(chemfig)]% +\begin{lateximage}[(-chemfig-~\packagediagramname)]% \LWR@chemfig@origchemup#1#2\chemdown#3% \end{lateximage}% } @@ -32066,7 +33060,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \begin{macrocode} \RenewDocumentCommand \charrow { mO{}O{} } { - \begin{lateximage}[(charrow)] + \begin{lateximage}[(-chemformula- charrow)] \group_begin: \__chemformula_draw_arrow:nnn {#1} {#2} {#3} \group_end: @@ -32396,7 +33390,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \begin{noindenvironment}{polymerdelims} % \begin{macrocode} \DeclareDocumentEnvironment{polymerdelims}{} -{\begin{lateximage}[(polymer)]} +{\begin{lateximage}[(-chemmacros- polymer)]} {\end{lateximage}} % \end{macrocode} % \end{noindenvironment} @@ -32408,7 +33402,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % For the print output version, see \cref{sec:chemmacrosprintenvs}. % \begin{macrocode} \DeclareDocumentEnvironment{redoxreaction}{m m} -{\begin{lateximage}[(redox~reaction)]} +{\begin{lateximage}[(-chemmacros- redoxreaction)]} {\end{lateximage}} % \end{macrocode} % \end{noindenvironment} @@ -33547,27 +34541,13 @@ name = \chemmacros_translate:n {scheme-name} % % \codehtml % +% A few placeholder definitions are forgotten first: % \begin{macrocode} -\LWR@ProvidesPackagePass{colortbl} -% \end{macrocode} - -% Remember the print-mode definitions: -% \begin{macrocode} -\LetLtxMacro\LWR@origcolumncolor\columncolor -\LetLtxMacro\LWR@origrowcolor\rowcolor -\LetLtxMacro\LWR@origcellcolor\cellcolor -\LetLtxMacro\LWR@origarrayrulecolor\arrayrulecolor -\LetLtxMacro\LWR@origdoublerulesepcolor\doublerulesepcolor +\let\rowcolor\relax -\appto\LWR@restoreorigformatting{% -\LetLtxMacro\columncolor\LWR@origcolumncolor% -\LetLtxMacro\rowcolor\LWR@origrowcolor% -\LetLtxMacro\cellcolor\LWR@origcellcolor% -\LetLtxMacro\arrayrulecolor\LWR@origarrayrulecolor% -\LetLtxMacro\doublerulesepcolor\LWR@origdoublerulesepcolor% -} +\LWR@ProvidesPackagePass{colortbl} % \end{macrocode} - +% % % The following \cs{LWR@HTML} versions are used inside an \HTML\ \env{tabular}. % @@ -33575,53 +34555,77 @@ name = \chemmacros_translate:n {scheme-name} % % \cs{LWR@getmynexttoken} is not used here because \cs{columncolor} is not used % inside the data area of the tabular. +% +% \changes{v0.57}{2018/06/02}{\pkg{colortbl}: New system for switching print and HTML outputs.} % \begin{macrocode} -\RenewDocumentCommand{\LWR@HTMLcolumncolor}{O{named} m o o}{% +\NewDocumentCommand{\LWR@HTML@columncolor}{O{named} m o o}{% \convertcolorspec{#1}{#2}{HTML}\LWR@columnHTMLcolor% \LWR@addtabularcellcolor% } + +\LWR@formatted{columncolor} % \end{macrocode} % \end{noindmacro} % +% % \cs{LWR@getmynexttoken} is used for \cs{rowcolor} because it is used % inside the data area of the tabular. % +% % \begin{noindmacro}{\rowcolor} \oarg{model} \marg{color} \oarg{left overhang} \oarg{right overhang} +% +% \changes{v0.57}{2018/06/02}{\pkg{colortbl}: New system for switching print and HTML outputs.} % \begin{macrocode} -\RenewDocumentCommand{\LWR@HTMLrowcolor}{O{named} m o o}{% +\NewDocumentCommand{\LWR@HTML@rowcolor}{O{named} m o o}{% \convertcolorspec{#1}{#2}{HTML}\LWR@rowHTMLcolor% \LWR@getmynexttoken% } + +\LWR@expandableformatted{rowcolor} % \end{macrocode} % \end{noindmacro} - +% +% % \begin{noindmacro}{\cellcolor} \oarg{model} \marg{color} \oarg{left overhang} \oarg{right overhang} +% +% \changes{v0.57}{2018/06/02}{\pkg{colortbl}: New system for switching print and HTML outputs.} % \begin{macrocode} -\RenewDocumentCommand{\LWR@HTMLcellcolor}{O{named} m o o}{% +\NewDocumentCommand{\LWR@HTML@cellcolor}{O{named} m o o}{% \convertcolorspec{#1}{#2}{HTML}\LWR@cellHTMLcolor% \LWR@addtabularcellcolor% } + +\LWR@formatted{cellcolor} % \end{macrocode} % \end{noindmacro} % \begin{noindmacro}{\arrayrulecolor} \oarg{model} \marg{color} % -% The version for use outside a \env{tabular}. +% The \HTML\ version for use outside a \env{tabular}. +% Inside a \env{tabular}, \cs{LWR@HTML@arrayrulecolornexttoken} is used instead. +% +% \changes{v0.57}{2018/06/02}{\pkg{colortbl}: New system for switching print and HTML outputs.} % \begin{macrocode} -\renewcommand{\arrayrulecolor}[2][named]{% +\newcommand{\LWR@HTML@arrayrulecolor}[2][named]{% \convertcolorspec{#1}{#2}{HTML}\LWR@ruleHTMLcolor% } + +\LWR@expandableformatted{arrayrulecolor} % \end{macrocode} % \end{noindmacro} -% \begin{noindmacro}{\LWR@arrayrulecolor} \oarg{model} \marg{color} +% \begin{noindmacro}{\LWR@arrayrulecolornexttoken} \oarg{model} \marg{color} % -% The version for use inside a \env{tabular}. +% The \HTML\ version for use inside a \env{tabular}. +% +% \changes{v0.57}{2018/06/02}{\pkg{colortbl}: New system for switching print and HTML outputs.} % \begin{macrocode} -\renewcommand{\LWR@HTMLarrayrulecolor}[2][named]{% +\newcommand{\LWR@HTML@arrayrulecolornexttoken}[2][named]{% \convertcolorspec{#1}{#2}{HTML}\LWR@ruleHTMLcolor% \LWR@getmynexttoken% } + +\LWR@expandableformatted{arrayrulecolornexttoken} % \end{macrocode} % \end{noindmacro} @@ -33629,15 +34633,19 @@ name = \chemmacros_translate:n {scheme-name} % % The version for use outside a \env{tabular}. % \begin{macrocode} -\renewcommand{\doublerulesepcolor}[2][named]{} +\newcommand{\LWR@HTML@doublerulesepcolor}[2][named]{} + +\LWR@expandableformatted{doublerulesepcolor} % \end{macrocode} % \end{noindmacro} -% \begin{noindmacro}{\LWR@doublerulesepcolor} \oarg{model} \marg{color} +% \begin{noindmacro}{\LWR@doublerulesepcolornexttoken} \oarg{model} \marg{color} % % The version for use inside a \env{tabular}. % \begin{macrocode} -\renewcommand{\LWR@HTMLdoublerulesepcolor}[2][named]{\LWR@getmynexttoken} +\newcommand{\LWR@HTML@doublerulesepcolornexttoken}[2][named]{\LWR@getmynexttoken} + +\LWR@expandableformatted{doublerulesepcolornexttoken} % \end{macrocode} % \end{noindmacro} @@ -34178,6 +35186,7 @@ name = \chemmacros_translate:n {scheme-name} % \credits{Peter J. Heslin} % % \changes{v0.25}{2017/03/16}{\pkg{ellipsis}: Added.} +% \changes{v0.57}{2018/05/15}{\pkg{ellipsis}: Added \cs{midwordellipsis}.} % % \DescribePackage{ellipsis} % \pkg{ellipsis} is emulated. @@ -34186,6 +35195,8 @@ name = \chemmacros_translate:n {scheme-name} \LWR@ProvidesPackageDrop{ellipsis} \newcommand{\ellipsisgap}{0.1em} + +\newcommand*{\midwordellipsis}{\,\textellipsis\,} % \end{macrocode} % \iffalse @@ -34510,13 +35521,13 @@ name = \chemmacros_translate:n {scheme-name} % \begin{macrocode} \DeclareDocumentCommand{\epigraph}{m m} { -\begin{LWR@BlockClassWP}{\LWR@origmbox{text-align:right}}{}{epigraph} +\begin{LWR@BlockClassWP}{\LWR@print@mbox{text-align:right}}{}{epigraph} \qitem{#1}{#2} \end{LWR@BlockClassWP} } \DeclareDocumentEnvironment{epigraphs}{} -{\LWR@BlockClassWP{\LWR@origmbox{text-align:right}}{}{epigraph}} +{\LWR@BlockClassWP{\LWR@print@mbox{text-align:right}}{}{epigraph}} {\endLWR@BlockClassWP} % \end{macrocode} % @@ -34631,6 +35642,123 @@ name = \chemmacros_translate:n {scheme-name} % % % \iffalse +%<*errata> +% \fi +% +% \part{lwarp-errata.sty} + +% \section{errata} +% +% \credits{Michael Kohlhase} +% +% \DescribePackage{errata} +% \pkg{errata} is patched for use by \pkg{lwarp}. +% +% This is for v0.3 of \pkg{errata}. +% A newer version of \pkg{errata} with more features is under development, +% at which time the \pkg{lwarp} version will have to be updated. +% +% \changes{v0.57}{2018/05/23}{\pkg{errata}: Added.} +% +% \codehtml +% +% Macros are being defined with the math dollar, +% so enable the \HTML\ version during package loading: +% \begin{macrocode} +\StartDefiningMath +% \end{macrocode} + +% Now load the package: +% \begin{macrocode} +\LWR@ProvidesPackagePass{errata}[2006/11/12] +% \end{macrocode} + +% Patches for dynamic inline math: +% \begin{macrocode} +\xpatchcmd{\erratumAdd} + {$_a^{\arabic{erratum}}$} +% {\StartDynamicMath$_a^{\arabic{erratum}}$\StopDynamicMath} + {\textsubscript{a}\textsuperscript{\arabic{erratum}}} + {} + { + \PackageError{lwarp} + {Unable to patch the erratum package, erratumAdd macro} + {Please contact the author of the lwarp package.} + } + +\xpatchcmd{\erratumDelete} + {$_d^{\arabic{erratum}}$} +% {\StartDynamicMath$_d^{\arabic{erratum}}$\StopDynamicMath} + {\textsubscript{d}\textsuperscript{\arabic{erratum}}} + {} + { + \PackageError{lwarp} + {Unable to patch the erratum package, erratumDelete macro} + {Please contact the author of the lwarp package.} + } + +\xpatchcmd{\erratumReplace} + {$_r^{\arabic{erratum}}$} +% {\StartDynamicMath$_r^{\arabic{erratum}}$\StopDynamicMath} + {\textsubscript{r}\textsuperscript{\arabic{erratum}}} + {} + { + \PackageError{lwarp} + {Unable to patch the erratum package, erratumReplace macro} + {Please contact the author of the lwarp package.} + } + +\xpatchcmd{\erratum} + {$_a$} +% {\StartDynamicMath$_a$\StopDynamicMath} + {\textsubscript{a}} + {} + { + \PackageError{lwarp} + {Unable to patch the erratum package, eDelete macro} + {Please contact the author of the lwarp package.} + } + +\xpatchcmd{\erratum} + {$_d^{\@thefnmark}$} +% {\StartDynamicMath$_d^{\@thefnmark}$\StopDynamicMath} + {\textsubscript{d}\textsuperscript{\@thefnmark}} + {} + { + \PackageError{lwarp} + {Unable to patch the erratum package, eDelete macro} + {Please contact the author of the lwarp package.} + } + +\xpatchcmd{\erratum} + {$_r^{\@thefnmark}$} +% {\StartDynamicMath$_r^{\@thefnmark}$\StopDynamicMath} + {\textsubscript{r}\textsuperscript{\@thefnmark}} + {} + { + \PackageError{lwarp} + {Unable to patch the erratum package, eReplace macro} + {Please contact the author of the lwarp package.} + } +% \end{macrocode} + +% Finish the current page's errata before closing and reloading the list: +% \begin{macrocode} +\preto\PrintErrata{\LWR@orignewpage} +% \end{macrocode} + +% No longer defining math macros with the \HTML\ |$|: +% \begin{macrocode} +\StopDefiningMath +% \end{macrocode} + +% \iffalse +%</errata> +% \fi +% +% +% +% \iffalse %<*eso-pic> % \fi % @@ -35843,7 +36971,7 @@ solid \LWR@origpound\LWR@tempcolor ; % % \part{lwarp-float.sty} -% \section{float and \cs{newfloat}} +% \section{float} % \label{sec:newfloat} % \label{sec:float} % @@ -35852,17 +36980,33 @@ solid \LWR@origpound\LWR@tempcolor ; % % \DescribePackage{float} % \pkg{float} is emulated. % -% \changes{v0.20}{2017/01/22}{Improved float caption type handling.} +% Float styles |boxed| and |ruled| are emulated by \CSS\ and a float class according +% to style. % +% The \HTML\ \element{figure} \attribute{class} is set to the float type, +% so \CSS\ may also be used to format the float and its caption, according to +% float type. +% Furthermore, an additional class is set to the float style: |plain|, |plaintop|, +% |boxed|, or |ruled|, so \CSS\ may be used to format by float style as well. +% Default formatting by \CSS\ is provided for |ruled| and |boxed| styles. +% +% \changes{v0.20}{2017/01/22}{\pkg{float}: Improved float caption type handling.} % % \codehtml % \begin{macrocode} -\LWR@ProvidesPackageDrop{float}[2016/03/04] +\LWR@ProvidesPackageDrop{float}[2001/11/08] % \end{macrocode} -% +% \begin{noindmacro}{\listof} % See \cref{sec:listof} for the \cs{listof} command. +% \end{noindmacro} +% \begin{macro}{\LWR@floatstyle} +% The default float style: +% \begin{macrocode} +\newcommand*{\LWR@floatstyle}{plain} +% \end{macrocode} +% \end{macro} % \begin{noindmacro}{\newfloat} \marg{1: type} \marg{2: placement} % \marg{3: ext} \oarg{4: within} @@ -35877,13 +37021,23 @@ solid \LWR@origpound\LWR@tempcolor ; % {\DeclareFloatingEnvironment[fileext=#3,within=#4]{#1}}% {\DeclareFloatingEnvironment[fileext=#3]{#1}}% % \end{macrocode} +% Remember the float style: +% \changes{v0.57}{2018/05/14}{\pkg{float}: Added float styles.} +% \begin{macrocode} +\csedef{LWR@floatstyle@#1}{\LWR@floatstyle}% +% \end{macrocode} % \pkg{newfloat} package automatically creates the \cs{listof} command % for new floats, but \pkg{float} does not, % so remove \cs{listof} here in case it is manually created later. -% ^^A required? % \begin{macrocode} \cslet{listof#1s}\relax% \cslet{listof#1es}\relax% +% \end{macrocode} +% Likesize, \pkg{newfloat} also creates \cs{l@<type>}, but \pkg{float} does not, +% so remove it here: +% \changes{v0.57}{2018/05/26}{\pkg{float}: Fix: Do not pre-define \cs{l@name}.} +% \begin{macrocode} +\cslet{l@#1}\relax% } % \end{macrocode} % \end{noindmacro} @@ -35893,7 +37047,7 @@ solid \LWR@origpound\LWR@tempcolor ; % % Sets the text name of the float, such as ``Figure''. % \begin{macrocode} \NewDocumentCommand{\floatname}{m +m}{% -\SetupFloatingEnvironment{#1}{name=#2}% + \SetupFloatingEnvironment{#1}{name=#2}% } % \end{macrocode} % \end{noindmacro} @@ -35903,24 +37057,27 @@ solid \LWR@origpound\LWR@tempcolor ; % % Float placement is ignored. % \begin{macrocode} \newcommand*{\floatplacement}[2]{% -\SetupFloatingEnvironment{#1}{placement=#2}% + \SetupFloatingEnvironment{#1}{placement=#2}% } % \end{macrocode} % \end{noindmacro} % \begin{noindmacro}{\floatstyle} \marg{style} % -% Float styles are ignored. +% Remember the style for future floats: % \begin{macrocode} -\newcommand{\floatstyle}[1]{} +\newcommand{\floatstyle}[1]{% + \def\LWR@floatstyle{#1}% +} % \end{macrocode} % \end{noindmacro} -% \begin{noindmacro}{\restylefloat} * \marg{style} +% \begin{noindmacro}{\restylefloat} * \marg{type} % -% Float styles are ignored. +% Remember the style for this float: % \begin{macrocode} \NewDocumentCommand{\restylefloat}{s m}{% + \csedef{LWR@floatstyle@#2}{\LWR@floatstyle}% } % \end{macrocode} % \end{noindmacro} @@ -35932,10 +37089,6 @@ solid \LWR@origpound\LWR@tempcolor ; % % % % -% -% -% -% % \iffalse %<*floatflt> % \fi @@ -36349,7 +37502,7 @@ solid \LWR@origpound\LWR@tempcolor ; % % \end{macrocode} % \begin{noindenvironment}{subfloatrow} \oarg{num\_floats} -% \changes{v0.15}{2016/04/01}{Added} +% \changes{v0.15}{2016/04/01}{Added.} % \begin{macrocode} \newenvironment*{subfloatrow}[1][2] { @@ -37333,6 +38486,30 @@ solid \LWR@origpound\LWR@tempcolor ; % % % % +% \iffalse +%<*glossary> +% \fi +% +% \part{lwarp-glossary.sty} +% +% \section{glossary} +% +% \DescribePackage{glossary} +% \pkg{glossary} is superceded by \pkg{glossaries}. +% +% \changes{v0.57}{2018/05/16}{\pkg{glossary}: Prevented.} +% +% \codehtml +% \begin{macrocode} +\LWR@loadnever{glossary}{glossaries} +% \end{macrocode} +% +% \iffalse +%</glossary> +% \fi +% +% +% % % \iffalse %<*graphics> @@ -37888,11 +39065,14 @@ img src="% % % % \begin{macro}{\rotatebox} \oarg{keyval list} \marg{angle} \marg{text} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % \begin{macrocode} -\LetLtxMacro\LWR@origrotatebox\rotatebox - \AtBeginDocument{ -\RenewDocumentCommand{\rotatebox}{O{} m +m}{% +% \end{macrocode} +% +% The \HTML\ version: +% \begin{macrocode} +\NewDocumentCommand{\LWR@HTML@rotatebox}{O{} m +m}{% % \end{macrocode} % Reset the origin to ``none-given'': % \begin{macrocode} @@ -37928,16 +39108,26 @@ img src="% \LWR@htmltagc{/span}% \end{LWR@nestspan}% } +% \end{macrocode} +% +% The high-level interface: +% \begin{macrocode} +\LWR@formatted{rotatebox} + }% AtBeginDocument % \end{macrocode} % \end{macro} + % \begin{macro}{\scalebox} \marg{h-scale} \oarg{v-scale} \marg{text} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % \begin{macrocode} -\LetLtxMacro\LWR@origscalebox\scalebox - \AtBeginDocument{ -\RenewDocumentCommand{\scalebox}{m o m}{% +% \end{macrocode} +% +% The \HTML\ version: +% \begin{macrocode} +\NewDocumentCommand{\LWR@HTML@scalebox}{m o m}{% % \end{macrocode} % Select |inline-block| so that \HTML\ will transform this span: % \begin{macrocode} @@ -37960,17 +39150,29 @@ img src="% \LWR@htmltagc{/span}% \end{LWR@nestspan}% } +% \end{macrocode} +% +% The high-level interface: +% \begin{macrocode} +\LWR@formatted{scalebox} + }% AtBeginDocument % \end{macrocode} % \end{macro} + % \begin{macro}{\reflectbox} \marg{text} +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % \begin{macrocode} -\let\LWR@origreflectbox\reflectbox - \AtBeginDocument{ -\renewcommand{\reflectbox}[1]{\scalebox{-1}[1]{#1}} -} + +\newcommand{\LWR@HTML@reflectbox}[1]{% +\scalebox{-1}[1]{#1}% +}% \reflectbox + +\LWR@formatted{reflectbox} + +}% AtBeginDocument % \end{macrocode} % \end{macro} @@ -37979,12 +39181,18 @@ img src="% % \begin{macro}{\resizebox} \marg{h-length} \marg{v-length} \marg{text} % % Simply prints its text argument. +% +% \changes{v0.57}{2018/05/28}{Improved print/\HTML\ output selection.} % \begin{macrocode} -\LetLtxMacro\LWR@origresizebox\resizebox - \AtBeginDocument{ -\renewcommand{\resizebox}[3]{#3} + +\NewDocumentCommand{\LWR@HTML@resizebox}{s m m m}{% +#4% } + +\LWR@formatted{resizebox} + +}% AtBeginDocument % \end{macrocode} % \end{macro} % @@ -38017,7 +39225,7 @@ img src="% % % \codehtml % \begin{macrocode} -\LWR@ProvidesPackagePass{graphicx} +\LWR@ProvidesPackagePass{graphicx}[2017/06/01] % \end{macrocode} % \iffalse @@ -38165,8 +39373,8 @@ img src="% { \LWR@findhangingleftmargin% \BlockClass[% - \LWR@origmbox{margin-left:\LWR@printlength{\LWR@templengthone}} ; % - \LWR@origmbox{text-indent:-\LWR@printlength{\hangingindent}}% + \LWR@print@mbox{margin-left:\LWR@printlength{\LWR@templengthone}} ; % + \LWR@print@mbox{text-indent:-\LWR@printlength{\hangingindent}}% ]% {hangingpar}% } @@ -38178,11 +39386,11 @@ img src="% \renewcommand*{\LWR@printopenlist}{% \LWR@findhangingleftmargin% ul style="% - \LWR@origmbox{list-style-type:none;} % extra space - \LWR@origmbox{% + \LWR@print@mbox{list-style-type:none;} % extra space + \LWR@print@mbox{% margin-left:\LWR@printlength{\LWR@templengthone}% } ; % extra space - \LWR@origmbox{% + \LWR@print@mbox{% text-indent:-\LWR@printlength{\hangingindent}% }% "% @@ -38203,8 +39411,8 @@ img src="% {% \BlockClass[% \LWR@findhangingleftmargin% - \LWR@origmbox{margin-left:\LWR@printlength{\LWR@templengthone}} ; % - \LWR@origmbox{text-indent:-\LWR@printlength{\hangingindent}}% + \LWR@print@mbox{margin-left:\LWR@printlength{\LWR@templengthone}} ; % + \LWR@print@mbox{text-indent:-\LWR@printlength{\hangingindent}}% ]{labeledpar}#2% } {\endBlockClass} @@ -38269,8 +39477,8 @@ img src="% \newenvironment*{hangparas}[2] {% \BlockClass[% - \LWR@origmbox{margin-left:\LWR@printlength{#1}} ; % - \LWR@origmbox{text-indent:-\LWR@printlength{#1}}% + \LWR@print@mbox{margin-left:\LWR@printlength{#1}} ; % + \LWR@print@mbox{text-indent:-\LWR@printlength{#1}}% ]% {hangingpar}% } @@ -38481,12 +39689,13 @@ img src="% % \marg{3: name} \marg{4: text} % \changes{v0.45}{2018/01/02}{\pkg{hyperref}: Fix: Underscore in \acro{URL}.} % \changes{v0.52}{2018/03/26}{\pkg{hyperref}: Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} +% \changes{v0.57}{2018/06/05}{\pkg{subcaption}: Fix: \cs{subref}.} % % Creates an \HTML\ link to |URL#category.name| with the given text. % \begin{macrocode} \newcommand{\LWR@hyperreffinish}[1]{% \begingroup% -\LetLtxMacro\ref\LWR@origref%{} syntax highlighting +\RenewDocumentCommand{\ref}{}{\LWR@ref@ignorestar}% #1% \endgroup% \LWR@htmltag{/a}% @@ -40035,6 +41244,55 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % % % +% +% +% +% \iffalse +%<*ltablex> +% \fi + +% \part{lwarp-ltablex.sty} + +% \section{ltablex} +% +% \credits{Anil K. Goel} +% +% \DescribePackage{ltablex} +% \pkg{ltablex} is emulated by \pkg{lwarp}. +% +% \changes{v0.57}{2018/05/25}{\pkg{ltablex}: Added.} +% +% \codehtml +% +% Relies on \pkg{tabularx}. +% +% \begin{macrocode} +\RequirePackage{tabularx} + +\LWR@ProvidesPackageDrop{ltablex} + +\DeclareDocumentEnvironment{tabularx}{m o m} +{\longtable{#3}} +{\endlongtable} + +\DeclareDocumentEnvironment{tabularx*}{m o m} +{\longtable{#3}} +{\endlongtable} + +\newcommand*{\keepXColumns}{} +\newcommand*{\convertXColumns}{} +% \end{macrocode} +% +% +% \iffalse +%</ltablex> +% \fi +% +% +% +% +% +% % \iffalse %<*ltcaption> % \fi @@ -40122,6 +41380,10 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % \DescribePackage{ltxtable} % \pkg{ltxtable} is emulated. % +% The print version does not seem to honor \env{longtable*} from the +% \watchout[table numbering] +% \pkg{caption} package, while \pkg{lwarp} does. +% % \changes{v0.44}{2017/11/15}{\pkg{ltxtable}: Added.} % % \codehtml @@ -40459,6 +41721,7 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % \DescribePackage{marginnote} Emulated. % % \changes{v0.26}{2017/03/30}{\pkg{marginnote}: Added.} +% \changes{v0.57}{2018/06/05}{\pkg{marginnote}: Fix: Long optional argument.} % % \codehtml % @@ -40467,8 +41730,11 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \LWR@ProvidesPackageDrop{marginnote} % \end{macrocode} % +% \changes{v0.57}{2018/06/05}{\pkg{marginnote}: Fix: Long optional argument.} +% \begin{macrocode} +\NewDocumentCommand{\marginnote}{+o +m o}{\marginpar{#2}} +% \end{macrocode} % \begin{macrocode} -\NewDocumentCommand{\marginnote}{o +m o}{\marginpar{#2}} \newcommand*{\marginnoteleftadjust}{} \newcommand*{\marginnoterightadjust}{} \newcommand*{\marginnotetextwidth}{} @@ -40706,9 +41972,11 @@ border-radius: \LWR@mdfprintlength{roundcorner} ; \LWR@orignewline % \env{mdframed} environment may not work with the \HTML\ versions of the following, % so restore them to their originals while inside \env{mdframed}: % \begin{macrocode} -\LetLtxMacro\hspace\LWR@orighspace% -\LetLtxMacro\rule\LWR@origrule% -\LetLtxMacro\makebox\LWR@origmakebox% +\LWR@select@print@hspace% +\renewcommand*{\rule}{\LWR@print@rule} +\LetLtxMacro\makebox\LWR@print@makebox% +% \end{macrocode} +% \begin{macrocode} \LWR@startpars% \LWR@traceinfo{LWR@mdframedstart done}% } @@ -40839,16 +42107,16 @@ background: ; \LWR@orignewline }{}% % \end{macrocode} -% The title's top border radius is adjusted for the line width: -% \begin{macrocode} -border-radius: -\setlength{\LWR@titleroundcorner} - {\maxof{\mdf@roundcorner@length-\mdf@linewidth@length}{0pt}} - \LWR@printlength{\LWR@titleroundcorner} - \LWR@printlength{\LWR@titleroundcorner} - 0pt 0pt - \LWR@orignewline -% \end{macrocode} +% ^^A The title's top border radius is adjusted for the line width: +% ^^A \begin{macrocode} +% ^^A border-radius: +% ^^A \setlength{\LWR@titleroundcorner} +% ^^A {\maxof{\mdf@roundcorner@length-\mdf@linewidth@length}{0pt}} +% ^^A \LWR@printlength{\LWR@titleroundcorner} +% ^^A \LWR@printlength{\LWR@titleroundcorner} +% ^^A 0pt 0pt +% ^^A \LWR@orignewline +% ^^A \end{macrocode} % Finish the custom style and the opening span tag: % \begin{macrocode} " \LWR@orignewline @@ -41469,7 +42737,7 @@ background: % \changes{v0.47}{2018/01/26}{\pkg{midpage}: Fix: Line wrap at \HTML\ hyphen.} % \begin{macrocode} \newenvironment{midpage} -{\begin{BlockClass}[\LWR@origmbox{margin-top:6ex} ; \LWR@origmbox{margin-bottom:6ex}]{midpage}} +{\begin{BlockClass}[\LWR@print@mbox{margin-top:6ex} ; \LWR@print@mbox{margin-bottom:6ex}]{midpage}} {\end{BlockClass}} % \end{macrocode} % @@ -41793,15 +43061,17 @@ background: % See \cref{sec:printmultirow} for the print-mode versions. % % \codehtml +% +% Remove the placeholder macro which was used if \pkg{multirow} was not loaded: % \begin{macrocode} -\LWR@ProvidesPackagePass{multirow} +\LetLtxMacro\multirow\relax % \end{macrocode} % -% Remember the print-mode version: % \begin{macrocode} -\LetLtxMacro\LWR@origmultirow\multirow +\LWR@ProvidesPackagePass{multirow} % \end{macrocode} % +% % \begin{macro}{\LWR@multirowborder} % Set to |left| or |right| to create a thick border for the cell, % for use by \pkg{bigdelim}: @@ -41822,10 +43092,11 @@ background: % \changes{v0.40}{2017/09/22}{\pkg{multirow}: Improved \pkg{bigdelim} borders.} % \changes{v0.41}{2017/09/28}{\pkg{multirow}: Add: \cs{cmidrule} trims.} % \changes{v0.47}{2018/01/26}{\pkg{multirow}: Fix: Line wrap at \HTML\ hyphen.} +% \changes{v0.57}{2018/05/28}{\pkg{multirow}: Improved print/\HTML\ output selection.} % \begin{macrocode} -\RenewDocumentCommand{\multirow}{O{c} m o m o +m}% +\NewDocumentCommand{\LWR@HTML@multirow}{O{c} m o m o +m}% {% -\LWR@traceinfo{*** multirow #1 #2 #4}% +\LWR@traceinfo{*** LWR@HTML@multirow #1 #2 #4}% \LWR@maybenewtablerow% \LWR@tabularleftedge% % \end{macrocode} @@ -41836,15 +43107,15 @@ background: % The vertical alignment, if given: % \begin{macrocode} \IfValueT{#1}{% -\ifstrequal{#1}{b}{style="\LWR@origmbox{vertical-align:bottom}" }{}% -\ifstrequal{#1}{t}{style="\LWR@origmbox{vertical-align:top}" }{}% +\ifstrequal{#1}{b}{style="\LWR@print@mbox{vertical-align:bottom}" }{}% +\ifstrequal{#1}{t}{style="\LWR@print@mbox{vertical-align:top}" }{}% }% % \end{macrocode} % The left/right border, if given: % \begin{macrocode} \ifdefvoid{\LWR@multirowborder}{}{% -style="\LWR@origmbox{border-\LWR@multirowborder:} 2px dotted black ; % -\LWR@origmbox{padding-\LWR@multirowborder:} 2px" % +style="\LWR@print@mbox{border-\LWR@multirowborder:} 2px dotted black ; % +\LWR@print@mbox{padding-\LWR@multirowborder:} 2px" % }% % \end{macrocode} % A class adds the column spec and the rule: @@ -41884,8 +43155,10 @@ class="td% \LWR@stoppars% \global\boolfalse{LWR@intabularmetadata}% \renewcommand{\LWR@multirowborder}{}% -\LWR@traceinfo{*** multirow done}% +\LWR@traceinfo{*** LWR@HTML@multirow done}% }% + +\LWR@formatted{multirow} % \end{macrocode} % % @@ -41904,9 +43177,20 @@ class="td% % \marg{6:width} \oarg{7:fixup} \marg{8:text} % % \changes{v0.39}{2017/08/30}{Added.} +% \changes{v0.57}{2018/05/28}{\pkg{multirow}: Improved print/\HTML\ output selection.} +% +% |\@ifpackageloaded{multirow}| determines if v2.0 or later of +% \pkg{multirow} was used, which included the \cs{ProvidesPackage} macro. +% +% +% The \HTML\ version follows. % +% \cs{AtBeginDocument} because the print version had to see if \pkg{multirow} +% was loaded before determining how to define \cs{LWR@print@multicolumnrow}. % \begin{macrocode} -\NewDocumentCommand{\multicolumnrow}{m m O{} m O{} m O{} +m}{% +\AtBeginDocument{ + +\NewExpandableDocumentCommand{\LWR@HTML@multicolumnrow}{m m O{} m O{} m O{} +m}{% % \end{macrocode} % Figure out how many extra \HTML\ columns to add for |@| and |!| columns: % \begin{macrocode} @@ -41928,18 +43212,14 @@ class="td% % \begin{macrocode} \booltrue{LWR@skipatbang}% } + +\LWR@expandableformatted{multicolumnrow} + +}% \AtBeginDocument % \end{macrocode} % \end{macro} % % -% \begin{macrocode} -\appto\LWR@restoreorigformatting{% -\LetLtxMacro\multirow\LWR@origmultirow% -\renewcommand{\multicolumnrow}{\LWR@origmulticolumnrow}% -} -% \end{macrocode} -% -% % \iffalse %</multirow> % \fi @@ -42640,7 +43920,7 @@ class="td% \newcommand{\LWR@inctheorem}{% \addtocounter{LWR@thisautoid}{1}% \LWR@stoppars% -\LWR@htmltag{a id="\LWR@origmbox{autoid-\arabic{LWR@thisautoid}}"}\LWR@htmltag{/a}% +\LWR@htmltag{a id="\LWR@print@mbox{autoid-\arabic{LWR@thisautoid}}"}\LWR@htmltag{/a}% \LWR@startpars% } % \end{macrocode} @@ -43815,7 +45095,7 @@ class="td% { \PackageError{lwarp} {Unable to patch the quoting package} - {Please contact the author of lwarp.} + {Please contact the author of the lwarp package.} } \xpatchcmd{\endquoting}{\quo@endtext} {\quo@endtext\end{LWR@blocktextcurrentfont}} @@ -43823,7 +45103,7 @@ class="td% { \PackageError{lwarp} {Unable to patch the quoting package} - {Please contact the author of lwarp.} + {Please contact the author of the lwarp package.} } % \end{macrocode} @@ -43930,8 +45210,12 @@ class="td% \newcommand*{\LWR@setrealscriptsalign}[1]{% \renewcommand*{\LWR@realscriptsalign}{}% -\ifthenelse{\equal{#1}{c}}{\renewcommand{\LWR@realscriptsalign}{\LWR@origmbox{text-align:center} ; }}{}% -\ifthenelse{\equal{#1}{r}}{\renewcommand{\LWR@realscriptsalign}{\LWR@origmbox{text-align:right} ; }}{}% +\ifthenelse{\equal{#1}{c}}{% + \renewcommand{\LWR@realscriptsalign}{\LWR@print@mbox{text-align:center} ; }% +}{}% +\ifthenelse{\equal{#1}{r}}{% + \renewcommand{\LWR@realscriptsalign}{\LWR@print@mbox{text-align:right} ; }% +}{}% } \DeclareDocumentCommand \textsubsuperscript {s O{l} mm} {% @@ -43957,6 +45241,52 @@ class="td% % % % +% \iffalse +%<*register> +% \fi +% +% \part{lwarp-register.sty} + +% \section{register} +% +% \credits{Matthew Lovell} +% +% \DescribePackage{register} +% \pkg{register} is patched for use by \pkg{lwarp}. +% +% \changes{v0.57}{2018/06/03}{\pkg{register}: Added.} +% +% \codehtml +% +% \begin{macrocode} +\LWR@ProvidesPackagePass{register} +% \end{macrocode} + +% \begin{macrocode} +\xpatchcmd{\register} + {\centering} + {\begin{center}\begin{lateximage}[-register-~\packagediagramname]} + {\typeout{Patch register success.}} + {\typeout{Patch register failure.}} + +\xpatchcmd{\endregister} + {\leftskip} + {% + \end{lateximage}\end{center}% + \leftskip% + }% + {\typeout{Patch endregister success.}} + {\typeout{Patch endregister failure.}} + +\setlength{\regWidth}{5in} +% \end{macrocode} + +% \iffalse +%</register> +% \fi +% +% +% % % \iffalse %<*relsize> @@ -44188,10 +45518,9 @@ class="td% % % \changes{v0.34}{2017/07/25}{\pkg{rotfloat}: Added.} % -% % \codehtml % \begin{macrocode} -\LWR@ProvidesPackageDrop{rotfloat} +\LWR@ProvidesPackageDrop{rotfloat}[2004/01/04] \RequirePackage{float} % \end{macrocode} @@ -44213,21 +45542,25 @@ class="td% }% {% \DeclareFloatingEnvironment[fileext=#3]{#1}% -% \end{macrocode} -% ^^A required:?? -% \begin{macrocode} - \DeclareFloatingEnvironment[fileext=#3]{sideways#1}% }% \csletcs{sideways#1}{#1}% \csletcs{endsideways#1}{end#1}% % \end{macrocode} +% Remember the float style: +% \changes{v0.57}{2018/05/14}{\pkg{rotfloat}: Added float styles.} +% \begin{macrocode} +\csedef{LWR@floatstyle@#1}{\LWR@floatstyle}% +\csedef{LWR@floatstyle@sideways#1}{\LWR@floatstyle}% +% \end{macrocode} % \pkg{newfloat} package automatically creates the \cs{listof} command % for new floats, but \pkg{float} does not, -% so remove \cs{listof} here in case it is manually created later. -% ^^A *8* keep the below? +% so remove \cs{listof} here in case it is manually created later: +% \changes{v0.57}{2018/05/14}{\pkg{rotfloat}: Fix for listof sideways floats.} % \begin{macrocode} \cslet{listof#1s}\relax% \cslet{listof#1es}\relax% +\cslet{listofsideways#1s}\relax% +\cslet{listofsideways#1es}\relax% } % \end{macrocode} % \end{macro} @@ -44433,12 +45766,12 @@ class="td% \DeclareDocumentCommand{\raggedfootnote}{}{} \DeclareDocumentCommand{\dictum}{o m}{ -\begin{LWR@BlockClassWP}{\LWR@origmbox{text-align:right}}{}{dictum} +\begin{LWR@BlockClassWP}{\LWR@print@mbox{text-align:right}}{}{dictum} #2 \IfValueT{#1} { \ifbool{FormatWP} - {\begin{BlockClass}[\LWR@origmbox{border-top:} 1px solid gray]{dictumauthor}} + {\begin{BlockClass}[\LWR@print@mbox{border-top:} 1px solid gray]{dictumauthor}} {\begin{BlockClass}{dictumauthor}} \dictumauthorformat{#1} \end{BlockClass} @@ -44478,15 +45811,15 @@ class="td% \ifblank{#2} { \begin{BlockClass}[ - \LWR@origmbox{margin-left:\LWR@printlength{\LWR@templengthtwo}} ; - \LWR@origmbox{margin-right:\LWR@printlength{\LWR@templengthtwo}} + \LWR@print@mbox{margin-left:\LWR@printlength{\LWR@templengthtwo}} ; + \LWR@print@mbox{margin-right:\LWR@printlength{\LWR@templengthtwo}} ]{addmargin} } { \setlength{\LWR@templengthone}{#2} \begin{BlockClass}[ - \LWR@origmbox{margin-left:\LWR@printlength{\LWR@templengthone}} ; - \LWR@origmbox{margin-right:\LWR@printlength{\LWR@templengthtwo}} + \LWR@print@mbox{margin-left:\LWR@printlength{\LWR@templengthone}} ; + \LWR@print@mbox{margin-right:\LWR@printlength{\LWR@templengthtwo}} ]{addmargin} } } @@ -45341,7 +46674,7 @@ class="td% \int_new:c { c__siunitx_math #1 _int } \group_begin:% lwarp \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@origmbox% lwarp + \LetLtxMacro\mbox\LWR@print@mbox% lwarp \hbox_set:Nn \l__siunitx_tmp_box { \ensuremath @@ -45359,7 +46692,7 @@ class="td% \cs_new_protected:Npn \__siunitx_combined_output:n #1 { \group_begin:% lwarp \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@origmbox% lwarp + \LetLtxMacro\mbox\LWR@print@mbox% lwarp \bool_if:NTF \l__siunitx_number_parse_bool { \tl_clear:N \l__siunitx_number_out_tl @@ -45468,7 +46801,7 @@ class="td% \leavevmode \group_begin:% lwarp \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@origmbox% lwarp + \LetLtxMacro\mbox\LWR@print@mbox% lwarp \bool_set_false:N \l__siunitx_font_set_bool \IfNoValueF {#1} { \keys_set:nn { siunitx } {#1} } @@ -45480,7 +46813,7 @@ class="td% \leavevmode \group_begin:% lwarp \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@origmbox% lwarp + \LetLtxMacro\mbox\LWR@print@mbox% lwarp \bool_set_false:N \l__siunitx_font_set_bool \IfNoValueF {#1} { \keys_set:nn { siunitx } {#1} } @@ -45491,7 +46824,7 @@ class="td% \RenewDocumentCommand \ang { o > { \SplitArgument { 2 } { ; } } m } { \group_begin:% lwarp \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@origmbox% lwarp + \LetLtxMacro\mbox\LWR@print@mbox% lwarp \IfNoValueF {#1} { \keys_set:nn { siunitx } {#1} } \__siunitx_angle_output:nnn #2 @@ -45502,7 +46835,7 @@ class="td% \leavevmode \group_begin:% lwarp \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@origmbox% lwarp + \LetLtxMacro\mbox\LWR@print@mbox% lwarp \bool_set_false:N \l__siunitx_font_set_bool \IfNoValueTF {#1} { \__siunitx_unit_output:nn {#2} { } } @@ -45519,7 +46852,7 @@ class="td% \leavevmode \group_begin:% lwarp \LetLtxMacro\@ensuredmath\LWR@origensuredmath% lwarp - \LetLtxMacro\mbox\LWR@origmbox% lwarp + \LetLtxMacro\mbox\LWR@print@mbox% lwarp \bool_set_false:N \l__siunitx_font_set_bool \IfNoValueTF {#1} { \__siunitx_range_unit:nnnn {#4} { } {#2} {#3} } @@ -47206,8 +48539,8 @@ class="td% % \tikz\ is placed inside an \SVG\ image, so use the original % meanings of the following: % \begin{macrocode} -\LetLtxMacro\pgfutil@minipage\LWR@origminipage -\let\pgfutil@endminipage\LWR@origendminipage +\LetLtxMacro\pgfutil@minipage\LWR@print@minipage +\let\pgfutil@endminipage\endLWR@print@minipage \let\pgfutil@raggedleft\LWR@origraggedleft \let\pgfutil@raggedright\LWR@origraggedright @@ -48966,6 +50299,51 @@ class="td% % % % +% \iffalse +%<*trimclip> +% \fi +% +% \part{lwarp-trimclip.sty} +% +% \section{trimclip} +% +% \DescribePackage{trimclip} +% \pkg{trimclip} is nullified. +% +% \changes{v0.57}{2018/05/26}{\pkg{trimclip}: Added.} +% +% \codehtml +% +% \begin{macrocode} +\LWR@ProvidesPackageDrop{trimclip} +% \end{macrocode} +% +% The third argument, the text, is not touched. +% This allows \cs{bgroup} / \cs{egroup}, and verbatim content. +% \begin{macrocode} +\csdef{trimbox}{\@ifstar\@gobble\@gobble} +\csletcs{trimbox*}{trimbox} +\def\endtrimbox{} +\csletcs{endtrimbox*}{endtrimbox} + +\csletcs{clipbox}{trimbox} +\csletcs{clipbox*}{trimbox} +\csletcs{endclipbox}{endtrimbox} +\csletcs{endclipbox*}{endtrimbox} + +\csletcs{marginbox}{trimbox} +\csletcs{marginbox*}{trimbox} +\csletcs{endmarginbox}{endtrimbox} +\csletcs{endmarginbox*}{endtrimbox} +% \end{macrocode} +% +% \iffalse +%</trimclip> +% \fi +% +% +% +% % % % \iffalse @@ -49561,6 +50939,56 @@ class="td% % % % \iffalse +%<*vowel> +% \fi +% +% \part{lwarp-vowel.sty} + +% \section{vowel} +% +% \credits{FUKUI Rei} +% +% \DescribePackage{vowel} +% \pkg{vowel} is patched for use by \pkg{lwarp}. +% +% This package has been tested with \prog{pdflatex} and the Type 1 TIPA fonts +% using the following package load sequence: +% \begin{sourcedisplay} +% \cs{usepackage}[T3,T1]\{fontenc\} \\ +% \cs{usepackage}[utf8]\{inputenc\} \\ +% \cs{usepackage}[noenc]\{tipa\} \\ +% \cs{usepackage}\{vowel\} +% \end{sourcedisplay} +% \bigskip +% +% \changes{v0.57}{2018/05/22}{\pkg{vowel}: Added.} +% +% \codehtml +% +% \begin{macrocode} +\LWR@ProvidesPackagePass{vowel} +% \end{macrocode} + +% \begin{macrocode} +\renewenvironment{vowel}[1][] + {% + \begin{lateximage}[(-vowel-~\packagediagramname)]% + \@vowel[#1]% + } + {% + \@@vowel% + \end{lateximage}% + } +% \end{macrocode} + +% \iffalse +%</vowel> +% \fi +% +% +% +% +% \iffalse %<*vwcol> % \fi % @@ -50022,7 +51450,7 @@ class="td% % \item [\cs{fcolorbox}:] \ % \begin{description} % \item [Print:] Modified to allow a background of |none|. \newline -% \cs{LWRprint@fcolorbox} at \cref{sec:xcolorpatches} +% \cs{LWR@print@fcolorbox} at \cref{sec:xcolorpatches} % \item [HTML:] Redefined by \pkg{lwarp-xcolor}, page \pageref{sec:fcolorbox}. % \item [HTML \env{lateximage}:] Remembers and reuses the print version. % \end{description} @@ -50038,7 +51466,7 @@ class="td% % \item [\env{fcolorminipage}:] \ % \begin{description} % \item [Print:] Newly defined in the \pkg{lwarp} core. \newline -% \env{LWRprint@fcolorminipage} at \cref{sec:xcolorpatches} +% \env{LWR@print@fcolorminipage} at \cref{sec:xcolorpatches} % \item [HTML:] Newly defined by \pkg{lwarp-xcolor}, page \pageref{sec:fcolorminipage}. % \item [HTML \env{lateximage}:] Uses the print version. % \end{description} @@ -50070,30 +51498,16 @@ class="td% % Remember the following print-mode actions to be restored % when inside a \env{lateximage} environment: % \begin{macrocode} -\LetLtxMacro\LWRprint@textcolor\textcolor -\LetLtxMacro\LWRprint@pagecolor\pagecolor -\LetLtxMacro\LWRprint@nopagecolor\nopagecolor -\LetLtxMacro\LWRprint@colorbox\colorbox -\LetLtxMacro\LWRprint@colorboxBlock\colorbox -% \end{macrocode} -% New print-mode versions of the following are also defined: -% \begin{macrocode} -\LetLtxMacro\LWRorigprint@fcolorbox\fcolorbox -\LetLtxMacro\LWRorigprint@fcolorboxBlock\fcolorbox -\LetLtxMacro\LWRorigprint@boxframe\boxframe +\LetLtxMacro\LWR@print@pagecolor\pagecolor +\LetLtxMacro\LWR@print@nopagecolor\nopagecolor % \end{macrocode} % -% % Inside a \env{lateximage} the following gets restored to their print-mode actions: % \margintag{\small\cs{LWR@restoreorigformatting}} % \begin{macrocode} \appto\LWR@restoreorigformatting{% -\LetLtxMacro\textcolor\LWRprint@textcolor% -\LetLtxMacro\pagecolor\LWRprint@pagecolor% -\LetLtxMacro\nopagecolor\LWRprint@nopagecolor% -\LetLtxMacro\colorbox\LWRprint@colorbox% -\LetLtxMacro\fcolorbox\LWRprint@fcolorbox% -\LetLtxMacro\boxframe\LWRorigprint@boxframe% +\LetLtxMacro\pagecolor\LWR@print@pagecolor% +\LetLtxMacro\nopagecolor\LWR@print@nopagecolor% } % \end{macrocode} % @@ -50211,8 +51625,10 @@ padding:\LWR@printlength{\fboxsep}% % \oarg{model} \marg{color} \marg{text} % % Converted into an \HTML\ hex color span. +% +% \changes{v0.57}{2018/06/02}{\pkg{xcolor}: New system for switching print and HTML outputs.} % \begin{macrocode} -\RenewDocumentCommand{\textcolor}{o m m}{% +\NewDocumentCommand{\LWR@HTML@textcolor}{o m m}{% \begingroup% % \end{macrocode} % Set the \PDF\ color, to be picked up by \SVG\ math if possible. @@ -50243,6 +51659,8 @@ padding:\LWR@printlength{\fboxsep}% }% \endgroup% } + +\LWR@formatted{textcolor} % \end{macrocode} % \end{macro} @@ -50271,8 +51689,9 @@ padding:\LWR@printlength{\fboxsep}% % % Converted into an \HTML\ hex background color \element{span}. % +% \changes{v0.57}{2018/06/02}{\pkg{xcolor}: New system for switching print and HTML outputs.} % \begin{macrocode} -\RenewDocumentCommand{\colorbox}{O{named} m +m}{% +\NewDocumentCommand{\LWR@HTML@colorbox}{O{named} m +m}{% \begingroup% \LWR@FBcancel% \InlineClass[% @@ -50281,6 +51700,10 @@ padding:\LWR@printlength{\fboxsep}% ]{colorbox}{#3}% \endgroup% } + +\AtBeginDocument{ +\LWR@formatted{colorbox} +} % \end{macrocode} % \end{macro} @@ -50289,8 +51712,9 @@ padding:\LWR@printlength{\fboxsep}% % % Converted into an \HTML\ hex background color \element{div}. % +% \changes{v0.57}{2018/06/02}{\pkg{xcolor}: New system for switching print and HTML outputs.} % \begin{macrocode} -\NewDocumentCommand{\colorboxBlock}{O{named} m +m}{% +\NewDocumentCommand{\LWR@HTML@colorboxBlock}{O{named} m +m}{% \begingroup% \LWR@FBcancel% \begin{BlockClass}[% @@ -50301,6 +51725,10 @@ padding:\LWR@printlength{\fboxsep}% \end{BlockClass}% \endgroup% } + +\AtBeginDocument{ +\LWR@formatted{colorboxBlock} +} % \end{macrocode} % \end{macro} @@ -50312,8 +51740,9 @@ padding:\LWR@printlength{\fboxsep}% % % A background color of |none| creates a colored frame without a background color. % +% \changes{v0.57}{2018/06/02}{\pkg{xcolor}: New system for switching print and HTML outputs.} % \begin{macrocode} -\RenewDocumentCommand{\fcolorbox}{O{named} m O{named} m +m}{% +\NewDocumentCommand{\LWR@HTML@fcolorbox}{O{named} m O{named} m +m}{% \LWR@traceinfo{HTML fcolorbox #2 #4}% \begingroup% \LWR@FBcancel% @@ -50332,6 +51761,10 @@ padding:\LWR@printlength{\fboxsep}% }% \endgroup% } + +\AtBeginDocument{ +\LWR@formatted{fcolorbox} +} % \end{macrocode} % \end{macro} @@ -50344,7 +51777,7 @@ padding:\LWR@printlength{\fboxsep}% % A background color of |none| creates a colored frame without a background color. % % \begin{macrocode} -\NewDocumentCommand{\fcolorboxBlock}{O{named} m O{named} m +m}{% +\NewDocumentCommand{\LWR@HTML@fcolorboxBlock}{O{named} m O{named} m +m}{% \LWR@traceinfo{HTML fcolorboxBlock #2 #4}% \begingroup% \LWR@FBcancel% @@ -50369,6 +51802,10 @@ padding:\LWR@printlength{\fboxsep}% \endgroup% \LWR@traceinfo{HTML fcolorboxBlock done}% } + +\AtBeginDocument{ +\LWR@formatted{fcolorboxBlock} +} % \end{macrocode} % \end{macro} @@ -50400,7 +51837,7 @@ width:\LWR@printlength{\LWR@tempwidth}% % \oarg{5:align} \oarg{6:height} \oarg{7:inner-align} \marg{8:width} % % \begin{macrocode} -\NewDocumentEnvironment{fcolorminipage}{O{named} m O{named} m O{c} o o m} +\NewDocumentEnvironment{LWR@HTML@fcolorminipage}{O{named} m O{named} m O{c} o o m} {% \LWR@FBcancel% \setlength{\LWR@tempwidth}{#8}% @@ -50415,6 +51852,10 @@ width:\LWR@printlength{\LWR@tempwidth}% }% } {\end{BlockClass}} + +\AtBeginDocument{ +\LWR@formattedenv{fcolorminipage} +} % \end{macrocode} % \end{environment} % @@ -50425,13 +51866,16 @@ width:\LWR@printlength{\LWR@tempwidth}% % % The depth is added to the height, but the box is not decended below % by the depth. \cs{textcolor} is honored. +% +% \changes{v0.57}{2018/06/02}{\pkg{xcolor}: Fix: Colored \cs{boxframe}.} % \begin{macrocode} -\renewcommand*{\boxframe}[3]{% +\newcommand*{\LWR@HTML@boxframe}[3]{% {% \setlength{\LWR@tempwidth}{#1}% \setlength{\LWR@tempheight}{#2}% \addtolength{\LWR@tempheight}{#3}% \LWR@forceminwidth{\fboxrule}% +\LWR@findcurrenttextcolor% \InlineClass[% display:inline-block ; % border:\LWR@printlength{\LWR@atleastonept} solid \LWR@currenttextcolor{} ; % @@ -50440,6 +51884,8 @@ height:\LWR@printlength{\LWR@tempheight}% ]{boxframe}{}% }% } + +\LWR@formatted{boxframe} % \end{macrocode} % \end{macro} % @@ -50537,6 +51983,66 @@ height:\LWR@printlength{\LWR@tempheight}% % % % +% \iffalse +%<*xellipsis> +% \fi +% +% \part{lwarp-xellipsis.sty} + +% \section{xellipsis} +% +% \credits{Donald P. Goodman III} +% +% \DescribePackage{xellipsis} +% \pkg{xellipsis} is patched for use by \pkg{lwarp}. +% +% When non-zero, each of the spaces is converted to an \HTML\ thin unbreakable space. +% +% \changes{v0.57}{2018/05/15}{\pkg{xellipsis}: Added.} +% +% \codehtml +% +% \begin{macrocode} +\LWR@ProvidesPackagePass{xellipsis} +% \end{macrocode} + +% \begin{macrocode} +\newcommand*{\LWR@xellipsespace}[1]{% +\ifdim#1=0pt\else% + \ifdim#1<\fontdimen2\font% + \,% + \else% + ~% + \fi% +\fi% +} + +\def\xelip{% +\mbox{% + \LWR@xellipsespace{\xelipprebef}% + \xelipprechar% + \LWR@xellipsespace{\xelippreaft}% + \LWR@xellipsespace{\xelipbef}% + \xelipchar% + \xel@loopi = 1% + \loop\ifnum\xelipnum>\xel@loopi% + \advance\xel@loopi by1% + \LWR@xellipsespace{\xelipgap}% + \xelipchar% + \repeat% + \LWR@xellipsespace{\xelipaft}% + \LWR@xellipsespace{\xelippostbef}% + \xelippostchar% + \LWR@xellipsespace{\xelippostaft}% +}% +}% +% \end{macrocode} + +% \iffalse +%</xellipsis> +% \fi +% +% % % % \iffalse @@ -50623,12 +52129,7 @@ height:\LWR@printlength{\LWR@tempheight}% \endLWR@nestspan% } % \end{macrocode} -% A nullified \cs{scalebox} command, to avoid introducing \HTML\ scaling tags: -% \margintag{\cs{scalebox}} -% \begin{macrocode} -\NewDocumentCommand{\LWR@noscalebox}{m o m}{#3} -% \end{macrocode} - +% % Instances of \pkg{xfrac} for various font choices: % \margintag{instances} % @@ -50640,17 +52141,18 @@ height:\LWR@printlength{\LWR@tempheight}% % \changes{v0.16}{2016/04/07}{\pkg{xfrac}: Adjusted for the use of any font:} % \changes{v0.48}{2018/02/13}{\pkg{xfrac}: Fix: Added groups around super/subscripts % to localize \env{LWR@nestspan} changes.} +% \changes{v0.57}{2018/06/01}{\pkg{xfrac}: Improved print/HTML \cs{scalebox} control.} % \begin{macrocode} \DeclareInstance{xfrac}{default}{text}{ numerator-format = {% \begingroup% -\LetLtxMacro{\scalebox}{\LWR@noscalebox}% +\RenewDocumentCommand{\scalebox}{m o m}{##3}% \LWR@htmlsmallfontstart\textsuperscript{#1}\,\LWR@htmlsmallfontend% \endgroup% }, denominator-format = {% \begingroup% -\LetLtxMacro{\scalebox}{\LWR@noscalebox}% +\RenewDocumentCommand{\scalebox}{m o m}{##3}% \LWR@htmlsmallfontstart{}\,#1\LWR@htmlsmallfontend% \endgroup% }, @@ -50663,13 +52165,13 @@ scaling = false \DeclareInstance{xfrac}{lmr}{text}{ numerator-format = {% \begingroup% -\LetLtxMacro{\scalebox}{\LWR@noscalebox}% +\RenewDocumentCommand{\scalebox}{m o m}{##3}% \LWR@htmlsmallfontstart\textsuperscript{#1}\,\LWR@htmlsmallfontend% \endgroup% }, denominator-format = {% \begingroup% -\LetLtxMacro{\scalebox}{\LWR@noscalebox}% +\RenewDocumentCommand{\scalebox}{m o m}{##3}% \LWR@htmlsmallfontstart{}\,#1\LWR@htmlsmallfontend% \endgroup% }, @@ -50682,13 +52184,13 @@ scaling = false \DeclareInstance{xfrac}{lmss}{text}{ numerator-format = {% \begingroup% -\LetLtxMacro{\scalebox}{\LWR@noscalebox}% +\RenewDocumentCommand{\scalebox}{m o m}{##3}% \LWR@htmlsmallfontstart\textsuperscript{#1}\,\LWR@htmlsmallfontend% \endgroup% }, denominator-format = {% \begingroup% -\LetLtxMacro{\scalebox}{\LWR@noscalebox}% +\RenewDocumentCommand{\scalebox}{m o m}{##3}% \LWR@htmlsmallfontstart{}\,#1\LWR@htmlsmallfontend% \endgroup% }, @@ -50701,13 +52203,13 @@ scaling = false \DeclareInstance{xfrac}{lmtt}{text}{ numerator-format = {% \begingroup% -\LetLtxMacro{\scalebox}{\LWR@noscalebox}% +\RenewDocumentCommand{\scalebox}{m o m}{##3}% \LWR@htmlsmallfontstart\textsuperscript{#1}\,\LWR@htmlsmallfontend% \endgroup% }, denominator-format = {% \begingroup% -\LetLtxMacro{\scalebox}{\LWR@noscalebox}% +\RenewDocumentCommand{\scalebox}{m o m}{##3}% \LWR@htmlsmallfontstart{}\,#1\LWR@htmlsmallfontend% \endgroup% }, @@ -50735,6 +52237,53 @@ scaling = false % % % +% +% \iffalse +%<*xltabular> +% \fi + +% \part{lwarp-xltabular.sty} + +% \section{xltabular} +% +% \credits{Rolf Niepraschk, Herbert Voß} +% +% \DescribePackage{xltabular} +% \pkg{xltabular} is emulated by \pkg{lwarp}. +% +% \changes{v0.57}{2018/05/25}{\pkg{xltabular}: Added.} +% +% \codehtml +% +% Relies on \pkg{tabularx}. +% +% At present, an \env{xltabular} without a caption or with only a \cs{caption*} +% \watchout[table numbering] +% may be misnumbered in \HTML, so it may be necessary to place at the end +% of the table: +% \begin{sourcedisplay} +% \cs{warpHTMLonly}\{\cs{addtocounter}\{table\}\{-1\}\} +% \end{sourcedisplay} +% +% \begin{macrocode} +\RequirePackage{tabularx} + +\LWR@ProvidesPackageDrop{xltabular} + +\DeclareDocumentEnvironment{xltabular}{o m m} +{\longtable{#3}} +{\endlongtable} +% \end{macrocode} +% +% +% \iffalse +%</xltabular> +% \fi +% +% +% +% +% % \iffalse %<*xltxtra> % \fi @@ -50821,6 +52370,53 @@ scaling = false % % % +% \iffalse +%<*xpiano> +% \fi +% +% \part{lwarp-xpiano.sty} + +% \section{xpiano} +% +% \credits{Enrico Gregorio} +% +% \DescribePackage{xpiano} +% \pkg{xpiano} is patched for use by \pkg{lwarp}. +% +% \changes{v0.57}{2018/06/03}{\pkg{xpiano}: Added.} +% +% \codehtml +% +% \begin{macrocode} +\LWR@ProvidesPackagePass{xpiano} +% \end{macrocode} + +% \begin{macrocode} +\ExplSyntaxOn +\NewDocumentCommand{\LWR@print@keyboard}{ O{}m } +{ +\xpiano_keyboard:nn { #1 } { #2 } +} + +\NewDocumentCommand{\LWR@HTML@keyboard}{ O{}m } +{ +\begin{lateximage}* + [-xpiano-~\packagediagramname{}: \detokenize\expandafter{#2}] + [\detokenize\expandafter{#1}] +\xpiano_keyboard:nn { #1 } { #2 } +\end{lateximage} +} +\ExplSyntaxOff + +\LWR@formatted{keyboard} +% \end{macrocode} + +% \iffalse +%</xpiano> +% \fi +% +% +% % % % \iffalse @@ -50974,14 +52570,14 @@ scaling = false % \begin{macrocode} \AtBeginDocument{ -\preto{\xy}{\begin{lateximage}[(xy)]} +\preto{\xy}{\begin{lateximage}[(-xy-~\packagediagramname)]} \appto{\endxy}{\end{lateximage}} \@ifundefined{xymatrix}{}{ \LetLtxMacro\LWR@origxymatrix\xymatrix \renewcommand{\xymatrix}[1]{% -\begin{lateximage}[(xymatrix)] +\begin{lateximage}[(-xy- xymatrix \packagediagramname)] \LWR@origxymatrix{#1} \end{lateximage} } @@ -50991,7 +52587,7 @@ scaling = false \LetLtxMacro\LWR@origxygraph\xygraph \renewcommand{\xygraph}[1]{% -\begin{lateximage}[(xygraph)] +\begin{lateximage}[(-xy- xygraph \packagediagramname)] \LWR@origxygraph{#1} \end{lateximage} } |