texlive[46416] trunk: lwarp (23jan18)

commits+karl at tug.org commits+karl at tug.org
Tue Jan 23 23:34:46 CET 2018


Revision: 46416
          http://tug.org/svn/texlive?view=revision&revision=46416
Author:   karl
Date:     2018-01-23 23:34:45 +0100 (Tue, 23 Jan 2018)
Log Message:
-----------
lwarp (23jan18)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua
    trunk/Master/texmf-dist/doc/latex/lwarp/README.txt
    trunk/Master/texmf-dist/doc/latex/lwarp/lwarp.pdf
    trunk/Master/texmf-dist/scripts/lwarp/lwarpmk.lua
    trunk/Master/texmf-dist/source/latex/lwarp/lwarp.dtx
    trunk/Master/texmf-dist/source/latex/lwarp/lwarp.ins
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-abstract.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-amsthm.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-breakurl.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-changepage.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-epigraph.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-float.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-floatrow.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-footnote.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-framed.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-moreverb.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-multirow.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-needspace.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-nextpage.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-rotfloat.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfig.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-supertabular.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tabularx.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-theorem.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-titleref.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-titling.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tocbibind.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tocloft.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xfrac.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xtab.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-array.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-backref.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-changebar.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-cite.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-continue.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-endfloat.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-flafter.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fltrace.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-footnpag.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fwlw.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hanging.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-memhfixc.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-midpage.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-natbib.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pagesel.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-memoir.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-prettyref.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfigure.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-textfit.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-turnthepage.sty

Modified: trunk/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua	2018-01-23 22:34:45 UTC (rev 46416)
@@ -1,10 +1,10 @@
 #!/usr/bin/env texlua
 
--- Copyright 2016-2017 Brian Dunn
+-- Copyright 2016-2018 Brian Dunn
 
 -- Print the usage of the lwarpmk command:
 
-printversion = "v0.44"
+printversion = "v0.46"
 
 function printhelp ()
 print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;

Modified: trunk/Master/texmf-dist/doc/latex/lwarp/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/lwarp/README.txt	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/doc/latex/lwarp/README.txt	2018-01-23 22:34:45 UTC (rev 46416)
@@ -1,5 +1,5 @@
 
-LaTeX lwarp package v0.44   README.txt
+LaTeX lwarp package v0.46   README.txt
 
 Files included are:
 
@@ -38,7 +38,7 @@
 version 2005/12/01 or later.
 
 
-Copyright 2016-2017 Brian Dunn
+Copyright 2016-2018 Brian Dunn
 
 Homepage: http://BDTechConcepts.com
 Email: bd at BDTechConcepts.com

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

Modified: trunk/Master/texmf-dist/scripts/lwarp/lwarpmk.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/lwarp/lwarpmk.lua	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/scripts/lwarp/lwarpmk.lua	2018-01-23 22:34:45 UTC (rev 46416)
@@ -1,10 +1,10 @@
 #!/usr/bin/env texlua
 
--- Copyright 2016-2017 Brian Dunn
+-- Copyright 2016-2018 Brian Dunn
 
 -- Print the usage of the lwarpmk command:
 
-printversion = "v0.44"
+printversion = "v0.46"
 
 function printhelp ()
 print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;

Modified: trunk/Master/texmf-dist/source/latex/lwarp/lwarp.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/lwarp/lwarp.dtx	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/source/latex/lwarp/lwarp.dtx	2018-01-23 22:34:45 UTC (rev 46416)
@@ -1,7 +1,7 @@
 %
 % \iffalse meta-comment
 %
-% Copyright 2016-2017 Brian Dunn
+% Copyright 2016-2018 Brian Dunn
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -16,7 +16,7 @@
 % \iffalse
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{lwarp}
-%<package>    [2017/11/22 v0.44  Allows LaTeX to directly produce HTML5 output.]
+%<package>    [2018/01/23 v0.46  Allows LaTeX to directly produce HTML5 output.]
 %
 %<*driver>
 \documentclass{ltxdoc}
@@ -163,6 +163,18 @@
 
 \usepackage{dtxdescribe}
 
+
+\DeclareRobustCommand{\thinskip}{\hskip 0.16667em\relax}
+\def\endash{–}
+\def\emdash{—}
+% \def\d at sh#1#2{\unskip#1\thinskip#2\thinskip\ignorespaces}
+% \def\dash{\d at sh\nobreak\endash}
+% \def\Dash{\d at sh\nobreak\emdash}
+\newcommand{\thinbrspace}{\hspace{.16667em}\penalty\exhyphenpenalty\hspace{0pt}}
+\newrobustcmd{\Dash}{\unskip\thinspace\textemdash\thinbrspace}
+\newrobustcmd{\dash}{\unskip\thinspace\mbox{--}\thinbrspace}
+
+
 \newcommand{\ItemDescribeMacro}[1]{%
 \item[\cmd{#1}:]%
 \setlength{\parskip}{1.5ex}%
@@ -232,6 +244,25 @@
 }}
 
 
+\pdfstringdefDisableCommands{
+\def\quad{ }
+\def\\{ }
+\def\pkg#1{#1}
+\def\cs#1{\textbackslash#1}
+\def\env#1{#1}
+\def\,{ }
+\def\prog#1{#1}
+\def\LuaLaTeX{LuaLaTeX}
+\def\XeLaTeX{XeLaTeX}
+\def\TeX{TeX}
+\def\LaTeX{LaTeX}
+\def\Dash{ --- }
+\def\dash{ -- }
+\def\element#1{#1}
+\def\attribute#1{#1}
+}
+
+
 \usepackage{cleveref}
 
 
@@ -239,10 +270,12 @@
 \renewcommand*{\thepart}{\arabic{part}}
 
 
-\newrobustcmd{\lmacro}[1]{\textbackslash#1}
-\newrobustcmd{\cmds}[1]{\texttt{#1}}
-\newrobustcmd{\env}[1]{\texttt{#1}}
-\newrobustcmd{\pkg}[1]{\textsf{#1}}
+\providerobustcmd*{\lmacro}[1]{\textbackslash#1}
+\providerobustcmd*{\cmds}[1]{\texttt{#1}}
+\providerobustcmd*{\env}[1]{\texttt{#1}}
+\providerobustcmd*{\ctr}[1]{\texttt{#1}}
+\providerobustcmd*{\pkg}[1]{\textsf{#1}}
+\providerobustcmd*{\prog}[1]{\texttt{#1}}
 \newrobustcmd{\acro}[1]{\textsc{\lowercase{#1}}}
 \newrobustcmd{\element}[1]{\texttt{<#1>}}
 \newrobustcmd{\attribute}[1]{\texttt{#1}}
@@ -266,6 +299,12 @@
 \newrobustcmd{\CTAN}{\acro{CTAN}}
 \newrobustcmd{\TDS}{\acro{TDS}}
 
+\newcommand{\spslash}{\unskip\kern.085em/\hspace{.085em}\penalty\exhyphenpenalty\hspace{0pt}}
+
+\makeatletter
+\newcommand*{\rulebreak}{\bigskip\hfill\rule[.7ex]{.3\linewidth}{.4pt}\hspace*{\fill}\bigskip\@afterheading}
+\makeatother
+
 \newcommand{\DescribeDefault}[1]{\margintag{\footnotesize \textcolor{green!50!black}{Default: \texttt{#1}}}}
 
 \newcommand{\goesto}{$\Rightarrow$}
@@ -276,7 +315,7 @@
 \newcommand{\codeprint}{\leavevmode\marginpar{\footnotesize\raggedleft\textcolor{codecolor}{\textbf{for PRINT output:~}}}\vspace{-5.25ex}}
 \newcommand{\codeall}{\leavevmode\marginpar{\footnotesize\raggedleft\textcolor{codecolor}{\textbf{for HTML \& PRINT:~}}}\vspace{-5.25ex}}
 
-\newcommand*{\testthis}{\textcolor{blue}{Please send bug reports!}\watchout[Not yet tested!]}
+\newcommand*{\testthis}{\textcolor{blue}{Please send bug reports!}\watchout[Not fully tested!]}
 
 \newcommand{\userentry}[1]{%
 \par
@@ -405,6 +444,10 @@
 same time as \pkg{hyperref}, since they both define the \cs{url} command.
 \pkg{lwarp} does not (yet) attempt to convert \pkg{url} links into hyperlinks
 during \HTML\ output, nor does \pkg{url} create hyperlinks during print output.
+
+When generating \HTML, \pkg{lwarp}'s emulation of \pkg{hyperref} does not
+\watchout[backref]
+automatically load \pkg{backref}, so \pkg{backref} must be loaded explicitly.
 }
 
 \newcommand{\limitsabstract}{%
@@ -515,6 +558,7 @@
     \cs{printindex}
     \end{sourcedisplay}
 
+\needspace{3\baselineskip}
 \item [On its own \HTML\ page, with a manual TOC entry:] \
     \begin{sourcedisplay}
     \cs{begin}\{warpprint\} \\
@@ -653,8 +697,7 @@
 \newcommand{\limitsreferences}{%
 Labels with special characters may be a problem.
 \margintag{labels}
-It is best to stick with alpha-numeric, hyphen, and perhaps the colon (if not French).
-The underscore currently does not yet work when generating math for MathJax.
+It is best to stick with alpha-numeric, hyphen, underscore, and perhaps the colon (if not French).
 \watchout[underscores]
 
 \cs{nameref} refers to the most recently-used section where the \cs{label}
@@ -694,6 +737,41 @@
 Please contact the author with any bug reports.
 }
 
+\newcommand{\limitsmemoir}{
+While emulating \pkg{memoir}, \pkg{lwarp} pre-loads
+a number of packages (\cref{sec:patch-memoir-packages}).
+This can cause an options clash when the user's document later loads the same
+\watchout[options clash]
+packages with options.  To fix this problem, specify the options before
+loading \pkg{lwarp}:
+\begin{sourcedisplay}
+\cs{documentclass}\{memoir\} \\
+\dots \\
+\cs{PassOptionsToPackage}\{options\_list\}\{package\_name\} \\
+\dots \\
+\cs{usepackage\{lwarp\}} \\
+\dots \\
+\cs{usepackage\{package\_name\}}
+\end{sourcedisplay}
+
+\cs{verbfootnote} is not supported.
+
+\cs{newfootnoteseries}, etc. are not supported.
+
+\pkg{lwarp} loads \pkg{pagenote} to perform \pkg{memoir}'s pagenote functions,
+but there are minor differences in \cs{pagenotesubhead} and related macros.
+
+Poem numbering is not supported.
+
+The \env{verbatim} environment does not yet support the \pkg{memoir} enhancements.
+It is currently recommended to load and use \pkg{fancyvrb} instead.
+
+The \pkg{memoir} glossary system is not yet supported by \texttt{lwarpmk}.
+The \pkg{glossaries} package may be used instead,
+but does require the glossary entries be
+changed from the \pkg{memoir} syntax to the \pkg{glossaries} syntax.
+}
+
 \newcommand{\limitsverse}{%
 \DescribeMacro{\attrib}
 The documentation for the \pkg{verse} and \pkg{memoir} packages suggest
@@ -727,6 +805,7 @@
 The default is wide enough for a stanza number.
 
 Horizontal spacing relies on \texttt{pdftotext}'s ability to discern the layout
+\watchout[spacing]
 (\texttt{-layout} option) of the
 text in the \HTML-tagged \PDF\ output.  For some settings of
 \cs{HTMLleftmargini} or \cs{HTMLleftskip} the horizontal alignment may not work out
@@ -870,6 +949,11 @@
 
     Also see \cref{sec:limitssiunitx}.
 
+\item A \env{tabbing} environment is emulated
+    using an \HTML\ \element{pre}.\margintag{tabbing}
+    While MathJax is enabled inside \env{tabbing}, the browser may not correctly
+    render the horizontal alignment of the math and text following after on the same line.
+
 \item Other math-related macros and packages are not supported by MathJax,
     \watchout[other macros and packages]
     including \cs{ensuremath}, \pkg{bigdelim}, \pkg{units}, and \pkg{nicefrac},
@@ -922,6 +1006,9 @@
 
 \newcommand{\limitsgraphics}{%
 For \cs{includegraphics} with \texttt{.pdf} files,
+\index{graphics>PDF files}
+\index{PDF images}
+\index{images>PDF}
 \watchout[\texttt{.pdf} image files]
 the user should provide a \texttt{.pdf} image file, and also
 a \texttt{.svg}, \texttt{.png}, or \texttt{.jpg} version of the same image.
@@ -934,12 +1021,24 @@
 other some other format otherwise.
 For \HTML, one of the other formats is used instead.
 
-If a \texttt{.pdf} file is explicitly referred to with its file extension,
+\DescribeProgram{pdftocairo}
+To convert a \PDF\ image to \SVG, use the utility \texttt{pdftocairo}:\userentry{
+pdftocairo -svg filename.pdf
+}
+
+If a \texttt{.pdf} file is referred to with its file extension,
 a link to the \texttt{.pdf} file will appear in the \HTML\ output.
 \begin{sourcedisplay}
 \cs{includegraphics}\{filename.pdf\} \% creates a link in HTML
 \end{sourcedisplay}
 
+\DescribePackage{epstopdf}
+For \texttt{.eps} files, use \pkg{epstopdf} to provide a \PDF\ version,
+and also provide a \SVG\ version as well.
+\index{graphics>EPS files}
+\index{EPS images}
+\index{images>EPS}
+
 For \texttt{.png}, \texttt{.jpg}, or \texttt{.gif} image files,
 \margintag{other image files}
 the same file may be used in
@@ -1062,6 +1161,14 @@
 \margintag{\cs{color} and \cs{pagecolor}}
 }
 
+\newcommand{\limitsepstopdf}{%
+When using \pkg{epstopdf} to convert images to \PDF,
+use the \texttt{pdftocairo} utility to also provide an \SVG\ version as well.
+In the document, refer to the image filename without a suffix.  The
+\PDF\ version will be used in print output, and the \SVG\ version will
+be used for \HTML.
+}
+
 \newcommand{\limitsoverpic}{%
 The macros \cs{overpicfontsize} and \cs{overpicfontskip} are used during
 \watchout[scaling]
@@ -1071,6 +1178,11 @@
 environments.
 }
 
+\newcommand{\limitstabbing}{%
+The \env{tabbing} environment works, except that \SVG\ math and \env{lateximage}s
+do not yet work inside the environment.
+}
+
 \newcommand{\limitstabular}{%
 Tabular mostly works as expected, but pay special attention to the
 following, especially if working with environments, macros inside tabulars,
@@ -1093,6 +1205,9 @@
         <define macros or environments using \env{tabular} and \texttt{\&} here> \\
         \textcolor{red}{\cs{EndDefiningTabulars}}
         \end{sourcedisplay}
+        This includes before and after defining any macro
+        \watchout[floatrow]
+        which used \cs{ttabbox} from \pkg{floatrow}.
     \item \limitsresumetabular
     \end{itemize}
 
@@ -1204,6 +1319,7 @@
         Keep the \cs{endfirsthead} row unchanged, as it is still relevent to \HTML\ output.
     \end{itemize}
 
+\needspace{3\baselineskip}
 \item[Other:] \
     \begin{itemize}
     \item \pkg{tabularx} ignores the width, but \texttt{X} columns do produce paragraph
@@ -1561,6 +1677,11 @@
 }
 
 \newcommand{\limitsfloatrow}{%
+Use \cs{StartDefiningTabulars} and \cs{EndDefiningTabulars} before and after
+\watchout[misplaced alignment alignment tab character \&]
+defining macros using \cs{ttabbox} with a tabular inside.
+See \cref{sec:limitstabular}.
+
 When combined with the \pkg{subfig} package,
 \watchout[\pkg{subfig} package]
 while inside a \env{subfloatrow} \cs{ffigbox} and \cs{ttabbox}
@@ -1679,6 +1800,14 @@
 \bigskip
 }
 
+\newcommand{\limitsxparse}{%
+To remove from the log any warnings about redeclaring objects,
+place the following before \pkg{lwarp} is loaded:
+\begin{sourcedisplay}
+\cs{usepackage}[log-declarations=false]\{xparse\}
+\end{sourcedisplay}
+}
+
 \newcommand{\limitsnewtxmath}{%
 The proper load order is:
 \watchout[loading sequence]
@@ -1714,8 +1843,6 @@
 
 \setlength{\marginparsep}{1em}
 \setlength{\marginparpush}{.7ex}
-\setlength{\parindent}{0em}
-\setlength{\parskip}{2ex}
 \setlength{\IndexMin}{40ex}
 
 
@@ -1736,7 +1863,7 @@
 %<*package>
 % \fi
 %
-% \CheckSum{16359}
+% \CheckSum{19275}
 %
 % \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
@@ -1822,6 +1949,8 @@
 % \changes{v0.42}{2017/10/30}{\ 2017/10/30}
 % \changes{v0.43}{2017/11/08}{\ 2017/11/08}
 % \changes{v0.44}{2017/11/22}{\ 2017/11/22}
+% \changes{v0.45}{2018/01/14}{\ 2018/01/14}
+% \changes{v0.46}{2018/01/23}{\ 2018/01/23}
 
 
 
@@ -1852,13 +1981,13 @@
 %
 % \bigskip
 %
-% {\small\textcopyright{} 2016--2017} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}
+% {\small\textcopyright{} 2016--2018} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}
 %
 % 
 % ^^A % \title{The \pkg{lwarp} package\thanks{This document
 % ^^A %   corresponds to \pkg{lwarp}~\fileversion,
 % ^^A %   dated \filedate.}}
-% ^^A % \author{{\small\textcopyright{} 2016--2017} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}}
+% ^^A % \author{{\small\textcopyright{} 2016--2018} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}}
 % ^^A % \published{}
 % ^^A % \subtitle{\textup{\LaTeX{} to HTML5}}
 % ^^A %
@@ -1883,7 +2012,7 @@
 %
 % A modular package-loading system uses the \pkg{lwarp} version of a package for
 % \HTML\ when available.
-% Almost two hundred \LaTeX\ packages are supported with these high-level source
+% More than two hundred \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
@@ -1933,22 +2062,27 @@
 % \clearpage
 % 
 % \section{Supporting \protect\TeX\ development}
+% \label{sec:supportinglatex}
 % \changes{v0.42}{2017/10/30}{Docs: Added support page.}
 % 
-% \TeX\ development:
+% \begingroup
+% \setlength{\parindent}{0em}
+% \setlength{\parskip}{2ex}
+%
+% \TeX\ and related projects:
 % \begin{itemize}[nosep]
-% \item is mostly open-sourced and a volunteer effort;
-% \item benefits students, academics, scientists, engineers, and businesses;
-% \item helps drive education, public and private research, and commercial activity;
-% \item is used in the fields of mathematics, science, engineering, and the humanities;
-% \item spans decades of development;
-% \item is enduring --- many older packages are still actively used and maintained;
-% \item is largely backwards compatible;
-% \item is portable across all the major computing platforms;
-% \item is usable even on older computers and away from internet access;
-% \item requires no yearly subscription fees;
-% \item is supported by an active community of knowledgeable volunteers;
-% \item and is continuing to maintain relevance with modern improvements.
+% \item are mostly open-sourced and a volunteer effort;
+% \item benefit students, academics, scientists, engineers, and businesses;
+% \item help drive education, public and private research, and commercial activity;
+% \item are used in the fields of mathematics, science, engineering, and humanities;
+% \item span decades of development;
+% \item are enduring --- many older packages are still actively used and maintained;
+% \item are largely backwards compatible;
+% \item are portable across all the major computing platforms;
+% \item are usable even on older computers and away from internet access;
+% \item are continuing to maintain relevance with modern improvements;
+% \item require no yearly subscription fees;
+% \item and are supported by an active community of knowledgeable volunteers.
 % \end{itemize}
 % 
 % Please consider helping by joining and/or contributing to the \TeX\ Users Group,
@@ -1982,6 +2116,8 @@
 % For country-specific \TeX\ users groups: \hfill
 % \href{http://tug.org/usergroups.html}{\texttt{http://tug.org/usergroups.html}}
 %
+% \endgroup
+%
 % \clearpage
 %
 %
@@ -2006,6 +2142,43 @@
 % For a detailed list of changes, see the Change History on page \pageref{sec:changehistory}.
 %
 % \begin{description}
+% \item[v0.46:] \
+%   \begin{itemize}
+%       \item \cs{PrintStack} changed to \cs{LWRPrintStack}.\watchout[name change]
+%       \item Fix: Empty lines between \env{tabular} rows.\margintag{misc. fixes}
+%       \item Fix: Stack unnesting.
+%       \item Fix: SVG math and \env{lateximage}s in numerous situations
+%               (but still more to do).
+%       \item Fix: Spaces in \cs{usepackage}.
+%       \item Fix: Now allows MathJax inside \env{verse}.
+%   \end{itemize}
+% \item[v0.45:] \
+%   \begin{itemize}
+%       \item Improved MikTeX install instructions.\margintag{docs}
+%       \item Improved graphics and \pkg{epstopdf} instructions.
+%       \item Updates to the \nameref{sec:introduction}.
+%       \item Added \pkg{memoir}, \pkg{memhfixc}.
+%               See \cref{sec:limitsmemoir}.\margintag{memoir}
+%       \item Fix: Now allows underscores in labels.\margintag{cross-references}
+%       \item Fix: \cs{\_} and |\<blank>| in section/file names.
+%       \item Fix: Now allows MathJax inside \env{tabbing}.\margintag{math}
+%       \item Fix: Bibliography \cs{em} names.\margintag{bibliography}
+%       \item Added \pkg{cite}, \pkg{natbib}, \pkg{backref}.
+%               (Also works as-is with \pkg{biblatex}.)
+%       \item Fix: Empty lines between \env{tabular} rows.\margintag{misc. fixes}
+%       \item Fix: ``Improper \cs{prevdepth}'' with minipages, lists.
+%       \item Fix: Incorrect \SVG\ math and |lateximage|s with \pkg{subfig}.
+%       \item Fix: Lateximages from incorrect pages with Mathjax.
+%       \item Fix: Missing sidetoc if using \pkg{listings}.
+%       \item Fix: Added an \pkg{array} emulation package.
+%       \item Added
+%           \pkg{subfigure}, \pkg{prettyref}, \margintag{packages}
+%           \pkg{hanging}, \pkg{midpage},
+%           \pkg{flafter}, \pkg{fltrace}, \pkg{changebar}, \pkg{endfloat},
+%           \pkg{continue}, \pkg{fwlw}, \pkg{turnthepage}, \pkg{footnpag},
+%           \pkg{pagesel}, \pkg{textfit}, \pkg{titleref}.
+%   \end{itemize}
+% \needspace{2\baselineskip}
 % \item[v0.44:] \
 %   \begin{itemize}
 %       \item Added \pkg{koma-script} classes (except \pkg{scrlttr2}, \pkg{scrjura}).
@@ -2035,6 +2208,7 @@
 %       \item Added \pkg{preview}, \pkg{atbegshi}, \pkg{watermark}.
 %       \item Improved \pkg{tocloft} \cs{newlistof} and \cs{newlistentry}.
 %   \end{itemize}
+% \needspace{2\baselineskip}
 % \item[v0.43:] \
 %   \begin{itemize}
 %       \item Docs: Reorganized \HTML\ customization, added an \HTML\ settings table.
@@ -2063,7 +2237,8 @@
 % \needspace{2\baselineskip}
 % \item[v0.42:] \
 %   \begin{itemize}
-%       \item Added \TeX\ development support page.\margintag{Support \TeX!}
+%       \item Added \TeX\ development support page,
+%           \nameref{sec:supportinglatex}.\margintag{Support \TeX!}
 %       \item Improved assitance for word-processor conversions when
 %           \margintag{word-processor conversion}
 %           boolean |FormatWP| is set |true|.
@@ -2601,11 +2776,13 @@
 % \clearpage
 %
 % \section{Introduction}
+% \label{sec:introduction}
 % \changes{v0.19}{2016/05/25}{Introduction: MathJax support mentioned.}
 %
 % The \pkg{lwarp} project aims to allow a rich \LaTeX{} document
-% to be converted to a reasonable \HTML\
-% interpretation.  No attempt has been made to force \LaTeX{} to provide for every
+% to be converted to a reasonable \HTMLfive\
+% interpretation, with only minor intervention on the user's part.
+% No attempt has been made to force \LaTeX{} to provide for every
 % \HTML-related possibility, and \HTML\ cannot exactly render every possible \LaTeX{} concept.
 % Where compromise is necessary, it is desirable to allow the print output to remain
 % typographically rich, and compromise only in the \HTML\ conversion.
@@ -2613,21 +2790,58 @@
 % Several ``modern'' features of \HTMLfive, \CSSthree, and \SVG\
 % are employed to allow a fairly feature-rich document
 % without relying on the use of Javascript.
-% Limited testing on older browsers show that these new features
-% degrade gracefully, although the \SVG\ format
-% for math may not be available on small cell phones.
+% Limited testing on older browsers shows that these new features
+% degrade gracefully.
 %
-% |pdflatex|, |xelatex|, or |lualatex| is used, allowing \pkg{lwarp} to process the usual image formats.
-% While generating \HTML\ output, \SVG\ files are used in placed of \PDF.
+% \rulebreak
+%
+% \pkg{lwarp} is a native \LaTeX\ package, and operates by either patching or
+% emulating various functions.  Source-level compatibility is a major goal, but
+% occasional user intervention is required in certain cases.
+%
+% As a package running directly in \LaTeX, \pkg{lwarp} has some advantages over
+% other methods of \HTML\ conversion.  A deeper level of \TeX\ understanding is
+% of course possible, as \TeX\ itself is still in use.
+% Lua expressions are still available with \LuaTeX.
+% Entire categories of
+% \LaTeX\ packages work as-is when used with \pkg{lwarp}: definitions, file handling,
+% utilities, internal data structures and calculations,
+% and anything generating plain-text output.
+% Blocks of \PDF\ output may be automatically converted to \SVG\ images
+% while using the same font and spacing as the original print document,
+% directly supporting \tikz\ and \env{picture},
+% Numerous packages are easily adapted for \HTML\ versions, either
+% by loading and patching the originals, or by creating nullified or emulated
+% replacements, and all without resorting to external programming.
+% As a result, several hundred packages have already been adapted (\cref{tab:supported}), and
+% an uncounted number more work as-is.
+%
+% Packages have been selected according to several criteria: importance,
+% popularity lists, recent CTAN updates, CTAN topics, mention in other packages, support by other
+% \HTML\ conversion methods,
+% and from sample documents taken from public archives\footnote{An amazing number of
+% decades-old packages are still in modern use.}.
+%
+% \rulebreak
+%
+% Assistance is also provide for modifying the \HTML\ output to suit the creation
+% of \EPUB\ documents, and for modifying the \HTML\ output to ease import into
+% a word processor.
+%
+% \rulebreak
+%
+% |pdflatex|, |xelatex|, or |lualatex| may be used,
+% allowing \pkg{lwarp} to process the usual image formats.
+% While generating \HTML\ output, \SVG\ files are used in place of \PDF.
 % Other formats such as \JPG\ are used as-is.
 %
-% \SVG\ images may be used for math,
-% and are also used for \env{picture}, and \tikz{} environments,
-% as this format has
-% better browser and e-book support than \MathML\ (as of this writing),
-% while still allowing for the high-quality display and printing of images (again, subject to potentially
-% bug-ridden\footnote{Firefox has had an on-again/off-again bug for quite some time regareding
-% printing \SVG{}s at high resolution.} browser
+% SVG images may be used for math,
+% and are also used for \env{picture}, and \tikz{} environments.
+% This format has better browser and e-book support than \MathML\ (as of this writing),
+% while still allowing for high-quality display and printing of images
+% (again, subject to potentially
+% bug-ridden\footnote{Firefox has had an on-again/off-again bug
+% for quite some time regareding printing \SVG{}s at high resolution.} browser
 % support).
 %
 % Furthermore, \SVG\ images allow math to be presented with
@@ -2643,14 +2857,15 @@
 % for math display instead of using \SVG\ images.
 % Subject to browser support and Internet access,
 % MathJax allows an \HTML\ page to display
-% math without relying on a large number of external image files,
-% one per math expression.  \pkg{lwarp} maintains \LaTeX\ control for cross-referencing
-% and equation numbering\,/\,formatting.
+% math without relying on a large number of external image files.\footnote{One \SVG\ image
+% file per math expression.  A commmon scientific paper can easily run into several thousand
+% files, depending on how often something like \$x\$ is used.
+% In testing one sample document it appears that hashing would only reduce the number in half.}
+% \pkg{lwarp} maintains \LaTeX\ control for cross-referencing
+% and equation numbering, and attempts to force MathJax to tag equations accordingly.
 %
-% \hfill\rule[.7ex]{.3\linewidth}{.4pt}\hspace*{\fill}
+% \rulebreak
 %
-% The \pkg{lwarp} package allows \LaTeX{} to directly generate \HTMLfive\ tags from a \LaTeX{}
-% source document, with only minor intervention on the user's part.
 % A |texlua| program called |lwarpmk| is used to process either the print or \HTML\
 % version of the document.  A few external utility programs are used to finish
 % the conversion from a \LaTeX{}-generated \PDF\ file which happens to have \HTMLfive\ tags,
@@ -2666,41 +2881,31 @@
 %
 % When requesting packages during \HTML\ conversion,
 % |lwarp| first looks to see if it has its own modified version
-% to use instead of the usual \LaTeX\ version.  These |lwarp-packagename.sty| files contain
+% to use instead of the standard \LaTeX\ version.
+% These |lwarp-packagename.sty| files contain
 % code used to emulate or replace functions for \HTML\ output.
 %
-% Enough functionality is provided to convert a typical article containing technical content.
-% Not every package has been tested, but many of the most useful ones are known to work,
-% either as-is or through emulation with replacement code.  (See \cref{tab:supported}.)
 %
-% Assistance is provide for modifying the \HTML\ output to suite the creation
-% of \EPUB\ documents, and for modifying the \HTML\ output to ease import into
-% a word processor.
+% \clearpage
 %
-%
 % \subsection{Supported packages and features}
 %
 % \changes{v0.15}{2016/04/05}{Docs: Moved the supported functions table to the introduction.}
 % \changes{v0.38}{2017/08/22}{Docs: Enhanced \protect\textit{Supported Functions} table.}
 %
-% Supported classes include \pkg{book}, \pkg{report}, and \pkg{article},
-% and the Koma-script classes \pkg{scrbook}, \pkg{scrreprt}, and \pkg{scrartcl}.
-% \pkg{memoir} is planned, but in the meantime many of the packages
-% used by \pkg{memoir} are already supported.
+% \Cref{tab:supported} lists some of the various \LaTeX{} features which may be used.
 %
+% \vspace{0.5in}
 %
-% \Cref{tab:supported} lists some of the various \LaTeX{} features which may be used.
-% \emph{Supported} means that the package or macro may be used as-is,
-% perhaps with minor limitations.
-% \emph{Emulated} means that the original package or macro is not used, but similar
-% functionality is provided in a way which is intended to be compatible with the
-% user's \LaTeX{} code.
-%
 % \renewcommand{\arraystretch}{1.5}
 %
+% \begingroup
+% \setlength{\parindent}{0em}
+% \setlength{\parskip}{2ex}
+%
 % \begin{longtable}{>{\raggedright}m{.3\linewidth}m{.6\linewidth}}
 % \caption{\protect\LaTeX--HTML generation ---
-% \protect\pkg{lwarp} package ---
+% \pkg{lwarp} package ---
 % Supported functions\label{tab:supported}} \endfirsthead
 % \warpprintonly{\multicolumn{2}{c}{\pkg{lwarp} Supported Functions --- continued} \\
 %	Category & Status \\ \toprule \endhead}
@@ -2716,11 +2921,13 @@
 % \midrule
 %
 % Classes: & \pkg{book}, \pkg{report}, \pkg{article},
-%   \pkg{scrbook}, \pkg{scrreprt}, \pkg{scrartcl}. \pkg{memoir} is planned. \\
+%   \pkg{scrbook}, \pkg{scrreprt}, \pkg{scrartcl}, \pkg{memoir}. \\
 %
 % Koma-script: & \pkg{scrextend}, \pkg{scrlayer}, \pkg{scrhack}.
 %   Others as listed below. \\
 %
+% Memoir: & \pkg{memhfixc} \\
+%
 % \midrule
 %
 % Page layout: & Emulates \pkg{geometry}, \pkg{fancyhdr}, \pkg{titleps},
@@ -2729,7 +2936,8 @@
 %       \pkg{textarea}, \pkg{zwpagelayout}, \pkg{ebook},
 %       \pkg{preview},
 %       \pkg{draftwatermark}, \pkg{watermark},
-%       \pkg{everyshi}, \pkg{atbegshi}. \\
+%       \pkg{everyshi}, \pkg{atbegshi}, \pkg{continue}, \pkg{fwlw}, \pkg{turnthepage},
+%       \pkg{pagesel}. \\
 %
 % Sectioning: & Supported, with hyperlinks.
 % 	Adds \cmds{FileDepth} for splitting the \HTML\ output.
@@ -2744,19 +2952,19 @@
 %
 % Title page: & \cs{maketitle}, \env{titlepage}, \pkg{titling}, \pkg{authblk}. \\
 %
-% Front \&\ back matter: & \pkg{abstract}, \pkg{appendix} \\
+% Front \&\ back matter: & \pkg{abstract}, \pkg{appendix}. \\
 %
 % Indexing: & \cmds{texindy} is used, with hyperlinks. \pkg{idxlayout} is emulated. \\
 %
 % Glossary: & \pkg{glossaries} and \cmds{xindy} are used. \\
 %
-% Bibliography: & Supported text-only. \\
+% Bibliography: & \pkg{cite}, \pkg{natbib}, \pkg{biblatex}, \pkg{backref}. \\
 %
 % \midrule
 %
 % Cross-references: & Emulated, with hyperlinks.
-%   \pkg{hyperref}, \pkg{cleveref}, \pkg{varioref}, \pkg{fancyref},
-%   \pkg{url}, \pkg{breakurl}. \\
+%   \pkg{hyperref}, \pkg{cleveref}, \pkg{varioref}, \pkg{fancyref}, \pkg{prettyref},
+%   \pkg{titleref}, \pkg{url}, \pkg{breakurl}. \\
 %
 % Languages: & \pkg{babel}.  (\pkg{polyglossia} is untested.) \\
 %
@@ -2766,7 +2974,7 @@
 %
 % Footnotes: & Adds \cmds{FootnoteDepth} to print footnotes at section breaks.
 %   \pkg{footnote}, \pkg{footmisc},
-%	\pkg{marginnote}, \pkg{sidenote}, \pkg{pagenote}, \pkg{endnotes}. \\
+%	\pkg{marginnote}, \pkg{sidenote}, \pkg{pagenote}, \pkg{endnotes}, \pkg{footnpag}. \\
 %
 % \midrule
 %
@@ -2788,8 +2996,9 @@
 %
 % Floats: & Appear where declared.
 %	\pkg{float}, \pkg{rotfloat}, \pkg{newfloat}, \pkg{caption} and \pkg{subcaption},
-%	\pkg{subfig}, \pkg{capt-of}, \pkg{placeins}, \pkg{trivfloat}, \pkg{floatrow},
-%	\pkg{subfloat}, \pkg{keyfloat}, \pkg{wrapfig}, \pkg{cutwin}, \pkg{floatflt}. \\
+%	\pkg{subfig}, \pkg{subfigure}, \pkg{capt-of}, \pkg{placeins}, \pkg{trivfloat}, \pkg{floatrow},
+%	\pkg{subfloat}, \pkg{keyfloat}, \pkg{wrapfig}, \pkg{cutwin}, \pkg{floatflt},
+%   \pkg{flafter}, \pkg{fltrace}, \pkg{endfloat}. \\
 %
 % \midrule
 %
@@ -2836,7 +3045,8 @@
 %
 % Quotations: & \pkg{verse}, \pkg{csquotes}, \pkg{epigraph} \\
 %
-% Verbatim: & \pkg{verbatim}, \pkg{moreverb}, \pkg{fancyvrb} (except for verbatim footnotes). \\
+% Verbatim: & \pkg{verbatim}, \pkg{moreverb}, \pkg{fancyvrb} (except for verbatim footnotes),
+%   \pkg{shortvrb}. \\
 %
 % Frames: & \pkg{framed}, \pkg{fancybox}, \pkg{mdframed}, \pkg{boxedminipage2e}, \pkg{shadow}. \\
 %
@@ -2844,11 +3054,12 @@
 %   Converted to up to three columns with an optional heading,
 %   per browser support. Single-column if unsupported.\\
 %
-% \env{fullwidth}: & Emulated. \\
+% Margins: & \pkg{midpage}, \pkg{hanging}, \pkg{fullwidth}. \\
 %
 % \midrule
 %
-% Todo: & \pkg{todo}, \pkg{todonotes}, \pkg{easy-todo}, \pkg{fixmetodonotes}, \pkg{fixme}. \\
+% Todo notes: & \pkg{todo}, \pkg{todonotes}, \pkg{easy-todo},
+%   \pkg{fixmetodonotes}, \pkg{fixme}, \pkg{changebar}. \\
 %
 % \midrule
 %
@@ -2856,7 +3067,7 @@
 % 	\cs{textbf}, etc are supported.
 % 	\cs{bfseries}, etc.\ are not yet supported.
 %	\pkg{lettrine}, \pkg{ulem}, \pkg{soul}, \pkg{soulutf8}, \pkg{soulpos}, \pkg{cancel},
-%       \pkg{relsize}, \pkg{scalefnt},
+%       \pkg{relsize}, \pkg{scalefnt}, \pkg{textfit},
 %       and \pkg{realscripts} are supported. \\
 %
 % Ordinals: & \pkg{nth}, \pkg{fmtcount}, and \pkg{engord} are supported. \\
@@ -2872,12 +3083,12 @@
 %
 % Rules: & \cs{rule} with width, height, raise, text color. \\
 %
-% \HTML\ reserved characters: & \cs{\&}, \cs{textless}, and
+% HTML reserved characters: & \cs{\&}, \cs{textless}, and
 % 	\cs{textgreater} are converted to \HTML\ entities. \\
 %
 % \midrule
 %
-% Fonts: & Used as-is.  Appear in math expressions or embedded image environments. \\
+% Fonts: & Used as-is.  Appear in \SVG\ math expressions or embedded image environments. \\
 %
 % Symbols: & Native \LaTeX\ diacriticals, \pkg{textcomp}. \\
 %
@@ -2891,23 +3102,14 @@
 %   \pkg{trace},
 %   \pkg{xspace}. \\
 %
-% \midrule
-%
-% Where: & \\
-%
-% \textbf{Supported:} & The existing \LaTeX{} package is used. \\
-% \textbf{Emulated:} & The \LaTeX{} package is not used, but some/all of its
-% 	functions are emulated.  Null functions, lengths, and counters are provided
-% 	for source compatibility. \\
-%
 % \bottomrule
 %
 % \end{longtable}
 %
+% \endgroup
 %
 %
 %
-%
 % \clearpage
 %
 % \section{Alternatives}
@@ -2934,6 +3136,7 @@
 %
 % \url{http://tug.org/tex4ht/}\DescribeProgram{TeX4ht}\DescribeProgram{htlatex}
 %
+% \bigskip\noindent
 % This system uses native \LaTeX{} processing to produce a DVI file containing special commands,
 % and then uses additional post-processing for the \HTML\ conversion by way of numerous configuration
 % files.
@@ -2968,7 +3171,7 @@
 % \item [Glad\TeX:] \url{http://humenda.github.io/GladTeX/} \DescribeProgram{GladTeX}
 % \end{description}
 % 
-% \subsection{AsciiDoc}
+% \subsection{AsciiDoc and Asciidoctor}
 %
 % AsciiDoc is one of the most capable markup languages, providing enough features to produce
 % the typical technical-writing document with cross-references,
@@ -2975,9 +3178,10 @@
 % and it writes \LaTeX{} and \HTML.
 % \begin{description}
 % \item [Asciidoctor:] \url{http://asciidoctor.org/} (More active.)\DescribeProgram{AsciiDoc}
-% \item [AsciiDoc:] \url{http://asciidoc.org/} (The original version.)\DescribeProgram{AsciiDoctor}
+% \item [AsciiDoc:] \url{http://asciidoc.org/} (The original project.)\DescribeProgram{AsciiDoctor}
 % \end{description}
 %
+% \subsubsection{Asciidoctor-LaTeX}
 % The Asciidoctor-LaTeX project is adding additional \LaTeX{}-related features.
 % \begin{description}
 % \item [Asciidoctor-LateX:] ~ \\
@@ -2988,7 +3192,6 @@
 %
 % \subsection{Pandoc}
 % \DescribeProgram{Pandoc}
-%
 % A markup system which also reads and writes \LaTeX{} and \HTML.
 % \begin{description}
 % \item [Pandoc:] \url{http://pandoc.org/}
@@ -3013,7 +3216,7 @@
 % \DescribeProgram{InDesign} \DescribeProgram{Flare} \DescribeProgram{Madcap}
 % abilities have been advancing in the areas of typesetting, cross-referencing, and \HTML\ generation.
 % See Adobe\,\textregistered{} FrameMaker\,\textregistered{},
-% Adobe\,\textregistered{} InDesign\,\textregistered{},
+% Adobe InDesign\,\textregistered{},
 % and Madcap Flare\,\texttrademark{}.
 %
 % \subsection{Comparisons}
@@ -3059,6 +3262,9 @@
 %
 % \clearpage
 %
+% \setlength{\parindent}{0em}
+% \setlength{\parskip}{2ex}
+%
 % \section{Installation}
 %
 % \Cref{tab:utility} shows the tools which are used for
@@ -3066,10 +3272,13 @@
 % In most cases, these will be available via the
 % standard package-installation tools.
 %
+% Detailed installation instructions follow.
+%
 % \index{utility>programs}
 % \index{programs>utility}
 %
-% \begin{table}
+% \begin{table}[hbp]
+% \changes{v0.45}{2017/11/30}{Docs: Moved table so doesn't interfere with install docs.}
 % \caption{Required software programs\label{tab:utility}}
 % \hrule
 % \begin{description}
@@ -3140,13 +3349,12 @@
 % This may be provided by your operating-system package manager, and is
 % required for some of the Poppler \PDF\ utilities.
 %
-% \url{perl.org}, \url{strawberryperl.com}
+% \url{strawberryperl.com} (recommended), \url{perl.org}
 %
 % \item[Automatically downloaded from the internet as required:] \
 % \begin{description}
 %
 % \item[MathJax:] Optionally used to display math.
-%	Automatically loaded from the MathJax website when needed. \\
 %	From: \url{mathjax.org}
 %	\DescribeProgram[requirement]{MathJax}
 %
@@ -3155,8 +3363,9 @@
 %
 % \hrule
 % \end{table}
+% \clearpage
 %
-% \subsection{Installing the \protect\pkg{lwarp} package}
+% \subsection{Installing the \pkg{lwarp} package}
 %
 % There are several ways to install \pkg{lwarp}.  These are listed here
 % with the preferred methods listed first:
@@ -3167,17 +3376,23 @@
 % \item [Pre-installed:] Try entering into a command line:
 %	\userentry{kpsewhich lwarp.sty}
 %
-% If a path to |lwarp.sty| is shown, then \pkg{lwarp} is already installed.
+% If a path to |lwarp.sty| is shown, then \pkg{lwarp} is already installed and
+%   you may skip to the next section.
 %
-% \item [\TeX\ Live:]If using a \TeX\ Live distribution,
+% \item [\TeX\ Live:] If using a \TeX\ Live distribution,
 %	try installing via |tlmgr|:
 %	\userentry{tlmgr install lwarp}
 %
-% \item [MiK\TeX:] If using MiK\TeX, try using the package installer to
-%	install the package |lwarp|.
-%	Also update the package |miktex-misc|, which will install the
-%	|lwarpmk| executable.
+% \item [MiK\TeX:] If using MiK\TeX:
+%   \begin{enumerate}
+%   \item  To install \pkg{lwarp} the first time,
+%       use the \pkg{MikTeX Package Manager (Admin)}.
+%   \item To update \pkg{lwarp}, use \pkg{MikTeX Update (Admin)}.
+%	\item Either way, also update the package |miktex-misc|, which will install and
+%       update the |lwarpmk| executable.
+%   \end{enumerate}
 % \changes{v0.26}{2017/03/23}{Docs: Improved MiK\TeX\ install instructions.}
+% \changes{v0.45}{2017/11/30}{Docs: Improved MiK\TeX\ install instructions.}
 %
 % \item [Operating-system package:] The operating-system package manager may
 %	already have |lwarp|, perhaps as part of a set of \TeX-related packages.
@@ -3332,7 +3547,7 @@
 %	\end{description}
 % \end{enumerate}
 %
-% \subsubsection{Using a local copy of \protect\pkg{lwarpmk}}
+% \subsubsection{Using a local copy of \pkg{lwarpmk}}
 % \label{sec:locallwarpmk}
 % It is also possible to use a local version of |lwarpmk|:
 % \begin{enumerate}
@@ -3379,20 +3594,22 @@
 %	displayed, then that utility is already installed.
 %	See \cref{tab:utility} on page \pageref{tab:utility}.
 %
-%	\userentry{luatex --version}
-%	\userentry{xindy --version}
-%	\userentry{latexmk --version}
-%	\userentry{perl --version}
-%	\userentry{pdfcrop --version}
+%	\userentry{luatex -{}-version}
+%	\userentry{xindy -{}-version}
+%	\userentry{latexmk -{}-version}
+%	\userentry{perl -{}-version}
+%	\userentry{pdfcrop -{}-version}
 %	\userentry{pdftotext -v}
-%	\userentry{pdfseparate --version}
+%	\userentry{pdfseparate -{}-version}
 %	\userentry{pdftocairo -v}
+% \changes{v0.45}{2017/11/30}{Docs: Fix for double hyphens.}
 %
 % \item [To install |xindy|, |latexmk|, and |pdfcrop|:] \
 %
-% The \TeX\ utilities |xindy|, |latexmk|, and |pdfcrop| may be provided by
-% your operating system's package manager, and are also provided by
-% the \CTAN\ archive:
+% The \TeX\ utilities |xindy|, |latexmk|, and |pdfcrop| may be installed
+% in TexLive with |tlmgr|, installed by MikTeX, provided by
+% your operating system's package manager, or downloaded from the \CTAN\ archive:
+% \changes{v0.45}{2017/11/30}{Docs: Improved install instructions.}
 %	\begin{sourcedisplay}
 % \url{http://ctan.org/pkg/xindy} \\
 % \url{http://ctan.org/pkg/latexmk} \\
@@ -3439,6 +3656,7 @@
 % \item Click "Ok" when done.
 % \end{enumerate}
 %
+% \needspace{2\baselineskip}
 % \item [To install Perl to a Windows machine:] \
 % \DescribeProgram[requirement]{perl}\index{Perl}
 % \begin{enumerate}
@@ -4108,7 +4326,7 @@
 %
 % \clearpage
 %
-% \subsection{\protect\pkg{lwarp} package loading and options}
+% \subsection{\pkg{lwarp} package loading and options}
 % \label{sec:loading}
 % \index{settings>lwarp package options}
 % 
@@ -4136,7 +4354,7 @@
 %
 %
 % \pkg{lwarp} supports \pkg{book}, \pkg{report}, and \pkg{article} classes,
-% as well as the equivalent Koma-script classes.
+% as well as the equivalent Koma-script classes and \pkg{memoir}.
 %
 % Load the \pkg{lwarp} package immediately after the font and UTF-8 setup commands.
 % \changes{v0.16}{2016/04/08}{Docs: Moved location of \cs{usepackage\{lwarp\}}.}
@@ -4899,6 +5117,7 @@
 %
 % \subsubsection{Textcomp}
 %
+% \DescribePackage{textcomp}
 % \limitstextcomp
 %
 %
@@ -4923,8 +5142,10 @@
 %	|\item[\href{file\_name.pdf}{text}]|
 %	\end{sourcedisplay}
 %
+%
 % \subsubsection{\pkg{relsize} package}
 %
+% \DescribePackage{relsize}
 % \limitsrelsize
 %
 %
@@ -5038,11 +5259,13 @@
 %
 % \subsubsection{\pkg{fancybox} package}
 %
+% \DescribePackage{fancybox}
 % \limitsfancybox
 %
 % 
 % \subsubsection{\pkg{mdframed} package}
 %
+% \DescribePackage{mdframed}
 % \limitsmdframed
 %
 %
@@ -5079,10 +5302,14 @@
 %
 % \changes{v0.22}{2017/03/01}{\pkg{varioref}: Supported.}
 %
+% \DescribePackage{cleveref}
+% \DescribePackage{varioref}
 % \limitscpageref
 %
 % \subsubsection{Hyperlinks, \pkg{hyperref}, and \pkg{url}}
 %
+% \DescribePackage{hyperref}
+% \DescribePackage{url}
 % \limitshyperlinks
 %
 %
@@ -5140,11 +5367,14 @@
 %
 % \subsubsection{\pkg{abstract} package}
 %
+% \DescribePackage{abstract}
 % \limitsabstract
 %
 %
 % \subsubsection{\pkg{titling} and \pkg{authblk}}
 %
+% \DescribePackage{titling}
+% \DescribePackage{authblk}
 % \limitstitlepage
 %
 %
@@ -5151,21 +5381,25 @@
 % \subsubsection{\pkg{tocloft} package}
 %
 % \DescribeOption[tocloft]{titles}
+% \DescribePackage{tocloft}
 % \limitstocloft
 %
 %
 % \subsubsection{\pkg{appendix} package}
 %
+% \DescribePackage{appendix}
 % \limitsappendix
 %
 %
 % \subsubsection{\pkg{pagenote} package}
 %
+% \DescribePackage{pagenote}
 % \limitspagenote
 %
 %
 % \subsubsection{\pkg{endnotes} package}
 %
+% \DescribePackage{endnotes}
 % \limitsendnotes
 %
 %
@@ -5180,8 +5414,10 @@
 % \label{sec:indextocbibind}
 % \index{index>placement and \acro{TOC} options}
 %
-% \changes{v0.38}{2017/08/24}{Docs: Index, \protect\pkg{tocbibind}.}
+% \changes{v0.38}{2017/08/24}{Docs: Index, \pkg{tocbibind}.}
 %
+% \DescribePackage{makeidx}
+% \DescribePackage{tocbibind}
 % \limitsindex
 %
 % See \cref{sec:index} for \pkg{lwarp}'s core index and glossary code,
@@ -5200,6 +5436,7 @@
 %
 % \subsubsection{\pkg{ntheorem} package}
 %
+% \DescribePackage{ntheorem}
 % \limitsntheorem
 %
 %
@@ -5226,28 +5463,45 @@
 % \subsection{Graphics}
 % \label{sec:limitsgraphics}
 %
+% \DescribePackage{graphics}
+% \DescribePackage{graphicx}
 % \limitsgraphics
 %
 %
 % \subsubsection{\pkg{grffile} package}
 %
+% \DescribePackage{grffile}
 % \limitsgrffile
 %
 %
 % \subsubsection{\pkg{color} package}
 %
+% \DescribePackage{color}
 % \limitscolor
 %
 %
 % \subsubsection{\pkg{xcolor} package}
 %
+% \DescribePackage{xcolor}
 % \limitsxcolor
 %
+%
+% \subsubsection{\pkg{epstopdf} package}
+%
+% \DescribePackage{epstopdf}
+% \limitsepstopdf
+%
+%
 % \subsubsection{\pkg{overpic} package}
 %
+% \DescribePackage{overpic}
 % \limitsoverpic
 %
 %
+% \subsection{Tabbing}
+% \limitstabbing
+%
+%
 % \subsection{Tabular}
 % \label{sec:limitstabular}
 % \changes{v0.39}{2017/08/30}{Docs: Reorganized tabular discussion.}
@@ -5256,15 +5510,19 @@
 %
 % \subsubsection{\pkg{longtable} package}
 %
+% \DescribePackage{longtable}
 % \limitslongtable
 %
 %
 % \subsubsection{\pkg{supertabular} and \pkg{xtab} packages}
 %
+% \DescribePackage{supertabular}
+% \DescribePackage{xtab}
 % \limitssupertabular
 %
 % \subsubsection{\pkg{bigdelim} package}
 %
+% \DescribePackage{bigdelim}
 % \limitsbigdelim
 %
 %
@@ -5272,11 +5530,16 @@
 %
 % \subsubsection{\pkg{float}, \pkg{trivfloat}, and/or \pkg{algorithmicx} together}
 %
+% \DescribePackage{float}
+% \DescribePackage{trivfloat}
+% \DescribePackage{algorithmx}
 % \limitscombiningfloats
 %
 %
 % \subsubsection{\pkg{caption} and \pkg{subcaption} packages}
 %
+% \DescribePackage{caption}
+% \DescribePackage{subcaption}
 % \limitscaption
 %
 %
@@ -5284,29 +5547,45 @@
 %
 % \subsubsection{\pkg{subfig} package}
 %
+% \DescribePackage{subfig}
 % \limitssubfig
 %
 %
 % \subsubsection{\pkg{floatrow} package}
 %
+% \DescribePackage{floatrow}
 % \limitsfloatrow
 %
 %
 % \subsubsection{\pkg{keyfloat} package}
 %
+% \DescribePackage{keyfloat}
 % \limitskeyfloat
 %
 %
 % \subsection{Koma-Script}
 %
+% \DescribeClass{komascript}
 % \limitskomascript
 %
 %
+% \subsection{Memoir}
+% \label{sec:limitsmemoir}
+%
+% \DescribeClass{memoir}
+% \limitsmemoir
+% \index{memoir>options clash}
+% \index{options clash, memoir}
+% \index{warning>Options clash, memoir}
+%
+%
 % \subsection{Miscellaneous}
 %
 %
 % \subsubsection{\pkg{verse} and \pkg{memoir}}
 %
+% \DescribePackage{verse}
+% \DescribeClass{memoir}
 % \limitsverse
 %
 %
@@ -5329,14 +5608,25 @@
 %
 % \subsubsection{\pkg{todonotes} and \pkg{luatodonotes} packages}
 %
+% \DescribePackage{todonotes}
+% \DescribePackage{luatodonotes}
 % \limitstodonotes
 %
 %
 % \subsubsection{\pkg{fixme}}
 %
+% \DescribePackage{fixme}
 % \limitsfixme
 %
 %
+% \subsubsection{xparse}
+%
+% \changes{v0.45}{2017/12/09}{Docs: \pkg{xparse} warnings.}
+% \DescribePackage{xparse}
+% \limitsxparse
+% \index{xparse>warnings}
+%
+%
 % \clearpage
 %
 % \section{EPUB conversion}
@@ -5785,9 +6075,11 @@
 %
 % \clearpage
 %
-% \section{Modifying \protect\pkg{lwarp}}
+% \section{Modifying \pkg{lwarp}}
 % \pagestyle{pageheadfoot}
 %
+% To quickly find a package in |lwarp.dtx|, search for |*packagename|.
+%
 % Purely text-based packages probably will work as-is when generating
 % \HTML.
 %
@@ -5800,7 +6092,7 @@
 % To create a custom \HTML\ block or inline \CSS\ class,
 % see \cref{sec:highlevelclasses}.
 %
-% \subsection{Creating an \protect\pkg{lwarp} version of a package}
+% \subsection{Creating an \pkg{lwarp} version of a package}
 %
 % When creating \HTML,
 % \pkg{lwarp} redefines the \cs{usepackage} and \cs{RequirePackage}
@@ -5840,10 +6132,10 @@
 % \begin{sourcedisplay}
 %   \cs{LWR at ProvidesPackagePass}
 % \end{sourcedisplay}
-% If |Drop|ped, the original print-version
+% If ``|Drop|''ped, the original print-version
 % package is ignored, and only the |lwarp-| version is used.
 % Use this where the original print version is useless for \HTML.
-% If |Pass|ed, the original package is loaded first, with the user-supplied options,
+% If ``|Pass|''ed, the original package is loaded first, with the user-supplied options,
 % then the |lwarp-| version continues loading as well.
 % See \cref{sec:ntheorem} (\nameref{sec:ntheorem})
 % for an example of selectively disabling user options for a package.
@@ -5852,7 +6144,7 @@
 % For a case where the original package is usable without changes, there is no
 % need to create a |lwarp-| version.
 %
-% \subsection{Adding a package to the \pkg{lwarp.dtx} file}
+% \subsubsection{Adding a package to the \pkg{lwarp.dtx} file}
 %
 % When adding a package to |lwarp.dtx| for permanent inclusing in \pkg{lwarp},
 % provide the |lwarp-<packagename>| code in |lwarp.dtx|,
@@ -5864,9 +6156,9 @@
 % an error if \pkg{packagename} is loaded before \pkg{lwarp}.
 %
 %
-% \subsection{Testing \protect\pkg{lwarp}}
+% \subsection{Testing \pkg{lwarp}}
 %
-% \changes{v0.25}{2017/03/22}{Docs: Testing \protect\pkg{lwarp}.}
+% \changes{v0.25}{2017/03/22}{Docs: Testing \pkg{lwarp}.}
 %
 % When changes have been made, test the print output before testing the
 % \HTML.  The print output compiles faster, and any errors in the printed
@@ -5959,22 +6251,42 @@
 %		    that your document's \LaTeX{} code is correct, before attempting
 %		    to generate an \HTML\ version.
 %
+%       \item [Options clash:] If using \pkg{memoir}, see \cref{sec:limitsmemoir}.
+%
 %       \item [``Missing \$ inserted.'':] If using a filename or URL in a
 %           footnote or \cs{item}, escape underscores with \cs{\_}.
+%           \index{warning>Missing \$ inserted.}
+%           \index{Missing \$ inserted.}
 %
+%       \item [``Label(s) may have changed. Rerun to get cross-references right.'':] \
+%
+%           This warning may repeat endlessly if a math expression is used in a caption.
+%           Simple math expressions such as \$X=1\$ may be replaced with
+%           \begin{sourcedisplay}
+%           \cs{textit}\{X\}\cs{,}=\cs{,}1
+%           \end{sourcedisplay}
+%           \index{warning>Label(s) may have changed.}
+%           \index{Label(s) may have changed}
+%
 %         \item [``Leaders not followed by proper glue'':] This can be caused by
 %         a missing |l@<floattype>| or |l@<sectiontype>| definition.
 %         See \pkg{lwarp}'s definitions for examples.
+%           \index{warning>Leaders not followed by proper glue.}
+%           \index{Leaders not followed by proper glue.}
 % 
-%         \item [``Improper \cs{prevdepth}'':] Something tried to use
-%         \cs{ensuremath} where \pkg{lwarp} then tries to create a \env{lateximage}.
+%         \item [``Improper \cs{prevdepth}'':] (Associated with \cs{LWR at orignewpage}.)
+%           Something tried to use
+%         \cs{ensuremath} where \pkg{lwarp} then tried to create a \env{lateximage}.
 %         If you can locate what used \cs{ensuremath}, have it temporarily set:
 %         \begin{sourcedisplay}
 %         \cs{LetLtxMacro}\cs{@ensuredmath}\cs{LWR at origensuredmath}
 %         \end{sourcedisplay}
 %         inside a group first.
+%           \index{warning>Improper \cs{prevdepth}.}
+%           \index{Improper \cs{prevdepth}.}
 %   \end{description}
 %
+% \needspace{3\baselineskip}
 % \item [Missing sections:] ~
 %	\begin{itemize}
 %	\item See \cref{sec:filedepth} regarding the
@@ -6290,10 +6602,28 @@
 \fi
 %    \end{macrocode}
 %
-
-
-% \clearpage
 %
+%
+%
+% \section{Miscellaneous tools}
+%
+%
+% \begin{macro}{\LWR at providelength} \marg{\cs{lengthname}}
+% Provides the length if it isn't defined yet.
+%
+% Used to provide source compatibility for lengths which will be ignored,
+% but might or might not be already provided by other packages.
+%
+% \changes{v0.46}{2018/01/23}{Added.}
+%    \begin{macrocode}
+\newcommand*\LWR at providelength[1]{%
+    \ifdeflength{#1}{}{\newlength{#1}}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
 % \section{Early package requirements}
 %
 % \DescribePackage{etoolbox}
@@ -6728,25 +7058,32 @@
 %
 %
 %
-% \section{Misplaced packages}
+% \section{Package load order}
 %
 % \changes{v0.21}{2017/02/22}{Add: Errors for misplaced packages.}
 
 
 % Several packages should only be loaded before \pkg{lwarp}, and
-% others should only be loaded after.
+% most others should only be loaded after.
 %
 % Packages which should only be loaded before \pkg{lwarp} have their own
 %	\begin{sourcedisplay}
 %	|lwarp-<packagename>.sty|
 %	\end{sourcedisplay}
-% which will trigger an error if they are loaded after
+% which use \cs{LWR at loadbefore} to trigger an error if they are loaded after
 % \pkg{lwarp}.
 % Examples include \pkg{fontspec}, \pkg{inputenc}, \pkg{fontenc},
 % and \pkg{newunicodechar}.
 %
+% Most packages should be loaded after \pkg{lwarp}.  This is enfoced by
+% a large number of \cs{LWR at loadafter} statements, below.
 %
-
+% Some packages are emulated by \pkg{memoir}, and so these are tested by
+% \cs{LWR at notmemoirloadafter}, which does not cause an error if \pkg{memoir} is used.
+%
+%
+% \subsection{Tests of package load order}
+%
 % \begin{macro}{\LWR at loadafter} \marg{packagename} \quad
 % Error if this package was loaded before \pkg{lwarp}.
 %
@@ -6767,7 +7104,20 @@
 %    \end{macrocode}
 % \end{macro}
 
+% \begin{macro}{\LWR at notmemoirloadafter} \marg{packagename} \quad
+% Error if not \pkg{memoir} class and this package was loaded before \pkg{lwarp}.
+%
+% \pkg{memoir} emulates many packages, and pretends that they have already been loaded.
+%
+% \changes{v0.45}{2017/12/03}{Added.}
+%    \begin{macrocode}
+\@ifclassloaded{memoir}
+{\newcommand*{\LWR at notmemoirloadafter}[1]{}}
+{\LetLtxMacro\LWR at notmemoirloadafter\LWR at loadafter}
+%    \end{macrocode}
+% \end{macro}
 
+
 % \begin{macro}{\LWR at loadbefore} \marg{packagename} \quad
 % Error if this package is after \pkg{lwarp}.
 %
@@ -6804,15 +7154,16 @@
 }
 %    \end{macrocode}
 % \end{macro}
-
-
-
-
+%
+%
+% \subsection{Enforcing package loading after \pkg{lwarp}}
+%
 % Packages which should only be loaded after \pkg{lwarp} are tested
 % here to trip an error of they have already been loaded.
 %
 % \changes{v0.25}{2017/03/16}{Fix: Allows XE\LaTeX\ and
 %	\LuaLaTeX\ to preload graphics and graphicx.}
+% \changes{v0.45}{2017/12/03}{Allows \pkg{memoir}'s preloaded packages.}
 %
 % The following packages must be loaded after \pkg{lwarp}:
 %    \begin{macrocode}
@@ -6819,7 +7170,7 @@
 \LWR at loadafter{a4}
 \LWR at loadafter{a4wide}
 \LWR at loadafter{a5comb}
-\LWR at loadafter{abstract}
+\LWR at notmemoirloadafter{abstract}
 \LWR at loadafter{adjmulticol}
 \LWR at loadafter{addlines}
 \LWR at loadafter{afterpage}
@@ -6829,38 +7180,44 @@
 \LWR at loadafter{amsthm}
 \LWR at loadafter{anonchap}
 \LWR at loadafter{anysize}
-\LWR at loadafter{appendix}
+\LWR at notmemoirloadafter{appendix}
 \LWR at loadafter{arabicfront}
-\LWR at loadafter{array}
+\LWR at notmemoirloadafter{array}
 \LWR at loadafter{atbegshi}
 \LWR at loadafter{authblk}
+\LWR at loadafter{backref}
 \LWR at loadafter{balance}
 \LWR at loadafter{bigdelim}
 \LWR at loadafter{bigstrut}
 \LWR at loadafter{bookmark}
-\LWR at loadafter{booktabs}
+\LWR at notmemoirloadafter{booktabs}
 \LWR at loadafter{boxedminipage}
 \LWR at loadafter{boxedminipage2e}
 \LWR at loadafter{breakurl}
 \LWR at loadafter{cancel}
-\LWR at loadafter{ccaption}
-\LWR at loadafter{changepage}
-\LWR at loadafter{chngpage}
+\LWR at notmemoirloadafter{ccaption}
+\LWR at loadafter{changebar}
+\LWR at notmemoirloadafter{changepage}
+\LWR at notmemoirloadafter{chngpage}
 \LWR at loadafter{chappg}
+\LWR at loadafter{cite}
 \LWR at loadafter{color}
-\LWR at loadafter{crop}
+\LWR at loadafter{continue}
+\LWR at notmemoirloadafter{crop}
 \LWR at loadafter{cuted}
 \LWR at loadafter{cutwin}
 \LWR at loadafter{dblfnote}
-\LWR at loadafter{dcolumn}
+\LWR at notmemoirloadafter{dcolumn}
 \LWR at loadafter{draftwatermark}
 \LWR at loadafter{easy-todo}
 \LWR at loadafter{ebook}
 \LWR at loadafter{ellipsis}
 \LWR at loadafter{emptypage}
-\LWR at loadafter{enumerate}
+\LWR at loadafter{endfloat}
+\LWR at loadafter{endnotes}
+\LWR at notmemoirloadafter{enumerate}
 \LWR at loadafter{enumitem}
-\LWR at loadafter{epigraph}
+\LWR at notmemoirloadafter{epigraph}
 \LWR at loadafter{eso-pic}
 \LWR at loadafter{everypage}
 \LWR at loadafter{everyshi}
@@ -6873,18 +7230,26 @@
 \LWR at loadafter{fix2col}
 \LWR at loadafter{fixme}
 \LWR at loadafter{fixmetodonotes}
+\LWR at loadafter{flafter}
 \LWR at loadafter{float}
 \LWR at loadafter{floatflt}
 \LWR at loadafter{floatpag}
 \LWR at loadafter{floatrow}
+\LWR at loadafter{fltrace}
 \LWR at loadafter{flushend}
 \LWR at loadafter{fncychap}
 \LWR at loadafter{fnpos}
 % fontenc must be loaded before lwarp
 % fontspec must be loaded before lwarp
+\LWR at loadafter{footmisc}
+\LWR at loadafter{footnote}
+\LWR at loadafter{footnotehyper}
+\LWR at loadafter{footnpag}
+\LWR at loadafter{framed}
 \LWR at loadafter{ftnright}
 \LWR at loadafter{fullpage}
 \LWR at loadafter{fullwidth}
+\LWR at loadafter{fwlw}
 \LWR at loadafter{geometry}
 \LWR at loadafter{glossaries}
 % \LWR at loadafter{graphics}% pre-loaded by xunicode
@@ -6891,6 +7256,7 @@
 % \LWR at loadafter{graphicx}% pre-loaded by xunicode
 \LWR at loadafter{grffile}
 \LWR at loadafter{hang}
+\LWR at loadafter{hanging}
 \LWR at loadafter{hyperref}
 \LWR at loadafter{hyperxmp}
 \LWR at loadafter{idxlayout}
@@ -6913,33 +7279,38 @@
 \LWR at loadafter{marginnote}
 \LWR at loadafter{mcaption}
 \LWR at loadafter{mdframed}
+\LWR at loadafter{memhfixc}
 \LWR at loadafter{metalogo}
 \LWR at loadafter{microtype}
 \LWR at loadafter{midfloat}
-\LWR at loadafter{moreverb}
+\LWR at loadafter{midpage}
+\LWR at notmemoirloadafter{moreverb}
 % morewrites must be loaded before lwarp
-\LWR at loadafter{mparhack}
+\LWR at notmemoirloadafter{mparhack}
 %\LWR at loadafter{multicol}% loaded by ltxdoc
 \LWR at loadafter{multirow}
 \LWR at loadafter{nameref}
-\LWR at loadafter{needspace}
+\LWR at loadafter{natbib}
+\LWR at notmemoirloadafter{needspace}
 % newclude must be loaded before lwarp
 \LWR at loadafter{newtxmath}
 % newunicodechar must be loaded before lwarp
-\LWR at loadafter{nextpage}
+\LWR at notmemoirloadafter{nextpage}
 \LWR at loadafter{nonumonpart}
 \LWR at loadafter{nopageno}
 \LWR at loadafter{nowidow}
 \LWR at loadafter{ntheorem}
 \LWR at loadafter{overpic}
-\LWR at loadafter{pagenote}
+\LWR at notmemoirloadafter{pagenote}
+\LWR at loadafter{pagesel}
 \LWR at loadafter{paralist}
-\LWR at loadafter{parskip}
+\LWR at notmemoirloadafter{parskip}
 \LWR at loadafter{pdflscape}
 \LWR at loadafter{pdfsync}
 \LWR at loadafter{pfnote}
 \LWR at loadafter{placeins}
 \LWR at loadafter{prelim2e}
+\LWR at loadafter{prettyref}
 \LWR at loadafter{preview}
 \LWR at loadafter{quotchap}
 \LWR at loadafter{ragged2e}
@@ -6958,9 +7329,9 @@
 \LWR at loadafter{scrlayer-scrpage}
 \LWR at loadafter{section}
 \LWR at loadafter{sectsty}
-\LWR at loadafter{setspace}
+\LWR at notmemoirloadafter{setspace}
 \LWR at loadafter{shadow}
-\LWR at loadafter{showidx}
+\LWR at notmemoirloadafter{showidx}
 \LWR at loadafter{showkeys}
 \LWR at loadafter{sidecap}
 \LWR at loadafter{sidenotes}
@@ -6970,12 +7341,14 @@
 \LWR at loadafter{soulutf8}
 \LWR at loadafter{stabular}
 \LWR at loadafter{subfig}
+\LWR at loadafter{subfigure}
 \LWR at loadafter{supertabular}
 \LWR at loadafter{tabls}
-\LWR at loadafter{tabularx}
+\LWR at notmemoirloadafter{tabularx}
 \LWR at loadafter{tabulary}
 \LWR at loadafter{textarea}
 % \LWR at loadafter{textcomp}% maybe before lwarp with font packages
+\LWR at loadafter{textfit}
 \LWR at loadafter{textpos}
 \LWR at loadafter{theorem}
 \LWR at loadafter{threeparttable}
@@ -6983,15 +7356,16 @@
 \LWR at loadafter{titleps}
 \LWR at loadafter{titlesec}
 \LWR at loadafter{titletoc}
-\LWR at loadafter{titling}
+\LWR at notmemoirloadafter{titling}
 % \LWR at loadafter{tocbasic}% preloaded by koma-script classes
-\LWR at loadafter{tocbibind}
-\LWR at loadafter{tocloft}
+\LWR at notmemoirloadafter{tocbibind}
+\LWR at notmemoirloadafter{tocloft}
 \LWR at loadafter{tocstyle}
 \LWR at loadafter{todo}
 \LWR at loadafter{todonotes}
 \LWR at loadafter{transparent}
 \LWR at loadafter{trivfloat}
+\LWR at loadafter{turnthepage}
 %    \end{macrocode}
 % \changes{v0.44}{2017/11/19}{Adjustment for \pkg{koma-script}.}
 %    \begin{macrocode}
@@ -6999,7 +7373,7 @@
 \LWR at loadafter{ulem}
 \LWR at loadafter{upref}
 \LWR at loadafter{varioref}
-\LWR at loadafter{verse}
+\LWR at notmemoirloadafter{verse}
 \LWR at loadafter{wallpaper}
 \LWR at loadafter{watermark}
 \LWR at loadafter{wrapfig}
@@ -7355,7 +7729,7 @@
 %		does-morewrites-not-support-filecontents-and-can-i-write-body-of-environment-us/\\
 %		312910}}
 %
-% \changes{v0.34}{2017/08/02}{\pkg{filecontents}: Required.  Patched for \protect\pkg{morewrites}.}
+% \changes{v0.34}{2017/08/02}{\pkg{filecontents}: Required.  Patched for \pkg{morewrites}.}
 %
 %    \begin{macrocode}
 \RequirePackage{filecontents}
@@ -7414,6 +7788,8 @@
 
 
 % \DescribePackage{refcount}
+%
+% Provides \cs{setcounterref}, \cs{setcounterpageref}, etc.
 %    \begin{macrocode}
 \RequirePackage{refcount}
 %    \end{macrocode}
@@ -7480,7 +7856,7 @@
 % so the options |leqno| and |fleqn| are passed beforehand to be
 % picked up both here and by \pkg{newtxmath} if it is used.
 % \changes{v0.16}{2016/04/11}{Fix: newtxmath compatibility.}
-% \changes{v0.33}{2016/06/21}{\protect\pkg{amsmath}: Removed \protect\texttt{fleqn} option.}
+% \changes{v0.33}{2016/06/21}{\pkg{amsmath}: Removed \protect\texttt{fleqn} option.}
 %
 %    \begin{macrocode}
 \PassOptionsToPackage{leqno}{amsmath}
@@ -7551,7 +7927,9 @@
 % The original name with blanks is in |LWR at strresult| and
 % the final name with no blanks goes into |LWR at strresulttwo|.
 %    \begin{macrocode}
+\LWR at traceinfo{LWR at lookforpackagename with blanks: !\LWR at strresult!}%
 \StrSubstitute[100]{\LWR at strresult}{ }{}[\LWR at strresulttwo]%
+\LWR at traceinfo{LWR at lookforpackagename without blanks: !\LWR at strresulttwo!}%
 %    \end{macrocode}
 % See if the package name was found:
 %    \begin{macrocode}
@@ -7568,7 +7946,15 @@
             {\LWR at strresult}%
             {lwarp-\LWR at strresulttwo}[\LWR at requirepackagenames]%
 }%
-{}% no lwarp-* file
+{
+%    \end{macrocode}
+% \changes{v0.46}{2018/01/23}{Fix: Spaces in \cs{usepackage}.}
+%    \begin{macrocode}
+        \StrSubstitute%
+            {\LWR at requirepackagenames}%
+            {\LWR at strresult}%
+            {\LWR at strresulttwo}[\LWR at requirepackagenames]%
+}% no lwarp-* file
 }% yes filename
 }
 %    \end{macrocode}
@@ -7786,17 +8172,24 @@
 \newread\LWR at copyinfile      % open the file to read from
 
 \newcommand*{\LWR at copyfile}[2]{%
+\LWR at traceinfo{LWR at copyfile: copying #1 to #2}
+
 \immediate\openout\LWR at copyoutfile=#2
 \openin\LWR at copyinfile=#1
 \begingroup\endlinechar=-1
 \makeatletter
+
+\LWR at traceinfo{LWR at copyfile: about to loop}
+
 \loop\unless\ifeof\LWR at copyinfile
+  \LWR at traceinfo{LWR at copyfile: one line}
   \read\LWR at copyinfile to\LWR at fileline  % Read one line and store it into \LWR at fileline
 %   \LWR at fileline\par                   % print the content into the pdf
 % print the content:
   \immediate\write\LWR at copyoutfile{\unexpanded\expandafter{\LWR at fileline}}%
 \repeat
-\closeout\LWR at copyoutfile
+\immediate\closeout\LWR at copyoutfile
+\LWR at traceinfo{LWR at copyfile: done}
 \endgroup
 }
 %    \end{macrocode}
@@ -7873,26 +8266,7 @@
 %    \end{macrocode}
 
 
-% \section{Koma-script}
-%
-% Load patches to \pkg{koma-script}.
-%
-% \codehtml
-%    \begin{macrocode}
-\begin{warpHTML}
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\@ifclassloaded{scrbook}{\RequirePackage{lwarp-patch-komascript}}{}
-\@ifclassloaded{scrartcl}{\RequirePackage{lwarp-patch-komascript}}{}
-\@ifclassloaded{scrreprt}{\RequirePackage{lwarp-patch-komascript}}{}
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\end{warpHTML}
-%    \end{macrocode}
 
-
 % \section{HTML-conversion output modifications}
 %
 % These booleans modify the \HTML\ output in various ways
@@ -8035,7 +8409,7 @@
 \renewcommand*{\LWR at tagsubsubsectionend}{/h5}
 \renewcommand*{\LWR at tagparagraph}{h6}
 \renewcommand*{\LWR at tagparagraphend}{/h6}
-\renewcommand*{\LWR at tagsubparagraph}{span class="subparagraph"{}}
+\renewcommand*{\LWR at tagsubparagraph}{span class="subparagraph"}
 \renewcommand*{\LWR at tagsubparagraphend}{/span}
 }% WPTitleHeading
 {% not WPTitleHeading, part and section starting at h1
@@ -8072,7 +8446,7 @@
 \renewcommand*{\LWR at tagsubsubsectionend}{/h5}
 \renewcommand*{\LWR at tagparagraph}{h6}
 \renewcommand*{\LWR at tagparagraphend}{/h6}
-\renewcommand*{\LWR at tagsubparagraph}{span class="subparagraph"{}}
+\renewcommand*{\LWR at tagsubparagraph}{span class="subparagraph"}
 \renewcommand*{\LWR at tagsubparagraphend}{/span}
 }% not WPTitleHeading
 }% chapter defined
@@ -8141,7 +8515,7 @@
 
 \let\LWR at origpagestyle\pagestyle
 \let\LWR at origthispagestyle\thispagestyle
-\let\LWR at origpagenumbering\pagenumbering
+\LetLtxMacro\LWR at origpagenumbering\pagenumbering
 
 \LetLtxMacro{\LWR at origminipage}{\minipage}
 \let\LWR at origendminipage\endminipage
@@ -8412,7 +8786,7 @@
 \begin{filecontents*}{lwarp.css}
 /*
   CSS stylesheet for the LaTeX lwarp package
-  Copyright 2016-2017 Brian Dunn — BD Tech Concepts LLC
+  Copyright 2016-2018 Brian Dunn — BD Tech Concepts LLC
 */
 
 
@@ -8459,6 +8833,7 @@
 }
 
 p {margin: 1.5ex 0em 1.5ex 0em ;}
+table p {margin: .5ex 0em .5ex 0em ;}
 
 /* Holds a section number to add space between it and the name */
 span.sectionnumber { margin-right: 0em }
@@ -8842,7 +9217,7 @@
 }
 
 ul, body dir, body menu {
-  margin: 1ex 1em 1ex 0em;
+  margin: 3ex 1em 3ex 0em;
   line-height: 1.2;
 }
 
@@ -9042,7 +9417,8 @@
 .mdframedtitle {
     padding: .5em ;
     display: block ;
-    font-size: 130%
+    font-size: 130% ;
+    margin-bottom: 1ex ;
 }
 
 .mdframedsubtitle {
@@ -9072,6 +9448,12 @@
   display: block ;
 }
 
+.shaded {
+    margin: 3ex 0em 3ex 0em ;
+    padding: .3ex 1em .3ex 1em ;
+    display: block ;
+}
+
 .snugframed {
     margin: 3ex 0em 3ex 0em ;
    border: 1px solid black;
@@ -10279,7 +10661,17 @@
 (require "texindy.xdy")
 (require "page-ranges.xdy")
 (require "book-order.xdy")
+(require "page-ranges.xdy")
 (markup-locref :open "\hyperindexref{" :close "}")
+(define-location-class "arabic-page-numbers"
+    ("arabic-numbers") :min-range-length 1)
+(define-location-class-order ("roman-page-numbers"
+                  "arabic-page-numbers"
+                  "alpha-page-numbers"
+                  "Roman-page-numbers"
+                  "Alpha-page-numbers"
+                  "see"
+                  "seealso"))
 \end{filecontents*}
 % \end{Verbatim}% for syntax highlighting
 \end{warpprint}
@@ -10300,6 +10692,8 @@
 % \changes{v0.30}{2017/04/26}{Fix: \protect\texttt{lwarp\_mathjax.txt}: Only written in print mode.}
 % \changes{v0.34}{2017/07/27}{File: \protect\texttt{lwarp\_mathjax.txt}: Version change.}
 % \changes{v0.42}{2017/10/16}{File: \protect\texttt{lwarp\_mathjax.txt}: Updated \pkg{siunitx} script.}
+% \changes{v0.45}{2017/12/21}{File: \protect\texttt{lwarp\_mathjax.txt}: Allow MathJax inside \env{tabbing}.}
+% \changes{v0.45}{2018/01/23}{File: \protect\texttt{lwarp\_mathjax.txt}: Allow MathJax inside \env{verse}.}
 %
 %
 %    \begin{macrocode}
@@ -10372,7 +10766,10 @@
  MathJax.Hub.Config({
    extensions: ["tex2jax.js","[siunitx]/siunitx.js"],
    jax: ["input/TeX","output/HTML-CSS"],
-   tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]},
+   tex2jax: {
+        inlineMath: [["$","$"],["\\(","\\)"]] ,
+        processClass: "tabbing|verse"
+    },
    TeX: {extensions: ["AMSmath.js","AMSsymbols.js", "sinuitx.js"]}
  });
  MathJax.Ajax.config.path['siunitx']  = 'http://rawgit.com/burnpanck/MathJax-siunitx/master/';
@@ -10436,11 +10833,11 @@
 \begin{filecontents*}{lwarpmk.lua}
 #!/usr/bin/env texlua
 
--- Copyright 2016-2017 Brian Dunn
+-- Copyright 2016-2018 Brian Dunn
 
 -- Print the usage of the lwarpmk command:
 
-printversion = "v0.44"
+printversion = "v0.46"
 
 function printhelp ()
 print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;
@@ -11096,65 +11493,68 @@
 % \begin{macro}{\pushclose} \marg{action} \marg{depth}
 
 % Pushes one return action and its \LaTeX\ depth onto the stacks.
+% \changes{v0.46}{2018/01/18}{Fix: Stack unnesting.}
 %    \begin{macrocode}
 \NewDocumentCommand{\pushclose}{m m}
 {
-\let\LWR at closetwelve\LWR at closeeleven
-\let\LWR at closeeleven\LWR at closeten
-\let\LWR at closeten\LWR at closenine
-\let\LWR at closenine\LWR at closeeight
-\let\LWR at closeeight\LWR at closeseven
-\let\LWR at closeseven\LWR at closesix
-\let\LWR at closesix\LWR at closefive
-\let\LWR at closefive\LWR at closefour
-\let\LWR at closefour\LWR at closethree
-\let\LWR at closethree\LWR at closetwo
-\let\LWR at closetwo\LWR at closeone
-\let\LWR at closeone#1
-\let\LWR at closedepthtwelve\LWR at closedeptheleven
-\let\LWR at closedepthelevel\LWR at closedepthten
-\let\LWR at closedepthten\LWR at closedepthnine
-\let\LWR at closedepthnine\LWR at closedeptheight
-\let\LWR at closedeptheight\LWR at closedepthseven
-\let\LWR at closedepthseven\LWR at closedepthsix
-\let\LWR at closedepthsix\LWR at closedepthfive
-\let\LWR at closedepthfive\LWR at closedepthfour
-\let\LWR at closedepthfour\LWR at closedepththree
-\let\LWR at closedepththree\LWR at closedepthtwo
-\let\LWR at closedepthtwo\LWR at closedepthone
-\let\LWR at closedepthone#2
+\global\let\LWR at closetwelve\LWR at closeeleven
+\global\let\LWR at closeeleven\LWR at closeten
+\global\let\LWR at closeten\LWR at closenine
+\global\let\LWR at closenine\LWR at closeeight
+\global\let\LWR at closeeight\LWR at closeseven
+\global\let\LWR at closeseven\LWR at closesix
+\global\let\LWR at closesix\LWR at closefive
+\global\let\LWR at closefive\LWR at closefour
+\global\let\LWR at closefour\LWR at closethree
+\global\let\LWR at closethree\LWR at closetwo
+\global\let\LWR at closetwo\LWR at closeone
+\global\let\LWR at closeone#1
+\global\let\LWR at closedepthtwelve\LWR at closedeptheleven
+\global\let\LWR at closedeptheleven\LWR at closedepthten
+\global\let\LWR at closedepthten\LWR at closedepthnine
+\global\let\LWR at closedepthnine\LWR at closedeptheight
+\global\let\LWR at closedeptheight\LWR at closedepthseven
+\global\let\LWR at closedepthseven\LWR at closedepthsix
+\global\let\LWR at closedepthsix\LWR at closedepthfive
+\global\let\LWR at closedepthfive\LWR at closedepthfour
+\global\let\LWR at closedepthfour\LWR at closedepththree
+\global\let\LWR at closedepththree\LWR at closedepthtwo
+\global\let\LWR at closedepthtwo\LWR at closedepthone
+\global\let\LWR at closedepthone#2
 }
 %    \end{macrocode}
 % \end{macro}
 
+
 % \begin{macro}{\popclose}
 
 % Pops one action and its depth off the stacks.
+% \changes{v0.46}{2018/01/18}{Fix: Stack unnesting.}
 %    \begin{macrocode}
 \newcommand*{\popclose}
 {
-\let\LWR at closeone\LWR at closetwo
-\let\LWR at closetwo\LWR at closethree
-\let\LWR at closethree\LWR at closefour
-\let\LWR at closefour\LWR at closefive
-\let\LWR at closefive\LWR at closesix
-\let\LWR at closesix\LWR at closeseven
-\let\LWR at closeseven\LWR at closeeight
-\let\LWR at closeeight\LWR at closenine
-\let\LWR at closenine\LWR at closeten
-\let\LWR at closeten\LWR at closeeleven
-\let\LWR at closeeleven\LWR at closetwelve
-\let\LWR at closedepthone\LWR at closedepthtwo
-\let\LWR at closedepthtwo\LWR at closedepththree
-\let\LWR at closedepththree\LWR at closedepthfour
-\let\LWR at closedepthfour\LWR at closedepthfive
-\let\LWR at closedepthfive\LWR at closedepthsix
-\let\LWR at closedepthsix\LWR at closedepthseven
-\let\LWR at closedepthseven\LWR at closedeptheight
-\let\LWR at closedeptheight\LWR at closedepthnine
-\let\LWR at closedepthnine\LWR at closedepthten
-\let\LWR at closedepthten\LWR at closedeptheleven
-\let\LWR at closedeptheleven\LWR at closedepthtwelve
+\global\let\LWR at closeone\LWR at closetwo
+\global\let\LWR at closetwo\LWR at closethree
+\global\let\LWR at closethree\LWR at closefour
+\global\let\LWR at closefour\LWR at closefive
+\global\let\LWR at closefive\LWR at closesix
+\global\let\LWR at closesix\LWR at closeseven
+\global\let\LWR at closeseven\LWR at closeeight
+\global\let\LWR at closeeight\LWR at closenine
+\global\let\LWR at closenine\LWR at closeten
+\global\let\LWR at closeten\LWR at closeeleven
+\global\let\LWR at closeeleven\LWR at closetwelve
+\global\let\LWR at closedepthone\LWR at closedepthtwo
+\global\let\LWR at closedepthtwo\LWR at closedepththree
+\global\let\LWR at closedepththree\LWR at closedepthfour
+\global\let\LWR at closedepthfour\LWR at closedepthfive
+\global\let\LWR at closedepthfive\LWR at closedepthsix
+\global\let\LWR at closedepthsix\LWR at closedepthseven
+\global\let\LWR at closedepthseven\LWR at closedeptheight
+\global\let\LWR at closedeptheight\LWR at closedepthnine
+\global\let\LWR at closedepthnine\LWR at closedepthten
+\global\let\LWR at closedepthten\LWR at closedeptheleven
+\global\let\LWR at closedeptheleven\LWR at closedepthtwelve
 }
 %    \end{macrocode}
 % \end{macro}
@@ -11209,7 +11609,44 @@
 %    \end{macrocode}
 
 
+% \section{Sanitizing labels and filenames}
+%
+% Special handling for underscores in labels and filenames.
 
+% \codehtml
+%    \begin{macrocode}
+\begin{warpHTML}
+%    \end{macrocode}
+
+% \begin{macro}{\LWR at sanitized} The sanitized version of what was given
+%   to \cs{LWR at sanitize}.
+% Characters are set to their detokenized versions.
+% Required for underscores in labels and filenames.
+%    \begin{macrocode}
+\newcommand*{\LWR at sanitized}{}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\LWR at sanitize} \marg{text}
+%
+% Sanitizes the text and returns the result in \cs{LWR at sanitized}.
+%    \begin{macrocode}
+\newcommand*{\LWR at sanitize}[1]{%
+\LWR at traceinfo{LWR at sanitize: !#1!}%
+\edef\LWR at sanitized{#1}%
+\LWR at traceinfo{LWR at sanitize expanded: !\LWR at sanitized!}%
+\edef\LWR at sanitized{\detokenize\expandafter{\LWR at sanitized}}%
+\LWR at traceinfo{LWR at sanitize result: !\LWR at sanitized!}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+%    \begin{macrocode}
+\end{warpHTML}
+%    \end{macrocode}
+
+
+
 % \section{HTML entities}
 
 % \codehtml
@@ -11217,7 +11654,7 @@
 \begin{warpHTML}
 %    \end{macrocode}
 
-% \HTML\ entites and \HTML\ Unicode entities:
+% HTML entites and \HTML\ Unicode entities:
 %    \begin{macrocode}
 \let\LWR at origampersand\&
 %    \end{macrocode}
@@ -11241,7 +11678,7 @@
 
 % \DescribeMacro{\&}
 %    \begin{macrocode}
-\renewcommand*{\&}{\HTMLentity{amp}}
+\renewrobustcmd*{\&}{\HTMLentity{amp}}
 %    \end{macrocode}
 
 % \begin{macro}{\textless}
@@ -11366,12 +11803,12 @@
 % Prints the filename for a given section: |\HTMLFilename{}filenumber/name.html|
 %    \begin{macrocode}
 \newcommand*{\LWR at htmlsectionfilename}[1]{%
-\LWR at traceinfo{LWR at htmlsectionfilename A}%
+\LWR at traceinfo{LWR at htmlsectionfilename A !\detokenize{#1}!}%
 %    \end{macrocode}
 % Section 0 or empty is given the home filename.
 % The filename must be detokenized for underscores.
 %    \begin{macrocode}
-\LWR at traceinfo{about to assign temp}%
+% \LWR at traceinfo{about to assign temp}%
 \edef\LWR at tempone{#1}%
 \LWR at traceinfo{about to compare with ??}%
 \ifthenelse{\equal{\LWR at tempone}{??}}%
@@ -11417,9 +11854,9 @@
 % Prints the filename for the given label
 %    \begin{macrocode}
 \newcommand*{\LWR at htmlrefsectionfilename}[1]{%
-\LWR at traceinfo{LWR at htmlrefsectionfilename A: !#1!}%
+\LWR at traceinfo{LWR at htmlrefsectionfilename: !\detokenize{#1}!}%
 \LWR at htmlsectionfilename{\LWR at htmlfileref{#1}}%
-\LWR at traceinfo{LWR at htmlrefsectionfilename B}%
+\LWR at traceinfo{LWR at htmlrefsectionfilename: done}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -11478,11 +11915,11 @@
 
 
 
-% \section{\textbackslash{}PrintStack diagnostic tool}
+% \section{\cs{LWRPrintStack} diagnostic tool}
 
 % Diagnostics tool:
 % Prints the \LaTeX\ nesting depth values for the stack levels.
-% Must have |\LWR at startpars| active while printing the stack, so |\PrintStack| may
+% |\LWR at startpars| is used before printing the stack, so that |\LWRPrintStack| may
 % \watchout
 % be called from anywhere in the normal text flow.
 
@@ -11491,14 +11928,19 @@
 \begin{warpHTML}
 %    \end{macrocode}
 
-% \begin{macro}{\PrintStack} Prints the closedepth stack.
+% \begin{macro}{\LWRPrintStack} Prints the closedepth stack.
+% \changes{v0.46}{2018/01/15}{Name changed from \cs{PrintStack}.}
 %    \begin{macrocode}
-\newcommand*{\PrintStack}{
+\newcommand*{\LWR at subprintstack}{
+\LWR at closedepthone\ \LWR at closedepthtwo\ \LWR at closedepththree\ 
+\LWR at closedepthfour\ \LWR at closedepthfive\ \LWR at closedepthsix\ 
+\LWR at closedepthseven\ \LWR at closedeptheight\ \LWR at closedepthnine\ 
+\LWR at closedepthten\ \LWR at closedeptheleven\ \LWR at closedepthtwelve\ 
+}
+
+\newcommand*{\LWRPrintStack}{
 \LWR at startpars
-\LWR at closedepthone{} \LWR at closedepthtwo{} \LWR at closedepththree{}
-\LWR at closedepthfour{} \LWR at closedepthfive{} \LWR at closedepthsix{}
-\LWR at closedepthseven{} \LWR at closedeptheight{} \LWR at closedepthnine{}
-\LWR at closedepthten{} \LWR at closedeptheleven{} \LWR at closedepthtwelve{}
+\LWR at subprintstack
 }
 %    \end{macrocode}
 % \end{macro}
@@ -11507,7 +11949,22 @@
 \end{warpHTML}
 %    \end{macrocode}
 
+% \codeprint
+%    \begin{macrocode}
+\begin{warpprint}
+%    \end{macrocode}
 
+%    \begin{macrocode}
+\newcommand*{\LWRPrintStack}{}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+\end{warpprint}
+%    \end{macrocode}
+
+
+
+
 % \section{Closing stack levels}
 
 % \codehtml
@@ -11530,15 +11987,27 @@
 % Close everything up to the given depth:
 %    \begin{macrocode}
 \newcommand*{\LWR at closeprevious}[1]{
+\LWR at traceinfo{LWR at closeprevious to depth #1, depths are \LWR at subprintstack}%
 %    \end{macrocode}
 % Close any pending paragraph:
 %    \begin{macrocode}
-\LWR at stoppars
+\LWR at stoppars%
 %    \end{macrocode}
-% Close anything nested deeper than the desired depth:
+% Close anything nested deeper than the desired depth.
+% First close anything deeper, then at most one of the same level.
+% \changes{v0.46}{2018/01/18}{Fix: Stack unnesting.}
 %    \begin{macrocode}
-\whileboolexpr{not test{\ifnumcomp{\LWR at closedepthone}{<}{#1}}}%
-    {\LWR at closeoneprevious}
+\whileboolexpr{test{\ifnumcomp{\LWR at closedepthone}{>}{#1}}}%
+{%
+    \LWR at traceinfo{LWR at closeprevious: closing out depth \LWR at closedepthone}%
+    \LWR at closeoneprevious%
+}%
+\ifboolexpr{test{\ifnumcomp{\LWR at closedepthone}{=}{#1}}}%
+{%
+    \LWR at traceinfo{LWR at closeprevious: closing out depth \LWR at closedepthone}%
+    \LWR at closeoneprevious%
+}{}%
+\LWR at traceinfo{LWR at closeprevious: done, depths are \LWR at subprintstack}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -11566,9 +12035,12 @@
 % Reduces the chance of an environment overflowing the \HTML\ \PDF\ output page.
 %
 % \changes{v0.28}{2017/04/13}{Forces new PDF page before major environments.}
+% \changes{v0.46}{2018/01/20}{Fix: Improper \cs{prevdepth}.}
 %    \begin{macrocode}
 \newcommand{\LWR at forcenewpage}{%
+\ifinner\else%
 \LWR at stoppars\LWR at orignewpage\LWR at startpars%
+\fi%
 }
 %    \end{macrocode}
 %
@@ -11632,9 +12104,9 @@
 %
 %
 %
-% \begin{macro}{\pagenumbering} \marg{commands}
+% \begin{macro}{\pagenumbering} * \marg{commands}
 %    \begin{macrocode}
-\renewcommand*{\pagenumbering}[1]{}
+\RenewDocumentCommand{\pagenumbering}{s m}{}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -11670,9 +12142,9 @@
 \newcommand*{\LWR at tagsubsectionend}{/h5}
 \newcommand*{\LWR at tagsubsubsection}{h6}
 \newcommand*{\LWR at tagsubsubsectionend}{/h6}
-\newcommand*{\LWR at tagparagraph}{span class="paragraph"{}}
+\newcommand*{\LWR at tagparagraph}{span class="paragraph"}
 \newcommand*{\LWR at tagparagraphend}{/span}
-\newcommand*{\LWR at tagsubparagraph}{span class="subparagraph"{}}
+\newcommand*{\LWR at tagsubparagraph}{span class="subparagraph"}
 \newcommand*{\LWR at tagsubparagraphend}{/span}
 
 \newcommand*{\LWR at tagregularparagraph}{p}
@@ -11687,6 +12159,7 @@
 % \changes{v0.36}{2017/08/15}{\pkg{babel-french}: Adjustements for French variants,
 %   load order, footnotes, ellipses.}
 % \changes{v0.37}{2017/08/19}{\pkg{babel-french}: Adjustment for load order.}
+% \changes{v0.45}{2017/12/29}{\pkg{babel-french}: Robust commands.}
 %
 % Adjust \pkg{babel-french} for \HTML\ spaces.
 % So far, this only works for |pdflatex| and |xelatex|.
@@ -11706,19 +12179,19 @@
 %    \begin{macrocode}
 %
     \LetLtxMacro\LWR at FBcancel\NoAutoSpacing%
-    \renewcommand*{\FBcolonspace}{%
+    \renewrobustcmd*{\FBcolonspace}{%
         \begingroup%
         \LWR at FBcancel%
         \LWR at origampersand{}nbsp;%
         \endgroup%
     }%
-    \renewcommand*{\FBthinspace}{%
+    \renewrobustcmd*{\FBthinspace}{%
         \begingroup%
         \LWR at FBcancel%
         \LWR at origampersand\#x202f;% \,
         \endgroup%
     }%
-    \renewcommand*{\FBguillspace}{%
+    \renewrobustcmd*{\FBguillspace}{%
         \begingroup%
         \LWR at FBcancel%
         \LWR at origampersand{}nbsp;% ~,  for \og xyz \fg{}
@@ -11736,7 +12209,7 @@
         \LWR at origampersand{}nbsp;% ~
         \endgroup%
     }%
-    \renewcommand*{~}{\HTMLentity{nbsp}}% was overwritten by babel-french
+    \renewrobustcmd*{~}{\HTMLentity{nbsp}}% was overwritten by babel-french
     \ifFBunicode%
     \else%
         \DeclareTextSymbol{\FBtextellipsis}{LY1}{133}%
@@ -11749,7 +12222,6 @@
 
 % \subsection{HTML tags}
 
-
 % \begin{macro}{\LWR at htmltagc} \marg{tag}
 % Break ligatures and use upright apostrophes in \HTML\ tags.
 %
@@ -11757,11 +12229,13 @@
 %    \begin{macrocode}
 \newcommand*{\LWR at htmltagc}[1]{%
 {%
-% \LWR at traceinfo{LWR at htmltagc \detokenize{#1}}%
+\LWR at traceinfo{LWR at htmltagc !\detokenize{#1}!}%
 \begingroup%
 \LWR at FBcancel%
 \ifmmode\else\protect\LWR at origttfamily\fi%
-\protect\LWR at origtextless#1\protect\LWR at origtextgreater%
+\protect\LWR at origtextless%
+#1%
+\protect\LWR at origtextgreater%
 \endgroup%
 }%
 }
@@ -11793,7 +12267,7 @@
 
 \newenvironment*{LWR at nestspan}
 {%
-\LWR at traceinfo{LWR at nestspan}%
+\LWR at traceinfo{LWR at nestspan starting}%
 \ifnumcomp{\value{LWR at lateximagedepth}}{>}{0}%
 {%
     \LWR at traceinfo{LWR at nestspan: inside a lateximage}%
@@ -11810,12 +12284,14 @@
     }%
     \renewcommand{\LWR at listend}{\LWR at htmltagc{br /}\LWR at htmltagc{br /}}%
 }% not in a lateximage
+\LWR at traceinfo{LWR at nestspan starting: done}%
 }% starting env
 {% ending env
+\LWR at traceinfo{LWR at nestspan ending}%
 \ifnumcomp{\value{LWR at lateximagedepth}}{>}{0}%
 {}%
 {\addtocounter{LWR at spandepth}{-1}}%
-\LWR at traceinfo{LWR at nestspan: done}%
+\LWR at traceinfo{LWR at nestspan ending: done}%
 }
 
 \AfterEndEnvironment{LWR at nestspan}{\global\let\par\LWR at closeparagraph}
@@ -11867,15 +12343,11 @@
 
 % Print an \HTML\ tag: \textless{}tag\textgreater{}
 %    \begin{macrocode}
-\newcommand*{\LWR at htmltagb}[1]{%
+\newcommand*{\LWR at htmltag}[1]{%
+% \LWR at traceinfo{LWR at htmltagb !\detokenize{#1}!}%
 \LWR at htmltagc{#1}%
-\endgroup%
+% \LWR at traceinfo{LWR at htmltagb: done}%
 }
-
-\newcommand*{\LWR at htmltag}{%
-\begingroup\catcode`\_=12
-\LWR at htmltagb%
-}
 %    \end{macrocode}
 % \end{macro}
 
@@ -11925,16 +12397,12 @@
 \LWR at htmlclosecomment{}}
 %    \end{macrocode}
 % \end{macro}
+%
+%
 % \begin{macro}{\LWR at htmlblockcomment} \marg{comment}
 %    \begin{macrocode}
-\newcommand{\LWR at htmlblockcommentb}[1]
-{\LWR at stoppars\LWR at htmlcomment{#1}\LWR at startpars\endgroup}
-
-\newcommand{\LWR at htmlblockcomment}
-{%
-\begingroup\catcode`\_=12
-\LWR at htmlblockcommentb%
-}
+\newcommand{\LWR at htmlblockcomment}[1]
+{\LWR at stoppars\LWR at htmlcomment{#1}\LWR at startpars}
 %    \end{macrocode}
 % \end{macro}
 
@@ -12095,12 +12563,8 @@
 %    \begin{macrocode}
 \begin{warpHTML}
 \NewDocumentEnvironment{BlockClass}{o m}%
-{
-\LWR at htmldivclass[#1]{#2}
-}
-{
-\LWR at htmldivclassend{#2}
-}
+{\LWR at htmldivclass[#1]{#2}}
+{\LWR at htmldivclassend{#2}}
 \end{warpHTML}
 %    \end{macrocode}
 % 
@@ -12174,10 +12638,10 @@
 \LWR at stoppars%
 \ifbool{FormatWP}%
 {%
-    \LWR at maybeincthisautoid%
+    \addtocounter{LWR at thisautoidWP}{1}%
     \LWR at htmltag{%
         div class="#3" %
-        id="autoid-\arabic{LWR at thisautoid}"%
+        id="autoidWP-\arabic{LWR at thisautoidWP}"%
         \ifblank{#1}{}{ style="#1"}%
     }%
 }% FormatWP
@@ -12342,19 +12806,6 @@
     {% yes nest par tags
         \LWR at htmltagc{\LWR at tagregularparagraph}%
 %    \end{macrocode}
-% Manually indent item list labels to avoid left margin intrustion:
-%
-% See if are nested inside an item list:
-%    \begin{macrocode}
-        \ifnumcomp{\@listdepth}{>}{0}%
-        {%
-%    \end{macrocode}
-% If so,  leave some horizontal room in the \LaTeX{} \PDF\ output for list labels:
-%    \begin{macrocode}
-        \LWR at orighspace{1in}%
-        }%
-        {}%
-%    \end{macrocode}
 % Now have started a paragraph.
 %    \begin{macrocode}
         \global\booltrue{LWR at doingapar}%
@@ -12438,9 +12889,25 @@
     {}%
 }% not handling pars
 %    \end{macrocode}
-% Finish with regular paragraph processing
+% In most cases, finish with a \LaTeX\ \cs{par}, but in the case
+% of paragraphs between lines in a tabular fetch the next token instead:
+% \changes{v0.46}{2018/01/19}{Fix: Tabular empty lines.}
 %    \begin{macrocode}
-\LWR at origpar%
+\ifboolexpr{%
+    not bool {LWR at doingapar} and
+    test {\ifnumcomp{\value{LWR at tabulardepth}}{>}{0}} and
+    test {
+        \ifnumcomp{\value{LWR at tabulardepth}}{=}{\value{LWR at tabularpardepth}}
+    } and
+    bool {LWR at intabularmetadata} and
+    not bool {LWR at tableparcell} and
+    test {\ifnumcomp{\value{LWR at lateximagedepth}}{=}{0}}
+}%
+{%
+    \LWR at getmynexttoken%
+}{%
+    \LWR at origpar%
+}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -12473,6 +12940,7 @@
 %    \begin{macrocode}
 \newcommand*{\LWR at startpars}%
 {%
+\LWR at traceinfo{LWR at startpars}%
 %    \end{macrocode}
 % Ignore if inside a span:
 %    \begin{macrocode}
@@ -12493,6 +12961,7 @@
     {%
 %    \end{macrocode}
 %	At the start of each paragraph, generate an opening tag:
+% \index{par=\cs{par}>hooks}
 %    \begin{macrocode}
         \PushPreHook{par}{\LWR at openparagraph}%
 %    \end{macrocode}
@@ -12510,6 +12979,7 @@
 %    \begin{macrocode}
     \global\boolfalse{LWR at doingapar}%
 }% nestspan
+\LWR at traceinfo{LWR at startpars: done}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -12603,31 +13073,21 @@
 \newcommand{\LWR at firstpagetop}{}	% for the home page alone
 \newcommand{\LWR at pagetop}{}			% for all other pages
 \newcommand{\LWR at pagebottom}{}
-
-\newcommand{\LWR at setfirstpagetopb}[1]{%
-\renewcommand{\LWR at firstpagetop}{#1}
-\catcode`\_=8
-}
 %    \end{macrocode}
+%
+%
 % \begin{macro}{\HTMLFirstPageTop} \marg{text and logos}
 %
 % \changes{v0.30}{2017/04/28}{Renamed from \cs{SetFirstPageTop}.}
 %
 %    \begin{macrocode}
-\newcommand{\HTMLFirstPageTop}{%
-\catcode`\_=12
-\LWR at setfirstpagetopb
+\newcommand{\HTMLFirstPageTop}[1]{%
+    \renewcommand{\LWR at firstpagetop}{#1}%
 }
 %    \end{macrocode}
 %
 %
 % \end{macro}
-%    \begin{macrocode}
-\newcommand{\LWR at setpagetopb}[1]{%
-\renewcommand{\LWR at pagetop}{#1}
-\catcode`\_=8
-}
-%    \end{macrocode}
 %
 %
 % \begin{macro}{\HTMLPageTop} \marg{text and logos}
@@ -12635,30 +13095,20 @@
 % \changes{v0.30}{2017/04/28}{Renamed from \cs{SetPageTop}.}
 %
 %    \begin{macrocode}
-\newcommand{\HTMLPageTop}{%
-\catcode`\_=12
-\LWR at setpagetopb
+\newcommand{\HTMLPageTop}[1]{%
+    \renewcommand{\LWR at pagetop}{#1}%
 }
 %    \end{macrocode}
 % \end{macro}
 %
 %
-%    \begin{macrocode}
-\newcommand{\LWR at setpagebottomb}[1]{%
-\renewcommand{\LWR at pagebottom}{#1}
-\catcode`\_=8
-}
-%    \end{macrocode}
-%
-%
 % \begin{macro}{\HTMLPageBottom} \marg{text and logos}
 %
 % \changes{v0.30}{2017/04/28}{Renamed from \cs{SetPageBottom}.}
 %
 %    \begin{macrocode}
-\newcommand{\HTMLPageBottom}{%
-\catcode`\_=12
-\LWR at setpagebottomb
+\newcommand{\HTMLPageBottom}[1]{%
+    \renewcommand{\LWR at pagebottom}{#1}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -12690,17 +13140,14 @@
 % Assigns the \CSS\ file to be used by the following \HTML\ pages.
 %
 % \changes{v0.30}{2017/04/28}{Renamed from \cs{NewCSS}.}
+% \changes{v0.45}{2017/12/29}{Improved filenames with underscores.}
 %
 %    \begin{macrocode}
-\newcommand*{\LWR at newcssb}[1]{%
-\renewcommand*{\LWR at currentcss}{#1}
-\catcode`\_=8
+\newcommand*{\CSSFilename}[1]{%
+\renewcommand*{\LWR at currentcss}{#1}%
+\@onelevel at sanitize\LWR at currentcss%
 }
 
-\newcommand*{\CSSFilename}{
-\catcode`\_=12
-\LWR at newcssb
-}
 \end{warpHTML}
 %    \end{macrocode}
 %
@@ -12886,7 +13333,10 @@
 %    \end{macrocode}
 
 
-% Patch \LaTeX\ footnotes to use a new \cs{box} for \pkg{lwarp} footnotes.
+% Patch \LaTeX\ footnotes to use a new \cs{box} instead of an insert
+% for \pkg{lwarp} footnotes.
+% This avoids having the original \cs{footins} appear
+% at the bottom of a \env{lateximage}, which is on its own new page.
 %    \begin{macrocode}
 \newbox\LWR at footnotes
 %    \end{macrocode}
@@ -12895,7 +13345,7 @@
 %
 % \begin{macro}{\@makefntext} \marg{text}
 %    \begin{macrocode}
-\long\def\@makefntext#1{\textsuperscript{\@thefnmark} #1}
+\long\def\@makefntext#1{\textsuperscript{\@thefnmark}~#1}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -12991,11 +13441,19 @@
 % \subsection{Minipage footnote implementation}
 % \label{sec:footnotesminipage}
 %
+% Patch \LaTeX\ minipage footnotes to use a new \cs{box} instead of an insert
+% for \pkg{lwarp} minipage footnotes.
+% This avoids having the original \cs{@mpfootins} appear
+% at the bottom of a \env{lateximage}, which is on its own new page.
+%    \begin{macrocode}
+\newbox\LWR at mpfootnotes
+%    \end{macrocode}
+%
 % \begin{macro}{\@mpfootnotetext} \marg{text}
 %    \begin{macrocode}
 \long\def\@mpfootnotetext#1{%
-\global\setbox\@mpfootins\vbox{%
-    \unvbox\@mpfootins
+\global\setbox\LWR at mpfootnotes\vbox{%
+    \unvbox\LWR at mpfootnotes
     \reset at font\footnotesize
     \hsize\columnwidth
     \@parboxrestore
@@ -13067,7 +13525,26 @@
 %    \end{macrocode}
 % \end{macro}
 
+% \begin{macro}{\LWR at printpendingmpfootnotes}
+% Enclose the minipage footnotes in a class, print, then clear.
+% \changes{v0.45}{2018/01/10}{Added.}
 %    \begin{macrocode}
+\newcommand*{\LWR at printpendingmpfootnotes}{%
+\ifvoid\LWR at mpfootnotes\else
+    \LWR at forcenewpage
+    \begin{BlockClass}{footnotes}
+    \LWR at origvspace*{\baselineskip}
+    \unvbox\LWR at mpfootnotes
+    \setbox\LWR at mpfootnotes=\vbox{}
+    \end{BlockClass}
+\fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+
+
+%    \begin{macrocode}
 \end{warpHTML}
 %    \end{macrocode}
 
@@ -13132,8 +13609,24 @@
 %    \end{macrocode}
 % \end{macro}
 %
-
+%
+% \begin{macro}{\reversemarginpar}
+% \changes{v0.45}{2017/12/12}{Added.}
 %    \begin{macrocode}
+\renewcommand*{\reversemarginpar}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\normalmarginpar}
+% \changes{v0.45}{2017/12/12}{Added.}
+%    \begin{macrocode}
+\renewcommand*{\normalmarginpar}{}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%    \begin{macrocode}
 \end{warpHTML}
 %    \end{macrocode}
 
@@ -13237,14 +13730,16 @@
 % Locally temporarily disable direct-formatting commands,
 % not used in filenames:
 %    \begin{macrocode}
-\LWR at nullfonts
+\LWR at nullfonts%
 \renewcommand*{\LWR at htmltagc}[1]{}%
 %    \end{macrocode}
 % Replaces common symbols and short words with hyphens:
 %
 %    \begin{macrocode}
-\edef\LWR at thisnewfilename{#1}
-\fullexpandarg
+\LWR at traceinfo{LWR at filenamenoblanks \#1: !#1!}%
+\edef\LWR at thisnewfilename{#1}%
+\LWR at traceinfo{LWR at filenamenoblanks edef: !\LWR at thisnewfilename!}%
+\fullexpandarg%
 %    \end{macrocode}
 % Convert spaces into hyphens:
 %    \begin{macrocode}
@@ -13271,6 +13766,14 @@
 \StrSubstitute{\LWR at thisnewfilename}%
     {\textgreater}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{\#}{-}[\LWR at thisnewfilename]
+%    \end{macrocode}
+% \changes{v0.45}{2017/12/29}{Fix: Section names with underscores.}
+%    \begin{macrocode}
+\StrSubstitute{\LWR at thisnewfilename}{\_}{-}[\LWR at thisnewfilename]
+%    \end{macrocode}
+% \changes{v0.45}{2017/12/29}{Fix: Section names with \cs{\ }.}
+%    \begin{macrocode}
+\StrSubstitute{\LWR at thisnewfilename}{\ }{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{\%}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{\{}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{\}}{-}[\LWR at thisnewfilename]
@@ -13278,6 +13781,7 @@
 \StrSubstitute{\LWR at thisnewfilename}%
     {\textbackslash}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{^}{-}[\LWR at thisnewfilename]
+\StrSubstitute{\LWR at thisnewfilename}{~}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{~{}}{-}[\LWR at thisnewfilename]
 %     "~{}" for babel
 \StrSubstitute{\LWR at thisnewfilename}{[}{-}[\LWR at thisnewfilename]
@@ -13335,6 +13839,7 @@
 % navigation, side TOC, header, and starts the text body.
 %    \begin{macrocode}
 \newcommand*{\LWR at newhtmlfile}[1]{
+\LWR at traceinfo{LWR at newhtmlfile: !#1!}
 %    \end{macrocode}
 
 % At the bottom of the ending file:
@@ -13393,6 +13898,7 @@
 % Uses pipe-separated fields for |split_html.gawk|.
 % Uses monospaced font with ligatures disabled for everything except the title.
 %    \begin{macrocode}
+\LWR at traceinfo{LWR at newhtmlfile: about to print start file}%
 \LWR at htmlblockcomment{%
 |Start file|%
 \LWR at htmlsectionfilename{\LWR at thisfilename}|%
@@ -13465,6 +13971,7 @@
 % Track the page numbers:
 %    \begin{macrocode}
 \setcounter{LWR at latestautopage}{\value{page}}
+\LWR at traceinfo{LWR at newhtmlfile: done}
 }
 %    \end{macrocode}
 % \end{macro}
@@ -13632,7 +14139,7 @@
 % Create an autosection tag.
 %    \begin{macrocode}
 \newcommand*{\LWR at createautosec}[1]{%
-\LWR at htmltag{#1 id="autosec-\thepage"{}}%
+\LWR at htmltag{#1 id="autosec-\arabic{page}"}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -13647,7 +14154,10 @@
 % |\LWR at stoppars| must be executed first.
 % \watchout
 %    \begin{macrocode}
-\NewDocumentCommand{\LWR at pushoneclose}{m m}{\pushclose{#2}{#1}}
+\NewDocumentCommand{\LWR at pushoneclose}{m m}{%
+\LWR at traceinfo{LWR at pushoneclose #1}%
+    \pushclose{#2}{#1}%
+}
 %    \end{macrocode}
 % \end{macro}
 
@@ -13755,7 +14265,7 @@
 % Generate a new \LaTeX\ page so that \TOC\ and index page number points to the section:
 %    \begin{macrocode}
 \LWR at traceinfo{LWR at section: testing whether to start a new HTML file}%
-\IfBooleanTF{#1}{\LWR at traceinfo{LWR at section: starred}}{}%
+\IfBooleanT{#1}{\LWR at traceinfo{LWR at section: starred}}%
 \ifbool{LWR at forcinghtmlpage}{\LWR at traceinfo{LWR at section: forcinghtmlpage}}{}%
 \ifthenelse{%
     \(%
@@ -13774,7 +14284,11 @@
 %    \end{macrocode}
 % \changes{v0.43}{2017/10/31}{Fix: Expansion in comparison.}
 %    \begin{macrocode}
-    \NOT\isempty{#3}% phantomsection
+    \(% phantomsection
+        \NOT\isempty{#3}%
+        \OR%
+        \(\NOT\equal{#1}{\BooleanTrue}\)%
+    \)%
 }%
 %    \end{macrocode}
 % If so: start a new \HTML\ file:
@@ -13801,7 +14315,7 @@
 %    \end{macrocode}
 % Generate a new \LaTeX\ page so that \TOC\ and index page number points to the section:
 %    \begin{macrocode}
-    \LWR at traceinfo{LWR at section: not a new HTML file}%
+    \LWR at traceinfo{LWR at section: not a new HTML file, about to LWR at orignewpage}%
     \LWR at orignewpage%
 
 }% not new file
@@ -13836,6 +14350,7 @@
 %    \end{macrocode}
 % Create the opening tag with an autosec:
 %    \begin{macrocode}
+\LWR at traceinfo{LWR at section: about to LWR at createautosec}%
 \LWR at createautosec{\csuse{LWR at tag#4}}%
 %    \end{macrocode}
 % \changes{v0.43}{2017/11/01}{Fix: Math in section name.}
@@ -13846,6 +14361,7 @@
 %    \begin{macrocode}
 \IfBooleanTF{#1}%
 {%
+\LWR at traceinfo{LWR at section: starred}%
 %    \end{macrocode}
 % Starred, but also forcing a TOC entry, so
 % add unnumbered TOC name or regular name:
@@ -13930,15 +14446,18 @@
 %    \end{macrocode}
 % Print the section name:
 %    \begin{macrocode}
+\LWR at traceinfo{LWR at section: about to print the section name}%
 #3%
 %    \end{macrocode}
 % Close the heading tag, such as /H2:
 %    \begin{macrocode}
+\LWR at traceinfo{LWR at section: about to close the heading tag}%
 \LWR at htmltag{\csuse{LWR at tag#4end}}%
 %    \end{macrocode}
 % Generate a \LaTeX{} label:
 % \changes{v0.43}{2017/11/01}{Fix: Math in section name.}
 %    \begin{macrocode}
+\LWR at traceinfo{LWR at section: about to create the LaTeX label}%
 \label{autopage-\theLWR at currentautosec}%
 %    \end{macrocode}
 % Start paragraph handing unless is an inline paragraph or subparagraph:
@@ -14012,11 +14531,12 @@
 % \end{macro}
 
 
-% \begin{macro}{\chapter} * \oarg{TOC name} \marg{name}
+% \begin{macro}{\chapter} * \oarg{TOC name} \oarg{heading name} \marg{name}
 %
 % \changes{v0.28}{2017/04/06}{If \EPUB, prints footnotes before each section.}
 % \changes{v0.40}{2017/09/22}{Added support for \pkg{quotchap}.}
 % \changes{v0.44}{2017/11/21}{Add preamble for \pkg{koma-script}.}
+% \changes{v0.45}{2017/12/04}{Add optional heading title for \pkg{memoir}.}
 %    \begin{macrocode}
 \let\@printcites\relax% for quotchap package
 
@@ -14025,14 +14545,18 @@
 \@ifundefined{chapter}
 {}
 {%
-\DeclareDocumentCommand{\chapter}{s o m}{%
-\LWR at traceinfo{chapter #3}%
+\DeclareDocumentCommand{\chapter}{s o o m}{%
+\IfValueTF{#2}{
+\LWR at traceinfo{chapter #2}%
+}{
+\LWR at traceinfo{chapter #4}%
+}
 \LWR at maybeprintpendingfootnotes{\LWR at depthchapter}%
 \LWR at stoppars%
 
 \LWR at startnewdepth{\LWR at depthchapter}{\LWR at printclosechapter}%
 
-\LWR at section{#1}{#2}{#3}{chapter}%
+\LWR at section{#1}{#2}{#4}{chapter}%
 
 \@printcites% for quotchap package
 
@@ -14044,15 +14568,21 @@
 % \end{macro}
 
 
-% \begin{macro}{\section} * \oarg{TOC name} \marg{name}
+% \begin{macro}{\section} * \oarg{TOC name} \oarg{heading name} \marg{name}
+% \changes{v0.45}{2017/12/04}{Add optional heading title for \pkg{memoir}.}
 %    \begin{macrocode}
-\DeclareDocumentCommand{\section}{s o m}{%
+\DeclareDocumentCommand{\section}{s o o m}{%
+\IfValueTF{#2}{
+\LWR at traceinfo{section #2}%
+}{
+\LWR at traceinfo{section #4}%
+}
 \LWR at maybeprintpendingfootnotes{\LWR at depthsection}%
 \LWR at stoppars%
 
 \LWR at startnewdepth{\LWR at depthsection}{\LWR at printclosesection}%
 
-\LWR at section{#1}{#2}{#3}{section}%
+\LWR at section{#1}{#2}{#4}{section}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -14186,7 +14716,7 @@
 %    \end{macrocode}
 % The language is user-adjustable:
 %    \begin{macrocode}
-\LWR at htmltag{html lang="\LWR at currentHTMLLanguage"{}}\LWR at orignewline
+\LWR at htmltag{html lang="\LWR at currentHTMLLanguage"}\LWR at orignewline
 %    \end{macrocode}
 % Start of the meta data:
 %    \begin{macrocode}
@@ -14234,7 +14764,7 @@
 %    \begin{macrocode}
 \LWR at htmltag{!{-}{-}[if lt IE 9]}\LWR at orignewline
 \LWR at htmltag{%
-script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"{}}%
+script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"}%
 \LWR at htmltag{/script}\LWR at orignewline
 \LWR at htmltag{![endif]{-}{-}}\LWR at orignewline
 %    \end{macrocode}
@@ -14330,7 +14860,7 @@
 % Force onecolumn and empty page style:
 %    \begin{macrocode}
 \LWR at origonecolumn%
-\LWR at origpagestyle{empty}
+\LWR at origpagestyle{empty}%
 %    \end{macrocode}
 % Reduce chance of line overflow in verbatim environments:
 %    \begin{macrocode}
@@ -14415,6 +14945,12 @@
 \global\boolfalse{LWR at doingapar}
 \global\boolfalse{LWR at doingstartpars}
 %    \end{macrocode}
+% Document and page settings:
+% \changes{v0.45}{2017/12/08}{Fix: Lateximages on incorrect pages with Mathjax.}
+%    \begin{macrocode}
+\mainmatter
+\LWR at origpagenumbering{arabic}
+%    \end{macrocode}
 % Start a new \HTML\ file and a header:
 %    \begin{macrocode}
 \LWR at traceinfo{LWR at lwarpStart: Starting new file.}
@@ -14426,13 +14962,8 @@
 \LWR at stoppars
 \LWR at htmltag{/header}\LWR at orignewline
 \LWR at traceinfo{LWR at lwarpStart: Generating textbody.}
-\LWR at htmltag{section class="textbody"{}}
+\LWR at htmltag{section class="textbody"}
 %    \end{macrocode}
-% Document and page settings:
-%    \begin{macrocode}
-\mainmatter
-\LWR at origpagenumbering{arabic}
-%    \end{macrocode}
 %
 % Patch the |itemize|, |enumerate|, and |description| environments and \cs{item}.
 % This works with the native \LaTeX\ environments, as well as
@@ -14728,11 +15259,12 @@
 %
 % \begin{environment}{titlepage}
 % Sets up a \element{div} of class \attribute{titlepage}.
+% Provided even for \pkg{memoir} class, since it is used by \cs{maketitle}.
 %
 % \changes{v0.39}{2017/09/02}{Clear pending footnotes.}
 % \changes{v0.39}{2017/09/03}{Removed minipages.}
 %    \begin{macrocode}
-\renewenvironment*{titlepage}
+\DeclareDocumentEnvironment{titlepage}{}
 {
 \renewrobustcmd{\affiliation}[1]{\\ \InlineClass{affiliation}{##1}}
 \LWR at printpendingfootnotes
@@ -14819,7 +15351,7 @@
 % \begin{macro}{\printauthor}
 %   \HTML\ version.
 %
-% \changes{v0.39}{2017/09/01}{Supports \protect\pkg{authblk} with
+% \changes{v0.39}{2017/09/01}{Supports \pkg{authblk} with
 % \element{div}s of class \attribute{oneauthor} instead of tabular.}
 % \changes{v0.39}{2017/09/03}{Removed minipages.}
 %
@@ -14922,6 +15454,12 @@
 %
 %
 %    \begin{macrocode}
+\@ifclassloaded{memoir}
+{
+\newcommand{\LWR at setfootnoteseries}{%
+    \renewcommand\thefootnote{\@arabic\c at footnote}%
+}
+}{% not memoir
 \if at titlepage
 \newcommand{\LWR at setfootnoteseries}{%
     \renewcommand\thefootnote{\@arabic\c at footnote}%
@@ -14931,6 +15469,7 @@
     \renewcommand\thefootnote{\@fnsymbol\c at footnote}%
 }
 \fi
+}% not memoir
 %    \end{macrocode}
 %
 %
@@ -14962,7 +15501,7 @@
 %    \end{macrocode}
 % Make the footnote mark and some extra horizontal space for the tags:
 %    \begin{macrocode}
-\textsuperscript{\@thefnmark} \LWR at orighspace{1in}
+\textsuperscript{\@thefnmark}~%
 %    \end{macrocode}
 % \begin{center}
 % \begin{minipage}{.7\linewidth}
@@ -15047,7 +15586,7 @@
 % \begin{macro}{\@maketitle}
 %   \HTML\ mode.  Typesets the title, etc.:
 %
-% \changes{v0.39}{2017/09/01}{Supports \protect\pkg{authblk} with
+% \changes{v0.39}{2017/09/01}{Supports \pkg{authblk} with
 % \element{div}s of class \attribute{oneauthor} instead of tabular.}
 % \changes{v0.39}{2017/09/03}{Removed minipages.}
 % \changes{v0.39}{2017/09/04}{Native \protect\LaTeX\ version.}
@@ -15348,7 +15887,7 @@
 % \section{Verbatim and tabbing}
 
 % \changes{v0.34}{2017/07/27}{Verbatim refactored to
-%		remove \protect\pkg{fancyvrb} requirement.}
+%		remove \pkg{fancyvrb} requirement.}
 
 
 % \codeall
@@ -15403,7 +15942,7 @@
 \ifbool{LWR at verbtags}{%
     \LWR at htmltag{pre class="#2"
     \ifthenelse{\equal{#1}{}}{}{style="#1"}%
-}% pre
+}\LWR at orignewline% pre
 }{}%
 %    \end{macrocode}
 % Use a mono-spaced font to preserve horizontal positioning.
@@ -15433,11 +15972,8 @@
 % \begin{macro}{\LWR at afterendverbatim} Finishes enclosing a verbatim environment.
 %    \begin{macrocode}
 \newcommand*{\LWR at afterendverbatim}{%
-%    \end{macrocode}
-% Remove excess vertical space at the end of the |pre|:
-%    \begin{macrocode}
+
 \endgroup%
-\unskip%
 %    \end{macrocode}
 % At the end of the environment, close the |pre|:
 %    \begin{macrocode}
@@ -15480,8 +16016,8 @@
 \AfterEndPreamble{
 \LWR at traceinfo{Patching verbatim.}
 \AtBeginEnvironment{verbatim}{%
-\LWR at forcenewpage
-\LWR at atbeginverbatim{verbatim}\unskip\LWR at origvspace*{-\baselineskip}%
+\LWR at forcenewpage%
+\LWR at atbeginverbatim{verbatim}\unskip\LWR at origvspace*{-2\baselineskip}%
 }
 \AfterEndEnvironment{verbatim}{%
     \unskip\LWR at origvspace*{-\baselineskip}\LWR at afterendverbatim%
@@ -15493,6 +16029,8 @@
 
 % \begin{environment}{tabbing}
 %
+% \limitstabbing
+%
 % \changes{v0.42}{2017/10/13}{Added.}
 %
 %    \begin{macrocode}
@@ -15544,7 +16082,8 @@
 \renewcommand{\@begintheorem}[2]{%
 \LWR at forcenewpage
 \BlockClass{theoremcontents}
-\InlineClass{theoremlabel}{#1\ #2\ }
+\trivlist
+\item[\InlineClass{theoremlabel}{#1\ #2\ }]\itshape
 }
 %    \end{macrocode}
 % \end{macro}
@@ -15553,7 +16092,8 @@
 \renewcommand{\@opargbegintheorem}[3]{%
 \LWR at forcenewpage
 \BlockClass{theoremcontents}
-\InlineClass{theoremlabel}{#1\ #2\ (#3)\ }
+\trivlist
+\item[\InlineClass{theoremlabel}{#1\ #2\ (#3)\ }]\itshape
 }
 %    \end{macrocode}
 % \end{macro}
@@ -15560,6 +16100,7 @@
 % \begin{macro}{\@endtheorem}
 %    \begin{macrocode}
 \renewcommand*{\@endtheorem}{%
+\endtrivlist
 \endBlockClass% theoremcontents
 }
 %    \end{macrocode}
@@ -15618,6 +16159,156 @@
 \newcommand*{\LWR at printopenlist}{ul style="list-style-type:none"}
 %    \end{macrocode}
 
+
+% ^^A \begin{macro}{\LWR@@labels} \pkg{lwarp} replacement for \cs{\@labels}.
+% ^^A \changes{v0.45}{2018/01/11}{Added.}
+% ^^A    \begin{macrocode}
+% ^^A \newcommand{\LWR@@labels}{}% no longer needed
+% ^^A    \end{macrocode}
+% ^^A \end{macro}
+
+
+% \begin{macro}{\@mklab}
+% Removes \PDF\ spacing.
+% \changes{v0.45}{2018/01/11}{Modified for \HTML.}
+%    \begin{macrocode}
+\def\@mklab#1{%
+%     \hfil %
+    #1}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\@donoparitem}
+% Modified for \HTML\ output by replacing \TeX\ boxes with plain text.
+% Also removes \PDF\ spacing.
+% \changes{v0.45}{2018/01/11}{Modified for \HTML.}
+%    \begin{macrocode}
+\def\@donoparitem{%
+  \@noparitemfalse
+%   \global\setbox\@labels\hbox{\hskip -\leftmargin
+%                                \unhbox\@labels
+%                                 \hskip \leftmargin}%
+%   \if at minipage\else
+%     \@tempskipa\lastskip
+%     \vskip -\lastskip
+%     \advance\@tempskipa\@outerparskip
+%     \advance\@tempskipa -\parskip
+%     \vskip\@tempskipa
+%   \fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \begin{macro}{\@item}
+% Modified for \HTML\ output by replacing \TeX\ boxes with plain text.
+% Also removes \PDF\ spacing.
+% \changes{v0.45}{2018/01/11}{Modified for \HTML.}
+%    \begin{macrocode}
+\def\@item[#1]{%
+  \if at noparitem
+    \@donoparitem
+  \else
+%     \if at inlabel
+%       \indent
+        \par
+%     \fi
+    \ifhmode
+%       \unskip\unskip
+        \par
+    \fi
+    \if at newlist
+      \if at nobreak
+        \@nbitem
+      \else
+%         \addpenalty\@beginparpenalty
+%         \addvspace\@topsep
+%         \addvspace{-\parskip}%
+      \fi
+    \else
+%       \addpenalty\@itempenalty
+%       \addvspace\itemsep
+    \fi
+    \global\@inlabeltrue
+  \fi
+%   \everypar{%
+    \@minipagefalse
+    \global\@newlistfalse
+%    \end{macrocode}
+%    \begin{macrocode}
+%     \if at inlabel
+%       \global\@inlabelfalse
+%    \end{macrocode}
+%    \begin{macrocode}
+%       {\setbox\z@\lastbox
+%        \ifvoid\z@
+%          \kern-\itemindent
+%        \fi}%
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%         \LWR@@labels
+%         \renewcommand{\LWR@@labels}{}
+%       \box\@labels
+%       \penalty\z@
+%     \fi
+%    \end{macrocode}
+%    \begin{macrocode}
+%     \if at nobreak
+%       \@nobreakfalse
+%       \clubpenalty \@M
+%     \else
+%       \clubpenalty \@clubpenalty
+%       \everypar{}%
+%     \fi}%
+%    \end{macrocode}
+%    \begin{macrocode}
+  \if at noitemarg
+    \@noitemargfalse
+    \if at nmbrlist
+%    \end{macrocode}
+%    \begin{macrocode}
+      \refstepcounter\@listctr
+    \fi
+  \fi
+%    \end{macrocode}
+%    \begin{macrocode}
+%     \appto{\LWR@@labels}{\makelabel{#1}}%
+%     \makelabel{#1}
+        #1
+%   \sbox\@tempboxa{\makelabel{#1}%
+%   \global\setbox\@labels\hbox{%
+%     \unhbox\@labels
+%     \hskip \itemindent
+%     \hskip -\labelwidth
+%     \hskip -\labelsep
+%     \ifdim \wd\@tempboxa >\labelwidth
+%       \box\@tempboxa
+%    \end{macrocode}
+%    \begin{macrocode}
+%     \else
+%       \hbox to\labelwidth {\unhbox\@tempboxa}%
+%     \fi
+%     \hskip \labelsep}%
+  \ignorespaces%
+}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\@nbitem}
+%    \begin{macrocode}
+\def\@nbitem{%
+%   \@tempskipa\@outerparskip
+%   \advance\@tempskipa -\parskip
+%   \addvspace\@tempskipa
+}
+%    \end{macrocode}
+% \end{macro}
+%
+
+
 % \begin{macro}{\LWR at listitem} \oarg{label}
 %
 % Handles \cs{item} inside a \env{list}, \env{itemize}, or \env{enumerate}.
@@ -15641,6 +16332,7 @@
 % \changes{v0.44}{2017/11/15}{Added \env{list} and \env{trivlist}.}
 %    \begin{macrocode}
 \newcommand*{\LWR at liststart}{%
+\LWR at traceinfo{LWR at liststart}%
 \LWR at stoppars%
 \LWR at pushoneclose{\LWR at depthlist}{\LWR at printcloselist}%
 \LWR at htmltag{\LWR at printopenlist}\LWR at orignewline%
@@ -15655,11 +16347,13 @@
 \setlength{\itemindent}{0pt}%
 \setlength{\labelsep}{1em}%
 }
-
+%    \end{macrocode}
+% \changes{v0.46}{2018/01/21}{Fix: Stack unnesting.}
+%    \begin{macrocode}
 \newcommand*{\LWR at listend}{%
+\LWR at traceinfo{LWR at listend}%
 \LWR at stoppars%
-\LWR at closeprevious{\LWR at depthlistitem}%
-\LWR at closeoneprevious%
+\LWR at closeprevious{\LWR at depthlist}%
 \LWR at startpars%
 }
 %    \end{macrocode}
@@ -15737,10 +16431,6 @@
 % Restore \cs{hspace} for use in the item text:
 %    \begin{macrocode}
 \LetLtxMacro{\hspace}{\LWR at hspace}%
-%    \end{macrocode}
-% Be sure the label doesn't print to the left of the rest of the file:
-%    \begin{macrocode}
-\LWR at orighspace{1in}
 \LWR at htmltag{dt}#1\LWR at htmltag{/dt}%
 \LWR at orignewline%
 \LWR at htmltag{dd}%
@@ -15782,11 +16472,18 @@
 \newcommand*{\LWR at patchlists}{%
     \let\item\LWR at listitem%
     \renewcommand*{\@trivlist}{%
+        \LWR at traceinfo{@trivlist start}%
         \LWR at liststart%
         \LWR at orig@trivlist%
+        \LWR at traceinfo{@trivlist done}%
     }%
-    \renewcommand*{\endtrivlist}{\LWR at origendtrivlist\LWR at listend}%
+    \renewcommand*{\endtrivlist}{%
+        \LWR at traceinfo{endtrivlist start}%
+        \LWR at origendtrivlist\LWR at listend%
+        \LWR at traceinfo{endtrivlist done}%
+    }%
     \renewcommand*{\trivlist}{%
+        \LWR at traceinfo{trivlist}%
         \LWR at origtrivlist%
         \def\makelabel####1{\LWR at orighspace{3em}####1}%
     }%
@@ -15885,8 +16582,9 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \subsection{Booleans}
 
+% \subsection{Tabular variables}
+
 % \DescribeBoolean{LWR at startedrow}
 % True if should print a row tag before this column.
 %    \begin{macrocode}
@@ -15973,7 +16671,123 @@
 %    \end{macrocode}
 
 
+% \DescribeCounter{LWR at tabularDepth}
+% Tracks whether |&| is being used inside a \env{tabular}.
+%    \begin{macrocode}
+\newcounter{LWR at tabulardepth}
+\setcounter{LWR at tabulardepth}{0}
+%    \end{macrocode}
+%
+% \DescribeCounter{LWR at tabularpardepth}
+% Tracks whether should look ahead at the next token
+%   when encountering a \cs{par} while processing tabular contents.
+%
+% When |LWR at tabularpardepth| is deeper than |LWR at tabulardepth| then
+% \pkg{lwarp} has started looking at the contents of the |tabular|, and thus
+% any \cs{par}s encountered must be followed by another token lookahead.
+% \changes{v0.46}{2018/01/18}{\ctr{LWR at tabularpardepth} added.}
+%    \begin{macrocode}
+\newcounter{LWR at tabularpardepth}
+\setcounter{LWR at tabularpardepth}{0}
+%    \end{macrocode}
+%
+%
+%    \begin{macrocode}
+\newcommand*{\LWR at colsresult}{}%temp storage for column format results
+\newcommand*{\LWR at pposition}{}
+\newcommand*{\LWR at pleft}{}
+\newcommand*{\LWR at pright}{}
+%    \end{macrocode}
 
+% \begin{macro}{\LWR at tablecolspec} Holds the parsed column specification,
+% of total width |LWR at tabletotalcols|, not counting |@| and |!| columns.
+%
+% Will contain a string such as |llrrccpc|, exactly one letter per \LaTeX\ table column,
+% without |@|, |!|, |>|, |<|, or the vertical bar.
+%
+%    \begin{macrocode}
+\newcommand*{\LWR at tablecolspec}{}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\LWR at strresult} Holds the result of |Str| functions.
+% \changes{v0.44}{2017/11/19}{Fix: \cs{providecommand}.}
+%    \begin{macrocode}
+\providecommand*{\LWR at strresult}{}
+\providecommand*{\LWR at strresulttwo}{}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\LWR at origcolspec} Holds the original column specs given to \env{tabular}.
+%    \begin{macrocode}
+\newcommand*{\LWR at origcolspec}{}
+%    \end{macrocode}
+% \end{macro}
+
+
+% \DescribeCounter{LWR at tablecolspecwidth}
+% Holds the number of tokens in the table columns specification.
+%
+% This is includes one for each |@|, |!|, |<|, |>| column,
+% and also one for each of the parameters of |p|, |@|, |!|, |<|, |>| columns,
+% and three for each |D| column.
+%
+% (This is not the total \# of \LaTeX\ columns in the table.)
+%    \begin{macrocode}
+\newcounter{LWR at tablecolspecwidth}
+%    \end{macrocode}
+
+% \DescribeCounter{LWR at tablecolspecindex}
+% While parsing the \LaTeX\ table column specification,
+% starts at 1 and is incremented per token of the specification.
+% While producing the table, resets to 1 at the start of the table and
+% also at each end of line, and is incremented by 1 by each ampersand.
+%    \begin{macrocode}
+\newcounter{LWR at tablecolspecindex}
+%    \end{macrocode}
+
+% \DescribeCounter{LWR at tablecolindex}
+% While parsing the \LaTeX\ table column specification,
+% starts at 1 and is incremented per token of the specification.
+% While producing the table, resets to 1 at the start of the table and
+% also at each end of line, and is incremented by 1 by each ampersand.
+%    \begin{macrocode}
+\newcounter{LWR at tablecolindex}
+%    \end{macrocode}
+
+% \DescribeCounter{LWR at tabletotalcols}
+% While parsing a table column specification,
+% begins at 0 and increments by 1 per \LaTeX\ table column.
+% Eventually holds the final number of \LaTeX\ table columns in each row,
+% not counting |@| and |!| columns.
+% (In \HTML, |@| and |!| cells become their own columns, but are not included in
+% |LWR at tabletotalcols|.)
+%    \begin{macrocode}
+\newcounter{LWR at tabletotalcols}
+%    \end{macrocode}
+
+% \DescribeCounter{LWR at tabletotalcolsnext}
+% Holds the next \LaTeX\ table column index while parsing,
+% equal to one more than |LWR at tabletotalcols|.
+%    \begin{macrocode}
+\newcounter{LWR at tabletotalcolsnext}
+%    \end{macrocode}
+
+% \DescribeObject{LWR at colatspec} A data array of specifications for |@| columns.
+% The leftmost's index is |leftedge|, the others are counter values.
+% See \cref{sec:dataarray}.
+% 
+% \DescribeObject{LWR at colbangspec} A data array of specifications for |!| columns.
+% The leftmost's index is |leftedge|, the others are counter values.
+% See \cref{sec:dataarray}.
+% 
+% \DescribeObject{LWR at colbeforespec} A data array of specifications for |>| columns.
+% 
+% \DescribeObject{LWR at colafterspec} A data array of specifications for |<| columns.
+%
+% \DescribeObject{LWR at colbarspec} A data array of specifications for vertical rules.
+
+
 % \subsection{Handling \&, @, !, and bar}
 %
 % \begin{minipage}{\linewidth}
@@ -16054,14 +16868,7 @@
 }
 %    \end{macrocode}
 % \end{macro}
-
-
-% |LWR at tabulardepth| tracks whether |&| is being used inside a \env{tabular}.
-%    \begin{macrocode}
-\newcounter{LWR at tabulardepth}
-\setcounter{LWR at tabulardepth}{0}
-
-%    \end{macrocode}
+%
 % When not used inside a \env{tabular}, |&| performs its original
 % function as recorded here ( with catcode 4 ).
 %    \begin{macrocode}
@@ -16097,7 +16904,7 @@
 % \changes{v0.33}{2017/06/20}{Add: Avoids error: \protect\texttt{misplaced alignment tab character \&}.}
 %    \begin{macrocode}
 \newcommand{\StartDefiningTabulars}{%
-\LWR at traceinfo{StartDefiningTabulars}
+\LWR at traceinfo{StartDefiningTabulars}%
 \warpHTMLonly{\catcode`\&=\active}%
 }
 %    \end{macrocode}
@@ -16106,7 +16913,7 @@
 % \begin{macro}{\EndDefiningTabulars} Place after defining something with |&| in it.
 %    \begin{macrocode}
 \newcommand{\EndDefiningTabulars}{%
-\LWR at traceinfo{EndDefiningTabulars}
+\LWR at traceinfo{EndDefiningTabulars}%
 \warpHTMLonly{\catcode`\&=4}%
 }
 %    \end{macrocode}
@@ -16258,10 +17065,10 @@
 }
 %    \end{macrocode}
 % \end{macro}
+%
+%
 
 
-
-
 % \subsection{Handling \protect\textbackslash\protect\textbackslash}
 
 % Inside tabular, |\\| is redefined to |\LWR at tabularendofline|
@@ -16305,104 +17112,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \subsection{Variables}
 
-%    \begin{macrocode}
-\newcommand*{\LWR at colsresult}{}%temp storage for column format results
-\newcommand*{\LWR at pposition}{}
-\newcommand*{\LWR at pleft}{}
-\newcommand*{\LWR at pright}{}
-%    \end{macrocode}
-
-% \begin{macro}{\LWR at tablecolspec} Holds the parsed column specification,
-% of total width |LWR at tabletotalcols|, not counting |@| and |!| columns.
-%
-% Will contain a string such as |llrrccpc|, exactly one letter per \LaTeX\ table column,
-% without |@|, |!|, |>|, |<|, or the vertical bar.
-%
-%    \begin{macrocode}
-\newcommand*{\LWR at tablecolspec}{}
-%    \end{macrocode}
-% \end{macro}
-
-% \begin{macro}{\LWR at strresult} Holds the result of |Str| functions.
-% \changes{v0.44}{2017/11/19}{Fix: \cs{providecommand}.}
-%    \begin{macrocode}
-\providecommand*{\LWR at strresult}{}
-\providecommand*{\LWR at strresulttwo}{}
-%    \end{macrocode}
-% \end{macro}
-
-% \begin{macro}{\LWR at origcolspec} Holds the original column specs given to \env{tabular}.
-%    \begin{macrocode}
-\newcommand*{\LWR at origcolspec}{}
-%    \end{macrocode}
-% \end{macro}
-
-
-% \DescribeCounter{LWR at tablecolspecwidth}
-% Holds the number of tokens in the table columns specification.
-%
-% This is includes one for each |@|, |!|, |<|, |>| column,
-% and also one for each of the parameters of |p|, |@|, |!|, |<|, |>| columns,
-% and three for each |D| column.
-%
-% (This is not the total \# of \LaTeX\ columns in the table.)
-%    \begin{macrocode}
-\newcounter{LWR at tablecolspecwidth}
-%    \end{macrocode}
-
-% \DescribeCounter{LWR at tablecolspecindex}
-% While parsing the \LaTeX\ table column specification,
-% starts at 1 and is incremented per token of the specification.
-% While producing the table, resets to 1 at the start of the table and
-% also at each end of line, and is incremented by 1 by each ampersand.
-%    \begin{macrocode}
-\newcounter{LWR at tablecolspecindex}
-%    \end{macrocode}
-
-% \DescribeCounter{LWR at tablecolindex}
-% While parsing the \LaTeX\ table column specification,
-% starts at 1 and is incremented per token of the specification.
-% While producing the table, resets to 1 at the start of the table and
-% also at each end of line, and is incremented by 1 by each ampersand.
-%    \begin{macrocode}
-\newcounter{LWR at tablecolindex}
-%    \end{macrocode}
-
-% \DescribeCounter{LWR at tabletotalcols}
-% While parsing a table column specification,
-% begins at 0 and increments by 1 per \LaTeX\ table column.
-% Eventually holds the final number of \LaTeX\ table columns in each row,
-% not counting |@| and |!| columns.
-% (In \HTML, |@| and |!| cells become their own columns, but are not included in
-% |LWR at tabletotalcols|.)
-%    \begin{macrocode}
-\newcounter{LWR at tabletotalcols}
-%    \end{macrocode}
-
-% \DescribeCounter{LWR at tabletotalcolsnext}
-% Holds the next \LaTeX\ table column index while parsing,
-% equal to one more than |LWR at tabletotalcols|.
-%    \begin{macrocode}
-\newcounter{LWR at tabletotalcolsnext}
-%    \end{macrocode}
-
-% \DescribeObject{LWR at colatspec} A data array of specifications for |@| columns.
-% The leftmost's index is |leftedge|, the others are counter values.
-% See \cref{sec:dataarray}.
-% 
-% \DescribeObject{LWR at colbangspec} A data array of specifications for |!| columns.
-% The leftmost's index is |leftedge|, the others are counter values.
-% See \cref{sec:dataarray}.
-% 
-% \DescribeObject{LWR at colbeforespec} A data array of specifications for |>| columns.
-% 
-% \DescribeObject{LWR at colafterspec} A data array of specifications for |<| columns.
-%
-% \DescribeObject{LWR at colbarspec} A data array of specifications for vertical rules.
-
-
 % \subsection{Parsing @, >, <, !, bar columns}
 %
 %
@@ -16641,7 +17351,7 @@
 
 % \subsection{Parsing the column specifications}
 
-% \HTML\ \CSS\ cannot exactly match the \LaTeX{} concept of a baseline for
+% HTML \CSS\ cannot exactly match the \LaTeX{} concept of a baseline for
 % a table row.
 % \watchout
 % \Cref{tab:baseline} shows the \LaTeX{} results for various
@@ -16907,6 +17617,7 @@
 %
 %    \begin{macrocode}
 \newcommand*{\LWR at printbartag}[1]{%
+\LWR at traceinfo{LWR at printbartag !#1!}%
 \ifboolexpr{bool{LWR at tabularmutemods} or bool{LWR at emptyatbang}}%
 {}% muting or empty
 {% not muting
@@ -16913,6 +17624,7 @@
     \edef\LWR at tempone{\LWR at getexparray{LWR at colbarspec}{#1}}%
     \ifdefempty{\LWR at tempone}{}{ \LWR at tempone}%
 }% not muting
+\LWR at traceinfo{LWR at printbartag done}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -17007,6 +17719,7 @@
 %    \begin{macrocode}
 \newcommand*{\LWR at tabledatasinglecolumntag}%
 {%
+\LWR at traceinfo{LWR at tabledatasinglecolumntag}%
 \LWR at maybenewtablerow%
 %    \end{macrocode}
 % Don't start a new paragraph tag if have already started one:
@@ -17029,6 +17742,7 @@
 %    \end{macrocode}
 % print the start of a new table data cell:
 %    \begin{macrocode}
+\LWR at traceinfo{LWR at tabledatasinglecolumntag: about to print td tag}%
         \LWR at htmltag{td class="td%
 %    \end{macrocode}
 % append this column's spec:
@@ -17051,6 +17765,7 @@
         \LWR at addformatwpalignment{\LWR at thiscolspec}%
         \LWR at tdendstyles%
         }%
+\LWR at traceinfo{LWR at tabledatasinglecolumntag: done printing td tag}%
 %    \end{macrocode}
 % If this is a p, m, b, or X column, allow paragraphs:
 %    \begin{macrocode}
@@ -17064,8 +17779,10 @@
             test{ \ifdefstring{\LWR at strresult}{X} }
         }%
         {% allow pars
+            \LWR at traceinfo{LWR at tabledatasinglecolumntag: about to LWR at startpars}%
+            \global\booltrue{LWR at tableparcell}%
             \LWR at startpars%
-            \global\booltrue{LWR at tableparcell}%
+            \LWR at traceinfo{LWR at tabledatasinglecolumntag: done with LWR at startpars}%
         }% allow pars
         {}% no pars
 %    \end{macrocode}
@@ -17079,6 +17796,7 @@
         \global\boolfalse{LWR at intabularmetadata}%
     }% not exiting tabular
 }{}% in tabular metadata
+\LWR at traceinfo{LWR at tabledatasinglecolumntag: done}%
 }%
 %    \end{macrocode}
 % \end{macro}
@@ -18049,6 +18767,8 @@
 \begin{warpHTML}
 %    \end{macrocode}
 %
+% Used to prevent opening a tabular data cell if the following token is
+% one which does not create tabular data:
 %    \begin{macrocode}
 \newcommand*{\LWR at donothing}{}
 %    \end{macrocode}
@@ -18213,6 +18933,12 @@
 \ifdefequal{\LWR at mynexttoken}{\hline}%
     {\let\mynext\LWR at donothing}{}%
 %
+\ifdefequal{\LWR at mynexttoken}{\firsthline}%
+    {\let\mynext\LWR at donothing}{}%
+%
+\ifdefequal{\LWR at mynexttoken}{\lasthline}%
+    {\let\mynext\LWR at donothing}{}%
+%
 \ifdefequal{\LWR at mynexttoken}{\toprule}%
     {\let\mynext\LWR at donothing}{}%
 %
@@ -18243,6 +18969,12 @@
 \ifdefequal{\LWR at mynexttoken}{\rdelim}%
     {\let\mynext\LWR at donothing}{}%
 %    \end{macrocode}
+% Ignore an empty line between rows:
+% \changes{v0.45}{2017/12/06}{Fix: Empty line between rows.}
+%    \begin{macrocode}
+\ifdefequal{\LWR at mynexttoken}{\par}%
+    {\let\mynext\LWR at donothing}{}%
+%    \end{macrocode}
 % no action for an |\end| token
 %
 % Add similar to the above for any other non-data tokens
@@ -18250,7 +18982,9 @@
 %
 % Start the new table cell if was not any of the above:
 %    \begin{macrocode}
+\LWR at traceinfo{LWR at tabledatacolumntag: about to do mynext}%
 \mynext%
+\LWR at traceinfo{LWR at tabledatacolumntag: done}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -18366,7 +19100,7 @@
 % since they were not compatible with the tabular column parsing code,
 % which uses \pkg{xstring}.
 % \changes{v0.41}{2017/10/06}{Fix: \cs{NoAutoSpacing} in a tabular
-%   with \protect\pkg{babel-french}.}
+%   with \pkg{babel-french}.}
 %    \begin{macrocode}
 \AtBeginDocument{
 \@ifundefined{frenchbsetup}%
@@ -18391,7 +19125,7 @@
 % since \pkg{siunitx} might redefine tabular in the user's document.
 %
 % \changes{v0.34}{2017/08/08}{\pkg{booktabs}: Works inside \env{lateximage}.}
-% \changes{v0.36}{2017/08/16}{Fix for \protect\pkg{babel-french}.}
+% \changes{v0.36}{2017/08/16}{Fix for \pkg{babel-french}.}
 %
 %    \begin{macrocode}
 \StartDefiningTabulars
@@ -18416,7 +19150,7 @@
 % the autospacing commands since were not compatible with the tabular parsing code.
 %
 % \changes{v0.41}{2017/10/06}{Fix: \cs{NoAutoSpacing} in a tabular
-%   with \protect\pkg{babel-french}.}
+%   with \pkg{babel-french}.}
 %
 %    \begin{macrocode}
 \LWR at nullifyNoAutoSpacing%
@@ -18544,6 +19278,11 @@
 \StartDefiningTabulars%
 \protected\gdef&{\LWR at tabularampersand}%
 %    \end{macrocode}
+% Nest one level deeper of tabular paragraph handling:
+% \changes{v0.46}{2018/01/18}{Fix: Tabular empty lines.}
+%    \begin{macrocode}
+\addtocounter{LWR at tabularpardepth}{1}%
+%    \end{macrocode}
 % Look ahead for a possible table data cell:
 %    \begin{macrocode}
 \LWR at traceinfo{LWR at tabular: about to LWR at getmynexttoken}%
@@ -18554,6 +19293,11 @@
 %    \begin{macrocode}
 {%
 \LWR at traceinfo{LWR at tabular ending}%
+%    \end{macrocode}
+% Unnest one level of tabular paragraph handling:
+% \changes{v0.46}{2018/01/18}{Fix: Tabular empty lines.}
+%    \begin{macrocode}
+\addtocounter{LWR at tabularpardepth}{-1}%
 \ifboolexpr{%
     test {%
         \ifnumcomp{\value{LWR at tablecolindex}}{<}{\value{LWR at tabletotalcols}}
@@ -18600,18 +19344,6 @@
 
 
 
-
-% \subsection{Array}
-% \label{sec:array}
-
-% \DescribePackage{array}
-%
-% \pkg{array} is also automatically loaded by siunitx.
-
-
-
-
-
 % \section{Cross-references}
 %
 % Sectioning commands have been emulated from scratch, so the cross-referencing
@@ -18758,10 +19490,12 @@
 %    \begin{macrocode}
 \zref at newlist{special}
 %    \end{macrocode}
+%
 % Define a new property which has the name of the most recently declared section:
 %    \begin{macrocode}
 \zref at newprop{zLWR at name}{\@currentlabelname}
 %    \end{macrocode}
+%
 % Define a new property which has either a filename or a file number:
 %    \begin{macrocode}
 \zref at newprop{zLWR at htmlfilenumber}{%
@@ -18768,6 +19502,7 @@
 \ifbool{FileSectionNames}{\LWR at thisfilename}{\arabic{LWR at htmlfilenumber}}%
 }%
 %    \end{macrocode}
+%
 % Additional properties for lateximages:
 %    \begin{macrocode}
 \zref at newprop{zLWR at lateximagedepth}{\arabic{LWR at lateximagedepth}}
@@ -18783,11 +19518,15 @@
 \zref at addprop{special}{zLWR at lateximagedepth}
 \zref at addprop{special}{zLWR at lateximagenumber}
 %    \end{macrocode}
+%
 % Returns the selected field:
 %    \begin{macrocode}
 \newcommand*{\LWR at spref}[2]{%
-\zref at extractdefault{#1}{#2}{??}}
+\zref at extractdefault{#1}{#2}{??}%
+}
 %    \end{macrocode}
+%
+%
 % \begin{macro}{\LWR at nameref} \marg{label}
 % Returns the section name for this label:
 %    \begin{macrocode}
@@ -18796,6 +19535,8 @@
 }
 %    \end{macrocode}
 % \end{macro}
+%
+%
 % \begin{macro}{\LWR at htmlfileref} \marg{label}
 % \changes{v0.24}{2017/03/13}{Fix: Index links while \cs{tracinglwarp}.}
 % Returns the file number for this label:
@@ -18806,6 +19547,8 @@
 }
 %    \end{macrocode}
 % \end{macro}
+%
+%
 % \begin{macro}{\LWR at lateximagedepthref} \marg{label}
 % Returns the |lateximagedepth| for this label:
 %    \begin{macrocode}
@@ -18814,6 +19557,9 @@
 }
 %    \end{macrocode}
 % \end{macro}
+%
+%
+%
 % \begin{macro}{\LWR at lateximagenumberref} \marg{label}
 % Returns the |lateximagenumber| for this label:
 %    \begin{macrocode}
@@ -18822,26 +19568,34 @@
 }
 %    \end{macrocode}
 % \end{macro}
+%
+%
 % \begin{macro}{\LWR at splabel} \marg{label}
 % Sanitize the name and then creates the label:
 %    \begin{macrocode}
 \newcommand*{\LWR at splabel}[1]{%
+\LWR at traceinfo{LWR at splabel !#1!}%
 \LWR at setlatestname{\@currentlabelname}%
-\zref at labelbylist{#1}{special}}
+\zref at labelbylist{#1}{special}%
+}
 %    \end{macrocode}
 % \end{macro}
+%
 
 
 
-
 % \subsection{Labels}
 % \label{sec:labels}
 
 
-% \begin{macro}{\LWR at subsublabel} \marg{label} \quad
+% \begin{macro}{\LWR at sublabel} \marg{label} \quad
 % Creates an \HTML\ id tag.
+%
+% \cs{detokenize} is used to allow underscores in the labels.
+% \changes{v0.45}{2017/12/29}{Fix: Labels with underscores.}
 %    \begin{macrocode}
-\newcommand*{\LWR at subsublabel}[1]{%
+\newcommand*{\LWR at sublabel}[1]{%
+\LWR at traceinfo{LWR at sublabel !#1!}%
 %    \end{macrocode}
 % Create an \HTML\ id tag unless are inside a lateximage,
 % since it would appear in the image:
@@ -18853,20 +19607,21 @@
 % If not doing a lateximage, create an \HTML\ ID tag:
 % (To be factored\dots)
 %    \begin{macrocode}
+    \LWR at sanitize{#1}%
     \ifbool{LWR at doingstartpars}%
     {% pars allowed
-        \ifbool{LWR at doingapar}
+        \ifbool{LWR at doingapar}%
         {% par started
-            \LWR at htmltag{a id="#1"{}}\LWR at htmltag{/a}%
+            \LWR at htmltag{a id="\LWR at sanitized"}\LWR at htmltag{/a}%
         }% par started
         {% par not started
             \LWR at stoppars%
-            \LWR at htmltag{a id="#1"{}}\LWR at htmltag{/a}%
+            \LWR at htmltag{a id="\LWR at sanitized"}\LWR at htmltag{/a}%
             \LWR at startpars%
         }% par not started
     }% pars allowed
     {% pars not allowed
-        \LWR at htmltag{a id="#1"{}}\LWR at htmltag{/a}%
+        \LWR at htmltag{a id="\LWR at sanitized"}\LWR at htmltag{/a}%
     }% pars not allowed
 }% not lateximage
 }
@@ -18874,7 +19629,7 @@
 % \end{macro}
 %
 %
-% \begin{macro}{\LWR at newlabel} \marg{label} \oarg{type}
+% \begin{macro}{\LWR at newlabel} \parg{bookmark} \marg{label} \oarg{type}
 %
 % \cs{label} during \HTML\ output when not in math mode,
 % removing extra spaces around the label, as done by regular \LaTeX\ \cs{label}.
@@ -18881,16 +19636,18 @@
 %
 % \pkg{clevereref} later encases this to add its own cross-referencing.
 %
+% The optional \meta{bookmark} is per the \pkg{memoir} class, and is ignored.
+%
 % The optional \meta{type} is per the \pkg{ntheorem} package, and is ignored.
 %    \begin{macrocode}
-\NewDocumentCommand{\LWR at newlabel}{m o}{%
+\NewDocumentCommand{\LWR at newlabel}{d() m o}{%
 \LWR at traceinfo{LWR at newlabel: starting}%
-\LWR at traceinfo{LWR at newlabel: !#1!}%
+\LWR at traceinfo{LWR at newlabel: !#2!}%
 % \@bsphack%
 %    \end{macrocode}
 % Create a traditional \LaTeX\ label, as modified by \pkg{cleveref}:
 %    \begin{macrocode}
-\LWR at origlabel{#1}%
+\LWR at origlabel{#2}%
 %    \end{macrocode}
 % Create a special label which holds the section number,
 % |LWR at htmlfilenumber|, |LWR at lateximagedepth|, and |LWR at lateximagenumber|:
@@ -18898,8 +19655,8 @@
 \LWR at traceinfo{LWR at newlabel: filesectionnames is \ifbool{FileSectionNames}{true}{false}}%
 \LWR at traceinfo{LWR at newlabel: LWR at thisfilename is !\LWR at thisfilename!}%
 \LWR at traceinfo{LWR at newlabel: LWR at htmlfilenumber is \arabic{LWR at htmlfilenumber}}%
-\LWR at splabel{#1}%
-\LWR at subsublabel{#1}%
+\LWR at splabel{#2}%
+\LWR at sublabel{#2}%
 % \@esphack%
 \LWR at traceinfo{LWR at newlabel: done}%
 }
@@ -18906,10 +19663,9 @@
 %    \end{macrocode}
 % \end{macro}
 %
+%
 
 
-
-
 % \subsection{References}
 % \label{sec:references}
 
@@ -18924,6 +19680,7 @@
 \newcommand*{\LWR at startref}[1]
 {%
 \edef\LWR at lidref{\LWR at lateximagedepthref{#1}}%
+\LWR at sanitize{#1}%
 \LWR at traceinfo{LWR at startref A: !#1!}%
 %    \end{macrocode}
 % Create the filename part of the link:
@@ -18962,7 +19719,11 @@
     }%
     {%
         \LWR at traceinfo{LWR at startref D3}%
-        #1%
+%    \end{macrocode}
+% \cs{detokenize} is used to allow underscores in the labels:
+% \changes{v0.45}{2017/12/01}{Fix: Labels with underscores.}
+%    \begin{macrocode}
+        \LWR at sanitized%
     }%
 }%
 \LWR at traceinfo{LWR at startref E}%
@@ -18969,7 +19730,7 @@
 %    \end{macrocode}
 % Closing quote:
 %    \begin{macrocode}
-"{}}%
+"}%
 \LWR at traceinfo{LWR at startref F}%
 }
 %    \end{macrocode}
@@ -18997,7 +19758,7 @@
 % or without a link if starred per \pkg{hyperref}.
 %    \begin{macrocode}
 \NewDocumentCommand{\LWR at newref}{s m}{%
-\LWR at traceinfo{LWR at newref #2}%
+\LWR at traceinfo{LWR at newref !#2!}%
 \IfBooleanTF{#1}%
 {\LWR at origref{#2}}%
 {\LWR at subnewref{#2}{#2}}%
@@ -19007,6 +19768,7 @@
 % \end{macro}
 
 
+
 % \label{sec:pagerefpagefor}
 % \begin{macro}{\pagerefPageFor} Text for page references.
 %
@@ -19049,10 +19811,11 @@
 % \end{macro}
 
 
+
 % \begin{macro}{\Nameref} \marg{label}
 % In print, adds the page number.  In \HTML, does not.
 %    \begin{macrocode}
-\let\Nameref\nameref
+\LetLtxMacro\Nameref\nameref
 %    \end{macrocode}
 % \end{macro}
 
@@ -19079,13 +19842,40 @@
 % \EmulatesPackage{hyperref}[2015/08/01]% Disabled.  Do not do this.
 %    \end{macrocode}
 
+
+
+% Emulates \pkg{hyperref}:
+% \begin{macro}{\@currentHref} Added to support \pkg{backref}.
+% \changes{v0.45}{2018/01/14}{Added.}
+%    \begin{macrocode}
+\AtBeginDocument{
+\def\@currentHref{%
+autopage-\theLWR at currentautosec%
+}
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+
 % Create a link with a text name:
 
 % \begin{macro}{\LWR at subhyperref} \marg{URL} \marg{text}
 % \changes{v0.18}{2016/04/14}{Improved \HTML\ output linebreaks.}
+% \changes{v0.45}{2017/12/29}{Improved URLs with underscores.}
 %    \begin{macrocode}
 \NewDocumentCommand{\LWR at subhyperref}{m +m}{%
-\LWR at htmltag{a href="{#1}" target="\_{}blank"\LWR at orignewline}#2\LWR at htmltag{/a}%
+\LWR at traceinfo{LWR at subhyperref !#1!}%
+\LWR at sanitize{#1}%
+\LWR at htmltag{%
+    a href="\LWR at sanitized" %
+%     a href="%
+%         \begingroup\@sanitize#1\endgroup%
+%     " %
+    target="\_{}blank"\LWR at orignewline%
+}%
+#2%
+\LWR at htmltag{/a}%
 \LWR at ensuredoingapar%
 }
 %    \end{macrocode}
@@ -19093,10 +19883,19 @@
 
 % \begin{macro}{\LWR at 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.}
 %    \begin{macrocode}
 \NewDocumentCommand{\LWR at subhyperrefclass}{m +m m}{%
-\LWR at htmltag{a href="{#1}"
-class="#3"\LWR at orignewline}#2\LWR at htmltag{/a}%
+% \LWR at sanitize{#1}%
+\LWR at htmltag{%
+%     a href="\LWR at sanitized"
+    a href="%
+        \begingroup\@sanitize#1\endgroup%
+    " %
+    class="#3"\LWR at orignewline%
+}%
+#2%
+\LWR at htmltag{/a}%
 \LWR at ensuredoingapar%
 }
 %    \end{macrocode}
@@ -19110,18 +19909,10 @@
 %
 % \changes{v0.43}{2017/10/31}{Made robust.}
 %    \begin{macrocode}
-\NewDocumentCommand{\LWR at hrefb}{O{} m +m}{%
+\NewDocumentCommand{\href}{O{} m +m}{%
+\LWR at ensuredoingapar%
 \LWR at subhyperref{#2}{#3}%
-\endgroup%
-\LWR at ensuredoingapar%
 }
-
-\DeclareRobustCommand*{\href}{%
-\LWR at ensuredoingapar%
-\begingroup%
-\catcode`\_=12
-\LWR at hrefb%
-}
 %    \end{macrocode}
 % \end{macro}
 
@@ -19129,13 +19920,13 @@
 %
 % Print the name of the link without creating the link:
 % \changes{v0.43}{2017/10/31}{Made robust.}
+% \changes{v0.45}{2017/12/29}{Improved URLs with underscores.}
 %    \begin{macrocode}
-\newcommand*{\LWR at nolinkurlb}[1]{#1\endgroup\LWR at ensuredoingapar}
-
-\DeclareRobustCommand*{\nolinkurl}{%
+\newcommand*{\nolinkurl}[1]{%
 \LWR at ensuredoingapar%
-\begingroup\catcode`\_=12
-\LWR at nolinkurlb%
+\def\LWR at templink{#1}%
+\@onelevel at sanitize\LWR at templink%
+\LWR at templink%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -19148,18 +19939,14 @@
 % and also redefined by \pkg{lwarp-url}.
 %
 % \changes{v0.43}{2017/10/31}{Made robust.}
+% \changes{v0.45}{2017/12/29}{Improved URLs with underscores.}
 %    \begin{macrocode}
-\NewDocumentCommand{\LWR at urlb}{m}{%
-\LWR at hrefb{#1}{#1}%
-}
-
-\DeclareRobustCommand*{\url}{%
+\NewDocumentCommand{\url}{m}{%
 \LWR at ensuredoingapar%
-\begingroup\catcode`\_=12
-\LWR at urlb%
+\def\LWR at templink{#1}%
+\@onelevel at sanitize\LWR at templink%
+\href{\LWR at templink}{\LWR at templink}%
 }
-
-% \LetLtxMacro\url\LWR at urla
 %    \end{macrocode}
 % \end{macro}
 
@@ -19172,8 +19959,8 @@
 %    \begin{macrocode}
 \newcommand*{\LWR at subinlineimage}[5][]{%
 \ifblank{#1}%
-{\LWR at htmltag{img src="#3.#4" alt="#3" style="#5" class="#2"{}}}%
-{\LWR at htmltag{img src="#3.#4" alt="#1" style="#5" class="#2"{}}}%
+{\LWR at htmltag{img src="#3.#4" alt="#3" style="#5" class="#2"}}%
+{\LWR at htmltag{img src="#3.#4" alt="#1" style="#5" class="#2"}}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -19341,6 +20128,14 @@
 \newcounter{LWR at thisautoid}
 %    \end{macrocode}
 
+% \DescribeCounter{LWR at thisautoidWP}
+% A sequential counter for all word processor conversion \element{div}s.
+% This is used to convince LibreOffice to form a frame around this element.
+% \changes{v0.45}{2017/12/09}{Separate \ctr{LWR at thisautoidWP} for word processor \element{div}s.}
+%    \begin{macrocode}
+\newcounter{LWR at thisautoidWP}
+%    \end{macrocode}
+
 % \DescribeBoolean{LWR at freezethisautoid}
 % Prevents multiple increments of \cs{LWR at thisautoid} inside a float.
 %    \begin{macrocode}
@@ -19348,21 +20143,15 @@
 \boolfalse{LWR at freezethisautoid}
 %    \end{macrocode}
 
-% \begin{macro}{\LWR at maybeincthisautoid}
-% Possibly increments the autoid counter.
-%    \begin{macrocode}
-\newcommand*{\LWR at maybeincthisautoid}{%
-\ifbool{LWR at freezethisautoid}{}{\addtocounter{LWR at thisautoid}{1}}%
-}
-%    \end{macrocode}
-% \end{macro}
-
 % \begin{macro}{\LWR at newautoidanchor}
 % Adds a new \element{autoid} anchor.
+% \changes{v0.45}{2017/12/07}{Fix: No anchor if frozen autoid.}
 %    \begin{macrocode}
 \newcommand*{\LWR at newautoidanchor}{%
-\LWR at maybeincthisautoid%
-\LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"{}}\LWR at htmltag{/a}%
+\ifbool{LWR at freezethisautoid}{}{%
+    \addtocounter{LWR at thisautoid}{1}%
+    \LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"}\LWR at htmltag{/a}%
+}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -19407,8 +20196,8 @@
 % |.lof|, etc. files just before each float's entry.  These values are used
 % by \cs{l at figure}, etc. to create the \HTML\ links in the List of Figures, etc.
 %
-% \DescribeCounter{LWR at nextautoid} Tracks autoid for floats.
-% \DescribeCounter{LWR at nextautopage} Tracks autopage for floats.
+% \DescribeCounter{LWR at nextautoid} Tracks |autoid| for floats.
+% \DescribeCounter{LWR at nextautopage} Tracks |autopage| for floats.
 %
 % These are updated per float as the |.lof| file is read.
 %    \begin{macrocode}
@@ -19420,7 +20209,7 @@
 % \begin{macro}{\LWRsetnextfloat} \marg{autopage} \marg{autoid}
 %
 % This is written to the |.lof| file just before each float's usual entry.
-% The autopage and autoid are remembered for \cs{l at figure} to use when
+% The |autopage| and |autoid| are remembered for \cs{l at figure} to use when
 % creating the \HTML\ links.
 %
 %    \begin{macrocode}
@@ -19433,7 +20222,7 @@
 
 % \DescribeCounter{LWR at latestautopage}
 % Updated each time a new \HTML\ file is begun.
-% \cs{LWRsetnextfloat} is written with this and the autoid
+% \cs{LWRsetnextfloat} is written with this and the |autoid|
 % by the modified \cs{addcontentsline} just before each float's entry.
 %    \begin{macrocode}
 \newcounter{LWR at latestautopage}
@@ -19544,7 +20333,7 @@
 
 \def\LWR at LTcaptionlistentry{%
 \LWR at ensuredoingapar%
-\LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"{}}\LWR at htmltag{/a}%
+\LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"}\LWR at htmltag{/a}%
   \bgroup
   \@ifstar{\egroup\LWR at LT@captionlistentry}% gobble *
           {\egroup\LWR at LT@captionlistentry}}%
@@ -19554,7 +20343,7 @@
 % \end{macro}
 
 % \begin{macro}{\addcontentsline}
-% Patched to write the autopage and autoid before each float's entry.
+% Patched to write the |autopage| and |autoid| before each float's entry.
 % No changes if writing |.toc|
 % For a theorem, automatically defines \cs{ext@<type>} as needed, to
 % mimic and reuse the float mechanism.
@@ -19579,10 +20368,14 @@
 }
 %    \end{macrocode}
 % \end{macro}
-
+%
+%
+% \DescribePackage{capt-of}
+% \DescribePackage{caption} Either package provides \cs{captionof}, which
+% is later patched at the beginning of the document.
+%
 % \begin{macro}{\captionof}
-% Patched to track the float number since this is used outside a float,
-% and also create an \HTML\ anchor for the virtual float.
+% Patched to handle paragraph tags.
 %    \begin{macrocode}
 \AtBeginDocument{
 \let\LWR at origcaptionof\captionof
@@ -19626,23 +20419,24 @@
 
 % \subsection{Reading and printing the TOC}
 
-% \begin{macro}{\LWR at myshorttoc} \marg{toc/lof/lot}
+% \begin{macro}{\LWR at myshorttoc} \marg{toc/lof/lot/sidetoc}
 % \changes{v0.18}{2016/05/19}{Reorganize \cs{HomeHTMLFilename} logic.}
 %
 % Reads in and prints the \TOC/\LOF/\LOT\ at the current position.
 % While doing so, makes the |@| character into a normal letter to allow
 % formatting commands in the section names.
-
+%
 % Unlike in regular \LaTeX{}, the file is not reset after being read, since
-% the \TOC\ may be referred to again in each \HTML\ page, and is
-% used for the side\TOC.
+% the side\TOC\ may be referred to again in each \HTML\ page.
 %    \begin{macrocode}
-\newcommand*{\LWR at myshorttoc}[1]{
-\LWR at ensuredoingapar
+\newcommand*{\LWR at myshorttoc}[1]{%
+\LWR at traceinfo{LWR at myshorttoc: #1}%
+\LWR at ensuredoingapar%
 %    \end{macrocode}
 % Only if the file exists:
 %    \begin{macrocode}
-\IfFileExists{\jobname.#1}{
+\IfFileExists{\jobname.#1}{%
+\LWR at traceinfo{LWR at myshorttoc: loading}%
 %    \end{macrocode}
 % Make |@| a regular letter.
 % Many of the commands in the file will have |@| characters in them, so |@|
@@ -19654,20 +20448,21 @@
 % \watchout[disabled]
 % the encoding change seems to be required, rather than leaving it |utf8|.
 %    \begin{macrocode}
-\begingroup
+\begingroup%
 % \ifxetexorluatex%
 % \else
 % \inputencoding{latin1}% currently disabled
 % \fi
-\makeatletter
+\makeatletter%
 %    \end{macrocode}
 % Read in the \TOC\ file:
 %    \begin{macrocode}
-\@input{\jobname.#1}
+\@input{\jobname.#1}%
 % \makeatother
-\endgroup
+\endgroup%
 }%
 {}%
+\LWR at traceinfo{LWR at myshorttoc: done}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -19723,10 +20518,28 @@
 %    \end{macrocode}
 % \end{macro}
 %
+%
+% \DescribeBoolean{LWR at copiedsidetoc} Used to only copy the
+% toc file to the sidetoc a single time.
+%
+% (\pkg{listings} and perhaps other packages would re-use \cs{tableofcontents}
+% for their own purposes, causing the sidetoc to be copied more than once, and
+% thus end up empty.)
+% \changes{v0.45}{2017/12/09}{Fix: Empty sidetoc.}
+%    \begin{macrocode}
+\newbool{LWR at copiedsidetoc}
+\boolfalse{LWR at copiedsidetoc}
+%    \end{macrocode}
+%
+%
+%
 % \begin{macro}{\tableofcontents}
 % Patch \cs{tableofcontents}, etc. to print footnotes first.
 % \pkg{newfloat} uses \cs{listoffigures} for all future float types.
+% \changes{v0.45}{2017/12/07}{Fix: Patch \cs{AtBeginDocument}.}
+% \changes{v0.45}{2017/12/09}{Fix: Empty sidetoc.}
 %    \begin{macrocode}
+\AtBeginDocument{
 \let\LWR at origtableofcontents\tableofcontents
 
 \renewcommand*{\tableofcontents}{%
@@ -19745,11 +20558,15 @@
 % Copy the |.toc| file to |.sidetoc| for printing the side\TOC.
 % The original |.toc| file is renewed when \cs{tableofcontents} is finished.
 %    \begin{macrocode}
-    \LWR at copyfile{\jobname.toc}{\jobname.sidetoc}%
+    \ifbool{LWR at copiedsidetoc}{}{%
+        \LWR at copyfile{\jobname.toc}{\jobname.sidetoc}%
+        \booltrue{LWR at copiedsidetoc}%
+    }%
     \LWR at printpendingfootnotes
     \LWR at origtableofcontents
 }
-}
+}% \tableofcontents
+}% AtBeginDocument
 %    \end{macrocode}
 % \end{macro}
 
@@ -19926,7 +20743,7 @@
 %
 % Called by \cs{l at section}, etc. to create a hyperlink to a section.
 %
-% The autopage label is always created just after the section.
+% The |autopage| label is always created just after the section opens.
 %
 % \begin{description}
 % \item[\#1] is depth
@@ -19936,6 +20753,7 @@
 % \end{description}
 %    \begin{macrocode}
 \NewDocumentCommand{\hypertoc}{m m +m m}{%
+\LWR at traceinfo{hypertoc !#1!#2!#3!#4!}%
 %    \end{macrocode}
 % Respond to tocdepth:
 %    \begin{macrocode}
@@ -19946,10 +20764,12 @@
 % of the given \HTML\ class.
 %    \begin{macrocode}
     \LWR at subhyperrefclass{%
-    \LWR at htmlrefsectionfilename{autopage-#4}\#autosec-#4}{#3}{toc#2}%
+        \LWR at htmlrefsectionfilename{autopage-#4}\#autosec-#4%
+    }{#3}{toc#2}%
     \LWR at stoppars%
 }
 {}
+\LWR at traceinfo{hypertoc done}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -19956,14 +20776,18 @@
 
 % \DescribeCounter{lofdepth} \TOC\ depth for figures.
 %    \begin{macrocode}
+\@ifclassloaded{memoir}{}{
 \newcounter{lofdepth}
 \setcounter{lofdepth}{1}
+}
 %    \end{macrocode}
 
 % \DescribeCounter{lotdepth} \TOC\ depth for tables.
 %    \begin{macrocode}
+\@ifclassloaded{memoir}{}{
 \newcounter{lotdepth}
 \setcounter{lotdepth}{1}
+}
 %    \end{macrocode}
 
 
@@ -20119,14 +20943,14 @@
 
 
 % \begin{macro}{\@wrindex} \marg{term} \qquad
-% Redefined to write the |LWR at latestautopage| counter instead of |page|
+% Redefined to write the |LWR at autoindex| counter instead of |page|
 % \changes{v0.28}{2017/04/13}{Improved indexing.}
 %    \begin{macrocode}
 \def\LWR at wrindex#1{%
 \addtocounter{LWR at autoindex}{1}%
-\LWR at newlabel{LWRindex-\theLWR at autoindex}%
+\LWR at newlabel{LWRindex-\arabic{LWR at autoindex}}%
 \protected at write\@indexfile{}%
-{\string\indexentry{#1}{\theLWR at autoindex}}%
+{\string\indexentry{#1}{\arabic{LWR at autoindex}}}%
 \endgroup
 \@esphack}
 
@@ -20189,15 +21013,72 @@
 \providecommand{\glo at name}{}
 \end{warpall}
 %    \end{macrocode}
+%
+%
+%
+%
+% \section{Bibliography presentation}
+%
+% \codehtml
+%    \begin{macrocode}
+\begin{warpHTML}
+%    \end{macrocode}
+%
+% \begin{environment}{thebibliography}
+% \changes{v0.45}{2018/01/13}{Patched to emphasize titles.}
+%
+% To emphasize document titles in the bibliography,
+% the following redefines \cs{em} inside \env{thebibliography}
+% to gather everything until the next closing brace,
+% then display these tokens with \cs{textit}.
+%
+% {
+%   \footnotesize\itshape
+%   Adapted from |embracedef.sty|, which is by \textup{\textsc{Takayuki YATO}}: \\
+%   \hspace*{2em}\url{https://gist.github.com/zr-tex8r/b72555e3e7ad2f0a37f1}
+% }
+%    \begin{macrocode}
+\AtBeginDocument{
+\AtBeginEnvironment{thebibliography}{
+\providecommand*{\LWR at newem}[1]{\textit{#1}}
 
+\renewrobustcmd{\em}{%
+  \begingroup
+    \gdef\LWR at em@after{\LWR at em@finish\LWR at newem}%
+    \afterassignment\LWR at em@after
+    \toks@\bgroup
+}
 
+\def\LWR at em@finish#1{%
+    \xdef\LWR at em@after{\noexpand#1{\the\toks@}}%
+  \endgroup
+  \LWR at em@after\egroup
+}
+}% \AtBeginEnvironment{thebibliography}
+}% \AtBeginDocument
+%    \end{macrocode}
+% \end{environment}
 
+%    \begin{macrocode}
+\end{warpHTML}
+%    \end{macrocode}
+
+
+
+
 % \section{Restoring original formatting}
 %
 %
+% \codehtml
+%    \begin{macrocode}
+\begin{warpHTML}
+%    \end{macrocode}
+%
+%
+%
 % \begin{macro}{\LWR at restoreorigformatting}
 % Used to temporarily restore
-% the print-mode meaing of a number of formatting, graphics, and symbols-related
+% the print-mode meaning of a number of formatting, graphics, and symbols-related
 % macros while generating \SVG\ math or a \env{lateximage}.
 % A number of packages will \cs{appto} additional actions to this macro.
 %
@@ -20286,7 +21167,7 @@
 \LetLtxMacro{\fminipage}{\LWRprint at fminipage}%
 \LetLtxMacro{\endfminipage}{\endLWRprint at fminipage}%
 \LetLtxMacro{\minipage}{\LWR at origminipage}%
-\let\endminipage\LWR at endminipage%
+\let\endminipage\LWR at origendminipage%
 \LetLtxMacro{\parbox}{\LWR at origparbox}%
 \let\TeX\LWR at origTeX%
 \let\LaTeX\LWR at origLaTeX%
@@ -20309,9 +21190,13 @@
 }
 %    \end{macrocode}
 % \end{macro}
-
-
-
+%
+%    \begin{macrocode}
+\end{warpHTML}
+%    \end{macrocode}
+%
+%
+%
 % \section{Math}
 % \label{sec:math}
 %
@@ -20778,7 +21663,7 @@
 %
 % \pkg{lwarp} points \cs{ltx at label} here.
 % This is used by \cs{label} when inside a
-% \LaTeX{} AMS math environment's math display environment.
+% \LaTeX\ AMS math environment's math display environment.
 %
 % \cs{LWR at origltx@label} points to the \LaTeX\ original,
 % modified by \pkg{lwarp}, then by \pkg{amsmath},
@@ -20785,7 +21670,7 @@
 % then by \pkg{cleveref}.
 %    \begin{macrocode}
 \newcommand*{\LWR at htmlmathlabel}[1]{%
-\LWR at traceinfo{LWR at htmlmathlabel #1}%
+\LWR at traceinfo{LWR at htmlmathlabelb #1}%
 %    \end{macrocode}
 % If |mathjax| or |FormatWP|, print the \LaTeX\ expression:
 % \changes{v0.42}{2017/10/26}{If \protect\texttt{FormatWP} print LaTeX expression.}
@@ -20821,6 +21706,7 @@
 % \end{macro}
 
 
+
 % \begin{macro}{\LWR at beginhideamsmath}
 % Starts hiding \LaTeX\ math inside an \HTML\ comment.
 %    \begin{macrocode}
@@ -21350,7 +22236,7 @@
 % Two versions follow, depending on expansion needs.
 % There may be a better way\dots
 %
-% \changes{v0.36}{2017/08/16}{Fix for \protect\pkg{babel-french}.}
+% \changes{v0.36}{2017/08/16}{Fix for \pkg{babel-french}.}
 %
 %    \begin{macrocode}
 \newcommand{\LWR at HTMLsanitize}[1]{%
@@ -21381,7 +22267,7 @@
 %
 % This version expands the argument before sanitizing it.
 %
-% \changes{v0.36}{2017/08/16}{Fix for \protect\pkg{babel-french}.}
+% \changes{v0.36}{2017/08/16}{Fix for \pkg{babel-french}.}
 %
 %    \begin{macrocode}
 \newcommand{\LWR at HTMLsanitizeexpand}[1]{%
@@ -21561,7 +22447,7 @@
 
 \NewDocumentEnvironment{lateximage}{O{image}}
 {%
-\LWR at traceinfo{lateximage: starting on page \arabic{page}}%
+\LWR at traceinfo{lateximage: starting on \jobname.pdf page \arabic{page}}%
 %    \end{macrocode}
 % Nested |lateximage|s remain one large |lateximage|:
 %    \begin{macrocode}
@@ -21605,7 +22491,9 @@
     \addtocounter{LWR at externalfilecnt}{1}%
     \LWR at traceinfo{lateximage: LWR at externalfilecnt is \arabic{LWR at externalfilecnt}}%
 %    \end{macrocode}
-% Figure out what the next page number will be:
+% Figure out what the next page number will be.
+% \cs{setcounterpageref} assigns |LWR at LIpage| to the page number for
+% the reference |LWRlateximageXXX|:
 %    \begin{macrocode}
     \setcounterpageref{LWR at LIpage}{LWRlateximage\arabic{LWR at lateximagenumber}}%
     \LWR at traceinfo{lateximage: LWR at LIpage is \arabic{LWR at LIpage}}%
@@ -21614,14 +22502,14 @@
 % of the image's page, and also will hold the link to the |.svg| file:
 %    \begin{macrocode}
     \LWR at htmltag{span id="lateximage\arabic{LWR at lateximagenumber}" %
-    class="lateximagesource"{}} \LWR at orignewline
+    class="lateximagesource"} \LWR at orignewline
 %    \end{macrocode}
 % Write instructions to the |lateximages.txt| file:
 %    \begin{macrocode}
     \LWR at traceinfo{lateximage: about to write to lateximages.txt}%
-    \immediate\write\LWR at lateximagesfile{|\theLWR at LIpage|\theLWR at externalfilecnt|}%
+    \immediate\write\LWR at lateximagesfile{|\arabic{LWR at LIpage}|\arabic{LWR at externalfilecnt}|}%
 %    \end{macrocode}
-% Place an open comment tag at the bottom of page; footnotes will be above this tag.
+% Place an open comment tag.
 % This will hide any traces of the lateximage \PDF\ page which were picked up by
 % |pdftotext|.
 %    \begin{macrocode}
@@ -21702,6 +22590,7 @@
 %    \end{macrocode}
 % Close the \HTML\ comment which encapsulated any traces of the lateximage picked up by |pdftotext|:
 %    \begin{macrocode}
+    \LWR at origvspace*{.5\baselineskip}%
     \LWR at htmlclosecomment{}\LWR at orignewline%
     \LWR at traceinfo{lateximage: The page after the image is \arabic{page}}%
 %    \end{macrocode}
@@ -22251,15 +23140,12 @@
 %
 %    \begin{macrocode}
 \LetLtxMacro\LWR at origlabel\label
-% \LetLtxMacro\label\LWR at newlabel
 \RenewDocumentCommand{\label}{}{\LWR at newlabel}
 
 \LetLtxMacro\LWR at origref\ref
-% \LetLtxMacro\ref\LWR at newref
 \RenewDocumentCommand{\ref}{}{\LWR at newref}%
 
 \LetLtxMacro\LWR at origpageref\pageref
-% \LetLtxMacro\pageref\LWR at newpageref
 \RenewDocumentCommand{\pageref}{}{\LWR at newpageref}
 
 \end{warpHTML}
@@ -22347,62 +23233,7 @@
 % \subsection{Minipage handling}
 % \label{sec:footnotesminipageplaced}
 %
-% \begin{macro}{\LWR at endminipage}
-% Used to close a minipage.
 %
-% Copied the \LaTeX{} definition and modified to create a \element{div} of class  \attribute{mpfootnotes}:
-%    \begin{macrocode}
-\def\LWR at endminipage{%
-    \par
-    \unskip
-    \ifvoid\@mpfootins\else
-      \vskip\skip\@mpfootins
-      \normalcolor
-        \LWR at htmldivclass{mpfootnotes}
-        \LWR at origmedskip
-      \unvbox\@mpfootins
-        \LWR at htmldivclassend{mpfootnotes}
-    \fi
-    \@minipagefalse
-  \color at endgroup
-  \egroup
-  \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}}
-%    \end{macrocode}
-% \end{macro}
-
-% \begin{macro}{\LWR at subminipage}
-% Used to create a \PDF\ minipage without creating an \HTML\ minipage.
-% This allows footnotes to appear at the bottom of the minipage instead of
-% the bottom of the \HTML\ page.
-%    \begin{macrocode}
-\newcommand*{\LWR at subminipage}{%
-\LWR at stoppars
-\LWR at origminipage{6in}
-%    \end{macrocode}
-% |\raggedright| cancels hyphenation, which will be done by \HTML\ instead.
-%    \begin{macrocode}
-\LWR at origraggedright%
-%    \end{macrocode}
-% Resume paragraph tag handling for the contents of the minipage:
-%    \begin{macrocode}
-\LWR at startpars%
-}
-%    \end{macrocode}
-% \end{macro}
-
-
-% \begin{macro}{\LWR at endsubminipage}
-% Closes the subminipage.
-%    \begin{macrocode}
-\newcommand*{\LWR at endsubminipage}{%
-\LWR at stoppars%
-\LWR at endminipage% The following empty line is required:
-
-}
-%    \end{macrocode}
-% \end{macro}
-
-
 % \DescribeBoolean{LWR at minipagefullwidth} Should the next minipage have no \HTML\ |width|?
 %    \begin{macrocode}
 \newbool{LWR at minipagefullwidth}
@@ -22463,16 +23294,32 @@
 %    \begin{macrocode}
 \uselengthunit{PT}%
 %    \end{macrocode}
+% Temporarily open a group, in which width and height is
+% computed based on a virtual page size instead of
+% the extra-large \PDF\ page used during \HTML\ tag generation.
+%
+% The following used to be an actual \LaTeX\ minipage.
+% \changes{v0.45}{2017/12/01}{Fix: Improper \cs{prevdepth}.}
+%    \begin{macrocode}
+\begingroup
+%    \end{macrocode}
 % Compute width, adjusted for frames:
 %    \begin{macrocode}
 \setlength{\LWR at minipagewidth}{#4}%
 \ifthenelse{\cnttest{\value{LWR at minipagedepth}}{=}{0}}{%
+%    \end{macrocode}
+% Only create a new page if not yet nested:
+%    \begin{macrocode}
+    \LWR at orignewpage%
+%    \end{macrocode}
+% Adjust virtual page size:
+%    \begin{macrocode}
     \addtolength{\LWR at minipagewidth}{3em}% room for frames
     \setlength{\linewidth}{6in}%
     \setlength{\textwidth}{6in}%
     \setlength{\textheight}{9in}%
 }{}%
-\LWR at traceinfo{computed width is \rndprintlength{\LWR at minipagewidth}}
+\LWR at traceinfo{computed width is \rndprintlength{\LWR at minipagewidth}}%
 %    \end{macrocode}
 % Compute height:
 %    \begin{macrocode}
@@ -22483,9 +23330,9 @@
 %    \begin{macrocode}
 \addtocounter{LWR at minipagedepth}{1}%
 %    \end{macrocode}
-% \LaTeX{} wants to start a paragraph for the new minipage, then start a paragraph again
-% for the contents of the minipage, so cancel the  paragraph tag handling
-% until the minipage has begun.
+% \LaTeX{} wants to start a paragraph for the virtual minipage,
+% then start a paragraph again for the contents of the minipage,
+% so cancel the  paragraph tag handling until the minipage has begun.
 %    \begin{macrocode}
 \ifbool{FormatWP}{\newline}{}%
 \LWR at stoppars%
@@ -22495,9 +23342,8 @@
 %    \begin{macrocode}
 \ifbool{FormatWP}{%
 
-\addtocounter{LWR at thisautoid}{1}%
-\booltrue{LWR at freezethisautoid}%
-\LWR at htmltag{div id="autoid-\arabic{LWR at thisautoid}" class="wpminipage"}%
+\addtocounter{LWR at thisautoidWP}{1}%
+\LWR at htmltag{div id="autoidWP-\arabic{LWR at thisautoidWP}" class="wpminipage"}%
 
 }{}%
 %    \end{macrocode}
@@ -22504,7 +23350,6 @@
 % Create the \element{div} tag with optional alignment style:
 %    \begin{macrocode}
 \LWR at traceinfo{minipage: creating div class}%
-\LWR at orignewpage%
 \LWR at htmltag{div class="minipage" style="%
 \ifthenelse{\equal{#1}{t}}{vertical-align:bottom ; }{}%
 \ifthenelse{\equal{#1}{c}}{vertical-align:middle ; }{}%
@@ -22527,18 +23372,18 @@
 }%
 \LWR at traceinfo{minipage: about to print the height}%
 \IfValueT{#2}{height:\rndprintlength{\LWR at minipageheight} ; }%
-"{}}%
+"}%
 %    \end{macrocode}
-% Finish with an empty line to start  \LaTeX{} minipage processing on a new line.
-% Use a large minipage area to avoid the unnecessary wrapping of tags.
+% Finish with an empty line to start the contents on a new line.
 %    \begin{macrocode}
 
-\LWR at origminipage{6in}% The preceding empty line is required.
+% The preceding empty line is required.
 %    \end{macrocode}
-% Set the user-accessible minipage and text width and height values inside the minipage.
-% These do not affect the actual size of the large minipage created by
-% \cs{LWR at origminipage} above, but are used by any reference to \cs{linewidth}, etc.
-% inside the \PDF\ minipage being created here.
+% Set the user-accessible line and text width and height values
+% inside the virtual minipage.
+% These do not affect the actual size of the \PDF\ output,
+% but are used by any reference to \cs{linewidth}, etc.
+% inside the virtual minipage being created here.
 %    \begin{macrocode}
 \setlength{\linewidth}{#4}% the original width
 \setlength{\textwidth}{6in}%
@@ -22548,6 +23393,12 @@
 %    \begin{macrocode}
 \LWR at origraggedright%
 %    \end{macrocode}
+% Set minipage footnotes:
+%    \begin{macrocode}
+\def\@mpfn{mpfootnote}%
+\def\thempfn{\thempfootnote}\c at mpfootnote\z@%
+\let\@footnotetext\@mpfootnotetext%
+%    \end{macrocode}
 % Resume paragraph tag handling for the contents of the minipage:
 % \changes{v0.42}{2017/10/18}{Added boolean \protect\texttt{WPMarkMinipages}.}
 %    \begin{macrocode}
@@ -22558,12 +23409,17 @@
 
 }{}%
 \LWR at traceinfo{minipage: finished starting the minipage}%
-}
+}% finished \minipage
+{% \endminipage
 %    \end{macrocode}
-% End the environment with \LaTeX{} processing and closing tag:
+% Print pending minipage footnotes:
+% \changes{v0.45}{2017/12/01}{Fix: Improper \cs{prevdepth}.}
+%    \begin{macrocode}
+\LWR at printpendingmpfootnotes%
+%    \end{macrocode}
+% End the environment with closing tag:
 % \changes{v0.42}{2017/10/18}{Added boolean \protect\texttt{WPMarkMinipages}.}
 %    \begin{macrocode}
-{%
 \ifboolexpr{bool{FormatWP} and bool{WPMarkMinipages}}{%
 
 === end minipage ===
@@ -22570,12 +23426,15 @@
 
 }{}%
 \LWR at stoppars%
-\LWR at endminipage% The following empty line is required:
+%    \end{macrocode}
+% The following used to be an actual \LaTeX\ minipage.
+% \changes{v0.45}{2017/12/01}{Fix: Improper \cs{prevdepth}.}
+%    \begin{macrocode}
+\endgroup%
 
 \ifbool{FormatWP}{%
 
 \LWR at htmlelementend{div}%
-\boolfalse{LWR at freezethisautoid}%
 
 }{}%
 \LWR at htmldivclassend{minipage}%
@@ -22605,9 +23464,9 @@
 \RenewDocumentCommand{\parbox}{O{t} o O{t} m +m}
 {
 \LWR at traceinfo{parbox of width #4}%
-\begin{minipage}[#1][#2][#3]{#4}
+\begin{minipage}[#1][#2][#3]{#4}%
 #5
-\end{minipage}
+\end{minipage}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -22651,12 +23510,18 @@
     ]%
     {makebox}%
 %    \end{macrocode}
-% Without a width argument, the text is simply used inline:
+% \changes{v0.46}{2018/01/19}{Fix: Lateximage in a \cs{makebox}.}
+% ^^A Now prints directly instead of inside a \mbox.
 %    \begin{macrocode}
-    {\mbox{#4}}%
+    {#4}%
     }% scope
 }%
-{\mbox{#4}}%
+%    \end{macrocode}
+% Without a width argument, the text is simply used inline:
+% \changes{v0.46}{2018/01/19}{Fix: Lateximage in a \cs{makebox}.}
+% ^^A Now prints directly instead of inside a \mbox.
+%    \begin{macrocode}
+{#4}% no width
 }
 %    \end{macrocode}
 % \end{macro}
@@ -22728,7 +23593,7 @@
 % may have loaded:
 %    \begin{macrocode}
 \newcommand{\LWRhtml at fbox}[1]{%
-\LWR at traceinfo{HTML fbox}
+\LWR at traceinfo{HTML fbox}%
 \LWR at forceminwidth{\fboxrule}%
 \InlineClass[%
 \LWR at blackborderpadding%
@@ -23118,8 +23983,11 @@
 \LetLtxMacro{\itshape}{\LWR at nullitshape}%
 \LetLtxMacro{\em}{\LWR at nullem}%
 \LetLtxMacro{\normalfont}{\LWR at nullnormalfont}%
-\renewcommand*{\HTMLunicode}[1]{}%
-\renewcommand*{\HTMLentity}[1]{}%
+\renewcommand*{\,}{-}%
+\renewcommand*{~}{-}%
+\renewcommand*{\textellipsis}{-}%
+\renewcommand*{\HTMLunicode}[1]{-}%
+\renewcommand*{\HTMLentity}[1]{-}%
 %    \end{macrocode}
 % Ampersand becomes ``and'', which is a short word and is then removed from the filename.
 %    \begin{macrocode}
@@ -23326,20 +24194,22 @@
 \let\LWR at origvspace\vspace
 \let\LWR at origrule\rule
 \let\LWR at origmedskip\medskip
+\let\LWR at origbigskip\bigskip
 \let\LWR at origtextellipsis\textellipsis
 %    \end{macrocode}
 
+% \changes{v0.45}{2017/12/29}{Improved: Robust \cs{\,}, \cs{~}, and \cs{textellipsis} commands.}
 % Direct-formatting space commands become \HTML\ entities:
 %    \begin{macrocode}
-\renewcommand*{\,}{\HTMLunicode{202f}}	% HTML thin non-breakable space
+\renewrobustcmd*{\,}{\HTMLunicode{202f}}	% HTML thin non-breakable space
 %    \end{macrocode}
 % ^^A \renewcommand*{\,}{\HTMLunicode{2009}}	% HTML thin wrappable space
 % ^^A \renewcommand*{\,}{\HTMLentity{nbsp}}	% regular-width non-breakable space
 %    \begin{macrocode}
 
-\renewcommand*{~}{\HTMLentity{nbsp}}
+\renewrobustcmd*{~}{\HTMLentity{nbsp}}
 
-\renewcommand*{\textellipsis}{\HTMLunicode{2026}}
+\renewrobustcmd*{\textellipsis}{\HTMLunicode{2026}}
 %    \end{macrocode}
 % Direct-formatting font sizes are ignored:
 %    \begin{macrocode}
@@ -23374,6 +24244,17 @@
 %    \end{macrocode}
 
 
+
+% \begin{macro}{\newpage}
+% \changes{v0.45}{2018/01/12}{Added.}
+%    \begin{macrocode}
+\renewcommand*{\newpage}{
+
+}
+%    \end{macrocode}
+% \end{macro}
+
+
 % \begin{macro}{\newline}
 % Uses the \HTML\ \element{br /} element.
 %    \begin{macrocode}
@@ -23800,7 +24681,7 @@
 % Emulate the hyperref |\phantomsection| command,
 % often used to insert the bibliography into table of contents:
 %    \begin{macrocode}
-\newcommand*{\phantomsection}{%
+\DeclareDocumentCommand{\phantomsection}{}{%
 \section*{}%
 }
 %    \end{macrocode}
@@ -23886,6 +24767,8 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+%
+%
 % \begin{macro}{\LuaTeX}
 % \begin{macro}{\LuaLaTeX} \LuaTeX, \LuaLaTeX
 %    \begin{macrocode}
@@ -23894,6 +24777,8 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+%
+%
 % \begin{macro}{\XeTeX}
 % \begin{macro}{\XeLaTeX} \XeTeX, \XeLaTeX
 % \nopagebreak
@@ -23918,6 +24803,8 @@
 \InlineClass{latexlogofont}{t}}
 %    \end{macrocode}
 % \end{macro}
+%
+%
 % \begin{macro}{\BibTeX}
 % \begin{macro}{\MakeIndex} \BibTeX, \MakeIndex
 %    \begin{macrocode}
@@ -23929,6 +24816,8 @@
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
+%
+%
 % \begin{macro}{\AmS} \AmS
 % \nopagebreak
 %
@@ -23938,11 +24827,15 @@
 {\InlineClass{amslogo}{\textit{A\textsubscript{M}S}}}}
 %    \end{macrocode}
 % \end{macro}
+%
+%
 % \begin{macro}{\MiKTeX} \MiKTeX
 %    \begin{macrocode}
 \newcommand*{\MiKTeX}{\InlineClass{latexlogofont}{MiK}\TeX}
 %    \end{macrocode}
 % \end{macro}
+%
+%
 % \begin{macro}{\LyX} \LyX
 % \nopagebreak
 %
@@ -23951,10 +24844,14 @@
 \newcommand*{\LyX}{\InlineClass{lyxlogo}{LyX}}
 %    \end{macrocode}
 % \end{macro}
+%
+%
 %    \begin{macrocode}
 \end{warpHTML}
 %    \end{macrocode}
 %
+%
+%
 % \subsection{Print logos}
 %
 % \codeprint
@@ -23997,18 +24894,55 @@
 % \end{macro}
 
 
+%    \begin{macrocode}
+\end{warpHTML}
+%    \end{macrocode}
 
 
+
+
+% \section{Koma-script}
+%
+% Load patches to \pkg{koma-script}.
+%
+% \codehtml
 %    \begin{macrocode}
+\begin{warpHTML}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\@ifclassloaded{scrbook}{\RequirePackage{lwarp-patch-komascript}}{}
+\@ifclassloaded{scrartcl}{\RequirePackage{lwarp-patch-komascript}}{}
+\@ifclassloaded{scrreprt}{\RequirePackage{lwarp-patch-komascript}}{}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \end{warpHTML}
 %    \end{macrocode}
 
 
+% \section{Memoir}
+%
+% Load patches to \pkg{memoir}.
+%
+% \changes{v0.45}{2017/12/03}{\pkg{memoir}: Added.}
+%
+% \codehtml
+%    \begin{macrocode}
+\begin{warpHTML}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\@ifclassloaded{memoir}{\RequirePackage{lwarp-patch-memoir}}{}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\end{warpHTML}
+%    \end{macrocode}
 
 
 
 
-
 % \clearpage
 % \section{Trademarks}
 %
@@ -24069,107 +25003,8 @@
 %
 %
 %
-% \iffalse
-%<*patch-komascript>
-% \fi
 %
-% \part{lwarp-patch-komascript.sty}
-%
-% \section{patch-komascript}
-%
-% \DescribePackage{lwarp-patch-komascript}
-% Patches for \pkg{komascript} classes.
-%
-% \pkg{lwarp} loads this package when
-% \pkg{scrbook}, \pkg{scrartcl}, or \pkg{scrreprt} are detected.
-%
-% \limitskomascript
-%
-% \changes{v0.44}{2017/11/19}{\pkg{lwarp-patch-komascript}: Added.}
-%
-% \codehtml
-%
-%    \begin{macrocode}
-\ProvidesPackage{lwarp-patch-komascript}
-%    \end{macrocode}
-%
-% \pkg{typearea} is emulated.
-%    \begin{macrocode}
-\RequirePackage{lwarp-typearea}
-%    \end{macrocode}
-%
-% \pkg{tocbasic} is emulated.
-%    \begin{macrocode}
-\RequirePackage{lwarp-tocbasic}
-%    \end{macrocode}
-%
-% \pkg{scrextend} patches most of the new macros.
-%    \begin{macrocode}
-\RequirePackage{lwarp-scrextend}
-%    \end{macrocode}
-%
-% The \cs{minisec} is placed inside a \element{div} of class \attribute{minisec}.
-%    \begin{macrocode}
-\renewcommand*{\minisec}[1]{
-\begin{BlockClass}{minisec}
-#1
-\end{BlockClass}
-}
-%    \end{macrocode}
-%
-% The part and chapter preambles are placed as plain text just after each heading.
-%    \begin{macrocode}
-\@ifundefined{setpartpreamble}{}{
-\RenewDocumentCommand{\setpartpreamble}{o o +m}{%
-\renewcommand{\part at preamble}{#3}%
-}
-}
-
-\@ifundefined{setchapterpreamble}{}{
-\RenewDocumentCommand{\setchapterpreamble}{o o +m}{%
-\renewcommand{\chapter at preamble}{#3}%
-}
-}
-%    \end{macrocode}
-%
-% Simple captions are used in all cases.
-%    \begin{macrocode}
-\LetLtxMacro\captionbelow\caption
-\LetLtxMacro\captionabove\caption
-
-\LetLtxMacro\captionofbelow\captionof
-\LetLtxMacro\captionofabove\captionof
-
-\RenewDocumentEnvironment{captionbeside}{o m o o o s}
-{}
-{%
-\IfValueTF{#1}%
-{\caption[#1]{#2}}%
-{\caption{#2}}%
-}
-
-\RenewDocumentEnvironment{captionofbeside}{m o m o o o s}
-{}
-{%
-\IfValueTF{#2}%
-{\captionof{#1}[#2]{#3}}%
-{\captionof{#1}{#3}}%
-}
-
-\RenewDocumentCommand{\setcapindent}{s m}{}
-\renewcommand*{\setcaphanging}{}
-\renewcommand*{\setcapwidth}[2][]{}
-\renewcommand*{\setcapdynwidth}[2][]{}
-\RenewDocumentCommand{\setcapmargin}{s o m}{}
-%    \end{macrocode}
-%
 % \iffalse
-%</patch-komascript>
-% \fi
-%
-%
-%
-% \iffalse
 %<*a4>
 % \fi
 %
@@ -24272,6 +25107,17 @@
 %
 % \codehtml
 %
+% \pkg{memoir} provides an \env{abstract} environment even though it
+% is not an \pkg{article} or \pkg{report} class.
+% Meanwhile, \pkg{lwarp} loads \pkg{book} to
+% emulate \pkg{memoir}, but \pkg{book} does not have an \env{abstract}
+% environment, so when the \pkg{abstract} package is loaded for emulation there
+% is no pre-existing \env{abstract} to redefine, which would cause an error.
+% Thus, a null \env{abstract} is provide here:
+%    \begin{macrocode}
+\ProvideDocumentEnvironment{abstract}{}{}{}
+%    \end{macrocode}
+%
 % Accept all options for \pkg{lwarp-abstract}:
 %    \begin{macrocode}
 \LWR at ProvidesPackagePass{abstract}
@@ -24294,6 +25140,34 @@
 \@bslabeldelim}%
 }
 
+\@ifclassloaded{memoir}
+{
+  \renewenvironment{abstract}{%
+%     \titlepage
+    \null\vfil
+    \@beginparpenalty\@lowpenalty
+    \if at bsrunin
+    \else
+      \if at bsstyle
+        \abstitlestyle{\BlockClassSingle{abstracttitle}{\abstractname}}
+      \else
+        \ifnumber at bs
+          \num at bs
+        \else
+          \begin{\absnamepos}%
+  \abstractnamefont \BlockClassSingle{abstracttitle}{\abstractname}
+            \@endparpenalty\@M
+          \end\absnamepos%
+%%        \vspace{\abstitleskip}%
+        \fi
+      \fi
+      \vspace{\abstitleskip}%
+    \fi
+    \put at bsintoc%
+    \begin{@bstr at ctlist}\if at bsrunin\@bsrunintitle\fi\abstracttextfont}%
+    {\par\end{@bstr at ctlist}\vfil\null%\endtitlepage
+    }
+}{% not memoir
 \if at titlepage
   \renewenvironment{abstract}{%
 %     \titlepage
@@ -24342,7 +25216,7 @@
     \begin{@bstr at ctlist}\if at bsrunin\@bsrunintitle\fi\abstracttextfont}%
     {\par\end{@bstr at ctlist}}
 \fi
-
+}% not memoir
 %    \end{macrocode}
 
 % \iffalse
@@ -24621,6 +25495,9 @@
 %
 % \credits{Publications Technical Group --- American Mathematical Society}
 %
+% The original source code is located in |amsclass.dtx|, and printed in
+% |amsclass.pdf|.
+%
 % \DescribePackage{amsthm}
 % \pkg{amsthm} is patched for use by \pkg{lwarp}.
 %
@@ -24711,10 +25588,9 @@
 % Patches for \CSS:
 %    \begin{macrocode}
 \def\@begintheorem#1#2[#3]{%
-\LWR at forcenewpage% new
-  \BlockClass{amsthmbody\LWR at thisthmstyle}% new
-  \deferred at thm@head{
-    \the\thm at headfont \thm at indent
+    \item[
+%   \deferred at thm@head{
+%     \the\thm at headfont \thm at indent
     \@ifempty{#1}{\let\thmname\@gobble}{\LWR at haveamsthmname}% new
     \@ifempty{#2}{\let\thmnumber\@gobble}{\LWR at haveamsthmnumber}% new
     \@ifempty{#3}{\let\thmnote\@gobble}{\LWR at haveamsthmnote}% new
@@ -24722,16 +25598,74 @@
     \the\thm at headpunct~
     \thmheadnl % possibly a newline.
     \hskip\thm at headsep
-  }%
+%   }%
+    ]
   \ignorespaces}
 %    \end{macrocode}
 %
 % Patched for \CSS:
+% \changes{v0.46}{2018/01/22}{\pkg{amsthm}: Adapted to \env{trivlist} changes.}
 %    \begin{macrocode}
-\def\@endtheorem{\endBlockClass\endtrivlist\@endpefalse }
+\def\@thm#1#2#3{%
+  \ifhmode\unskip\unskip\par\fi
+  \normalfont
+  \LWR at forcenewpage% new
+  \BlockClass{amsthmbody\LWR at thisthmstyle}% new
+  \trivlist
+  \let\thmheadnl\relax
+  \let\thm at swap\@gobble
+  \thm at notefont{\fontseries\mddefault\upshape}%
+  \thm at headpunct{.}% add period after heading
+  \thm at headsep 5\p@ plus\p@ minus\p@\relax
+  \thm at space@setup
+  #1% style overrides
+  \@topsep \thm at preskip               % used by thm head
+  \@topsepadd \thm at postskip           % used by \@endparenv
+  \def\@tempa{#2}\ifx\@empty\@tempa
+    \def\@tempa{\@oparg{\@begintheorem{#3}{}}[]}%
+  \else
+    \refstepcounter{#2}%
+    \def\@tempa{\@oparg{\@begintheorem{#3}{\csname the#2\endcsname}}[]}%
+  \fi
+  \@tempa
+}
 %    \end{macrocode}
+% \pkg{cleveref} patches \cs{@thm} to do \cs{cref at thmoptarg} if an optional
+% argument is given.  \pkg{lwarp} then patches \cs{cref at thmoptarg}
+% \cs{AtBeginDocument}.
+%    \begin{macrocode}
+\AtBeginDocument{
+\def\cref at thmoptarg[#1]#2#3#4{%
+    \ifhmode\unskip\unskip\par\fi%
+    \normalfont%
+    \LWR at forcenewpage% new
+    \BlockClass{amsthmbody\LWR at thisthmstyle}% new
+    \trivlist%
+    \let\thmheadnl\relax%
+    \let\thm at swap\@gobble%
+    \thm at notefont{\fontseries\mddefault\upshape}%
+    \thm at headpunct{.}% add period after heading
+    \thm at headsep 5\p@ plus\p@ minus\p@\relax%
+    \thm at space@setup%
+    #2% style overrides
+    \@topsep \thm at preskip               % used by thm head
+    \@topsepadd \thm at postskip           % used by \@endparenv
+    \def\@tempa{#3}\ifx\@empty\@tempa%
+        \def\@tempa{\@oparg{\@begintheorem{#4}{}}[]}%
+    \else%
+        \refstepcounter[#1]{#3}%  <<< cleveref modification
+        \def\@tempa{\@oparg{\@begintheorem{#4}{\csname the#3\endcsname}}[]}%
+    \fi%
+    \@tempa
+}%
+}% AtBeginDocument
+
+\def\@endtheorem{\endtrivlist\endBlockClass\@endpefalse }
+%    \end{macrocode}
 %
 %
+%
+%
 % Proof QED symbol:
 %    \begin{macrocode}
 \AtBeginDocument{
@@ -24749,7 +25683,7 @@
   \pushQED{\qed}%
   \normalfont \topsep6\p@\@plus6\p@\relax
   \trivlist
-  \item[\hskip\labelsep
+  \item[
         \InlineClass{amsthmproofname}{#1\@addpunct{.}}]\ignorespaces% changes
 }{%
   \InlineClass{theoremendmark}{\popQED}\endtrivlist%
@@ -24920,8 +25854,46 @@
 %
 %
 %
+% \iffalse
+%<*array>
+% \fi
 %
+% \part{lwarp-array.sty}
+%
+% \section{array}
+%
+% \DescribePackage{array}
+% \pkg{array} is used as-is for print output, and emulated for \HTML.
+%
+% \changes{v0.45}{2017/12/03}{\pkg{array}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{array}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\let\LWR at origfirsthline\firsthline
+\let\LWR at origlasthline\lasthline
+
+\appto{\LWR at restoreorigformatting}{%
+\let\firsthline\LWR at origfirsthline%
+\let\lasthline\LWR at origlasthline%
+}
+
+\renewcommand*{\firsthline}{\LWR at hline}%
+\renewcommand*{\lasthline}{\LWR at hline}%
+%    \end{macrocode}
+%
 % \iffalse
+%</array>
+% \fi
+%
+%
+%
+%
+% \iffalse
 %<*atbegshi>
 % \fi
 %
@@ -25025,7 +25997,49 @@
 %
 %
 %
+%
+%
 % \iffalse
+%<*backref>
+% \fi
+%
+% \part{lwarp-backref.sty}
+
+% \section{backref}
+%
+% \credits{David Carlisle and Sebastian Rahtz}
+%
+% \DescribePackage{backref}
+% \pkg{backref} is patched for use by \pkg{lwarp}.
+%
+% Note that \pkg{backref} must be explicitly loaded,
+% \watchout[loading]
+% and is not automatically loaded by \pkg{hyperref} when
+% generating \HTML\ output.
+%
+% \changes{v0.45}{2018/01/14}{\pkg{backref}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{backref}
+%    \end{macrocode}
+
+% Force the |hyperref| option:
+%    \begin{macrocode}
+\def\backref{}\let\backrefxxx\hyper at section@backref
+%    \end{macrocode}
+
+% \iffalse
+%</backref>
+% \fi
+%
+%
+%
+%
+%
+%
+% \iffalse
 %<*balance>
 % \fi
 %
@@ -25339,6 +26353,7 @@
 % \pkg{breakurl} is emulated.
 %
 % \changes{v0.43}{2017/10/31}{\pkg{breakurl}: Added.}
+% \changes{v0.45}{2017/12/29}{Improved URLs with underscores.}
 %
 % \codehtml
 %
@@ -25349,18 +26364,16 @@
 %    \begin{macrocode}
 \LetLtxMacro\burl\url
 
-\NewDocumentCommand{\LWR at burlaltb}{O{} +m m}{%
-\LWR at subhyperref{#3}{#2}% order reversed from \href
-\endgroup%
+\NewDocumentCommand{\burlalt}{O{} +m m}{%
 \LWR at ensuredoingapar%
+\def\LWR at templink{#2}%
+\@onelevel at sanitize\LWR at templink%
+\def\LWR at templinktwo{#3}%
+\@onelevel at sanitize\LWR at templinktwo%
+\LWR at subhyperref{\LWR at templink}{\LWR at templinktwo}%
+\LWR at ensuredoingapar%
 }
 
-\DeclareRobustCommand*{\burlalt}{%
-\LWR at ensuredoingapar%
-\begingroup%
-\catcode`\_=12
-\LWR at burlaltb%
-}
 \LetLtxMacro\urlalt\burlalt
 %    \end{macrocode}
 %
@@ -25497,8 +26510,47 @@
 %
 %
 %
+% \iffalse
+%<*changebar>
+% \fi
 %
+% \part{lwarp-changebar.sty}
+%
+% \section{changebar}
+%
+% \DescribePackage{changebar}
+% \pkg{changebar} is ignored.
+%
+% \changes{v0.45}{2017/12/15}{\pkg{changebar}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{changebar}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\newcommand*{\cbstart}{}
+\newcommand*{\cbend}{}
+\newenvironment*{\changebar}{}{}
+\newcommand*{\cbdelete}{}
+\newcommand*{\nochnagebars}{}
+\newcommand*{\cbcolor}[1]{}
+\newlength{\changebarwidth}
+\newlength{\deletebarwidth}
+\newlength{\changebarsep}
+\newcounter{changebargrey}
+%    \end{macrocode}
+%
 % \iffalse
+%</changebar>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*changepage>
 % \fi
 
@@ -25525,17 +26577,22 @@
 \DeclareRobustCommand{\checkoddpage}{\oddpagetrue}
 \DeclareRobustCommand{\changetext}[5]{}
 \DeclareRobustCommand{\changepage}[9]{}
+
+\@ifundefined{adjustwidth}{
 \newenvironment{adjustwidth}[2]{}{}
 \newenvironment{adjustwidth*}[2]{}{}
+}{
+\renewenvironment{adjustwidth}[2]{}{}
+\renewenvironment{adjustwidth*}[2]{}{}
+}
 %    \end{macrocode}
 
 % \changes{v0.44}{2017/11/13}{\pkg{changepage}: Additional options.}
 %    \begin{macrocode}
-\newcommand*{\strictpagecheck}{}
-\newcommand*{\easypagecheck}{}
+\DeclareDocumentCommand{\strictpagecheck}{}
+\DeclareDocumentCommand{\easypagecheck}{}
 %    \end{macrocode}
 
-
 % \iffalse
 %</changepage>
 % \fi
@@ -25606,9 +26663,53 @@
 %
 %
 %
+% \iffalse
+%<*cite>
+% \fi
 %
+% \part{lwarp-cite.sty}
+
+% \section{cite}
 %
+% \credits{Donald Arseneau}
+%
+% \DescribePackage{cite}
+% \pkg{cite} is patched for use by \pkg{lwarp}.
+%
+% \changes{v0.45}{2018/01/13}{\pkg{cite}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{cite}
+%    \end{macrocode}
+
+% For the [super] option, the \cs{kern} must be removed:
+%    \begin{macrocode}
+\def\LWRCT at biblabel#1{\@citess{#1}\kern-\labelsep\,}
+
+\ifdefstrequal{\@biblabel}{\LWRCT at biblabel}
+{
+    \def\@biblabel#1{\@citess{#1}}
+}{}
+%    \end{macrocode}
+
+% For the [super] option, \cs{textsuperscript} is used instead of math superscript:
+%    \begin{macrocode}
+\def\@citess#1{\textsuperscript{#1}}
+
+\DeclareDocumentCommand\citepunct{}{,\,\relax}
+%    \end{macrocode}
+
 % \iffalse
+%</cite>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*color>
 % \fi
 %
@@ -25638,8 +26739,44 @@
 %
 %
 %
+% \iffalse
+%<*continue>
+% \fi
 %
+% \part{lwarp-continue.sty}
+%
+% \section{continue}
+%
+% \DescribePackage{continue}
+% \pkg{continue} is ignored.
+%
+% \changes{v0.45}{2017/12/19}{\pkg{continue}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{continue}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\newcommand*{\flagcont}{}
+\newcommand*{\flagend}{}
+\newcommand*{\flagword}{}
+\newcommand*{\preflagword}{}
+\newcommand*{\postflagword}{}
+\newlength\contsep
+\newlength\contdrop
+%    \end{macrocode}
+%
 % \iffalse
+%</continue>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*crop>
 % \fi
 %
@@ -25832,7 +26969,6 @@
 %
 %
 %
-%
 % \iffalse
 %<*draftwatermark>
 % \fi
@@ -26041,6 +27177,49 @@
 %
 %
 % \iffalse
+%<*endfloat>
+% \fi
+%
+% \part{lwarp-endfloat.sty}
+%
+% \section{endfloat}
+%
+% \DescribePackage{endfloat}
+% \pkg{endfloat} is ignored.
+%
+% \changes{v0.45}{2017/12/19}{\pkg{endfloat}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{endfloat}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\newcommand\figureplace{}
+\newcommand\tableplace{}
+\newcommand\floatplace[1]{}
+\newcounter{posttable}
+\newcounter{postfigure}
+\newcommand*{\theposttbl}{}
+\newcommand*{\thepostfig}{}
+\newcommand{\AtBeginFigures}[1]{}
+\newcommand{\AtBeginTables}[1]{}
+\newcommand{\AtBeginDelayedFloats}[1]{}
+\newcommand*{\processdelayedfloats}{}
+\newcommand*{\efloatseparator}{}
+%    \end{macrocode}
+%
+% \iffalse
+%</endfloat>
+% \fi
+%
+%
+%
+%
+%
+%
+% \iffalse
 %<*endnotes>
 % \fi
 
@@ -26206,7 +27385,7 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newcommand{\qitem}[2]
+\DeclareDocumentCommand{\qitem}{m m}
 {
 \begin{BlockClass}{qitem}
 #1
@@ -26220,7 +27399,7 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newcommand{\epigraph}[2]
+\DeclareDocumentCommand{\epigraph}{m m}
 {
 \begin{LWR at BlockClassWP}{text-align:right}{}{epigraph}
 \qitem{#1}{#2}
@@ -26227,7 +27406,7 @@
 \end{LWR at BlockClassWP}
 }
 
-\newenvironment*{epigraphs}
+\DeclareDocumentEnvironment{epigraphs}{}
 {\LWR at BlockClassWP{text-align:right}{}{epigraph}}
 {\endLWR at BlockClassWP}
 %    \end{macrocode}
@@ -26236,12 +27415,23 @@
 %
 % The following are null commands for source compatibility:
 %    \begin{macrocode}
+\newenvironment*{flushepinormal}{}{}
+%    \end{macrocode}
+%
+% \changes{v0.45}{2017/12/22}{\pkg{epigraph}: Support for \pkg{memoir}.}
+%    \begin{macrocode}
+\@ifclassloaded{memoir}{
+\setlength{\epigraphwidth}{.5\linewidth}
+\renewcommand{\textflush}{flushepinormal}
+\renewcommand{\epigraphhead}[2][0]{#2}
+\renewcommand{\dropchapter}[1]{}
+\renewcommand*{\undodrop}{}
+}{% not memoir
 \newlength{\epigraphwidth}
 \setlength{\epigraphwidth}{.5\linewidth}
-\newenvironment*{flushepinormal}{}{}
-\newcommand{\textflush}[1]{flushepinormal}
-\newcommand{\epigraphflush}[1]{flushright}
-\newcommand{\sourceflush}[1]{flushright}
+\newcommand{\textflush}{flushepinormal}
+\newcommand{\epigraphflush}{flushright}
+\newcommand{\sourceflush}{flushright}
 \newcommand*{\epigraphsize}{\small}
 \newlength{\epigraphrule}
 \newlength{\beforeepigraphskip}
@@ -26249,6 +27439,9 @@
 \newcommand{\epigraphhead}[2][0]{#2}
 \newcommand{\dropchapter}[1]{}
 \newcommand*{\undodrop}{}
+}% not memoir
+
+\let\cleartoevenpage\relax% also in nextpage
 \newcommand{\cleartoevenpage}[1][]{}
 %    \end{macrocode}
 %
@@ -26574,7 +27767,7 @@
 \def\endLandscape{}
 %    \end{macrocode}
 %
-% Low-level patches for \env{Verbatim}, \env{VerbatimInput}, \env{UseVerbatim}:
+% Low-level patches for \env{UseVerbatim} and friends:
 %
 %    \begin{macrocode}
 \let\LWRFB at UseVerbatim\UseVerbatim
@@ -26760,6 +27953,7 @@
 %
 %
 % \changes{v0.34}{2017/07/27}{\pkg{fancyvrb}: Added, no longer required.}
+% \changes{v0.45}{2018/01/07}{\pkg{fancyvrb}: Improvements.}
 %
 % \codehtml
 %    \begin{macrocode}
@@ -26767,7 +27961,6 @@
 \LWR at ProvidesPackagePass{fancyvrb}
 %    \end{macrocode}
 %
-
 % \codehtml
 %    \begin{macrocode}
 \begin{warpHTML}
@@ -26795,30 +27988,46 @@
 \LWR at traceinfo{Patching Verbatim.}
 %    \end{macrocode}
 %
-% Remember the original defintion of \env{Verbatim}:
+%
+% \changes{v0.45}{2018/01/07}{\pkg{fancyvrb}: Improvements.}
 %    \begin{macrocode}
-\let\LWRFV at origVerbatim\Verbatim
+\preto\FVB at Verbatim{\LWR at forcenewpage}
+\preto\FVB at LVerbatim{\LWR at forcenewpage}
+% \preto\FVB at BVerbatim{\LWR at forcenewpage}% Fails, so done below.
 %    \end{macrocode}
 %
+% Simplified to remove \PDF\ formatting:
+% \changes{v0.45}{2018/01/07}{\pkg{fancyvrb}: Improvements.}
+%    \begin{macrocode}
+\def\FV at BeginListFrame@Single{%
+  \FV at SingleFrameLine{\z@}%
+}
+
+\def\FV at EndListFrame@Single{%
+  \FV at SingleFrameLine{\@ne}%
+}
+
+\def\FV at BeginListFrame@Lines{%
+  \FV at SingleFrameLine{\z@}%
+}
+
+\def\FV at EndListFrame@Lines{%
+    \FV at SingleFrameLine{\@ne}%
+}
+
+\renewcommand*{\FV at SingleFrameSep}{}
+%    \end{macrocode}
 %
-% \begin{environment}{Verbatim}
-%
-% Patched to place the environment in a |fancyvrb| div,
-% and the label in a |fancyvrblabel| div.
-% Also corrects the left margin for line numbers.
-% Also uses |VerbatimHTMLWidth| to control placement of line numbers on the right.
-% Aligning the right margin requires knowing the width.
-%
-% \changes{v0.20}{2016/12/24}{Added.}
-%
+% Adds \HTML\ formatting:
 %    \begin{macrocode}
-\renewcommand*{\Verbatim}{%
-\LWR at forcenewpage
-\LWRFV at origVerbatim%
+\def\FV at BUseVerbatim#1{%
+    \LWR at atbeginverbatim[\LWR at FVstyle]{verbatim}%
+    \FV at BVerbatimBegin#1\FV at BVerbatimEnd%
+    \LWR at afterendverbatim%
 }
 %    \end{macrocode}
-% \end{environment}
-%
+
+
 % \begin{macro}{\LWR at FVstyle} Holds the style of the verbatim.
 %    \begin{macrocode}
 \newcommand*{\LWR at FVstyle}{}
@@ -26831,12 +28040,16 @@
 %    \begin{macrocode}
 \newcommand*{\LWR at fvstartnone}{%
 \LWR at traceinfo{fvstartnone}%
-\hbox to\z@{\LWR at atbeginverbatim[\LWR at FVstyle]{verbatim}}%
+% \hbox to\z@{
+\LWR at atbeginverbatim[\LWR at FVstyle]{verbatim}%
+% }%
 }
 
 \newcommand*{\LWR at fvendnone}{%
 \LWR at traceinfo{fvendnone}%
-\hbox to\z@{\LWR at afterendverbatim}%
+% \hbox to\z@{
+\LWR at afterendverbatim%
+% }%
 }
 
 \newcommand*{\LWR at fvstartsingle}{%
@@ -26854,7 +28067,10 @@
 \newcommand*{\LWR at fvstartline}{%
 \LWR at traceinfo{fvstartline}%
 \LWR at fvstartnone%
+% \setlength{\LWR at templengthone}{\baselineskip}%
 \FV at BeginListFrame@Lines%
+% \setlength{\baselineskip}{\LWR at templengthone}%
+% \setlength{\baselineskip}{5pt}%
 }
 
 \newcommand*{\LWR at fvendline}{%
@@ -26942,7 +28158,7 @@
 % Original code is from the \pkg{fancyvrb} package.
 %    \begin{macrocode}
 \def\FV at SingleFrameLine#1{%
-  \hbox to\z@{%
+%   \hbox to\z@{%
 %     \kern\leftmargin
     \ifnum#1=\z@\relax
       \let\FV at Label\FV at LabelBegin
@@ -26966,15 +28182,15 @@
         \ifx\FV at LabelPositionBottomLine\relax
         \else
         \LWR at FVfindbordercolor
+
         \LWR at htmltagc{div class="fancyvrblabel" style="color: \#\LWR at tempcolor"}
         \LWR at origtextrm{\FV at LabelEnd}
         \LWR at htmltagc{/div}
         \fi
       \fi
-
     \fi
-    \hss
-    }
+%     \hss
+%     }
 }
 %    \end{macrocode}
 %
@@ -27001,16 +28217,15 @@
 % \begin{environment}{BVerbatim}
 %    \begin{macrocode}
 \AtBeginEnvironment{BVerbatim}
-{
-\LWR at forcenewpage
-\LWR at atbeginverbatim{bverbatim}
-
+{%
+\LWR at forcenewpage% instead of \preto
+\LWR at atbeginverbatim{bverbatim}%
 }
 
 \AfterEndEnvironment{BVerbatim}
-{
-\leavevmode\par\LWR at origvspace{-\baselineskip}
-\LWR at afterendverbatim
+{%
+\leavevmode\par\LWR at origvspace{-\baselineskip}%
+\LWR at afterendverbatim%
 }
 %    \end{macrocode}
 % \end{environment}
@@ -27233,6 +28448,33 @@
 %
 %
 % \iffalse
+%<*flafter>
+% \fi
+%
+% \part{lwarp-flafter.sty}
+%
+% \section{flafter}
+%
+% \DescribePackage{flafter}
+% \pkg{flafter} is ignored.
+%
+% \changes{v0.45}{2017/12/02}{\pkg{flafter}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{flafter}
+\providecommand\fl at trace[1]{}
+%    \end{macrocode}
+%
+% \iffalse
+%</flafter>
+% \fi
+%
+%
+%
+%
+% \iffalse
 %<*float>
 % \fi
 
@@ -27259,7 +28501,7 @@
 % See \cref{sec:listof} for the \cs{listof} command.
 
 
-% \begin{macro}{\newfloat} \marg{1: type} \marg{2: placement}
+% \begin{noindmacro}{\newfloat} \marg{1: type} \marg{2: placement}
 %							\marg{3: ext} \oarg{4: within}
 %
 % Emulates the \cs{newfloat} command from the \pkg{float} package.
@@ -27268,21 +28510,22 @@
 %
 %    \begin{macrocode}
 \NewDocumentCommand{\newfloat}{m m m o}{%
-\IfValueTF{#4}
-{\DeclareFloatingEnvironment[fileext=#3,within=#4]{#1}}
-{\DeclareFloatingEnvironment[fileext=#3]{#1}}
+\IfValueTF{#4}%
+{\DeclareFloatingEnvironment[fileext=#3,within=#4]{#1}}%
+{\DeclareFloatingEnvironment[fileext=#3]{#1}}%
 %    \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
+\cslet{listof#1s}\relax%
+\cslet{listof#1es}\relax%
 }
 %    \end{macrocode}
-% \end{macro}
+% \end{noindmacro}
 
-% \begin{macro}{\floatname} \marg{type} \marg{name}
+% \begin{noindmacro}{\floatname} \marg{type} \marg{name}
 %
 % Sets the text name of the float, such as ``Figure''.
 %    \begin{macrocode}
@@ -27290,9 +28533,9 @@
 \SetupFloatingEnvironment{#1}{name=#2}%
 }
 %    \end{macrocode}
-% \end{macro}
+% \end{noindmacro}
 
-% \begin{macro}{\floatplacement} \marg{type} \marg{placement}
+% \begin{noindmacro}{\floatplacement} \marg{type} \marg{placement}
 %
 % Float placement is ignored.
 %    \begin{macrocode}
@@ -27300,9 +28543,9 @@
 \SetupFloatingEnvironment{#1}{placement=#2}%
 }
 %    \end{macrocode}
-% \end{macro}
+% \end{noindmacro}
 
-% \begin{macro}{\floatstyle} \marg{style}
+% \begin{noindmacro}{\floatstyle} \marg{style}
 %
 % Float styles are ignored.
 %    \begin{macrocode}
@@ -27309,9 +28552,9 @@
 \newcommand{\floatstyle}[1]{%
 }
 %    \end{macrocode}
-% \end{macro}
+% \end{noindmacro}
 
-% \begin{macro}{\restylefloat} * \marg{style}
+% \begin{noindmacro}{\restylefloat} * \marg{style}
 %
 % Float styles are ignored.
 %    \begin{macrocode}
@@ -27318,7 +28561,7 @@
 \NewDocumentCommand{\restylefloat}{s m}{%
 }
 %    \end{macrocode}
-% \end{macro}
+% \end{noindmacro}
 
 % \iffalse
 %</float>
@@ -27662,11 +28905,11 @@
 %    \end{macrocode}
 % Reset key values:
 %    \begin{macrocode}
-\renewcommand*{\LWR at frowkeyplacement}{}
-\renewcommand*{\LWR at frowkeyname}{}
-\renewcommand*{\LWR at frowkeyfileext}{}
-\renewcommand*{\LWR at frowkeywithin}{}
-\renewcommand*{\LWR at frowkeycapstyle}{}
+\renewcommand*{\LWR at frowkeyplacement}{}%
+\renewcommand*{\LWR at frowkeyname}{}%
+\renewcommand*{\LWR at frowkeyfileext}{}%
+\renewcommand*{\LWR at frowkeywithin}{}%
+\renewcommand*{\LWR at frowkeycapstyle}{}%
 %    \end{macrocode}
 % Read new key values:
 %    \begin{macrocode}
@@ -27676,24 +28919,24 @@
 %    \end{macrocode}
 % Create a new float with optional [within]:
 %    \begin{macrocode}
-\ifthenelse{\equal{\LWR at frowkeywithin}{}}
-{
-    \LWR at traceinfo{about to newfloat #1 \LWR at frowkeyplacement\ 
+\ifthenelse{\equal{\LWR at frowkeywithin}{}}%
+{%
+    \LWR at traceinfo{about to newfloat #1 \LWR at frowkeyplacement\ %
         \LWR at frowkeyfileext}%
-    \newfloat{#1}{\LWR at frowkeyplacement}{\LWR at frowkeyfileext}
+    \newfloat{#1}{\LWR at frowkeyplacement}{\LWR at frowkeyfileext}%
 }%
 {%
-    \LWR at traceinfo{about to newfloat #1\ \LWR at frowkeyplacement\ 
+    \LWR at traceinfo{about to newfloat #1\ \LWR at frowkeyplacement\ %
         \LWR at frowkeyfileext\ \LWR at frowkeywithin}%
     \newfloat{#1}{\LWR at frowkeyplacement}%
     {\LWR at frowkeyfileext}[\LWR at frowkeywithin]%
-    \LWR at traceinfo{finished newfloat #1}
+    \LWR at traceinfo{finished newfloat #1}%
 }%
 %    \end{macrocode}
 % Rename the float if a name was given:
 %    \begin{macrocode}
-\ifthenelse{\equal{\LWR at frowkeyname}{}}
-{}
+\ifthenelse{\equal{\LWR at frowkeyname}{}}%
+{}%
 {\floatname{#1}{\LWR at frowkeyname}}%
 }
 %    \end{macrocode}
@@ -27778,8 +29021,40 @@
 %
 %
 %
+% \iffalse
+%<*fltrace>
+% \fi
 %
+% \part{lwarp-fltrace.sty}
+%
+% \section{fltrace}
+%
+% \DescribePackage{fltrace}
+% \pkg{fltrace} is ignored.
+%
+% \changes{v0.45}{2017/12/02}{\pkg{fltrace}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{fltrace}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\def\tracefloats{}
+\def\tracefloatsoff{}
+\def\tracefloatvals{}
+%    \end{macrocode}
+%
 % \iffalse
+%</fltrace>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*flushend>
 % \fi
 %
@@ -28080,7 +29355,7 @@
 }
 
 % \let\fn at endnote\color at endgroup% *** conflicts with lwarp
-\newcommand*{\fn at endnote}{%
+\def\fn at endnote{%
 \LWR at htmltagc{/\LWR at tagregularparagraph}%
 \LWR at orignewline%
 }
@@ -28159,8 +29434,37 @@
 %
 %
 %
+% \iffalse
+%<*footnpag>
+% \fi
 %
+% \part{lwarp-footnpag.sty}
+%
+% \section{footnpag}
+%
+% \DescribePackage{footnpag}
+% \pkg{footnpag} is ignored.
+%
+% \changes{v0.45}{2017/12/19}{\pkg{footnpag}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{footnpag}
+%    \end{macrocode}
+%
 % \iffalse
+%</footnpag>
+% \fi
+%
+%
+%
+%
+%
+%
+%
+%
+% \iffalse
 %<*framed>
 % \fi
 
@@ -28202,7 +29506,7 @@
 \renewenvironment{shaded}{%
 \convertcolorspec{named}{shadecolor}{HTML}\LWR at tempcolor%
 \LWR at forcenewpage
-\BlockClass[background: \#\LWR at tempcolor]{framed}%
+\BlockClass[background: \#\LWR at tempcolor]{shaded}%
 }
 {\endBlockClass}
 
@@ -28209,7 +29513,7 @@
 \renewenvironment{shaded*}{%
 \convertcolorspec{named}{shadecolor}{HTML}\LWR at tempcolor%
 \LWR at forcenewpage
-\BlockClass[background: \#\LWR at tempcolor]{framed}%
+\BlockClass[background: \#\LWR at tempcolor]{shaded}%
 }
 {\endBlockClass}
 
@@ -28417,8 +29721,43 @@
 %
 %
 %
+% \iffalse
+%<*fwlw>
+% \fi
 %
+% \part{lwarp-fwlw.sty}
+%
+% \section{fwlw}
+%
+% \DescribePackage{fwlw}
+% \pkg{fwlw} is ignored.
+%
+% \changes{v0.45}{2017/12/19}{\pkg{fwlw}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{fwlw}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\newbox\FirstWordBox     \global\setbox\FirstWordBox\hbox{}
+\newbox\NextWordBox      \global\setbox\NextWordBox\hbox{}
+\newbox\LastWordBox      \global\setbox\LastWordBox\hbox{}
+\def\ps at fwlwhead{}
+\def\ps at NextWordFoot{}
+%    \end{macrocode}
+%
 % \iffalse
+%</fwlw>
+% \fi
+%
+%
+%
+%
+%
+%
+% \iffalse
 %<*geometry>
 % \fi
 
@@ -28794,6 +30133,7 @@
 % \changes{v0.29}{2017/04/15}{Fix: Error when no optional arguments.}
 % \changes{v0.40}{2017/09/08}{Add: Full \cs{graphicspath} support.}
 % \changes{v0.42}{2017/10/26}{Fix: Filename expansion.}
+% \changes{v0.45}{2017/12/29}{Improved URLs with underscores.}
 %    \begin{macrocode}
 \NewDocumentCommand{\LWR at includegraphicsb}{s o o m}
 {%
@@ -28826,6 +30166,8 @@
 \Ginclude at graphics{\detokenize\expandafter{#4}}%
 \endgroup%
 \filename at parse{\LWR at parsedfilename}%
+\LWR at traceinfo{LWR at parsedfilename is \LWR at parsedfilename}%
+% \LWR at sanitize{\LWR at parsedfilename}%
 %    \end{macrocode}
 %
 % For correct em sizing during the width and height conversions:
@@ -28911,8 +30253,11 @@
 {% start of href
 \LWR at traceinfo{LWR at includegraphicsb: about to LWR at htmltag}%
 \LWR at htmltag{% start of image tags
-img src="\LWR at parsedfilename" \LWR at orignewline%
-\LWR at origtilde{} alt="[\filename at base]" \LWR at orignewline%
+% img src="\LWR at sanitized" \LWR at orignewline%
+img src="%
+\begingroup\@sanitize\LWR at parsedfilename\endgroup%
+" \LWR at orignewline%
+% \LWR at origtilde{} alt="[\filename at base]" \LWR at orignewline%
 %    \end{macrocode}
 % Only include a style tag if a width, height, angle, or scale was given:
 %    \begin{macrocode}
@@ -28954,7 +30299,6 @@
 \LWR at origtilde{} class="\LWR at igclass" \LWR at orignewline%
 }% end of image tags
 }% end of href
-\endgroup
 %    \end{macrocode}
 % Return to small-sized output:
 %    \begin{macrocode}
@@ -28985,10 +30329,8 @@
 % This graphic should trigger an \HTML\ paragraph even if alone,
 % so ensure that are doing paragraph handling:
 %    \begin{macrocode}
-\LWR at traceinfo{includegraphics}
+\LWR at traceinfo{includegraphics}%
 \LWR at ensuredoingapar%
-\begingroup%
-\catcode`\_=12
 \LWR at includegraphicsb%
 }% includegraphics
 }% AtBeginDocument
@@ -29079,7 +30421,7 @@
 \LWR at rotstyle{-ms-}{#2} %
 \LWR at rotstyle{-webkit-}{#2} %
 \LWR at rotstyle{}{#2} %
-"{}}\LWR at orignewline%
+"}\LWR at orignewline%
 %    \end{macrocode}
 % Print the text to be rotated:
 %    \begin{macrocode}
@@ -29111,7 +30453,7 @@
 \LWR at scalestyle{-ms-}{#1}{\IfNoValueTF{#2}{#1}{#2}} %
 \LWR at scalestyle{-webkit-}{#1}{\IfNoValueTF{#2}{#1}{#2}} %
 \LWR at scalestyle{}{#1}{\IfNoValueTF{#2}{#1}{#2}} %
-"{}}%
+"}%
 %    \end{macrocode}
 % Print the text to be scaled:
 %    \begin{macrocode}
@@ -29231,6 +30573,8 @@
 %
 % \section{hang}
 %
+% \credits{Andreas Nolda}
+%
 % \DescribePackage{hang}
 % \pkg{hang} is emulated.
 %
@@ -29314,8 +30658,82 @@
 %
 %
 %
+% \iffalse
+%<*hanging>
+% \fi
 %
+% \part{lwarp-hanging.sty}
+%
+% \section{hanging}
+%
+% \DescribePackage{hanging}
+% \pkg{hanging} is emulated.
+%
+% \changes{v0.45}{2017/12/02}{\pkg{hanging}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{hanging}
+%    \end{macrocode}
+%
+%
+%    \begin{macrocode}
+\@ifclassloaded{memoir}{
+\let\hangpara\relax
+\let\hangparas\relax
+\let\endhangparas\relax
+\let\hangpunct\relax
+\let\endhangpunct\relax
+}{}
+%    \end{macrocode}
+%
+% \begin{noindmacro}{\hangpara} \marg{indent} \marg{afternum}
+%
+% \textcolor{red}{Use \env{hangparas} instead.}
+%    \begin{macrocode}
+\newcommand*{\hangpara}[2]{}
+%    \end{macrocode}
+% \end{noindmacro}
+
+% \begin{noindenvironment}{hangparas} \marg{indent} \marg{afternum}
+%    \begin{macrocode}
+\newenvironment*{hangparas}[2]
+{%
+    \uselengthunit{PT}%
+    \BlockClass[%
+        margin-left:\rndprintlength{#1}; %
+        text-indent:-\rndprintlength{#1}%
+    ]%
+    {hangingpar}%
+}
+{\endBlockClass}
+%    \end{macrocode}
+% \end{noindenvironment}
+%
+% \begin{noindenvironment}{hangpunct}
+%    \begin{macrocode}
+\newenvironment*{hangpunct}
+{\BlockClass{hangpunct}}
+{\endBlockClass}
+%    \end{macrocode}
+% \end{noindenvironment}
+%
+%    \begin{macrocode}
+\newcommand{\nhpt}{.}
+\newcommand{\nhlq}{‘}
+\newcommand{\nhrq}{’}
+%    \end{macrocode}
+%
 % \iffalse
+%</hanging>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*hyperref>
 % \fi
 
@@ -29353,17 +30771,14 @@
 % Insert an image with alt text:
 %
 % \changes{v0.43}{2017/10/31}{\pkg{hyperref}: Made robust.}
+% \changes{v0.45}{2017/12/29}{Improved filenames with underscores.}
 %    \begin{macrocode}
-\NewDocumentCommand{\LWR at hyperimageb}{m +m}{%
-\LWR at htmltag{img src="#1" alt="#2" class="hyperimage"{}}%
-\endgroup%
+\NewDocumentCommand{\hyperimage}{m +m}{%
 \LWR at ensuredoingapar%
-}
-
-\DeclareRobustCommand*{\hyperimage}{%
+\def\LWR at templink{#1}%
+\@onelevel at sanitize\LWR at templink%
+\LWR at htmltag{img src="\LWR at templink" alt="#2" class="hyperimage"}%
 \LWR at ensuredoingapar%
-\begingroup\catcode`\_=12
-\LWR at hyperimageb%
 }
 %    \end{macrocode}
 % \end{noindmacro}
@@ -29377,7 +30792,7 @@
 %    \begin{macrocode}
 \NewDocumentCommand{\hyperdef}{m m +m}{%
 \LWR at ensuredoingapar%
-\LWR at subsublabel{#1.#2}%
+\LWR at sublabel{#1.#2}%
 #3%
 }
 %    \end{macrocode}
@@ -29386,14 +30801,22 @@
 %
 % \begin{noindmacro}{\LWR at hyperrefb} \marg{1: URL} \marg{2: category}
 %							\marg{3: name} \marg{4: text}
+% \changes{v0.45}{2018/01/02}{\pkg{hyperref}: Fix for underscores in \cs{hyperref}.}
 %
 % Creates an \HTML\ link to |URL#category.name| with the given text.
 %    \begin{macrocode}
 \NewDocumentCommand{\LWR at hyperrefb}{m m m +m}{%
-\LWR at htmltag{a href="#1\LWR at hashmark#2.#3"}%
+\def\LWR at templink{#1}%
+\@onelevel at sanitize\LWR at templink%
+\def\LWR at templinktwo{#2}%
+\@onelevel at sanitize\LWR at templinktwo%
+\def\LWR at templinkthree{#3}%
+\@onelevel at sanitize\LWR at templinkthree%
+\LWR at htmltag{a href="\LWR at templink\LWR at hashmark%
+    \LWR at templinktwo.\LWR at templinkthree"%
+}%
 #4%
 \LWR at htmltag{/a}%
-\endgroup%
 }
 %    \end{macrocode}
 % \end{noindmacro}
@@ -29406,7 +30829,6 @@
 \LWR at startref{#1}%
 #2%
 \LWR at htmltag{/a}%
-\endgroup%
 }
 %    \end{macrocode}
 % \end{noindmacro}
@@ -29419,7 +30841,6 @@
 %    \begin{macrocode}
 \DeclareRobustCommand*{\hyperref}{%
 \LWR at ensuredoingapar%
-\begingroup\catcode`\_=12
 \@ifnextchar[\LWR at hyperrefc\LWR at hyperrefb%
 }
 %    \end{macrocode}
@@ -29445,8 +30866,9 @@
 % Creates a link to the anchor created by hypertarget,
 % with the given link text.
 %
+% Declared because also defined by \pkg{memoir}.
 %    \begin{macrocode}
-\NewDocumentCommand{\hyperlink}{m +m}{%
+\DeclareDocumentCommand{\hyperlink}{m +m}{%
 \hyperref[#1]{#2}%
 }
 %    \end{macrocode}
@@ -30947,6 +32369,22 @@
 %
 % \changes{v0.17}{2016/04/14}{\pkg{mdframed}: Added.}
 %
+%
+% \subsection{Limitations}
+%
+% \limitsmdframed
+%
+% Environments created or encapsulated by \pkg{mdframed} are enclosed in a
+% \margintag{CSS classes}
+% \element{div} of class |md<environmentname>|, or |mdframed| otherwise.
+%
+% Frame titles are placed into a \element{span} of class |mdframedtitle|.
+% Subtitles are in a \element{span} of class |mdframedsubtitle|,
+% and likewise for subsubtitles.
+%
+% Pre-existing hooks are used to patch extra functions before and after the frames.
+%
+%
 % \subsection{Package loading}
 %
 % \codehtml
@@ -30967,22 +32405,42 @@
 %    \end{macrocode}
 %
 %
-% \subsection{Limitations}
+% \subsection{Patches}
 %
-% \limitsmdframed
+% Patch to remove \PDF\ formatting and add \HTML\ tags:
+%    \begin{macrocode}
+\AtBeginDocument{
+\def\mdf at trivlist#1{%
+  \edef\mdf at temp{%
+%     \topsep=\the\topsep\relax%
+%     \partopsep=\the\partopsep\relax%
+%     \parsep=\the\parsep\relax%
+  }%
+%   \setlength{\topsep}{#1}%
+%   \topskip\z@%
+%   \partopsep\z@%
+%   \parsep\z@%
+%   \@nmbrlistfalse%
+%   \@trivlist%
+%   \labelwidth\z@%
+%   \leftmargin\z@%
+%   \itemindent\z@%
+  \let\@itemlabel\@empty%
+  \def\makelabel##1{##1}%
+%   \item\relax\mdf at temp\relax%
+}
+
+\renewcommand*{\endmdf at trivlist}{%
+\LWR at traceinfo{endmdf at trivlist}%
+% \endtrivlist%
+\LWR at listend%
+}
+}% AtBeginDocument
+%    \end{macrocode}
 %
-% Environments created or encapsulated by \pkg{mdframed} are enclosed in a
-% \margintag{CSS classes}
-% \element{div} of class |md<environmentname>|, or |mdframed| otherwise.
 %
-% Frame titles are placed into a \element{span} of class |mdframedtitle|.
-% Subtitles are in a \element{span} of class |mdframedsubtitle|,
-% and likewise for subsubtitles.
+% \subsection{Initial setup}
 %
-% Pre-existing hooks are used to patch extra functions before and after the frames.
-%
-%
-%
 % ^^A \DescribeMacro{\mdfsetup}
 % To handle CSS and paragraphs,
 % patch code at start and end of environment and contents.
@@ -31032,6 +32490,7 @@
 % Encapsulate a frame inside a \element{div} of the desired |class|.
 %    \begin{macrocode}
 \newcommand*{\LWR at mdframedstart}{%
+\LWR at traceinfo{LWR at mdframedstart start}%
 %    \end{macrocode}
 % Turn off paragraph handling during the generation of
 % the encapsulating tags:
@@ -31082,6 +32541,8 @@
 \LetLtxMacro{\hspace}{\LWR at orighspace}%
 \LetLtxMacro\rule\LWR at origrule%
 \LetLtxMacro\makebox\LWR at origmakebox%
+\LWR at startpars%
+\LWR at traceinfo{LWR at mdframedstart done}%
 }
 %    \end{macrocode}
 % \end{noindmacro}
@@ -31092,6 +32553,7 @@
 % After closing the \element{div}, globally restore to the default environment type:
 %    \begin{macrocode}
 \newcommand*{\LWR at mdframedend}{
+\LWR at traceinfo{LWR at mdframedend start}%
 %    \end{macrocode}
 % Close the custom \element{div}:
 %    \begin{macrocode}
@@ -31104,11 +32566,75 @@
 % Resume paragraph handling:
 %    \begin{macrocode}
 \LWR at startpars%
+\LWR at traceinfo{LWR at mdframedend done}%
 }
 %    \end{macrocode}
 % \end{noindmacro}
 %
 %
+% \subsection{Mdframed environment}
+%
+% \changes{v0.46}{2018/01/21}{\pkg{mdframed}: Fixes for \SVG\ math or \env{lateximage} in title.}
+%    \begin{macrocode}
+\renewenvironment{mdframed}[1][]{%
+ \color at begingroup%
+   \mdfsetup{userdefinedwidth=\linewidth,#1}%
+   \mdf at startcode%
+   \mdf at preenvsetting%
+   \ifdefempty{\mdf at firstframetitle}{}%
+           {\let\mdf at frametitlesave\mdf at frametitle%
+            \let\mdf at frametitle\mdf at firstframetitle%
+           }%
+   \ifvmode\nointerlineskip\fi%
+        \ifdefempty{\mdf at frametitle}{}%
+            {\mdfframedtitleenv{\mdf at frametitle}%
+%             \mdf@@frametitle at use%
+            }%
+   \mdf at trivlist{\mdf at skipabove@length}%%
+   \mdf at settings%
+%    \mdf at lrbox{\mdf at splitbox@one}%
+%    \mdf at startinnercode%
+  }%
+  {%
+%    \mdf@@ignorelastdescenders%
+   \par%
+%     \unskip\ifvmode\nointerlineskip\hrule \@height\z@ \@width\hsize\fi%%
+   \ifmdf at footnoteinside%
+      \def\mdf at reserveda{%
+        \mdf at footnoteoutput%
+%         \mdf at endinnercode%
+%         \endmdf at lrbox%
+%         \ifdefempty{\mdf at frametitle}{}%
+%             {\mdfframedtitleenv{\mdf at frametitle}\mdf@@frametitle at use}%
+%         \detected at mdf@put at frame
+      }%
+   \else%
+      \def\mdf at reserveda{%
+%         \mdf at endinnercode%
+%         \endmdf at lrbox%
+%         \ifdefempty{\mdf at frametitle}{}%
+%             {\mdfframedtitleenv{\mdf at frametitle}\mdf@@frametitle at use}%
+%         \detected at mdf@put at frame%
+        \mdf at footnoteoutput%
+        }%
+   \fi%
+   \mdf at reserveda%
+  \aftergroup\endmdf at trivlist%
+ \color at endgroup%
+ \mdf at endcode%
+}
+%    \end{macrocode}
+%
+% \changes{v0.46}{2018/01/21}{\pkg{mdframed}: Fixes for footnotes.}
+% \begin{noindmacro}{\mdf at footnoteoutput}
+%    \begin{macrocode}
+\renewrobustcmd*\mdf at footnoteoutput{%
+    \LWR at printpendingmpfootnotes%
+}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+%
 % \subsection{Titles and subtitles}
 %
 % \begin{noindmacro}{\mdfframedtitleenv} \marg{title}
@@ -31121,7 +32647,8 @@
 \newlength{\LWR at titleroundcorner}
 
 \renewrobustcmd\mdfframedtitleenv[1]{%
-\LWR at origmdfframedtitleenv{%
+\LWR at traceinfo{LWR at mdframedtitleenv start}%
+% \LWR at origmdfframedtitleenv{%
 %    \end{macrocode}
 % Below, print \HTML\ pt lengths:
 %    \begin{macrocode}
@@ -31175,8 +32702,9 @@
 %    \begin{macrocode}
 \LWR at htmltagc{/span}%
 \end{LWR at nestspan}%
+% }
+\LWR at traceinfo{LWR at mdframedtitleenv end}%
 }
-}
 %    \end{macrocode}
 % \end{noindmacro}
 %
@@ -31191,6 +32719,7 @@
 \NewDocumentCommand{\LWR at mdfsubtitlecommon}{m o m}
 {% the following empty line is required
 
+\LWR at traceinfo{LWR at mdframedsubtitlecommon start}%
 %    \end{macrocode}
 % Special handling for mdframed:
 % Subtitles have \cs{par}s around them,
@@ -31248,6 +32777,7 @@
 \LWR at htmltagc{/span}% the following empty line is required
 \end{LWR at nestspan}% must follow the /span or an extra <p> appears
 
+\LWR at traceinfo{LWR at mdframedsubtitlecommon end}%
 }
 %    \end{macrocode}
 % \end{noindmacro}
@@ -31254,8 +32784,6 @@
 %
 % \begin{noindmacro}{\LWR at mdfsubtitle} \oarg{options} \marg{title}
 %    \begin{macrocode}
-\let\LWR at origmdfsubtitle\mdfsubtitle
-
 \newcommand*{\LWR at mdfsubtitle}{%
 \LWR at mdfsubtitlecommon{sub}%
 }
@@ -31266,8 +32794,6 @@
 %
 % \begin{noindmacro}{\LWR at mdfsubsubtitle} \oarg{options} \marg{title}
 %    \begin{macrocode}
-\let\LWR at origmdfsubsubtitle\mdfsubsubtitle
-
 \newcommand*{\LWR at mdfsubsubtitle}{%
 \LWR at mdfsubtitlecommon{subsub}%
 }
@@ -31316,7 +32842,7 @@
 % \end{noindmacro}
 %
 %
-% \begin{noindmacro}{\mdtheorem} \oarg{mdframed-options}{envname}
+% \begin{noindmacro}{\mdtheorem} \oarg{mdframed-options} \marg{envname}
 %        \oarg{numberedlike} \marg{caption} \oarg{within}
 %
 % Modified from the original to remember the environment.
@@ -31416,7 +32942,7 @@
 % \end{noindmacro}
 %
 %
-% \begin{noindmacro}{\newmdtheoremenv} \oarg{mdframed-options}{envname}
+% \begin{noindmacro}{\newmdtheoremenv} \oarg{mdframed-options} \marg{envname}
 %        \oarg{numberedlike} \marg{caption} \oarg{within}
 %
 % Modified from the original to remember the environment.
@@ -31446,6 +32972,33 @@
 %
 %
 % \iffalse
+%<*memhfixc>
+% \fi
+%
+% \part{lwarp-memhfixc.sty}
+%
+% \section{memhfixc}
+%
+% \DescribePackage{memhfixc}
+% \pkg{memhfixc} is ignored.
+%
+% \changes{v0.45}{2018/01/03}{\pkg{memhfixc}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{memhfixc}
+%    \end{macrocode}
+%
+% \iffalse
+%</memhfixc>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*metalogo>
 % \fi
 %
@@ -31582,8 +33135,40 @@
 %
 %
 %
+% \iffalse
+%<*midpage>
+% \fi
 %
+% \part{lwarp-midpage.sty}
+%
+% \section{midpage}
+%
+% \DescribePackage{midpage}
+% \pkg{midpage} is ignored.
+%
+% \changes{v0.39}{2017/08/27}{\pkg{midpage}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{midpage}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\newenvironment{midpage}
+{\begin{BlockClass}[margin-top:6ex ; margin-bottom:6ex]{midpage}}
+{\end{BlockClass}}
+%    \end{macrocode}
+%
 % \iffalse
+%</midpage>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*moreverb>
 % \fi
 %
@@ -31609,8 +33194,6 @@
 \LWR at ProvidesPackagePass{moreverb}
 %    \end{macrocode}
 %
-%
-%
 %    \begin{macrocode}
 \BeforeBeginEnvironment{verbatimtab}{%
 \LWR at forcenewpage
@@ -31685,11 +33268,12 @@
 \renewenvironment*{boxedverbatim}
 {
 \LWR at forcenewpage
-\LWR at atbeginverbatim{boxedverbatim}\unskip\LWR at origvspace*{-\baselineskip}%
+\LWR at atbeginverbatim{boxedverbatim}\unskip\LWR at origvspace*{-2\baselineskip}%
 \verbatim%
 }
 {
 \endverbatim%
+\unskip%
 \LWR at afterendverbatim%
 }
 
@@ -31804,7 +33388,7 @@
 %    \begin{macrocode}
 \NewDocumentEnvironment{multicols}{s m o}
 %    \end{macrocode}
-% \HTML\ \element{div} class to contain everything:
+% HTML \element{div} class to contain everything:
 %    \begin{macrocode}
 {
 \LWR at forcenewpage
@@ -31907,7 +33491,7 @@
 %    \begin{macrocode}
 \RenewDocumentCommand{\multirow}{O{c} m o m o +m}%
 {%
-\LWR at traceinfo{*** multirow #1 #2 #4}
+\LWR at traceinfo{*** multirow #1 #2 #4}%
 \LWR at maybenewtablerow%
 \LWR at tabularleftedge%
 %    \end{macrocode}
@@ -32058,10 +33642,67 @@
 %
 %
 %
+% \iffalse
+%<*natbib>
+% \fi
 %
+% \part{lwarp-natbib.sty}
+
+% \section{natbib}
 %
+% \credits{Patrick W. Daly}
 %
+% \DescribePackage{natbib}
+% \pkg{natbib} is patched for use by \pkg{lwarp}.
+%
+% \changes{v0.45}{2018/01/13}{\pkg{natbib}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{natbib}
+%    \end{macrocode}
+%
+% Replace math $<$ and $>$ with \cs{textless} and \cs{textgreater}:
+%
+% A macro to compare:
+%    \begin{macrocode}
+\newcommand{\LWRNB at NAT@open}{$<$}
+%    \end{macrocode}
+% To patch \cs{NAT at open} and \cs{NAT at close}
+%    \begin{macrocode}
+\newcommand{\LWRNB at patchnatbibopenclose}{
+\ifdefstrequal{\NAT at open}{\LWRNB at NAT@open}
+{
+    \renewcommand{\NAT at open}{\textless}
+    \renewcommand{\NAT at close}{\textgreater}
+}{}
+}
+%    \end{macrocode}
+% Do it now in case |angle| was selected as an option:
+%    \begin{macrocode}
+\LWRNB at patchnatbibopenclose
+%    \end{macrocode}
+% Also patch \cs{setcitestyle} to patch after settings are made:
+%    \begin{macrocode}
+\let\LWRNB at origsetcitestyle\setcitestyle
+
+\renewcommand{\setcitestyle}[1]{%
+\LWRNB at origsetcitestyle{#1}%
+\LWRNB at patchnatbibopenclose%
+}
+%    \end{macrocode}
+
 % \iffalse
+%</natbib>
+% \fi
+%
+%
+%
+%
+%
+%
+% \iffalse
 %<*needspace>
 % \fi
 
@@ -32082,7 +33723,7 @@
 %    \begin{macrocode}
 \LWR at ProvidesPackageDrop{needspace}
 
-\newcommand*{\needspace}[1]{}
+\DeclareDocumentCommand{\needspace}{m}{}
 \DeclareDocumentCommand{\Needspace}{s m}{}
 %    \end{macrocode}
 
@@ -32183,10 +33824,10 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newcommand{\cleartoevenpage}[1][]{}
-\newcommand{\movetoevenpage}[1][]{}
-\newcommand{\cleartooddpage}[1][]{}
-\newcommand{\movetooddpage}[1][]{}
+\DeclareDocumentCommand{\cleartoevenpage}{o}{}
+\DeclareDocumentCommand{\movetoevenpage}{o}{}
+\DeclareDocumentCommand{\cleartooddpage}{o}{}
+\DeclareDocumentCommand{\movetooddpage}{o}{}
 %    \end{macrocode}
 
 % \iffalse
@@ -32320,6 +33961,7 @@
 % \pkg{ntheorem} is patched for use by \pkg{lwarp}.
 %
 % \changes{v0.25}{2017/03/22}{\pkg{ntheorem}: Added.}
+% \changes{v0.46}{2018/01/22}{\pkg{ntheorem}: Adapted to \env{trivlist} changes.}
 %
 % \begin{table}[ht]
 % \hrule
@@ -32391,6 +34033,87 @@
 \newcommand{\LWR at newtheoremstyle}{plain}
 %    \end{macrocode}
 %
+%
+%    \begin{macrocode}
+\AtBeginDocument{
+\@ifpackageloaded{cleveref}{
+\gdef\@thm#1#2#3{%
+   \if at thmmarks
+     \stepcounter{end\InTheoType ctr}%
+   \fi
+   \renewcommand{\InTheoType}{#1}%
+   \if at thmmarks
+     \stepcounter{curr#1ctr}%
+     \setcounter{end#1ctr}{0}%
+   \fi
+   \refstepcounter[#1]{#2}%  <<< cleveref modification
+   \theorem at prework
+    \LWR at forcenewpage% new
+    \BlockClass{theorembody#1}%\LWR at thisthmstyle% new
+   \trivlist % latex's \trivlist, calling latex's \@trivlist unchanged
+   \ifuse at newframeskips  % cf. latex.ltx for topsepadd: \@trivlist
+     \ifthm at inframe
+       \thm at topsep\theoreminframepreskipamount
+       \thm at topsepadd\theoreminframepostskipamount
+      \else
+       \thm at topsep\theorempreskipamount
+       \thm at topsepadd\theorempostskipamount
+      \fi
+    \else% oldframeskips
+      \thm at topsep\theorempreskipamount
+      \thm at topsepadd \theorempostskipamount
+      \ifvmode\advance\thm at topsepadd\partopsep\fi
+   \fi
+   \@topsep\thm at topsep
+   \@topsepadd\thm at topsepadd
+   \advance\linewidth -\theorem at indent
+   \advance\linewidth -\theorem at rightindent
+   \advance\@totalleftmargin \theorem at indent
+   \parshape \@ne \@totalleftmargin \linewidth
+   \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}
+}
+}{% not @ifpackageloaded{cleveref}
+\gdef\@thm#1#2#3{%
+   \if at thmmarks
+     \stepcounter{end\InTheoType ctr}%
+   \fi
+   \renewcommand{\InTheoType}{#1}%
+   \if at thmmarks
+     \stepcounter{curr#1ctr}%
+     \setcounter{end#1ctr}{0}%
+   \fi
+   \refstepcounter{#2}%
+   \theorem at prework
+    \LWR at forcenewpage% new
+    \BlockClass{theorembody#1}%\LWR at thisthmstyle% new
+   \trivlist % latex's \trivlist, calling latex's \@trivlist unchanged
+   \ifuse at newframeskips  % cf. latex.ltx for topsepadd: \@trivlist
+     \ifthm at inframe
+       \thm at topsep\theoreminframepreskipamount
+       \thm at topsepadd\theoreminframepostskipamount
+      \else
+       \thm at topsep\theorempreskipamount
+       \thm at topsepadd\theorempostskipamount
+      \fi
+    \else% oldframeskips
+      \thm at topsep\theorempreskipamount
+      \thm at topsepadd \theorempostskipamount
+      \ifvmode\advance\thm at topsepadd\partopsep\fi
+   \fi
+   \@topsep\thm at topsep
+   \@topsepadd\thm at topsepadd
+   \advance\linewidth -\theorem at indent
+   \advance\linewidth -\theorem at rightindent
+   \advance\@totalleftmargin \theorem at indent
+   \parshape \@ne \@totalleftmargin \linewidth
+   \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}
+}
+}
+}% AtBeginDocument
+%    \end{macrocode}
+%
+%
+%
 % Patched to remember the style being used for new theorems:
 %    \begin{macrocode}
 \gdef\theoremstyle#1{%
@@ -32476,7 +34199,7 @@
 \newcommand{\LWR at inctheorem}{%
 \addtocounter{LWR at thisautoid}{1}%
 \LWR at stoppars%
-\LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"{}}\LWR at htmltag{/a}%
+\LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"}\LWR at htmltag{/a}%
 \LWR at startpars%
 }
 %    \end{macrocode}
@@ -32499,15 +34222,11 @@
   \expandafter\@ifundefined{th@#1}%
    {\expandafter\gdef\csname th@#1\endcsname{%
     \def\@begintheorem####1####2{%
-\LWR at forcenewpage% new
-\BlockClass{theorembody#1}%\LWR at thisthmstyle% new
-\LWR at inctheorem% new
-#2}%
+    \LWR at inctheorem% new
+    #2}%
     \def\@opargbegintheorem####1####2####3{%
-\LWR at forcenewpage% new
-\BlockClass{theorembody#1}%\LWR at thisthmstyle% new
-\LWR at inctheorem% new
-#3}%
+    \LWR at inctheorem% new
+    #3}%
 }%
 }%
 {\PackageError{\basename}{Theorem style #1 already defined}\@eha}
@@ -32518,96 +34237,76 @@
 %
 %    \begin{macrocode}
 \renewtheoremstyle{plain}%
-  {\item[\hskip\labelsep \theorem at headerfont
+  {\item[
     \InlineClass{theoremheaderplain}{##1\ ##2\theorem at separator}]}%
-  {\item[\hskip\labelsep \theorem at headerfont
+  {\item[
     \InlineClass{theoremheaderplain}{##1\ ##2\ (##3)\theorem at separator}]}
 
 \renewtheoremstyle{break}%
   {\item[
-% 		\rlap{\vbox{\hbox{
-    \hskip\labelsep \theorem at headerfont
     \InlineClass{theoremheaderbreak}{##1\ ##2\theorem at separator}\newline
-% 		}\hbox{\strut}}}
     ]}%
   {\item[
-% 		\rlap{\vbox{\hbox{
-    \hskip\labelsep \theorem at headerfont
     \InlineClass{theoremheaderbreak}%
         {##1\ ##2\ (##3)\theorem at separator}\newline
-% 		}\hbox{\strut}}}
     ]}
 
 \renewtheoremstyle{change}%
-  {\item[\hskip\labelsep
-    \theorem at headerfont
+  {\item[
     \InlineClass{theoremheaderchange}{##2\ ##1\theorem at separator}]}%
-  {\item[\hskip\labelsep
-    \theorem at headerfont
+  {\item[
     \InlineClass{theoremheaderchange}{##2\ ##1\ (##3)\theorem at separator}]}
 
 \renewtheoremstyle{changebreak}%
   {\item[
-% 		\rlap{\vbox{\hbox{
-        \hskip\labelsep \theorem at headerfont
         \InlineClass{theoremheaderchangebreak}%
             {##2\ ##1\theorem at separator}\newline
-% 		}\hbox{\strut}}}
     ]}%
   {\item[
-% 		\rlap{\vbox{\hbox{
-        \hskip\labelsep \theorem at headerfont
         \InlineClass{theoremheaderchangebreak}%
             {##2\ ##1\ (##3)\theorem at separator}\newline
-% 		}\hbox{\strut}}}
     ]}
 
 \renewtheoremstyle{margin}%
-  {\item[\hskip\labelsep\theorem at headerfont
+  {\item[
         \InlineClass{theoremheadermargin}{##2 \qquad ##1\theorem at separator}
     ]}%
-  {\item[\hskip\labelsep\theorem at headerfont
+  {\item[
         \InlineClass{theoremheadermargin}{##2 \qquad ##1\ (##3)\theorem at separator}
     ]}
 
 \renewtheoremstyle{marginbreak}%
-  {\item[\hskip\labelsep\theorem at headerfont
+  {\item[
     \InlineClass{theoremheadermarginbreak}%
         {##2 \qquad ##1\theorem at separator}\newline
     ]}%
-  {\item[\hskip\labelsep\theorem at headerfont
+  {\item[
     \InlineClass{theoremheadermarginbreak}%
         {##2 \qquad ##1\ (##3)\theorem at separator}\newline
     ]}
 
 \renewtheoremstyle{nonumberplain}%
-  {\item[\theorem at headerfont\hskip\labelsep
+  {\item[
     \InlineClass{theoremheaderplain}{##1\theorem at separator}]}%
-  {\item[\theorem at headerfont\hskip \labelsep
+  {\item[
     \InlineClass{theoremheaderplain}{##1\ (##3)\theorem at separator}]}
 
 \renewtheoremstyle{nonumberbreak}%
   {\item[
-% 		\rlap{\vbox{\hbox{
-    \hskip\labelsep \theorem at headerfont
     \InlineClass{theoremheaderbreak}{##1\theorem at separator}\newline
-% 		}\hbox{\strut}}}
     ]}%
   {\item[
-% 		\rlap{\vbox{\hbox{
-    \hskip\labelsep \theorem at headerfont
     \InlineClass{theoremheaderbreak}{##1\ (##3)\theorem at separator}\newline
-% 		}\hbox{\strut}}}
     ]}
 
 \renewtheoremstyle{empty}%
   {\item[]}%
-  {\item[\theorem at headerfont \hskip\labelsep\relax
+  {\item[
     \InlineClass{theoremheaderplain}{##3}]}
 
 \renewtheoremstyle{emptybreak}%
   {\item[]}%
-  {\item[\theorem at headerfont \hskip\labelsep\relax
+  {\item[
     \InlineClass{theoremheaderplain}{##3}] \ \newline}
 %    \end{macrocode}
 %
@@ -32618,18 +34317,21 @@
 % objects which are not a purely plain style:
 %    \begin{macrocode}
 \ifbool{LWR at ntheoremamsthm}{}{%
-% upright text via CSS
+%    \end{macrocode}
+% Upright text via CSS:
+%    \begin{macrocode}
     \newtheoremstyle{plainupright}%
-    {\item[\hskip\labelsep \theorem at headerfont
+    {\item[
         \InlineClass{theoremheaderplain}{##1\ ##2\theorem at separator}]}%
-    {\item[\hskip\labelsep \theorem at headerfont
+    {\item[
         \InlineClass{theoremheaderplain}{##1\ ##2\ (##3)\theorem at separator}]}
-
-% upright text and small caps header via CSS
+%    \end{macrocode}
+% Upright text and small caps header via CSS:
+%    \begin{macrocode}
     \newtheoremstyle{nonumberplainuprightsc}%
-    {\item[\theorem at headerfont\hskip\labelsep
+    {\item[
         \InlineClass{theoremheadersc}{##1\theorem at separator}]}%
-    {\item[\theorem at headerfont\hskip \labelsep
+    {\item[
         \InlineClass{theoremheadersc}{##1\ (##3)\theorem at separator}]}
 }% not amsthm
 %    \end{macrocode}
@@ -32640,6 +34342,26 @@
 % The following standard configuration is renewed using the new \CSS:
 %    \begin{macrocode}
 \ifbool{LWR at ntheoremamsthm}{}{%
+    \theoremnumbering{arabic}
+    \theoremstyle{plain}
+    \RequirePackage{latexsym}
+    \theoremsymbol{\Box}
+    \theorembodyfont{\itshape}
+    \theoremheaderfont{\normalfont\bfseries}
+    \theoremseparator{}
+    \renewtheorem{Theorem}{Theorem}
+    \renewtheorem{theorem}{Theorem}
+    \renewtheorem{Satz}{Satz}
+    \renewtheorem{satz}{Satz}
+    \renewtheorem{Proposition}{Proposition}
+    \renewtheorem{proposition}{Proposition}
+    \renewtheorem{Lemma}{Lemma}
+    \renewtheorem{lemma}{Lemma}
+    \renewtheorem{Korollar}{Korollar}
+    \renewtheorem{korollar}{Korollar}
+    \renewtheorem{Corollary}{Corollary}
+    \renewtheorem{corollary}{Corollary}
+
     \theoremstyle{plainupright}
     \theorembodyfont{\upshape}
     \theoremsymbol{\HTMLunicode{25A1}}% UTF-8 white box
@@ -32678,19 +34400,13 @@
 \gdef\th at plain{%
   \def\theorem at headerfont{\normalfont\bfseries}\itshape%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyplain}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
-% 			\theorem at headerfont
+      \item[
  			\InlineClass{theoremheaderplain}{##1\ ##2.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyplain}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
-% 			\theorem at headerfont
+     \item[
  		\InlineClass{theoremheaderplain}{##1\ ##2\ (##3).}
         ]}}
 
@@ -32697,19 +34413,13 @@
 \gdef\th at nonumberplain{%
   \def\theorem at headerfont{\normalfont\bfseries}\itshape%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyplain}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
-% 			\theorem at headerfont
+      \item[
  			\InlineClass{theoremheaderplain}{##1.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyplain}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
-% 			\theorem at headerfont
+     \item[
  		\InlineClass{theoremheaderplain}{##1\ (##3).}
         ]}}
 
@@ -32716,19 +34426,13 @@
 \gdef\th at definition{%
   \def\theorem at headerfont{\normalfont\bfseries}\normalfont%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodydefinition}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
-% 			\theorem at headerfont
+      \item[
  			\InlineClass{theoremheaderdefinition}{##1\ ##2.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodydefinition}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
-% 			\theorem at headerfont
+     \item[
  		\InlineClass{theoremheaderdefinition}{##1\ ##2\ (##3).}
         ]}}
 
@@ -32735,19 +34439,13 @@
 \gdef\th at nonumberdefinition{%
   \def\theorem at headerfont{\normalfont\bfseries}\normalfont%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodydefinition}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
-% 			\theorem at headerfont
+      \item[
  			\InlineClass{theoremheaderdefinition}{##1.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodydefinition}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
-% 			\theorem at headerfont
+     \item[
  		\InlineClass{theoremheaderdefinition}{##1\ (##3).}
         ]}}
 
@@ -32754,19 +34452,13 @@
 \gdef\th at remark{%
   \def\theorem at headerfont{\itshape}\normalfont%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyremark}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
-% 			\theorem at headerfont
+      \item[
  			\InlineClass{theoremheaderremark}{##1\ ##2.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyremark}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
-% 			\theorem at headerfont
+     \item[
  		\InlineClass{theoremheaderremark}{##1\ ##2\ (##3).}
         ]}}
 
@@ -32773,19 +34465,13 @@
 \gdef\th at nonumberremark{%
   \def\theorem at headerfont{\itshape}\normalfont%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyremark}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
-% 			\theorem at headerfont
+      \item[
  			\InlineClass{theoremheaderremark}{##1.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyremark}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
-% 			\theorem at headerfont
+     \item[
  		\InlineClass{theoremheaderremark}{##1\ (##3).}
         ]}}
 
@@ -32792,19 +34478,13 @@
 \gdef\th at proof{%
   \def\theorem at headerfont{\normalfont\bfseries}\itshape%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyproof}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
-% 			\theorem at headerfont
+      \item[
  			\InlineClass{theoremheaderproof}{##1.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyroof}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
-% 			\theorem at headerfont
+     \item[
  		\InlineClass{theoremheaderproof}{##1\ (##3).}
         ]}}
 
@@ -32845,7 +34525,7 @@
     \setendmarkfalse%
     \fi%
 }{}%
-\LWR at origendtheorem%
+\LWR at origendtheorem% also does \@endtrivlist
 \ifbool{LWR at ntheoremmarks}{\global\setendmarktrue}{}%
 \endBlockClass%
 }
@@ -33006,8 +34686,33 @@
 %
 %
 %
+% \iffalse
+%<*pagesel>
+% \fi
 %
+% \part{lwarp-pagesel.sty}
+%
+% \section{pagesel}
+%
+% \DescribePackage{pagesel}
+% \pkg{pagesel} is ignored.
+%
+% \changes{v0.45}{2017/12/24}{\pkg{pagesel}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{pagesel}
+%    \end{macrocode}
+%
 % \iffalse
+%</pagesel>
+% \fi
+%
+%
+%
+%
+% \iffalse
 %<*paralist>
 % \fi
 %
@@ -33098,7 +34803,7 @@
 %
 % \section{pdflscape}
 %
-% \DescribePackage{pdflscape} Emulated.
+% \DescribePackage{pdflscape} \pkg{pdflscape} is ignored.
 %
 % \changes{v0.34}{2017/08/03}{\pkg{pdflscape}: Added.}
 %
@@ -33254,7 +34959,42 @@
 %
 %
 %
+%
+%
 % \iffalse
+%<*prettyref>
+% \fi
+%
+% \part{lwarp-prettyref.sty}
+
+% \section{prettyref}
+%
+% \credits{Kevin S. Ruland}
+%
+% \DescribePackage{prettyref}
+% \pkg{prettyref} is patched for use by \pkg{lwarp}.
+%
+% \changes{v0.45}{2017/12/11}{\pkg{prettyref}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{prettyref}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+\newrefformat{fig}{Figure \ref{#1}}
+\newrefformat{tab}{Table \ref{#1}}
+%    \end{macrocode}
+
+% \iffalse
+%</prettyref>
+% \fi
+%
+%
+%
+%
+% \iffalse
 %<*preview>
 % \fi
 %
@@ -33713,23 +35453,27 @@
 %
 %    \begin{macrocode}
 \RenewDocumentCommand{\newfloat}{m m m o}{%
-\IfValueTF{#4}
-{
-    \DeclareFloatingEnvironment[fileext=#3,within=#4]{#1}
-}
-{
-    \DeclareFloatingEnvironment[fileext=#3]{#1}
-    \DeclareFloatingEnvironment[fileext=#3]{sideways#1}
-}
-\csletcs{sideways#1}{#1}
-\csletcs{endsideways#1}{end#1}
+\IfValueTF{#4}%
+{%
+    \DeclareFloatingEnvironment[fileext=#3,within=#4]{#1}%
+}%
+{%
+    \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}
 % \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?
 %    \begin{macrocode}
-\cslet{listof#1s}\relax
-\cslet{listof#1es}\relax
+\cslet{listof#1s}\relax%
+\cslet{listof#1es}\relax%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -35060,24 +36804,30 @@
          \ifdim\dimen@>\FBso at max
            \global\FBso at max\dimen@
          \fi}%
-    \vtop\bgroup
-      \vbox\bgroup
+%    \end{macrocode}
+% Do not use boxes, which interfere with |lateximage|s:
+% \changes{v0.45}{2018/01/12}{\pkg{subfig}: Fix: Math in subcaptions.}
+%    \begin{macrocode}
+%     \vtop%
+    \bgroup
+%       \vbox%
+      \bgroup
         \ifcase\@tempcnta
           \@minipagefalse
         \or
-          \vskip\sf at top
+%           \vskip\sf at top
         \or
           \ifdim \lastskip=\z@ \else
-            \@tempskipb\sf at top\relax\@xaddvskip
+%             \@tempskipb\sf at top\relax\@xaddvskip
           \fi
         \fi
         \sf at ifpositiontop{%
           \ifx \@empty#3\relax \else
             \sf at subcaption{#1}{#2}{#3}%
-            \vskip\sf at capskip
-            \vskip\sf at captopadj
+%             \vskip\sf at capskip
+%             \vskip\sf at captopadj
           \fi\egroup
-          \hrule width0pt height0pt depth0pt
+%           \hrule width0pt height0pt depth0pt
             \LWR at startpars% new
 % 			\box\@tempboxa
             #4
@@ -35099,12 +36849,12 @@
         \LWR at stoppars% new
           \egroup
           \ifx \@empty#3\relax \else
-            \vskip\sf at capskip
-            \hrule width0pt height0pt depth0pt
+%             \vskip\sf at capskip
+%             \hrule width0pt height0pt depth0pt
             \sf at subcaption{#1}{#2}{#3}%
          \fi
         }%
-      \vskip\sf at bottom
+%       \vskip\sf at bottom
     \egroup
     \@ifundefined{FBsc at max}{}%
         {\addtocounter{FRobj}{-1}%
@@ -35162,7 +36912,10 @@
                 {\@nameuse{sub\@captype name}}%
                 {\@nameuse{thesub\@captype}}%
                 {#3}
-            \LWR at figcaption% new
+%    \end{macrocode}
+% \changes{v0.45}{2017/12/18}{\pkg{subfig}: Fix for subcaption end tag.}
+%    \begin{macrocode}
+            \endLWR at figcaption% new
 \LWR at traceinfo{sfsubcap B2}% new
 % 			}%
         }%
@@ -35181,7 +36934,7 @@
 % 				\parbox[t][\FBsubcheight][t]{\the\@tempdima}
             }%
          \fi
-         \vbox{%
+%          \vbox{%
 %            \hb at xt@\the\@tempdima{%
 
 %              \hss
@@ -35196,7 +36949,7 @@
 %              \hss
 
 % 			}
-          }
+%           }
         }%
   \egroup
 \LWR at startpars% new
@@ -35218,7 +36971,7 @@
     \let\caption at tfmt\@firstofone
   }%
 %   \@setpar{\@@par\caption@@par}\caption@@par
-\renewcommand{\@@par}{\LWR at closeparagraph\LWR at orig@@par}% new
+    \renewcommand{\@@par}{\LWR at closeparagraph\LWR at orig@@par}% new
   \caption at applyfont
   \caption at fmt
     {\ifcaption at star\else
@@ -35249,6 +37002,19 @@
 %    \end{macrocode}
 % \end{noindmacro}
 
+% ^^A *8* move to caption itself?
+% \begin{noindmacro}{\caption@@make@} \marg{} \marg{}
+%    \begin{macrocode}
+\renewcommand{\caption@@make@}[2]{%
+  \caption at stepthecounter
+  \caption at beginhook
+      \caption@@@make{#1}{#2}%
+  \caption at endhook
+}
+%    \end{macrocode}
+% \end{noindmacro}
+
+
 % \begin{noindmacro}{\subfloat at label}
 % Patches for \cs{sf at sub@label}:
 %    \begin{macrocode}
@@ -35276,6 +37042,7 @@
 %    \end{macrocode}
 % \end{noindmacro}
 %
+%
 % \begin{noindmacro}{\sf@@subref} \marg{label}
 %
 % The starred version uses the printed |sub@<label>| which is stored as
@@ -35294,7 +37061,7 @@
 
 \def\@newsubfloat[#1]#2{%
 \LWR at orig@newsubfloat[#1]{#2}%
-\renewcommand{\l at sub#2}[2]{\hypertocfloat{2}{sub#2}{\ext at sub#2}{##1}{##2}}
+\renewcommand{\l at sub#2}[2]{\hypertocfloat{2}{sub#2}{\ext at sub#2}{##1}{##2}}%
 }
 %    \end{macrocode}
 % \end{noindmacro}
@@ -35315,8 +37082,7 @@
 %
 % ^^A \def\subfigure{\subfloat}
 % ^^A \def\subtable{\subfloat}
-
-
+%
 % \iffalse
 %</subfig>
 % \fi
@@ -35325,10 +37091,57 @@
 %
 %
 %
+% \iffalse
+%<*subfigure>
+% \fi
 %
+% \part{lwarp-subfigure.sty}
 %
+% \section{subfigure}
 %
+% \DescribePackage{subfigure}
+% \pkg{subfigure} is emulated by \pkg{subfig}.
+%
+% \changes{v0.45}{2017/12/02}{\pkg{subfigure}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{subfigure}
+\RequirePackage{subfig}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\LetLtxMacro\subfigure\subfloat
+\LetLtxMacro\subtable\subfloat
+\LetLtxMacro\Subref\subref
+\@ifundefined{figuretopcaptrue}{\newif\iffiguretopcap}{}
+\newif\ifsubfiguretopcap
+\newif\ifsubcaphang
+\newif\ifsubcapcenter
+\newif\ifsubcapcenterlast
+\newif\ifsubcapnooneline
+\newif\ifsubcapraggedright
+\newskip\subfigtopskip
+\newskip\subfigcapskip
+\newdimen\subfigcaptopadj
+\newskip\subfigbottomskip
+\newdimen\subfigcapmargin
+\newskip\subfiglabelskip
+\newcommand*{\subcapsize}{}
+\newcommand*{\subcaplabelfont}{}
+\newcommand*{\subcapfont}{}
+%    \end{macrocode}
+%
 % \iffalse
+%</subfigure>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*supertabular>
 % \fi
 
@@ -35384,15 +37197,15 @@
 \newcommand*{\shrinkheight}[1]{}
 
 \NewDocumentEnvironment{supertabular}{s o m}
-{
-\LWR at traceinfo{supertabular}
-\table
-\LWRST at caption
-\begin{tabular}{#3}
+{%
+\LWR at traceinfo{supertabular}%
+\table%
+\LWRST at caption%
+\begin{tabular}{#3}%
 \TabularMacro\ifdefvoid{\LWRST at firsthead}%
 {\LWR at getmynexttoken}%
 {\expandafter\LWR at getmynexttoken\LWRST at firsthead}%
-}
+}%
 {%
 \ifdefvoid{\LWRST at lasttail}%
 {}%
@@ -35400,9 +37213,9 @@
 \TabularMacro\ResumeTabular%
 \LWRST at lasttail%
 }%
-\end{tabular}
-\endtable
-\LWR at traceinfo{supertabular done}
+\end{tabular}%
+\endtable%
+\LWR at traceinfo{supertabular done}%
 }
 
 \NewDocumentEnvironment{mpsupertabular}{s o m}
@@ -35520,11 +37333,11 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\NewDocumentEnvironment{tabularx}{m o m}
+\DeclareDocumentEnvironment{tabularx}{m o m}
 {\tabular{#3}}
 {\endtabular}
 
-\NewDocumentEnvironment{tabularx*}{m o m}
+\DeclareDocumentEnvironment{tabularx*}{m o m}
 {\tabular{#3}}
 {\endtabular}
 %    \end{macrocode}
@@ -35830,8 +37643,63 @@
 %
 %
 %
+% \iffalse
+%<*textfit>
+% \fi
 %
+% \part{lwarp-textfit.sty}
+%
+% \section{textfit}
+%
+% \DescribePackage{textfit}
+% \pkg{textfit} is emulated.
+%
+% Text is placed into a \element{span} of class \attribute{textfit}.
+% Sizes are approximated, and also limited by browser min/max font-size settings.
+%
+% \changes{v0.45}{2017/12/24}{\pkg{textfit}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{textfit}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\newsavebox{\LWR at textfitbox}
+
+\newcommand*{\LWR at textfitscale}[2]{%
+\uselengthunit{PT}%
+\setlength{\LWR at templengthone}{#1}%
+\setlength{\LWR at templengthone}{%
+    1em*\ratio{\LWR at templengthone}{\LWR at templengthtwo}%
+}%
+\InlineClass[font-size:\rndprintlength{\LWR at templengthone}]{textfit}{#2}%
+}
+
+\newcommand*{\scaletowidth}[2]{%
+\sbox{\LWR at textfitbox}{#2}%
+\settowidth{\LWR at templengthtwo}{\usebox{\LWR at textfitbox}}%
+\LWR at textfitscale{#1}{#2}%
+}
+
+\newcommand*{\scaletoheight}[2]{%
+\sbox{\LWR at textfitbox}{#2}%
+\settoheight{\LWR at templengthtwo}{\usebox{\LWR at textfitbox}}%
+\LWR at textfitscale{#1}{#2}%
+}
+%    \end{macrocode}
+%
 % \iffalse
+%</textfit>
+% \fi
+%
+%
+%
+%
+%
+%
+% \iffalse
 %<*textpos>
 % \fi
 
@@ -36004,103 +37872,106 @@
 % of class |theorembody<style>|.
 %
 % Each header is encased in an \cs{InlineClass} of class |theoremheader|.
+% \changes{v0.46}{2018/01/22}{\pkg{theorem}: Adapt to \env{trivlist} changes.}
 %    \begin{macrocode}
-\gdef\th at plain{%\normalfont\itshape
+\gdef\th at plain{%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-        \item[\hskip\labelsep
+        \item[
             \InlineClass{theoremheader}{##1\ ##2}
-        ]}%
+        ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-   \item[\hskip\labelsep
+   \item[
         \InlineClass{theoremheader}{##1\ ##2\ (##3)}
-    ]}
+    ]
+    }
 }
 
-\gdef\th at break{%\normalfont\slshape
+\gdef\th at break{%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip \labelsep
+    \item[
         \InlineClass{theoremheader}{##1\ ##2}\newline%
-    ]}%
+    ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-  \item[\hskip \labelsep
+  \item[
         \InlineClass{theoremheader}{##1\ ##2\ (##3)}\newline
-    ]}
+    ]
+    }
 }
 
-\gdef\th at marginbreak{%\normalfont\slshape
+\gdef\th at marginbreak{%
   \def\@begintheorem##1##2{
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep %
+    \item[
         \InlineClass{theoremheader}{##2	\qquad ##1}\newline
-    ]}%
+    ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep %
+    \item[
         \InlineClass{theoremheader}{##2	\qquad ##1\ %
         (##3)}\newline
-    ]}
+    ]
+    }
 }
 
-\gdef\th at changebreak{%\normalfont\slshape
+\gdef\th at changebreak{%
   \def\@begintheorem##1##2{
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
         \InlineClass{theoremheader}{##2\ ##1}\newline
-    ]}%
+    ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
         \InlineClass{theoremheader}{ ##2\ ##1\ %
         (##3)}\newline
-    ]}
+    ]
+    }
 }
 
-\gdef\th at change{%\normalfont\slshape
+\gdef\th at change{%
   \def\@begintheorem##1##2{
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
         \InlineClass{theoremheader}{##2\ ##1}
-    ]}%
+    ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
         \InlineClass{theoremheader}{##2\ ##1\ (##3)}
-    ]}
+    ]
+    }
 }
 
-\gdef\th at margin{%\normalfont\slshape
+\gdef\th at margin{%
   \def\@begintheorem##1##2{
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
         \InlineClass{theoremheader}{##2 \qquad ##1}
-    ]}%
+    ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
             \InlineClass{theoremheader}{##2 \qquad ##1\ (##3)}
-    ]}
+    ]
+    }
 }
 %    \end{macrocode}
 %
 % Patched for \CSS:
+% \changes{v0.46}{2018/01/22}{\pkg{theorem}: Adapt to \env{trivlist} changes.}
 %    \begin{macrocode}
-\gdef\@endtheorem{\endBlockClass\endtrivlist}
+\gdef\@thm#1#2{\refstepcounter{#1}%
+\LWR at forcenewpage% new
+    \BlockClass{theorembody\LWR at thisthmstyle}% new
+   \trivlist
+   \@topsep \theorempreskipamount               % used by first \item
+   \@topsepadd \theorempostskipamount           % used by \@endparenv
+   \@ifnextchar [%
+   {\@ythm{#1}{#2}}%
+   {\@begintheorem{#2}{\csname the#1\endcsname}\ignorespaces}}
+
+\gdef\@endtheorem{%
+\endtrivlist
+\endBlockClass
+}
 %    \end{macrocode}
 %
 % \iffalse
@@ -36227,12 +38098,7 @@
 %		\hspace*{2em}test-if-a-package-or-package-option-is-loaded}
 
 
-% \codehtml
 %    \begin{macrocode}
-\begin{warpHTML}
-%    \end{macrocode}
-
-%    \begin{macrocode}
 \newboolean{LWR at tikzbabel}
 
 \@ifpackagelater{tikz}{2013/12/20}% Test for Tikz version v3.0.0
@@ -36267,10 +38133,6 @@
 %    \end{macrocode}
 % \end{environment}
 
-%    \begin{macrocode}
-\end{warpHTML}
-%    \end{macrocode}
-
 % \iffalse
 %</tikz>
 % \fi
@@ -36533,13 +38395,26 @@
 % \section{titleref}
 %
 % \DescribePackage{titleref}
-% \pkg{titleref} is superceded by \pkg{hyperref} and \pkg{nameref}.
+% \pkg{titleref} is emulated.
 %
 % \changes{v0.34}{2017/07/26}{\pkg{titleref}: Prevented.}
+% \changes{v0.45}{2018/01/03}{\pkg{titleref}: Added.}
 %
 % \codehtml
 %    \begin{macrocode}
-\LWR at loadnever{titleref}{hyperref and nameref}
+\LWR at ProvidesPackageDrop{titleref}
+
+\LetLtxMacro\titleref\nameref
+
+\providecounter{LWR at currenttitle}
+
+\newcommand*{\currenttitle}{%
+    \addtocounter{LWR at currenttitle}{1}%
+    \label{currenttitle\arabic{LWR at currenttitle}}%
+    \nameref{currenttitle\arabic{LWR at currenttitle}}%
+}
+
+\newcommand*{\theTitleReference}[2]{}
 %    \end{macrocode}
 %
 % \iffalse
@@ -36971,7 +38846,7 @@
 %    \end{macrocode}
 % Make the footnote mark and some extra horizontal space for the tags:
 %    \begin{macrocode}
-\makethanksmark \LWR at orighspace{1in}
+\makethanksmark~%
 %    \end{macrocode}
 % \begin{center}
 % \begin{minipage}{.7\linewidth}
@@ -37036,7 +38911,7 @@
 % \begin{macro}{\@maketitle}
 %  Typesets the title, etc.  Patched for \HTML.
 %
-% \changes{v0.39}{2017/09/01}{Supports \protect\pkg{authblk} with
+% \changes{v0.39}{2017/09/01}{Supports \pkg{authblk} with
 % \element{div}s of class \attribute{oneauthor} instead of tabular.}
 % \changes{v0.39}{2017/09/03}{Removed minipages.}
 % \changes{v0.39}{2017/09/04}{\pkg{titling} version.}
@@ -37122,11 +38997,15 @@
 %
 % Set default titlepage thanks footnote marks.  See \cref{sec:titlehtml}.
 %    \begin{macrocode}
+\@ifclassloaded{memoir}{
+   \thanksmarkseries{arabic}
+}{% not memoir
 \if at titlepage
    \thanksmarkseries{arabic}
 \else
    \thanksmarkseries{fnsymbol}
 \fi
+}% not memoir
 %    \end{macrocode}
 %
 %
@@ -37247,13 +39126,13 @@
 % The following code is shared by \pkg{anonchap}.
 %
 %    \begin{macrocode}
-\renewcommand{\simplechapter}[1][\@empty]{%
+\DeclareDocumentCommand{\simplechapter}{O{\@empty}}{%
     \def\@chapcntformat##1{%
         #1~\csname the##1\endcsname\simplechapterdelim\protect\quad%
     }%
 }
 
-\renewcommand{\restorechapter}{%
+\DeclareDocumentCommand{\restorechapter}{}{%
 \let\@chapcntformat\@seccntformat%
 }
 %    \end{macrocode}
@@ -37377,7 +39256,7 @@
 
 % \begin{noindmacro}{\cftdot}
 %    \begin{macrocode}
-\newcommand*{\cftdot}{.}
+\providecommand*{\cftdot}{.}
 %    \end{macrocode}
 % \end{noindmacro}
 
@@ -37389,7 +39268,7 @@
 
 % \begin{noindmacro}{\cftnodots}
 %    \begin{macrocode}
-\newcommand*{\cftnodots}{5000}
+\providecommand*{\cftnodots}{5000}
 %    \end{macrocode}
 % \end{noindmacro}
 
@@ -37401,46 +39280,47 @@
 
 % \begin{noindmacro}{\cftsetpnumwidth} \marg{length}
 %    \begin{macrocode}
-\newcommand*{\cftsetpnumwidth}[1]{}
+\DeclareDocumentCommand{\cftsetpnumwidth}{m}{}
 %    \end{macrocode}
 % \end{noindmacro}
 
 % \begin{noindmacro}{\cftsetrmarg} \marg{length}
 %    \begin{macrocode}
-\newcommand*{\cftsetrmarg}[1]{}
+\DeclareDocumentCommand{\cftsetrmarg}{m}{}
 %    \end{macrocode}
 % \end{noindmacro}
 
 % \begin{noindmacro}{\cftpnumalign} \marg{alignment}
 %    \begin{macrocode}
-\newcommand*{\cftpnumalign}[1]{}
+\DeclareDocumentCommand{\cftpnumalign}{m}{}
 %    \end{macrocode}
 % \end{noindmacro}
 
 %    \begin{macrocode}
-\newlength{\cftparskip}
+\LWR at providelength{\cftparskip}
 %    \end{macrocode}
 
 
-
+% The part-related items are also provided by \pkg{memoir}:
 %    \begin{macrocode}
-\newlength{\cftbeforepartskip}
-\newlength{\cftpartindent}
-\newlength{\cftpartnumwidth}
-\newcommand*{\cftpartfont}{}
-\newcommand*{\cftpartpresnum}{}
-\newcommand*{\cftpartaftersnum}{}
-\newcommand*{\cftpartaftersnumb}{}
-\newcommand*{\cftpartleader}{}
-\newcommand*{\cftpartdotsep}{1}
-\newcommand*{\cftpartpagefont}{}
-\newcommand*{\cftpartafterpnum}{}
+\LWR at providelength{\cftbeforepartskip}
+\LWR at providelength{\cftpartindent}
+\LWR at providelength{\cftpartnumwidth}
+\providecommand*{\cftpartfont}{}
+\providecommand*{\cftpartpresnum}{}
+\providecommand*{\cftpartaftersnum}{}
+\providecommand*{\cftpartaftersnumb}{}
+\providecommand*{\cftpartleader}{}
+\providecommand*{\cftpartdotsep}{1}
+\providecommand*{\cftpartpagefont}{}
+\providecommand*{\cftpartafterpnum}{}
 %    \end{macrocode}
-
+%
+% \pkg{memoir} uses the full name ``chapter'' instead of ``chap'':
 %    \begin{macrocode}
-\newlength{\cftbeforechapskip}
-\newlength{\cftchapindent}
-\newlength{\cftchapnumwidth}
+\LWR at providelength{\cftbeforechapskip}
+\LWR at providelength{\cftchapindent}
+\LWR at providelength{\cftchapnumwidth}
 \newcommand*{\cftchapfont}{}
 \newcommand*{\cftchappresnum}{}
 \newcommand*{\cftchapaftersnum}{}
@@ -37450,11 +39330,12 @@
 \newcommand*{\cftchappagefont}{}
 \newcommand*{\cftchapafterpnum}{}
 %    \end{macrocode}
-
+%
+% The following do not appear in \pkg{memoir}:
 %    \begin{macrocode}
-\newlength{\cftbeforesecskip}
-\newlength{\cftsecindent}
-\newlength{\cftsecnumwidth}
+\LWR at providelength{\cftbeforesecskip}
+\LWR at providelength{\cftsecindent}
+\LWR at providelength{\cftsecnumwidth}
 \newcommand*{\cftsecfont}{}
 \newcommand*{\cftsecpresnum}{}
 \newcommand*{\cftsecaftersnum}{}
@@ -37466,9 +39347,9 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newlength{\cftbeforesubsecskip}
-\newlength{\cftsubsecindent}
-\newlength{\cftsubsecnumwidth}
+\LWR at providelength{\cftbeforesubsecskip}
+\LWR at providelength{\cftsubsecindent}
+\LWR at providelength{\cftsubsecnumwidth}
 \newcommand*{\cftsubsecfont}{}
 \newcommand*{\cftsubsecpresnum}{}
 \newcommand*{\cftsubsecaftersnum}{}
@@ -37480,9 +39361,9 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newlength{\cftbeforesubsubsecskip}
-\newlength{\cftsubsubsecindent}
-\newlength{\cftsubsubsecnumwidth}
+\LWR at providelength{\cftbeforesubsubsecskip}
+\LWR at providelength{\cftsubsubsecindent}
+\LWR at providelength{\cftsubsubsecnumwidth}
 \newcommand*{\cftsubsubsecfont}{}
 \newcommand*{\cftsubsubsecpresnum}{}
 \newcommand*{\cftsubsubsecaftersnum}{}
@@ -37494,9 +39375,9 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newlength{\cftbeforeparaskip}
-\newlength{\cftparaindent}
-\newlength{\cftparanumwidth}
+\LWR at providelength{\cftbeforeparaskip}
+\LWR at providelength{\cftparaindent}
+\LWR at providelength{\cftparanumwidth}
 \newcommand*{\cftparafont}{}
 \newcommand*{\cftparapresnum}{}
 \newcommand*{\cftparaaftersnum}{}
@@ -37508,9 +39389,9 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newlength{\cftbeforesubparaskip}
-\newlength{\cftsubparaindent}
-\newlength{\cftsubparanumwidth}
+\LWR at providelength{\cftbeforesubparaskip}
+\LWR at providelength{\cftsubparaindent}
+\LWR at providelength{\cftsubparanumwidth}
 \newcommand*{\cftsubparafont}{}
 \newcommand*{\cftsubparapresnum}{}
 \newcommand*{\cftsubparaaftersnum}{}
@@ -37522,9 +39403,9 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newlength{\cftbeforefigskip}
-\newlength{\cftfigindent}
-\newlength{\cftfignumwidth}
+\LWR at providelength{\cftbeforefigskip}
+\LWR at providelength{\cftfigindent}
+\LWR at providelength{\cftfignumwidth}
 \newcommand*{\cftfigfont}{}
 \newcommand*{\cftfigpresnum}{}
 \newcommand*{\cftfigaftersnum}{}
@@ -37536,9 +39417,9 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newlength{\cftbeforesubfigskip}
-\newlength{\cftsubfigindent}
-\newlength{\cftsubfignumwidth}
+\LWR at providelength{\cftbeforesubfigskip}
+\LWR at providelength{\cftsubfigindent}
+\LWR at providelength{\cftsubfignumwidth}
 \newcommand*{\cftsubfigfont}{}
 \newcommand*{\cftsubfigpresnum}{}
 \newcommand*{\cftsubfigaftersnum}{}
@@ -37550,9 +39431,9 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newlength{\cftbeforetabskip}
-\newlength{\cfttabindent}
-\newlength{\cfttabnumwidth}
+\LWR at providelength{\cftbeforetabskip}
+\LWR at providelength{\cfttabindent}
+\LWR at providelength{\cfttabnumwidth}
 \newcommand*{\cfttabfont}{}
 \newcommand*{\cfttabpresnum}{}
 \newcommand*{\cfttabaftersnum}{}
@@ -37564,9 +39445,9 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newlength{\cftbeforesubtabskip}
-\newlength{\cftsubtabindent}
-\newlength{\cftsubtabnumwidth}
+\LWR at providelength{\cftbeforesubtabskip}
+\LWR at providelength{\cftsubtabindent}
+\LWR at providelength{\cftsubtabnumwidth}
 \newcommand*{\cftsubtabfont}{}
 \newcommand*{\cftsubtabpresnum}{}
 \newcommand*{\cftsubtabaftersnum}{}
@@ -37578,7 +39459,7 @@
 %    \end{macrocode}
 
 %    \begin{macrocode}
-\newcommand{\cftsetindents}[3]{}
+\DeclareDocumentCommand{\cftsetindents}{m m m}{}
 %    \end{macrocode}
 
 %    \begin{macrocode}
@@ -37590,31 +39471,42 @@
 % \begin{noindmacro}{\newlistentry} \oarg{within} \marg{counter} \marg{ext} \marg{level-1}
 % \changes{v0.44}{2017/11/09}{\pkg{tocloft}: Added \cs{newlistentry}.}
 %    \begin{macrocode}
-\NewDocumentCommand{\newlistentry}{o m m m}
-{
-\IfValueTF{#1}
-{
-    \newcounter{#2}[#1]
-    \expandafter\edef\csname the#2\endcsname{
-        \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}
-    }
+\DeclareDocumentCommand{\newlistentry}{o m m m}
+{%
+\LWR at traceinfo{newlistentry #2 #3 #4}%
+\IfValueTF{#1}%
+{%
+    \@ifundefined{c@#2}{%
+        \newcounter{#2}[#1]%
+        \expandafter\edef\csname the#2\endcsname{%
+            \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}%
+        }%
+    }{}%
+}%
+{%
+    \@ifundefined{c@#2}{%
+        \newcounter{#2}%
+    }{}%
+}%
+\@namedef{l@#2}##1##2{%
+    \hypertocfloat{1}{#2}{#3}{##1}{##2}%
+    \def\cftwhatismyname{#2}% from memoir
+}%
+\expandafter\newlength\csname cftbefore#2skip\endcsname%
+\expandafter\newlength\csname cft#2indent\endcsname%
+\expandafter\newlength\csname cft#2numwidth\endcsname%
+\@namedef{cft#2font}{}%
+\@namedef{cft#2presnum}{}%
+\@namedef{cft#2aftersnum}{}%
+\@namedef{cft#2aftersnumb}{}%
+\@namedef{cft#2leader}{}%
+\@namedef{cft#2dotsep}{1}%
+\@namedef{cft#2pagefont}{}%
+\@namedef{cft#2afterpnum}{}%
+\@namedef{toclevel@#2}{#4}%
+\@namedef{cft#2fillnum}##1{}%
+\LWR at traceinfo{newlistentry done}%
 }
-{\newcounter{#2}}
-\@namedef{l@#2}##1##2{\hypertocfloat{1}{#2}{#3}{##1}{##2}}
-\expandafter\newlength\csname cftbefore#2skip\endcsname
-\expandafter\newlength\csname cft#2indent\endcsname
-\expandafter\newlength\csname cft#2numwidth\endcsname
-\@namedef{cft#2font}{}
-\@namedef{cft#2presnum}{}
-\@namedef{cft#2aftersnum}{}
-\@namedef{cft#2aftersnumb}{}
-\@namedef{cft#2leader}{}
-\@namedef{cft#2dotsep}{1}
-\@namedef{cft#2pagefont}{}
-\@namedef{cft#2afterpnum}{}
-\@namedef{toclevel@#2}{#4}
-\@namedef{cft#2fillnum}##1{}
-}
 %    \end{macrocode}
 % \end{noindmacro}
 
@@ -37624,13 +39516,13 @@
 % Emulated through the \cs{newfloat} mechanism.
 % \changes{v0.44}{2017/11/09}{\pkg{tocloft}: Improved \cs{newlistof}.}
 %    \begin{macrocode}
-\NewDocumentCommand{\newlistof}{o m m m}
+\DeclareDocumentCommand{\newlistof}{o m m m}
 {%
 \IfValueTF{#1}
 {\newlistentry[#1]{#2}{#3}{0}}
 {\newlistentry{#2}{#3}{0}}
 \@namedef{ext@#2}{#3}
-\newcounter{#3depth}
+\@ifundefined{c@#3depth}{\newcounter{#3depth}}{}
 \setcounter{#3depth}{1}
 \@namedef{cftmark#3}{}
 \@namedef{listof#2}{\listof{#2}{#4}}
@@ -38033,8 +39925,38 @@
 %
 %
 %
+% \iffalse
+%<*turnthepage>
+% \fi
 %
+% \part{lwarp-turnthepage.sty}
+%
+% \section{turnthepage}
+%
+% \DescribePackage{turnthepage}
+% \pkg{turnthepage} is ignored.
+%
+% \changes{v0.45}{2017/12/19}{\pkg{turnthepage}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{turnthepage}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\newcommand{\turnthepage}{}
+%    \end{macrocode}
+%
 % \iffalse
+%</turnthepage>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*typearea>
 % \fi
 %
@@ -38288,7 +40210,7 @@
 %    \begin{macrocode}
 \LWR at restoreoriglists%
 %    \end{macrocode}
-% \DescribePackage{verse}\DescribePackage{memoir}\index{memoir>verse}
+% \DescribePackage{verse}\DescribeClass{memoir}\index{memoir>verse}
 % The \pkg{verse} or \pkg{memoir} packages can place stanza numbers to the left
 % with their \cs{flagverse} command. \DescribeMacro{\flagverse}
 % Do not allow them to go into the left margin, which would cause |pdfcrop|
@@ -39132,7 +41054,7 @@
 % \margintag{font size}
 %    \begin{macrocode}
 \newcommand*{\LWR at htmlsmallfontstart}{%
-\LWR at htmltagc{span style="font-size:\xfracHTMLfontsize"{}}%
+\LWR at htmltagc{span style="font-size:\xfracHTMLfontsize"}%
 \LWR at nestspan%
 %
 }
@@ -39373,15 +41295,15 @@
 \newcommand*{\xentrystretch}[1]{}
 
 \NewDocumentEnvironment{xtabular}{s o m}
-{
-\LWR at traceinfo{xtabular}
-\table
-\LWRXT at caption
-\begin{tabular}{#3}
+{%
+\LWR at traceinfo{xtabular}%
+\table%
+\LWRXT at caption%
+\begin{tabular}{#3}%
 \TabularMacro\ifdefvoid{\LWRXT at firsthead}%
 {\LWR at getmynexttoken}%
 {\expandafter\LWR at getmynexttoken\LWRXT at firsthead}%
-}
+}%
 {%
 \ifdefvoid{\LWRXT at lasttail}%
 {}%
@@ -39389,9 +41311,9 @@
 \TabularMacro\ResumeTabular%
 \LWRXT at lasttail%
 }%
-\end{tabular}
-\endtable
-\LWR at traceinfo{xtabular done}
+\end{tabular}%
+\endtable%
+\LWR at traceinfo{xtabular done}%
 }
 
 \NewDocumentEnvironment{mpxtabular}{s o m}
@@ -39500,11 +41422,1465 @@
 %
 %
 %
+% \iffalse
+%<*patch-komascript>
+% \fi
 %
+% \part{lwarp-patch-komascript.sty}
 %
+% \section{patch-komascript}
 %
+% \DescribePackage{lwarp-patch-komascript}
+% Patches for \pkg{komascript} classes.
 %
+% \pkg{lwarp} loads this package when
+% \pkg{scrbook}, \pkg{scrartcl}, or \pkg{scrreprt} classes are detected.
 %
+% \limitskomascript
+%
+% \changes{v0.44}{2017/11/19}{\pkg{lwarp-patch-komascript}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\ProvidesPackage{lwarp-patch-komascript}
+%    \end{macrocode}
+%
+% \pkg{typearea} is emulated.
+%    \begin{macrocode}
+\RequirePackage{lwarp-typearea}
+%    \end{macrocode}
+%
+% \pkg{tocbasic} is emulated.
+%    \begin{macrocode}
+\RequirePackage{lwarp-tocbasic}
+%    \end{macrocode}
+%
+% \pkg{scrextend} patches most of the new macros.
+%    \begin{macrocode}
+\RequirePackage{lwarp-scrextend}
+%    \end{macrocode}
+%
+% The \cs{minisec} is placed inside a \element{div} of class \attribute{minisec}.
+%    \begin{macrocode}
+\renewcommand*{\minisec}[1]{
+\begin{BlockClass}{minisec}
+#1
+\end{BlockClass}
+}
+%    \end{macrocode}
+%
+% The part and chapter preambles are placed as plain text just after each heading.
+%    \begin{macrocode}
+\@ifundefined{setpartpreamble}{}{
+\RenewDocumentCommand{\setpartpreamble}{o o +m}{%
+\renewcommand{\part at preamble}{#3}%
+}
+}
+
+\@ifundefined{setchapterpreamble}{}{
+\RenewDocumentCommand{\setchapterpreamble}{o o +m}{%
+\renewcommand{\chapter at preamble}{#3}%
+}
+}
+%    \end{macrocode}
+%
+% Simple captions are used in all cases.
+%    \begin{macrocode}
+\LetLtxMacro\captionbelow\caption
+\LetLtxMacro\captionabove\caption
+
+\LetLtxMacro\captionofbelow\captionof
+\LetLtxMacro\captionofabove\captionof
+
+\RenewDocumentEnvironment{captionbeside}{o m o o o s}
+{}
+{%
+\IfValueTF{#1}%
+{\caption[#1]{#2}}%
+{\caption{#2}}%
+}
+
+\RenewDocumentEnvironment{captionofbeside}{m o m o o o s}
+{}
+{%
+\IfValueTF{#2}%
+{\captionof{#1}[#2]{#3}}%
+{\captionof{#1}{#3}}%
+}
+
+\RenewDocumentCommand{\setcapindent}{s m}{}
+\renewcommand*{\setcaphanging}{}
+\renewcommand*{\setcapwidth}[2][]{}
+\renewcommand*{\setcapdynwidth}[2][]{}
+\RenewDocumentCommand{\setcapmargin}{s o m}{}
+%    \end{macrocode}
+%
+% \iffalse
+%</patch-komascript>
+% \fi
+%
+%
+%
+%
+%
+%
+% \iffalse
+%<*patch-memoir>
+% \fi
+%
+% \part{lwarp-patch-memoir.sty}
+%
+% \section{patch-memoir}
+%
+%
+% \credits{Peter Wilson}
+%
+% \DescribePackage{lwarp-patch-memoir}
+% Patches for \pkg{memoir} class.
+%
+% \testthis
+%
+% \pkg{lwarp} loads this package when the \pkg{memoir} class is detected.
+%
+% \limitsmemoir
+%
+% \changes{v0.45}{2017/12/03}{\pkg{lwarp-patch-memoir}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\ProvidesPackage{lwarp-patch-memoir}
+%    \end{macrocode}
+%
+% \subsection{Packages}
+% \label{sec:patch-memoir-packages}
+%
+% These are pre-loaded to provide emulation for many of \pkg{memoir}'s functions.
+% \pkg{memoir} pretends that \pkg{abstract}, etc. are already loaded, via its
+% ``emulated'' package mechanism, but \pkg{lwarp} is directly loading the ``|lwarp-|''
+% version of each, which happens to avoid \pkg{memoir}'s emulation system.
+%    \begin{macrocode}
+\RequirePackage{lwarp-abstract}% req'd
+\RequirePackage{lwarp-array}% req'd
+\RequirePackage{lwarp-booktabs}% req'd
+% \RequirePackage{lwarp-ccaption}% to do
+\RequirePackage{lwarp-changepage}% req'd
+\RequirePackage{lwarp-crop}
+\RequirePackage{lwarp-dcolumn}% req'd
+\RequirePackage{lwarp-enumerate}% req'd
+\RequirePackage{lwarp-epigraph}% req'd
+\RequirePackage{lwarp-fancyvrb}% req'd
+\RequirePackage{lwarp-footmisc}% req'd
+\RequirePackage{lwarp-framed}% req'd
+\RequirePackage{lwarp-hanging}% req'd
+\DisemulatePackage{moreverb}
+\RequirePackage{lwarp-moreverb}
+\RequirePackage{lwarp-mparhack}
+\RequirePackage{lwarp-needspace}% req'd
+\RequirePackage{lwarp-nextpage}% req'd
+\RequirePackage{lwarp-pagenote}% req'd
+\RequirePackage{lwarp-parskip}
+\RequirePackage{lwarp-setspace}% req'd
+\RequirePackage{lwarp-showidx}
+\RequirePackage{lwarp-subfigure}% red'q
+%    \end{macrocode}
+% \pkg{subfigure} is emulated via \pkg{subfig}, which pre-defines
+% |subfigure| and |subtable|, but \pkg{memoir} does not, so
+% they must be tested for here:
+%    \begin{macrocode}
+\LetLtxMacro\LWR at memorignewsubfloat\newsubfloat
+\RenewDocumentCommand{\newsubfloat}{O{} m}{%
+    \@ifundefined{c at sub#2}{%
+        \LWR at memorignewsubfloat[#1]{#2}%
+    }{}%
+}
+
+\RequirePackage{lwarp-tabularx}% req'd
+\RequirePackage{lwarp-titling}% req'd
+% \RequirePackage{lwarp-tocbibind}% not emulated by memoir
+\RequirePackage{lwarp-tocloft}% req'd
+\RequirePackage{lwarp-verse}% req'd
+%    \end{macrocode}
+%
+%
+% \subsection{Preliminary setup}
+%
+% Bypass the \pkg{memoir} package mechanism:
+%    \begin{macrocode}
+\LetLtxMacro\LWR at origlabel\@mem at old@label
+%    \end{macrocode}
+
+
+% Redefined to write the |LWR at autoindex| counter instead of |page|
+%    \begin{macrocode}
+\AtBeginDocument{
+    \def\@@wrindexhyp#1||\\{%
+        \addtocounter{LWR at autoindex}{1}%
+        \LWR at newlabel{LWRindex-\arabic{LWR at autoindex}}%
+      \ifshowindexmark\@showidx{#1}\fi
+      \protected at write\@auxout{}%
+        {\string\@@wrindexm at m{\@idxfile}{#1}{\arabic{LWR at autoindex}}}%
+      \endgroup
+      \@esphack}%
+}
+%    \end{macrocode}
+
+
+%
+% \pkg{memoir} already set the page size to a default,
+% so it must be forced large for \pkg{lwarp}'s use,
+% to avoid tag overflows off the page.
+%    \begin{macrocode}
+\setstocksize{190in}{20in}
+\setlrmarginsandblock{2in}{2in}{*}
+\setulmarginsandblock{1in}{1in}{*}
+%    \end{macrocode}
+%
+%
+% \subsection{Laying out the page}
+%
+%    \begin{macrocode}
+\renewcommand*{\stockavi}{}
+\renewcommand*{\stockav}{}
+\renewcommand*{\stockaiv}{}
+\renewcommand*{\stockaiii}{}
+\renewcommand*{\stockbvi}{}
+\renewcommand*{\stockbv}{}
+\renewcommand*{\stockbiv}{}
+\renewcommand*{\stockbiii}{}
+% \renewcommand*{\stockmetriccrownvo}{}% in docs but not in the package
+\renewcommand*{\stockmlargecrownvo}{}
+\renewcommand*{\stockmdemyvo}{}
+\renewcommand*{\stockmsmallroyalvo}{}
+\renewcommand*{\pageavi}{}
+\renewcommand*{\pageav}{}
+\renewcommand*{\pageaiv}{}
+\renewcommand*{\pageaiii}{}
+\renewcommand*{\pagebvi}{}
+\renewcommand*{\pagebv}{}
+\renewcommand*{\pagebiv}{}
+\renewcommand*{\pagebiii}{}
+% \renewcommand*{\pagemetriccrownvo}{}% in docs but not in the package
+\renewcommand*{\pagemlargecrownvo}{}
+\renewcommand*{\pagemdemyvo}{}
+\renewcommand*{\pagemsmallroyalvo}{}
+
+\renewcommand*{\stockdbill}{}
+\renewcommand*{\stockstatement}{}
+\renewcommand*{\stockexecutive}{}
+\renewcommand*{\stockletter}{}
+\renewcommand*{\stockold}{}
+\renewcommand*{\stocklegal}{}
+\renewcommand*{\stockledger}{}
+\renewcommand*{\stockbroadsheet}{}
+\renewcommand*{\pagedbill}{}
+\renewcommand*{\pagestatement}{}
+\renewcommand*{\pageexecutive}{}
+\renewcommand*{\pageletter}{}
+\renewcommand*{\pageold}{}
+\renewcommand*{\pagelegal}{}
+\renewcommand*{\pageledger}{}
+\renewcommand*{\pagebroadsheet}{}
+
+\renewcommand*{\stockpottvo}{}
+\renewcommand*{\stockfoolscapvo}{}
+\renewcommand*{\stockcrownvo}{}
+\renewcommand*{\stockpostvo}{}
+\renewcommand*{\stocklargecrownvo}{}
+\renewcommand*{\stocklargepostvo}{}
+\renewcommand*{\stocksmalldemyvo}{}
+\renewcommand*{\stockdemyvo}{}
+\renewcommand*{\stockmediumvo}{}
+\renewcommand*{\stocksmallroyalvo}{}
+\renewcommand*{\stockroyalvo}{}
+\renewcommand*{\stocksuperroyalvo}{}
+\renewcommand*{\stockimperialvo}{}
+\renewcommand*{\pagepottvo}{}
+\renewcommand*{\pagefoolscapvo}{}
+\renewcommand*{\pagecrownvo}{}
+\renewcommand*{\pagepostvo}{}
+\renewcommand*{\pagelargecrownvo}{}
+\renewcommand*{\pagelargepostvo}{}
+\renewcommand*{\pagesmalldemyvo}{}
+\renewcommand*{\pagedemyvo}{}
+\renewcommand*{\pagemediumvo}{}
+\renewcommand*{\pagesmallroyalvo}{}
+\renewcommand*{\pageroyalvo}{}
+\renewcommand*{\pagesuperroyalvo}{}
+\renewcommand*{\pageimperialvo}{}
+
+\renewcommand*{\memfontfamily}{}
+\renewcommand*{\memfontenc}{}
+\renewcommand*{\memfontpack}{}
+
+\renewcommand*{\anyptfilebase}{}
+\renewcommand*{\anyptsize}{10}
+
+\renewcommand*{\setstocksize}[2]{}
+\renewcommand*{\settrimmedsize}[3]{}
+\renewcommand*{\settrims}[2]{}
+
+% \newlength{\lxvchars}
+% \setlength{\lxvchars}{305pt}
+% \newlength{\xlvchars}
+% \setlength{\xlvchars}{190pt}
+\renewcommand*{\setxlvchars}[1]{}
+\renewcommand*{\setlxvchars}[1]{}
+
+\renewcommand*{\settypeblocksize}[3]{}
+\renewcommand*{\setlrmargins}[3]{}
+\renewcommand*{\setlrmarginsandblock}[3]{}
+\renewcommand*{\setbinding}[1]{}
+\renewcommand*{\setulmargins}[3]{}
+\renewcommand*{\setulmarginsandblock}[3]{}
+\renewcommand*{\setcolsepandrule}[2]{}
+
+\renewcommand*{\setheadfoot}[2]{}
+\renewcommand*{\setheaderspaces}[3]{}
+\renewcommand*{\setmarginnotes}[3]{}
+\renewcommand*{\setfootins}[2]{}
+\renewcommand*{\checkandfixthelayout}[1][]{}
+\renewcommand*{\checkthelayout}[1]{}
+\renewcommand*{\fixthelayout}{}
+% 
+% \newlength{\stockheight}
+% \newlength{\trimtop}
+% \newlength{\trimedge}
+% \newlength{\stockwidth}
+% \newlength{\spinemargin}
+% \newlength{\foremargin}
+% \newlength{\uppermargin}
+% \newlength{\headmargin}
+% 
+\renewcommand*{\typeoutlayout}{}
+\renewcommand*{\typeoutstandardlayout}{}
+\renewcommand*{\settypeoutlayoutunit}[1]{}
+\renewcommand*{\fixpdflayout}{}
+\renewcommand*{\fixdvipslayout}{}
+
+\renewcommand*{\medievalpage}[1][]{}
+\renewcommand*{\isopage}[1][]{}
+\renewcommand*{\semiisopage}[1][]{}
+
+\renewcommand{\setpagebl}[3]{}
+\renewcommand{\setpageml}[3]{}
+\renewcommand{\setpagetl}[3]{}
+\renewcommand{\setpagetm}[3]{}
+\renewcommand{\setpagetr}[3]{}
+\renewcommand{\setpagemr}[3]{}
+\renewcommand{\setpagebr}[3]{}
+\renewcommand{\setpagebm}[3]{}
+\renewcommand{\setpagecc}[3]{}
+%    \end{macrocode}
+%
+% \subsection{Text and fonts}
+%    \begin{macrocode}
+\let\miniscule\tiny
+\let\HUGE\Huge
+ 
+\renewcommand*{\abnormalparskip}[1]{}
+\renewcommand*{\nonzeroparskip}{}
+\renewcommand*{\traditionalparskip}{}
+ 
+\let\onelineskip\baselineskip
+ 
+\let\OnehalfSpacing\onehalfspacing
+\let\DoubleSpacing\doublespacing
+\renewcommand*{\setPagenoteSpacing}[1]{}
+\renewcommand*{\setFloatSpacing}[1]{}
+\let\SingleSpacing\singlespacing
+\let\setSingleSpace\SetSinglespace
+\let\SingleSpace\singlespace
+\let\endSingleSpace\endsinglespace
+\let\Spacing\spacing
+\let\endSpacing\endspacing
+\let\OnehalfSpace\onehalfspace
+\let\endOnehalfSpace\endonehalfspace
+\csletcs{OnehalfSpace*}{onehalfspace}
+\csletcs{endOnehalfSpace*}{endonehalfspace}
+\let\DoubleSpace\doublespace
+\let\endDoubleSpace\enddoublespace
+\csletcs{DoubleSpace*}{doublespace}
+\csletcs{endDoubleSpace*}{enddoublespace}
+\renewcommand*{\setDisplayskipStretch}[1]{}
+\renewcommand*{\memdskipstretch}{}
+\renewcommand*{\noDisplayskipStretch}{}
+\renewcommand*{\memdskips}{}
+
+\renewcommand*{\midsloppy}{}
+\renewenvironment*{midsloppypar}{}{}
+
+\renewcommand*{\sloppybottom}{}
+%    \end{macrocode}
+%
+% \subsection{Titles}
+%    \begin{macrocode}
+\csletcs{titlingpage*}{titlingpage}
+\csletcs{endtitlingpage*}{endtitlingpage}
+\let\andnext\and
+\renewcommand*{\thanksmarkstyle}[1]{}
+\renewcommand{\thanksfootmark}{%
+\thanksscript{\tamark}%
+}
+
+% \newlength{\thanksmarksep}
+%    \end{macrocode}
+%
+% \subsection{Abstracts}
+%    \begin{macrocode}
+\renewcommand*{\abstractcol}{}
+\renewcommand*{\abstractintoc}{}
+\renewcommand*{\abstractnum}{}
+\renewcommand*{\abstractrunin}{}
+%    \end{macrocode}
+%
+% \subsection{Docment divisions}
+%    \begin{macrocode}
+
+\def\@apppage{%
+    \part*{\appendixpagename}
+}
+\renewcommand\mempreaddapppagetotochook{}
+\renewcommand\mempostaddapppagetotochook{}
+
+\def\@sapppage{%
+    \part*{\appendixpagename}
+}
+
+\csletcs{frontmatter*}{frontmatter}
+\csletcs{mainmatter*}{mainmatter}
+\renewcommand*{\raggedbottomsection}{}
+\renewcommand*{\normalbottomsection}{}
+\renewcommand*{\bottomsectionskip}{}
+\renewcommand*{\bottomsectionpenalty}{}
+\csletcs{appendixpage*}{appendixpage}
+\renewcommand*{\namedsubappendices}{}
+\renewcommand*{\unnamedsubappendices}{}
+\renewcommand*{\setsecnumdepth}[1]{}% todo tocvsec2
+\renewcommand*{\maxsecnumdepth}[1]{}% todo tocvsec2
+\renewcommand*{\beforebookskip}{}
+\renewcommand*{\afterbookskip}{}
+\renewcommand*{\beforepartskip}{}
+\renewcommand*{\afterpartskip}{}
+\renewcommand*{\midbookskip}{}
+\renewcommand*{\midpartskip}{}
+\renewcommand*{\printbookname}{}
+\renewcommand*{\booknamefont}{}
+\renewcommand*{\booknamenum}{}
+\renewcommand*{\printbooknum}{}
+\renewcommand*{\booknumfont}{}
+\renewcommand*{\printpartname}{}
+\renewcommand*{\partnamefont}{}
+\renewcommand*{\partnamenum}{}
+\renewcommand*{\printpartnum}{}
+\renewcommand*{\partnumfont}{}
+\renewcommand*{\printbooktitle}[1]{}
+\renewcommand*{\booktitlefont}{}
+\renewcommand{\printparttitle}[1]{}
+\renewcommand*{\parttitlefont}{}
+\renewcommand*{\bookpageend}{}
+\renewcommand*{\bookblankpage}{}
+\renewcommand*{\nobookblankpage}{}
+\renewcommand*{\partpageend}{}
+\renewcommand*{\partblankpage}{}
+\renewcommand*{\nopartblankpage}{}
+\RenewDocumentCommand{\newleadpage}{s o m m}{}% todo
+\RenewDocumentCommand{\renewleadpage}{s o m m}{}% todo
+\renewcommand*{\leadpagetoclevel}{chapter}
+
+\renewcommand*{\openright}{}
+\renewcommand*{\openleft}{}
+\renewcommand*{\openany}{}
+\renewcommand*{\clearforchapter}{}
+\renewcommand*{\memendofchapterhook}{}
+\renewcommand*{\chapterheadstart}{}
+% \newlength{\beforechapskip}
+\renewcommand*{\afterchapternum}{}
+% \newlength{\midchapskip}
+\renewcommand*{\afterchaptertitle}{}
+% \newlength{\afterchapskip}
+\renewcommand*{\printchaptername}{}
+\renewcommand*{\chapnamefont}{}
+\renewcommand*{\chapternamenum}{}
+\renewcommand*{\printchapternum}{}
+\renewcommand*{\chapnumfont}{}
+\renewcommand{\printchaptertitle}[1]{}
+\renewcommand*{\chaptitlefont}{}
+\renewcommand*{\printchapternonum}{}
+\renewcommand*{\indentafterchapter}{}
+\renewcommand*{\noindentafterchapter}{}
+\renewcommand*{\insertchapterspace}{}
+
+\renewcommand*{\chapterstyle}[1]{}
+\renewcommand{\makechapterstyle}[2]{}
+\renewcommand*{\chapindent}{}
+\let\chapterprecis\cftchapterprecis
+\let\chapterprecishere\cftchapterprecishere
+\let\chapterprecistoc\cftchapterprecistoc
+\renewcommand*{\precisfont}{}
+\renewcommand*{\prechapterprecis}{}
+\renewcommand*{\postchapterprecis}{}
+\renewcommand{\precistoctext}[1]{}
+\renewcommand*{\precistocfont}{}
+\renewcommand*{\precistocformat}{}
+% \newlength{\prechapterprecisshift}
+
+\renewcommand*{\setbeforesecskip}[1]{}
+\renewcommand*{\setaftersecskip}[1]{}
+\renewcommand*{\setsecindent}[1]{}
+\renewcommand*{\setsecheadstyle}[1]{}
+\renewcommand*{\setbeforesubsecskip}[1]{}
+\renewcommand*{\setaftersubsecskip}[1]{}
+\renewcommand*{\setsubsecindent}[1]{}
+\renewcommand*{\setsubsecheadstyle}[1]{}
+\renewcommand*{\setbeforesubsubsecskip}[1]{}
+\renewcommand*{\setaftersubsubsecskip}[1]{}
+\renewcommand*{\setsubsubsecindent}[1]{}
+\renewcommand*{\setsubsubsecheadstyle}[1]{}
+\renewcommand*{\setbeforeparaskip}[1]{}
+\renewcommand*{\setafterparaskip}[1]{}
+\renewcommand*{\setparaindent}[1]{}
+\renewcommand*{\setparaheadstyle}[1]{}
+\renewcommand*{\setbeforesubparaskip}[1]{}
+\renewcommand*{\setaftersubparaskip}[1]{}
+\renewcommand*{\setsubparaindent}[1]{}
+\renewcommand*{\setsubparaheadstyle}[1]{}
+\renewcommand{\@hangfrom}[1]{#1}
+\renewcommand{\sethangfrom}[1]{}
+\renewcommand{\setsecnumformat}[1]{}
+
+\renewcommand*{\hangsecnum}{}
+\renewcommand*{\defaultsecnum}{}
+
+\renewcommand*{\sechook}{}
+\renewcommand{\setsechook}[1]{}
+\renewcommand*{\subsechook}{}
+\renewcommand{\setsubsechook}[1]{}
+\renewcommand*{\subsubsechook}{}
+\renewcommand{\setsubsubsechook}[1]{}
+\renewcommand*{\parahook}{}
+\renewcommand{\setparahook}[1]{}
+\renewcommand*{\subparahook}{}
+\renewcommand{\setsubparahook}[1]{}
+
+\RenewDocumentCommand{\plainbreak}{s m}{\begin{center}~\end{center}}
+
+\RenewDocumentCommand{\fancybreak}{s +m}{%
+\begin{center}#2\end{center}%
+}
+
+\RenewDocumentCommand{\plainfancybreak}{s m m +m}{%
+\begin{center}#4\end{center}%
+}
+
+\RenewDocumentCommand{\pfbreak}{s}{%
+\begin{center}
+\pfbreakdisplay
+\end{center}
+}
+
+% \newlength{\pfbreakskip}
+\renewcommand{\pfbreakdisplay}{*\quad*\quad*}
+
+\renewcommand{\makeheadstyles}[2]{}
+\renewcommand*{\headstyles}[1]{}
+%    \end{macrocode}
+%
+% \subsection{Pagination and headers}
+%    \begin{macrocode}
+\renewcommand*{\savepagenumber}{}
+\renewcommand*{\restorepagenumber}{}
+\renewcommand*{\uppercaseheads}{}
+\renewcommand*{\nouppercaseheads}{}
+
+\renewcommand*{\bookpagemark}[1]{}
+\renewcommand*{\partmark}[1]{}
+\renewcommand*{\bibmark}{}
+\renewcommand*{\indexmark}{}
+\renewcommand*{\glossarymark}{}
+
+\LWR at origpagestyle{empty}
+\renewcommand*{\ps at empty}{}
+\renewcommand*{\makepagestyle}[1]{}
+\renewcommand*{\emptypshook}{}%
+% \renewcommand*{\empty at oddhead}{}
+% \renewcommand*{\empty at oddfoot}{}
+% \renewcommand*{\empty at evenhead}{}
+% \renewcommand*{\empty at evenfoot}{}
+\renewcommand*{\@oddhead}{}
+\renewcommand*{\@oddfoot}{}
+\renewcommand*{\@evenhead}{}
+\renewcommand*{\@evenfoot}{}
+\renewcommand*{\aliaspagestyle}[2]{}
+\renewcommand*{\copypagestyle}[2]{}
+
+\renewcommand*{\makeevenhead}[4]{}
+\renewcommand*{\makeoddhead}[4]{}
+\renewcommand*{\makeevenfoot}[4]{}
+\renewcommand*{\makeoddfoot}[4]{}
+\renewcommand*{\makerunningwidth}[3]{}
+% \newlength{\headwidth}
+\renewcommand*{\makeheadrule}[3]{}
+\renewcommand*{\makefootrule}[3]{}
+\renewcommand*{\makeheadfootruleprefix}[3]{}
+% \newlength{\normalrulethickness}
+% \setlength{\normalrulethickness}{.4pt}
+% \newlength{\footruleheight}
+% \newlength{\footruleskip}
+\renewcommand*{\makeheadposition}[5]{}
+\renewcommand{\makepsmarks}[2]{}
+\renewcommand*{\makeheadfootstrut}[3]{}
+
+\renewcommand{\createplainmark}[3]{}
+\renewcommand{\memUChead}[1]{}
+\renewcommand{\createmark}[5]{}
+\renewcommand*{\clearplainmark}[1]{}
+\renewcommand*{\clearmark}[1]{}
+\renewcommand{\addtopsmarks}[3]{}
+\renewcommand{\ifonlyfloats}[2]{#2}
+\renewcommand*{\mergepagefloatstyle}[3]{}
+
+\renewcommand*{\framepichead}{}
+\renewcommand*{\framepictextfoot}{}
+\renewcommand*{\framepichook}{}
+\renewcommand*{\showheadfootlocoff}{}
+\renewcommand*{\showtextblocklocoff}{}
+%    \end{macrocode}
+%
+% \subsection{Paragraphs and lists}
+%    \begin{macrocode}
+\renewcommand{\hangfrom}[1]{#1}
+\let\centerfloat\centering
+\renewcommand*{\raggedyright}[1][]{}
+% \newlength{\ragrparindent}
+\renewcommand{\sourceatright}[2][]{\attribution{#2}}
+\let\memorigdbs\LWR at endofline
+\let\memorigpar\par
+\let\atcentercr\LWR at endofline
+\renewcommand*{\flushleftright}{}
+\renewcommand*{\linenottooshort}[1][]{}
+\renewcommand*{\russianpar}{}
+\renewcommand*{\lastlinerulefill}{}
+\renewcommand*{\lastlineparrule}{}
+\renewcommand*{\justlastraggedleft}{}
+\renewcommand*{\raggedrightthenleft}{}
+\renewcommand*{\leftcenterright}{}
+
+\renewcommand{\leftspringright}[4]{%
+\begin{minipage}{#1\linewidth}#3\end{minipage}\qquad%
+\begin{minipage}{#2\linewidth}\begin{flushright}#4\end{flushright}\end{minipage}%
+}
+
+\renewenvironment*{blockdescription}
+{\LWR at descriptionstart\LWR at origdescription}
+{\enddescription}
+\renewcommand*{\blockdescriptionlabel}[1]{\textbf{#1}}
+\renewenvironment*{labelled}[1]{\begin{description}}{\end{description}}
+\renewenvironment*{flexlabelled}[6]{\begin{description}}{\end{description}}
+\renewcommand*{\tightlists}{}
+\renewcommand*{\defaultlists}{}
+\RenewDocumentCommand{\firmlists}{s}{}
+\renewcommand*{\firmlist}{}
+\renewcommand*{\tightlist}{}
+\renewcommand*{\zerotrivseps}{}
+\renewcommand*{\savetrivseps}{}
+\renewcommand*{\restoretrivseps}{}
+%    \end{macrocode}
+%
+% \subsection{Contents lists}
+%    \begin{macrocode}
+\csletcs{tableofcontents*}{tableofcontents}
+\csletcs{listoffigures*}{listoffigures}
+\csletcs{listoftables*}{listoftables}
+\renewenvironment{KeepFromToc}{}{}
+\renewcommand*{\onecoltocetc}{}
+\renewcommand*{\twocoltocetc}{}
+\renewcommand*{\ensureonecol}{}
+\renewcommand*{\restorefromonecol}{}
+\renewcommand*{\doccoltocetc}{}
+\renewcommand*{\maxtocdepth}[1]{}% tocvsec2
+\renewcommand*{\settocdepth}[1]{}% tocvsec2
+
+\renewcommand{\tocheadstart}{}
+\renewcommand{\printtoctitle}[1]{}
+\renewcommand{\tocmark}{}
+\renewcommand{\aftertoctitle}{}
+\renewcommand{\lofheadstart}{}
+\renewcommand{\printloftitle}[1]{}
+\renewcommand{\lofmark}{}
+\renewcommand{\afterloftitle}{}
+\renewcommand{\lotheadstart}{}
+\renewcommand{\printlottitle}[1]{}
+\renewcommand{\lotmark}{}
+\renewcommand{\afterlottitle}{}
+
+\renewcommand*{\setpnumwidth}[1]{}
+\renewcommand*{\setrmarg}[1]{}
+\renewcommand*{\cftbookbreak}{}
+\renewcommand*{\cftpartbreak}{}
+\renewcommand*{\cftchapterbreak}{}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+% \newlength{\cftbeforebookskip}
+% \newlength{\cftbookindent}
+% \newlength{\cftbooknumwidth}
+\renewcommand*{\cftbookfont}{}
+\renewcommand*{\cftbookname}{}
+\renewcommand*{\cftbookpresnum}{}
+\renewcommand*{\cftbookaftersnum}{}
+\renewcommand*{\cftbookaftersnumb}{}
+\renewcommand*{\cftbookleader}{}
+\renewcommand*{\cftbookdotsep}{1}
+\renewcommand*{\cftbookpagefont}{}
+\renewcommand*{\cftbookafterpnum}{}
+\renewcommand*{\cftbookformatpnum}[1]{}
+\renewcommand*{\cftbookformatpnumhook}[1]{}
+%    \end{macrocode}
+% 
+% Part is already defined by \pkg{tocloft}.
+% 
+%    \begin{macrocode}
+% \newlength{\cftbeforechapterskip}
+% \newlength{\cftchapterindent}
+% \newlength{\cftchapternumwidth}
+\renewcommand*{\cftchapterfont}{}
+\renewcommand*{\cftchaptername}{}
+\renewcommand*{\cftchapterpresnum}{}
+\renewcommand*{\cftchapteraftersnum}{}
+\renewcommand*{\cftchapteraftersnumb}{}
+\renewcommand*{\cftchapterleader}{}
+\renewcommand*{\cftchapterdotsep}{1}
+\renewcommand*{\cftchapterpagefont}{}
+\renewcommand*{\cftchapterafterpnum}{}
+\renewcommand*{\cftchapterformatpnum}[1]{}
+\renewcommand*{\cftchapterformatpnumhook}[1]{}
+%    \end{macrocode}
+%
+% ^^A *8* probably redundant:
+%    \begin{macrocode}
+% \newlength{\cftbeforesectionskip}
+% \newlength{\cftsectionindent}
+% \newlength{\cftsectionnumwidth}
+\renewcommand*{\cftsectionfont}{}
+\renewcommand*{\cftsectionname}{}
+\renewcommand*{\cftsectionpresnum}{}
+\renewcommand*{\cftsectionaftersnum}{}
+\renewcommand*{\cftsectionaftersnumb}{}
+\renewcommand*{\cftsectionleader}{}
+\renewcommand*{\cftsectiondotsep}{1}
+\renewcommand*{\cftsectionpagefont}{}
+\renewcommand*{\cftsectionafterpnum}{}
+\renewcommand*{\cftsectionformatpnum}[1]{}
+\renewcommand*{\cftsectionformatpnumhook}[1]{}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+% \newlength{\cftbeforesubsectionskip}
+% \newlength{\cftsubsectionindent}
+% \newlength{\cftsubsectionnumwidth}
+\renewcommand*{\cftsubsectionfont}{}
+\renewcommand*{\cftsubsectionname}{}
+\renewcommand*{\cftsubsectionpresnum}{}
+\renewcommand*{\cftsubsectionaftersnum}{}
+\renewcommand*{\cftsubsectionaftersnumb}{}
+\renewcommand*{\cftsubsectionleader}{}
+\renewcommand*{\cftsubsectiondotsep}{1}
+\renewcommand*{\cftsubsectionpagefont}{}
+\renewcommand*{\cftsubsectionafterpnum}{}
+\renewcommand*{\cftsubsectionformatpnum}[1]{}
+\renewcommand*{\cftsubsectionformatpnumhook}[1]{}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+% \newlength{\cftbeforesubsubsectionskip}
+% \newlength{\cftsubsubsectionindent}
+% \newlength{\cftsubsubsectionnumwidth}
+\renewcommand*{\cftsubsubsectionfont}{}
+\renewcommand*{\cftsubsubsectionname}{}
+\renewcommand*{\cftsubsubsectionpresnum}{}
+\renewcommand*{\cftsubsubsectionaftersnum}{}
+\renewcommand*{\cftsubsubsectionaftersnumb}{}
+\renewcommand*{\cftsubsubsectionleader}{}
+\renewcommand*{\cftsubsubsectiondotsep}{1}
+\renewcommand*{\cftsubsubsectionpagefont}{}
+\renewcommand*{\cftsubsubsectionafterpnum}{}
+\renewcommand*{\cftsubsubsectionformatpnum}[1]{}
+\renewcommand*{\cftsubsubsectionformatpnumhook}[1]{}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+% \newlength{\cftbeforeparagraphskip}
+% \newlength{\cftparagraphindent}
+% \newlength{\cftparagraphnumwidth}
+\renewcommand*{\cftparagraphfont}{}
+\renewcommand*{\cftparagraphname}{}
+\renewcommand*{\cftparagraphpresnum}{}
+\renewcommand*{\cftparagraphaftersnum}{}
+\renewcommand*{\cftparagraphaftersnumb}{}
+\renewcommand*{\cftparagraphleader}{}
+\renewcommand*{\cftparagraphdotsep}{1}
+\renewcommand*{\cftparagraphpagefont}{}
+\renewcommand*{\cftparagraphafterpnum}{}
+\renewcommand*{\cftparagraphformatpnum}[1]{}
+\renewcommand*{\cftparagraphformatpnumhook}[1]{}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+% \newlength{\cftbeforesubparagraphskip}
+% \newlength{\cftsubparagraphindent}
+% \newlength{\cftsubparagraphnumwidth}
+\renewcommand*{\cftsubparagraphfont}{}
+\renewcommand*{\cftsubparagraphname}{}
+\renewcommand*{\cftsubparagraphpresnum}{}
+\renewcommand*{\cftsubparagraphaftersnum}{}
+\renewcommand*{\cftsubparagraphaftersnumb}{}
+\renewcommand*{\cftsubparagraphleader}{}
+\renewcommand*{\cftsubparagraphdotsep}{1}
+\renewcommand*{\cftsubparagraphpagefont}{}
+\renewcommand*{\cftsubparagraphafterpnum}{}
+\renewcommand*{\cftsubparagraphformatpnum}[1]{}
+\renewcommand*{\cftsubparagraphformatpnumhook}[1]{}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+% \newlength{\cftbeforefigureskip}
+% \newlength{\cftfigureindent}
+% \newlength{\cftfigurenumwidth}
+\renewcommand*{\cftfigurefont}{}
+\renewcommand*{\cftfigurename}{}
+\renewcommand*{\cftfigurepresnum}{}
+\renewcommand*{\cftfigureaftersnum}{}
+\renewcommand*{\cftfigureaftersnumb}{}
+\renewcommand*{\cftfigureleader}{}
+\renewcommand*{\cftfiguredotsep}{1}
+\renewcommand*{\cftfigurepagefont}{}
+\renewcommand*{\cftfigureafterpnum}{}
+\renewcommand*{\cftfigureformatpnum}[1]{}
+\renewcommand*{\cftfigureformatpnumhook}[1]{}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+% \newlength{\cftbeforesubfigureskip}
+% \newlength{\cftsubfigureindent}
+% \newlength{\cftsubfigurenumwidth}
+\newcommand*{\cftsubfigurefont}{}
+\newcommand*{\cftsubfigurename}{}
+\newcommand*{\cftsubfigurepresnum}{}
+\newcommand*{\cftsubfigureaftersnum}{}
+\newcommand*{\cftsubfigureaftersnumb}{}
+\newcommand*{\cftsubfigureleader}{}
+\newcommand*{\cftsubfiguredotsep}{1}
+\newcommand*{\cftsubfigurepagefont}{}
+\newcommand*{\cftsubfigureafterpnum}{}
+\newcommand*{\cftsubfigureformatpnum}[1]{}
+\newcommand*{\cftsubfigureformatpnumhook}[1]{}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+% \newlength{\cftbeforetableskip}
+% \newlength{\cfttableindent}
+% \newlength{\cfttablenumwidth}
+\renewcommand*{\cfttablefont}{}
+\renewcommand*{\cfttablename}{}
+\renewcommand*{\cfttablepresnum}{}
+\renewcommand*{\cfttableaftersnum}{}
+\renewcommand*{\cfttableaftersnumb}{}
+\renewcommand*{\cfttableleader}{}
+\renewcommand*{\cfttabledotsep}{1}
+\renewcommand*{\cfttablepagefont}{}
+\renewcommand*{\cfttableafterpnum}{}
+\renewcommand*{\cfttableformatpnum}[1]{}
+\renewcommand*{\cfttableformatpnumhook}[1]{}
+%    \end{macrocode}
+
+%    \begin{macrocode}
+% \newlength{\cftbeforesubtableskip}
+% \newlength{\cftsubtableindent}
+% \newlength{\cftsubtablenumwidth}
+\newcommand*{\cftsubtablefont}{}
+\newcommand*{\cftsubtablename}{}
+\newcommand*{\cftsubtablepresnum}{}
+\newcommand*{\cftsubtableaftersnum}{}
+\newcommand*{\cftsubtableaftersnumb}{}
+\newcommand*{\cftsubtableleader}{}
+\newcommand*{\cftsubtabledotsep}{1}
+\newcommand*{\cftsubtablepagefont}{}
+\newcommand*{\cftsubtableafterpnum}{}
+\newcommand*{\cftsubtableformatpnum}[1]{}
+\newcommand*{\cftsubtableformatpnumhook}[1]{}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\renewcommand*{\booknumberline}[1]{}
+\renewcommand*{\partnumberline}[1]{}
+\renewcommand*{\chapternumberline}[1]{}
+\renewcommand*{\numberlinehook}[1]{}
+% \renewcommand*{\cftwhatismyname}{}%
+\renewcommand*{\booknumberlinehook}[1]{}
+\renewcommand*{\partnumberlinehook}[1]{}
+\renewcommand*{\chapternumberlinehook}[1]{}
+\renewcommand{\numberlinebox}[2]{}
+\renewcommand{\booknumberlinebox}[2]{}
+\renewcommand{\partnumberlinebox}[2]{}
+\renewcommand{\chapternumberlinebox}[2]{}
+% 
+% \newlength{\cftparfillskip}
+\renewcommand*{\cftpagenumbersoff}[1]{}
+\renewcommand*{\cftpagenumberson}[1]{}
+\renewcommand*{\cftlocalchange}[3]{}
+\renewcommand*{\cftaddtitleline}[4]{}
+\renewcommand*{\cftaddnumtitleline}[4]{}
+\renewcommand{\cftinsertcode}[2]{}
+\renewcommand{\cftinserthook}[2]{}
+\renewcommand{\settocpreprocessor}[2]{}
+\DeclareRobustCommand{\cftpagenumbersoff}[1]{}
+\DeclareRobustCommand{\cftpagenumberson}[1]{}
+%    \end{macrocode}
+%
+% \subsection{Floats and captions}
+%
+% \begin{noindmacro}{\newfloat} \oarg{1: within} \marg{2: type}
+%                           \marg{3: ext} \marg{4: capname}
+%    \begin{macrocode}
+\RenewDocumentCommand{\newfloat}{o m m m}{%
+\IfValueTF{#1}%
+{\DeclareFloatingEnvironment[fileext=#3,within=#1,name={#4}]{#2}}%
+{\DeclareFloatingEnvironment[fileext=#3,name={#4}]{#2}}%
+%    \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 following?
+%    \begin{macrocode}
+\cslet{listof#2s}\relax%
+\cslet{listof#2es}\relax%
+}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+%
+% \begin{noindmacro}{\newlistof} \oarg{within} \marg{type} \marg{ext} \marg{listofname}
+%
+% Emulated through the \cs{newfloat} mechanism.
+% Note that \pkg{memoir} uses a different syntax than \pkg{tocloft} for the name.
+%    \begin{macrocode}
+\RenewDocumentCommand{\newlistof}{o m m m}
+{%
+\IfValueTF{#1}
+{\newlistentry[#1]{#2}{#3}{0}}
+{\newlistentry{#2}{#3}{0}}
+\@namedef{ext@#2}{#3}%
+\@ifundefined{c@#3depth}{\newcounter{#3depth}}{}%
+\setcounter{#3depth}{1}%
+\@namedef{#3mark}{}%
+\@namedef{#2}{\listof{#2}{#4}}
+\@namedef{@cftmake#3title}{}
+\@ifundefined{cftbefore#3titleskip}{
+    \expandafter\newlength\csname cftbefore#3titleskip\endcsname
+    \expandafter\newlength\csname cftafter#3titleskip\endcsname
+}{}
+\@namedef{cft#3titlefont}{}
+\@namedef{cftafter#3title}{}
+\@namedef{cft#3prehook}{}
+\@namedef{cft#3posthook}{}
+}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+%
+%    \begin{macrocode}
+\renewcommand{\setfloatadjustment}[2]{}
+%    \end{macrocode}
+%
+% Borrowed from the \pkg{lwarp} version of \pkg{keyfloat}:
+%    \begin{macrocode}
+\NewDocumentEnvironment{KFLTmemoir at marginfloat}{O{-1.2ex} m}
+{% start
+\LWR at BlockClassWP{float:right; width:2in; margin:10pt}{}{marginblock}%
+\captionsetup{type=#2}%
+}
+{%
+\endLWR at BlockClassWP%
+}
+
+\DeclareDocumentEnvironment{marginfigure}{o}
+  {\begin{KFLTmemoir at marginfloat}{figure}}
+  {\end{KFLTmemoir at marginfloat}}
+
+\DeclareDocumentEnvironment{margintable}{o}
+  {\begin{KFLTmemoir at marginfloat}{table}}
+  {\end{KFLTmemoir at marginfloat}}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\renewcommand{\setmarginfloatcaptionadjustment}[2]{}
+\renewcommand{\setmpjustification}[2]{}
+\renewcommand*{\mpjustification}{}
+\renewcommand*{\setfloatlocations}[2]{}
+\DeclareDocumentCommand{\suppressfloats}{o}{}
+\renewcommand*{\FloatBlock}{}
+\renewcommand*{\FloatBlockAllowAbove}{}
+\renewcommand*{\FloatBlockAllowBelow}{}
+\renewcommand*{\setFloatBlockFor}{}
+\renewcommand*{\captiondelim}[1]{\renewcommand*{\CaptionSeparator}{#1}}
+\renewcommand*{\captionnamefont}[1]{}
+\renewcommand*{\captiontitlefont}[1]{}
+\renewcommand*{\captionstyle}[2][]{}
+\renewcommand*{\centerlastline}{}
+\renewcommand*{\hangcaption}{}
+\renewcommand*{\indentcaption}[1]{}
+\renewcommand*{\normalcaption}{}
+\renewcommand*{\changecaptionwidth}{}
+\DeclareDocumentCommand{\captionwidth}{m}{}
+\renewcommand*{\normalcaptionwidth}{}
+\renewcommand{\precaption}[1]{}
+\renewcommand{\captiontitlefinal}[1]{}
+\renewcommand{\postcaption}[1]{}
+
+\renewcommand{\contcaption}[1]{%
+% \ContinuedFloat%
+% \caption{#1}%
+\begin{LWR at figcaption}% later becomes \caption*
+\csuse{\@captype name} \thechapter.\the\value{\@captype}\CaptionSeparator #1
+\end{LWR at figcaption}
+}
+%    \end{macrocode}
+% The extra |\\| here forces a \element{br} in HTML when \cs{legend} is
+% used in a \cs{marginpar}.
+%    \begin{macrocode}
+\renewcommand{\legend}[1]{\begin{center}#1\\\end{center}}
+
+\renewcommand{\namedlegend}[2][]{
+\begin{center}
+\csuse{fleg\@captype}\CaptionSeparator#2\\
+\end{center}
+\csuse{flegtoc\@captype}{#1}
+}
+
+\renewcommand{\flegtable}{\tablename}
+\renewcommand{\flegfigure}{\figurename}
+\renewcommand{\flegtoctable}{}
+\renewcommand{\flegtocfigure}{}
+
+\renewcommand{\newfixedcaption}[3][\caption]{%
+  \renewcommand{#2}{\def\@captype{#3}#1}}
+\renewcommand{\renewfixedcaption}[3][\caption]{%
+  \renewcommand{#2}{\def\@captype{#3}#1}}
+\renewcommand{\providefixedcaption}[3][\caption]{%
+  \providecommand{#2}{\def\@captype{#3}#1}}
+
+\renewcommand{\bitwonumcaption}[6][]{%
+\ifblank{#2}{\caption{#3}}{\caption[#2]{#3}}%
+\addtocounter{\@captype}{-1}%
+\begingroup%
+\csdef{\@captype name}{#4}%
+\ifblank{#5}{\caption{#6}}{\caption[#5]{#6}}%
+\endgroup%
+\ifblank{#1}{}{\label{#1}}%
+}
+
+\LetLtxMacro\bionenumcaption\bitwonumcaption% todo
+
+\renewcommand{\bicaption}[5][]{%
+\ifblank{#2}{\caption{#3}}{\caption[#2]{#3}}%
+\begin{LWR at figcaption}% later becomes \caption*
+#4 \thechapter.\the\value{\@captype}\CaptionSeparator #5
+\end{LWR at figcaption}
+\ifblank{#1}{}{\label{#1}}%
+}
+
+\renewcommand{\bicontcaption}[3]{%
+\contcaption{#1}%
+\begingroup%
+\csdef{\@captype name}{#2}%
+\contcaption{#3}%
+\endgroup%
+}
+
+\renewcommand{\midbicaption}[1]{}
+
+\renewcommand{\subcaption}[2][]{%
+\ifblank{#1}{\subfloat[#2]{}}{\subfloat[#1][#2]{}}%
+}
+
+\RenewDocumentCommand{\subtop}{O{} O{} m}{%
+\subfloat[#1][#2]{#3}%
+}
+
+\RenewDocumentCommand{\subbottom}{O{} O{} m}{%
+\subfloat[#1][#2]{#3}%
+}
+
+\renewcommand{\contsubcaption}{\ContinuedFloat\subcaption}
+
+\renewcommand{\contsubtop}{%
+\ContinuedFloat\addtocounter{\@captype}{1}%
+\subtop}
+
+\renewcommand{\contsubbottom}{%
+\ContinuedFloat\addtocounter{\@captype}{1}%
+\subbottom}
+
+\renewcommand{\subconcluded}{}
+
+\LetLtxMacro\subcaptionref\subref
+
+\renewcommand*{\tightsubcaptions}{}
+\renewcommand*{\loosesubcaptions}{}
+
+\renewcommand*{\subcaptionsize}[1]{}
+\renewcommand*{\subcaptionlabelfont}[1]{}
+\renewcommand*{\subcaptionfont}[1]{}
+\renewcommand*{\subcaptionstyle}[1]{}
+
+\renewcommand*{\hangsubcaption}{}
+\renewcommand*{\shortsubcaption}{}
+\renewcommand*{\normalsubcaption}{}
+
+\RenewDocumentEnvironment{sidecaption}{o m o}
+{}
+{
+\IfValueTF{#1}{\caption[#1]{#2}}{\caption{#2}}%
+\IfValueT{#3}{\label{#3}}%
+}
+
+% \newlength{\sidecapwidth}
+% \newlength{\sidecapsep}
+\renewcommand*{\setsidecaps}[2]{}
+\renewcommand*{\sidecapmargin}[1]{}
+% \newif\ifscapmargleft
+\scapmargleftfalse
+\renewcommand*{\setsidecappos}[1]{}
+
+\RenewDocumentEnvironment{sidecontcaption}{m o}
+{}
+{%
+\ContinuedFloat%
+\caption{#1}%
+%    \end{macrocode}
+% Without \cs{@captype}, the section is referred to instead.
+%    \begin{macrocode}
+\IfValueT{#2}{\label[\@captype]{#2}}%
+}
+%    \end{macrocode}
+% \cs{sidenamedlegend} does not appear to use the TOC argument.
+%    \begin{macrocode}
+\renewenvironment{sidenamedlegend}[2][]{
+\begin{center}
+\csuse{\@captype name}\CaptionSeparator#2
+\end{center}
+}
+{}
+
+\renewenvironment{sidelegend}[1]
+{\begin{center}
+#1
+
+}
+{\end{center}}
+
+\renewcommand*{\sidecapstyle}{}
+\renewcommand*{\overridescapmargin}[1]{}
+% \newlength{\sidecapraise}
+\renewcommand*{\sidecapfloatwidth}{\linewidth}
+
+\LetLtxMacro\ctabular\tabular
+\LetLtxMacro\endctabular\endtabular
+
+\renewcommand{\autorows}[5][]{%
+#5
+}
+
+\renewcommand{\autocols}[5][]{%
+#5
+}
+%    \end{macrocode}
+%
+% \subsection{Page notes}
+%
+%    \begin{macrocode}
+\renewcommand*{\feetabovefloat}{}
+\renewcommand*{\feetbelowfloat}{}
+\renewcommand*{\feetatbottom}{}
+
+\renewcommand*{\verbfootnote}[2][]{
+\PackageError{lwarp,memoir}
+{Verbatim footnotes are not yet supported by lwarp.}
+{This may be improved some day.}
+}
+
+\renewcommand*{\plainfootnotes}{}
+\renewcommand*{\twocolumnfootnotes}{}
+\renewcommand*{\threecolumnfootnotes}{}
+\renewcommand*{\paragraphfootnotes}{}
+\renewcommand*{\footfudgefiddle}{}
+
+\renewcommand*{\newfootnoteseries}[1]{
+\PackageError{lwarp,memoir}
+{Memoir footnote series are not yet supported by lwarp.}
+{This may be improved some day.}
+}
+
+\renewcommand*{\plainfootstyle}[1]{}
+\renewcommand*{\twocolumnfootstyle}[1]{}
+\renewcommand*{\threecolumnfootstyle}[1]{}
+\renewcommand*{\paragraphfootstyle}[1]{}
+
+\renewcommand*{\footfootmark}{}
+\renewcommand*{\footmarkstyle}[1]{}
+
+% \newlength{\footmarkwidth}
+% \newlength{\footmarksep}
+% \newlength{\footparindent}
+
+\renewcommand*{\foottextfont}{}
+
+\renewcommand*{\marginparmargin}[1]{}
+\renewcommand*{\sideparmargin}[1]{}
+
+\LetLtxMacro\sidepar\marginpar
+\renewcommand*{\sideparfont}{}
+\renewcommand*{\sideparform}{}
+\LWR at providelength{\sideparvshift}
+
+\renewcommand*{\parnopar}{}
+
+\renewcommand{\sidebar}[1]{\begin{quote}#1\end{quote}}
+\renewcommand*{\sidebarmargin}[1]{}
+\renewcommand*{\sidebarfont}{}
+\renewcommand*{\sidebarform}{}
+% \newlength{\sidebarhsep}
+% \newlength{\sidebarvsep}
+% \newlength{\sidebarwidth}
+% \newlength{\sidebartopsep}
+\renewcommand{\setsidebarheight}[1]{}
+\renewcommand*{\setsidebars}[6]{}
+\renewcommand*{\footnotesatfoot}{}
+\renewcommand*{\footnotesinmargin}{}
+
+\LetLtxMacro\sidefootnote\footnote
+\LetLtxMacro\sidefootnotemark\footnotemark
+\LetLtxMacro\sidefootnotetext\footnotetext
+
+\renewcommand*{\sidefootmargin}[1]{}
+% \newlength{\sidefoothsep}
+% \newlength{\sidefootvsep}
+% \newlength{\sidefootwidth}
+% \newlength{\sidefootadjust}
+% \newlength{\sidefootheight}
+\renewcommand*{\setsidefootheight}[1]{}
+% \renewcommand*{\sidefootfont}{}% in docs but not in the package
+\renewcommand*{\setsidefeet}[6]{}
+\renewcommand*{\sidefootmarkstyle}[1]{}
+\renewcommand*{\sidefoottextfont}{}
+\renewcommand*{\sidefootform}{}
+
+\renewcommand*{\continuousnotenums}{\pncontopttrue}% from pagenote
+\renewcommand*{\notepageref}{}
+\renewcommand*{\prenotetext}{}
+\renewcommand*{\postnotetext}{}
+\renewcommand*{\idtextinnotes}[1]{}
+\renewcommand*{\printpageinnotes}[1]{}
+\renewcommand*{\printpageinnoteshyperref}[1]{}
+\renewcommand*{\foottopagenote}{}
+\renewcommand*{\pagetofootnote}{}
+%    \end{macrocode}
+%
+% \subsection{Decorative text}
+%
+%    \begin{macrocode}
+\renewcommand*{\epigraphposition}[1]{}
+\renewcommand*{\epigraphtextposition}[1]{}
+\renewcommand*{\epigraphsourceposition}[1]{}
+\renewcommand*{\epigraphfontsize}[1]{}
+\renewcommand*{\epigraphforheader}[2][]{}
+\renewcommand*{\epigraphpicture}{}
+%    \end{macrocode}
+%
+% \subsection{Poetry}
+%
+%    \begin{macrocode}
+\renewcommand*{\vinphantom}{}
+\renewcommand*{\vleftofline}[1]{#1}
+% \let\linenumberfrequency\poemlines
+% \renewcommand*{\linenumberfont}[1]{}
+
+\DeclareDocumentCommand{\PoemTitle}{s o o m}{%
+\IfValueTF{#2}%
+{\poemtitle[#2]{#4}}%
+{\poemtitle{#4}}%
+}
+
+\renewcommand*{\NumberPoemTitle}{}
+\renewcommand*{\PlainPoemTitle}{}
+\renewcommand*{\poemtitlepstyle}{}
+\renewcommand*{\poemtitlestarmark}[1]{}
+\renewcommand*{\poemtitlestarpstyle}{}
+\renewcommand*{\PoemTitleheadstart}{}
+\renewcommand*{\printPoemTitlenonum}{}
+\renewcommand*{\printPoemTitlenum}{}
+\renewcommand*{\afterPoemTitlenum}{}
+\renewcommand*{\printPoemTitletitle}[1]{}
+\renewcommand*{\afterPoemTitle}{}
+\newlength{\midpoemtitleskip}
+\renewcommand*{\PoemTitlenumfont}{}
+\renewcommand*{\PoemTitlefont}{}
+%    \end{macrocode}
+%
+% \subsection{Boxes, verbatims and files}
+%
+%    \begin{macrocode}
+\renewenvironment{qframe}{\framed}{\endframed}
+\renewenvironment{qshade}{\shaded}{\endshaded}
+%    \end{macrocode}
+%
+% Use the \pkg{comment} package:
+%    \begin{macrocode}
+\renewcommand*{\commentsoff}[1]{\includecomment{#1}}
+\renewcommand*{\commentson}[1]{\excludecomment{#1}}
+\LetLtxMacro\renewcomment\commentson
+
+\renewcommand*{\setverbatimfont}[1]{}
+\renewcommand*{\tabson}[1]{}
+\renewcommand*{\tabsoff}{}
+\renewcommand*{\wrappingon}{}
+\renewcommand*{\wrappingoff}{}
+\renewcommand*{\verbatimindent}{}
+\renewcommand*{\verbatimbreakchar}[1]{}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\DefineVerbatimEnvironment{fboxverbatim}{Verbatim}{frame=single}
+%    \end{macrocode}
+%
+% \env{boxedverbatim} is already defined by \pkg{moreverb}.
+% \env{boxedverbatim*} does not appear to work at all, even in a minimal print
+% \pkg{memoir} document.
+%
+%    \begin{macrocode}
+\renewcommand*{\bvbox}{}
+\renewcommand*{\bvtopandtail}{}
+\renewcommand*{\bvsides}{}
+\renewcommand*{\nobvbox}{}
+% \newlength\bvboxsep
+\renewcommand*{\bvtoprulehook}{}
+\renewcommand*{\bvtopmidhook}{}
+\renewcommand*{\bvendrulehook}{}
+\renewcommand*{\bvleftsidehook}{}
+\renewcommand*{\bvrightsidehook}{}
+\renewcommand*{\bvperpagetrue}{}
+\renewcommand*{\bvperpagefalse}{}
+\renewcommand{\bvtopofpage}[1]{}
+\renewcommand{\bvendofpage}[1]{}
+\renewcommand*{\linenumberfrequency}[1]{}
+\renewcommand*{\resetbvlinenumber}{}
+\renewcommand*{\setbvlinenums}[2]{}
+\renewcommand*{\linenumberfont}[1]{}
+\renewcommand*{\bvnumbersinside}{}
+\renewcommand*{\bvnumbersoutside}{}
+%    \end{macrocode}
+%
+% \subsection{Cross referencing}
+%
+%    \begin{macrocode}
+\renewcommand*{\fref}[1]{\cref{#1}}
+\renewcommand*{\tref}[1]{\cref{#1}}
+\renewcommand*{\pref}[1]{\cpageref{#1}}
+\renewcommand*{\Aref}[1]{\cref{#1}}
+\renewcommand*{\Bref}[1]{\cref{#1}}
+\renewcommand*{\Pref}[1]{\cref{#1}}
+\renewcommand*{\Sref}[1]{\cref{#1}}
+\renewcommand*{\figurerefname}{Figure}
+\renewcommand*{\tablerefname}{Table}
+\renewcommand*{\pagerefname}{page}
+\renewcommand*{\bookrefname}{Book~}
+\renewcommand*{\partrefname}{Part~}
+\renewcommand*{\chapterrefname}{Chapter~}
+\renewcommand*{\sectionrefname}{\S}
+\renewcommand*{\appendixrefname}{Appendix~}
+\LetLtxMacro\titleref\nameref
+\renewcommand*{\headnameref}{}
+\renewcommand*{\tocnameref}{}
+
+\providecounter{LWR at currenttitle}
+
+\renewcommand*{\currenttitle}{%
+    \addtocounter{LWR at currenttitle}{1}%
+    \label{currenttitle\arabic{LWR at currenttitle}}%
+    \nameref{currenttitle\arabic{LWR at currenttitle}}%
+}
+
+\renewcommand*{\theTitleReference}[2]{}
+\renewcommand*{\namerefon}{}
+\renewcommand*{\namerefoff}{}
+%    \end{macrocode}
+%
+% \subsection{Back matter}
+%
+%    \begin{macrocode}
+\DeclareDocumentCommand{\newblock}{}{}
+% 
+\renewcommand*{\showindexmarks}{}
+\renewcommand*{\hideindexmarks}{}
+
+\renewcommand*{\xindyindex}{}
+%    \end{macrocode}
+%
+% \subsection{Miscellaneous}
+%
+%    \begin{macrocode}
+\renewcommand*{\changemarks}{}
+\renewcommand*{\nochangemarks}{}
+\renewcommand*{\added}[1]{}
+\renewcommand*{\deleted}[1]{}
+\renewcommand*{\changed}[1]{}
+
+\renewcommand*{\showtrimsoff}{}
+\renewcommand*{\showtrimson}{}
+\renewcommand*{\trimXmarks}{}
+\renewcommand*{\trimLmarks}{}
+\renewcommand*{\trimFrame}{}
+\renewcommand*{\trimNone}{}
+\renewcommand*\trimmarkscolor{}
+\renewcommand*{\trimmarks}{}
+\renewcommand*{\tmarktl}{}
+\renewcommand*{\tmarktr}{}
+\renewcommand*{\tmarkbr}{}
+\renewcommand*{\tmarkbl}{}
+\renewcommand*{\tmarktm}{}
+\renewcommand*{\tmarkmr}{}
+\renewcommand*{\tmarkbm}{}
+\renewcommand*{\tmarkml}{}
+\renewcommand*{\trimmark}{}
+\renewcommand*{\quarkmarks}{}
+\renewcommand*{\registrationColour}[1]{}
+
+\renewcommand*{\leavespergathering}[1]{}
+
+\renewcommand*{\noprelistbreak}{}
+
+\renewcommand*{\cleartorecto}{}
+\renewcommand*{\cleartoverso}{}
+
+\renewenvironment{vplace}[1][]{}{}
+%    \end{macrocode}
+%
+% \subsection{Final patchwork}
+%
+%    \begin{macrocode}
+\newlistof{tableofcontents}{toc}{\contentsname}
+\newlistof{listoffigures}{lof}{\listfigurename}
+\newlistof{listoftables}{lot}{\listtablename}
+%    \end{macrocode}
+%
+% \iffalse
+%</patch-memoir>
+% \fi
+%
+%
+%
 % \clearpage
 % \renewcommand*{\partname}{}
 % \renewcommand*{\thepart}{}

Modified: trunk/Master/texmf-dist/source/latex/lwarp/lwarp.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/lwarp/lwarp.ins	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/source/latex/lwarp/lwarp.ins	2018-01-23 22:34:45 UTC (rev 46416)
@@ -33,7 +33,6 @@
 \askforoverwritefalse
 \generate{
 \file{lwarp.sty}{\from{lwarp.dtx}{package}}
-\file{lwarp-patch-komascript.sty}{\from{lwarp.dtx}{patch-komascript}}
 \file{lwarp-a4.sty}{\from{lwarp.dtx}{a4}}
 \file{lwarp-a4wide.sty}{\from{lwarp.dtx}{a4wide}}
 \file{lwarp-a5comb.sty}{\from{lwarp.dtx}{a5comb}}
@@ -48,8 +47,10 @@
 \file{lwarp-anysize.sty}{\from{lwarp.dtx}{anysize}}
 \file{lwarp-appendix.sty}{\from{lwarp.dtx}{appendix}}
 \file{lwarp-arabicfront.sty}{\from{lwarp.dtx}{arabicfront}}
+\file{lwarp-array.sty}{\from{lwarp.dtx}{array}}
 \file{lwarp-atbegshi.sty}{\from{lwarp.dtx}{atbegshi}}
 \file{lwarp-authblk.sty}{\from{lwarp.dtx}{authblk}}
+\file{lwarp-backref.sty}{\from{lwarp.dtx}{backref}}
 \file{lwarp-balance.sty}{\from{lwarp.dtx}{balance}}
 \file{lwarp-bigdelim.sty}{\from{lwarp.dtx}{bigdelim}}
 \file{lwarp-bigstrut.sty}{\from{lwarp.dtx}{bigstrut}}
@@ -60,10 +61,13 @@
 \file{lwarp-breakurl.sty}{\from{lwarp.dtx}{breakurl}}
 \file{lwarp-cancel.sty}{\from{lwarp.dtx}{cancel}}
 \file{lwarp-ccaption.sty}{\from{lwarp.dtx}{ccaption}}
+\file{lwarp-changebar.sty}{\from{lwarp.dtx}{changebar}}
 \file{lwarp-changepage.sty}{\from{lwarp.dtx}{changepage}}
 \file{lwarp-chngpage.sty}{\from{lwarp.dtx}{chngpage}}
 \file{lwarp-chappg.sty}{\from{lwarp.dtx}{chappg}}
+\file{lwarp-cite.sty}{\from{lwarp.dtx}{cite}}
 \file{lwarp-color.sty}{\from{lwarp.dtx}{color}}
+\file{lwarp-continue.sty}{\from{lwarp.dtx}{continue}}
 \file{lwarp-crop.sty}{\from{lwarp.dtx}{crop}}
 \file{lwarp-cuted.sty}{\from{lwarp.dtx}{cuted}}
 \file{lwarp-cutwin.sty}{\from{lwarp.dtx}{cutwin}}
@@ -74,6 +78,7 @@
 \file{lwarp-ebook.sty}{\from{lwarp.dtx}{ebook}}
 \file{lwarp-ellipsis.sty}{\from{lwarp.dtx}{ellipsis}}
 \file{lwarp-emptypage.sty}{\from{lwarp.dtx}{emptypage}}
+\file{lwarp-endfloat.sty}{\from{lwarp.dtx}{endfloat}}
 \file{lwarp-endnotes.sty}{\from{lwarp.dtx}{endnotes}}
 \file{lwarp-enumerate.sty}{\from{lwarp.dtx}{enumerate}}
 \file{lwarp-enumitem.sty}{\from{lwarp.dtx}{enumitem}}
@@ -90,10 +95,12 @@
 \file{lwarp-fix2col.sty}{\from{lwarp.dtx}{fix2col}}
 \file{lwarp-fixme.sty}{\from{lwarp.dtx}{fixme}}
 \file{lwarp-fixmetodonotes.sty}{\from{lwarp.dtx}{fixmetodonotes}}
+\file{lwarp-flafter.sty}{\from{lwarp.dtx}{flafter}}
 \file{lwarp-float.sty}{\from{lwarp.dtx}{float}}
 \file{lwarp-floatflt.sty}{\from{lwarp.dtx}{floatflt}}
 \file{lwarp-floatpag.sty}{\from{lwarp.dtx}{floatpag}}
 \file{lwarp-floatrow.sty}{\from{lwarp.dtx}{floatrow}}
+\file{lwarp-fltrace.sty}{\from{lwarp.dtx}{fltrace}}
 \file{lwarp-flushend.sty}{\from{lwarp.dtx}{flushend}}
 \file{lwarp-fncychap.sty}{\from{lwarp.dtx}{fncychap}}
 \file{lwarp-fnpos.sty}{\from{lwarp.dtx}{fnpos}}
@@ -102,10 +109,12 @@
 \file{lwarp-footnotehyper.sty}{\from{lwarp.dtx}{footnotehyper}}
 \file{lwarp-fontenc.sty}{\from{lwarp.dtx}{fontenc}}
 \file{lwarp-fontspec.sty}{\from{lwarp.dtx}{fontspec}}
+\file{lwarp-footnpag.sty}{\from{lwarp.dtx}{footnpag}}
 \file{lwarp-framed.sty}{\from{lwarp.dtx}{framed}}
 \file{lwarp-ftnright.sty}{\from{lwarp.dtx}{ftnright}}
 \file{lwarp-fullpage.sty}{\from{lwarp.dtx}{fullpage}}
 \file{lwarp-fullwidth.sty}{\from{lwarp.dtx}{fullwidth}}
+\file{lwarp-fwlw.sty}{\from{lwarp.dtx}{fwlw}}
 \file{lwarp-geometry.sty}{\from{lwarp.dtx}{geometry}}
 \file{lwarp-glossaries.sty}{\from{lwarp.dtx}{glossaries}}
 \file{lwarp-graphicx.sty}{\from{lwarp.dtx}{graphicx}}
@@ -112,6 +121,7 @@
 \file{lwarp-graphics.sty}{\from{lwarp.dtx}{graphics}}
 \file{lwarp-grffile.sty}{\from{lwarp.dtx}{grffile}}
 \file{lwarp-hang.sty}{\from{lwarp.dtx}{hang}}
+\file{lwarp-hanging.sty}{\from{lwarp.dtx}{hanging}}
 \file{lwarp-hyperref.sty}{\from{lwarp.dtx}{hyperref}}
 \file{lwarp-hyperxmp.sty}{\from{lwarp.dtx}{hyperxmp}}
 \file{lwarp-idxlayout.sty}{\from{lwarp.dtx}{idxlayout}}
@@ -134,9 +144,11 @@
 \file{lwarp-marginnote.sty}{\from{lwarp.dtx}{marginnote}}
 \file{lwarp-mcaption.sty}{\from{lwarp.dtx}{mcaption}}
 \file{lwarp-mdframed.sty}{\from{lwarp.dtx}{mdframed}}
+\file{lwarp-memhfixc.sty}{\from{lwarp.dtx}{memhfixc}}
+\file{lwarp-metalogo.sty}{\from{lwarp.dtx}{metalogo}}
 \file{lwarp-microtype.sty}{\from{lwarp.dtx}{microtype}}
 \file{lwarp-midfloat.sty}{\from{lwarp.dtx}{midfloat}}
-\file{lwarp-metalogo.sty}{\from{lwarp.dtx}{metalogo}}
+\file{lwarp-midpage.sty}{\from{lwarp.dtx}{midpage}}
 \file{lwarp-moreverb.sty}{\from{lwarp.dtx}{moreverb}}
 \file{lwarp-morewrites.sty}{\from{lwarp.dtx}{morewrites}}
 \file{lwarp-mparhack.sty}{\from{lwarp.dtx}{mparhack}}
@@ -143,6 +155,7 @@
 \file{lwarp-multicol.sty}{\from{lwarp.dtx}{multicol}}
 \file{lwarp-multirow.sty}{\from{lwarp.dtx}{multirow}}
 \file{lwarp-nameref.sty}{\from{lwarp.dtx}{nameref}}
+\file{lwarp-natbib.sty}{\from{lwarp.dtx}{natbib}}
 \file{lwarp-needspace.sty}{\from{lwarp.dtx}{needspace}}
 \file{lwarp-newclude.sty}{\from{lwarp.dtx}{newclude}}
 \file{lwarp-newunicodechar.sty}{\from{lwarp.dtx}{newunicodechar}}
@@ -153,6 +166,7 @@
 \file{lwarp-ntheorem.sty}{\from{lwarp.dtx}{ntheorem}}
 \file{lwarp-overpic.sty}{\from{lwarp.dtx}{overpic}}
 \file{lwarp-pagenote.sty}{\from{lwarp.dtx}{pagenote}}
+\file{lwarp-pagesel.sty}{\from{lwarp.dtx}{pagesel}}
 \file{lwarp-paralist.sty}{\from{lwarp.dtx}{paralist}}
 \file{lwarp-parskip.sty}{\from{lwarp.dtx}{parskip}}
 \file{lwarp-pdflscape.sty}{\from{lwarp.dtx}{pdflscape}}
@@ -160,6 +174,7 @@
 \file{lwarp-pfnote.sty}{\from{lwarp.dtx}{pfnote}}
 \file{lwarp-placeins.sty}{\from{lwarp.dtx}{placeins}}
 \file{lwarp-prelim2e.sty}{\from{lwarp.dtx}{prelim2e}}
+\file{lwarp-prettyref.sty}{\from{lwarp.dtx}{prettyref}}
 \file{lwarp-preview.sty}{\from{lwarp.dtx}{preview}}
 \file{lwarp-quotchap.sty}{\from{lwarp.dtx}{quotchap}}
 \file{lwarp-ragged2e.sty}{\from{lwarp.dtx}{ragged2e}}
@@ -190,6 +205,7 @@
 \file{lwarp-soulutf8.sty}{\from{lwarp.dtx}{soulutf8}}
 \file{lwarp-stabular.sty}{\from{lwarp.dtx}{stabular}}
 \file{lwarp-subfig.sty}{\from{lwarp.dtx}{subfig}}
+\file{lwarp-subfigure.sty}{\from{lwarp.dtx}{subfigure}}
 \file{lwarp-supertabular.sty}{\from{lwarp.dtx}{supertabular}}
 \file{lwarp-syntonly.sty}{\from{lwarp.dtx}{syntonly}}
 \file{lwarp-tabularx.sty}{\from{lwarp.dtx}{tabularx}}
@@ -197,6 +213,7 @@
 \file{lwarp-tabls.sty}{\from{lwarp.dtx}{tabls}}
 \file{lwarp-textarea.sty}{\from{lwarp.dtx}{textarea}}
 \file{lwarp-textcomp.sty}{\from{lwarp.dtx}{textcomp}}
+\file{lwarp-textfit.sty}{\from{lwarp.dtx}{textfit}}
 \file{lwarp-textpos.sty}{\from{lwarp.dtx}{textpos}}
 \file{lwarp-theorem.sty}{\from{lwarp.dtx}{theorem}}
 \file{lwarp-threeparttable.sty}{\from{lwarp.dtx}{threeparttable}}
@@ -214,6 +231,7 @@
 \file{lwarp-todonotes.sty}{\from{lwarp.dtx}{todonotes}}
 \file{lwarp-transparent.sty}{\from{lwarp.dtx}{transparent}}
 \file{lwarp-trivfloat.sty}{\from{lwarp.dtx}{trivfloat}}
+\file{lwarp-turnthepage.sty}{\from{lwarp.dtx}{turnthepage}}
 \file{lwarp-typearea.sty}{\from{lwarp.dtx}{typearea}}
 \file{lwarp-ulem.sty}{\from{lwarp.dtx}{ulem}}
 \file{lwarp-upref.sty}{\from{lwarp.dtx}{upref}}
@@ -227,6 +245,8 @@
 \file{lwarp-xmpincl.sty}{\from{lwarp.dtx}{xmpincl}}
 \file{lwarp-xtab.sty}{\from{lwarp.dtx}{xtab}}
 \file{lwarp-zwpagelayout.sty}{\from{lwarp.dtx}{zwpagelayout}}
+\file{lwarp-patch-komascript.sty}{\from{lwarp.dtx}{patch-komascript}}
+\file{lwarp-patch-memoir.sty}{\from{lwarp.dtx}{patch-memoir}}
 }
 \Msg{*********************************************************}
 \Msg{*}

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-abstract.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-abstract.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-abstract.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -15,6 +15,7 @@
 %%   http://www.latex-project.org/lppl.txt
 %% and version 1.3 or later is part of all distributions of LaTeX
 %% version 2005/12/01 or later.
+\ProvideDocumentEnvironment{abstract}{}{}{}
 \LWR at ProvidesPackagePass{abstract}
 
 \AtBeginDocument{
@@ -32,6 +33,33 @@
 \@bslabeldelim}%
 }
 
+\@ifclassloaded{memoir}
+{
+  \renewenvironment{abstract}{%
+    \null\vfil
+    \@beginparpenalty\@lowpenalty
+    \if at bsrunin
+    \else
+      \if at bsstyle
+        \abstitlestyle{\BlockClassSingle{abstracttitle}{\abstractname}}
+      \else
+        \ifnumber at bs
+          \num at bs
+        \else
+          \begin{\absnamepos}%
+  \abstractnamefont \BlockClassSingle{abstracttitle}{\abstractname}
+            \@endparpenalty\@M
+          \end\absnamepos%
+%%        \vspace{\abstitleskip}%
+        \fi
+      \fi
+      \vspace{\abstitleskip}%
+    \fi
+    \put at bsintoc%
+    \begin{@bstr at ctlist}\if at bsrunin\@bsrunintitle\fi\abstracttextfont}%
+    {\par\end{@bstr at ctlist}\vfil\null%\endtitlepage
+    }
+}{% not memoir
 \if at titlepage
   \renewenvironment{abstract}{%
     \null\vfil
@@ -79,8 +107,8 @@
     \begin{@bstr at ctlist}\if at bsrunin\@bsrunintitle\fi\abstracttextfont}%
     {\par\end{@bstr at ctlist}}
 \fi
+}% not memoir
 
-
 \endinput
 %%
 %% End of file `lwarp-abstract.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-amsthm.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-amsthm.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-amsthm.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -66,10 +66,7 @@
 \LWR at haveamsthmnumber
 \LWR at haveamsthmnote
 \def\@begintheorem#1#2[#3]{%
-\LWR at forcenewpage% new
-  \BlockClass{amsthmbody\LWR at thisthmstyle}% new
-  \deferred at thm@head{
-    \the\thm at headfont \thm at indent
+    \item[
     \@ifempty{#1}{\let\thmname\@gobble}{\LWR at haveamsthmname}% new
     \@ifempty{#2}{\let\thmnumber\@gobble}{\LWR at haveamsthmnumber}% new
     \@ifempty{#3}{\let\thmnote\@gobble}{\LWR at haveamsthmnote}% new
@@ -77,10 +74,59 @@
     \the\thm at headpunct~
     \thmheadnl % possibly a newline.
     \hskip\thm at headsep
-  }%
+    ]
   \ignorespaces}
-\def\@endtheorem{\endBlockClass\endtrivlist\@endpefalse }
+\def\@thm#1#2#3{%
+  \ifhmode\unskip\unskip\par\fi
+  \normalfont
+  \LWR at forcenewpage% new
+  \BlockClass{amsthmbody\LWR at thisthmstyle}% new
+  \trivlist
+  \let\thmheadnl\relax
+  \let\thm at swap\@gobble
+  \thm at notefont{\fontseries\mddefault\upshape}%
+  \thm at headpunct{.}% add period after heading
+  \thm at headsep 5\p@ plus\p@ minus\p@\relax
+  \thm at space@setup
+  #1% style overrides
+  \@topsep \thm at preskip               % used by thm head
+  \@topsepadd \thm at postskip           % used by \@endparenv
+  \def\@tempa{#2}\ifx\@empty\@tempa
+    \def\@tempa{\@oparg{\@begintheorem{#3}{}}[]}%
+  \else
+    \refstepcounter{#2}%
+    \def\@tempa{\@oparg{\@begintheorem{#3}{\csname the#2\endcsname}}[]}%
+  \fi
+  \@tempa
+}
 \AtBeginDocument{
+\def\cref at thmoptarg[#1]#2#3#4{%
+    \ifhmode\unskip\unskip\par\fi%
+    \normalfont%
+    \LWR at forcenewpage% new
+    \BlockClass{amsthmbody\LWR at thisthmstyle}% new
+    \trivlist%
+    \let\thmheadnl\relax%
+    \let\thm at swap\@gobble%
+    \thm at notefont{\fontseries\mddefault\upshape}%
+    \thm at headpunct{.}% add period after heading
+    \thm at headsep 5\p@ plus\p@ minus\p@\relax%
+    \thm at space@setup%
+    #2% style overrides
+    \@topsep \thm at preskip               % used by thm head
+    \@topsepadd \thm at postskip           % used by \@endparenv
+    \def\@tempa{#3}\ifx\@empty\@tempa%
+        \def\@tempa{\@oparg{\@begintheorem{#4}{}}[]}%
+    \else%
+        \refstepcounter[#1]{#3}%  <<< cleveref modification
+        \def\@tempa{\@oparg{\@begintheorem{#4}{\csname the#3\endcsname}}[]}%
+    \fi%
+    \@tempa
+}%
+}% AtBeginDocument
+
+\def\@endtheorem{\endtrivlist\endBlockClass\@endpefalse }
+\AtBeginDocument{
 \def\openbox{\text{\HTMLunicode{25A1}}}% UTF-8 white box
 \def\blacksquare{\text{\HTMLunicode{220E}}}% UTF-8 end-of-proof
 \def\Box{\text{\HTMLunicode{25A1}}}% UTF-8 white box
@@ -91,7 +137,7 @@
   \pushQED{\qed}%
   \normalfont \topsep6\p@\@plus6\p@\relax
   \trivlist
-  \item[\hskip\labelsep
+  \item[
         \InlineClass{amsthmproofname}{#1\@addpunct{.}}]\ignorespaces% changes
 }{%
   \InlineClass{theoremendmark}{\popQED}\endtrivlist%

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-array.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-array.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-array.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,31 @@
+%%
+%% This is file `lwarp-array.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `array')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackagePass{array}
+\let\LWR at origfirsthline\firsthline
+\let\LWR at origlasthline\lasthline
+
+\appto{\LWR at restoreorigformatting}{%
+\let\firsthline\LWR at origfirsthline%
+\let\lasthline\LWR at origlasthline%
+}
+
+\renewcommand*{\firsthline}{\LWR at hline}%
+\renewcommand*{\lasthline}{\LWR at hline}%
+\endinput
+%%
+%% End of file `lwarp-array.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-array.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-backref.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-backref.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-backref.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,25 @@
+%%
+%% This is file `lwarp-backref.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `backref')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\LWR at ProvidesPackagePass{backref}
+
+\def\backref{}\let\backrefxxx\hyper at section@backref
+
+\endinput
+%%
+%% End of file `lwarp-backref.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-backref.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-breakurl.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-breakurl.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-breakurl.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -18,18 +18,16 @@
 \LWR at ProvidesPackageDrop{breakurl}
 \LetLtxMacro\burl\url
 
-\NewDocumentCommand{\LWR at burlaltb}{O{} +m m}{%
-\LWR at subhyperref{#3}{#2}% order reversed from \href
-\endgroup%
+\NewDocumentCommand{\burlalt}{O{} +m m}{%
 \LWR at ensuredoingapar%
+\def\LWR at templink{#2}%
+\@onelevel at sanitize\LWR at templink%
+\def\LWR at templinktwo{#3}%
+\@onelevel at sanitize\LWR at templinktwo%
+\LWR at subhyperref{\LWR at templink}{\LWR at templinktwo}%
+\LWR at ensuredoingapar%
 }
 
-\DeclareRobustCommand*{\burlalt}{%
-\LWR at ensuredoingapar%
-\begingroup%
-\catcode`\_=12
-\LWR at burlaltb%
-}
 \LetLtxMacro\urlalt\burlalt
 \endinput
 %%

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-changebar.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-changebar.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-changebar.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,31 @@
+%%
+%% This is file `lwarp-changebar.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `changebar')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{changebar}
+\newcommand*{\cbstart}{}
+\newcommand*{\cbend}{}
+\newenvironment*{\changebar}{}{}
+\newcommand*{\cbdelete}{}
+\newcommand*{\nochnagebars}{}
+\newcommand*{\cbcolor}[1]{}
+\newlength{\changebarwidth}
+\newlength{\deletebarwidth}
+\newlength{\changebarsep}
+\newcounter{changebargrey}
+\endinput
+%%
+%% End of file `lwarp-changebar.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-changebar.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-changepage.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-changepage.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-changepage.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -23,11 +23,17 @@
 \DeclareRobustCommand{\checkoddpage}{\oddpagetrue}
 \DeclareRobustCommand{\changetext}[5]{}
 \DeclareRobustCommand{\changepage}[9]{}
+
+\@ifundefined{adjustwidth}{
 \newenvironment{adjustwidth}[2]{}{}
 \newenvironment{adjustwidth*}[2]{}{}
+}{
+\renewenvironment{adjustwidth}[2]{}{}
+\renewenvironment{adjustwidth*}[2]{}{}
+}
 
-\newcommand*{\strictpagecheck}{}
-\newcommand*{\easypagecheck}{}
+\DeclareDocumentCommand{\strictpagecheck}{}
+\DeclareDocumentCommand{\easypagecheck}{}
 
 \endinput
 %%

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-cite.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-cite.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-cite.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,34 @@
+%%
+%% This is file `lwarp-cite.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `cite')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\LWR at ProvidesPackagePass{cite}
+
+\def\LWRCT at biblabel#1{\@citess{#1}\kern-\labelsep\,}
+
+\ifdefstrequal{\@biblabel}{\LWRCT at biblabel}
+{
+    \def\@biblabel#1{\@citess{#1}}
+}{}
+
+\def\@citess#1{\textsuperscript{#1}}
+
+\DeclareDocumentCommand\citepunct{}{,\,\relax}
+
+\endinput
+%%
+%% End of file `lwarp-cite.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-cite.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-continue.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-continue.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-continue.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,28 @@
+%%
+%% This is file `lwarp-continue.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `continue')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{continue}
+\newcommand*{\flagcont}{}
+\newcommand*{\flagend}{}
+\newcommand*{\flagword}{}
+\newcommand*{\preflagword}{}
+\newcommand*{\postflagword}{}
+\newlength\contsep
+\newlength\contdrop
+\endinput
+%%
+%% End of file `lwarp-continue.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-continue.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-endfloat.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-endfloat.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-endfloat.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,33 @@
+%%
+%% This is file `lwarp-endfloat.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `endfloat')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{endfloat}
+\newcommand\figureplace{}
+\newcommand\tableplace{}
+\newcommand\floatplace[1]{}
+\newcounter{posttable}
+\newcounter{postfigure}
+\newcommand*{\theposttbl}{}
+\newcommand*{\thepostfig}{}
+\newcommand{\AtBeginFigures}[1]{}
+\newcommand{\AtBeginTables}[1]{}
+\newcommand{\AtBeginDelayedFloats}[1]{}
+\newcommand*{\processdelayedfloats}{}
+\newcommand*{\efloatseparator}{}
+\endinput
+%%
+%% End of file `lwarp-endfloat.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-endfloat.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-epigraph.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-epigraph.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-epigraph.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -20,7 +20,7 @@
 
 \LWR at ProvidesPackageDrop{epigraph}
 
-\newcommand{\qitem}[2]
+\DeclareDocumentCommand{\qitem}{m m}
 {
 \begin{BlockClass}{qitem}
 #1
@@ -32,7 +32,7 @@
 \end{BlockClass}
 }
 
-\newcommand{\epigraph}[2]
+\DeclareDocumentCommand{\epigraph}{m m}
 {
 \begin{LWR at BlockClassWP}{text-align:right}{}{epigraph}
 \qitem{#1}{#2}
@@ -39,15 +39,22 @@
 \end{LWR at BlockClassWP}
 }
 
-\newenvironment*{epigraphs}
+\DeclareDocumentEnvironment{epigraphs}{}
 {\LWR at BlockClassWP{text-align:right}{}{epigraph}}
 {\endLWR at BlockClassWP}
+\newenvironment*{flushepinormal}{}{}
+\@ifclassloaded{memoir}{
+\setlength{\epigraphwidth}{.5\linewidth}
+\renewcommand{\textflush}{flushepinormal}
+\renewcommand{\epigraphhead}[2][0]{#2}
+\renewcommand{\dropchapter}[1]{}
+\renewcommand*{\undodrop}{}
+}{% not memoir
 \newlength{\epigraphwidth}
 \setlength{\epigraphwidth}{.5\linewidth}
-\newenvironment*{flushepinormal}{}{}
-\newcommand{\textflush}[1]{flushepinormal}
-\newcommand{\epigraphflush}[1]{flushright}
-\newcommand{\sourceflush}[1]{flushright}
+\newcommand{\textflush}{flushepinormal}
+\newcommand{\epigraphflush}{flushright}
+\newcommand{\sourceflush}{flushright}
 \newcommand*{\epigraphsize}{\small}
 \newlength{\epigraphrule}
 \newlength{\beforeepigraphskip}
@@ -55,6 +62,9 @@
 \newcommand{\epigraphhead}[2][0]{#2}
 \newcommand{\dropchapter}[1]{}
 \newcommand*{\undodrop}{}
+}% not memoir
+
+\let\cleartoevenpage\relax% also in nextpage
 \newcommand{\cleartoevenpage}[1][]{}
 \endinput
 %%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fancyvrb.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -17,7 +17,6 @@
 %% version 2005/12/01 or later.
 \RequirePackage{xcolor}% for \convertcolorspec
 \LWR at ProvidesPackagePass{fancyvrb}
-
 \begin{warpHTML}
 
 \fvset{frame=none}%
@@ -30,20 +29,40 @@
 
 \AfterEndPreamble{
 \LWR at traceinfo{Patching Verbatim.}
-\let\LWRFV at origVerbatim\Verbatim
-\renewcommand*{\Verbatim}{%
-\LWR at forcenewpage
-\LWRFV at origVerbatim%
+\preto\FVB at Verbatim{\LWR at forcenewpage}
+\preto\FVB at LVerbatim{\LWR at forcenewpage}
+\def\FV at BeginListFrame@Single{%
+  \FV at SingleFrameLine{\z@}%
 }
+
+\def\FV at EndListFrame@Single{%
+  \FV at SingleFrameLine{\@ne}%
+}
+
+\def\FV at BeginListFrame@Lines{%
+  \FV at SingleFrameLine{\z@}%
+}
+
+\def\FV at EndListFrame@Lines{%
+    \FV at SingleFrameLine{\@ne}%
+}
+
+\renewcommand*{\FV at SingleFrameSep}{}
+\def\FV at BUseVerbatim#1{%
+    \LWR at atbeginverbatim[\LWR at FVstyle]{verbatim}%
+    \FV at BVerbatimBegin#1\FV at BVerbatimEnd%
+    \LWR at afterendverbatim%
+}
+
 \newcommand*{\LWR at FVstyle}{}
 \newcommand*{\LWR at fvstartnone}{%
 \LWR at traceinfo{fvstartnone}%
-\hbox to\z@{\LWR at atbeginverbatim[\LWR at FVstyle]{verbatim}}%
+\LWR at atbeginverbatim[\LWR at FVstyle]{verbatim}%
 }
 
 \newcommand*{\LWR at fvendnone}{%
 \LWR at traceinfo{fvendnone}%
-\hbox to\z@{\LWR at afterendverbatim}%
+\LWR at afterendverbatim%
 }
 
 \newcommand*{\LWR at fvstartsingle}{%
@@ -136,7 +155,6 @@
 \let\FV at RightListFrame\relax%
 \let\FV at EndListFrame\LWR at fvendnone}
 \def\FV at SingleFrameLine#1{%
-  \hbox to\z@{%
     \ifnum#1=\z@\relax
       \let\FV at Label\FV at LabelBegin
     \else
@@ -156,15 +174,13 @@
         \ifx\FV at LabelPositionBottomLine\relax
         \else
         \LWR at FVfindbordercolor
+
         \LWR at htmltagc{div class="fancyvrblabel" style="color: \#\LWR at tempcolor"}
         \LWR at origtextrm{\FV at LabelEnd}
         \LWR at htmltagc{/div}
         \fi
       \fi
-
     \fi
-    \hss
-    }
 }
 \def\FV at ListProcessLine#1{%
    \hbox to \hsize{%
@@ -180,16 +196,15 @@
 }
 
 \AtBeginEnvironment{BVerbatim}
-{
-\LWR at forcenewpage
-\LWR at atbeginverbatim{bverbatim}
-
+{%
+\LWR at forcenewpage% instead of \preto
+\LWR at atbeginverbatim{bverbatim}%
 }
 
 \AfterEndEnvironment{BVerbatim}
-{
-\leavevmode\par\LWR at origvspace{-\baselineskip}
-\LWR at afterendverbatim
+{%
+\leavevmode\par\LWR at origvspace{-\baselineskip}%
+\LWR at afterendverbatim%
 }
 
 } % \AfterEndPreamble

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-flafter.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-flafter.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-flafter.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,22 @@
+%%
+%% This is file `lwarp-flafter.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `flafter')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{flafter}
+\providecommand\fl at trace[1]{}
+\endinput
+%%
+%% End of file `lwarp-flafter.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-flafter.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-float.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-float.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-float.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -21,11 +21,11 @@
 
 
 \NewDocumentCommand{\newfloat}{m m m o}{%
-\IfValueTF{#4}
-{\DeclareFloatingEnvironment[fileext=#3,within=#4]{#1}}
-{\DeclareFloatingEnvironment[fileext=#3]{#1}}
-\cslet{listof#1s}\relax
-\cslet{listof#1es}\relax
+\IfValueTF{#4}%
+{\DeclareFloatingEnvironment[fileext=#3,within=#4]{#1}}%
+{\DeclareFloatingEnvironment[fileext=#3]{#1}}%
+\cslet{listof#1s}\relax%
+\cslet{listof#1es}\relax%
 }
 
 \NewDocumentCommand{\floatname}{m +m}{%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-floatrow.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-floatrow.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-floatrow.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -120,29 +120,29 @@
 \define at key{frowkeys}{relatedcapstyle}{}%
 
 \newcommand*{\DeclareNewFloatType}[2]{%
-\renewcommand*{\LWR at frowkeyplacement}{}
-\renewcommand*{\LWR at frowkeyname}{}
-\renewcommand*{\LWR at frowkeyfileext}{}
-\renewcommand*{\LWR at frowkeywithin}{}
-\renewcommand*{\LWR at frowkeycapstyle}{}
+\renewcommand*{\LWR at frowkeyplacement}{}%
+\renewcommand*{\LWR at frowkeyname}{}%
+\renewcommand*{\LWR at frowkeyfileext}{}%
+\renewcommand*{\LWR at frowkeywithin}{}%
+\renewcommand*{\LWR at frowkeycapstyle}{}%
 \LWR at traceinfo{about to setkeys frowkeys}%
 \setkeys{frowkeys}{#2}%
 \LWR at traceinfo{finished setkeys frowkeys}%
-\ifthenelse{\equal{\LWR at frowkeywithin}{}}
-{
-    \LWR at traceinfo{about to newfloat #1 \LWR at frowkeyplacement\
+\ifthenelse{\equal{\LWR at frowkeywithin}{}}%
+{%
+    \LWR at traceinfo{about to newfloat #1 \LWR at frowkeyplacement\ %
         \LWR at frowkeyfileext}%
-    \newfloat{#1}{\LWR at frowkeyplacement}{\LWR at frowkeyfileext}
+    \newfloat{#1}{\LWR at frowkeyplacement}{\LWR at frowkeyfileext}%
 }%
 {%
-    \LWR at traceinfo{about to newfloat #1\ \LWR at frowkeyplacement\
+    \LWR at traceinfo{about to newfloat #1\ \LWR at frowkeyplacement\ %
         \LWR at frowkeyfileext\ \LWR at frowkeywithin}%
     \newfloat{#1}{\LWR at frowkeyplacement}%
     {\LWR at frowkeyfileext}[\LWR at frowkeywithin]%
-    \LWR at traceinfo{finished newfloat #1}
+    \LWR at traceinfo{finished newfloat #1}%
 }%
-\ifthenelse{\equal{\LWR at frowkeyname}{}}
-{}
+\ifthenelse{\equal{\LWR at frowkeyname}{}}%
+{}%
 {\floatname{#1}{\LWR at frowkeyname}}%
 }
 

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fltrace.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fltrace.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fltrace.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,24 @@
+%%
+%% This is file `lwarp-fltrace.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `fltrace')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{fltrace}
+\def\tracefloats{}
+\def\tracefloatsoff{}
+\def\tracefloatvals{}
+\endinput
+%%
+%% End of file `lwarp-fltrace.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fltrace.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-footnote.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-footnote.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-footnote.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -20,7 +20,7 @@
   \protected at edef\@currentlabel{\csname p@\@mpfn\endcsname\@thefnmark}%
 }
 
-\newcommand*{\fn at endnote}{%
+\def\fn at endnote{%
 \LWR at htmltagc{/\LWR at tagregularparagraph}%
 \LWR at orignewline%
 }

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-footnpag.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-footnpag.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-footnpag.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,21 @@
+%%
+%% This is file `lwarp-footnpag.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `footnpag')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{footnpag}
+\endinput
+%%
+%% End of file `lwarp-footnpag.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-footnpag.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-framed.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-framed.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-framed.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -35,7 +35,7 @@
 \renewenvironment{shaded}{%
 \convertcolorspec{named}{shadecolor}{HTML}\LWR at tempcolor%
 \LWR at forcenewpage
-\BlockClass[background: \#\LWR at tempcolor]{framed}%
+\BlockClass[background: \#\LWR at tempcolor]{shaded}%
 }
 {\endBlockClass}
 
@@ -42,7 +42,7 @@
 \renewenvironment{shaded*}{%
 \convertcolorspec{named}{shadecolor}{HTML}\LWR at tempcolor%
 \LWR at forcenewpage
-\BlockClass[background: \#\LWR at tempcolor]{framed}%
+\BlockClass[background: \#\LWR at tempcolor]{shaded}%
 }
 {\endBlockClass}
 

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fwlw.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fwlw.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fwlw.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,26 @@
+%%
+%% This is file `lwarp-fwlw.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `fwlw')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{fwlw}
+\newbox\FirstWordBox     \global\setbox\FirstWordBox\hbox{}
+\newbox\NextWordBox      \global\setbox\NextWordBox\hbox{}
+\newbox\LastWordBox      \global\setbox\LastWordBox\hbox{}
+\def\ps at fwlwhead{}
+\def\ps at NextWordFoot{}
+\endinput
+%%
+%% End of file `lwarp-fwlw.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-fwlw.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -159,6 +159,7 @@
 \Ginclude at graphics{\detokenize\expandafter{#4}}%
 \endgroup%
 \filename at parse{\LWR at parsedfilename}%
+\LWR at traceinfo{LWR at parsedfilename is \LWR at parsedfilename}%
 \large%
 \setlength{\LWR at igwidth}{0pt}%
 \setlength{\LWR at igheight}{0pt}%
@@ -219,8 +220,9 @@
 {% start of href
 \LWR at traceinfo{LWR at includegraphicsb: about to LWR at htmltag}%
 \LWR at htmltag{% start of image tags
-img src="\LWR at parsedfilename" \LWR at orignewline%
-\LWR at origtilde{} alt="[\filename at base]" \LWR at orignewline%
+img src="%
+\begingroup\@sanitize\LWR at parsedfilename\endgroup%
+" \LWR at orignewline%
 \ifthenelse{
     \NOT\equal{\LWR at igwidthstyle}{} \OR
     \NOT\equal{\LWR at igheightstyle}{} \OR
@@ -254,7 +256,6 @@
 \LWR at origtilde{} class="\LWR at igclass" \LWR at orignewline%
 }% end of image tags
 }% end of href
-\endgroup
 \LWR at origscriptsize
 \LWR at traceinfo{LWR at includegraphicsb done}%
 }
@@ -271,10 +272,8 @@
 
 \renewcommand*{\includegraphics}
 {%
-\LWR at traceinfo{includegraphics}
+\LWR at traceinfo{includegraphics}%
 \LWR at ensuredoingapar%
-\begingroup%
-\catcode`\_=12
 \LWR at includegraphicsb%
 }% includegraphics
 }% AtBeginDocument
@@ -312,7 +311,7 @@
 \LWR at rotstyle{-ms-}{#2} %
 \LWR at rotstyle{-webkit-}{#2} %
 \LWR at rotstyle{}{#2} %
-"{}}\LWR at orignewline%
+"}\LWR at orignewline%
 \begin{LWR at nestspan}%
 #3%
 \LWR at htmltagc{/span}%
@@ -328,7 +327,7 @@
 \LWR at scalestyle{-ms-}{#1}{\IfNoValueTF{#2}{#1}{#2}} %
 \LWR at scalestyle{-webkit-}{#1}{\IfNoValueTF{#2}{#1}{#2}} %
 \LWR at scalestyle{}{#1}{\IfNoValueTF{#2}{#1}{#2}} %
-"{}}%
+"}%
 \begin{LWR at nestspan}%
 #3%
 \LWR at htmltagc{/span}%

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hanging.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hanging.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hanging.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,46 @@
+%%
+%% This is file `lwarp-hanging.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `hanging')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{hanging}
+\@ifclassloaded{memoir}{
+\let\hangpara\relax
+\let\hangparas\relax
+\let\endhangparas\relax
+\let\hangpunct\relax
+\let\endhangpunct\relax
+}{}
+\newcommand*{\hangpara}[2]{}
+
+\newenvironment*{hangparas}[2]
+{%
+    \uselengthunit{PT}%
+    \BlockClass[%
+        margin-left:\rndprintlength{#1}; %
+        text-indent:-\rndprintlength{#1}%
+    ]%
+    {hangingpar}%
+}
+{\endBlockClass}
+\newenvironment*{hangpunct}
+{\BlockClass{hangpunct}}
+{\endBlockClass}
+\newcommand{\nhpt}{.}
+\newcommand{\nhlq}{‘}
+\newcommand{\nhrq}{’}
+\endinput
+%%
+%% End of file `lwarp-hanging.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hanging.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -27,27 +27,30 @@
 \newcommand*{\hypersetup}[1]{}
 \newcommand*{\hyperbaseurl}[1]{}
 
-\NewDocumentCommand{\LWR at hyperimageb}{m +m}{%
-\LWR at htmltag{img src="#1" alt="#2" class="hyperimage"{}}%
-\endgroup%
+\NewDocumentCommand{\hyperimage}{m +m}{%
 \LWR at ensuredoingapar%
-}
-
-\DeclareRobustCommand*{\hyperimage}{%
+\def\LWR at templink{#1}%
+\@onelevel at sanitize\LWR at templink%
+\LWR at htmltag{img src="\LWR at templink" alt="#2" class="hyperimage"}%
 \LWR at ensuredoingapar%
-\begingroup\catcode`\_=12
-\LWR at hyperimageb%
 }
 \NewDocumentCommand{\hyperdef}{m m +m}{%
 \LWR at ensuredoingapar%
-\LWR at subsublabel{#1.#2}%
+\LWR at sublabel{#1.#2}%
 #3%
 }
 \NewDocumentCommand{\LWR at hyperrefb}{m m m +m}{%
-\LWR at htmltag{a href="#1\LWR at hashmark#2.#3"}%
+\def\LWR at templink{#1}%
+\@onelevel at sanitize\LWR at templink%
+\def\LWR at templinktwo{#2}%
+\@onelevel at sanitize\LWR at templinktwo%
+\def\LWR at templinkthree{#3}%
+\@onelevel at sanitize\LWR at templinkthree%
+\LWR at htmltag{a href="\LWR at templink\LWR at hashmark%
+    \LWR at templinktwo.\LWR at templinkthree"%
+}%
 #4%
 \LWR at htmltag{/a}%
-\endgroup%
 }
 
 \NewDocumentCommand{\LWR at hyperrefc}{O{label} +m}{
@@ -54,12 +57,10 @@
 \LWR at startref{#1}%
 #2%
 \LWR at htmltag{/a}%
-\endgroup%
 }
 
 \DeclareRobustCommand*{\hyperref}{%
 \LWR at ensuredoingapar%
-\begingroup\catcode`\_=12
 \@ifnextchar[\LWR at hyperrefc\LWR at hyperrefb%
 }
 
@@ -68,7 +69,7 @@
 #2%
 }
 
-\NewDocumentCommand{\hyperlink}{m +m}{%
+\DeclareDocumentCommand{\hyperlink}{m +m}{%
 \hyperref[#1]{#2}%
 }
 

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -21,6 +21,19 @@
 \LWR at ProvidesPackageDrop{mdframed}
 \LWR at origRequirePackage{amsthm}
 \LWR at origRequirePackage[framemethod=none]{mdframed}
+\AtBeginDocument{
+\def\mdf at trivlist#1{%
+  \edef\mdf at temp{%
+  }%
+  \let\@itemlabel\@empty%
+  \def\makelabel##1{##1}%
+}
+
+\renewcommand*{\endmdf at trivlist}{%
+\LWR at traceinfo{endmdf at trivlist}%
+\LWR at listend%
+}
+}% AtBeginDocument
 \mdfsetup{
 startcode={\LWR at mdframedstart\LWR at origraggedright},
 endcode={\LWR at mdframedend},
@@ -36,6 +49,7 @@
 \rndprintlength{\csuse{mdf@#1 at length}}
 }
 \newcommand*{\LWR at mdframedstart}{%
+\LWR at traceinfo{LWR at mdframedstart start}%
 \LWR at stoppars%
 \uselengthunit{PT}%
 \LWR at htmltagc{div class="\LWR at mdthisenv" \LWR at orignewline
@@ -57,18 +71,57 @@
 \LetLtxMacro{\hspace}{\LWR at orighspace}%
 \LetLtxMacro\rule\LWR at origrule%
 \LetLtxMacro\makebox\LWR at origmakebox%
+\LWR at startpars%
+\LWR at traceinfo{LWR at mdframedstart done}%
 }
 \newcommand*{\LWR at mdframedend}{
+\LWR at traceinfo{LWR at mdframedend start}%
 \LWR at htmldivclassend{\LWR at mdthisenv}
 \gdef\LWR at mdthisenv{mdframed}
 \LWR at startpars%
+\LWR at traceinfo{LWR at mdframedend done}%
 }
+\renewenvironment{mdframed}[1][]{%
+ \color at begingroup%
+   \mdfsetup{userdefinedwidth=\linewidth,#1}%
+   \mdf at startcode%
+   \mdf at preenvsetting%
+   \ifdefempty{\mdf at firstframetitle}{}%
+           {\let\mdf at frametitlesave\mdf at frametitle%
+            \let\mdf at frametitle\mdf at firstframetitle%
+           }%
+   \ifvmode\nointerlineskip\fi%
+        \ifdefempty{\mdf at frametitle}{}%
+            {\mdfframedtitleenv{\mdf at frametitle}%
+            }%
+   \mdf at trivlist{\mdf at skipabove@length}%%
+   \mdf at settings%
+  }%
+  {%
+   \par%
+   \ifmdf at footnoteinside%
+      \def\mdf at reserveda{%
+        \mdf at footnoteoutput%
+      }%
+   \else%
+      \def\mdf at reserveda{%
+        \mdf at footnoteoutput%
+        }%
+   \fi%
+   \mdf at reserveda%
+  \aftergroup\endmdf at trivlist%
+ \color at endgroup%
+ \mdf at endcode%
+}
+\renewrobustcmd*\mdf at footnoteoutput{%
+    \LWR at printpendingmpfootnotes%
+}
 \LetLtxMacro\LWR at origmdfframedtitleenv\mdfframedtitleenv
 
 \newlength{\LWR at titleroundcorner}
 
 \renewrobustcmd\mdfframedtitleenv[1]{%
-\LWR at origmdfframedtitleenv{%
+\LWR at traceinfo{LWR at mdframedtitleenv start}%
 \uselengthunit{PT}%
 \LWR at htmltagc{span class="mdframedtitle" \LWR at orignewline
 style=" \LWR at orignewline
@@ -95,11 +148,12 @@
 #1%
 \LWR at htmltagc{/span}%
 \end{LWR at nestspan}%
+\LWR at traceinfo{LWR at mdframedtitleenv end}%
 }
-}
 \NewDocumentCommand{\LWR at mdfsubtitlecommon}{m o m}
 {% the following empty line is required
 
+\LWR at traceinfo{LWR at mdframedsubtitlecommon start}%
 \let\par\LWR at origpar%
 \LWR at htmltagc{span class="mdframed#1title"
 style=" \LWR at orignewline
@@ -128,15 +182,12 @@
 \LWR at htmltagc{/span}% the following empty line is required
 \end{LWR at nestspan}% must follow the /span or an extra <p> appears
 
+\LWR at traceinfo{LWR at mdframedsubtitlecommon end}%
 }
-\let\LWR at origmdfsubtitle\mdfsubtitle
-
 \newcommand*{\LWR at mdfsubtitle}{%
 \LWR at mdfsubtitlecommon{sub}%
 }
 \let\mdfsubtitle\LWR at mdfsubtitle
-\let\LWR at origmdfsubsubtitle\mdfsubsubtitle
-
 \newcommand*{\LWR at mdfsubsubtitle}{%
 \LWR at mdfsubtitlecommon{subsub}%
 }

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-memhfixc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-memhfixc.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-memhfixc.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,21 @@
+%%
+%% This is file `lwarp-memhfixc.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `memhfixc')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{memhfixc}
+\endinput
+%%
+%% End of file `lwarp-memhfixc.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-memhfixc.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-midpage.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-midpage.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-midpage.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,24 @@
+%%
+%% This is file `lwarp-midpage.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `midpage')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{midpage}
+\newenvironment{midpage}
+{\begin{BlockClass}[margin-top:6ex ; margin-bottom:6ex]{midpage}}
+{\end{BlockClass}}
+\endinput
+%%
+%% End of file `lwarp-midpage.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-midpage.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-moreverb.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-moreverb.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-moreverb.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -65,11 +65,12 @@
 \renewenvironment*{boxedverbatim}
 {
 \LWR at forcenewpage
-\LWR at atbeginverbatim{boxedverbatim}\unskip\LWR at origvspace*{-\baselineskip}%
+\LWR at atbeginverbatim{boxedverbatim}\unskip\LWR at origvspace*{-2\baselineskip}%
 \verbatim%
 }
 {
 \endverbatim%
+\unskip%
 \LWR at afterendverbatim%
 }
 

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-multirow.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-multirow.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-multirow.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -22,7 +22,7 @@
 \newcommand{\LWR at multirowborder}{}
 \RenewDocumentCommand{\multirow}{O{c} m o m o +m}%
 {%
-\LWR at traceinfo{*** multirow #1 #2 #4}
+\LWR at traceinfo{*** multirow #1 #2 #4}%
 \LWR at maybenewtablerow%
 \LWR at tabularleftedge%
 \LWR at htmltag{td rowspan="#2" %

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-natbib.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-natbib.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-natbib.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,38 @@
+%%
+%% This is file `lwarp-natbib.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `natbib')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\LWR at ProvidesPackagePass{natbib}
+\newcommand{\LWRNB at NAT@open}{$<$}
+\newcommand{\LWRNB at patchnatbibopenclose}{
+\ifdefstrequal{\NAT at open}{\LWRNB at NAT@open}
+{
+    \renewcommand{\NAT at open}{\textless}
+    \renewcommand{\NAT at close}{\textgreater}
+}{}
+}
+\LWRNB at patchnatbibopenclose
+\let\LWRNB at origsetcitestyle\setcitestyle
+
+\renewcommand{\setcitestyle}[1]{%
+\LWRNB at origsetcitestyle{#1}%
+\LWRNB at patchnatbibopenclose%
+}
+
+\endinput
+%%
+%% End of file `lwarp-natbib.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-natbib.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-needspace.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-needspace.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-needspace.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -19,7 +19,7 @@
 
 \LWR at ProvidesPackageDrop{needspace}
 
-\newcommand*{\needspace}[1]{}
+\DeclareDocumentCommand{\needspace}{m}{}
 \DeclareDocumentCommand{\Needspace}{s m}{}
 
 \endinput

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-nextpage.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-nextpage.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-nextpage.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -19,10 +19,10 @@
 
 \LWR at ProvidesPackageDrop{nextpage}
 
-\newcommand{\cleartoevenpage}[1][]{}
-\newcommand{\movetoevenpage}[1][]{}
-\newcommand{\cleartooddpage}[1][]{}
-\newcommand{\movetooddpage}[1][]{}
+\DeclareDocumentCommand{\cleartoevenpage}{o}{}
+\DeclareDocumentCommand{\movetoevenpage}{o}{}
+\DeclareDocumentCommand{\cleartooddpage}{o}{}
+\DeclareDocumentCommand{\movetooddpage}{o}{}
 
 \endinput
 %%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -36,6 +36,81 @@
 
 \LWR at ProvidesPackagePass{ntheorem}
 \newcommand{\LWR at newtheoremstyle}{plain}
+\AtBeginDocument{
+\@ifpackageloaded{cleveref}{
+\gdef\@thm#1#2#3{%
+   \if at thmmarks
+     \stepcounter{end\InTheoType ctr}%
+   \fi
+   \renewcommand{\InTheoType}{#1}%
+   \if at thmmarks
+     \stepcounter{curr#1ctr}%
+     \setcounter{end#1ctr}{0}%
+   \fi
+   \refstepcounter[#1]{#2}%  <<< cleveref modification
+   \theorem at prework
+    \LWR at forcenewpage% new
+    \BlockClass{theorembody#1}%\LWR at thisthmstyle% new
+   \trivlist % latex's \trivlist, calling latex's \@trivlist unchanged
+   \ifuse at newframeskips  % cf. latex.ltx for topsepadd: \@trivlist
+     \ifthm at inframe
+       \thm at topsep\theoreminframepreskipamount
+       \thm at topsepadd\theoreminframepostskipamount
+      \else
+       \thm at topsep\theorempreskipamount
+       \thm at topsepadd\theorempostskipamount
+      \fi
+    \else% oldframeskips
+      \thm at topsep\theorempreskipamount
+      \thm at topsepadd \theorempostskipamount
+      \ifvmode\advance\thm at topsepadd\partopsep\fi
+   \fi
+   \@topsep\thm at topsep
+   \@topsepadd\thm at topsepadd
+   \advance\linewidth -\theorem at indent
+   \advance\linewidth -\theorem at rightindent
+   \advance\@totalleftmargin \theorem at indent
+   \parshape \@ne \@totalleftmargin \linewidth
+   \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}
+}
+}{% not @ifpackageloaded{cleveref}
+\gdef\@thm#1#2#3{%
+   \if at thmmarks
+     \stepcounter{end\InTheoType ctr}%
+   \fi
+   \renewcommand{\InTheoType}{#1}%
+   \if at thmmarks
+     \stepcounter{curr#1ctr}%
+     \setcounter{end#1ctr}{0}%
+   \fi
+   \refstepcounter{#2}%
+   \theorem at prework
+    \LWR at forcenewpage% new
+    \BlockClass{theorembody#1}%\LWR at thisthmstyle% new
+   \trivlist % latex's \trivlist, calling latex's \@trivlist unchanged
+   \ifuse at newframeskips  % cf. latex.ltx for topsepadd: \@trivlist
+     \ifthm at inframe
+       \thm at topsep\theoreminframepreskipamount
+       \thm at topsepadd\theoreminframepostskipamount
+      \else
+       \thm at topsep\theorempreskipamount
+       \thm at topsepadd\theorempostskipamount
+      \fi
+    \else% oldframeskips
+      \thm at topsep\theorempreskipamount
+      \thm at topsepadd \theorempostskipamount
+      \ifvmode\advance\thm at topsepadd\partopsep\fi
+   \fi
+   \@topsep\thm at topsep
+   \@topsepadd\thm at topsepadd
+   \advance\linewidth -\theorem at indent
+   \advance\linewidth -\theorem at rightindent
+   \advance\@totalleftmargin \theorem at indent
+   \parshape \@ne \@totalleftmargin \linewidth
+   \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}
+}
+}
+}% AtBeginDocument
 \gdef\theoremstyle#1{%
    \@ifundefined{th@#1}{\@warning
           {Unknown theoremstyle `#1'. Using `plain'}%
@@ -105,7 +180,7 @@
 \newcommand{\LWR at inctheorem}{%
 \addtocounter{LWR at thisautoid}{1}%
 \LWR at stoppars%
-\LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"{}}\LWR at htmltag{/a}%
+\LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"}\LWR at htmltag{/a}%
 \LWR at startpars%
 }
 \gdef\newtheoremstyle#1#2#3{%
@@ -112,113 +187,120 @@
   \expandafter\@ifundefined{th@#1}%
    {\expandafter\gdef\csname th@#1\endcsname{%
     \def\@begintheorem####1####2{%
-\LWR at forcenewpage% new
-\BlockClass{theorembody#1}%\LWR at thisthmstyle% new
-\LWR at inctheorem% new
-#2}%
+    \LWR at inctheorem% new
+    #2}%
     \def\@opargbegintheorem####1####2####3{%
-\LWR at forcenewpage% new
-\BlockClass{theorembody#1}%\LWR at thisthmstyle% new
-\LWR at inctheorem% new
-#3}%
+    \LWR at inctheorem% new
+    #3}%
 }%
 }%
 {\PackageError{\basename}{Theorem style #1 already defined}\@eha}
 }
 \renewtheoremstyle{plain}%
-  {\item[\hskip\labelsep \theorem at headerfont
+  {\item[
     \InlineClass{theoremheaderplain}{##1\ ##2\theorem at separator}]}%
-  {\item[\hskip\labelsep \theorem at headerfont
+  {\item[
     \InlineClass{theoremheaderplain}{##1\ ##2\ (##3)\theorem at separator}]}
 
 \renewtheoremstyle{break}%
   {\item[
-    \hskip\labelsep \theorem at headerfont
     \InlineClass{theoremheaderbreak}{##1\ ##2\theorem at separator}\newline
     ]}%
   {\item[
-    \hskip\labelsep \theorem at headerfont
     \InlineClass{theoremheaderbreak}%
         {##1\ ##2\ (##3)\theorem at separator}\newline
     ]}
 
 \renewtheoremstyle{change}%
-  {\item[\hskip\labelsep
-    \theorem at headerfont
+  {\item[
     \InlineClass{theoremheaderchange}{##2\ ##1\theorem at separator}]}%
-  {\item[\hskip\labelsep
-    \theorem at headerfont
+  {\item[
     \InlineClass{theoremheaderchange}{##2\ ##1\ (##3)\theorem at separator}]}
 
 \renewtheoremstyle{changebreak}%
   {\item[
-        \hskip\labelsep \theorem at headerfont
         \InlineClass{theoremheaderchangebreak}%
             {##2\ ##1\theorem at separator}\newline
     ]}%
   {\item[
-        \hskip\labelsep \theorem at headerfont
         \InlineClass{theoremheaderchangebreak}%
             {##2\ ##1\ (##3)\theorem at separator}\newline
     ]}
 
 \renewtheoremstyle{margin}%
-  {\item[\hskip\labelsep\theorem at headerfont
+  {\item[
         \InlineClass{theoremheadermargin}{##2 \qquad ##1\theorem at separator}
     ]}%
-  {\item[\hskip\labelsep\theorem at headerfont
+  {\item[
         \InlineClass{theoremheadermargin}{##2 \qquad ##1\ (##3)\theorem at separator}
     ]}
 
 \renewtheoremstyle{marginbreak}%
-  {\item[\hskip\labelsep\theorem at headerfont
+  {\item[
     \InlineClass{theoremheadermarginbreak}%
         {##2 \qquad ##1\theorem at separator}\newline
     ]}%
-  {\item[\hskip\labelsep\theorem at headerfont
+  {\item[
     \InlineClass{theoremheadermarginbreak}%
         {##2 \qquad ##1\ (##3)\theorem at separator}\newline
     ]}
 
 \renewtheoremstyle{nonumberplain}%
-  {\item[\theorem at headerfont\hskip\labelsep
+  {\item[
     \InlineClass{theoremheaderplain}{##1\theorem at separator}]}%
-  {\item[\theorem at headerfont\hskip \labelsep
+  {\item[
     \InlineClass{theoremheaderplain}{##1\ (##3)\theorem at separator}]}
 
 \renewtheoremstyle{nonumberbreak}%
   {\item[
-    \hskip\labelsep \theorem at headerfont
     \InlineClass{theoremheaderbreak}{##1\theorem at separator}\newline
     ]}%
   {\item[
-    \hskip\labelsep \theorem at headerfont
     \InlineClass{theoremheaderbreak}{##1\ (##3)\theorem at separator}\newline
     ]}
 
 \renewtheoremstyle{empty}%
   {\item[]}%
-  {\item[\theorem at headerfont \hskip\labelsep\relax
+  {\item[
     \InlineClass{theoremheaderplain}{##3}]}
 
 \renewtheoremstyle{emptybreak}%
   {\item[]}%
-  {\item[\theorem at headerfont \hskip\labelsep\relax
+  {\item[
     \InlineClass{theoremheaderplain}{##3}] \ \newline}
 \ifbool{LWR at ntheoremamsthm}{}{%
     \newtheoremstyle{plainupright}%
-    {\item[\hskip\labelsep \theorem at headerfont
+    {\item[
         \InlineClass{theoremheaderplain}{##1\ ##2\theorem at separator}]}%
-    {\item[\hskip\labelsep \theorem at headerfont
+    {\item[
         \InlineClass{theoremheaderplain}{##1\ ##2\ (##3)\theorem at separator}]}
-
     \newtheoremstyle{nonumberplainuprightsc}%
-    {\item[\theorem at headerfont\hskip\labelsep
+    {\item[
         \InlineClass{theoremheadersc}{##1\theorem at separator}]}%
-    {\item[\theorem at headerfont\hskip \labelsep
+    {\item[
         \InlineClass{theoremheadersc}{##1\ (##3)\theorem at separator}]}
 }% not amsthm
 \ifbool{LWR at ntheoremamsthm}{}{%
+    \theoremnumbering{arabic}
+    \theoremstyle{plain}
+    \RequirePackage{latexsym}
+    \theoremsymbol{\Box}
+    \theorembodyfont{\itshape}
+    \theoremheaderfont{\normalfont\bfseries}
+    \theoremseparator{}
+    \renewtheorem{Theorem}{Theorem}
+    \renewtheorem{theorem}{Theorem}
+    \renewtheorem{Satz}{Satz}
+    \renewtheorem{satz}{Satz}
+    \renewtheorem{Proposition}{Proposition}
+    \renewtheorem{proposition}{Proposition}
+    \renewtheorem{Lemma}{Lemma}
+    \renewtheorem{lemma}{Lemma}
+    \renewtheorem{Korollar}{Korollar}
+    \renewtheorem{korollar}{Korollar}
+    \renewtheorem{Corollary}{Corollary}
+    \renewtheorem{corollary}{Corollary}
+
     \theoremstyle{plainupright}
     \theorembodyfont{\upshape}
     \theoremsymbol{\HTMLunicode{25A1}}% UTF-8 white box
@@ -250,17 +332,13 @@
 \gdef\th at plain{%
   \def\theorem at headerfont{\normalfont\bfseries}\itshape%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyplain}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
+      \item[
   \InlineClass{theoremheaderplain}{##1\ ##2.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyplain}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
+     \item[
   \InlineClass{theoremheaderplain}{##1\ ##2\ (##3).}
         ]}}
 
@@ -267,17 +345,13 @@
 \gdef\th at nonumberplain{%
   \def\theorem at headerfont{\normalfont\bfseries}\itshape%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyplain}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
+      \item[
   \InlineClass{theoremheaderplain}{##1.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyplain}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
+     \item[
   \InlineClass{theoremheaderplain}{##1\ (##3).}
         ]}}
 
@@ -284,17 +358,13 @@
 \gdef\th at definition{%
   \def\theorem at headerfont{\normalfont\bfseries}\normalfont%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodydefinition}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
+      \item[
   \InlineClass{theoremheaderdefinition}{##1\ ##2.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodydefinition}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
+     \item[
   \InlineClass{theoremheaderdefinition}{##1\ ##2\ (##3).}
         ]}}
 
@@ -301,17 +371,13 @@
 \gdef\th at nonumberdefinition{%
   \def\theorem at headerfont{\normalfont\bfseries}\normalfont%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodydefinition}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
+      \item[
   \InlineClass{theoremheaderdefinition}{##1.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodydefinition}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
+     \item[
   \InlineClass{theoremheaderdefinition}{##1\ (##3).}
         ]}}
 
@@ -318,17 +384,13 @@
 \gdef\th at remark{%
   \def\theorem at headerfont{\itshape}\normalfont%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyremark}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
+      \item[
   \InlineClass{theoremheaderremark}{##1\ ##2.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyremark}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
+     \item[
   \InlineClass{theoremheaderremark}{##1\ ##2\ (##3).}
         ]}}
 
@@ -335,17 +397,13 @@
 \gdef\th at nonumberremark{%
   \def\theorem at headerfont{\itshape}\normalfont%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyremark}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
+      \item[
   \InlineClass{theoremheaderremark}{##1.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyremark}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
+     \item[
   \InlineClass{theoremheaderremark}{##1\ (##3).}
         ]}}
 
@@ -352,17 +410,13 @@
 \gdef\th at proof{%
   \def\theorem at headerfont{\normalfont\bfseries}\itshape%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyproof}% new
         \LWR at inctheorem% new
-      \item[\hskip\labelsep
+      \item[
   \InlineClass{theoremheaderproof}{##1.}
         ]}%
   \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-        \BlockClass{theorembodyroof}% new
         \LWR at inctheorem% new
-     \item[\hskip\labelsep
+     \item[
   \InlineClass{theoremheaderproof}{##1\ (##3).}
         ]}}
 
@@ -394,7 +448,7 @@
     \setendmarkfalse%
     \fi%
 }{}%
-\LWR at origendtheorem%
+\LWR at origendtheorem% also does \@endtrivlist
 \ifbool{LWR at ntheoremmarks}{\global\setendmarktrue}{}%
 \endBlockClass%
 }

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pagesel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pagesel.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pagesel.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,21 @@
+%%
+%% This is file `lwarp-pagesel.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `pagesel')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{pagesel}
+\endinput
+%%
+%% End of file `lwarp-pagesel.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pagesel.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-memoir.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-memoir.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-memoir.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,1055 @@
+%%
+%% This is file `lwarp-patch-memoir.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `patch-memoir')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\ProvidesPackage{lwarp-patch-memoir}
+\RequirePackage{lwarp-abstract}% req'd
+\RequirePackage{lwarp-array}% req'd
+\RequirePackage{lwarp-booktabs}% req'd
+\RequirePackage{lwarp-changepage}% req'd
+\RequirePackage{lwarp-crop}
+\RequirePackage{lwarp-dcolumn}% req'd
+\RequirePackage{lwarp-enumerate}% req'd
+\RequirePackage{lwarp-epigraph}% req'd
+\RequirePackage{lwarp-fancyvrb}% req'd
+\RequirePackage{lwarp-footmisc}% req'd
+\RequirePackage{lwarp-framed}% req'd
+\RequirePackage{lwarp-hanging}% req'd
+\DisemulatePackage{moreverb}
+\RequirePackage{lwarp-moreverb}
+\RequirePackage{lwarp-mparhack}
+\RequirePackage{lwarp-needspace}% req'd
+\RequirePackage{lwarp-nextpage}% req'd
+\RequirePackage{lwarp-pagenote}% req'd
+\RequirePackage{lwarp-parskip}
+\RequirePackage{lwarp-setspace}% req'd
+\RequirePackage{lwarp-showidx}
+\RequirePackage{lwarp-subfigure}% red'q
+\LetLtxMacro\LWR at memorignewsubfloat\newsubfloat
+\RenewDocumentCommand{\newsubfloat}{O{} m}{%
+    \@ifundefined{c at sub#2}{%
+        \LWR at memorignewsubfloat[#1]{#2}%
+    }{}%
+}
+
+\RequirePackage{lwarp-tabularx}% req'd
+\RequirePackage{lwarp-titling}% req'd
+\RequirePackage{lwarp-tocloft}% req'd
+\RequirePackage{lwarp-verse}% req'd
+\LetLtxMacro\LWR at origlabel\@mem at old@label
+
+\AtBeginDocument{
+    \def\@@wrindexhyp#1||\\{%
+        \addtocounter{LWR at autoindex}{1}%
+        \LWR at newlabel{LWRindex-\arabic{LWR at autoindex}}%
+      \ifshowindexmark\@showidx{#1}\fi
+      \protected at write\@auxout{}%
+        {\string\@@wrindexm at m{\@idxfile}{#1}{\arabic{LWR at autoindex}}}%
+      \endgroup
+      \@esphack}%
+}
+
+\setstocksize{190in}{20in}
+\setlrmarginsandblock{2in}{2in}{*}
+\setulmarginsandblock{1in}{1in}{*}
+\renewcommand*{\stockavi}{}
+\renewcommand*{\stockav}{}
+\renewcommand*{\stockaiv}{}
+\renewcommand*{\stockaiii}{}
+\renewcommand*{\stockbvi}{}
+\renewcommand*{\stockbv}{}
+\renewcommand*{\stockbiv}{}
+\renewcommand*{\stockbiii}{}
+\renewcommand*{\stockmlargecrownvo}{}
+\renewcommand*{\stockmdemyvo}{}
+\renewcommand*{\stockmsmallroyalvo}{}
+\renewcommand*{\pageavi}{}
+\renewcommand*{\pageav}{}
+\renewcommand*{\pageaiv}{}
+\renewcommand*{\pageaiii}{}
+\renewcommand*{\pagebvi}{}
+\renewcommand*{\pagebv}{}
+\renewcommand*{\pagebiv}{}
+\renewcommand*{\pagebiii}{}
+\renewcommand*{\pagemlargecrownvo}{}
+\renewcommand*{\pagemdemyvo}{}
+\renewcommand*{\pagemsmallroyalvo}{}
+
+\renewcommand*{\stockdbill}{}
+\renewcommand*{\stockstatement}{}
+\renewcommand*{\stockexecutive}{}
+\renewcommand*{\stockletter}{}
+\renewcommand*{\stockold}{}
+\renewcommand*{\stocklegal}{}
+\renewcommand*{\stockledger}{}
+\renewcommand*{\stockbroadsheet}{}
+\renewcommand*{\pagedbill}{}
+\renewcommand*{\pagestatement}{}
+\renewcommand*{\pageexecutive}{}
+\renewcommand*{\pageletter}{}
+\renewcommand*{\pageold}{}
+\renewcommand*{\pagelegal}{}
+\renewcommand*{\pageledger}{}
+\renewcommand*{\pagebroadsheet}{}
+
+\renewcommand*{\stockpottvo}{}
+\renewcommand*{\stockfoolscapvo}{}
+\renewcommand*{\stockcrownvo}{}
+\renewcommand*{\stockpostvo}{}
+\renewcommand*{\stocklargecrownvo}{}
+\renewcommand*{\stocklargepostvo}{}
+\renewcommand*{\stocksmalldemyvo}{}
+\renewcommand*{\stockdemyvo}{}
+\renewcommand*{\stockmediumvo}{}
+\renewcommand*{\stocksmallroyalvo}{}
+\renewcommand*{\stockroyalvo}{}
+\renewcommand*{\stocksuperroyalvo}{}
+\renewcommand*{\stockimperialvo}{}
+\renewcommand*{\pagepottvo}{}
+\renewcommand*{\pagefoolscapvo}{}
+\renewcommand*{\pagecrownvo}{}
+\renewcommand*{\pagepostvo}{}
+\renewcommand*{\pagelargecrownvo}{}
+\renewcommand*{\pagelargepostvo}{}
+\renewcommand*{\pagesmalldemyvo}{}
+\renewcommand*{\pagedemyvo}{}
+\renewcommand*{\pagemediumvo}{}
+\renewcommand*{\pagesmallroyalvo}{}
+\renewcommand*{\pageroyalvo}{}
+\renewcommand*{\pagesuperroyalvo}{}
+\renewcommand*{\pageimperialvo}{}
+
+\renewcommand*{\memfontfamily}{}
+\renewcommand*{\memfontenc}{}
+\renewcommand*{\memfontpack}{}
+
+\renewcommand*{\anyptfilebase}{}
+\renewcommand*{\anyptsize}{10}
+
+\renewcommand*{\setstocksize}[2]{}
+\renewcommand*{\settrimmedsize}[3]{}
+\renewcommand*{\settrims}[2]{}
+
+\renewcommand*{\setxlvchars}[1]{}
+\renewcommand*{\setlxvchars}[1]{}
+
+\renewcommand*{\settypeblocksize}[3]{}
+\renewcommand*{\setlrmargins}[3]{}
+\renewcommand*{\setlrmarginsandblock}[3]{}
+\renewcommand*{\setbinding}[1]{}
+\renewcommand*{\setulmargins}[3]{}
+\renewcommand*{\setulmarginsandblock}[3]{}
+\renewcommand*{\setcolsepandrule}[2]{}
+
+\renewcommand*{\setheadfoot}[2]{}
+\renewcommand*{\setheaderspaces}[3]{}
+\renewcommand*{\setmarginnotes}[3]{}
+\renewcommand*{\setfootins}[2]{}
+\renewcommand*{\checkandfixthelayout}[1][]{}
+\renewcommand*{\checkthelayout}[1]{}
+\renewcommand*{\fixthelayout}{}
+\renewcommand*{\typeoutlayout}{}
+\renewcommand*{\typeoutstandardlayout}{}
+\renewcommand*{\settypeoutlayoutunit}[1]{}
+\renewcommand*{\fixpdflayout}{}
+\renewcommand*{\fixdvipslayout}{}
+
+\renewcommand*{\medievalpage}[1][]{}
+\renewcommand*{\isopage}[1][]{}
+\renewcommand*{\semiisopage}[1][]{}
+
+\renewcommand{\setpagebl}[3]{}
+\renewcommand{\setpageml}[3]{}
+\renewcommand{\setpagetl}[3]{}
+\renewcommand{\setpagetm}[3]{}
+\renewcommand{\setpagetr}[3]{}
+\renewcommand{\setpagemr}[3]{}
+\renewcommand{\setpagebr}[3]{}
+\renewcommand{\setpagebm}[3]{}
+\renewcommand{\setpagecc}[3]{}
+\let\miniscule\tiny
+\let\HUGE\Huge
+
+\renewcommand*{\abnormalparskip}[1]{}
+\renewcommand*{\nonzeroparskip}{}
+\renewcommand*{\traditionalparskip}{}
+
+\let\onelineskip\baselineskip
+
+\let\OnehalfSpacing\onehalfspacing
+\let\DoubleSpacing\doublespacing
+\renewcommand*{\setPagenoteSpacing}[1]{}
+\renewcommand*{\setFloatSpacing}[1]{}
+\let\SingleSpacing\singlespacing
+\let\setSingleSpace\SetSinglespace
+\let\SingleSpace\singlespace
+\let\endSingleSpace\endsinglespace
+\let\Spacing\spacing
+\let\endSpacing\endspacing
+\let\OnehalfSpace\onehalfspace
+\let\endOnehalfSpace\endonehalfspace
+\csletcs{OnehalfSpace*}{onehalfspace}
+\csletcs{endOnehalfSpace*}{endonehalfspace}
+\let\DoubleSpace\doublespace
+\let\endDoubleSpace\enddoublespace
+\csletcs{DoubleSpace*}{doublespace}
+\csletcs{endDoubleSpace*}{enddoublespace}
+\renewcommand*{\setDisplayskipStretch}[1]{}
+\renewcommand*{\memdskipstretch}{}
+\renewcommand*{\noDisplayskipStretch}{}
+\renewcommand*{\memdskips}{}
+
+\renewcommand*{\midsloppy}{}
+\renewenvironment*{midsloppypar}{}{}
+
+\renewcommand*{\sloppybottom}{}
+\csletcs{titlingpage*}{titlingpage}
+\csletcs{endtitlingpage*}{endtitlingpage}
+\let\andnext\and
+\renewcommand*{\thanksmarkstyle}[1]{}
+\renewcommand{\thanksfootmark}{%
+\thanksscript{\tamark}%
+}
+
+\renewcommand*{\abstractcol}{}
+\renewcommand*{\abstractintoc}{}
+\renewcommand*{\abstractnum}{}
+\renewcommand*{\abstractrunin}{}
+
+\def\@apppage{%
+    \part*{\appendixpagename}
+}
+\renewcommand\mempreaddapppagetotochook{}
+\renewcommand\mempostaddapppagetotochook{}
+
+\def\@sapppage{%
+    \part*{\appendixpagename}
+}
+
+\csletcs{frontmatter*}{frontmatter}
+\csletcs{mainmatter*}{mainmatter}
+\renewcommand*{\raggedbottomsection}{}
+\renewcommand*{\normalbottomsection}{}
+\renewcommand*{\bottomsectionskip}{}
+\renewcommand*{\bottomsectionpenalty}{}
+\csletcs{appendixpage*}{appendixpage}
+\renewcommand*{\namedsubappendices}{}
+\renewcommand*{\unnamedsubappendices}{}
+\renewcommand*{\setsecnumdepth}[1]{}% todo tocvsec2
+\renewcommand*{\maxsecnumdepth}[1]{}% todo tocvsec2
+\renewcommand*{\beforebookskip}{}
+\renewcommand*{\afterbookskip}{}
+\renewcommand*{\beforepartskip}{}
+\renewcommand*{\afterpartskip}{}
+\renewcommand*{\midbookskip}{}
+\renewcommand*{\midpartskip}{}
+\renewcommand*{\printbookname}{}
+\renewcommand*{\booknamefont}{}
+\renewcommand*{\booknamenum}{}
+\renewcommand*{\printbooknum}{}
+\renewcommand*{\booknumfont}{}
+\renewcommand*{\printpartname}{}
+\renewcommand*{\partnamefont}{}
+\renewcommand*{\partnamenum}{}
+\renewcommand*{\printpartnum}{}
+\renewcommand*{\partnumfont}{}
+\renewcommand*{\printbooktitle}[1]{}
+\renewcommand*{\booktitlefont}{}
+\renewcommand{\printparttitle}[1]{}
+\renewcommand*{\parttitlefont}{}
+\renewcommand*{\bookpageend}{}
+\renewcommand*{\bookblankpage}{}
+\renewcommand*{\nobookblankpage}{}
+\renewcommand*{\partpageend}{}
+\renewcommand*{\partblankpage}{}
+\renewcommand*{\nopartblankpage}{}
+\RenewDocumentCommand{\newleadpage}{s o m m}{}% todo
+\RenewDocumentCommand{\renewleadpage}{s o m m}{}% todo
+\renewcommand*{\leadpagetoclevel}{chapter}
+
+\renewcommand*{\openright}{}
+\renewcommand*{\openleft}{}
+\renewcommand*{\openany}{}
+\renewcommand*{\clearforchapter}{}
+\renewcommand*{\memendofchapterhook}{}
+\renewcommand*{\chapterheadstart}{}
+\renewcommand*{\afterchapternum}{}
+\renewcommand*{\afterchaptertitle}{}
+\renewcommand*{\printchaptername}{}
+\renewcommand*{\chapnamefont}{}
+\renewcommand*{\chapternamenum}{}
+\renewcommand*{\printchapternum}{}
+\renewcommand*{\chapnumfont}{}
+\renewcommand{\printchaptertitle}[1]{}
+\renewcommand*{\chaptitlefont}{}
+\renewcommand*{\printchapternonum}{}
+\renewcommand*{\indentafterchapter}{}
+\renewcommand*{\noindentafterchapter}{}
+\renewcommand*{\insertchapterspace}{}
+
+\renewcommand*{\chapterstyle}[1]{}
+\renewcommand{\makechapterstyle}[2]{}
+\renewcommand*{\chapindent}{}
+\let\chapterprecis\cftchapterprecis
+\let\chapterprecishere\cftchapterprecishere
+\let\chapterprecistoc\cftchapterprecistoc
+\renewcommand*{\precisfont}{}
+\renewcommand*{\prechapterprecis}{}
+\renewcommand*{\postchapterprecis}{}
+\renewcommand{\precistoctext}[1]{}
+\renewcommand*{\precistocfont}{}
+\renewcommand*{\precistocformat}{}
+
+\renewcommand*{\setbeforesecskip}[1]{}
+\renewcommand*{\setaftersecskip}[1]{}
+\renewcommand*{\setsecindent}[1]{}
+\renewcommand*{\setsecheadstyle}[1]{}
+\renewcommand*{\setbeforesubsecskip}[1]{}
+\renewcommand*{\setaftersubsecskip}[1]{}
+\renewcommand*{\setsubsecindent}[1]{}
+\renewcommand*{\setsubsecheadstyle}[1]{}
+\renewcommand*{\setbeforesubsubsecskip}[1]{}
+\renewcommand*{\setaftersubsubsecskip}[1]{}
+\renewcommand*{\setsubsubsecindent}[1]{}
+\renewcommand*{\setsubsubsecheadstyle}[1]{}
+\renewcommand*{\setbeforeparaskip}[1]{}
+\renewcommand*{\setafterparaskip}[1]{}
+\renewcommand*{\setparaindent}[1]{}
+\renewcommand*{\setparaheadstyle}[1]{}
+\renewcommand*{\setbeforesubparaskip}[1]{}
+\renewcommand*{\setaftersubparaskip}[1]{}
+\renewcommand*{\setsubparaindent}[1]{}
+\renewcommand*{\setsubparaheadstyle}[1]{}
+\renewcommand{\@hangfrom}[1]{#1}
+\renewcommand{\sethangfrom}[1]{}
+\renewcommand{\setsecnumformat}[1]{}
+
+\renewcommand*{\hangsecnum}{}
+\renewcommand*{\defaultsecnum}{}
+
+\renewcommand*{\sechook}{}
+\renewcommand{\setsechook}[1]{}
+\renewcommand*{\subsechook}{}
+\renewcommand{\setsubsechook}[1]{}
+\renewcommand*{\subsubsechook}{}
+\renewcommand{\setsubsubsechook}[1]{}
+\renewcommand*{\parahook}{}
+\renewcommand{\setparahook}[1]{}
+\renewcommand*{\subparahook}{}
+\renewcommand{\setsubparahook}[1]{}
+
+\RenewDocumentCommand{\plainbreak}{s m}{\begin{center}~\end{center}}
+
+\RenewDocumentCommand{\fancybreak}{s +m}{%
+\begin{center}#2\end{center}%
+}
+
+\RenewDocumentCommand{\plainfancybreak}{s m m +m}{%
+\begin{center}#4\end{center}%
+}
+
+\RenewDocumentCommand{\pfbreak}{s}{%
+\begin{center}
+\pfbreakdisplay
+\end{center}
+}
+
+\renewcommand{\pfbreakdisplay}{*\quad*\quad*}
+
+\renewcommand{\makeheadstyles}[2]{}
+\renewcommand*{\headstyles}[1]{}
+\renewcommand*{\savepagenumber}{}
+\renewcommand*{\restorepagenumber}{}
+\renewcommand*{\uppercaseheads}{}
+\renewcommand*{\nouppercaseheads}{}
+
+\renewcommand*{\bookpagemark}[1]{}
+\renewcommand*{\partmark}[1]{}
+\renewcommand*{\bibmark}{}
+\renewcommand*{\indexmark}{}
+\renewcommand*{\glossarymark}{}
+
+\LWR at origpagestyle{empty}
+\renewcommand*{\ps at empty}{}
+\renewcommand*{\makepagestyle}[1]{}
+\renewcommand*{\emptypshook}{}%
+\renewcommand*{\@oddhead}{}
+\renewcommand*{\@oddfoot}{}
+\renewcommand*{\@evenhead}{}
+\renewcommand*{\@evenfoot}{}
+\renewcommand*{\aliaspagestyle}[2]{}
+\renewcommand*{\copypagestyle}[2]{}
+
+\renewcommand*{\makeevenhead}[4]{}
+\renewcommand*{\makeoddhead}[4]{}
+\renewcommand*{\makeevenfoot}[4]{}
+\renewcommand*{\makeoddfoot}[4]{}
+\renewcommand*{\makerunningwidth}[3]{}
+\renewcommand*{\makeheadrule}[3]{}
+\renewcommand*{\makefootrule}[3]{}
+\renewcommand*{\makeheadfootruleprefix}[3]{}
+\renewcommand*{\makeheadposition}[5]{}
+\renewcommand{\makepsmarks}[2]{}
+\renewcommand*{\makeheadfootstrut}[3]{}
+
+\renewcommand{\createplainmark}[3]{}
+\renewcommand{\memUChead}[1]{}
+\renewcommand{\createmark}[5]{}
+\renewcommand*{\clearplainmark}[1]{}
+\renewcommand*{\clearmark}[1]{}
+\renewcommand{\addtopsmarks}[3]{}
+\renewcommand{\ifonlyfloats}[2]{#2}
+\renewcommand*{\mergepagefloatstyle}[3]{}
+
+\renewcommand*{\framepichead}{}
+\renewcommand*{\framepictextfoot}{}
+\renewcommand*{\framepichook}{}
+\renewcommand*{\showheadfootlocoff}{}
+\renewcommand*{\showtextblocklocoff}{}
+\renewcommand{\hangfrom}[1]{#1}
+\let\centerfloat\centering
+\renewcommand*{\raggedyright}[1][]{}
+\renewcommand{\sourceatright}[2][]{\attribution{#2}}
+\let\memorigdbs\LWR at endofline
+\let\memorigpar\par
+\let\atcentercr\LWR at endofline
+\renewcommand*{\flushleftright}{}
+\renewcommand*{\linenottooshort}[1][]{}
+\renewcommand*{\russianpar}{}
+\renewcommand*{\lastlinerulefill}{}
+\renewcommand*{\lastlineparrule}{}
+\renewcommand*{\justlastraggedleft}{}
+\renewcommand*{\raggedrightthenleft}{}
+\renewcommand*{\leftcenterright}{}
+
+\renewcommand{\leftspringright}[4]{%
+\begin{minipage}{#1\linewidth}#3\end{minipage}\qquad%
+\begin{minipage}{#2\linewidth}\begin{flushright}#4\end{flushright}\end{minipage}%
+}
+
+\renewenvironment*{blockdescription}
+{\LWR at descriptionstart\LWR at origdescription}
+{\enddescription}
+\renewcommand*{\blockdescriptionlabel}[1]{\textbf{#1}}
+\renewenvironment*{labelled}[1]{\begin{description}}{\end{description}}
+\renewenvironment*{flexlabelled}[6]{\begin{description}}{\end{description}}
+\renewcommand*{\tightlists}{}
+\renewcommand*{\defaultlists}{}
+\RenewDocumentCommand{\firmlists}{s}{}
+\renewcommand*{\firmlist}{}
+\renewcommand*{\tightlist}{}
+\renewcommand*{\zerotrivseps}{}
+\renewcommand*{\savetrivseps}{}
+\renewcommand*{\restoretrivseps}{}
+\csletcs{tableofcontents*}{tableofcontents}
+\csletcs{listoffigures*}{listoffigures}
+\csletcs{listoftables*}{listoftables}
+\renewenvironment{KeepFromToc}{}{}
+\renewcommand*{\onecoltocetc}{}
+\renewcommand*{\twocoltocetc}{}
+\renewcommand*{\ensureonecol}{}
+\renewcommand*{\restorefromonecol}{}
+\renewcommand*{\doccoltocetc}{}
+\renewcommand*{\maxtocdepth}[1]{}% tocvsec2
+\renewcommand*{\settocdepth}[1]{}% tocvsec2
+
+\renewcommand{\tocheadstart}{}
+\renewcommand{\printtoctitle}[1]{}
+\renewcommand{\tocmark}{}
+\renewcommand{\aftertoctitle}{}
+\renewcommand{\lofheadstart}{}
+\renewcommand{\printloftitle}[1]{}
+\renewcommand{\lofmark}{}
+\renewcommand{\afterloftitle}{}
+\renewcommand{\lotheadstart}{}
+\renewcommand{\printlottitle}[1]{}
+\renewcommand{\lotmark}{}
+\renewcommand{\afterlottitle}{}
+
+\renewcommand*{\setpnumwidth}[1]{}
+\renewcommand*{\setrmarg}[1]{}
+\renewcommand*{\cftbookbreak}{}
+\renewcommand*{\cftpartbreak}{}
+\renewcommand*{\cftchapterbreak}{}
+
+\renewcommand*{\cftbookfont}{}
+\renewcommand*{\cftbookname}{}
+\renewcommand*{\cftbookpresnum}{}
+\renewcommand*{\cftbookaftersnum}{}
+\renewcommand*{\cftbookaftersnumb}{}
+\renewcommand*{\cftbookleader}{}
+\renewcommand*{\cftbookdotsep}{1}
+\renewcommand*{\cftbookpagefont}{}
+\renewcommand*{\cftbookafterpnum}{}
+\renewcommand*{\cftbookformatpnum}[1]{}
+\renewcommand*{\cftbookformatpnumhook}[1]{}
+\renewcommand*{\cftchapterfont}{}
+\renewcommand*{\cftchaptername}{}
+\renewcommand*{\cftchapterpresnum}{}
+\renewcommand*{\cftchapteraftersnum}{}
+\renewcommand*{\cftchapteraftersnumb}{}
+\renewcommand*{\cftchapterleader}{}
+\renewcommand*{\cftchapterdotsep}{1}
+\renewcommand*{\cftchapterpagefont}{}
+\renewcommand*{\cftchapterafterpnum}{}
+\renewcommand*{\cftchapterformatpnum}[1]{}
+\renewcommand*{\cftchapterformatpnumhook}[1]{}
+\renewcommand*{\cftsectionfont}{}
+\renewcommand*{\cftsectionname}{}
+\renewcommand*{\cftsectionpresnum}{}
+\renewcommand*{\cftsectionaftersnum}{}
+\renewcommand*{\cftsectionaftersnumb}{}
+\renewcommand*{\cftsectionleader}{}
+\renewcommand*{\cftsectiondotsep}{1}
+\renewcommand*{\cftsectionpagefont}{}
+\renewcommand*{\cftsectionafterpnum}{}
+\renewcommand*{\cftsectionformatpnum}[1]{}
+\renewcommand*{\cftsectionformatpnumhook}[1]{}
+
+\renewcommand*{\cftsubsectionfont}{}
+\renewcommand*{\cftsubsectionname}{}
+\renewcommand*{\cftsubsectionpresnum}{}
+\renewcommand*{\cftsubsectionaftersnum}{}
+\renewcommand*{\cftsubsectionaftersnumb}{}
+\renewcommand*{\cftsubsectionleader}{}
+\renewcommand*{\cftsubsectiondotsep}{1}
+\renewcommand*{\cftsubsectionpagefont}{}
+\renewcommand*{\cftsubsectionafterpnum}{}
+\renewcommand*{\cftsubsectionformatpnum}[1]{}
+\renewcommand*{\cftsubsectionformatpnumhook}[1]{}
+
+\renewcommand*{\cftsubsubsectionfont}{}
+\renewcommand*{\cftsubsubsectionname}{}
+\renewcommand*{\cftsubsubsectionpresnum}{}
+\renewcommand*{\cftsubsubsectionaftersnum}{}
+\renewcommand*{\cftsubsubsectionaftersnumb}{}
+\renewcommand*{\cftsubsubsectionleader}{}
+\renewcommand*{\cftsubsubsectiondotsep}{1}
+\renewcommand*{\cftsubsubsectionpagefont}{}
+\renewcommand*{\cftsubsubsectionafterpnum}{}
+\renewcommand*{\cftsubsubsectionformatpnum}[1]{}
+\renewcommand*{\cftsubsubsectionformatpnumhook}[1]{}
+
+\renewcommand*{\cftparagraphfont}{}
+\renewcommand*{\cftparagraphname}{}
+\renewcommand*{\cftparagraphpresnum}{}
+\renewcommand*{\cftparagraphaftersnum}{}
+\renewcommand*{\cftparagraphaftersnumb}{}
+\renewcommand*{\cftparagraphleader}{}
+\renewcommand*{\cftparagraphdotsep}{1}
+\renewcommand*{\cftparagraphpagefont}{}
+\renewcommand*{\cftparagraphafterpnum}{}
+\renewcommand*{\cftparagraphformatpnum}[1]{}
+\renewcommand*{\cftparagraphformatpnumhook}[1]{}
+
+\renewcommand*{\cftsubparagraphfont}{}
+\renewcommand*{\cftsubparagraphname}{}
+\renewcommand*{\cftsubparagraphpresnum}{}
+\renewcommand*{\cftsubparagraphaftersnum}{}
+\renewcommand*{\cftsubparagraphaftersnumb}{}
+\renewcommand*{\cftsubparagraphleader}{}
+\renewcommand*{\cftsubparagraphdotsep}{1}
+\renewcommand*{\cftsubparagraphpagefont}{}
+\renewcommand*{\cftsubparagraphafterpnum}{}
+\renewcommand*{\cftsubparagraphformatpnum}[1]{}
+\renewcommand*{\cftsubparagraphformatpnumhook}[1]{}
+
+\renewcommand*{\cftfigurefont}{}
+\renewcommand*{\cftfigurename}{}
+\renewcommand*{\cftfigurepresnum}{}
+\renewcommand*{\cftfigureaftersnum}{}
+\renewcommand*{\cftfigureaftersnumb}{}
+\renewcommand*{\cftfigureleader}{}
+\renewcommand*{\cftfiguredotsep}{1}
+\renewcommand*{\cftfigurepagefont}{}
+\renewcommand*{\cftfigureafterpnum}{}
+\renewcommand*{\cftfigureformatpnum}[1]{}
+\renewcommand*{\cftfigureformatpnumhook}[1]{}
+
+\newcommand*{\cftsubfigurefont}{}
+\newcommand*{\cftsubfigurename}{}
+\newcommand*{\cftsubfigurepresnum}{}
+\newcommand*{\cftsubfigureaftersnum}{}
+\newcommand*{\cftsubfigureaftersnumb}{}
+\newcommand*{\cftsubfigureleader}{}
+\newcommand*{\cftsubfiguredotsep}{1}
+\newcommand*{\cftsubfigurepagefont}{}
+\newcommand*{\cftsubfigureafterpnum}{}
+\newcommand*{\cftsubfigureformatpnum}[1]{}
+\newcommand*{\cftsubfigureformatpnumhook}[1]{}
+
+\renewcommand*{\cfttablefont}{}
+\renewcommand*{\cfttablename}{}
+\renewcommand*{\cfttablepresnum}{}
+\renewcommand*{\cfttableaftersnum}{}
+\renewcommand*{\cfttableaftersnumb}{}
+\renewcommand*{\cfttableleader}{}
+\renewcommand*{\cfttabledotsep}{1}
+\renewcommand*{\cfttablepagefont}{}
+\renewcommand*{\cfttableafterpnum}{}
+\renewcommand*{\cfttableformatpnum}[1]{}
+\renewcommand*{\cfttableformatpnumhook}[1]{}
+
+\newcommand*{\cftsubtablefont}{}
+\newcommand*{\cftsubtablename}{}
+\newcommand*{\cftsubtablepresnum}{}
+\newcommand*{\cftsubtableaftersnum}{}
+\newcommand*{\cftsubtableaftersnumb}{}
+\newcommand*{\cftsubtableleader}{}
+\newcommand*{\cftsubtabledotsep}{1}
+\newcommand*{\cftsubtablepagefont}{}
+\newcommand*{\cftsubtableafterpnum}{}
+\newcommand*{\cftsubtableformatpnum}[1]{}
+\newcommand*{\cftsubtableformatpnumhook}[1]{}
+\renewcommand*{\booknumberline}[1]{}
+\renewcommand*{\partnumberline}[1]{}
+\renewcommand*{\chapternumberline}[1]{}
+\renewcommand*{\numberlinehook}[1]{}
+\renewcommand*{\booknumberlinehook}[1]{}
+\renewcommand*{\partnumberlinehook}[1]{}
+\renewcommand*{\chapternumberlinehook}[1]{}
+\renewcommand{\numberlinebox}[2]{}
+\renewcommand{\booknumberlinebox}[2]{}
+\renewcommand{\partnumberlinebox}[2]{}
+\renewcommand{\chapternumberlinebox}[2]{}
+\renewcommand*{\cftpagenumbersoff}[1]{}
+\renewcommand*{\cftpagenumberson}[1]{}
+\renewcommand*{\cftlocalchange}[3]{}
+\renewcommand*{\cftaddtitleline}[4]{}
+\renewcommand*{\cftaddnumtitleline}[4]{}
+\renewcommand{\cftinsertcode}[2]{}
+\renewcommand{\cftinserthook}[2]{}
+\renewcommand{\settocpreprocessor}[2]{}
+\DeclareRobustCommand{\cftpagenumbersoff}[1]{}
+\DeclareRobustCommand{\cftpagenumberson}[1]{}
+\RenewDocumentCommand{\newfloat}{o m m m}{%
+\IfValueTF{#1}%
+{\DeclareFloatingEnvironment[fileext=#3,within=#1,name={#4}]{#2}}%
+{\DeclareFloatingEnvironment[fileext=#3,name={#4}]{#2}}%
+\cslet{listof#2s}\relax%
+\cslet{listof#2es}\relax%
+}
+\RenewDocumentCommand{\newlistof}{o m m m}
+{%
+\IfValueTF{#1}
+{\newlistentry[#1]{#2}{#3}{0}}
+{\newlistentry{#2}{#3}{0}}
+\@namedef{ext@#2}{#3}%
+\@ifundefined{c@#3depth}{\newcounter{#3depth}}{}%
+\setcounter{#3depth}{1}%
+\@namedef{#3mark}{}%
+\@namedef{#2}{\listof{#2}{#4}}
+\@namedef{@cftmake#3title}{}
+\@ifundefined{cftbefore#3titleskip}{
+    \expandafter\newlength\csname cftbefore#3titleskip\endcsname
+    \expandafter\newlength\csname cftafter#3titleskip\endcsname
+}{}
+\@namedef{cft#3titlefont}{}
+\@namedef{cftafter#3title}{}
+\@namedef{cft#3prehook}{}
+\@namedef{cft#3posthook}{}
+}
+\renewcommand{\setfloatadjustment}[2]{}
+\NewDocumentEnvironment{KFLTmemoir at marginfloat}{O{-1.2ex} m}
+{% start
+\LWR at BlockClassWP{float:right; width:2in; margin:10pt}{}{marginblock}%
+\captionsetup{type=#2}%
+}
+{%
+\endLWR at BlockClassWP%
+}
+
+\DeclareDocumentEnvironment{marginfigure}{o}
+  {\begin{KFLTmemoir at marginfloat}{figure}}
+  {\end{KFLTmemoir at marginfloat}}
+
+\DeclareDocumentEnvironment{margintable}{o}
+  {\begin{KFLTmemoir at marginfloat}{table}}
+  {\end{KFLTmemoir at marginfloat}}
+\renewcommand{\setmarginfloatcaptionadjustment}[2]{}
+\renewcommand{\setmpjustification}[2]{}
+\renewcommand*{\mpjustification}{}
+\renewcommand*{\setfloatlocations}[2]{}
+\DeclareDocumentCommand{\suppressfloats}{o}{}
+\renewcommand*{\FloatBlock}{}
+\renewcommand*{\FloatBlockAllowAbove}{}
+\renewcommand*{\FloatBlockAllowBelow}{}
+\renewcommand*{\setFloatBlockFor}{}
+\renewcommand*{\captiondelim}[1]{\renewcommand*{\CaptionSeparator}{#1}}
+\renewcommand*{\captionnamefont}[1]{}
+\renewcommand*{\captiontitlefont}[1]{}
+\renewcommand*{\captionstyle}[2][]{}
+\renewcommand*{\centerlastline}{}
+\renewcommand*{\hangcaption}{}
+\renewcommand*{\indentcaption}[1]{}
+\renewcommand*{\normalcaption}{}
+\renewcommand*{\changecaptionwidth}{}
+\DeclareDocumentCommand{\captionwidth}{m}{}
+\renewcommand*{\normalcaptionwidth}{}
+\renewcommand{\precaption}[1]{}
+\renewcommand{\captiontitlefinal}[1]{}
+\renewcommand{\postcaption}[1]{}
+
+\renewcommand{\contcaption}[1]{%
+\begin{LWR at figcaption}% later becomes \caption*
+\csuse{\@captype name} \thechapter.\the\value{\@captype}\CaptionSeparator #1
+\end{LWR at figcaption}
+}
+\renewcommand{\legend}[1]{\begin{center}#1\\\end{center}}
+
+\renewcommand{\namedlegend}[2][]{
+\begin{center}
+\csuse{fleg\@captype}\CaptionSeparator#2\\
+\end{center}
+\csuse{flegtoc\@captype}{#1}
+}
+
+\renewcommand{\flegtable}{\tablename}
+\renewcommand{\flegfigure}{\figurename}
+\renewcommand{\flegtoctable}{}
+\renewcommand{\flegtocfigure}{}
+
+\renewcommand{\newfixedcaption}[3][\caption]{%
+  \renewcommand{#2}{\def\@captype{#3}#1}}
+\renewcommand{\renewfixedcaption}[3][\caption]{%
+  \renewcommand{#2}{\def\@captype{#3}#1}}
+\renewcommand{\providefixedcaption}[3][\caption]{%
+  \providecommand{#2}{\def\@captype{#3}#1}}
+
+\renewcommand{\bitwonumcaption}[6][]{%
+\ifblank{#2}{\caption{#3}}{\caption[#2]{#3}}%
+\addtocounter{\@captype}{-1}%
+\begingroup%
+\csdef{\@captype name}{#4}%
+\ifblank{#5}{\caption{#6}}{\caption[#5]{#6}}%
+\endgroup%
+\ifblank{#1}{}{\label{#1}}%
+}
+
+\LetLtxMacro\bionenumcaption\bitwonumcaption% todo
+
+\renewcommand{\bicaption}[5][]{%
+\ifblank{#2}{\caption{#3}}{\caption[#2]{#3}}%
+\begin{LWR at figcaption}% later becomes \caption*
+#4 \thechapter.\the\value{\@captype}\CaptionSeparator #5
+\end{LWR at figcaption}
+\ifblank{#1}{}{\label{#1}}%
+}
+
+\renewcommand{\bicontcaption}[3]{%
+\contcaption{#1}%
+\begingroup%
+\csdef{\@captype name}{#2}%
+\contcaption{#3}%
+\endgroup%
+}
+
+\renewcommand{\midbicaption}[1]{}
+
+\renewcommand{\subcaption}[2][]{%
+\ifblank{#1}{\subfloat[#2]{}}{\subfloat[#1][#2]{}}%
+}
+
+\RenewDocumentCommand{\subtop}{O{} O{} m}{%
+\subfloat[#1][#2]{#3}%
+}
+
+\RenewDocumentCommand{\subbottom}{O{} O{} m}{%
+\subfloat[#1][#2]{#3}%
+}
+
+\renewcommand{\contsubcaption}{\ContinuedFloat\subcaption}
+
+\renewcommand{\contsubtop}{%
+\ContinuedFloat\addtocounter{\@captype}{1}%
+\subtop}
+
+\renewcommand{\contsubbottom}{%
+\ContinuedFloat\addtocounter{\@captype}{1}%
+\subbottom}
+
+\renewcommand{\subconcluded}{}
+
+\LetLtxMacro\subcaptionref\subref
+
+\renewcommand*{\tightsubcaptions}{}
+\renewcommand*{\loosesubcaptions}{}
+
+\renewcommand*{\subcaptionsize}[1]{}
+\renewcommand*{\subcaptionlabelfont}[1]{}
+\renewcommand*{\subcaptionfont}[1]{}
+\renewcommand*{\subcaptionstyle}[1]{}
+
+\renewcommand*{\hangsubcaption}{}
+\renewcommand*{\shortsubcaption}{}
+\renewcommand*{\normalsubcaption}{}
+
+\RenewDocumentEnvironment{sidecaption}{o m o}
+{}
+{
+\IfValueTF{#1}{\caption[#1]{#2}}{\caption{#2}}%
+\IfValueT{#3}{\label{#3}}%
+}
+
+\renewcommand*{\setsidecaps}[2]{}
+\renewcommand*{\sidecapmargin}[1]{}
+\scapmargleftfalse
+\renewcommand*{\setsidecappos}[1]{}
+
+\RenewDocumentEnvironment{sidecontcaption}{m o}
+{}
+{%
+\ContinuedFloat%
+\caption{#1}%
+\IfValueT{#2}{\label[\@captype]{#2}}%
+}
+\renewenvironment{sidenamedlegend}[2][]{
+\begin{center}
+\csuse{\@captype name}\CaptionSeparator#2
+\end{center}
+}
+{}
+
+\renewenvironment{sidelegend}[1]
+{\begin{center}
+#1
+
+}
+{\end{center}}
+
+\renewcommand*{\sidecapstyle}{}
+\renewcommand*{\overridescapmargin}[1]{}
+\renewcommand*{\sidecapfloatwidth}{\linewidth}
+
+\LetLtxMacro\ctabular\tabular
+\LetLtxMacro\endctabular\endtabular
+
+\renewcommand{\autorows}[5][]{%
+#5
+}
+
+\renewcommand{\autocols}[5][]{%
+#5
+}
+\renewcommand*{\feetabovefloat}{}
+\renewcommand*{\feetbelowfloat}{}
+\renewcommand*{\feetatbottom}{}
+
+\renewcommand*{\verbfootnote}[2][]{
+\PackageError{lwarp,memoir}
+{Verbatim footnotes are not yet supported by lwarp.}
+{This may be improved some day.}
+}
+
+\renewcommand*{\plainfootnotes}{}
+\renewcommand*{\twocolumnfootnotes}{}
+\renewcommand*{\threecolumnfootnotes}{}
+\renewcommand*{\paragraphfootnotes}{}
+\renewcommand*{\footfudgefiddle}{}
+
+\renewcommand*{\newfootnoteseries}[1]{
+\PackageError{lwarp,memoir}
+{Memoir footnote series are not yet supported by lwarp.}
+{This may be improved some day.}
+}
+
+\renewcommand*{\plainfootstyle}[1]{}
+\renewcommand*{\twocolumnfootstyle}[1]{}
+\renewcommand*{\threecolumnfootstyle}[1]{}
+\renewcommand*{\paragraphfootstyle}[1]{}
+
+\renewcommand*{\footfootmark}{}
+\renewcommand*{\footmarkstyle}[1]{}
+
+
+\renewcommand*{\foottextfont}{}
+
+\renewcommand*{\marginparmargin}[1]{}
+\renewcommand*{\sideparmargin}[1]{}
+
+\LetLtxMacro\sidepar\marginpar
+\renewcommand*{\sideparfont}{}
+\renewcommand*{\sideparform}{}
+\LWR at providelength{\sideparvshift}
+
+\renewcommand*{\parnopar}{}
+
+\renewcommand{\sidebar}[1]{\begin{quote}#1\end{quote}}
+\renewcommand*{\sidebarmargin}[1]{}
+\renewcommand*{\sidebarfont}{}
+\renewcommand*{\sidebarform}{}
+\renewcommand{\setsidebarheight}[1]{}
+\renewcommand*{\setsidebars}[6]{}
+\renewcommand*{\footnotesatfoot}{}
+\renewcommand*{\footnotesinmargin}{}
+
+\LetLtxMacro\sidefootnote\footnote
+\LetLtxMacro\sidefootnotemark\footnotemark
+\LetLtxMacro\sidefootnotetext\footnotetext
+
+\renewcommand*{\sidefootmargin}[1]{}
+\renewcommand*{\setsidefootheight}[1]{}
+\renewcommand*{\setsidefeet}[6]{}
+\renewcommand*{\sidefootmarkstyle}[1]{}
+\renewcommand*{\sidefoottextfont}{}
+\renewcommand*{\sidefootform}{}
+
+\renewcommand*{\continuousnotenums}{\pncontopttrue}% from pagenote
+\renewcommand*{\notepageref}{}
+\renewcommand*{\prenotetext}{}
+\renewcommand*{\postnotetext}{}
+\renewcommand*{\idtextinnotes}[1]{}
+\renewcommand*{\printpageinnotes}[1]{}
+\renewcommand*{\printpageinnoteshyperref}[1]{}
+\renewcommand*{\foottopagenote}{}
+\renewcommand*{\pagetofootnote}{}
+\renewcommand*{\epigraphposition}[1]{}
+\renewcommand*{\epigraphtextposition}[1]{}
+\renewcommand*{\epigraphsourceposition}[1]{}
+\renewcommand*{\epigraphfontsize}[1]{}
+\renewcommand*{\epigraphforheader}[2][]{}
+\renewcommand*{\epigraphpicture}{}
+\renewcommand*{\vinphantom}{}
+\renewcommand*{\vleftofline}[1]{#1}
+
+\DeclareDocumentCommand{\PoemTitle}{s o o m}{%
+\IfValueTF{#2}%
+{\poemtitle[#2]{#4}}%
+{\poemtitle{#4}}%
+}
+
+\renewcommand*{\NumberPoemTitle}{}
+\renewcommand*{\PlainPoemTitle}{}
+\renewcommand*{\poemtitlepstyle}{}
+\renewcommand*{\poemtitlestarmark}[1]{}
+\renewcommand*{\poemtitlestarpstyle}{}
+\renewcommand*{\PoemTitleheadstart}{}
+\renewcommand*{\printPoemTitlenonum}{}
+\renewcommand*{\printPoemTitlenum}{}
+\renewcommand*{\afterPoemTitlenum}{}
+\renewcommand*{\printPoemTitletitle}[1]{}
+\renewcommand*{\afterPoemTitle}{}
+\newlength{\midpoemtitleskip}
+\renewcommand*{\PoemTitlenumfont}{}
+\renewcommand*{\PoemTitlefont}{}
+\renewenvironment{qframe}{\framed}{\endframed}
+\renewenvironment{qshade}{\shaded}{\endshaded}
+\renewcommand*{\commentsoff}[1]{\includecomment{#1}}
+\renewcommand*{\commentson}[1]{\excludecomment{#1}}
+\LetLtxMacro\renewcomment\commentson
+
+\renewcommand*{\setverbatimfont}[1]{}
+\renewcommand*{\tabson}[1]{}
+\renewcommand*{\tabsoff}{}
+\renewcommand*{\wrappingon}{}
+\renewcommand*{\wrappingoff}{}
+\renewcommand*{\verbatimindent}{}
+\renewcommand*{\verbatimbreakchar}[1]{}
+\DefineVerbatimEnvironment{fboxverbatim}{Verbatim}{frame=single}
+\renewcommand*{\bvbox}{}
+\renewcommand*{\bvtopandtail}{}
+\renewcommand*{\bvsides}{}
+\renewcommand*{\nobvbox}{}
+\renewcommand*{\bvtoprulehook}{}
+\renewcommand*{\bvtopmidhook}{}
+\renewcommand*{\bvendrulehook}{}
+\renewcommand*{\bvleftsidehook}{}
+\renewcommand*{\bvrightsidehook}{}
+\renewcommand*{\bvperpagetrue}{}
+\renewcommand*{\bvperpagefalse}{}
+\renewcommand{\bvtopofpage}[1]{}
+\renewcommand{\bvendofpage}[1]{}
+\renewcommand*{\linenumberfrequency}[1]{}
+\renewcommand*{\resetbvlinenumber}{}
+\renewcommand*{\setbvlinenums}[2]{}
+\renewcommand*{\linenumberfont}[1]{}
+\renewcommand*{\bvnumbersinside}{}
+\renewcommand*{\bvnumbersoutside}{}
+\renewcommand*{\fref}[1]{\cref{#1}}
+\renewcommand*{\tref}[1]{\cref{#1}}
+\renewcommand*{\pref}[1]{\cpageref{#1}}
+\renewcommand*{\Aref}[1]{\cref{#1}}
+\renewcommand*{\Bref}[1]{\cref{#1}}
+\renewcommand*{\Pref}[1]{\cref{#1}}
+\renewcommand*{\Sref}[1]{\cref{#1}}
+\renewcommand*{\figurerefname}{Figure}
+\renewcommand*{\tablerefname}{Table}
+\renewcommand*{\pagerefname}{page}
+\renewcommand*{\bookrefname}{Book~}
+\renewcommand*{\partrefname}{Part~}
+\renewcommand*{\chapterrefname}{Chapter~}
+\renewcommand*{\sectionrefname}{\S}
+\renewcommand*{\appendixrefname}{Appendix~}
+\LetLtxMacro\titleref\nameref
+\renewcommand*{\headnameref}{}
+\renewcommand*{\tocnameref}{}
+
+\providecounter{LWR at currenttitle}
+
+\renewcommand*{\currenttitle}{%
+    \addtocounter{LWR at currenttitle}{1}%
+    \label{currenttitle\arabic{LWR at currenttitle}}%
+    \nameref{currenttitle\arabic{LWR at currenttitle}}%
+}
+
+\renewcommand*{\theTitleReference}[2]{}
+\renewcommand*{\namerefon}{}
+\renewcommand*{\namerefoff}{}
+\DeclareDocumentCommand{\newblock}{}{}
+\renewcommand*{\showindexmarks}{}
+\renewcommand*{\hideindexmarks}{}
+
+\renewcommand*{\xindyindex}{}
+\renewcommand*{\changemarks}{}
+\renewcommand*{\nochangemarks}{}
+\renewcommand*{\added}[1]{}
+\renewcommand*{\deleted}[1]{}
+\renewcommand*{\changed}[1]{}
+
+\renewcommand*{\showtrimsoff}{}
+\renewcommand*{\showtrimson}{}
+\renewcommand*{\trimXmarks}{}
+\renewcommand*{\trimLmarks}{}
+\renewcommand*{\trimFrame}{}
+\renewcommand*{\trimNone}{}
+\renewcommand*\trimmarkscolor{}
+\renewcommand*{\trimmarks}{}
+\renewcommand*{\tmarktl}{}
+\renewcommand*{\tmarktr}{}
+\renewcommand*{\tmarkbr}{}
+\renewcommand*{\tmarkbl}{}
+\renewcommand*{\tmarktm}{}
+\renewcommand*{\tmarkmr}{}
+\renewcommand*{\tmarkbm}{}
+\renewcommand*{\tmarkml}{}
+\renewcommand*{\trimmark}{}
+\renewcommand*{\quarkmarks}{}
+\renewcommand*{\registrationColour}[1]{}
+
+\renewcommand*{\leavespergathering}[1]{}
+
+\renewcommand*{\noprelistbreak}{}
+
+\renewcommand*{\cleartorecto}{}
+\renewcommand*{\cleartoverso}{}
+
+\renewenvironment{vplace}[1][]{}{}
+\newlistof{tableofcontents}{toc}{\contentsname}
+\newlistof{listoffigures}{lof}{\listfigurename}
+\newlistof{listoftables}{lot}{\listtablename}
+\endinput
+%%
+%% End of file `lwarp-patch-memoir.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-memoir.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-prettyref.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-prettyref.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-prettyref.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,26 @@
+%%
+%% This is file `lwarp-prettyref.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `prettyref')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\LWR at ProvidesPackagePass{prettyref}
+
+\newrefformat{fig}{Figure \ref{#1}}
+\newrefformat{tab}{Table \ref{#1}}
+
+\endinput
+%%
+%% End of file `lwarp-prettyref.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-prettyref.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-rotfloat.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-rotfloat.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-rotfloat.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -21,19 +21,19 @@
 
 \RequirePackage{float}
 \RenewDocumentCommand{\newfloat}{m m m o}{%
-\IfValueTF{#4}
-{
-    \DeclareFloatingEnvironment[fileext=#3,within=#4]{#1}
+\IfValueTF{#4}%
+{%
+    \DeclareFloatingEnvironment[fileext=#3,within=#4]{#1}%
+}%
+{%
+    \DeclareFloatingEnvironment[fileext=#3]{#1}%
+    \DeclareFloatingEnvironment[fileext=#3]{sideways#1}%
+}%
+\csletcs{sideways#1}{#1}%
+\csletcs{endsideways#1}{end#1}%
+\cslet{listof#1s}\relax%
+\cslet{listof#1es}\relax%
 }
-{
-    \DeclareFloatingEnvironment[fileext=#3]{#1}
-    \DeclareFloatingEnvironment[fileext=#3]{sideways#1}
-}
-\csletcs{sideways#1}{#1}
-\csletcs{endsideways#1}{end#1}
-\cslet{listof#1s}\relax
-\cslet{listof#1es}\relax
-}
 \endinput
 %%
 %% End of file `lwarp-rotfloat.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfig.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfig.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfig.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -46,24 +46,19 @@
          \ifdim\dimen@>\FBso at max
            \global\FBso at max\dimen@
          \fi}%
-    \vtop\bgroup
-      \vbox\bgroup
+    \bgroup
+      \bgroup
         \ifcase\@tempcnta
           \@minipagefalse
         \or
-          \vskip\sf at top
         \or
           \ifdim \lastskip=\z@ \else
-            \@tempskipb\sf at top\relax\@xaddvskip
           \fi
         \fi
         \sf at ifpositiontop{%
           \ifx \@empty#3\relax \else
             \sf at subcaption{#1}{#2}{#3}%
-            \vskip\sf at capskip
-            \vskip\sf at captopadj
           \fi\egroup
-          \hrule width0pt height0pt depth0pt
             \LWR at startpars% new
             #4
             \LWR at stoppars% new
@@ -81,12 +76,9 @@
         \LWR at stoppars% new
           \egroup
           \ifx \@empty#3\relax \else
-            \vskip\sf at capskip
-            \hrule width0pt height0pt depth0pt
             \sf at subcaption{#1}{#2}{#3}%
          \fi
         }%
-      \vskip\sf at bottom
     \egroup
     \@ifundefined{FBsc at max}{}%
         {\addtocounter{FRobj}{-1}%
@@ -124,7 +116,7 @@
                 {\@nameuse{sub\@captype name}}%
                 {\@nameuse{thesub\@captype}}%
                 {#3}
-            \LWR at figcaption% new
+            \endLWR at figcaption% new
 \LWR at traceinfo{sfsubcap B2}% new
         }%
         {\dimen@\ht0%
@@ -140,7 +132,6 @@
            \def\next{
             }%
          \fi
-         \vbox{%
 
 \LWR at traceinfo{sfsubcap C1}% new
                \caption at make
@@ -149,7 +140,6 @@
                    {#3}
 \LWR at traceinfo{sfsubcap C1}% new
 
-          }
         }%
   \egroup
 \LWR at startpars% new
@@ -165,7 +155,7 @@
     \let\caption at lsep\@empty
     \let\caption at tfmt\@firstofone
   }%
-\renewcommand{\@@par}{\LWR at closeparagraph\LWR at orig@@par}% new
+    \renewcommand{\@@par}{\LWR at closeparagraph\LWR at orig@@par}% new
   \caption at applyfont
   \caption at fmt
     {\ifcaption at star\else
@@ -194,6 +184,13 @@
 \LWR at stoppars% new
 }
 
+\renewcommand{\caption@@make@}[2]{%
+  \caption at stepthecounter
+  \caption at beginhook
+      \caption@@@make{#1}{#2}%
+  \caption at endhook
+}
+
 \def\subfloat at label{%
 \LWR at ensuredoingapar% new
   \@ifnextchar(%   %) match left parenthesis
@@ -211,11 +208,10 @@
 
 \def\@newsubfloat[#1]#2{%
 \LWR at orig@newsubfloat[#1]{#2}%
-\renewcommand{\l at sub#2}[2]{\hypertocfloat{2}{sub#2}{\ext at sub#2}{##1}{##2}}
+\renewcommand{\l at sub#2}[2]{\hypertocfloat{2}{sub#2}{\ext at sub#2}{##1}{##2}}%
 }
 \renewcommand{\l at subfigure}[2]{\hypertocfloat{2}{subfigure}{lof}{#1}{#2}}
 \renewcommand{\l at subtable}[2]{\hypertocfloat{2}{subtable}{lot}{#1}{#2}}
-
 \endinput
 %%
 %% End of file `lwarp-subfig.sty'.

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfigure.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfigure.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfigure.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,41 @@
+%%
+%% This is file `lwarp-subfigure.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `subfigure')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{subfigure}
+\RequirePackage{subfig}
+\LetLtxMacro\subfigure\subfloat
+\LetLtxMacro\subtable\subfloat
+\LetLtxMacro\Subref\subref
+\@ifundefined{figuretopcaptrue}{\newif\iffiguretopcap}{}
+\newif\ifsubfiguretopcap
+\newif\ifsubcaphang
+\newif\ifsubcapcenter
+\newif\ifsubcapcenterlast
+\newif\ifsubcapnooneline
+\newif\ifsubcapraggedright
+\newskip\subfigtopskip
+\newskip\subfigcapskip
+\newdimen\subfigcaptopadj
+\newskip\subfigbottomskip
+\newdimen\subfigcapmargin
+\newskip\subfiglabelskip
+\newcommand*{\subcapsize}{}
+\newcommand*{\subcaplabelfont}{}
+\newcommand*{\subcapfont}{}
+\endinput
+%%
+%% End of file `lwarp-subfigure.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfigure.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-supertabular.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-supertabular.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-supertabular.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -45,15 +45,15 @@
 \newcommand*{\shrinkheight}[1]{}
 
 \NewDocumentEnvironment{supertabular}{s o m}
-{
-\LWR at traceinfo{supertabular}
-\table
-\LWRST at caption
-\begin{tabular}{#3}
+{%
+\LWR at traceinfo{supertabular}%
+\table%
+\LWRST at caption%
+\begin{tabular}{#3}%
 \TabularMacro\ifdefvoid{\LWRST at firsthead}%
 {\LWR at getmynexttoken}%
 {\expandafter\LWR at getmynexttoken\LWRST at firsthead}%
-}
+}%
 {%
 \ifdefvoid{\LWRST at lasttail}%
 {}%
@@ -61,9 +61,9 @@
 \TabularMacro\ResumeTabular%
 \LWRST at lasttail%
 }%
-\end{tabular}
-\endtable
-\LWR at traceinfo{supertabular done}
+\end{tabular}%
+\endtable%
+\LWR at traceinfo{supertabular done}%
 }
 
 \NewDocumentEnvironment{mpsupertabular}{s o m}

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tabularx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tabularx.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tabularx.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -19,11 +19,11 @@
 
 \LWR at ProvidesPackageDrop{tabularx}
 
-\NewDocumentEnvironment{tabularx}{m o m}
+\DeclareDocumentEnvironment{tabularx}{m o m}
 {\tabular{#3}}
 {\endtabular}
 
-\NewDocumentEnvironment{tabularx*}{m o m}
+\DeclareDocumentEnvironment{tabularx*}{m o m}
 {\tabular{#3}}
 {\endtabular}
 

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-textfit.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-textfit.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-textfit.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,43 @@
+%%
+%% This is file `lwarp-textfit.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `textfit')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{textfit}
+\newsavebox{\LWR at textfitbox}
+
+\newcommand*{\LWR at textfitscale}[2]{%
+\uselengthunit{PT}%
+\setlength{\LWR at templengthone}{#1}%
+\setlength{\LWR at templengthone}{%
+    1em*\ratio{\LWR at templengthone}{\LWR at templengthtwo}%
+}%
+\InlineClass[font-size:\rndprintlength{\LWR at templengthone}]{textfit}{#2}%
+}
+
+\newcommand*{\scaletowidth}[2]{%
+\sbox{\LWR at textfitbox}{#2}%
+\settowidth{\LWR at templengthtwo}{\usebox{\LWR at textfitbox}}%
+\LWR at textfitscale{#1}{#2}%
+}
+
+\newcommand*{\scaletoheight}[2]{%
+\sbox{\LWR at textfitbox}{#2}%
+\settoheight{\LWR at templengthtwo}{\usebox{\LWR at textfitbox}}%
+\LWR at textfitscale{#1}{#2}%
+}
+\endinput
+%%
+%% End of file `lwarp-textfit.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-textfit.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-theorem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-theorem.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-theorem.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -81,98 +81,99 @@
     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% new
     }%
   \fi}
-\gdef\th at plain{%\normalfont\itshape
+\gdef\th at plain{%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-        \item[\hskip\labelsep
+        \item[
             \InlineClass{theoremheader}{##1\ ##2}
-        ]}%
+        ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-   \item[\hskip\labelsep
+   \item[
         \InlineClass{theoremheader}{##1\ ##2\ (##3)}
-    ]}
+    ]
+    }
 }
 
-\gdef\th at break{%\normalfont\slshape
+\gdef\th at break{%
   \def\@begintheorem##1##2{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip \labelsep
+    \item[
         \InlineClass{theoremheader}{##1\ ##2}\newline%
-    ]}%
+    ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-  \item[\hskip \labelsep
+  \item[
         \InlineClass{theoremheader}{##1\ ##2\ (##3)}\newline
-    ]}
+    ]
+    }
 }
 
-\gdef\th at marginbreak{%\normalfont\slshape
+\gdef\th at marginbreak{%
   \def\@begintheorem##1##2{
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep %
+    \item[
         \InlineClass{theoremheader}{##2 \qquad ##1}\newline
-    ]}%
+    ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep %
+    \item[
         \InlineClass{theoremheader}{##2 \qquad ##1\ %
         (##3)}\newline
-    ]}
+    ]
+    }
 }
 
-\gdef\th at changebreak{%\normalfont\slshape
+\gdef\th at changebreak{%
   \def\@begintheorem##1##2{
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
         \InlineClass{theoremheader}{##2\ ##1}\newline
-    ]}%
+    ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
         \InlineClass{theoremheader}{ ##2\ ##1\ %
         (##3)}\newline
-    ]}
+    ]
+    }
 }
 
-\gdef\th at change{%\normalfont\slshape
+\gdef\th at change{%
   \def\@begintheorem##1##2{
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
         \InlineClass{theoremheader}{##2\ ##1}
-    ]}%
+    ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
         \InlineClass{theoremheader}{##2\ ##1\ (##3)}
-    ]}
+    ]
+    }
 }
 
-\gdef\th at margin{%\normalfont\slshape
+\gdef\th at margin{%
   \def\@begintheorem##1##2{
-\LWR at forcenewpage% new
-    \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
+    \item[
         \InlineClass{theoremheader}{##2 \qquad ##1}
-    ]}%
+    ]
+    }%
 \def\@opargbegintheorem##1##2##3{%
+    \item[
+            \InlineClass{theoremheader}{##2 \qquad ##1\ (##3)}
+    ]
+    }
+}
+\gdef\@thm#1#2{\refstepcounter{#1}%
 \LWR at forcenewpage% new
     \BlockClass{theorembody\LWR at thisthmstyle}% new
-    \item[\hskip\labelsep
-            \InlineClass{theoremheader}{##2 \qquad ##1\ (##3)}
-    ]}
+   \trivlist
+   \@topsep \theorempreskipamount               % used by first \item
+   \@topsepadd \theorempostskipamount           % used by \@endparenv
+   \@ifnextchar [%
+   {\@ythm{#1}{#2}}%
+   {\@begintheorem{#2}{\csname the#1\endcsname}\ignorespaces}}
+
+\gdef\@endtheorem{%
+\endtrivlist
+\endBlockClass
 }
-\gdef\@endtheorem{\endBlockClass\endtrivlist}
 \endinput
 %%
 %% End of file `lwarp-theorem.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -19,8 +19,6 @@
 \LWR at ProvidesPackagePass{tikz}
 
 
-\begin{warpHTML}
-
 \newboolean{LWR at tikzbabel}
 
 \@ifpackagelater{tikz}{2013/12/20}% Test for Tikz version v3.0.0
@@ -41,8 +39,6 @@
 {\catcode`\$=\active}%
 }
 
-\end{warpHTML}
-
 \endinput
 %%
 %% End of file `lwarp-tikz.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-titleref.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-titleref.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-titleref.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -15,7 +15,19 @@
 %%   http://www.latex-project.org/lppl.txt
 %% and version 1.3 or later is part of all distributions of LaTeX
 %% version 2005/12/01 or later.
-\LWR at loadnever{titleref}{hyperref and nameref}
+\LWR at ProvidesPackageDrop{titleref}
+
+\LetLtxMacro\titleref\nameref
+
+\providecounter{LWR at currenttitle}
+
+\newcommand*{\currenttitle}{%
+    \addtocounter{LWR at currenttitle}{1}%
+    \label{currenttitle\arabic{LWR at currenttitle}}%
+    \nameref{currenttitle\arabic{LWR at currenttitle}}%
+}
+
+\newcommand*{\theTitleReference}[2]{}
 \endinput
 %%
 %% End of file `lwarp-titleref.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-titling.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-titling.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-titling.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -53,7 +53,7 @@
 \renewcommand*{\LWR at maketitlesetup}{%
 \def\@makefnmark{\textsuperscript{\@thefnmark}}
 \long\def\@makefntext##1{%
-\makethanksmark \LWR at orighspace{1in}
+\makethanksmark~%
 ##1%
 }%
 }
@@ -104,11 +104,15 @@
 \renewcommand{\thanksmarkseries}[1]{%
 \def\@bsmarkseries{\renewcommand{\thefootnote}{\@nameuse{#1}{footnote}}}%
 }
+\@ifclassloaded{memoir}{
+   \thanksmarkseries{arabic}
+}{% not memoir
 \if at titlepage
    \thanksmarkseries{arabic}
 \else
    \thanksmarkseries{fnsymbol}
 \fi
+}% not memoir
 \endinput
 %%
 %% End of file `lwarp-titling.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tocbibind.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tocbibind.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tocbibind.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -49,13 +49,13 @@
 \let\subitem\LWR at indexsubitem%
 \let\subsubitem\LWR at indexsubsubitem%
 }{}
-\renewcommand{\simplechapter}[1][\@empty]{%
+\DeclareDocumentCommand{\simplechapter}{O{\@empty}}{%
     \def\@chapcntformat##1{%
         #1~\csname the##1\endcsname\simplechapterdelim\protect\quad%
     }%
 }
 
-\renewcommand{\restorechapter}{%
+\DeclareDocumentCommand{\restorechapter}{}{%
 \let\@chapcntformat\@seccntformat%
 }
 \endinput

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tocloft.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tocloft.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tocloft.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -49,37 +49,36 @@
 \newlength{\cftbeforelottitleskip}
 \newlength{\cftafterlottitleskip}
 
-\newcommand*{\cftdot}{.}
+\providecommand*{\cftdot}{.}
 
 \providecommand*{\cftdotsep}{1}
 
-\newcommand*{\cftnodots}{5000}
+\providecommand*{\cftnodots}{5000}
 
 \providecommand{\cftdotfill}[1]{}
 
-\newcommand*{\cftsetpnumwidth}[1]{}
+\DeclareDocumentCommand{\cftsetpnumwidth}{m}{}
 
-\newcommand*{\cftsetrmarg}[1]{}
+\DeclareDocumentCommand{\cftsetrmarg}{m}{}
 
-\newcommand*{\cftpnumalign}[1]{}
+\DeclareDocumentCommand{\cftpnumalign}{m}{}
 
-\newlength{\cftparskip}
+\LWR at providelength{\cftparskip}
 
-\newlength{\cftbeforepartskip}
-\newlength{\cftpartindent}
-\newlength{\cftpartnumwidth}
-\newcommand*{\cftpartfont}{}
-\newcommand*{\cftpartpresnum}{}
-\newcommand*{\cftpartaftersnum}{}
-\newcommand*{\cftpartaftersnumb}{}
-\newcommand*{\cftpartleader}{}
-\newcommand*{\cftpartdotsep}{1}
-\newcommand*{\cftpartpagefont}{}
-\newcommand*{\cftpartafterpnum}{}
-
-\newlength{\cftbeforechapskip}
-\newlength{\cftchapindent}
-\newlength{\cftchapnumwidth}
+\LWR at providelength{\cftbeforepartskip}
+\LWR at providelength{\cftpartindent}
+\LWR at providelength{\cftpartnumwidth}
+\providecommand*{\cftpartfont}{}
+\providecommand*{\cftpartpresnum}{}
+\providecommand*{\cftpartaftersnum}{}
+\providecommand*{\cftpartaftersnumb}{}
+\providecommand*{\cftpartleader}{}
+\providecommand*{\cftpartdotsep}{1}
+\providecommand*{\cftpartpagefont}{}
+\providecommand*{\cftpartafterpnum}{}
+\LWR at providelength{\cftbeforechapskip}
+\LWR at providelength{\cftchapindent}
+\LWR at providelength{\cftchapnumwidth}
 \newcommand*{\cftchapfont}{}
 \newcommand*{\cftchappresnum}{}
 \newcommand*{\cftchapaftersnum}{}
@@ -88,10 +87,9 @@
 \newcommand*{\cftchapdotsep}{1}
 \newcommand*{\cftchappagefont}{}
 \newcommand*{\cftchapafterpnum}{}
-
-\newlength{\cftbeforesecskip}
-\newlength{\cftsecindent}
-\newlength{\cftsecnumwidth}
+\LWR at providelength{\cftbeforesecskip}
+\LWR at providelength{\cftsecindent}
+\LWR at providelength{\cftsecnumwidth}
 \newcommand*{\cftsecfont}{}
 \newcommand*{\cftsecpresnum}{}
 \newcommand*{\cftsecaftersnum}{}
@@ -101,9 +99,9 @@
 \newcommand*{\cftsecpagefont}{}
 \newcommand*{\cftsecafterpnum}{}
 
-\newlength{\cftbeforesubsecskip}
-\newlength{\cftsubsecindent}
-\newlength{\cftsubsecnumwidth}
+\LWR at providelength{\cftbeforesubsecskip}
+\LWR at providelength{\cftsubsecindent}
+\LWR at providelength{\cftsubsecnumwidth}
 \newcommand*{\cftsubsecfont}{}
 \newcommand*{\cftsubsecpresnum}{}
 \newcommand*{\cftsubsecaftersnum}{}
@@ -113,9 +111,9 @@
 \newcommand*{\cftsubsecpagefont}{}
 \newcommand*{\cftsubsecafterpnum}{}
 
-\newlength{\cftbeforesubsubsecskip}
-\newlength{\cftsubsubsecindent}
-\newlength{\cftsubsubsecnumwidth}
+\LWR at providelength{\cftbeforesubsubsecskip}
+\LWR at providelength{\cftsubsubsecindent}
+\LWR at providelength{\cftsubsubsecnumwidth}
 \newcommand*{\cftsubsubsecfont}{}
 \newcommand*{\cftsubsubsecpresnum}{}
 \newcommand*{\cftsubsubsecaftersnum}{}
@@ -125,9 +123,9 @@
 \newcommand*{\cftsubsubsecpagefont}{}
 \newcommand*{\cftsubsubsecafterpnum}{}
 
-\newlength{\cftbeforeparaskip}
-\newlength{\cftparaindent}
-\newlength{\cftparanumwidth}
+\LWR at providelength{\cftbeforeparaskip}
+\LWR at providelength{\cftparaindent}
+\LWR at providelength{\cftparanumwidth}
 \newcommand*{\cftparafont}{}
 \newcommand*{\cftparapresnum}{}
 \newcommand*{\cftparaaftersnum}{}
@@ -137,9 +135,9 @@
 \newcommand*{\cftparapagefont}{}
 \newcommand*{\cftparaafterpnum}{}
 
-\newlength{\cftbeforesubparaskip}
-\newlength{\cftsubparaindent}
-\newlength{\cftsubparanumwidth}
+\LWR at providelength{\cftbeforesubparaskip}
+\LWR at providelength{\cftsubparaindent}
+\LWR at providelength{\cftsubparanumwidth}
 \newcommand*{\cftsubparafont}{}
 \newcommand*{\cftsubparapresnum}{}
 \newcommand*{\cftsubparaaftersnum}{}
@@ -149,9 +147,9 @@
 \newcommand*{\cftsubparapagefont}{}
 \newcommand*{\cftsubparaafterpnum}{}
 
-\newlength{\cftbeforefigskip}
-\newlength{\cftfigindent}
-\newlength{\cftfignumwidth}
+\LWR at providelength{\cftbeforefigskip}
+\LWR at providelength{\cftfigindent}
+\LWR at providelength{\cftfignumwidth}
 \newcommand*{\cftfigfont}{}
 \newcommand*{\cftfigpresnum}{}
 \newcommand*{\cftfigaftersnum}{}
@@ -161,9 +159,9 @@
 \newcommand*{\cftfigpagefont}{}
 \newcommand*{\cftfigafterpnum}{}
 
-\newlength{\cftbeforesubfigskip}
-\newlength{\cftsubfigindent}
-\newlength{\cftsubfignumwidth}
+\LWR at providelength{\cftbeforesubfigskip}
+\LWR at providelength{\cftsubfigindent}
+\LWR at providelength{\cftsubfignumwidth}
 \newcommand*{\cftsubfigfont}{}
 \newcommand*{\cftsubfigpresnum}{}
 \newcommand*{\cftsubfigaftersnum}{}
@@ -173,9 +171,9 @@
 \newcommand*{\cftsubfigpagefont}{}
 \newcommand*{\cftsubfigafterpnum}{}
 
-\newlength{\cftbeforetabskip}
-\newlength{\cfttabindent}
-\newlength{\cfttabnumwidth}
+\LWR at providelength{\cftbeforetabskip}
+\LWR at providelength{\cfttabindent}
+\LWR at providelength{\cfttabnumwidth}
 \newcommand*{\cfttabfont}{}
 \newcommand*{\cfttabpresnum}{}
 \newcommand*{\cfttabaftersnum}{}
@@ -185,9 +183,9 @@
 \newcommand*{\cfttabpagefont}{}
 \newcommand*{\cfttabafterpnum}{}
 
-\newlength{\cftbeforesubtabskip}
-\newlength{\cftsubtabindent}
-\newlength{\cftsubtabnumwidth}
+\LWR at providelength{\cftbeforesubtabskip}
+\LWR at providelength{\cftsubtabindent}
+\LWR at providelength{\cftsubtabnumwidth}
 \newcommand*{\cftsubtabfont}{}
 \newcommand*{\cftsubtabpresnum}{}
 \newcommand*{\cftsubtabaftersnum}{}
@@ -197,44 +195,55 @@
 \newcommand*{\cftsubtabpagefont}{}
 \newcommand*{\cftsubtabafterpnum}{}
 
-\newcommand{\cftsetindents}[3]{}
+\DeclareDocumentCommand{\cftsetindents}{m m m}{}
 
 \newcommand{\pagenumbersoff}[1]{}
 \newcommand{\pagenumberson}[1]{}
 
-\NewDocumentCommand{\newlistentry}{o m m m}
-{
-\IfValueTF{#1}
-{
-    \newcounter{#2}[#1]
-    \expandafter\edef\csname the#2\endcsname{
-        \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}
-    }
+\DeclareDocumentCommand{\newlistentry}{o m m m}
+{%
+\LWR at traceinfo{newlistentry #2 #3 #4}%
+\IfValueTF{#1}%
+{%
+    \@ifundefined{c@#2}{%
+        \newcounter{#2}[#1]%
+        \expandafter\edef\csname the#2\endcsname{%
+            \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}%
+        }%
+    }{}%
+}%
+{%
+    \@ifundefined{c@#2}{%
+        \newcounter{#2}%
+    }{}%
+}%
+\@namedef{l@#2}##1##2{%
+    \hypertocfloat{1}{#2}{#3}{##1}{##2}%
+    \def\cftwhatismyname{#2}% from memoir
+}%
+\expandafter\newlength\csname cftbefore#2skip\endcsname%
+\expandafter\newlength\csname cft#2indent\endcsname%
+\expandafter\newlength\csname cft#2numwidth\endcsname%
+\@namedef{cft#2font}{}%
+\@namedef{cft#2presnum}{}%
+\@namedef{cft#2aftersnum}{}%
+\@namedef{cft#2aftersnumb}{}%
+\@namedef{cft#2leader}{}%
+\@namedef{cft#2dotsep}{1}%
+\@namedef{cft#2pagefont}{}%
+\@namedef{cft#2afterpnum}{}%
+\@namedef{toclevel@#2}{#4}%
+\@namedef{cft#2fillnum}##1{}%
+\LWR at traceinfo{newlistentry done}%
 }
-{\newcounter{#2}}
-\@namedef{l@#2}##1##2{\hypertocfloat{1}{#2}{#3}{##1}{##2}}
-\expandafter\newlength\csname cftbefore#2skip\endcsname
-\expandafter\newlength\csname cft#2indent\endcsname
-\expandafter\newlength\csname cft#2numwidth\endcsname
-\@namedef{cft#2font}{}
-\@namedef{cft#2presnum}{}
-\@namedef{cft#2aftersnum}{}
-\@namedef{cft#2aftersnumb}{}
-\@namedef{cft#2leader}{}
-\@namedef{cft#2dotsep}{1}
-\@namedef{cft#2pagefont}{}
-\@namedef{cft#2afterpnum}{}
-\@namedef{toclevel@#2}{#4}
-\@namedef{cft#2fillnum}##1{}
-}
 
-\NewDocumentCommand{\newlistof}{o m m m}
+\DeclareDocumentCommand{\newlistof}{o m m m}
 {%
 \IfValueTF{#1}
 {\newlistentry[#1]{#2}{#3}{0}}
 {\newlistentry{#2}{#3}{0}}
 \@namedef{ext@#2}{#3}
-\newcounter{#3depth}
+\@ifundefined{c@#3depth}{\newcounter{#3depth}}{}
 \setcounter{#3depth}{1}
 \@namedef{cftmark#3}{}
 \@namedef{listof#2}{\listof{#2}{#4}}

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-turnthepage.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-turnthepage.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-turnthepage.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -0,0 +1,22 @@
+%%
+%% This is file `lwarp-turnthepage.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `turnthepage')
+%% This is a generated file.
+%% Copyright 2016-2017 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+\LWR at ProvidesPackageDrop{turnthepage}
+\newcommand{\turnthepage}{}
+\endinput
+%%
+%% End of file `lwarp-turnthepage.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-turnthepage.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xfrac.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xfrac.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xfrac.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -30,7 +30,7 @@
 \begin{warpHTML}
 
 \newcommand*{\LWR at htmlsmallfontstart}{%
-\LWR at htmltagc{span style="font-size:\xfracHTMLfontsize"{}}%
+\LWR at htmltagc{span style="font-size:\xfracHTMLfontsize"}%
 \LWR at nestspan%
 }
 

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xtab.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xtab.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xtab.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -52,15 +52,15 @@
 \newcommand*{\xentrystretch}[1]{}
 
 \NewDocumentEnvironment{xtabular}{s o m}
-{
-\LWR at traceinfo{xtabular}
-\table
-\LWRXT at caption
-\begin{tabular}{#3}
+{%
+\LWR at traceinfo{xtabular}%
+\table%
+\LWRXT at caption%
+\begin{tabular}{#3}%
 \TabularMacro\ifdefvoid{\LWRXT at firsthead}%
 {\LWR at getmynexttoken}%
 {\expandafter\LWR at getmynexttoken\LWRXT at firsthead}%
-}
+}%
 {%
 \ifdefvoid{\LWRXT at lasttail}%
 {}%
@@ -68,9 +68,9 @@
 \TabularMacro\ResumeTabular%
 \LWRXT at lasttail%
 }%
-\end{tabular}
-\endtable
-\LWR at traceinfo{xtabular done}
+\end{tabular}%
+\endtable%
+\LWR at traceinfo{xtabular done}%
 }
 
 \NewDocumentEnvironment{mpxtabular}{s o m}

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty	2018-01-23 01:23:02 UTC (rev 46415)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty	2018-01-23 22:34:45 UTC (rev 46416)
@@ -17,7 +17,7 @@
 %% version 2005/12/01 or later.
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesPackage{lwarp}
-    [2017/11/22 v0.44  Allows LaTeX to directly produce HTML5 output.]
+    [2018/01/23 v0.46  Allows LaTeX to directly produce HTML5 output.]
 
 
 
@@ -48,7 +48,9 @@
 \RequirePackage{upquote}
 \else
 \fi
-
+\newcommand*\LWR at providelength[1]{%
+    \ifdeflength{#1}{}{\newlength{#1}}%
+}
 \RequirePackage{etoolbox}[2011/01/03]% v2.6 for \BeforeBeginEnvironment, etc.
 \RequirePackage{xpatch}
 
@@ -168,7 +170,6 @@
 {\includecomment{LWR at createlwarpmk}}
 {\excludecomment{LWR at createlwarpmk}}
 
-
 \newcommand*{\LWR at loadafter}[1]{%
 \@ifpackageloaded{#1}
 {
@@ -181,6 +182,10 @@
 {}
 }
 
+\@ifclassloaded{memoir}
+{\newcommand*{\LWR at notmemoirloadafter}[1]{}}
+{\LetLtxMacro\LWR at notmemoirloadafter\LWR at loadafter}
+
 \newcommand*{\LWR at loadbefore}[1]{%
 \@ifpackageloaded{#1}
 {}
@@ -199,11 +204,10 @@
 or is superceded by another package.
 For a possible alternative, see package(s) #2.}
 }
-
 \LWR at loadafter{a4}
 \LWR at loadafter{a4wide}
 \LWR at loadafter{a5comb}
-\LWR at loadafter{abstract}
+\LWR at notmemoirloadafter{abstract}
 \LWR at loadafter{adjmulticol}
 \LWR at loadafter{addlines}
 \LWR at loadafter{afterpage}
@@ -213,38 +217,44 @@
 \LWR at loadafter{amsthm}
 \LWR at loadafter{anonchap}
 \LWR at loadafter{anysize}
-\LWR at loadafter{appendix}
+\LWR at notmemoirloadafter{appendix}
 \LWR at loadafter{arabicfront}
-\LWR at loadafter{array}
+\LWR at notmemoirloadafter{array}
 \LWR at loadafter{atbegshi}
 \LWR at loadafter{authblk}
+\LWR at loadafter{backref}
 \LWR at loadafter{balance}
 \LWR at loadafter{bigdelim}
 \LWR at loadafter{bigstrut}
 \LWR at loadafter{bookmark}
-\LWR at loadafter{booktabs}
+\LWR at notmemoirloadafter{booktabs}
 \LWR at loadafter{boxedminipage}
 \LWR at loadafter{boxedminipage2e}
 \LWR at loadafter{breakurl}
 \LWR at loadafter{cancel}
-\LWR at loadafter{ccaption}
-\LWR at loadafter{changepage}
-\LWR at loadafter{chngpage}
+\LWR at notmemoirloadafter{ccaption}
+\LWR at loadafter{changebar}
+\LWR at notmemoirloadafter{changepage}
+\LWR at notmemoirloadafter{chngpage}
 \LWR at loadafter{chappg}
+\LWR at loadafter{cite}
 \LWR at loadafter{color}
-\LWR at loadafter{crop}
+\LWR at loadafter{continue}
+\LWR at notmemoirloadafter{crop}
 \LWR at loadafter{cuted}
 \LWR at loadafter{cutwin}
 \LWR at loadafter{dblfnote}
-\LWR at loadafter{dcolumn}
+\LWR at notmemoirloadafter{dcolumn}
 \LWR at loadafter{draftwatermark}
 \LWR at loadafter{easy-todo}
 \LWR at loadafter{ebook}
 \LWR at loadafter{ellipsis}
 \LWR at loadafter{emptypage}
-\LWR at loadafter{enumerate}
+\LWR at loadafter{endfloat}
+\LWR at loadafter{endnotes}
+\LWR at notmemoirloadafter{enumerate}
 \LWR at loadafter{enumitem}
-\LWR at loadafter{epigraph}
+\LWR at notmemoirloadafter{epigraph}
 \LWR at loadafter{eso-pic}
 \LWR at loadafter{everypage}
 \LWR at loadafter{everyshi}
@@ -257,20 +267,29 @@
 \LWR at loadafter{fix2col}
 \LWR at loadafter{fixme}
 \LWR at loadafter{fixmetodonotes}
+\LWR at loadafter{flafter}
 \LWR at loadafter{float}
 \LWR at loadafter{floatflt}
 \LWR at loadafter{floatpag}
 \LWR at loadafter{floatrow}
+\LWR at loadafter{fltrace}
 \LWR at loadafter{flushend}
 \LWR at loadafter{fncychap}
 \LWR at loadafter{fnpos}
+\LWR at loadafter{footmisc}
+\LWR at loadafter{footnote}
+\LWR at loadafter{footnotehyper}
+\LWR at loadafter{footnpag}
+\LWR at loadafter{framed}
 \LWR at loadafter{ftnright}
 \LWR at loadafter{fullpage}
 \LWR at loadafter{fullwidth}
+\LWR at loadafter{fwlw}
 \LWR at loadafter{geometry}
 \LWR at loadafter{glossaries}
 \LWR at loadafter{grffile}
 \LWR at loadafter{hang}
+\LWR at loadafter{hanging}
 \LWR at loadafter{hyperref}
 \LWR at loadafter{hyperxmp}
 \LWR at loadafter{idxlayout}
@@ -292,29 +311,34 @@
 \LWR at loadafter{marginnote}
 \LWR at loadafter{mcaption}
 \LWR at loadafter{mdframed}
+\LWR at loadafter{memhfixc}
 \LWR at loadafter{metalogo}
 \LWR at loadafter{microtype}
 \LWR at loadafter{midfloat}
-\LWR at loadafter{moreverb}
-\LWR at loadafter{mparhack}
+\LWR at loadafter{midpage}
+\LWR at notmemoirloadafter{moreverb}
+\LWR at notmemoirloadafter{mparhack}
 \LWR at loadafter{multirow}
 \LWR at loadafter{nameref}
-\LWR at loadafter{needspace}
+\LWR at loadafter{natbib}
+\LWR at notmemoirloadafter{needspace}
 \LWR at loadafter{newtxmath}
-\LWR at loadafter{nextpage}
+\LWR at notmemoirloadafter{nextpage}
 \LWR at loadafter{nonumonpart}
 \LWR at loadafter{nopageno}
 \LWR at loadafter{nowidow}
 \LWR at loadafter{ntheorem}
 \LWR at loadafter{overpic}
-\LWR at loadafter{pagenote}
+\LWR at notmemoirloadafter{pagenote}
+\LWR at loadafter{pagesel}
 \LWR at loadafter{paralist}
-\LWR at loadafter{parskip}
+\LWR at notmemoirloadafter{parskip}
 \LWR at loadafter{pdflscape}
 \LWR at loadafter{pdfsync}
 \LWR at loadafter{pfnote}
 \LWR at loadafter{placeins}
 \LWR at loadafter{prelim2e}
+\LWR at loadafter{prettyref}
 \LWR at loadafter{preview}
 \LWR at loadafter{quotchap}
 \LWR at loadafter{ragged2e}
@@ -332,9 +356,9 @@
 \LWR at loadafter{scrlayer-scrpage}
 \LWR at loadafter{section}
 \LWR at loadafter{sectsty}
-\LWR at loadafter{setspace}
+\LWR at notmemoirloadafter{setspace}
 \LWR at loadafter{shadow}
-\LWR at loadafter{showidx}
+\LWR at notmemoirloadafter{showidx}
 \LWR at loadafter{showkeys}
 \LWR at loadafter{sidecap}
 \LWR at loadafter{sidenotes}
@@ -344,11 +368,13 @@
 \LWR at loadafter{soulutf8}
 \LWR at loadafter{stabular}
 \LWR at loadafter{subfig}
+\LWR at loadafter{subfigure}
 \LWR at loadafter{supertabular}
 \LWR at loadafter{tabls}
-\LWR at loadafter{tabularx}
+\LWR at notmemoirloadafter{tabularx}
 \LWR at loadafter{tabulary}
 \LWR at loadafter{textarea}
+\LWR at loadafter{textfit}
 \LWR at loadafter{textpos}
 \LWR at loadafter{theorem}
 \LWR at loadafter{threeparttable}
@@ -356,18 +382,19 @@
 \LWR at loadafter{titleps}
 \LWR at loadafter{titlesec}
 \LWR at loadafter{titletoc}
-\LWR at loadafter{titling}
-\LWR at loadafter{tocbibind}
-\LWR at loadafter{tocloft}
+\LWR at notmemoirloadafter{titling}
+\LWR at notmemoirloadafter{tocbibind}
+\LWR at notmemoirloadafter{tocloft}
 \LWR at loadafter{tocstyle}
 \LWR at loadafter{todo}
 \LWR at loadafter{todonotes}
 \LWR at loadafter{transparent}
 \LWR at loadafter{trivfloat}
+\LWR at loadafter{turnthepage}
 \LWR at loadafter{ulem}
 \LWR at loadafter{upref}
 \LWR at loadafter{varioref}
-\LWR at loadafter{verse}
+\LWR at notmemoirloadafter{verse}
 \LWR at loadafter{wallpaper}
 \LWR at loadafter{watermark}
 \LWR at loadafter{wrapfig}
@@ -514,7 +541,9 @@
 }
 \newcommand*{\LWR at lookforpackagename}[1]{%
 \LWR at findword{\LWR at requirepackagenames}{#1}[\LWR at strresult]%
+\LWR at traceinfo{LWR at lookforpackagename with blanks: !\LWR at strresult!}%
 \StrSubstitute[100]{\LWR at strresult}{ }{}[\LWR at strresulttwo]%
+\LWR at traceinfo{LWR at lookforpackagename without blanks: !\LWR at strresulttwo!}%
 \IfStrEq{\LWR at strresulttwo}{}%
 {}% no filename
 {% yes filename
@@ -525,7 +554,12 @@
             {\LWR at strresult}%
             {lwarp-\LWR at strresulttwo}[\LWR at requirepackagenames]%
 }%
-{}% no lwarp-* file
+{
+        \StrSubstitute%
+            {\LWR at requirepackagenames}%
+            {\LWR at strresult}%
+            {\LWR at strresulttwo}[\LWR at requirepackagenames]%
+}% no lwarp-* file
 }% yes filename
 }
 \RenewDocumentCommand{\RequirePackage}{o m o}{%
@@ -637,15 +671,22 @@
 \newread\LWR at copyinfile      % open the file to read from
 
 \newcommand*{\LWR at copyfile}[2]{%
+\LWR at traceinfo{LWR at copyfile: copying #1 to #2}
+
 \immediate\openout\LWR at copyoutfile=#2
 \openin\LWR at copyinfile=#1
 \begingroup\endlinechar=-1
 \makeatletter
+
+\LWR at traceinfo{LWR at copyfile: about to loop}
+
 \loop\unless\ifeof\LWR at copyinfile
+  \LWR at traceinfo{LWR at copyfile: one line}
   \read\LWR at copyinfile to\LWR at fileline  % Read one line and store it into \LWR at fileline
   \immediate\write\LWR at copyoutfile{\unexpanded\expandafter{\LWR at fileline}}%
 \repeat
-\closeout\LWR at copyoutfile
+\immediate\closeout\LWR at copyoutfile
+\LWR at traceinfo{LWR at copyfile: done}
 \endgroup
 }
 
@@ -678,12 +719,6 @@
 
 \end{warpall}
 
-\begin{warpHTML}
-\@ifclassloaded{scrbook}{\RequirePackage{lwarp-patch-komascript}}{}
-\@ifclassloaded{scrartcl}{\RequirePackage{lwarp-patch-komascript}}{}
-\@ifclassloaded{scrreprt}{\RequirePackage{lwarp-patch-komascript}}{}
-\end{warpHTML}
-
 \begin{warpall}
 \newbool{FormatEPUB}
 \boolfalse{FormatEPUB}
@@ -726,7 +761,7 @@
 \renewcommand*{\LWR at tagsubsubsectionend}{/h5}
 \renewcommand*{\LWR at tagparagraph}{h6}
 \renewcommand*{\LWR at tagparagraphend}{/h6}
-\renewcommand*{\LWR at tagsubparagraph}{span class="subparagraph"{}}
+\renewcommand*{\LWR at tagsubparagraph}{span class="subparagraph"}
 \renewcommand*{\LWR at tagsubparagraphend}{/span}
 }% WPTitleHeading
 {% not WPTitleHeading, part and section starting at h1
@@ -763,7 +798,7 @@
 \renewcommand*{\LWR at tagsubsubsectionend}{/h5}
 \renewcommand*{\LWR at tagparagraph}{h6}
 \renewcommand*{\LWR at tagparagraphend}{/h6}
-\renewcommand*{\LWR at tagsubparagraph}{span class="subparagraph"{}}
+\renewcommand*{\LWR at tagsubparagraph}{span class="subparagraph"}
 \renewcommand*{\LWR at tagsubparagraphend}{/span}
 }% not WPTitleHeading
 }% chapter defined
@@ -818,7 +853,7 @@
 
 \let\LWR at origpagestyle\pagestyle
 \let\LWR at origthispagestyle\thispagestyle
-\let\LWR at origpagenumbering\pagenumbering
+\LetLtxMacro\LWR at origpagenumbering\pagenumbering
 
 \LetLtxMacro{\LWR at origminipage}{\minipage}
 \let\LWR at origendminipage\endminipage
@@ -965,7 +1000,7 @@
 \begin{filecontents*}{lwarp.css}
 /*
   CSS stylesheet for the LaTeX lwarp package
-  Copyright 2016-2017 Brian Dunn — BD Tech Concepts LLC
+  Copyright 2016-2018 Brian Dunn — BD Tech Concepts LLC
 */
 
 /* a fix for older browsers: */
@@ -1010,6 +1045,7 @@
 }
 
 p {margin: 1.5ex 0em 1.5ex 0em ;}
+table p {margin: .5ex 0em .5ex 0em ;}
 
 /* Holds a section number to add space between it and the name */
 span.sectionnumber { margin-right: 0em }
@@ -1380,7 +1416,7 @@
 }
 
 ul, body dir, body menu {
-  margin: 1ex 1em 1ex 0em;
+  margin: 3ex 1em 3ex 0em;
   line-height: 1.2;
 }
 
@@ -1570,7 +1606,8 @@
 .mdframedtitle {
     padding: .5em ;
     display: block ;
-    font-size: 130%
+    font-size: 130% ;
+    margin-bottom: 1ex ;
 }
 
 .mdframedsubtitle {
@@ -1599,6 +1636,12 @@
   display: block ;
 }
 
+.shaded {
+    margin: 3ex 0em 3ex 0em ;
+    padding: .3ex 1em .3ex 1em ;
+    display: block ;
+}
+
 .snugframed {
     margin: 3ex 0em 3ex 0em ;
    border: 1px solid black;
@@ -2676,7 +2719,17 @@
 (require "texindy.xdy")
 (require "page-ranges.xdy")
 (require "book-order.xdy")
+(require "page-ranges.xdy")
 (markup-locref :open "\hyperindexref{" :close "}")
+(define-location-class "arabic-page-numbers"
+    ("arabic-numbers") :min-range-length 1)
+(define-location-class-order ("roman-page-numbers"
+                  "arabic-page-numbers"
+                  "alpha-page-numbers"
+                  "Roman-page-numbers"
+                  "Alpha-page-numbers"
+                  "see"
+                  "seealso"))
 \end{filecontents*}
 \end{warpprint}
 
@@ -2750,7 +2803,10 @@
  MathJax.Hub.Config({
    extensions: ["tex2jax.js","[siunitx]/siunitx.js"],
    jax: ["input/TeX","output/HTML-CSS"],
-   tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]},
+   tex2jax: {
+        inlineMath: [["$","$"],["\\(","\\)"]] ,
+        processClass: "tabbing|verse"
+    },
    TeX: {extensions: ["AMSmath.js","AMSsymbols.js", "sinuitx.js"]}
  });
  MathJax.Ajax.config.path['siunitx']  = 'http://rawgit.com/burnpanck/MathJax-siunitx/master/';
@@ -2787,11 +2843,11 @@
 \begin{filecontents*}{lwarpmk.lua}
 #!/usr/bin/env texlua
 
--- Copyright 2016-2017 Brian Dunn
+-- Copyright 2016-2018 Brian Dunn
 
 -- Print the usage of the lwarpmk command:
 
-printversion = "v0.44"
+printversion = "v0.46"
 
 function printhelp ()
 print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;
@@ -3366,57 +3422,57 @@
 
 \NewDocumentCommand{\pushclose}{m m}
 {
-\let\LWR at closetwelve\LWR at closeeleven
-\let\LWR at closeeleven\LWR at closeten
-\let\LWR at closeten\LWR at closenine
-\let\LWR at closenine\LWR at closeeight
-\let\LWR at closeeight\LWR at closeseven
-\let\LWR at closeseven\LWR at closesix
-\let\LWR at closesix\LWR at closefive
-\let\LWR at closefive\LWR at closefour
-\let\LWR at closefour\LWR at closethree
-\let\LWR at closethree\LWR at closetwo
-\let\LWR at closetwo\LWR at closeone
-\let\LWR at closeone#1
-\let\LWR at closedepthtwelve\LWR at closedeptheleven
-\let\LWR at closedepthelevel\LWR at closedepthten
-\let\LWR at closedepthten\LWR at closedepthnine
-\let\LWR at closedepthnine\LWR at closedeptheight
-\let\LWR at closedeptheight\LWR at closedepthseven
-\let\LWR at closedepthseven\LWR at closedepthsix
-\let\LWR at closedepthsix\LWR at closedepthfive
-\let\LWR at closedepthfive\LWR at closedepthfour
-\let\LWR at closedepthfour\LWR at closedepththree
-\let\LWR at closedepththree\LWR at closedepthtwo
-\let\LWR at closedepthtwo\LWR at closedepthone
-\let\LWR at closedepthone#2
+\global\let\LWR at closetwelve\LWR at closeeleven
+\global\let\LWR at closeeleven\LWR at closeten
+\global\let\LWR at closeten\LWR at closenine
+\global\let\LWR at closenine\LWR at closeeight
+\global\let\LWR at closeeight\LWR at closeseven
+\global\let\LWR at closeseven\LWR at closesix
+\global\let\LWR at closesix\LWR at closefive
+\global\let\LWR at closefive\LWR at closefour
+\global\let\LWR at closefour\LWR at closethree
+\global\let\LWR at closethree\LWR at closetwo
+\global\let\LWR at closetwo\LWR at closeone
+\global\let\LWR at closeone#1
+\global\let\LWR at closedepthtwelve\LWR at closedeptheleven
+\global\let\LWR at closedeptheleven\LWR at closedepthten
+\global\let\LWR at closedepthten\LWR at closedepthnine
+\global\let\LWR at closedepthnine\LWR at closedeptheight
+\global\let\LWR at closedeptheight\LWR at closedepthseven
+\global\let\LWR at closedepthseven\LWR at closedepthsix
+\global\let\LWR at closedepthsix\LWR at closedepthfive
+\global\let\LWR at closedepthfive\LWR at closedepthfour
+\global\let\LWR at closedepthfour\LWR at closedepththree
+\global\let\LWR at closedepththree\LWR at closedepthtwo
+\global\let\LWR at closedepthtwo\LWR at closedepthone
+\global\let\LWR at closedepthone#2
 }
 
 
 \newcommand*{\popclose}
 {
-\let\LWR at closeone\LWR at closetwo
-\let\LWR at closetwo\LWR at closethree
-\let\LWR at closethree\LWR at closefour
-\let\LWR at closefour\LWR at closefive
-\let\LWR at closefive\LWR at closesix
-\let\LWR at closesix\LWR at closeseven
-\let\LWR at closeseven\LWR at closeeight
-\let\LWR at closeeight\LWR at closenine
-\let\LWR at closenine\LWR at closeten
-\let\LWR at closeten\LWR at closeeleven
-\let\LWR at closeeleven\LWR at closetwelve
-\let\LWR at closedepthone\LWR at closedepthtwo
-\let\LWR at closedepthtwo\LWR at closedepththree
-\let\LWR at closedepththree\LWR at closedepthfour
-\let\LWR at closedepthfour\LWR at closedepthfive
-\let\LWR at closedepthfive\LWR at closedepthsix
-\let\LWR at closedepthsix\LWR at closedepthseven
-\let\LWR at closedepthseven\LWR at closedeptheight
-\let\LWR at closedeptheight\LWR at closedepthnine
-\let\LWR at closedepthnine\LWR at closedepthten
-\let\LWR at closedepthten\LWR at closedeptheleven
-\let\LWR at closedeptheleven\LWR at closedepthtwelve
+\global\let\LWR at closeone\LWR at closetwo
+\global\let\LWR at closetwo\LWR at closethree
+\global\let\LWR at closethree\LWR at closefour
+\global\let\LWR at closefour\LWR at closefive
+\global\let\LWR at closefive\LWR at closesix
+\global\let\LWR at closesix\LWR at closeseven
+\global\let\LWR at closeseven\LWR at closeeight
+\global\let\LWR at closeeight\LWR at closenine
+\global\let\LWR at closenine\LWR at closeten
+\global\let\LWR at closeten\LWR at closeeleven
+\global\let\LWR at closeeleven\LWR at closetwelve
+\global\let\LWR at closedepthone\LWR at closedepthtwo
+\global\let\LWR at closedepthtwo\LWR at closedepththree
+\global\let\LWR at closedepththree\LWR at closedepthfour
+\global\let\LWR at closedepthfour\LWR at closedepthfive
+\global\let\LWR at closedepthfive\LWR at closedepthsix
+\global\let\LWR at closedepthsix\LWR at closedepthseven
+\global\let\LWR at closedepthseven\LWR at closedeptheight
+\global\let\LWR at closedeptheight\LWR at closedepthnine
+\global\let\LWR at closedepthnine\LWR at closedepthten
+\global\let\LWR at closedepthten\LWR at closedeptheleven
+\global\let\LWR at closedeptheleven\LWR at closedepthtwelve
 }
 
 \end{warpHTML}
@@ -3434,6 +3490,21 @@
 
 \begin{warpHTML}
 
+\newcommand*{\LWR at sanitized}{}
+
+\newcommand*{\LWR at sanitize}[1]{%
+\LWR at traceinfo{LWR at sanitize: !#1!}%
+\edef\LWR at sanitized{#1}%
+\LWR at traceinfo{LWR at sanitize expanded: !\LWR at sanitized!}%
+\edef\LWR at sanitized{\detokenize\expandafter{\LWR at sanitized}}%
+\LWR at traceinfo{LWR at sanitize result: !\LWR at sanitized!}%
+}
+
+\end{warpHTML}
+
+
+\begin{warpHTML}
+
 \let\LWR at origampersand\&
 \newcommand*{\HTMLentity}[1]{%
 \begingroup%
@@ -3443,7 +3514,7 @@
 }
 \newcommand*{\HTMLunicode}[1]{\HTMLentity{\#x#1}}
 
-\renewcommand*{\&}{\HTMLentity{amp}}
+\renewrobustcmd*{\&}{\HTMLentity{amp}}
 
 \let\LWR at origtextless\textless
 \renewcommand*{\textless}{\HTMLentity{lt}}
@@ -3477,8 +3548,7 @@
 \setcounter{LWR at htmlfilenumber}{0}
 
 \newcommand*{\LWR at htmlsectionfilename}[1]{%
-\LWR at traceinfo{LWR at htmlsectionfilename A}%
-\LWR at traceinfo{about to assign temp}%
+\LWR at traceinfo{LWR at htmlsectionfilename A !\detokenize{#1}!}%
 \edef\LWR at tempone{#1}%
 \LWR at traceinfo{about to compare with ??}%
 \ifthenelse{\equal{\LWR at tempone}{??}}%
@@ -3511,9 +3581,9 @@
 }
 
 \newcommand*{\LWR at htmlrefsectionfilename}[1]{%
-\LWR at traceinfo{LWR at htmlrefsectionfilename A: !#1!}%
+\LWR at traceinfo{LWR at htmlrefsectionfilename: !\detokenize{#1}!}%
 \LWR at htmlsectionfilename{\LWR at htmlfileref{#1}}%
-\LWR at traceinfo{LWR at htmlrefsectionfilename B}%
+\LWR at traceinfo{LWR at htmlrefsectionfilename: done}%
 }
 
 \end{warpHTML}
@@ -3541,17 +3611,27 @@
 
 \begin{warpHTML}
 
-\newcommand*{\PrintStack}{
+\newcommand*{\LWR at subprintstack}{
+\LWR at closedepthone\ \LWR at closedepthtwo\ \LWR at closedepththree\
+\LWR at closedepthfour\ \LWR at closedepthfive\ \LWR at closedepthsix\
+\LWR at closedepthseven\ \LWR at closedeptheight\ \LWR at closedepthnine\
+\LWR at closedepthten\ \LWR at closedeptheleven\ \LWR at closedepthtwelve\
+}
+
+\newcommand*{\LWRPrintStack}{
 \LWR at startpars
-\LWR at closedepthone{} \LWR at closedepthtwo{} \LWR at closedepththree{}
-\LWR at closedepthfour{} \LWR at closedepthfive{} \LWR at closedepthsix{}
-\LWR at closedepthseven{} \LWR at closedeptheight{} \LWR at closedepthnine{}
-\LWR at closedepthten{} \LWR at closedeptheleven{} \LWR at closedepthtwelve{}
+\LWR at subprintstack
 }
 
 \end{warpHTML}
 
+\begin{warpprint}
 
+\newcommand*{\LWRPrintStack}{}
+
+\end{warpprint}
+
+
 \begin{warpHTML}
 
 \newcommand*{\LWR at closeoneprevious}{%
@@ -3562,9 +3642,19 @@
 }
 
 \newcommand*{\LWR at closeprevious}[1]{
-\LWR at stoppars
-\whileboolexpr{not test{\ifnumcomp{\LWR at closedepthone}{<}{#1}}}%
-    {\LWR at closeoneprevious}
+\LWR at traceinfo{LWR at closeprevious to depth #1, depths are \LWR at subprintstack}%
+\LWR at stoppars%
+\whileboolexpr{test{\ifnumcomp{\LWR at closedepthone}{>}{#1}}}%
+{%
+    \LWR at traceinfo{LWR at closeprevious: closing out depth \LWR at closedepthone}%
+    \LWR at closeoneprevious%
+}%
+\ifboolexpr{test{\ifnumcomp{\LWR at closedepthone}{=}{#1}}}%
+{%
+    \LWR at traceinfo{LWR at closeprevious: closing out depth \LWR at closedepthone}%
+    \LWR at closeoneprevious%
+}{}%
+\LWR at traceinfo{LWR at closeprevious: done, depths are \LWR at subprintstack}%
 }
 
 \end{warpHTML}
@@ -3574,7 +3664,9 @@
 \begin{warpHTML}
 
 \newcommand{\LWR at forcenewpage}{%
+\ifinner\else%
 \LWR at stoppars\LWR at orignewpage\LWR at startpars%
+\fi%
 }
 \renewcommand*{\pagestyle}[1]{}
 \renewcommand*{\thispagestyle}[1]{}
@@ -3584,7 +3676,7 @@
 \renewcommand*{\flushbottom}{}
 \renewcommand*{\sloppy}{}
 \renewcommand*{\fussy}{}
-\renewcommand*{\pagenumbering}[1]{}
+\RenewDocumentCommand{\pagenumbering}{s m}{}
 \end{warpHTML}
 
 
@@ -3603,9 +3695,9 @@
 \newcommand*{\LWR at tagsubsectionend}{/h5}
 \newcommand*{\LWR at tagsubsubsection}{h6}
 \newcommand*{\LWR at tagsubsubsectionend}{/h6}
-\newcommand*{\LWR at tagparagraph}{span class="paragraph"{}}
+\newcommand*{\LWR at tagparagraph}{span class="paragraph"}
 \newcommand*{\LWR at tagparagraphend}{/span}
-\newcommand*{\LWR at tagsubparagraph}{span class="subparagraph"{}}
+\newcommand*{\LWR at tagsubparagraph}{span class="subparagraph"}
 \newcommand*{\LWR at tagsubparagraphend}{/span}
 
 \newcommand*{\LWR at tagregularparagraph}{p}
@@ -3619,19 +3711,19 @@
 {%
     \frenchbsetup{FrenchFootnotes=false}%
     \LetLtxMacro\LWR at FBcancel\NoAutoSpacing%
-    \renewcommand*{\FBcolonspace}{%
+    \renewrobustcmd*{\FBcolonspace}{%
         \begingroup%
         \LWR at FBcancel%
         \LWR at origampersand{}nbsp;%
         \endgroup%
     }%
-    \renewcommand*{\FBthinspace}{%
+    \renewrobustcmd*{\FBthinspace}{%
         \begingroup%
         \LWR at FBcancel%
         \LWR at origampersand\#x202f;% \,
         \endgroup%
     }%
-    \renewcommand*{\FBguillspace}{%
+    \renewrobustcmd*{\FBguillspace}{%
         \begingroup%
         \LWR at FBcancel%
         \LWR at origampersand{}nbsp;% ~,  for \og xyz \fg{}
@@ -3649,7 +3741,7 @@
         \LWR at origampersand{}nbsp;% ~
         \endgroup%
     }%
-    \renewcommand*{~}{\HTMLentity{nbsp}}% was overwritten by babel-french
+    \renewrobustcmd*{~}{\HTMLentity{nbsp}}% was overwritten by babel-french
     \ifFBunicode%
     \else%
         \DeclareTextSymbol{\FBtextellipsis}{LY1}{133}%
@@ -3661,10 +3753,13 @@
 
 \newcommand*{\LWR at htmltagc}[1]{%
 {%
+\LWR at traceinfo{LWR at htmltagc !\detokenize{#1}!}%
 \begingroup%
 \LWR at FBcancel%
 \ifmmode\else\protect\LWR at origttfamily\fi%
-\protect\LWR at origtextless#1\protect\LWR at origtextgreater%
+\protect\LWR at origtextless%
+#1%
+\protect\LWR at origtextgreater%
 \endgroup%
 }%
 }
@@ -3676,7 +3771,7 @@
 
 \newenvironment*{LWR at nestspan}
 {%
-\LWR at traceinfo{LWR at nestspan}%
+\LWR at traceinfo{LWR at nestspan starting}%
 \ifnumcomp{\value{LWR at lateximagedepth}}{>}{0}%
 {%
     \LWR at traceinfo{LWR at nestspan: inside a lateximage}%
@@ -3693,12 +3788,14 @@
     }%
     \renewcommand{\LWR at listend}{\LWR at htmltagc{br /}\LWR at htmltagc{br /}}%
 }% not in a lateximage
+\LWR at traceinfo{LWR at nestspan starting: done}%
 }% starting env
 {% ending env
+\LWR at traceinfo{LWR at nestspan ending}%
 \ifnumcomp{\value{LWR at lateximagedepth}}{>}{0}%
 {}%
 {\addtocounter{LWR at spandepth}{-1}}%
-\LWR at traceinfo{LWR at nestspan: done}%
+\LWR at traceinfo{LWR at nestspan ending: done}%
 }
 
 \AfterEndEnvironment{LWR at nestspan}{\global\let\par\LWR at closeparagraph}
@@ -3724,17 +3821,11 @@
 }
 
 
-\newcommand*{\LWR at htmltagb}[1]{%
+\newcommand*{\LWR at htmltag}[1]{%
 \LWR at htmltagc{#1}%
-\endgroup%
 }
 
-\newcommand*{\LWR at htmltag}{%
-\begingroup\catcode`\_=12
-\LWR at htmltagb%
-}
 
-
 \newcommand*{\LWR at htmlopencomment}{%
 {%
 \begingroup%
@@ -3762,15 +3853,9 @@
 #1%
 }%
 \LWR at htmlclosecomment{}}
-\newcommand{\LWR at htmlblockcommentb}[1]
-{\LWR at stoppars\LWR at htmlcomment{#1}\LWR at startpars\endgroup}
+\newcommand{\LWR at htmlblockcomment}[1]
+{\LWR at stoppars\LWR at htmlcomment{#1}\LWR at startpars}
 
-\newcommand{\LWR at htmlblockcomment}
-{%
-\begingroup\catcode`\_=12
-\LWR at htmlblockcommentb%
-}
-
 \newcommand*{\LWR at htmlblocktag}[1]{%
 \LWR at stoppars%
 \LWR at htmltag{#1}%
@@ -3835,12 +3920,8 @@
 
 \begin{warpHTML}
 \NewDocumentEnvironment{BlockClass}{o m}%
-{
-\LWR at htmldivclass[#1]{#2}
-}
-{
-\LWR at htmldivclassend{#2}
-}
+{\LWR at htmldivclass[#1]{#2}}
+{\LWR at htmldivclassend{#2}}
 \end{warpHTML}
 \begin{warpprint}
 \NewDocumentEnvironment{BlockClass}{o m}{}{}%
@@ -3869,10 +3950,10 @@
 \LWR at stoppars%
 \ifbool{FormatWP}%
 {%
-    \LWR at maybeincthisautoid%
+    \addtocounter{LWR at thisautoidWP}{1}%
     \LWR at htmltag{%
         div class="#3" %
-        id="autoid-\arabic{LWR at thisautoid}"%
+        id="autoidWP-\arabic{LWR at thisautoidWP}"%
         \ifblank{#1}{}{ style="#1"}%
     }%
 }% FormatWP
@@ -3950,11 +4031,6 @@
     {}% no nested par tags
     {% yes nest par tags
         \LWR at htmltagc{\LWR at tagregularparagraph}%
-        \ifnumcomp{\@listdepth}{>}{0}%
-        {%
-        \LWR at orighspace{1in}%
-        }%
-        {}%
         \global\booltrue{LWR at doingapar}%
         \let\par\LWR at closeparagraph%
     }% end of yes nest par tags
@@ -3991,7 +4067,21 @@
     {\ifbool{LWR at intabularmetadata}{}{\unskip\LWR at htmltagc{br /}}}%
     {}%
 }% not handling pars
-\LWR at origpar%
+\ifboolexpr{%
+    not bool {LWR at doingapar} and
+    test {\ifnumcomp{\value{LWR at tabulardepth}}{>}{0}} and
+    test {
+        \ifnumcomp{\value{LWR at tabulardepth}}{=}{\value{LWR at tabularpardepth}}
+    } and
+    bool {LWR at intabularmetadata} and
+    not bool {LWR at tableparcell} and
+    test {\ifnumcomp{\value{LWR at lateximagedepth}}{=}{0}}
+}%
+{%
+    \LWR at getmynexttoken%
+}{%
+    \LWR at origpar%
+}%
 }
 
 \end{warpHTML}
@@ -4001,6 +4091,7 @@
 
 \newcommand*{\LWR at startpars}%
 {%
+\LWR at traceinfo{LWR at startpars}%
 \ifnumcomp{\value{LWR at spandepth}}{>}{0}%
 {}%
 {%
@@ -4014,6 +4105,7 @@
     \global\setbool{LWR at doingstartpars}{true}%
     \global\boolfalse{LWR at doingapar}%
 }% nestspan
+\LWR at traceinfo{LWR at startpars: done}%
 }
 
 \newcommand*{\LWR at stoppars}%
@@ -4047,31 +4139,15 @@
 \newcommand{\LWR at firstpagetop}{} % for the home page alone
 \newcommand{\LWR at pagetop}{} % for all other pages
 \newcommand{\LWR at pagebottom}{}
-
-\newcommand{\LWR at setfirstpagetopb}[1]{%
-\renewcommand{\LWR at firstpagetop}{#1}
-\catcode`\_=8
+\newcommand{\HTMLFirstPageTop}[1]{%
+    \renewcommand{\LWR at firstpagetop}{#1}%
 }
-\newcommand{\HTMLFirstPageTop}{%
-\catcode`\_=12
-\LWR at setfirstpagetopb
+\newcommand{\HTMLPageTop}[1]{%
+    \renewcommand{\LWR at pagetop}{#1}%
 }
-\newcommand{\LWR at setpagetopb}[1]{%
-\renewcommand{\LWR at pagetop}{#1}
-\catcode`\_=8
+\newcommand{\HTMLPageBottom}[1]{%
+    \renewcommand{\LWR at pagebottom}{#1}%
 }
-\newcommand{\HTMLPageTop}{%
-\catcode`\_=12
-\LWR at setpagetopb
-}
-\newcommand{\LWR at setpagebottomb}[1]{%
-\renewcommand{\LWR at pagebottom}{#1}
-\catcode`\_=8
-}
-\newcommand{\HTMLPageBottom}{%
-\catcode`\_=12
-\LWR at setpagebottomb
-}
 
 \end{warpall}
 
@@ -4081,15 +4157,11 @@
 
 \newcommand*{\LWR at currentcss}{lwarp.css}
 
-\newcommand*{\LWR at newcssb}[1]{%
-\renewcommand*{\LWR at currentcss}{#1}
-\catcode`\_=8
+\newcommand*{\CSSFilename}[1]{%
+\renewcommand*{\LWR at currentcss}{#1}%
+\@onelevel at sanitize\LWR at currentcss%
 }
 
-\newcommand*{\CSSFilename}{
-\catcode`\_=12
-\LWR at newcssb
-}
 \end{warpHTML}
 \begin{warpprint}
 \newcommand*{\CSSFilename}[1]{}
@@ -4137,7 +4209,7 @@
 \begin{warpHTML}
 
 \newbox\LWR at footnotes
-\long\def\@makefntext#1{\textsuperscript{\@thefnmark} #1}
+\long\def\@makefntext#1{\textsuperscript{\@thefnmark}~#1}
 \def\@makefnmark{\hbox{\textsuperscript{\@thefnmark}}}
 \long\def\LWR at footnotetext#1{%
 \LWR at traceinfo{LWR at footnotetext}%
@@ -4169,9 +4241,10 @@
 }%
 
 \let\@footnotetext\LWR at footnotetext
+\newbox\LWR at mpfootnotes
 \long\def\@mpfootnotetext#1{%
-\global\setbox\@mpfootins\vbox{%
-    \unvbox\@mpfootins
+\global\setbox\LWR at mpfootnotes\vbox{%
+    \unvbox\LWR at mpfootnotes
     \reset at font\footnotesize
     \hsize\columnwidth
     \@parboxrestore
@@ -4216,6 +4289,17 @@
 {}%
 }
 
+\newcommand*{\LWR at printpendingmpfootnotes}{%
+\ifvoid\LWR at mpfootnotes\else
+    \LWR at forcenewpage
+    \begin{BlockClass}{footnotes}
+    \LWR at origvspace*{\baselineskip}
+    \unvbox\LWR at mpfootnotes
+    \setbox\LWR at mpfootnotes=\vbox{}
+    \end{BlockClass}
+\fi
+}
+
 \end{warpHTML}
 
 \begin{warpHTML}
@@ -4244,7 +4328,8 @@
 \end{BlockClass}
 }%
 }
-
+\renewcommand*{\reversemarginpar}{}
+\renewcommand*{\normalmarginpar}{}
 \end{warpHTML}
 
 \begin{warpprint}
@@ -4271,10 +4356,12 @@
 \newcommand*{\LWR at filenamenoblanks}[1]{%
 \begingroup
 
-\LWR at nullfonts
+\LWR at nullfonts%
 \renewcommand*{\LWR at htmltagc}[1]{}%
-\edef\LWR at thisnewfilename{#1}
-\fullexpandarg
+\LWR at traceinfo{LWR at filenamenoblanks \#1: !#1!}%
+\edef\LWR at thisnewfilename{#1}%
+\LWR at traceinfo{LWR at filenamenoblanks edef: !\LWR at thisnewfilename!}%
+\fullexpandarg%
 \StrSubstitute{\LWR at thisnewfilename}{ }{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{,}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{'}{-}[\LWR at thisnewfilename]
@@ -4294,6 +4381,8 @@
 \StrSubstitute{\LWR at thisnewfilename}%
     {\textgreater}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{\#}{-}[\LWR at thisnewfilename]
+\StrSubstitute{\LWR at thisnewfilename}{\_}{-}[\LWR at thisnewfilename]
+\StrSubstitute{\LWR at thisnewfilename}{\ }{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{\%}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{\{}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{\}}{-}[\LWR at thisnewfilename]
@@ -4301,6 +4390,7 @@
 \StrSubstitute{\LWR at thisnewfilename}%
     {\textbackslash}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{^}{-}[\LWR at thisnewfilename]
+\StrSubstitute{\LWR at thisnewfilename}{~}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{~{}}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{[}{-}[\LWR at thisnewfilename]
 \StrSubstitute{\LWR at thisnewfilename}{]}{-}[\LWR at thisnewfilename]
@@ -4334,6 +4424,7 @@
 }
 
 \newcommand*{\LWR at newhtmlfile}[1]{
+\LWR at traceinfo{LWR at newhtmlfile: !#1!}
 
 
 \LWR at htmlelementclassend{section}{textbody}
@@ -4364,6 +4455,7 @@
 {\LWR at filenamenoblanks{#1}}
 {\renewcommand*{\LWR at thisfilename}{\arabic{LWR at htmlfilenumber}}}
 
+\LWR at traceinfo{LWR at newhtmlfile: about to print start file}%
 \LWR at htmlblockcomment{%
 |Start file|%
 \LWR at htmlsectionfilename{\LWR at thisfilename}|%
@@ -4400,6 +4492,7 @@
 \LWR at stoppars
 
 \setcounter{LWR at latestautopage}{\value{page}}
+\LWR at traceinfo{LWR at newhtmlfile: done}
 }
 
 \end{warpHTML}
@@ -4441,10 +4534,13 @@
 }
 
 \newcommand*{\LWR at createautosec}[1]{%
-\LWR at htmltag{#1 id="autosec-\thepage"{}}%
+\LWR at htmltag{#1 id="autosec-\arabic{page}"}%
 }
 
-\NewDocumentCommand{\LWR at pushoneclose}{m m}{\pushclose{#2}{#1}}
+\NewDocumentCommand{\LWR at pushoneclose}{m m}{%
+\LWR at traceinfo{LWR at pushoneclose #1}%
+    \pushclose{#2}{#1}%
+}
 
 \NewDocumentCommand{\LWR at startnewdepth}{m m}{%
 \LWR at closeprevious{#1}%
@@ -4462,7 +4558,7 @@
 \LWR at stoppars%
 \global\boolfalse{LWR at minipagethispar}%
 \LWR at traceinfo{LWR at section: testing whether to start a new HTML file}%
-\IfBooleanTF{#1}{\LWR at traceinfo{LWR at section: starred}}{}%
+\IfBooleanT{#1}{\LWR at traceinfo{LWR at section: starred}}%
 \ifbool{LWR at forcinghtmlpage}{\LWR at traceinfo{LWR at section: forcinghtmlpage}}{}%
 \ifthenelse{%
     \(%
@@ -4478,7 +4574,11 @@
         \cnttest{\csuse{LWR at depth#4}}{<=}{\value{LWR at prevFileDepth}}%
     \)%
     \AND%
-    \NOT\isempty{#3}% phantomsection
+    \(% phantomsection
+        \NOT\isempty{#3}%
+        \OR%
+        \(\NOT\equal{#1}{\BooleanTrue}\)%
+    \)%
 }%
 {% new file
     \LWR at traceinfo{LWR at section: new HTML file}%
@@ -4487,7 +4587,7 @@
     {\LWR at newhtmlfile{#2}}%
 }% new file
 {% not new file
-    \LWR at traceinfo{LWR at section: not a new HTML file}%
+    \LWR at traceinfo{LWR at section: not a new HTML file, about to LWR at orignewpage}%
     \LWR at orignewpage%
 
 }% not new file
@@ -4508,10 +4608,12 @@
 }%
 {\LWR at startpars}%
 {}%
+\LWR at traceinfo{LWR at section: about to LWR at createautosec}%
 \LWR at createautosec{\csuse{LWR at tag#4}}%
 \setcounter{LWR at currentautosec}{\value{page}}
 \IfBooleanTF{#1}%
 {%
+\LWR at traceinfo{LWR at section: starred}%
 \ifbool{LWR at forcinghtmltoc}%
 {\addcontentsline{toc}{#4}{\IfValueTF{#2}{#2}{#3}}}%
 {}%
@@ -4564,8 +4666,11 @@
         \LWR at traceinfo{LWR at section: finished print section number}%
     }{}%
 }% end of not starred
+\LWR at traceinfo{LWR at section: about to print the section name}%
 #3%
+\LWR at traceinfo{LWR at section: about to close the heading tag}%
 \LWR at htmltag{\csuse{LWR at tag#4end}}%
+\LWR at traceinfo{LWR at section: about to create the LaTeX label}%
 \label{autopage-\theLWR at currentautosec}%
 \ifthenelse{%
     \cnttest{\csuse{LWR at depth#4}}{<}{\LWR at depthparagraph}%
@@ -4611,14 +4716,18 @@
 \@ifundefined{chapter}
 {}
 {%
-\DeclareDocumentCommand{\chapter}{s o m}{%
-\LWR at traceinfo{chapter #3}%
+\DeclareDocumentCommand{\chapter}{s o o m}{%
+\IfValueTF{#2}{
+\LWR at traceinfo{chapter #2}%
+}{
+\LWR at traceinfo{chapter #4}%
+}
 \LWR at maybeprintpendingfootnotes{\LWR at depthchapter}%
 \LWR at stoppars%
 
 \LWR at startnewdepth{\LWR at depthchapter}{\LWR at printclosechapter}%
 
-\LWR at section{#1}{#2}{#3}{chapter}%
+\LWR at section{#1}{#2}{#4}{chapter}%
 
 \@printcites% for quotchap package
 
@@ -4627,13 +4736,18 @@
 }
 }
 
-\DeclareDocumentCommand{\section}{s o m}{%
+\DeclareDocumentCommand{\section}{s o o m}{%
+\IfValueTF{#2}{
+\LWR at traceinfo{section #2}%
+}{
+\LWR at traceinfo{section #4}%
+}
 \LWR at maybeprintpendingfootnotes{\LWR at depthsection}%
 \LWR at stoppars%
 
 \LWR at startnewdepth{\LWR at depthsection}{\LWR at printclosesection}%
 
-\LWR at section{#1}{#2}{#3}{section}%
+\LWR at section{#1}{#2}{#4}{section}%
 }
 
 \DeclareDocumentCommand{\subsection}{s o m}{%
@@ -4697,7 +4811,7 @@
 \LWR at traceinfo{LWR at filestart: B}
 \LWR at htmltag{!DOCTYPE html}\LWR at orignewline
 \LWR at traceinfo{LWR at filestart: C}
-\LWR at htmltag{html lang="\LWR at currentHTMLLanguage"{}}\LWR at orignewline
+\LWR at htmltag{html lang="\LWR at currentHTMLLanguage"}\LWR at orignewline
 \LWR at htmltag{head}\LWR at orignewline
 \LWR at htmltag{meta charset="UTF-8" /}\LWR at orignewline
 \ifthenelse{\equal{\theHTMLAuthor}{}}%
@@ -4715,7 +4829,7 @@
     \LWR at orignewline
 \LWR at htmltag{!{-}{-}[if lt IE 9]}\LWR at orignewline
 \LWR at htmltag{%
-script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"{}}%
+script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"}%
 \LWR at htmltag{/script}\LWR at orignewline
 \LWR at htmltag{![endif]{-}{-}}\LWR at orignewline
 \ifthenelse{\equal{\theHTMLTitle}{}}%
@@ -4759,7 +4873,7 @@
 \edef\LWR at strresult{\HTMLFilename}
 \edef\HTMLFilename{\detokenize\expandafter{\LWR at strresult}}
 \LWR at origonecolumn%
-\LWR at origpagestyle{empty}
+\LWR at origpagestyle{empty}%
 \LWR at origscriptsize%
 \LWR at origraggedright%
 \LetLtxMacro{\\}{\LWR at endofline}%
@@ -4788,6 +4902,8 @@
 \let\ConTeXt\LWR at ConTeXt
 \global\boolfalse{LWR at doingapar}
 \global\boolfalse{LWR at doingstartpars}
+\mainmatter
+\LWR at origpagenumbering{arabic}
 \LWR at traceinfo{LWR at lwarpStart: Starting new file.}
 \LWR at filestart{}
 \LWR at traceinfo{LWR at lwarpStart: Generating first header.}
@@ -4797,9 +4913,7 @@
 \LWR at stoppars
 \LWR at htmltag{/header}\LWR at orignewline
 \LWR at traceinfo{LWR at lwarpStart: Generating textbody.}
-\LWR at htmltag{section class="textbody"{}}
-\mainmatter
-\LWR at origpagenumbering{arabic}
+\LWR at htmltag{section class="textbody"}
 \LWR at patchlists
 \catcode`\$=\active
 \LWR at startpars
@@ -4865,7 +4979,7 @@
 }% AtBeginDocument
 \end{warpprint}
 \begin{warpHTML}
-\renewenvironment*{titlepage}
+\DeclareDocumentEnvironment{titlepage}{}
 {
 \renewrobustcmd{\affiliation}[1]{\\ \InlineClass{affiliation}{##1}}
 \LWR at printpendingfootnotes
@@ -4930,6 +5044,12 @@
 \newcommand*{\printdate}{{\small\textit{\@date}}}
 \end{warpprint}
 \begin{warpHTML}
+\@ifclassloaded{memoir}
+{
+\newcommand{\LWR at setfootnoteseries}{%
+    \renewcommand\thefootnote{\@arabic\c at footnote}%
+}
+}{% not memoir
 \if at titlepage
 \newcommand{\LWR at setfootnoteseries}{%
     \renewcommand\thefootnote{\@arabic\c at footnote}%
@@ -4939,11 +5059,12 @@
     \renewcommand\thefootnote{\@fnsymbol\c at footnote}%
 }
 \fi
+}% not memoir
 \newcommand*{\LWR at maketitlesetup}{%
 \LWR at setfootnoteseries%
 \def\@makefnmark{\textsuperscript{\thefootnote}}
 \long\def\@makefntext##1{%
-\textsuperscript{\@thefnmark} \LWR at orighspace{1in}
+\textsuperscript{\@thefnmark}~%
 ##1%
 }%
 }
@@ -5118,7 +5239,7 @@
 \ifbool{LWR at verbtags}{%
     \LWR at htmltag{pre class="#2"
     \ifthenelse{\equal{#1}{}}{}{style="#1"}%
-}% pre
+}\LWR at orignewline% pre
 }{}%
 \begingroup%
 \LWR at origttfamily%
@@ -5128,8 +5249,8 @@
 }
 
 \newcommand*{\LWR at afterendverbatim}{%
+
 \endgroup%
-\unskip%
 \ifbool{LWR at verbtags}{\noindent\LWR at htmltag{/pre}
 
 }{}%
@@ -5148,8 +5269,8 @@
 \AfterEndPreamble{
 \LWR at traceinfo{Patching verbatim.}
 \AtBeginEnvironment{verbatim}{%
-\LWR at forcenewpage
-\LWR at atbeginverbatim{verbatim}\unskip\LWR at origvspace*{-\baselineskip}%
+\LWR at forcenewpage%
+\LWR at atbeginverbatim{verbatim}\unskip\LWR at origvspace*{-2\baselineskip}%
 }
 \AfterEndEnvironment{verbatim}{%
     \unskip\LWR at origvspace*{-\baselineskip}\LWR at afterendverbatim%
@@ -5175,14 +5296,17 @@
 \renewcommand{\@begintheorem}[2]{%
 \LWR at forcenewpage
 \BlockClass{theoremcontents}
-\InlineClass{theoremlabel}{#1\ #2\ }
+\trivlist
+\item[\InlineClass{theoremlabel}{#1\ #2\ }]\itshape
 }
 \renewcommand{\@opargbegintheorem}[3]{%
 \LWR at forcenewpage
 \BlockClass{theoremcontents}
-\InlineClass{theoremlabel}{#1\ #2\ (#3)\ }
+\trivlist
+\item[\InlineClass{theoremlabel}{#1\ #2\ (#3)\ }]\itshape
 }
 \renewcommand*{\@endtheorem}{%
+\endtrivlist
 \endBlockClass% theoremcontents
 }
 
@@ -5193,6 +5317,45 @@
 \newcommand*{\LWR at printcloselist}{\LWR at printcloseitemize}
 \newcommand*{\LWR at printopenlist}{ul style="list-style-type:none"}
 
+
+\def\@mklab#1{%
+    #1}
+
+\def\@donoparitem{%
+  \@noparitemfalse
+}
+\def\@item[#1]{%
+  \if at noparitem
+    \@donoparitem
+  \else
+        \par
+    \ifhmode
+        \par
+    \fi
+    \if at newlist
+      \if at nobreak
+        \@nbitem
+      \else
+      \fi
+    \else
+    \fi
+    \global\@inlabeltrue
+  \fi
+    \@minipagefalse
+    \global\@newlistfalse
+  \if at noitemarg
+    \@noitemargfalse
+    \if at nmbrlist
+      \refstepcounter\@listctr
+    \fi
+  \fi
+        #1
+  \ignorespaces%
+}
+
+\def\@nbitem{%
+}
+
 \newcommand*{\LWR at listitem}{%
 \LWR at stoppars%
 \LWR at startnewdepth{\LWR at depthlistitem}{\LWR at printcloselistitem}%
@@ -5202,6 +5365,7 @@
 }
 
 \newcommand*{\LWR at liststart}{%
+\LWR at traceinfo{LWR at liststart}%
 \LWR at stoppars%
 \LWR at pushoneclose{\LWR at depthlist}{\LWR at printcloselist}%
 \LWR at htmltag{\LWR at printopenlist}\LWR at orignewline%
@@ -5216,11 +5380,10 @@
 \setlength{\itemindent}{0pt}%
 \setlength{\labelsep}{1em}%
 }
-
 \newcommand*{\LWR at listend}{%
+\LWR at traceinfo{LWR at listend}%
 \LWR at stoppars%
-\LWR at closeprevious{\LWR at depthlistitem}%
-\LWR at closeoneprevious%
+\LWR at closeprevious{\LWR at depthlist}%
 \LWR at startpars%
 }
 
@@ -5256,7 +5419,6 @@
 \LetLtxMacro{\hspace}{\LWR at nohspace}%
 \LWR at origitem[]%
 \LetLtxMacro{\hspace}{\LWR at hspace}%
-\LWR at orighspace{1in}
 \LWR at htmltag{dt}#1\LWR at htmltag{/dt}%
 \LWR at orignewline%
 \LWR at htmltag{dd}%
@@ -5277,11 +5439,18 @@
 \newcommand*{\LWR at patchlists}{%
     \let\item\LWR at listitem%
     \renewcommand*{\@trivlist}{%
+        \LWR at traceinfo{@trivlist start}%
         \LWR at liststart%
         \LWR at orig@trivlist%
+        \LWR at traceinfo{@trivlist done}%
     }%
-    \renewcommand*{\endtrivlist}{\LWR at origendtrivlist\LWR at listend}%
+    \renewcommand*{\endtrivlist}{%
+        \LWR at traceinfo{endtrivlist start}%
+        \LWR at origendtrivlist\LWR at listend%
+        \LWR at traceinfo{endtrivlist done}%
+    }%
     \renewcommand*{\trivlist}{%
+        \LWR at traceinfo{trivlist}%
         \LWR at origtrivlist%
         \def\makelabel####1{\LWR at orighspace{3em}####1}%
     }%
@@ -5356,7 +5525,34 @@
 \newbool{LWR at intabularmetadata}
 \boolfalse{LWR at intabularmetadata}
 
+\newcounter{LWR at tabulardepth}
+\setcounter{LWR at tabulardepth}{0}
+\newcounter{LWR at tabularpardepth}
+\setcounter{LWR at tabularpardepth}{0}
+\newcommand*{\LWR at colsresult}{}%temp storage for column format results
+\newcommand*{\LWR at pposition}{}
+\newcommand*{\LWR at pleft}{}
+\newcommand*{\LWR at pright}{}
 
+\newcommand*{\LWR at tablecolspec}{}
+
+\providecommand*{\LWR at strresult}{}
+\providecommand*{\LWR at strresulttwo}{}
+
+\newcommand*{\LWR at origcolspec}{}
+
+\newcounter{LWR at tablecolspecwidth}
+
+\newcounter{LWR at tablecolspecindex}
+
+\newcounter{LWR at tablecolindex}
+
+\newcounter{LWR at tabletotalcols}
+
+\newcounter{LWR at tabletotalcolsnext}
+
+
+
 \newcommand*{\LWR at insertatbangcols}{%
 \ifbool{LWR at skipatbang}%
 {}%
@@ -5396,20 +5592,16 @@
 \global\boolfalse{LWR at skippingmcolrowcell}%
 \global\boolfalse{LWR at skipatbang}%
 }
-
-\newcounter{LWR at tabulardepth}
-\setcounter{LWR at tabulardepth}{0}
-
 \let\LWR at origampmacro&
 
 \end{warpHTML}
 \begin{warpall}
 \newcommand{\StartDefiningTabulars}{%
-\LWR at traceinfo{StartDefiningTabulars}
+\LWR at traceinfo{StartDefiningTabulars}%
 \warpHTMLonly{\catcode`\&=\active}%
 }
 \newcommand{\EndDefiningTabulars}{%
-\LWR at traceinfo{EndDefiningTabulars}
+\LWR at traceinfo{EndDefiningTabulars}%
 \warpHTMLonly{\catcode`\&=4}%
 }
 
@@ -5487,30 +5679,6 @@
 \LWR at getmynexttoken%
 }
 
-
-\newcommand*{\LWR at colsresult}{}%temp storage for column format results
-\newcommand*{\LWR at pposition}{}
-\newcommand*{\LWR at pleft}{}
-\newcommand*{\LWR at pright}{}
-
-\newcommand*{\LWR at tablecolspec}{}
-
-\providecommand*{\LWR at strresult}{}
-\providecommand*{\LWR at strresulttwo}{}
-
-\newcommand*{\LWR at origcolspec}{}
-
-\newcounter{LWR at tablecolspecwidth}
-
-\newcounter{LWR at tablecolspecindex}
-
-\newcounter{LWR at tablecolindex}
-
-\newcounter{LWR at tabletotalcols}
-
-\newcounter{LWR at tabletotalcolsnext}
-
-
 \newcommand*{\LWR at colparameter}{}
 \newcommand*{\LWR at parseatcolumn}{%
 \LWR at traceinfo{at column}%
@@ -5710,6 +5878,7 @@
 
 
 \newcommand*{\LWR at printbartag}[1]{%
+\LWR at traceinfo{LWR at printbartag !#1!}%
 \ifboolexpr{bool{LWR at tabularmutemods} or bool{LWR at emptyatbang}}%
 {}% muting or empty
 {% not muting
@@ -5716,6 +5885,7 @@
     \edef\LWR at tempone{\LWR at getexparray{LWR at colbarspec}{#1}}%
     \ifdefempty{\LWR at tempone}{}{ \LWR at tempone}%
 }% not muting
+\LWR at traceinfo{LWR at printbartag done}%
 }
 
 
@@ -5762,6 +5932,7 @@
 
 \newcommand*{\LWR at tabledatasinglecolumntag}%
 {%
+\LWR at traceinfo{LWR at tabledatasinglecolumntag}%
 \LWR at maybenewtablerow%
 \ifbool{LWR at intabularmetadata}%
 {%
@@ -5769,6 +5940,7 @@
     {% not exiting tabular
         \LWR at tabularleftedge%
         \StrChar{\LWR at tablecolspec}{\arabic{LWR at tablecolindex}}[\LWR at strresult]%
+\LWR at traceinfo{LWR at tabledatasinglecolumntag: about to print td tag}%
         \LWR at htmltag{td class="td%
         \LWR at strresult%
         \LWR at addcmidruletrim%
@@ -5781,6 +5953,7 @@
         \LWR at addformatwpalignment{\LWR at thiscolspec}%
         \LWR at tdendstyles%
         }%
+\LWR at traceinfo{LWR at tabledatasinglecolumntag: done printing td tag}%
         \ifboolexpr{%
             test{ \ifdefstring{\LWR at strresult}{p} } or
             test{ \ifdefstring{\LWR at strresult}{m} } or
@@ -5791,8 +5964,10 @@
             test{ \ifdefstring{\LWR at strresult}{X} }
         }%
         {% allow pars
+            \LWR at traceinfo{LWR at tabledatasinglecolumntag: about to LWR at startpars}%
+            \global\booltrue{LWR at tableparcell}%
             \LWR at startpars%
-            \global\booltrue{LWR at tableparcell}%
+            \LWR at traceinfo{LWR at tabledatasinglecolumntag: done with LWR at startpars}%
         }% allow pars
         {}% no pars
         \ifboolexpr{bool{LWR at tabularmutemods} or bool{LWR at emptyatbang}}%
@@ -5803,6 +5978,7 @@
         \global\boolfalse{LWR at intabularmetadata}%
     }% not exiting tabular
 }{}% in tabular metadata
+\LWR at traceinfo{LWR at tabledatasinglecolumntag: done}%
 }%
 
 
@@ -6272,6 +6448,10 @@
     {\let\mynext\LWR at donothing}{}%
 \ifdefequal{\LWR at mynexttoken}{\hline}%
     {\let\mynext\LWR at donothing}{}%
+\ifdefequal{\LWR at mynexttoken}{\firsthline}%
+    {\let\mynext\LWR at donothing}{}%
+\ifdefequal{\LWR at mynexttoken}{\lasthline}%
+    {\let\mynext\LWR at donothing}{}%
 \ifdefequal{\LWR at mynexttoken}{\toprule}%
     {\let\mynext\LWR at donothing}{}%
 \ifdefequal{\LWR at mynexttoken}{\midrule}%
@@ -6292,7 +6472,11 @@
     {\let\mynext\LWR at donothing}{}%
 \ifdefequal{\LWR at mynexttoken}{\rdelim}%
     {\let\mynext\LWR at donothing}{}%
+\ifdefequal{\LWR at mynexttoken}{\par}%
+    {\let\mynext\LWR at donothing}{}%
+\LWR at traceinfo{LWR at tabledatacolumntag: about to do mynext}%
 \mynext%
+\LWR at traceinfo{LWR at tabledatacolumntag: done}%
 }
 
 \end{warpHTML}
@@ -6432,11 +6616,13 @@
 \global\boolfalse{LWR at emptyatbang}%
 \StartDefiningTabulars%
 \protected\gdef&{\LWR at tabularampersand}%
+\addtocounter{LWR at tabularpardepth}{1}%
 \LWR at traceinfo{LWR at tabular: about to LWR at getmynexttoken}%
 \LWR at getmynexttoken%
 }%
 {%
 \LWR at traceinfo{LWR at tabular ending}%
+\addtocounter{LWR at tabularpardepth}{-1}%
 \ifboolexpr{%
     test {%
         \ifnumcomp{\value{LWR at tablecolindex}}{<}{\value{LWR at tabletotalcols}}
@@ -6469,8 +6655,6 @@
 \end{warpHTML}
 
 
-
-
 \begin{warpHTML}
 
 
@@ -6498,7 +6682,8 @@
 \zref at addprop{special}{zLWR at lateximagedepth}
 \zref at addprop{special}{zLWR at lateximagenumber}
 \newcommand*{\LWR at spref}[2]{%
-\zref at extractdefault{#1}{#2}{??}}
+\zref at extractdefault{#1}{#2}{??}%
+}
 \newcommand*{\LWR at nameref}[1]{%
 \LWR at spref{#1}{zLWR at name}%
 }
@@ -6512,40 +6697,44 @@
 \LWR at spref{#1}{zLWR at lateximagenumber}%
 }
 \newcommand*{\LWR at splabel}[1]{%
+\LWR at traceinfo{LWR at splabel !#1!}%
 \LWR at setlatestname{\@currentlabelname}%
-\zref at labelbylist{#1}{special}}
+\zref at labelbylist{#1}{special}%
+}
 
 
-\newcommand*{\LWR at subsublabel}[1]{%
+\newcommand*{\LWR at sublabel}[1]{%
+\LWR at traceinfo{LWR at sublabel !#1!}%
 \ifnumcomp{\value{LWR at lateximagedepth}}{>}{0}%
 {}%
 {% not lateximage
+    \LWR at sanitize{#1}%
     \ifbool{LWR at doingstartpars}%
     {% pars allowed
-        \ifbool{LWR at doingapar}
+        \ifbool{LWR at doingapar}%
         {% par started
-            \LWR at htmltag{a id="#1"{}}\LWR at htmltag{/a}%
+            \LWR at htmltag{a id="\LWR at sanitized"}\LWR at htmltag{/a}%
         }% par started
         {% par not started
             \LWR at stoppars%
-            \LWR at htmltag{a id="#1"{}}\LWR at htmltag{/a}%
+            \LWR at htmltag{a id="\LWR at sanitized"}\LWR at htmltag{/a}%
             \LWR at startpars%
         }% par not started
     }% pars allowed
     {% pars not allowed
-        \LWR at htmltag{a id="#1"{}}\LWR at htmltag{/a}%
+        \LWR at htmltag{a id="\LWR at sanitized"}\LWR at htmltag{/a}%
     }% pars not allowed
 }% not lateximage
 }
-\NewDocumentCommand{\LWR at newlabel}{m o}{%
+\NewDocumentCommand{\LWR at newlabel}{d() m o}{%
 \LWR at traceinfo{LWR at newlabel: starting}%
-\LWR at traceinfo{LWR at newlabel: !#1!}%
-\LWR at origlabel{#1}%
+\LWR at traceinfo{LWR at newlabel: !#2!}%
+\LWR at origlabel{#2}%
 \LWR at traceinfo{LWR at newlabel: filesectionnames is \ifbool{FileSectionNames}{true}{false}}%
 \LWR at traceinfo{LWR at newlabel: LWR at thisfilename is !\LWR at thisfilename!}%
 \LWR at traceinfo{LWR at newlabel: LWR at htmlfilenumber is \arabic{LWR at htmlfilenumber}}%
-\LWR at splabel{#1}%
-\LWR at subsublabel{#1}%
+\LWR at splabel{#2}%
+\LWR at sublabel{#2}%
 \LWR at traceinfo{LWR at newlabel: done}%
 }
 
@@ -6553,6 +6742,7 @@
 \newcommand*{\LWR at startref}[1]
 {%
 \edef\LWR at lidref{\LWR at lateximagedepthref{#1}}%
+\LWR at sanitize{#1}%
 \LWR at traceinfo{LWR at startref A: !#1!}%
 \LWR at htmltag{a href="%
 \LWR at traceinfo{LWR at startref B}%
@@ -6574,11 +6764,11 @@
     }%
     {%
         \LWR at traceinfo{LWR at startref D3}%
-        #1%
+        \LWR at sanitized%
     }%
 }%
 \LWR at traceinfo{LWR at startref E}%
-"{}}%
+"}%
 \LWR at traceinfo{LWR at startref F}%
 }
 
@@ -6590,7 +6780,7 @@
 }
 
 \NewDocumentCommand{\LWR at newref}{s m}{%
-\LWR at traceinfo{LWR at newref #2}%
+\LWR at traceinfo{LWR at newref !#2!}%
 \IfBooleanTF{#1}%
 {\LWR at origref{#2}}%
 {\LWR at subnewref{#2}{#2}}%
@@ -6613,59 +6803,65 @@
 \LWR at traceinfo{nameref D}%
 }
 
-\let\Nameref\nameref
+\LetLtxMacro\Nameref\nameref
 
 
 
 
+\AtBeginDocument{
+\def\@currentHref{%
+autopage-\theLWR at currentautosec%
+}
+}
 
+
 \NewDocumentCommand{\LWR at subhyperref}{m +m}{%
-\LWR at htmltag{a href="{#1}" target="\_{}blank"\LWR at orignewline}#2\LWR at htmltag{/a}%
+\LWR at traceinfo{LWR at subhyperref !#1!}%
+\LWR at sanitize{#1}%
+\LWR at htmltag{%
+    a href="\LWR at sanitized" %
+    target="\_{}blank"\LWR at orignewline%
+}%
+#2%
+\LWR at htmltag{/a}%
 \LWR at ensuredoingapar%
 }
 
 \NewDocumentCommand{\LWR at subhyperrefclass}{m +m m}{%
-\LWR at htmltag{a href="{#1}"
-class="#3"\LWR at orignewline}#2\LWR at htmltag{/a}%
+\LWR at htmltag{%
+    a href="%
+        \begingroup\@sanitize#1\endgroup%
+    " %
+    class="#3"\LWR at orignewline%
+}%
+#2%
+\LWR at htmltag{/a}%
 \LWR at ensuredoingapar%
 }
 
-\NewDocumentCommand{\LWR at hrefb}{O{} m +m}{%
+\NewDocumentCommand{\href}{O{} m +m}{%
+\LWR at ensuredoingapar%
 \LWR at subhyperref{#2}{#3}%
-\endgroup%
-\LWR at ensuredoingapar%
 }
 
-\DeclareRobustCommand*{\href}{%
+\newcommand*{\nolinkurl}[1]{%
 \LWR at ensuredoingapar%
-\begingroup%
-\catcode`\_=12
-\LWR at hrefb%
+\def\LWR at templink{#1}%
+\@onelevel at sanitize\LWR at templink%
+\LWR at templink%
 }
 
-\newcommand*{\LWR at nolinkurlb}[1]{#1\endgroup\LWR at ensuredoingapar}
-
-\DeclareRobustCommand*{\nolinkurl}{%
+\NewDocumentCommand{\url}{m}{%
 \LWR at ensuredoingapar%
-\begingroup\catcode`\_=12
-\LWR at nolinkurlb%
+\def\LWR at templink{#1}%
+\@onelevel at sanitize\LWR at templink%
+\href{\LWR at templink}{\LWR at templink}%
 }
 
-\NewDocumentCommand{\LWR at urlb}{m}{%
-\LWR at hrefb{#1}{#1}%
-}
-
-\DeclareRobustCommand*{\url}{%
-\LWR at ensuredoingapar%
-\begingroup\catcode`\_=12
-\LWR at urlb%
-}
-
-
 \newcommand*{\LWR at subinlineimage}[5][]{%
 \ifblank{#1}%
-{\LWR at htmltag{img src="#3.#4" alt="#3" style="#5" class="#2"{}}}%
-{\LWR at htmltag{img src="#3.#4" alt="#1" style="#5" class="#2"{}}}%
+{\LWR at htmltag{img src="#3.#4" alt="#3" style="#5" class="#2"}}%
+{\LWR at htmltag{img src="#3.#4" alt="#1" style="#5" class="#2"}}%
 }
 
 \end{warpHTML}
@@ -6719,16 +6915,16 @@
 
 \newcounter{LWR at thisautoid}
 
+\newcounter{LWR at thisautoidWP}
+
 \newbool{LWR at freezethisautoid}
 \boolfalse{LWR at freezethisautoid}
 
-\newcommand*{\LWR at maybeincthisautoid}{%
-\ifbool{LWR at freezethisautoid}{}{\addtocounter{LWR at thisautoid}{1}}%
-}
-
 \newcommand*{\LWR at newautoidanchor}{%
-\LWR at maybeincthisautoid%
-\LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"{}}\LWR at htmltag{/a}%
+\ifbool{LWR at freezethisautoid}{}{%
+    \addtocounter{LWR at thisautoid}{1}%
+    \LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"}\LWR at htmltag{/a}%
+}%
 }
 
 \newcommand*{\@captype}{}
@@ -6800,7 +6996,7 @@
 
 \def\LWR at LTcaptionlistentry{%
 \LWR at ensuredoingapar%
-\LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"{}}\LWR at htmltag{/a}%
+\LWR at htmltag{a id="autoid-\arabic{LWR at thisautoid}"}\LWR at htmltag{/a}%
   \bgroup
   \@ifstar{\egroup\LWR at LT@captionlistentry}% gobble *
           {\egroup\LWR at LT@captionlistentry}}%
@@ -6821,7 +7017,6 @@
 }% not TOC
 \LWR at origaddcontentsline{#1}{#2}{#3}%
 }
-
 \AtBeginDocument{
 \let\LWR at origcaptionof\captionof
 
@@ -6837,16 +7032,18 @@
 \begin{warpHTML}
 
 
-
-\newcommand*{\LWR at myshorttoc}[1]{
-\LWR at ensuredoingapar
-\IfFileExists{\jobname.#1}{
-\begingroup
-\makeatletter
-\@input{\jobname.#1}
-\endgroup
+\newcommand*{\LWR at myshorttoc}[1]{%
+\LWR at traceinfo{LWR at myshorttoc: #1}%
+\LWR at ensuredoingapar%
+\IfFileExists{\jobname.#1}{%
+\LWR at traceinfo{LWR at myshorttoc: loading}%
+\begingroup%
+\makeatletter%
+\@input{\jobname.#1}%
+\endgroup%
 }%
 {}%
+\LWR at traceinfo{LWR at myshorttoc: done}%
 }
 
 \NewDocumentCommand{\LWR at subtableofcontents}{m m}{%
@@ -6867,6 +7064,9 @@
 \LWR at orig@starttoc{#1}
 \LWR at htmlelementclassend{nav}{#1}
 }
+\newbool{LWR at copiedsidetoc}
+\boolfalse{LWR at copiedsidetoc}
+\AtBeginDocument{
 \let\LWR at origtableofcontents\tableofcontents
 
 \renewcommand*{\tableofcontents}{%
@@ -6876,11 +7076,15 @@
 
 }
 {
-    \LWR at copyfile{\jobname.toc}{\jobname.sidetoc}%
+    \ifbool{LWR at copiedsidetoc}{}{%
+        \LWR at copyfile{\jobname.toc}{\jobname.sidetoc}%
+        \booltrue{LWR at copiedsidetoc}%
+    }%
     \LWR at printpendingfootnotes
     \LWR at origtableofcontents
 }
-}
+}% \tableofcontents
+}% AtBeginDocument
 
 \let\LWR at origlistoffigures\listoffigures
 
@@ -6960,20 +7164,27 @@
 \LetLtxMacro\numberline\LWR at numberline
 
 \NewDocumentCommand{\hypertoc}{m m +m m}{%
+\LWR at traceinfo{hypertoc !#1!#2!#3!#4!}%
 \ifthenelse{\cnttest{#1}{<=}{\value{tocdepth}}}{%
     \LWR at startpars%
     \LWR at subhyperrefclass{%
-    \LWR at htmlrefsectionfilename{autopage-#4}\#autosec-#4}{#3}{toc#2}%
+        \LWR at htmlrefsectionfilename{autopage-#4}\#autosec-#4%
+    }{#3}{toc#2}%
     \LWR at stoppars%
 }
 {}
+\LWR at traceinfo{hypertoc done}%
 }
 
+\@ifclassloaded{memoir}{}{
 \newcounter{lofdepth}
 \setcounter{lofdepth}{1}
+}
 
+\@ifclassloaded{memoir}{}{
 \newcounter{lotdepth}
 \setcounter{lotdepth}{1}
+}
 
 \newcommand{\hypertocfloat}[5]{%
 \LWR at startpars
@@ -7053,9 +7264,9 @@
 
 \def\LWR at wrindex#1{%
 \addtocounter{LWR at autoindex}{1}%
-\LWR at newlabel{LWRindex-\theLWR at autoindex}%
+\LWR at newlabel{LWRindex-\arabic{LWR at autoindex}}%
 \protected at write\@indexfile{}%
-{\string\indexentry{#1}{\theLWR at autoindex}}%
+{\string\indexentry{#1}{\arabic{LWR at autoindex}}}%
 \endgroup
 \@esphack}
 
@@ -7080,7 +7291,29 @@
 \begin{warpall}
 \providecommand{\glo at name}{}
 \end{warpall}
+\begin{warpHTML}
+\AtBeginDocument{
+\AtBeginEnvironment{thebibliography}{
+\providecommand*{\LWR at newem}[1]{\textit{#1}}
 
+\renewrobustcmd{\em}{%
+  \begingroup
+    \gdef\LWR at em@after{\LWR at em@finish\LWR at newem}%
+    \afterassignment\LWR at em@after
+    \toks@\bgroup
+}
+
+\def\LWR at em@finish#1{%
+    \xdef\LWR at em@after{\noexpand#1{\the\toks@}}%
+  \endgroup
+  \LWR at em@after\egroup
+}
+}% \AtBeginEnvironment{thebibliography}
+}% \AtBeginDocument
+
+\end{warpHTML}
+
+\begin{warpHTML}
 \newcommand*{\LWR at restoreorigformatting}{%
 \LWR at traceinfo{LWR at restoreorigformatting}%
 \linespread{1}%
@@ -7150,7 +7383,7 @@
 \LetLtxMacro{\fminipage}{\LWRprint at fminipage}%
 \LetLtxMacro{\endfminipage}{\endLWRprint at fminipage}%
 \LetLtxMacro{\minipage}{\LWR at origminipage}%
-\let\endminipage\LWR at endminipage%
+\let\endminipage\LWR at origendminipage%
 \LetLtxMacro{\parbox}{\LWR at origparbox}%
 \let\TeX\LWR at origTeX%
 \let\LaTeX\LWR at origLaTeX%
@@ -7163,7 +7396,7 @@
 \LWR at restoreoriglists%
 \LWR at FBcancel%
 }
-
+\end{warpHTML}
 \begin{warpHTML}
 
 \let\LWR at origtextdollar\$
@@ -7332,7 +7565,7 @@
 \boolfalse{LWR at amsmultline}
 
 \newcommand*{\LWR at htmlmathlabel}[1]{%
-\LWR at traceinfo{LWR at htmlmathlabel #1}%
+\LWR at traceinfo{LWR at htmlmathlabelb #1}%
 \ifboolexpr{bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) }%
 {%
     \text{
@@ -7747,7 +7980,7 @@
 
 \NewDocumentEnvironment{lateximage}{O{image}}
 {%
-\LWR at traceinfo{lateximage: starting on page \arabic{page}}%
+\LWR at traceinfo{lateximage: starting on \jobname.pdf page \arabic{page}}%
 \ifthenelse{\cnttest{\value{LWR at lateximagedepth}}{>}{0}}%
 {%
     \addtocounter{LWR at lateximagedepth}{1}%
@@ -7767,9 +8000,9 @@
     \setcounterpageref{LWR at LIpage}{LWRlateximage\arabic{LWR at lateximagenumber}}%
     \LWR at traceinfo{lateximage: LWR at LIpage is \arabic{LWR at LIpage}}%
     \LWR at htmltag{span id="lateximage\arabic{LWR at lateximagenumber}" %
-    class="lateximagesource"{}} \LWR at orignewline
+    class="lateximagesource"} \LWR at orignewline
     \LWR at traceinfo{lateximage: about to write to lateximages.txt}%
-    \immediate\write\LWR at lateximagesfile{|\theLWR at LIpage|\theLWR at externalfilecnt|}%
+    \immediate\write\LWR at lateximagesfile{|\arabic{LWR at LIpage}|\arabic{LWR at externalfilecnt}|}%
     \LWR at traceinfo{lateximage: about to create open comment}%
     \LWR at htmlopencomment%
     \addtocounter{LWR at lateximagedepth}{1}%
@@ -7803,6 +8036,7 @@
     \LWR at origendminipage%
     \LWR at orignewpage%
     \LWR at origscriptsize%
+    \LWR at origvspace*{.5\baselineskip}%
     \LWR at htmlclosecomment{}\LWR at orignewline%
     \LWR at traceinfo{lateximage: The page after the image is \arabic{page}}%
     \LWR at subinlineimage[#1]{lateximage}%
@@ -8059,35 +8293,6 @@
 
 \newlength{\LWR at minipagewidth}
 \newlength{\LWR at minipageheight}
-\def\LWR at endminipage{%
-    \par
-    \unskip
-    \ifvoid\@mpfootins\else
-      \vskip\skip\@mpfootins
-      \normalcolor
-        \LWR at htmldivclass{mpfootnotes}
-        \LWR at origmedskip
-      \unvbox\@mpfootins
-        \LWR at htmldivclassend{mpfootnotes}
-    \fi
-    \@minipagefalse
-  \color at endgroup
-  \egroup
-  \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}}
-
-\newcommand*{\LWR at subminipage}{%
-\LWR at stoppars
-\LWR at origminipage{6in}
-\LWR at origraggedright%
-\LWR at startpars%
-}
-
-\newcommand*{\LWR at endsubminipage}{%
-\LWR at stoppars%
-\LWR at endminipage% The following empty line is required:
-
-}
-
 \newbool{LWR at minipagefullwidth}
 \boolfalse{LWR at minipagefullwidth}
 \newcommand*{\minipagefullwidth}{\booltrue{LWR at minipagefullwidth}}
@@ -8101,14 +8306,16 @@
 \RenewDocumentEnvironment{minipage}{O{t} o O{t} m}
 {%
 \uselengthunit{PT}%
+\begingroup
 \setlength{\LWR at minipagewidth}{#4}%
 \ifthenelse{\cnttest{\value{LWR at minipagedepth}}{=}{0}}{%
+    \LWR at orignewpage%
     \addtolength{\LWR at minipagewidth}{3em}% room for frames
     \setlength{\linewidth}{6in}%
     \setlength{\textwidth}{6in}%
     \setlength{\textheight}{9in}%
 }{}%
-\LWR at traceinfo{computed width is \rndprintlength{\LWR at minipagewidth}}
+\LWR at traceinfo{computed width is \rndprintlength{\LWR at minipagewidth}}%
 \setlength{\LWR at minipageheight}{\textheight}% default unless specified
 \IfValueT{#2}{\setlength{\LWR at minipageheight}{#2}}%
 \addtocounter{LWR at minipagedepth}{1}%
@@ -8116,13 +8323,11 @@
 \LWR at stoppars%
 \ifbool{FormatWP}{%
 
-\addtocounter{LWR at thisautoid}{1}%
-\booltrue{LWR at freezethisautoid}%
-\LWR at htmltag{div id="autoid-\arabic{LWR at thisautoid}" class="wpminipage"}%
+\addtocounter{LWR at thisautoidWP}{1}%
+\LWR at htmltag{div id="autoidWP-\arabic{LWR at thisautoidWP}" class="wpminipage"}%
 
 }{}%
 \LWR at traceinfo{minipage: creating div class}%
-\LWR at orignewpage%
 \LWR at htmltag{div class="minipage" style="%
 \ifthenelse{\equal{#1}{t}}{vertical-align:bottom ; }{}%
 \ifthenelse{\equal{#1}{c}}{vertical-align:middle ; }{}%
@@ -8142,13 +8347,15 @@
 }%
 \LWR at traceinfo{minipage: about to print the height}%
 \IfValueT{#2}{height:\rndprintlength{\LWR at minipageheight} ; }%
-"{}}%
+"}%
 
-\LWR at origminipage{6in}% The preceding empty line is required.
 \setlength{\linewidth}{#4}% the original width
 \setlength{\textwidth}{6in}%
 \setlength{\textheight}{9in}%
 \LWR at origraggedright%
+\def\@mpfn{mpfootnote}%
+\def\thempfn{\thempfootnote}\c at mpfootnote\z@%
+\let\@footnotetext\@mpfootnotetext%
 \LWR at startpars%
 \ifboolexpr{bool{FormatWP} and bool{WPMarkMinipages}}{%
 
@@ -8156,8 +8363,9 @@
 
 }{}%
 \LWR at traceinfo{minipage: finished starting the minipage}%
-}
-{%
+}% finished \minipage
+{% \endminipage
+\LWR at printpendingmpfootnotes%
 \ifboolexpr{bool{FormatWP} and bool{WPMarkMinipages}}{%
 
 === end minipage ===
@@ -8164,12 +8372,11 @@
 
 }{}%
 \LWR at stoppars%
-\LWR at endminipage% The following empty line is required:
+\endgroup%
 
 \ifbool{FormatWP}{%
 
 \LWR at htmlelementend{div}%
-\boolfalse{LWR at freezethisautoid}%
 
 }{}%
 \LWR at htmldivclassend{minipage}%
@@ -8183,9 +8390,9 @@
 \RenewDocumentCommand{\parbox}{O{t} o O{t} m +m}
 {
 \LWR at traceinfo{parbox of width #4}%
-\begin{minipage}[#1][#2][#3]{#4}
+\begin{minipage}[#1][#2][#3]{#4}%
 #5
-\end{minipage}
+\end{minipage}%
 }
 \LetLtxMacro\LWR at origmakebox\makebox
 
@@ -8205,10 +8412,10 @@
         width:\rndprintlength{\LWR at tempwidth}%
     ]%
     {makebox}%
-    {\mbox{#4}}%
+    {#4}%
     }% scope
 }%
-{\mbox{#4}}%
+{#4}% no width
 }
 \LetLtxMacro\LWR at origframebox\framebox
 
@@ -8234,7 +8441,7 @@
 }
 \let\LWRprint at fbox\fbox
 \newcommand{\LWRhtml at fbox}[1]{%
-\LWR at traceinfo{HTML fbox}
+\LWR at traceinfo{HTML fbox}%
 \LWR at forceminwidth{\fboxrule}%
 \InlineClass[%
 \LWR at blackborderpadding%
@@ -8419,8 +8626,11 @@
 \LetLtxMacro{\itshape}{\LWR at nullitshape}%
 \LetLtxMacro{\em}{\LWR at nullem}%
 \LetLtxMacro{\normalfont}{\LWR at nullnormalfont}%
-\renewcommand*{\HTMLunicode}[1]{}%
-\renewcommand*{\HTMLentity}[1]{}%
+\renewcommand*{\,}{-}%
+\renewcommand*{~}{-}%
+\renewcommand*{\textellipsis}{-}%
+\renewcommand*{\HTMLunicode}[1]{-}%
+\renewcommand*{\HTMLentity}[1]{-}%
 \renewcommand*{\&}{and}%
 \renewcommand{\textsuperscript}[1]{##1}%
 \renewcommand{\textsubscript}[1]{##1}%
@@ -8497,13 +8707,14 @@
 \let\LWR at origvspace\vspace
 \let\LWR at origrule\rule
 \let\LWR at origmedskip\medskip
+\let\LWR at origbigskip\bigskip
 \let\LWR at origtextellipsis\textellipsis
 
-\renewcommand*{\,}{\HTMLunicode{202f}} % HTML thin non-breakable space
+\renewrobustcmd*{\,}{\HTMLunicode{202f}} % HTML thin non-breakable space
 
-\renewcommand*{~}{\HTMLentity{nbsp}}
+\renewrobustcmd*{~}{\HTMLentity{nbsp}}
 
-\renewcommand*{\textellipsis}{\HTMLunicode{2026}}
+\renewrobustcmd*{\textellipsis}{\HTMLunicode{2026}}
 \let\LWR at orignormalsize\normalsize
 \let\LWR at origsmall\small
 \let\LWR at origfootnotesize\footnotesize
@@ -8533,6 +8744,10 @@
 
 }
 
+\renewcommand*{\newpage}{
+
+}
+
 \newcommand*{\LWR at newlinebr}{\unskip\LWR at htmltag{br /}\LWR at orignewline}%
 \let\newline\LWR at newlinebr
 
@@ -8674,7 +8889,7 @@
 
 \begin{warpHTML}
 
-\newcommand*{\phantomsection}{%
+\DeclareDocumentCommand{\phantomsection}{}{%
 \section*{}%
 }
 
@@ -8757,7 +8972,17 @@
 
 \end{warpHTML}
 
+\begin{warpHTML}
+\@ifclassloaded{scrbook}{\RequirePackage{lwarp-patch-komascript}}{}
+\@ifclassloaded{scrartcl}{\RequirePackage{lwarp-patch-komascript}}{}
+\@ifclassloaded{scrreprt}{\RequirePackage{lwarp-patch-komascript}}{}
+\end{warpHTML}
 
+\begin{warpHTML}
+\@ifclassloaded{memoir}{\RequirePackage{lwarp-patch-memoir}}{}
+\end{warpHTML}
+
+
 \endinput
 %%
 %% End of file `lwarp.sty'.



More information about the tex-live-commits mailing list