texlive[47944] trunk: lwarp (6jun18)

commits+karl at tug.org commits+karl at tug.org
Wed Jun 6 22:52:13 CEST 2018


Revision: 47944
          http://tug.org/svn/texlive?view=revision&revision=47944
Author:   karl
Date:     2018-06-06 22:52:12 +0200 (Wed, 06 Jun 2018)
Log Message:
-----------
lwarp (6jun18)

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-adjmulticol.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-axodraw2.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bigdelim.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bigstrut.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-booktabs.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-breakurl.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bytefield.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemfig.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemmacros.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-colortbl.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ellipsis.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-epigraph.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-float.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-graphicx.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hang.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hanging.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-marginnote.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-midpage.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-multirow.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-quoting.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-realscripts.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-rotfloat.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-scrextend.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-siunitx.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xcolor.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xfrac.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xy.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-algorithm2e.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-errata.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-glossary.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ltablex.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-register.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-trimclip.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-vowel.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xellipsis.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xltabular.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xpiano.sty

Modified: trunk/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua	2018-06-06 20:52:12 UTC (rev 47944)
@@ -2,15 +2,16 @@
 
 -- Copyright 2016-2018 Brian Dunn
 
--- Print the usage of the lwarpmk command:
+printversion = "v0.57"
 
-printversion = "v0.56"
-
 function printhelp ()
 print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;
 end
 
 function printusage ()
+--
+-- Print the usage of the lwarpmk command:
+--
 print ( [[
 
 lwarpmk print [project]: Compile the print version if necessary.
@@ -38,9 +39,10 @@
 printconf ()
 end
 
+function printconf ()
+--
 -- Print the format of the configuration file lwarpmk.conf:
-
-function printconf ()
+--
 print ( [[
 An example lwarpmk.conf or <project>.lwarpmkconf project file:
 --
@@ -62,11 +64,12 @@
 ]] ) ;
 end
 
+function splitfile (destfile,sourcefile)
+--
 -- Split one large sourcefile into a number of files,
 -- starting with destfile.
 -- The file is split at each occurance of <!--|Start file|newfilename|*
-
-function splitfile (destfile,sourcefile)
+--
 print ("lwarpmk: Splitting " .. sourcefile .. " into " .. destfile) ;
 local sfile = io.open(sourcefile)
 io.output(destfile)
@@ -83,20 +86,25 @@
 io.close(sfile)
 end -- function
 
+function cvalueerror ( line, linenum , cvalue )
+--
 -- Incorrect value, so print an error and exit.
-
-function cvalueerror ( line, linenum , cvalue )
+--
     print ("lwarpmk: ===")
     print ("lwarpmk: " .. linenum .. " : " .. line ) ;
-    print ("lwarpmk: incorrect variable value \"" .. cvalue .. "\" in lwarpmk.conf.\n" ) ;
+    print (
+        "lwarpmk: incorrect variable value \"" .. cvalue ..
+        "\" in lwarpmk.conf.\n"
+    ) ;
     print ("lwarpmk: ===")
     printconf () ;
     os.exit(1) ;
 end
 
+function loadconf ()
+--
 -- Load settings from the project's "lwarpmk.conf" file:
-
-function loadconf ()
+--
 -- Default configuration filename:
 local conffile = "lwarpmk.conf"
 -- Optional configuration filename:
@@ -118,7 +126,10 @@
     print ("lwarpmk: recompile using pdflatex, xelatex, or lualatex,")
     print ("lwarpmk: then try using lwarpmk again.")
     if ( arg[2] ~= nil ) then
-        print ("lwarpmk: (\"" .. arg[2] .. "\" does not appear to be a project name.)")
+        print (
+            "lwarpmk: (\"" .. arg[2] ..
+            "\" does not appear to be a project name.)"
+        )
     end
     print ("lwarpmk: ===")
     printhelp () ;
@@ -171,7 +182,10 @@
 else
     print ("lwarpmk: ===")
     print ("lwarpmk: " .. linenum .. " : " .. line ) ;
-    print ("lwarpmk: Incorrect variable name \"" .. cvarname .. "\" in " .. conffile ..".\n" ) ;
+    print (
+        "lwarpmk: Incorrect variable name \"" .. cvarname .. "\" in " ..
+        conffile ..".\n"
+    ) ;
     print ("lwarpmk: ===")
     printconf () ;
 os.exit(1) ;
@@ -203,7 +217,7 @@
     opquote= "\'"
     cmdgroupopenname = " ( "
     cmdgroupclosename = " ) "
-    seqname = " ; "
+    seqname = " && "
     bgname = " &"
 elseif opsystem=="Windows" then -- For Windows
     rmname = "DEL"
@@ -232,15 +246,31 @@
 
 end -- loadconf
 
+function executecheckerror ( executecommands , errormessage )
+--
+-- Execute an operating system call,
+-- and maybe exit with an error message.
+--
+local err
+err = os.execute ( executecommands )
+if ( err ~= 0 ) then
+    print ("lwarpmk: ===")
+    print ("lwarpmk: " .. errormessage )
+    print ("lwarpmk: ===")
+    os.exit(1)
+end
+end -- executecheckerror
+
 function refreshdate ()
 os.execute(touchnamepre .. " " .. sourcename .. ".tex " .. touchnamepost)
 end
 
+function reruntoget (filesource)
+--
 -- Scan the LaTeX log file for the phrase "Rerun to get",
 -- indicating that the file should be compiled again.
 -- Return true if found.
-
-function reruntoget (filesource)
+--
 local fsource = io.open(filesource)
 for line in fsource:lines() do
 if ( string.find(line,"Rerun to get") ~= nil ) then
@@ -252,10 +282,11 @@
 return false
 end
 
+function onetime (fsuffix)
+--
 -- Compile one time, return true if should compile again.
 -- fsuffix is "" for print, "_html" for HTML output.
-
-function onetime (fsuffix)
+--
 print("lwarpmk: Compiling with " .. latexname .. " " .. sourcename..fsuffix)
 local thisshellescape = " "
 if ( shellescape == "true" ) then
@@ -263,20 +294,18 @@
 else
     thisshellescape = " "
 end
-err = os.execute(latexname .. thisshellescape .. sourcename..fsuffix)
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: Compile error.")
-    print ("lwarpmk: ===")
-    os.exit(1)
-end
+executecheckerror (
+    latexname .. thisshellescape .. sourcename..fsuffix ,
+    "Compile error."
+)
 return (reruntoget(sourcename .. fsuffix .. ".log") ) ;
 end
 
+function manytimes (fsuffix)
+--
 -- Compile up to five times.
 -- fsuffix is "" for print, "_html" for HTML output
-
-function manytimes (fsuffix)
+--
 if onetime(fsuffix) == true then
 if onetime(fsuffix) == true then
 if onetime(fsuffix) == true then
@@ -285,9 +314,10 @@
 end end end end end
 end
 
+function verifyfileexists (filename)
+--
 -- Exit if the given file does not exist.
-
-function verifyfileexists (filename)
+--
 if (lfs.attributes ( filename , "modification" ) == nil ) then
     print ("lwarpmk: ===")
     print ("lwarpmk: " .. filename .. " not found." ) ;
@@ -296,9 +326,10 @@
 end
 end
 
+function pdftohtml ()
+--
 -- Convert <project>_html.pdf into HTML files:
-
-function pdftohtml ()
+--
 -- Convert to text:
 print ("lwarpmk: Converting " .. sourcename
     .."_html.pdf to " .. sourcename .. "_html.html")
@@ -308,9 +339,11 @@
 splitfile (homehtmlfilename .. ".html" , sourcename .. "_html.html")
 end
 
+function removeaux ()
+--
 -- Remove auxiliary files:
 -- All aux files are removed since there may be many bbl*.aux files.
-function removeaux ()
+--
 os.execute ( rmname .. " *.aux " ..
     sourcename ..".toc " .. sourcename .. "_html.toc " ..
     sourcename ..".lof " .. sourcename .. "_html.lof " ..
@@ -323,10 +356,12 @@
     )
 end
 
+function checkhtmlpdfexists ()
+--
 -- Error if the HTML document does not exist.
--- The lateximages are drawn from the HTML PDF verison of the document,
+-- The lateximages are drawn from the HTML PDF version of the document,
 -- so "lwarpmk html" must be done before "lwarpmk limages".
-function checkhtmlpdfexists ()
+--
 local htmlpdffile = io.open(sourcename .. "_html.pdf", "r")
 if ( htmlpdffile == nil ) then
     print ("")
@@ -339,8 +374,10 @@
 io.close (htmlpdffile)
 end -- checkhtmlpdfexists
 
+function warnlimages ()
+--
 -- Warning of a missing lateximages.txt file:
-function warnlimages ()
+--
     print ("lwarpmk: ===")
     print ("lwarpmk: \"lateximages.txt\" does not exist.")
     print ("lwarpmk: Your project does not use SVG math or other lateximages,")
@@ -353,9 +390,11 @@
     print ("lwarpmk: ===")
 end -- warnlimages
 
+function checklimages ()
+--
 -- Check lateximages.txt to see if need to recompile first.
 -- If any entry has a page number of zero, then there were incorrect images.
-function checklimages ()
+--
 print ("lwarpmk: Checking for a valid lateximages.txt file.")
 local limagesfile = io.open("lateximages.txt", "r")
 if ( limagesfile == nil ) then
@@ -387,91 +426,34 @@
     print ("lwarpmk: ===")
     os.exit(1) ;
 end -- pagezerowarning
-end -- checklateximages
+end -- checklimages
 
--- Create lateximages based on lateximages.txt:
-function createlateximages ()
--- See if the document must be recompiled first:
-checklimages ()
--- See if the print version exists:
-checkhtmlpdfexists ()
--- Attempt to create the lateximages:
-print ("lwarpmk: Creating lateximages.")
-local limagesfile = io.open("lateximages.txt", "r")
-if ( limagesfile == nil ) then
-    warnlateximages ()
-    os.exit(1)
-end
--- Create the lateximages directory, ignore error if already exists
-err = os.execute("mkdir lateximages")
--- For Windows, create lwarp_one_limage.cmd from lwarp_one_limage.txt:
-if opsystem=="Windows" then
-    err = os.execute (
-        cpname .. " lwarp_one_limage.txt lwarp_one_limage.cmd"
-    )
-    if ( err ~= 0 ) then
-        print ("lwarpmk: ===")
-        print ("lwarpmk: File error trying to copy")
-        print ("         lwarp_one_limage.txt to lwarp_one_limage.cmd")
-        print ("lwarpmk: ===")
-        os.exit(1) ;
-    end
-end -- create lwarp_one_limage.cmd
--- Track the number of parallel processes
-numimageprocesses = 0
--- Track warning to recompile if find a page 0
-pagezerowarning = false
--- Scan lateximages.txt
-for line in limagesfile:lines() do
--- lwimgpage is the page number in the PDF which has the image
--- lwimghash is true if this filename is a hash
--- lwimgname is the lateximage filename root to assign for the image
-i,j,lwimgpage,lwimghash,lwimgname = string.find (line,"|(.*)|(.*)|(.*)|")
--- For each entry:
-if ( (i~=nil) ) then
--- Skip if the page number is 0:
-if ( lwimgpage == "0" ) then
-    pagezerowarning = true
-else
--- Skip is this image is hashed and already exists:
-local lwimgfullname = "lateximages" .. dirslash .. lwimgname .. ".svg"
-if (
-    (lwimghash ~= "true") or
-    (lfs.attributes(lwimgfullname,"mode")==nil) -- file not exists
+function createuniximage ( lwimgfullname )
+--
+-- Create one lateximage for Unix / Linux / Mac OS.
+--
+executecheckerror (
+    cmdgroupopenname ..
+    "pdfseparate -f " .. lwimgpage .. " -l " .. lwimgpage .. " " ..
+        sourcename .."_html.pdf " ..
+        "lateximages" .. dirslash .."lateximagetemp-%d" .. ".pdf" ..
+        seqname ..
+    -- Crop the image:
+    "pdfcrop  --hires  lateximages" .. dirslash .. "lateximagetemp-" ..
+        lwimgpage .. ".pdf " ..
+        "lateximages" .. dirslash .. lwimgname .. ".pdf" ..
+        seqname ..
+    -- Convert the image to svg:
+    "pdftocairo -svg  -noshrink  lateximages" .. dirslash .. lwimgname .. ".pdf " ..
+        "lateximages" .. dirslash .. lwimgname ..".svg" ..
+        seqname ..
+    -- Remove the temporary files:
+    rmname .. " lateximages" .. dirslash .. lwimgname .. ".pdf" .. seqname ..
+    rmname .. " lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf" ..
+    cmdgroupclosename .. " >/dev/null " .. bgname
+    ,
+    "File error trying to convert " .. lwimgfullname
 )
-then -- not hashed or not exists:
--- Print the name of the file being generated:
-print ( "lwarpmk: " .. lwimgname )
--- Touch/create the dest so that only once instance tries to build it:
-err = os.execute(newtouchname .. " " .. lwimgfullname)
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: File error trying to touch " .. lwimgfullname)
-    print ("lwarpmk: ===")
-    os.exit(1) ;
-end
--- Separate out the image into its own single-page pdf:
-if opsystem=="Unix" then
--- For Unix / Linux / Mac OS:
-err = os.execute(
-cmdgroupopenname ..
-"pdfseparate -f " .. lwimgpage .. " -l " .. lwimgpage .. " " ..
-    sourcename .."_html.pdf " ..
-    "lateximages" .. dirslash .."lateximagetemp-%d" .. ".pdf" ..
-    seqname ..
--- Crop the image:
-"pdfcrop  --hires  lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf " ..
-    "lateximages" .. dirslash .. lwimgname .. ".pdf" ..
-    seqname ..
--- Convert the image to svg:
-"pdftocairo -svg  -noshrink  lateximages" .. dirslash .. lwimgname .. ".pdf " ..
-    "lateximages" .. dirslash .. lwimgname ..".svg" ..
-    seqname ..
--- Remove the temporary files:
-rmname .. " lateximages" .. dirslash .. lwimgname .. ".pdf" .. seqname ..
-rmname .. " lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf" ..
-cmdgroupclosename .. " >/dev/null " .. bgname
-)
 -- Every 32 images, wait for completion at below normal priority,
 --  allowing other image tasks to catch up.
 numimageprocesses = numimageprocesses + 1
@@ -478,10 +460,14 @@
 if ( numimageprocesses > 32 ) then
     numimageprocesses = 0
     print ( "lwarpmk: waiting" )
-    err = os.execute ( "wait" )
+    executecheckerror ( "wait" , "File error trying to wait.")
 end
-elseif opsystem=="Windows" then
--- For Windows
+end -- createuniximage
+
+function createwindowsimage ( lwimgfullname )
+--
+-- Create one lateximage for Windows.
+--
 -- Every 32 images, wait for completion at below normal priority,
 --  allowing other image tasks to catch up.
 numimageprocesses = numimageprocesses + 1
@@ -493,30 +479,94 @@
     thiswaitcommand = ""
 end
 -- Execute the image generation command
-err = os.execute (
+executecheckerror (
     "start /B " .. thiswaitcommand .. " \"\" lwarp_one_limage " ..
     lwimgpage .. " " ..
     lwimghash .. " " ..
     lwimgname .. " " ..
     sourcename .. " <nul >nul"
+    ,
+    "File error trying to create image."
 )
-end -- Windows
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: File error trying to create one lateximage.")
-    print ("lwarpmk: ===")
+end -- createwindowsimage
+
+function createonelateximage ( line )
+--
+-- Given the next line of lateximages.txt, convert a single image.
+--
+-- lwimgpage is the page number in the PDF which has the image
+-- lwimghash is true if this filename is a hash
+-- lwimgname is the lateximage filename root to assign for the image
+i,j,lwimgpage,lwimghash,lwimgname = string.find (line,"|(.*)|(.*)|(.*)|")
+-- For each entry:
+if ( (i~=nil) ) then
+    -- Skip if the page number is 0:
+    if ( lwimgpage == "0" ) then
+        pagezerowarning = true
+    else
+        -- Skip is this image is hashed and already exists:
+        local lwimgfullname = "lateximages" .. dirslash .. lwimgname .. ".svg"
+        if (
+            (lwimghash ~= "true") or
+            (lfs.attributes(lwimgfullname,"mode")==nil) -- file not exists
+        )
+        then -- not hashed or not exists:
+            -- Print the name of the file being generated:
+            print ( "lwarpmk: " .. lwimgname )
+            -- Touch/create the dest so that only once instance tries to build it:
+            executecheckerror (
+                newtouchname .. " " .. lwimgfullname ,
+                "File error trying to touch " .. lwimgfullname
+            )
+            -- Separate out the image into its own single-page pdf:
+            if opsystem=="Unix" then
+                createuniximage (lwimgfullname)
+            elseif opsystem=="Windows" then
+                createwindowsimage (lwimgfullname)
+            end
+        end -- not hashed or not exists
+    end -- not page 0
+end -- not nil
+end -- createonelateximage
+
+function createlateximages ()
+--
+-- Create lateximages based on lateximages.txt:
+--
+-- See if the document must be recompiled first:
+checklimages ()
+-- See if the print version exists:
+checkhtmlpdfexists ()
+-- Attempt to create the lateximages:
+print ("lwarpmk: Creating lateximages.")
+local limagesfile = io.open("lateximages.txt", "r")
+if ( limagesfile == nil ) then
+    warnlateximages ()
     os.exit(1)
 end
-end -- not hashed or not exists
-end -- not page 0
-end -- not nil
+-- Create the lateximages directory, ignore error if already exists
+err = os.execute("mkdir lateximages")
+-- For Windows, create lwarp_one_limage.cmd from lwarp_one_limage.txt:
+if opsystem=="Windows" then
+    executecheckerror (
+        cpname .. " lwarp_one_limage.txt lwarp_one_limage.cmd" ,
+        "File error trying to copy lwarp_one_limage.txt to lwarp_one_limage.cmd"
+    )
+end -- create lwarp_one_limage.cmd
+-- Track the number of parallel processes
+numimageprocesses = 0
+-- Track warning to recompile if find a page 0
+pagezerowarning = false
+-- Scan lateximages.txt
+for line in limagesfile:lines() do
+    createonelateximage ( line )
 end -- do
 io.close(limagesfile)
 print ( "lwarpmk limages: ===")
 print ( "lwarpmk limages: Wait a moment for the images to complete" )
-print ( "lwarpmk limages: before reloading the page." )
+print ( "lwarpmk limages:   before reloading the page." )
 print ( "lwarpmk limages: ===")
-print ( "lwarpmk limages: done" )
+print ( "lwarpmk limages: Done." )
 if ( pagezerowarning == true ) then
     print ( "lwarpmk limages: WARNING: Images will be incorrect." )
     print ( "lwarpmk limages:   Enter \"lwarpmk cleanlimages\", then" )
@@ -525,9 +575,11 @@
 end -- pagezerowarning
 end -- function
 
+function compilelatexmk ( fsuffix )
+--
 -- Use latexmk to compile source and index:
 -- fsuffix is "" for print, or "_html" for HTML
-function compilelatexmk ( fsuffix )
+--
 -- Maybe select the shell-escape option:
 local thisshellescape = " "
 if ( shellescape == "true" ) then
@@ -537,7 +589,8 @@
 end
 -- The recorder option is required to detect changes in <project>.tex
 -- while we are loading <project>_html.tex.
-err=os.execute ( "latexmk -pdf -dvi- -ps- -recorder "
+executecheckerror (
+    "latexmk -pdf -dvi- -ps- -recorder "
     .. "-e "
     .. opquote
     .. "$makeindex = q/" -- $
@@ -547,19 +600,18 @@
     .. "  -L " .. xindylanguage .. " /"
     .. opquote
     .. " -pdflatex=\"" .. latexname .. thisshellescape .." %O %S\" "
-    .. sourcename..fsuffix ..".tex" ) ;
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: Compile error.")
-    print ("lwarpmk: ===")
-    os.exit(1)
-end
+    .. sourcename..fsuffix ..".tex"
+    ,
+    "Compile error."
+)
 end -- function
 
+function convertpdftosvg ()
+--
 -- Converts PDF files to SVG files.
 -- The filenames are arg[2] and up.
 -- arg[1] is the command "pdftosvg".
-function convertpdftosvg ()
+--
 for i = 2 , #arg do
     if (lfs.attributes(arg[i],"mode")==nil) then
         print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.")
@@ -570,6 +622,8 @@
 end -- do
 end --function
 
+-- Start of the main code: --
+
 -- lwarpmk --version :
 
 if (arg[1] == "--version") then
@@ -606,6 +660,8 @@
     end
 end -- not latexmk
 
+-- lwarpmk print1:
+
 elseif arg[1] == "print1" then
     loadconf ()
     verifyfileexists (sourcename .. ".tex") ;
@@ -676,6 +732,8 @@
     end
 end -- not latexmk
 
+-- lwarpmk html1:
+
 elseif arg[1] == "html1" then
     loadconf ()
     verifyfileexists ( sourcename .. ".tex" ) ;
@@ -683,6 +741,7 @@
     pdftohtml ()
     print ("lwarpmk: Done.")
 
+-- lwarpmk pdftohtml:
 elseif arg[1] == "pdftohtml" then
     loadconf ()
     pdftohtml ()
@@ -790,6 +849,8 @@
 elseif (arg[1] == "-h" ) or (arg[1] == "--help") then
 printusage ()
 
+-- Unknown command:
+
 else
 printhelp ()
 print ("\nlwarpmk: ****** Unknown command \""..arg[1].."\". ******\n")

Modified: trunk/Master/texmf-dist/doc/latex/lwarp/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/lwarp/README.txt	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/doc/latex/lwarp/README.txt	2018-06-06 20:52:12 UTC (rev 47944)
@@ -1,5 +1,5 @@
 
-LaTeX lwarp package v0.56   README.txt
+LaTeX lwarp package v0.57   README.txt
 
 Files included are:
 

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-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/scripts/lwarp/lwarpmk.lua	2018-06-06 20:52:12 UTC (rev 47944)
@@ -2,15 +2,16 @@
 
 -- Copyright 2016-2018 Brian Dunn
 
--- Print the usage of the lwarpmk command:
+printversion = "v0.57"
 
-printversion = "v0.56"
-
 function printhelp ()
 print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;
 end
 
 function printusage ()
+--
+-- Print the usage of the lwarpmk command:
+--
 print ( [[
 
 lwarpmk print [project]: Compile the print version if necessary.
@@ -38,9 +39,10 @@
 printconf ()
 end
 
+function printconf ()
+--
 -- Print the format of the configuration file lwarpmk.conf:
-
-function printconf ()
+--
 print ( [[
 An example lwarpmk.conf or <project>.lwarpmkconf project file:
 --
@@ -62,11 +64,12 @@
 ]] ) ;
 end
 
+function splitfile (destfile,sourcefile)
+--
 -- Split one large sourcefile into a number of files,
 -- starting with destfile.
 -- The file is split at each occurance of <!--|Start file|newfilename|*
-
-function splitfile (destfile,sourcefile)
+--
 print ("lwarpmk: Splitting " .. sourcefile .. " into " .. destfile) ;
 local sfile = io.open(sourcefile)
 io.output(destfile)
@@ -83,20 +86,25 @@
 io.close(sfile)
 end -- function
 
+function cvalueerror ( line, linenum , cvalue )
+--
 -- Incorrect value, so print an error and exit.
-
-function cvalueerror ( line, linenum , cvalue )
+--
     print ("lwarpmk: ===")
     print ("lwarpmk: " .. linenum .. " : " .. line ) ;
-    print ("lwarpmk: incorrect variable value \"" .. cvalue .. "\" in lwarpmk.conf.\n" ) ;
+    print (
+        "lwarpmk: incorrect variable value \"" .. cvalue ..
+        "\" in lwarpmk.conf.\n"
+    ) ;
     print ("lwarpmk: ===")
     printconf () ;
     os.exit(1) ;
 end
 
+function loadconf ()
+--
 -- Load settings from the project's "lwarpmk.conf" file:
-
-function loadconf ()
+--
 -- Default configuration filename:
 local conffile = "lwarpmk.conf"
 -- Optional configuration filename:
@@ -118,7 +126,10 @@
     print ("lwarpmk: recompile using pdflatex, xelatex, or lualatex,")
     print ("lwarpmk: then try using lwarpmk again.")
     if ( arg[2] ~= nil ) then
-        print ("lwarpmk: (\"" .. arg[2] .. "\" does not appear to be a project name.)")
+        print (
+            "lwarpmk: (\"" .. arg[2] ..
+            "\" does not appear to be a project name.)"
+        )
     end
     print ("lwarpmk: ===")
     printhelp () ;
@@ -171,7 +182,10 @@
 else
     print ("lwarpmk: ===")
     print ("lwarpmk: " .. linenum .. " : " .. line ) ;
-    print ("lwarpmk: Incorrect variable name \"" .. cvarname .. "\" in " .. conffile ..".\n" ) ;
+    print (
+        "lwarpmk: Incorrect variable name \"" .. cvarname .. "\" in " ..
+        conffile ..".\n"
+    ) ;
     print ("lwarpmk: ===")
     printconf () ;
 os.exit(1) ;
@@ -203,7 +217,7 @@
     opquote= "\'"
     cmdgroupopenname = " ( "
     cmdgroupclosename = " ) "
-    seqname = " ; "
+    seqname = " && "
     bgname = " &"
 elseif opsystem=="Windows" then -- For Windows
     rmname = "DEL"
@@ -232,15 +246,31 @@
 
 end -- loadconf
 
+function executecheckerror ( executecommands , errormessage )
+--
+-- Execute an operating system call,
+-- and maybe exit with an error message.
+--
+local err
+err = os.execute ( executecommands )
+if ( err ~= 0 ) then
+    print ("lwarpmk: ===")
+    print ("lwarpmk: " .. errormessage )
+    print ("lwarpmk: ===")
+    os.exit(1)
+end
+end -- executecheckerror
+
 function refreshdate ()
 os.execute(touchnamepre .. " " .. sourcename .. ".tex " .. touchnamepost)
 end
 
+function reruntoget (filesource)
+--
 -- Scan the LaTeX log file for the phrase "Rerun to get",
 -- indicating that the file should be compiled again.
 -- Return true if found.
-
-function reruntoget (filesource)
+--
 local fsource = io.open(filesource)
 for line in fsource:lines() do
 if ( string.find(line,"Rerun to get") ~= nil ) then
@@ -252,10 +282,11 @@
 return false
 end
 
+function onetime (fsuffix)
+--
 -- Compile one time, return true if should compile again.
 -- fsuffix is "" for print, "_html" for HTML output.
-
-function onetime (fsuffix)
+--
 print("lwarpmk: Compiling with " .. latexname .. " " .. sourcename..fsuffix)
 local thisshellescape = " "
 if ( shellescape == "true" ) then
@@ -263,20 +294,18 @@
 else
     thisshellescape = " "
 end
-err = os.execute(latexname .. thisshellescape .. sourcename..fsuffix)
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: Compile error.")
-    print ("lwarpmk: ===")
-    os.exit(1)
-end
+executecheckerror (
+    latexname .. thisshellescape .. sourcename..fsuffix ,
+    "Compile error."
+)
 return (reruntoget(sourcename .. fsuffix .. ".log") ) ;
 end
 
+function manytimes (fsuffix)
+--
 -- Compile up to five times.
 -- fsuffix is "" for print, "_html" for HTML output
-
-function manytimes (fsuffix)
+--
 if onetime(fsuffix) == true then
 if onetime(fsuffix) == true then
 if onetime(fsuffix) == true then
@@ -285,9 +314,10 @@
 end end end end end
 end
 
+function verifyfileexists (filename)
+--
 -- Exit if the given file does not exist.
-
-function verifyfileexists (filename)
+--
 if (lfs.attributes ( filename , "modification" ) == nil ) then
     print ("lwarpmk: ===")
     print ("lwarpmk: " .. filename .. " not found." ) ;
@@ -296,9 +326,10 @@
 end
 end
 
+function pdftohtml ()
+--
 -- Convert <project>_html.pdf into HTML files:
-
-function pdftohtml ()
+--
 -- Convert to text:
 print ("lwarpmk: Converting " .. sourcename
     .."_html.pdf to " .. sourcename .. "_html.html")
@@ -308,9 +339,11 @@
 splitfile (homehtmlfilename .. ".html" , sourcename .. "_html.html")
 end
 
+function removeaux ()
+--
 -- Remove auxiliary files:
 -- All aux files are removed since there may be many bbl*.aux files.
-function removeaux ()
+--
 os.execute ( rmname .. " *.aux " ..
     sourcename ..".toc " .. sourcename .. "_html.toc " ..
     sourcename ..".lof " .. sourcename .. "_html.lof " ..
@@ -323,10 +356,12 @@
     )
 end
 
+function checkhtmlpdfexists ()
+--
 -- Error if the HTML document does not exist.
--- The lateximages are drawn from the HTML PDF verison of the document,
+-- The lateximages are drawn from the HTML PDF version of the document,
 -- so "lwarpmk html" must be done before "lwarpmk limages".
-function checkhtmlpdfexists ()
+--
 local htmlpdffile = io.open(sourcename .. "_html.pdf", "r")
 if ( htmlpdffile == nil ) then
     print ("")
@@ -339,8 +374,10 @@
 io.close (htmlpdffile)
 end -- checkhtmlpdfexists
 
+function warnlimages ()
+--
 -- Warning of a missing lateximages.txt file:
-function warnlimages ()
+--
     print ("lwarpmk: ===")
     print ("lwarpmk: \"lateximages.txt\" does not exist.")
     print ("lwarpmk: Your project does not use SVG math or other lateximages,")
@@ -353,9 +390,11 @@
     print ("lwarpmk: ===")
 end -- warnlimages
 
+function checklimages ()
+--
 -- Check lateximages.txt to see if need to recompile first.
 -- If any entry has a page number of zero, then there were incorrect images.
-function checklimages ()
+--
 print ("lwarpmk: Checking for a valid lateximages.txt file.")
 local limagesfile = io.open("lateximages.txt", "r")
 if ( limagesfile == nil ) then
@@ -387,91 +426,34 @@
     print ("lwarpmk: ===")
     os.exit(1) ;
 end -- pagezerowarning
-end -- checklateximages
+end -- checklimages
 
--- Create lateximages based on lateximages.txt:
-function createlateximages ()
--- See if the document must be recompiled first:
-checklimages ()
--- See if the print version exists:
-checkhtmlpdfexists ()
--- Attempt to create the lateximages:
-print ("lwarpmk: Creating lateximages.")
-local limagesfile = io.open("lateximages.txt", "r")
-if ( limagesfile == nil ) then
-    warnlateximages ()
-    os.exit(1)
-end
--- Create the lateximages directory, ignore error if already exists
-err = os.execute("mkdir lateximages")
--- For Windows, create lwarp_one_limage.cmd from lwarp_one_limage.txt:
-if opsystem=="Windows" then
-    err = os.execute (
-        cpname .. " lwarp_one_limage.txt lwarp_one_limage.cmd"
-    )
-    if ( err ~= 0 ) then
-        print ("lwarpmk: ===")
-        print ("lwarpmk: File error trying to copy")
-        print ("         lwarp_one_limage.txt to lwarp_one_limage.cmd")
-        print ("lwarpmk: ===")
-        os.exit(1) ;
-    end
-end -- create lwarp_one_limage.cmd
--- Track the number of parallel processes
-numimageprocesses = 0
--- Track warning to recompile if find a page 0
-pagezerowarning = false
--- Scan lateximages.txt
-for line in limagesfile:lines() do
--- lwimgpage is the page number in the PDF which has the image
--- lwimghash is true if this filename is a hash
--- lwimgname is the lateximage filename root to assign for the image
-i,j,lwimgpage,lwimghash,lwimgname = string.find (line,"|(.*)|(.*)|(.*)|")
--- For each entry:
-if ( (i~=nil) ) then
--- Skip if the page number is 0:
-if ( lwimgpage == "0" ) then
-    pagezerowarning = true
-else
--- Skip is this image is hashed and already exists:
-local lwimgfullname = "lateximages" .. dirslash .. lwimgname .. ".svg"
-if (
-    (lwimghash ~= "true") or
-    (lfs.attributes(lwimgfullname,"mode")==nil) -- file not exists
+function createuniximage ( lwimgfullname )
+--
+-- Create one lateximage for Unix / Linux / Mac OS.
+--
+executecheckerror (
+    cmdgroupopenname ..
+    "pdfseparate -f " .. lwimgpage .. " -l " .. lwimgpage .. " " ..
+        sourcename .."_html.pdf " ..
+        "lateximages" .. dirslash .."lateximagetemp-%d" .. ".pdf" ..
+        seqname ..
+    -- Crop the image:
+    "pdfcrop  --hires  lateximages" .. dirslash .. "lateximagetemp-" ..
+        lwimgpage .. ".pdf " ..
+        "lateximages" .. dirslash .. lwimgname .. ".pdf" ..
+        seqname ..
+    -- Convert the image to svg:
+    "pdftocairo -svg  -noshrink  lateximages" .. dirslash .. lwimgname .. ".pdf " ..
+        "lateximages" .. dirslash .. lwimgname ..".svg" ..
+        seqname ..
+    -- Remove the temporary files:
+    rmname .. " lateximages" .. dirslash .. lwimgname .. ".pdf" .. seqname ..
+    rmname .. " lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf" ..
+    cmdgroupclosename .. " >/dev/null " .. bgname
+    ,
+    "File error trying to convert " .. lwimgfullname
 )
-then -- not hashed or not exists:
--- Print the name of the file being generated:
-print ( "lwarpmk: " .. lwimgname )
--- Touch/create the dest so that only once instance tries to build it:
-err = os.execute(newtouchname .. " " .. lwimgfullname)
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: File error trying to touch " .. lwimgfullname)
-    print ("lwarpmk: ===")
-    os.exit(1) ;
-end
--- Separate out the image into its own single-page pdf:
-if opsystem=="Unix" then
--- For Unix / Linux / Mac OS:
-err = os.execute(
-cmdgroupopenname ..
-"pdfseparate -f " .. lwimgpage .. " -l " .. lwimgpage .. " " ..
-    sourcename .."_html.pdf " ..
-    "lateximages" .. dirslash .."lateximagetemp-%d" .. ".pdf" ..
-    seqname ..
--- Crop the image:
-"pdfcrop  --hires  lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf " ..
-    "lateximages" .. dirslash .. lwimgname .. ".pdf" ..
-    seqname ..
--- Convert the image to svg:
-"pdftocairo -svg  -noshrink  lateximages" .. dirslash .. lwimgname .. ".pdf " ..
-    "lateximages" .. dirslash .. lwimgname ..".svg" ..
-    seqname ..
--- Remove the temporary files:
-rmname .. " lateximages" .. dirslash .. lwimgname .. ".pdf" .. seqname ..
-rmname .. " lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf" ..
-cmdgroupclosename .. " >/dev/null " .. bgname
-)
 -- Every 32 images, wait for completion at below normal priority,
 --  allowing other image tasks to catch up.
 numimageprocesses = numimageprocesses + 1
@@ -478,10 +460,14 @@
 if ( numimageprocesses > 32 ) then
     numimageprocesses = 0
     print ( "lwarpmk: waiting" )
-    err = os.execute ( "wait" )
+    executecheckerror ( "wait" , "File error trying to wait.")
 end
-elseif opsystem=="Windows" then
--- For Windows
+end -- createuniximage
+
+function createwindowsimage ( lwimgfullname )
+--
+-- Create one lateximage for Windows.
+--
 -- Every 32 images, wait for completion at below normal priority,
 --  allowing other image tasks to catch up.
 numimageprocesses = numimageprocesses + 1
@@ -493,30 +479,94 @@
     thiswaitcommand = ""
 end
 -- Execute the image generation command
-err = os.execute (
+executecheckerror (
     "start /B " .. thiswaitcommand .. " \"\" lwarp_one_limage " ..
     lwimgpage .. " " ..
     lwimghash .. " " ..
     lwimgname .. " " ..
     sourcename .. " <nul >nul"
+    ,
+    "File error trying to create image."
 )
-end -- Windows
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: File error trying to create one lateximage.")
-    print ("lwarpmk: ===")
+end -- createwindowsimage
+
+function createonelateximage ( line )
+--
+-- Given the next line of lateximages.txt, convert a single image.
+--
+-- lwimgpage is the page number in the PDF which has the image
+-- lwimghash is true if this filename is a hash
+-- lwimgname is the lateximage filename root to assign for the image
+i,j,lwimgpage,lwimghash,lwimgname = string.find (line,"|(.*)|(.*)|(.*)|")
+-- For each entry:
+if ( (i~=nil) ) then
+    -- Skip if the page number is 0:
+    if ( lwimgpage == "0" ) then
+        pagezerowarning = true
+    else
+        -- Skip is this image is hashed and already exists:
+        local lwimgfullname = "lateximages" .. dirslash .. lwimgname .. ".svg"
+        if (
+            (lwimghash ~= "true") or
+            (lfs.attributes(lwimgfullname,"mode")==nil) -- file not exists
+        )
+        then -- not hashed or not exists:
+            -- Print the name of the file being generated:
+            print ( "lwarpmk: " .. lwimgname )
+            -- Touch/create the dest so that only once instance tries to build it:
+            executecheckerror (
+                newtouchname .. " " .. lwimgfullname ,
+                "File error trying to touch " .. lwimgfullname
+            )
+            -- Separate out the image into its own single-page pdf:
+            if opsystem=="Unix" then
+                createuniximage (lwimgfullname)
+            elseif opsystem=="Windows" then
+                createwindowsimage (lwimgfullname)
+            end
+        end -- not hashed or not exists
+    end -- not page 0
+end -- not nil
+end -- createonelateximage
+
+function createlateximages ()
+--
+-- Create lateximages based on lateximages.txt:
+--
+-- See if the document must be recompiled first:
+checklimages ()
+-- See if the print version exists:
+checkhtmlpdfexists ()
+-- Attempt to create the lateximages:
+print ("lwarpmk: Creating lateximages.")
+local limagesfile = io.open("lateximages.txt", "r")
+if ( limagesfile == nil ) then
+    warnlateximages ()
     os.exit(1)
 end
-end -- not hashed or not exists
-end -- not page 0
-end -- not nil
+-- Create the lateximages directory, ignore error if already exists
+err = os.execute("mkdir lateximages")
+-- For Windows, create lwarp_one_limage.cmd from lwarp_one_limage.txt:
+if opsystem=="Windows" then
+    executecheckerror (
+        cpname .. " lwarp_one_limage.txt lwarp_one_limage.cmd" ,
+        "File error trying to copy lwarp_one_limage.txt to lwarp_one_limage.cmd"
+    )
+end -- create lwarp_one_limage.cmd
+-- Track the number of parallel processes
+numimageprocesses = 0
+-- Track warning to recompile if find a page 0
+pagezerowarning = false
+-- Scan lateximages.txt
+for line in limagesfile:lines() do
+    createonelateximage ( line )
 end -- do
 io.close(limagesfile)
 print ( "lwarpmk limages: ===")
 print ( "lwarpmk limages: Wait a moment for the images to complete" )
-print ( "lwarpmk limages: before reloading the page." )
+print ( "lwarpmk limages:   before reloading the page." )
 print ( "lwarpmk limages: ===")
-print ( "lwarpmk limages: done" )
+print ( "lwarpmk limages: Done." )
 if ( pagezerowarning == true ) then
     print ( "lwarpmk limages: WARNING: Images will be incorrect." )
     print ( "lwarpmk limages:   Enter \"lwarpmk cleanlimages\", then" )
@@ -525,9 +575,11 @@
 end -- pagezerowarning
 end -- function
 
+function compilelatexmk ( fsuffix )
+--
 -- Use latexmk to compile source and index:
 -- fsuffix is "" for print, or "_html" for HTML
-function compilelatexmk ( fsuffix )
+--
 -- Maybe select the shell-escape option:
 local thisshellescape = " "
 if ( shellescape == "true" ) then
@@ -537,7 +589,8 @@
 end
 -- The recorder option is required to detect changes in <project>.tex
 -- while we are loading <project>_html.tex.
-err=os.execute ( "latexmk -pdf -dvi- -ps- -recorder "
+executecheckerror (
+    "latexmk -pdf -dvi- -ps- -recorder "
     .. "-e "
     .. opquote
     .. "$makeindex = q/" -- $
@@ -547,19 +600,18 @@
     .. "  -L " .. xindylanguage .. " /"
     .. opquote
     .. " -pdflatex=\"" .. latexname .. thisshellescape .." %O %S\" "
-    .. sourcename..fsuffix ..".tex" ) ;
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: Compile error.")
-    print ("lwarpmk: ===")
-    os.exit(1)
-end
+    .. sourcename..fsuffix ..".tex"
+    ,
+    "Compile error."
+)
 end -- function
 
+function convertpdftosvg ()
+--
 -- Converts PDF files to SVG files.
 -- The filenames are arg[2] and up.
 -- arg[1] is the command "pdftosvg".
-function convertpdftosvg ()
+--
 for i = 2 , #arg do
     if (lfs.attributes(arg[i],"mode")==nil) then
         print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.")
@@ -570,6 +622,8 @@
 end -- do
 end --function
 
+-- Start of the main code: --
+
 -- lwarpmk --version :
 
 if (arg[1] == "--version") then
@@ -606,6 +660,8 @@
     end
 end -- not latexmk
 
+-- lwarpmk print1:
+
 elseif arg[1] == "print1" then
     loadconf ()
     verifyfileexists (sourcename .. ".tex") ;
@@ -676,6 +732,8 @@
     end
 end -- not latexmk
 
+-- lwarpmk html1:
+
 elseif arg[1] == "html1" then
     loadconf ()
     verifyfileexists ( sourcename .. ".tex" ) ;
@@ -683,6 +741,7 @@
     pdftohtml ()
     print ("lwarpmk: Done.")
 
+-- lwarpmk pdftohtml:
 elseif arg[1] == "pdftohtml" then
     loadconf ()
     pdftohtml ()
@@ -790,6 +849,8 @@
 elseif (arg[1] == "-h" ) or (arg[1] == "--help") then
 printusage ()
 
+-- Unknown command:
+
 else
 printhelp ()
 print ("\nlwarpmk: ****** Unknown command \""..arg[1].."\". ******\n")

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

Modified: trunk/Master/texmf-dist/source/latex/lwarp/lwarp.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/lwarp/lwarp.ins	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/source/latex/lwarp/lwarp.ins	2018-06-06 20:52:12 UTC (rev 47944)
@@ -44,6 +44,7 @@
 \file{lwarp-ae.sty}{\from{lwarp.dtx}{ae}}
 \file{lwarp-aecc.sty}{\from{lwarp.dtx}{aecc}}
 \file{lwarp-afterpage.sty}{\from{lwarp.dtx}{afterpage}}
+\file{lwarp-algorithm2e.sty}{\from{lwarp.dtx}{algorithm2e}}
 \file{lwarp-algorithmicx.sty}{\from{lwarp.dtx}{algorithmicx}}
 \file{lwarp-alltt.sty}{\from{lwarp.dtx}{alltt}}
 \file{lwarp-amsthm.sty}{\from{lwarp.dtx}{amsthm}}
@@ -107,6 +108,7 @@
 \file{lwarp-epigraph.sty}{\from{lwarp.dtx}{epigraph}}
 \file{lwarp-epstopdf.sty}{\from{lwarp.dtx}{epstopdf}}
 \file{lwarp-epstopdf-base.sty}{\from{lwarp.dtx}{epstopdf-base}}
+\file{lwarp-errata.sty}{\from{lwarp.dtx}{errata}}
 \file{lwarp-eso-pic.sty}{\from{lwarp.dtx}{eso-pic}}
 \file{lwarp-everypage.sty}{\from{lwarp.dtx}{everypage}}
 \file{lwarp-everyshi.sty}{\from{lwarp.dtx}{everyshi}}
@@ -145,6 +147,7 @@
 \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-glossary.sty}{\from{lwarp.dtx}{glossary}}
 \file{lwarp-graphicx.sty}{\from{lwarp.dtx}{graphicx}}
 \file{lwarp-graphics.sty}{\from{lwarp.dtx}{graphics}}
 \file{lwarp-grffile.sty}{\from{lwarp.dtx}{grffile}}
@@ -172,6 +175,7 @@
 \file{lwarp-listings.sty}{\from{lwarp.dtx}{listings}}
 \file{lwarp-longtable.sty}{\from{lwarp.dtx}{longtable}}
 \file{lwarp-lscape.sty}{\from{lwarp.dtx}{lscape}}
+\file{lwarp-ltablex.sty}{\from{lwarp.dtx}{ltablex}}
 \file{lwarp-ltcaption.sty}{\from{lwarp.dtx}{ltcaption}}
 \file{lwarp-ltxgrid.sty}{\from{lwarp.dtx}{ltxgrid}}
 \file{lwarp-ltxtable.sty}{\from{lwarp.dtx}{ltxtable}}
@@ -230,6 +234,7 @@
 \file{lwarp-quoting.sty}{\from{lwarp.dtx}{quoting}}
 \file{lwarp-ragged2e.sty}{\from{lwarp.dtx}{ragged2e}}
 \file{lwarp-realscripts.sty}{\from{lwarp.dtx}{realscripts}}
+\file{lwarp-register.sty}{\from{lwarp.dtx}{register}}
 \file{lwarp-relsize.sty}{\from{lwarp.dtx}{relsize}}
 \file{lwarp-resizegather.sty}{\from{lwarp.dtx}{resizegather}}
 \file{lwarp-romanbar.sty}{\from{lwarp.dtx}{romanbar}}
@@ -287,6 +292,7 @@
 \file{lwarp-todo.sty}{\from{lwarp.dtx}{todo}}
 \file{lwarp-todonotes.sty}{\from{lwarp.dtx}{todonotes}}
 \file{lwarp-transparent.sty}{\from{lwarp.dtx}{transparent}}
+\file{lwarp-trimclip.sty}{\from{lwarp.dtx}{trimclip}}
 \file{lwarp-trivfloat.sty}{\from{lwarp.dtx}{trivfloat}}
 \file{lwarp-turnthepage.sty}{\from{lwarp.dtx}{turnthepage}}
 \file{lwarp-typearea.sty}{\from{lwarp.dtx}{typearea}}
@@ -297,6 +303,7 @@
 \file{lwarp-verse.sty}{\from{lwarp.dtx}{verse}}
 \file{lwarp-vertbars.sty}{\from{lwarp.dtx}{vertbars}}
 \file{lwarp-vmargin.sty}{\from{lwarp.dtx}{vmargin}}
+\file{lwarp-vowel.sty}{\from{lwarp.dtx}{vowel}}
 \file{lwarp-vwcol.sty}{\from{lwarp.dtx}{vwcol}}
 \file{lwarp-wallpaper.sty}{\from{lwarp.dtx}{wallpaper}}
 \file{lwarp-wasysym.sty}{\from{lwarp.dtx}{wasysym}}
@@ -303,9 +310,12 @@
 \file{lwarp-watermark.sty}{\from{lwarp.dtx}{watermark}}
 \file{lwarp-wrapfig.sty}{\from{lwarp.dtx}{wrapfig}}
 \file{lwarp-xcolor.sty}{\from{lwarp.dtx}{xcolor}}
+\file{lwarp-xellipsis.sty}{\from{lwarp.dtx}{xellipsis}}
 \file{lwarp-xfrac.sty}{\from{lwarp.dtx}{xfrac}}
+\file{lwarp-xltabular.sty}{\from{lwarp.dtx}{xltabular}}
 \file{lwarp-xltxtra.sty}{\from{lwarp.dtx}{xltxtra}}
 \file{lwarp-xmpincl.sty}{\from{lwarp.dtx}{xmpincl}}
+\file{lwarp-xpiano.sty}{\from{lwarp.dtx}{xpiano}}
 \file{lwarp-xtab.sty}{\from{lwarp.dtx}{xtab}}
 \file{lwarp-xurl.sty}{\from{lwarp.dtx}{xurl}}
 \file{lwarp-xy.sty}{\from{lwarp.dtx}{xy}}

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-adjmulticol.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-adjmulticol.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-adjmulticol.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -28,8 +28,8 @@
 \ifnumcomp{#2}{=}{1}{\renewcommand*{\LWR at mcolstype}{singlecolumn}}{}%
 \LWR at forcenewpage%
 \BlockClass[%
-\LWR at origmbox{margin-left:\LWR at printlength{\LWR at templengthone}} ; %
-\LWR at origmbox{margin-right:\LWR at printlength{\LWR at templengthtwo}}%
+\LWR at print@mbox{margin-left:\LWR at printlength{\LWR at templengthone}} ; %
+\LWR at print@mbox{margin-right:\LWR at printlength{\LWR at templengthtwo}}%
 ]{\LWR at mcolstype}%
 }
 {\endBlockClass}

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-algorithm2e.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-algorithm2e.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-algorithm2e.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -0,0 +1,161 @@
+%%
+%% This is file `lwarp-algorithm2e.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `algorithm2e')
+%% This is a generated file.
+%% 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
+%% 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{algorithm2e}
+
+\renewcommand{\l at algocf}[2]{\hypertocfloat{1}{algocf}{loa}{#1}{#2}}
+\newcommand*{\LWR at floatstyle@algocf}{ruled}
+
+\ifdefstring{\algocf at style}{boxed}{%
+\renewcommand*{\LWR at floatstyle@algocf}{boxed}
+}{}
+
+\ifdefstring{\algocf at style}{boxruled}{%
+\renewcommand*{\LWR at floatstyle@algocf}{boxruled}
+}{}
+
+\ifdefstring{\algocf at style}{plain}{%
+\renewcommand*{\LWR at floatstyle@algocf}{plain}
+}{}
+\newbool{LWR at algocf@dopars}
+\booltrue{LWR at algocf@dopars}
+
+\renewcommand{\algocf at everypar}{%
+\ifbool{LWR at algocf@dopars}{%
+    \ifbool{LWR at doingstartpars}{%
+        \ifnumcomp{\value{LWR at lateximagedepth}}{>}{0}%
+            {}%
+            {%
+                \algocf at everyparnl\algocf at everyparhanging%
+            }%
+    }{}%
+}{}%
+}
+\renewcommand{\algocf at makecaption}[2]{%
+\LWR at caption@begin{algocf}%
+\algocf at captiontext{#1}{#2}%
+\LWR at caption@end%
+}
+\renewcommand{\algocf at makecaption@plain}[2]{%
+    \LWR at caption@begin{algocf}%
+    \algocf at captiontext{#1}{#2}%
+    \LWR at caption@end%
+}
+
+\renewcommand{\algocf at makecaption@boxed}[2]{%
+    \LWR at caption@begin{algocf}%
+    \algocf at captiontext{#1}{#2}%
+    \LWR at caption@end%
+}
+
+\renewcommand{\algocf at makecaption@ruled}[2]{%
+    \LWR at caption@begin{algocf}%
+    \algocf at captiontext{#1}{#2}%
+    \LWR at caption@end%
+}
+\long\def\algocf at latexcaption#1[#2]#3{% original definition of caption
+\boolfalse{LWR at algocf@dopars}%  lwarp
+  \par%
+  \addcontentsline{\csname ext@#1\endcsname}{#1}%
+  {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
+  \begingroup%
+  \@parboxrestore%
+  \if at minipage%
+    \@setminipage%
+  \fi%
+  \normalsize%
+  \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par%
+  \endgroup%
+\booltrue{LWR at algocf@dopars}%   lwarp
+}
+\renewcommand{\algocf at printnl}[1]{%
+    \InlineClass{alg2elinenumber}{\NlSty{#1}}~%
+}%
+\preto\@algocf at init{%
+  \edef\LWR at floatstyle@figure{\LWR at floatstyle@algocf}%
+}
+\renewcommand{\@algocf at start}{%
+    \let\@mathsemicolon=\;\def\;{\ifmmode\@mathsemicolon\else\@endalgoln\fi}%
+    \AlFnt{}%
+    \booltrue{LWR at algocf@dopars}% lwarp
+}
+
+\renewcommand{\@algocf at finish}{%
+    \boolfalse{LWR at algocf@dopars}% lwarp
+    \lineskip\normallineskip\setlength{\skiptotal}{\@defaultskiptotal}%
+    \let\;=\@mathsemicolon%
+    \let\]=\@emathdisplay%
+}
+\renewcommand{\BlankLine}{%
+\LWR at stoppars%
+\LWR at htmltagc{br /}%
+\LWR at startpars%
+}
+\renewcommand{\SetKwInOut}[2]{%
+  \algocf at newcommand{#1}[1]{%
+    \ifthenelse{\boolean{algocf at hanginginout}}%
+        {\relax}%
+        {\algocf at seteveryparhanging{\relax}}%
+    \ifthenelse{\boolean{algocf at inoutnumbered}}%
+        {\relax}%
+        {\algocf at seteveryparnl{\relax}}%
+    {%
+            \KwSty{#2\algocf at typo:}%
+        ~##1\par%
+    }%
+    \algocf at linesnumbered% reset the numbering of the lines
+    \ifthenelse{\boolean{algocf at hanginginout}}%
+        {\relax}%
+        {\algocf at reseteveryparhanging}%
+  }%
+}%
+
+\renewcommand{\ResetInOut}[1]{}%
+\renewcommand{\algocf at Vline}[1]{%
+\boolfalse{LWR at algocf@dopars}%
+\begin{BlockClass}{alg2evline}
+\booltrue{LWR at algocf@dopars}%
+#1
+\boolfalse{LWR at algocf@dopars}%
+\end{BlockClass}
+\booltrue{LWR at algocf@dopars}%
+}
+\renewcommand{\algocf at Vsline}[1]{%
+\boolfalse{LWR at algocf@dopars}%
+\begin{BlockClass}{alg2evsline}
+\booltrue{LWR at algocf@dopars}%
+#1
+\boolfalse{LWR at algocf@dopars}%
+\end{BlockClass}
+\booltrue{LWR at algocf@dopars}%
+}
+\renewcommand{\algocf at Noline}[1]{%
+\boolfalse{LWR at algocf@dopars}%
+\begin{BlockClass}{alg2enoline}
+\booltrue{LWR at algocf@dopars}%
+#1
+\boolfalse{LWR at algocf@dopars}%
+\end{BlockClass}
+\booltrue{LWR at algocf@dopars}%
+}
+\LetLtxMacro\algocf at Here\algocf
+\LetLtxMacro\endalgocf at Here\endalgocf
+
+\endinput
+%%
+%% End of file `lwarp-algorithm2e.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-algorithm2e.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-axodraw2.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-axodraw2.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-axodraw2.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -18,7 +18,7 @@
 
 \LWR at ProvidesPackagePass{axodraw2}
 
-\BeforeBeginEnvironment{axopicture}{\begin{lateximage}[(axopicture)]}
+\BeforeBeginEnvironment{axopicture}{\begin{lateximage}[(-axopicture-~\packagediagramname)]}
 
 \AfterEndEnvironment{axopicture}{\end{lateximage}}
 

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bigdelim.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bigdelim.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bigdelim.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -18,21 +18,19 @@
 \let\ldelim\relax
 \let\rdelim\relax
 \LWR at ProvidesPackagePass{bigdelim}
-\LetLtxMacro\LWR at origldelim\ldelim
-\LetLtxMacro\LWR at origrdelim\rdelim
-\RenewDocumentCommand{\ldelim}{m m m O{}}{%
+\NewDocumentCommand{\LWR at HTML@ldelim}{m m m O{}}{%
 \renewcommand{\LWR at multirowborder}{right}%
 \multirow{#2}{#3}{#4 \InlineClass{ldelim}{#1}}%
 }
 
-\RenewDocumentCommand{\rdelim}{m m m O{}}{%
+\LWR at formatted{ldelim}
+
+\NewDocumentCommand{\LWR at HTML@rdelim}{m m m O{}}{%
 \renewcommand{\LWR at multirowborder}{left}%
 \multirow{#2}{#3}{\InlineClass{rdelim}{#1} #4}%
 }
-\appto\LWR at restoreorigformatting{%
-\LetLtxMacro{\ldelim}{\LWR at origldelim}%
-\LetLtxMacro{\rdelim}{\LWR at origrdelim}%
-}
+
+\LWR at formatted{rdelim}
 \endinput
 %%
 %% End of file `lwarp-bigdelim.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bigstrut.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bigstrut.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bigstrut.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -21,7 +21,7 @@
 \renewcommand\bigstrut[1][x]{}
 
 \appto\LWR at restoreorigformatting{%
-\LetLtxMacro{\bigstrut}{\LWR at origbigstrut}%
+\LetLtxMacro\bigstrut\LWR at origbigstrut%
 }
 \endinput
 %%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-booktabs.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-booktabs.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-booktabs.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -15,14 +15,73 @@
 %%   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.
+\LetLtxMacro\toprule\relax
+\LetLtxMacro\midrule\relax
+\LetLtxMacro\cmidrule\cline
+\LetLtxMacro\bottomrule\relax
+\LetLtxMacro\addlinespace\relax
+\LetLtxMacro\morecmidrules\relax
+\LetLtxMacro\specialrule\relax
+
 \LWR at ProvidesPackagePass{booktabs}
-\LetLtxMacro\LWR at origtoprule\toprule
-\LetLtxMacro\LWR at origmidrule\midrule
-\LetLtxMacro\LWR at origcmidrule\cmidrule
-\LetLtxMacro\LWR at origbottomrule\bottomrule
-\LetLtxMacro\LWR at origaddlinespace\addlinespace
-\LetLtxMacro\LWR at origmorecmidrules\morecmidrules
-\LetLtxMacro\LWR at origspecialrule\specialrule
+\DeclareDocumentCommand{\LWR at HTML@toprule}{o d()}%
+    {%
+        \IfValueTF{#1}%
+            {\LWR at docmidrule[#1](){1-\arabic{LWR at tabletotalcols}}}%
+            {%
+                \ifbool{FormatWP}%
+                {\LWR at docmidrule[#1](){1-\arabic{LWR at tabletotalcols}}}%
+                {\booltrue{LWR at doingtbrule}}%
+            }%
+    \LWR at getmynexttoken}
+
+\LWR at expandableformatted{toprule}
+
+\DeclareDocumentCommand{\LWR at HTML@midrule}{o d()}%
+    {%
+        \IfValueTF{#1}%
+            {\LWR at docmidrule[#1](){1-\arabic{LWR at tabletotalcols}}}%
+            {%
+                \ifbool{FormatWP}%
+                {\LWR at docmidrule[#1](){1-\arabic{LWR at tabletotalcols}}}%
+                {\addtocounter{LWR at hlines}{1}}%
+            }%
+    \LWR at getmynexttoken}
+
+\LWR at expandableformatted{midrule}
+
+\DeclareDocumentCommand{\LWR at HTML@cmidrule}{O{\LWR at cmidrulewidth} d() m}{%
+    \LWR at docmidrule[#1](#2){#3}%
+    \LWR at getmynexttoken%
+}%
+
+\LWR at expandableformatted{cmidrule}
+
+\DeclareDocumentCommand{\LWR at HTML@bottomrule}{o d()}{%
+    \IfValueTF{#1}%
+        {\LWR at docmidrule[#1](){1-\arabic{LWR at tabletotalcols}}}%
+        {%
+            \ifbool{FormatWP}%
+            {\LWR at docmidrule[#1](){1-\arabic{LWR at tabletotalcols}}}%
+            {\booltrue{LWR at doingtbrule}}%
+        }%
+    \LWR at getmynexttoken%
+}%
+
+\LWR at expandableformatted{bottomrule}
+
+\DeclareDocumentCommand{\LWR at HTML@addlinespace}{o}{}%
+
+\LWR at expandableformatted{addlinespace}
+
+\DeclareDocumentCommand{\LWR at HTML@morecmidrules}{}{}%
+
+\LWR at expandableformatted{morecmidrules}
+
+\DeclareDocumentCommand{\LWR at HTML@specialrule}{m m m d()}%
+    {\LWR at docmidrule[#1](){1-\arabic{LWR at tabletotalcols}}\LWR at getmynexttoken}%
+
+\LWR at expandableformatted{specialrule}
 \endinput
 %%
 %% End of file `lwarp-booktabs.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-breakurl.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-breakurl.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-breakurl.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -20,13 +20,9 @@
 
 \NewDocumentCommand{\LWR at burlaltb}{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%
-\endgroup%
+\LWR at subhyperref{#2}%
+\LWR at subhyperreftext{#3}%
+\endgroup% restore catcodes
 }
 
 \newrobustcmd*{\burlalt}{%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bytefield.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bytefield.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-bytefield.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -18,7 +18,7 @@
 
 \LWR at ProvidesPackagePass{bytefield}
 
-\BeforeBeginEnvironment{bytefield}{\begin{lateximage}[(bytefield)]}
+\BeforeBeginEnvironment{bytefield}{\begin{lateximage}[(-bytefield-~\packagediagramname)]}
 
 \AfterEndEnvironment{bytefield}{\end{lateximage}}
 

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemfig.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemfig.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemfig.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -21,7 +21,7 @@
 \LetLtxMacro\LWR at chemfig@origchemfig\chemfig
 
 \DeclareDocumentCommand\chemfig{s O{} O{} m}{%
-    \begin{lateximage}[(chemfig)]%
+    \begin{lateximage}[(-chemfig-~\packagediagramname)]%
     \IfBooleanTF{#1}{%
         \LWR at chemfig@origchemfig*[#2][#3]{#4}%
     }{%
@@ -33,18 +33,18 @@
 \LetLtxMacro\LWR at chemfig@origCF at lewis@b\CF at lewis@b
 
 \def\CF at lewis@b#1#2{%
-\begin{lateximage}[(chemfig)]%
+\begin{lateximage}[(-chemfig-~\packagediagramname)]%
 \LWR at chemfig@origCF at lewis@b{#1}{#2}%
 \end{lateximage}%
 }
 
-\preto{\schemestart}{\begin{lateximage}[(chemfig)]}
+\preto{\schemestart}{\begin{lateximage}[(-chemfig-~\packagediagramname)]}
 \appto{\CF at schemestop}{\end{lateximage}}
 
 \LetLtxMacro\LWR at chemfig@origchemleft\chemleft
 
 \def\chemleft#1#2\chemright#3{%
-\begin{lateximage}[(chemfig)]%
+\begin{lateximage}[(-chemfig-~\packagediagramname)]%
 \LWR at chemfig@origchemleft#1#2\chemright#3%
 \end{lateximage}%
 }
@@ -52,7 +52,7 @@
 \LetLtxMacro\LWR at chemfig@origchemup\chemup
 
 \def\chemup#1#2\chemdown#3{%
-\begin{lateximage}[(chemfig)]%
+\begin{lateximage}[(-chemfig-~\packagediagramname)]%
 \LWR at chemfig@origchemup#1#2\chemdown#3%
 \end{lateximage}%
 }

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemformula.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -68,7 +68,7 @@
   }
 \RenewDocumentCommand \charrow { mO{}O{} }
 {
-    \begin{lateximage}[(charrow)]
+    \begin{lateximage}[(-chemformula- charrow)]
     \group_begin:
       \__chemformula_draw_arrow:nnn {#1} {#2} {#3}
     \group_end:

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemmacros.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemmacros.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-chemmacros.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -25,11 +25,11 @@
 
 \ExplSyntaxOff
 \DeclareDocumentEnvironment{polymerdelims}{}
-{\begin{lateximage}[(polymer)]}
+{\begin{lateximage}[(-chemmacros- polymer)]}
 {\end{lateximage}}
 
 \DeclareDocumentEnvironment{redoxreaction}{m m}
-{\begin{lateximage}[(redox~reaction)]}
+{\begin{lateximage}[(-chemmacros- redoxreaction)]}
 {\end{lateximage}}
 \ExplSyntaxOn
 \AtBeginDocument{

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-colortbl.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-colortbl.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-colortbl.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -15,49 +15,49 @@
 %%   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.
+\let\rowcolor\relax
+
 \LWR at ProvidesPackagePass{colortbl}
-
-\LetLtxMacro\LWR at origcolumncolor\columncolor
-\LetLtxMacro\LWR at origrowcolor\rowcolor
-\LetLtxMacro\LWR at origcellcolor\cellcolor
-\LetLtxMacro\LWR at origarrayrulecolor\arrayrulecolor
-\LetLtxMacro\LWR at origdoublerulesepcolor\doublerulesepcolor
-
-\appto\LWR at restoreorigformatting{%
-\LetLtxMacro\columncolor\LWR at origcolumncolor%
-\LetLtxMacro\rowcolor\LWR at origrowcolor%
-\LetLtxMacro\cellcolor\LWR at origcellcolor%
-\LetLtxMacro\arrayrulecolor\LWR at origarrayrulecolor%
-\LetLtxMacro\doublerulesepcolor\LWR at origdoublerulesepcolor%
-}
-
-\RenewDocumentCommand{\LWR at HTMLcolumncolor}{O{named} m o o}{%
+\NewDocumentCommand{\LWR at HTML@columncolor}{O{named} m o o}{%
 \convertcolorspec{#1}{#2}{HTML}\LWR at columnHTMLcolor%
 \LWR at addtabularcellcolor%
 }
-\RenewDocumentCommand{\LWR at HTMLrowcolor}{O{named} m o o}{%
+
+\LWR at formatted{columncolor}
+\NewDocumentCommand{\LWR at HTML@rowcolor}{O{named} m o o}{%
 \convertcolorspec{#1}{#2}{HTML}\LWR at rowHTMLcolor%
 \LWR at getmynexttoken%
 }
 
-\RenewDocumentCommand{\LWR at HTMLcellcolor}{O{named} m o o}{%
+\LWR at expandableformatted{rowcolor}
+\NewDocumentCommand{\LWR at HTML@cellcolor}{O{named} m o o}{%
 \convertcolorspec{#1}{#2}{HTML}\LWR at cellHTMLcolor%
 \LWR at addtabularcellcolor%
 }
 
-\renewcommand{\arrayrulecolor}[2][named]{%
+\LWR at formatted{cellcolor}
+
+\newcommand{\LWR at HTML@arrayrulecolor}[2][named]{%
 \convertcolorspec{#1}{#2}{HTML}\LWR at ruleHTMLcolor%
 }
 
-\renewcommand{\LWR at HTMLarrayrulecolor}[2][named]{%
+\LWR at expandableformatted{arrayrulecolor}
+
+\newcommand{\LWR at HTML@arrayrulecolornexttoken}[2][named]{%
 \convertcolorspec{#1}{#2}{HTML}\LWR at ruleHTMLcolor%
 \LWR at getmynexttoken%
 }
 
-\renewcommand{\doublerulesepcolor}[2][named]{}
+\LWR at expandableformatted{arrayrulecolornexttoken}
 
-\renewcommand{\LWR at HTMLdoublerulesepcolor}[2][named]{\LWR at getmynexttoken}
+\newcommand{\LWR at HTML@doublerulesepcolor}[2][named]{}
 
+\LWR at expandableformatted{doublerulesepcolor}
+
+\newcommand{\LWR at HTML@doublerulesepcolornexttoken}[2][named]{\LWR at getmynexttoken}
+
+\LWR at expandableformatted{doublerulesepcolornexttoken}
+
 \endinput
 %%
 %% End of file `lwarp-colortbl.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ellipsis.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ellipsis.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ellipsis.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -22,6 +22,8 @@
 
 \newcommand{\ellipsisgap}{0.1em}
 
+\newcommand*{\midwordellipsis}{\,\textellipsis\,}
+
 \endinput
 %%
 %% End of file `lwarp-ellipsis.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-epigraph.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-epigraph.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-epigraph.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -34,13 +34,13 @@
 
 \DeclareDocumentCommand{\epigraph}{m m}
 {
-\begin{LWR at BlockClassWP}{\LWR at origmbox{text-align:right}}{}{epigraph}
+\begin{LWR at BlockClassWP}{\LWR at print@mbox{text-align:right}}{}{epigraph}
 \qitem{#1}{#2}
 \end{LWR at BlockClassWP}
 }
 
 \DeclareDocumentEnvironment{epigraphs}{}
-{\LWR at BlockClassWP{\LWR at origmbox{text-align:right}}{}{epigraph}}
+{\LWR at BlockClassWP{\LWR at print@mbox{text-align:right}}{}{epigraph}}
 {\endLWR at BlockClassWP}
 \newenvironment*{flushepinormal}{}{}
 \@ifclassloaded{memoir}{

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-errata.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-errata.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-errata.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -0,0 +1,89 @@
+%%
+%% This is file `lwarp-errata.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `errata')
+%% This is a generated file.
+%% 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
+%% 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.
+
+\StartDefiningMath
+
+\LWR at ProvidesPackagePass{errata}[2006/11/12]
+
+\xpatchcmd{\erratumAdd}
+    {$_a^{\arabic{erratum}}$}
+    {\textsubscript{a}\textsuperscript{\arabic{erratum}}}
+    {}
+    {
+        \PackageError{lwarp}
+        {Unable to patch the erratum package, erratumAdd macro}
+        {Please contact the author of the lwarp package.}
+    }
+
+\xpatchcmd{\erratumDelete}
+    {$_d^{\arabic{erratum}}$}
+    {\textsubscript{d}\textsuperscript{\arabic{erratum}}}
+    {}
+    {
+        \PackageError{lwarp}
+        {Unable to patch the erratum package, erratumDelete macro}
+        {Please contact the author of the lwarp package.}
+    }
+
+\xpatchcmd{\erratumReplace}
+    {$_r^{\arabic{erratum}}$}
+    {\textsubscript{r}\textsuperscript{\arabic{erratum}}}
+    {}
+    {
+        \PackageError{lwarp}
+        {Unable to patch the erratum package, erratumReplace macro}
+        {Please contact the author of the lwarp package.}
+    }
+
+\xpatchcmd{\erratum}
+    {$_a$}
+    {\textsubscript{a}}
+    {}
+    {
+        \PackageError{lwarp}
+        {Unable to patch the erratum package, eDelete macro}
+        {Please contact the author of the lwarp package.}
+    }
+
+\xpatchcmd{\erratum}
+    {$_d^{\@thefnmark}$}
+    {\textsubscript{d}\textsuperscript{\@thefnmark}}
+    {}
+    {
+        \PackageError{lwarp}
+        {Unable to patch the erratum package, eDelete macro}
+        {Please contact the author of the lwarp package.}
+    }
+
+\xpatchcmd{\erratum}
+    {$_r^{\@thefnmark}$}
+    {\textsubscript{r}\textsuperscript{\@thefnmark}}
+    {}
+    {
+        \PackageError{lwarp}
+        {Unable to patch the erratum package, eReplace macro}
+        {Please contact the author of the lwarp package.}
+    }
+
+\preto\PrintErrata{\LWR at orignewpage}
+
+\StopDefiningMath
+
+\endinput
+%%
+%% End of file `lwarp-errata.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-errata.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-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-float.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -17,28 +17,35 @@
 %% version 2005/12/01 or later.
 
 
-\LWR at ProvidesPackageDrop{float}[2016/03/04]
+\LWR at ProvidesPackageDrop{float}[2001/11/08]
 
 
+\newcommand*{\LWR at floatstyle}{plain}
+
 \NewDocumentCommand{\newfloat}{m m m o}{%
 \IfValueTF{#4}%
 {\DeclareFloatingEnvironment[fileext=#3,within=#4]{#1}}%
 {\DeclareFloatingEnvironment[fileext=#3]{#1}}%
+\csedef{LWR at floatstyle@#1}{\LWR at floatstyle}%
 \cslet{listof#1s}\relax%
 \cslet{listof#1es}\relax%
+\cslet{l@#1}\relax%
 }
 
 \NewDocumentCommand{\floatname}{m +m}{%
-\SetupFloatingEnvironment{#1}{name=#2}%
+    \SetupFloatingEnvironment{#1}{name=#2}%
 }
 
 \newcommand*{\floatplacement}[2]{%
-\SetupFloatingEnvironment{#1}{placement=#2}%
+    \SetupFloatingEnvironment{#1}{placement=#2}%
 }
 
-\newcommand{\floatstyle}[1]{}
+\newcommand{\floatstyle}[1]{%
+    \def\LWR at floatstyle{#1}%
+}
 
 \NewDocumentCommand{\restylefloat}{s m}{%
+    \csedef{LWR at floatstyle@#2}{\LWR at floatstyle}%
 }
 
 \endinput

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-glossary.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-glossary.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-glossary.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -0,0 +1,21 @@
+%%
+%% This is file `lwarp-glossary.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `glossary')
+%% This is a generated file.
+%% 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
+%% 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 loadnever{glossary}{glossaries}
+\endinput
+%%
+%% End of file `lwarp-glossary.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-glossary.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-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -297,10 +297,8 @@
 \define at key{krotbox}{x}{}
 \define at key{krotbox}{y}{}
 \define at key{krotbox}{units}{}
-\LetLtxMacro\LWR at origrotatebox\rotatebox
-
 \AtBeginDocument{
-\RenewDocumentCommand{\rotatebox}{O{} m +m}{%
+\NewDocumentCommand{\LWR at HTML@rotatebox}{O{} m +m}{%
 \renewcommand*{\LWR at rotboxorigin}{}
 \setkeys{krotbox}{#1}%
 \LWR at htmltagc{span style="display: inline-block; %
@@ -315,12 +313,12 @@
 \LWR at htmltagc{/span}%
 \end{LWR at nestspan}%
 }
+\LWR at formatted{rotatebox}
+
 }% AtBeginDocument
 
-\LetLtxMacro\LWR at origscalebox\scalebox
-
 \AtBeginDocument{
-\RenewDocumentCommand{\scalebox}{m o m}{%
+\NewDocumentCommand{\LWR at HTML@scalebox}{m o m}{%
 \LWR at htmltagc{span style="display: inline-block; %
 \LWR at scalestyle{-ms-}{#1}{\IfNoValueTF{#2}{#1}{#2}} % extra space
 \LWR at scalestyle{-webkit-}{#1}{\IfNoValueTF{#2}{#1}{#2}} % extra space
@@ -331,19 +329,29 @@
 \LWR at htmltagc{/span}%
 \end{LWR at nestspan}%
 }
+\LWR at formatted{scalebox}
+
 }% AtBeginDocument
 
-\let\LWR at origreflectbox\reflectbox
+\AtBeginDocument{
 
+\newcommand{\LWR at HTML@reflectbox}[1]{%
+\scalebox{-1}[1]{#1}%
+}% \reflectbox
+
+\LWR at formatted{reflectbox}
+
+}% AtBeginDocument
+
 \AtBeginDocument{
-\renewcommand{\reflectbox}[1]{\scalebox{-1}[1]{#1}}
+
+\NewDocumentCommand{\LWR at HTML@resizebox}{s m m m}{%
+#4%
 }
 
-\LetLtxMacro\LWR at origresizebox\resizebox
+\LWR at formatted{resizebox}
 
-\AtBeginDocument{
-\renewcommand{\resizebox}[3]{#3}
-}
+}% AtBeginDocument
 \endinput
 %%
 %% End of file `lwarp-graphics.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-graphicx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-graphicx.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-graphicx.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -17,7 +17,7 @@
 %% version 2005/12/01 or later.
 
 
-\LWR at ProvidesPackagePass{graphicx}
+\LWR at ProvidesPackagePass{graphicx}[2017/06/01]
 
 \endinput
 %%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hang.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hang.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hang.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -30,8 +30,8 @@
 {
     \LWR at findhangingleftmargin%
     \BlockClass[%
-        \LWR at origmbox{margin-left:\LWR at printlength{\LWR at templengthone}} ; %
-        \LWR at origmbox{text-indent:-\LWR at printlength{\hangingindent}}%
+        \LWR at print@mbox{margin-left:\LWR at printlength{\LWR at templengthone}} ; %
+        \LWR at print@mbox{text-indent:-\LWR at printlength{\hangingindent}}%
     ]%
     {hangingpar}%
 }
@@ -43,11 +43,11 @@
     \renewcommand*{\LWR at printopenlist}{%
         \LWR at findhangingleftmargin%
         ul style="%
-            \LWR at origmbox{list-style-type:none;} % extra space
-            \LWR at origmbox{%
+            \LWR at print@mbox{list-style-type:none;} % extra space
+            \LWR at print@mbox{%
                 margin-left:\LWR at printlength{\LWR at templengthone}%
             } ; % extra space
-            \LWR at origmbox{%
+            \LWR at print@mbox{%
                 text-indent:-\LWR at printlength{\hangingindent}%
             }%
         "%
@@ -68,8 +68,8 @@
 {%
     \BlockClass[%
         \LWR at findhangingleftmargin%
-        \LWR at origmbox{margin-left:\LWR at printlength{\LWR at templengthone}} ; %
-        \LWR at origmbox{text-indent:-\LWR at printlength{\hangingindent}}%
+        \LWR at print@mbox{margin-left:\LWR at printlength{\LWR at templengthone}} ; %
+        \LWR at print@mbox{text-indent:-\LWR at printlength{\hangingindent}}%
     ]{labeledpar}#2%
 }
 {\endBlockClass}

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hanging.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hanging.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hanging.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -28,8 +28,8 @@
 \newenvironment*{hangparas}[2]
 {%
     \BlockClass[%
-        \LWR at origmbox{margin-left:\LWR at printlength{#1}} ; %
-        \LWR at origmbox{text-indent:-\LWR at printlength{#1}}%
+        \LWR at print@mbox{margin-left:\LWR at printlength{#1}} ; %
+        \LWR at print@mbox{text-indent:-\LWR at printlength{#1}}%
     ]%
     {hangingpar}%
 }

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-hyperref.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -65,7 +65,7 @@
 
 \newcommand{\LWR at hyperreffinish}[1]{%
 \begingroup%
-\LetLtxMacro\ref\LWR at origref%{} syntax highlighting
+\RenewDocumentCommand{\ref}{}{\LWR at ref@ignorestar}%
 #1%
 \endgroup%
 \LWR at htmltag{/a}%

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ltablex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ltablex.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ltablex.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -0,0 +1,36 @@
+%%
+%% This is file `lwarp-ltablex.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `ltablex')
+%% This is a generated file.
+%% 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
+%% 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.
+
+
+\RequirePackage{tabularx}
+
+\LWR at ProvidesPackageDrop{ltablex}
+
+\DeclareDocumentEnvironment{tabularx}{m o m}
+{\longtable{#3}}
+{\endlongtable}
+
+\DeclareDocumentEnvironment{tabularx*}{m o m}
+{\longtable{#3}}
+{\endlongtable}
+
+\newcommand*{\keepXColumns}{}
+\newcommand*{\convertXColumns}{}
+\endinput
+%%
+%% End of file `lwarp-ltablex.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ltablex.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-marginnote.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-marginnote.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-marginnote.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -16,7 +16,7 @@
 %% and version 1.3 or later is part of all distributions of LaTeX
 %% version 2005/12/01 or later.
 \LWR at ProvidesPackageDrop{marginnote}
-\NewDocumentCommand{\marginnote}{o +m o}{\marginpar{#2}}
+\NewDocumentCommand{\marginnote}{+o +m o}{\marginpar{#2}}
 \newcommand*{\marginnoteleftadjust}{}
 \newcommand*{\marginnoterightadjust}{}
 \newcommand*{\marginnotetextwidth}{}

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -68,9 +68,9 @@
 {box-shadow: none ;}
 \LWR at orignewline
 "}
-\LetLtxMacro\hspace\LWR at orighspace%
-\LetLtxMacro\rule\LWR at origrule%
-\LetLtxMacro\makebox\LWR at origmakebox%
+\LWR at select@print at hspace%
+\renewcommand*{\rule}{\LWR at print@rule}
+\LetLtxMacro\makebox\LWR at print@makebox%
 \LWR at startpars%
 \LWR at traceinfo{LWR at mdframedstart done}%
 }
@@ -134,13 +134,6 @@
     \LWR at mdfprintcolor{frametitlerulecolor}
     ; \LWR at orignewline
 }{}%
-border-radius:
-\setlength{\LWR at titleroundcorner}
-    {\maxof{\mdf at roundcorner@length-\mdf at linewidth@length}{0pt}}
-    \LWR at printlength{\LWR at titleroundcorner}
-    \LWR at printlength{\LWR at titleroundcorner}
-    0pt 0pt
-    \LWR at orignewline
 " \LWR at orignewline
 }% span
 \begin{LWR at nestspan}%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-midpage.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-midpage.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-midpage.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -17,7 +17,7 @@
 %% version 2005/12/01 or later.
 \LWR at ProvidesPackageDrop{midpage}
 \newenvironment{midpage}
-{\begin{BlockClass}[\LWR at origmbox{margin-top:6ex} ; \LWR at origmbox{margin-bottom:6ex}]{midpage}}
+{\begin{BlockClass}[\LWR at print@mbox{margin-top:6ex} ; \LWR at print@mbox{margin-bottom:6ex}]{midpage}}
 {\end{BlockClass}}
 \endinput
 %%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-multirow.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-multirow.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-multirow.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -17,22 +17,22 @@
 %% version 2005/12/01 or later.
 
 
+\LetLtxMacro\multirow\relax
 \LWR at ProvidesPackagePass{multirow}
-\LetLtxMacro\LWR at origmultirow\multirow
 \newcommand{\LWR at multirowborder}{}
-\RenewDocumentCommand{\multirow}{O{c} m o m o +m}%
+\NewDocumentCommand{\LWR at HTML@multirow}{O{c} m o m o +m}%
 {%
-\LWR at traceinfo{*** multirow #1 #2 #4}%
+\LWR at traceinfo{*** LWR at HTML@multirow #1 #2 #4}%
 \LWR at maybenewtablerow%
 \LWR at tabularleftedge%
 \LWR at htmltag{td rowspan="#2" %
 \IfValueT{#1}{%
-\ifstrequal{#1}{b}{style="\LWR at origmbox{vertical-align:bottom}" }{}%
-\ifstrequal{#1}{t}{style="\LWR at origmbox{vertical-align:top}" }{}%
+\ifstrequal{#1}{b}{style="\LWR at print@mbox{vertical-align:bottom}" }{}%
+\ifstrequal{#1}{t}{style="\LWR at print@mbox{vertical-align:top}" }{}%
 }%
 \ifdefvoid{\LWR at multirowborder}{}{%
-style="\LWR at origmbox{border-\LWR at multirowborder:} 2px dotted black ; %
-\LWR at origmbox{padding-\LWR at multirowborder:} 2px" %
+style="\LWR at print@mbox{border-\LWR at multirowborder:} 2px dotted black ; %
+\LWR at print@mbox{padding-\LWR at multirowborder:} 2px" %
 }%
 class="td%
 \StrChar{\LWR at tablecolspec}{\arabic{LWR at tablecolindex}}%
@@ -51,9 +51,13 @@
 \LWR at stoppars%
 \global\boolfalse{LWR at intabularmetadata}%
 \renewcommand{\LWR at multirowborder}{}%
-\LWR at traceinfo{*** multirow done}%
+\LWR at traceinfo{*** LWR at HTML@multirow done}%
 }%
-\NewDocumentCommand{\multicolumnrow}{m m O{} m O{} m O{} +m}{%
+
+\LWR at formatted{multirow}
+\AtBeginDocument{
+
+\NewExpandableDocumentCommand{\LWR at HTML@multicolumnrow}{m m O{} m O{} m O{} +m}{%
 \LWR at tabularhtmlcolumns{\arabic{LWR at tablecolindex}}{#1}
 \begingroup%
 \LetLtxMacro{\\}{\LWR at endofline}%
@@ -63,10 +67,10 @@
 \addtocounter{LWR at tablecolindex}{-1}%
 \booltrue{LWR at skipatbang}%
 }
-\appto\LWR at restoreorigformatting{%
-\LetLtxMacro\multirow\LWR at origmultirow%
-\renewcommand{\multicolumnrow}{\LWR at origmulticolumnrow}%
-}
+
+\LWR at expandableformatted{multicolumnrow}
+
+}% \AtBeginDocument
 \endinput
 %%
 %% End of file `lwarp-multirow.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -180,7 +180,7 @@
 \newcommand{\LWR at inctheorem}{%
 \addtocounter{LWR at thisautoid}{1}%
 \LWR at stoppars%
-\LWR at htmltag{a id="\LWR at origmbox{autoid-\arabic{LWR at thisautoid}}"}\LWR at htmltag{/a}%
+\LWR at htmltag{a id="\LWR at print@mbox{autoid-\arabic{LWR at thisautoid}}"}\LWR at htmltag{/a}%
 \LWR at startpars%
 }
 \gdef\newtheoremstyle#1#2#3{%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-quoting.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-quoting.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-quoting.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -24,7 +24,7 @@
     {
         \PackageError{lwarp}
         {Unable to patch the quoting package}
-        {Please contact the author of lwarp.}
+        {Please contact the author of the lwarp package.}
     }
 \xpatchcmd{\endquoting}{\quo at endtext}
     {\quo at endtext\end{LWR at blocktextcurrentfont}}
@@ -32,7 +32,7 @@
     {
         \PackageError{lwarp}
         {Unable to patch the quoting package}
-        {Please contact the author of lwarp.}
+        {Please contact the author of the lwarp package.}
     }
 
 \endinput

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-realscripts.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-realscripts.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-realscripts.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -28,8 +28,12 @@
 
 \newcommand*{\LWR at setrealscriptsalign}[1]{%
 \renewcommand*{\LWR at realscriptsalign}{}%
-\ifthenelse{\equal{#1}{c}}{\renewcommand{\LWR at realscriptsalign}{\LWR at origmbox{text-align:center} ; }}{}%
-\ifthenelse{\equal{#1}{r}}{\renewcommand{\LWR at realscriptsalign}{\LWR at origmbox{text-align:right} ; }}{}%
+\ifthenelse{\equal{#1}{c}}{%
+    \renewcommand{\LWR at realscriptsalign}{\LWR at print@mbox{text-align:center} ; }%
+}{}%
+\ifthenelse{\equal{#1}{r}}{%
+    \renewcommand{\LWR at realscriptsalign}{\LWR at print@mbox{text-align:right} ; }%
+}{}%
 }
 
 \DeclareDocumentCommand \textsubsuperscript {s O{l} mm} {%

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-register.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-register.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-register.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -0,0 +1,40 @@
+%%
+%% This is file `lwarp-register.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `register')
+%% This is a generated file.
+%% 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
+%% 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{register}
+
+\xpatchcmd{\register}
+    {\centering}
+    {\begin{center}\begin{lateximage}[-register-~\packagediagramname]}
+    {\typeout{Patch register success.}}
+    {\typeout{Patch register failure.}}
+
+\xpatchcmd{\endregister}
+    {\leftskip}
+    {%
+        \end{lateximage}\end{center}%
+        \leftskip%
+    }%
+    {\typeout{Patch endregister success.}}
+    {\typeout{Patch endregister failure.}}
+
+\setlength{\regWidth}{5in}
+
+\endinput
+%%
+%% End of file `lwarp-register.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-register.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-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-rotfloat.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -17,7 +17,7 @@
 %% version 2005/12/01 or later.
 
 
-\LWR at ProvidesPackageDrop{rotfloat}
+\LWR at ProvidesPackageDrop{rotfloat}[2004/01/04]
 
 \RequirePackage{float}
 \RenewDocumentCommand{\newfloat}{m m m o}{%
@@ -27,12 +27,15 @@
 }%
 {%
     \DeclareFloatingEnvironment[fileext=#3]{#1}%
-    \DeclareFloatingEnvironment[fileext=#3]{sideways#1}%
 }%
 \csletcs{sideways#1}{#1}%
 \csletcs{endsideways#1}{end#1}%
+\csedef{LWR at floatstyle@#1}{\LWR at floatstyle}%
+\csedef{LWR at floatstyle@sideways#1}{\LWR at floatstyle}%
 \cslet{listof#1s}\relax%
 \cslet{listof#1es}\relax%
+\cslet{listofsideways#1s}\relax%
+\cslet{listofsideways#1es}\relax%
 }
 \endinput
 %%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-scrextend.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-scrextend.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-scrextend.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -78,12 +78,12 @@
 \DeclareDocumentCommand{\raggedfootnote}{}{}
 
 \DeclareDocumentCommand{\dictum}{o m}{
-\begin{LWR at BlockClassWP}{\LWR at origmbox{text-align:right}}{}{dictum}
+\begin{LWR at BlockClassWP}{\LWR at print@mbox{text-align:right}}{}{dictum}
     #2
     \IfValueT{#1}
     {
         \ifbool{FormatWP}
-        {\begin{BlockClass}[\LWR at origmbox{border-top:} 1px solid gray]{dictumauthor}}
+        {\begin{BlockClass}[\LWR at print@mbox{border-top:} 1px solid gray]{dictumauthor}}
         {\begin{BlockClass}{dictumauthor}}
         \dictumauthorformat{#1}
         \end{BlockClass}
@@ -123,15 +123,15 @@
 \ifblank{#2}
 {
     \begin{BlockClass}[
-        \LWR at origmbox{margin-left:\LWR at printlength{\LWR at templengthtwo}} ;
-        \LWR at origmbox{margin-right:\LWR at printlength{\LWR at templengthtwo}}
+        \LWR at print@mbox{margin-left:\LWR at printlength{\LWR at templengthtwo}} ;
+        \LWR at print@mbox{margin-right:\LWR at printlength{\LWR at templengthtwo}}
     ]{addmargin}
 }
 {
     \setlength{\LWR at templengthone}{#2}
     \begin{BlockClass}[
-        \LWR at origmbox{margin-left:\LWR at printlength{\LWR at templengthone}} ;
-        \LWR at origmbox{margin-right:\LWR at printlength{\LWR at templengthtwo}}
+        \LWR at print@mbox{margin-left:\LWR at printlength{\LWR at templengthone}} ;
+        \LWR at print@mbox{margin-right:\LWR at printlength{\LWR at templengthtwo}}
     ]{addmargin}
 }
 }

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-siunitx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-siunitx.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-siunitx.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -68,7 +68,7 @@
   \int_new:c { c__siunitx_math #1 _int }
   \group_begin:% lwarp
     \LetLtxMacro\@ensuredmath\LWR at origensuredmath% lwarp
-    \LetLtxMacro\mbox\LWR at origmbox% lwarp
+    \LetLtxMacro\mbox\LWR at print@mbox% lwarp
     \hbox_set:Nn \l__siunitx_tmp_box
       {
         \ensuremath
@@ -86,7 +86,7 @@
 \cs_new_protected:Npn \__siunitx_combined_output:n #1 {
     \group_begin:% lwarp
     \LetLtxMacro\@ensuredmath\LWR at origensuredmath% lwarp
-    \LetLtxMacro\mbox\LWR at origmbox% lwarp
+    \LetLtxMacro\mbox\LWR at print@mbox% lwarp
   \bool_if:NTF \l__siunitx_number_parse_bool
     {
       \tl_clear:N \l__siunitx_number_out_tl
@@ -172,7 +172,7 @@
   \leavevmode
   \group_begin:% lwarp
     \LetLtxMacro\@ensuredmath\LWR at origensuredmath% lwarp
-    \LetLtxMacro\mbox\LWR at origmbox% lwarp
+    \LetLtxMacro\mbox\LWR at print@mbox% lwarp
     \bool_set_false:N \l__siunitx_font_set_bool
     \IfNoValueF {#1}
       { \keys_set:nn { siunitx } {#1} }
@@ -184,7 +184,7 @@
   \leavevmode
   \group_begin:% lwarp
     \LetLtxMacro\@ensuredmath\LWR at origensuredmath% lwarp
-    \LetLtxMacro\mbox\LWR at origmbox% lwarp
+    \LetLtxMacro\mbox\LWR at print@mbox% lwarp
     \bool_set_false:N \l__siunitx_font_set_bool
     \IfNoValueF {#1}
       { \keys_set:nn { siunitx } {#1} }
@@ -195,7 +195,7 @@
 \RenewDocumentCommand \ang { o > { \SplitArgument { 2 } { ; } } m } {
   \group_begin:% lwarp
     \LetLtxMacro\@ensuredmath\LWR at origensuredmath% lwarp
-    \LetLtxMacro\mbox\LWR at origmbox% lwarp
+    \LetLtxMacro\mbox\LWR at print@mbox% lwarp
     \IfNoValueF {#1}
       { \keys_set:nn { siunitx } {#1} }
     \__siunitx_angle_output:nnn #2
@@ -206,7 +206,7 @@
   \leavevmode
   \group_begin:% lwarp
     \LetLtxMacro\@ensuredmath\LWR at origensuredmath% lwarp
-    \LetLtxMacro\mbox\LWR at origmbox% lwarp
+    \LetLtxMacro\mbox\LWR at print@mbox% lwarp
     \bool_set_false:N \l__siunitx_font_set_bool
     \IfNoValueTF {#1}
       { \__siunitx_unit_output:nn {#2} { } }
@@ -222,7 +222,7 @@
   \leavevmode
   \group_begin:% lwarp
     \LetLtxMacro\@ensuredmath\LWR at origensuredmath% lwarp
-    \LetLtxMacro\mbox\LWR at origmbox% lwarp
+    \LetLtxMacro\mbox\LWR at print@mbox% lwarp
     \bool_set_false:N \l__siunitx_font_set_bool
     \IfNoValueTF {#1}
       { \__siunitx_range_unit:nnnn {#4} { } {#2} {#3} }

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -34,8 +34,8 @@
 
 \appto\endpgfpicture{\end{lateximage}}
 
-\LetLtxMacro\pgfutil at minipage\LWR at origminipage
-\let\pgfutil at endminipage\LWR at origendminipage
+\LetLtxMacro\pgfutil at minipage\LWR at print@minipage
+\let\pgfutil at endminipage\endLWR at print@minipage
 
 \let\pgfutil at raggedleft\LWR at origraggedleft
 \let\pgfutil at raggedright\LWR at origraggedright

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-trimclip.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-trimclip.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-trimclip.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -0,0 +1,35 @@
+%%
+%% This is file `lwarp-trimclip.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `trimclip')
+%% This is a generated file.
+%% 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
+%% 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{trimclip}
+\csdef{trimbox}{\@ifstar\@gobble\@gobble}
+\csletcs{trimbox*}{trimbox}
+\def\endtrimbox{}
+\csletcs{endtrimbox*}{endtrimbox}
+
+\csletcs{clipbox}{trimbox}
+\csletcs{clipbox*}{trimbox}
+\csletcs{endclipbox}{endtrimbox}
+\csletcs{endclipbox*}{endtrimbox}
+
+\csletcs{marginbox}{trimbox}
+\csletcs{marginbox*}{trimbox}
+\csletcs{endmarginbox}{endtrimbox}
+\csletcs{endmarginbox*}{endtrimbox}
+\endinput
+%%
+%% End of file `lwarp-trimclip.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-trimclip.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-vowel.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-vowel.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-vowel.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -0,0 +1,33 @@
+%%
+%% This is file `lwarp-vowel.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `vowel')
+%% This is a generated file.
+%% 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
+%% 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{vowel}
+
+\renewenvironment{vowel}[1][]
+    {%
+        \begin{lateximage}[(-vowel-~\packagediagramname)]%
+        \@vowel[#1]%
+    }
+    {%
+        \@@vowel%
+        \end{lateximage}%
+    }
+
+\endinput
+%%
+%% End of file `lwarp-vowel.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-vowel.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xcolor.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xcolor.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xcolor.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -20,21 +20,11 @@
 \LWR at ProvidesPackagePass{xcolor}
 
 \begin{warpHTML}
-\LetLtxMacro\LWRprint at textcolor\textcolor
-\LetLtxMacro\LWRprint at pagecolor\pagecolor
-\LetLtxMacro\LWRprint at nopagecolor\nopagecolor
-\LetLtxMacro\LWRprint at colorbox\colorbox
-\LetLtxMacro\LWRprint at colorboxBlock\colorbox
-\LetLtxMacro\LWRorigprint at fcolorbox\fcolorbox
-\LetLtxMacro\LWRorigprint at fcolorboxBlock\fcolorbox
-\LetLtxMacro\LWRorigprint at boxframe\boxframe
+\LetLtxMacro\LWR at print@pagecolor\pagecolor
+\LetLtxMacro\LWR at print@nopagecolor\nopagecolor
 \appto\LWR at restoreorigformatting{%
-\LetLtxMacro\textcolor\LWRprint at textcolor%
-\LetLtxMacro\pagecolor\LWRprint at pagecolor%
-\LetLtxMacro\nopagecolor\LWRprint at nopagecolor%
-\LetLtxMacro\colorbox\LWRprint at colorbox%
-\LetLtxMacro\fcolorbox\LWRprint at fcolorbox%
-\LetLtxMacro\boxframe\LWRorigprint at boxframe%
+\LetLtxMacro\pagecolor\LWR at print@pagecolor%
+\LetLtxMacro\nopagecolor\LWR at print@nopagecolor%
 }
 \renewcommand*{\LWR at findcurrenttextcolor}{%
 \protect\colorlet{LWR at current@color}{.}%
@@ -76,7 +66,7 @@
 border:\LWR at printlength{\LWR at atleastonept} solid \LWR at colorstyle{#1}{#2} ; %
 padding:\LWR at printlength{\fboxsep}%
 }
-\RenewDocumentCommand{\textcolor}{o m m}{%
+\NewDocumentCommand{\LWR at HTML@textcolor}{o m m}{%
 \begingroup%
 \IfValueTF{#1}{%
     \color[#1]{#2}%
@@ -98,11 +88,13 @@
 \endgroup%
 }
 
+\LWR at formatted{textcolor}
+
 \renewcommand*{\pagecolor}[2][named]{}
 
 \renewcommand*{\nopagecolor}{}
 
-\RenewDocumentCommand{\colorbox}{O{named} m +m}{%
+\NewDocumentCommand{\LWR at HTML@colorbox}{O{named} m +m}{%
 \begingroup%
 \LWR at FBcancel%
 \InlineClass[%
@@ -112,7 +104,11 @@
 \endgroup%
 }
 
-\NewDocumentCommand{\colorboxBlock}{O{named} m +m}{%
+\AtBeginDocument{
+\LWR at formatted{colorbox}
+}
+
+\NewDocumentCommand{\LWR at HTML@colorboxBlock}{O{named} m +m}{%
 \begingroup%
 \LWR at FBcancel%
 \begin{BlockClass}[%
@@ -124,7 +120,11 @@
 \endgroup%
 }
 
-\RenewDocumentCommand{\fcolorbox}{O{named} m O{named} m +m}{%
+\AtBeginDocument{
+\LWR at formatted{colorboxBlock}
+}
+
+\NewDocumentCommand{\LWR at HTML@fcolorbox}{O{named} m O{named} m +m}{%
 \LWR at traceinfo{HTML fcolorbox #2 #4}%
 \begingroup%
 \LWR at FBcancel%
@@ -144,7 +144,11 @@
 \endgroup%
 }
 
-\NewDocumentCommand{\fcolorboxBlock}{O{named} m O{named} m +m}{%
+\AtBeginDocument{
+\LWR at formatted{fcolorbox}
+}
+
+\NewDocumentCommand{\LWR at HTML@fcolorboxBlock}{O{named} m O{named} m +m}{%
 \LWR at traceinfo{HTML fcolorboxBlock #2 #4}%
 \begingroup%
 \LWR at FBcancel%
@@ -170,6 +174,10 @@
 \LWR at traceinfo{HTML fcolorboxBlock done}%
 }
 
+\AtBeginDocument{
+\LWR at formatted{fcolorboxBlock}
+}
+
 \NewDocumentCommand{\LWR at subfcolorminipage}{m m m m}{%
 \begin{BlockClass}[%
 #3%
@@ -178,7 +186,7 @@
 width:\LWR at printlength{\LWR at tempwidth}%
 ]{fcolorminipage}%
 }
-\NewDocumentEnvironment{fcolorminipage}{O{named} m O{named} m O{c} o o m}
+\NewDocumentEnvironment{LWR at HTML@fcolorminipage}{O{named} m O{named} m O{c} o o m}
 {%
 \LWR at FBcancel%
 \setlength{\LWR at tempwidth}{#8}%
@@ -193,12 +201,17 @@
 }%
 }
 {\end{BlockClass}}
-\renewcommand*{\boxframe}[3]{%
+
+\AtBeginDocument{
+\LWR at formattedenv{fcolorminipage}
+}
+\newcommand*{\LWR at HTML@boxframe}[3]{%
 {%
 \setlength{\LWR at tempwidth}{#1}%
 \setlength{\LWR at tempheight}{#2}%
 \addtolength{\LWR at tempheight}{#3}%
 \LWR at forceminwidth{\fboxrule}%
+\LWR at findcurrenttextcolor%
 \InlineClass[%
 display:inline-block ; %
 border:\LWR at printlength{\LWR at atleastonept} solid \LWR at currenttextcolor{} ; %
@@ -207,6 +220,8 @@
 ]{boxframe}{}%
 }%
 }
+
+\LWR at formatted{boxframe}
 \newcommand*{\LWR at xcolortempcolor}{}
 
 \def\rowc at l@rs[#1]#2#3#4%

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xellipsis.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xellipsis.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xellipsis.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -0,0 +1,53 @@
+%%
+%% This is file `lwarp-xellipsis.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `xellipsis')
+%% This is a generated file.
+%% 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
+%% 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{xellipsis}
+
+\newcommand*{\LWR at xellipsespace}[1]{%
+\ifdim#1=0pt\else%
+    \ifdim#1<\fontdimen2\font%
+        \,%
+    \else%
+        ~%
+    \fi%
+\fi%
+}
+
+\def\xelip{%
+\mbox{%
+    \LWR at xellipsespace{\xelipprebef}%
+    \xelipprechar%
+    \LWR at xellipsespace{\xelippreaft}%
+    \LWR at xellipsespace{\xelipbef}%
+    \xelipchar%
+    \xel at loopi = 1%
+    \loop\ifnum\xelipnum>\xel at loopi%
+        \advance\xel at loopi by1%
+        \LWR at xellipsespace{\xelipgap}%
+        \xelipchar%
+    \repeat%
+    \LWR at xellipsespace{\xelipaft}%
+    \LWR at xellipsespace{\xelippostbef}%
+    \xelippostchar%
+    \LWR at xellipsespace{\xelippostaft}%
+}%
+}%
+
+\endinput
+%%
+%% End of file `lwarp-xellipsis.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xellipsis.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-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xfrac.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -38,18 +38,16 @@
 \LWR at htmltagc{/span}%
 \endLWR at nestspan%
 }
-\NewDocumentCommand{\LWR at noscalebox}{m o m}{#3}
-
 \DeclareInstance{xfrac}{default}{text}{
 numerator-format = {%
 \begingroup%
-\LetLtxMacro{\scalebox}{\LWR at noscalebox}%
+\RenewDocumentCommand{\scalebox}{m o m}{##3}%
 \LWR at htmlsmallfontstart\textsuperscript{#1}\,\LWR at htmlsmallfontend%
 \endgroup%
 },
 denominator-format = {%
 \begingroup%
-\LetLtxMacro{\scalebox}{\LWR at noscalebox}%
+\RenewDocumentCommand{\scalebox}{m o m}{##3}%
 \LWR at htmlsmallfontstart{}\,#1\LWR at htmlsmallfontend%
 \endgroup%
 },
@@ -59,13 +57,13 @@
 \DeclareInstance{xfrac}{lmr}{text}{
 numerator-format = {%
 \begingroup%
-\LetLtxMacro{\scalebox}{\LWR at noscalebox}%
+\RenewDocumentCommand{\scalebox}{m o m}{##3}%
 \LWR at htmlsmallfontstart\textsuperscript{#1}\,\LWR at htmlsmallfontend%
 \endgroup%
 },
 denominator-format = {%
 \begingroup%
-\LetLtxMacro{\scalebox}{\LWR at noscalebox}%
+\RenewDocumentCommand{\scalebox}{m o m}{##3}%
 \LWR at htmlsmallfontstart{}\,#1\LWR at htmlsmallfontend%
 \endgroup%
 },
@@ -75,13 +73,13 @@
 \DeclareInstance{xfrac}{lmss}{text}{
 numerator-format = {%
 \begingroup%
-\LetLtxMacro{\scalebox}{\LWR at noscalebox}%
+\RenewDocumentCommand{\scalebox}{m o m}{##3}%
 \LWR at htmlsmallfontstart\textsuperscript{#1}\,\LWR at htmlsmallfontend%
 \endgroup%
 },
 denominator-format = {%
 \begingroup%
-\LetLtxMacro{\scalebox}{\LWR at noscalebox}%
+\RenewDocumentCommand{\scalebox}{m o m}{##3}%
 \LWR at htmlsmallfontstart{}\,#1\LWR at htmlsmallfontend%
 \endgroup%
 },
@@ -91,13 +89,13 @@
 \DeclareInstance{xfrac}{lmtt}{text}{
 numerator-format = {%
 \begingroup%
-\LetLtxMacro{\scalebox}{\LWR at noscalebox}%
+\RenewDocumentCommand{\scalebox}{m o m}{##3}%
 \LWR at htmlsmallfontstart\textsuperscript{#1}\,\LWR at htmlsmallfontend%
 \endgroup%
 },
 denominator-format = {%
 \begingroup%
-\LetLtxMacro{\scalebox}{\LWR at noscalebox}%
+\RenewDocumentCommand{\scalebox}{m o m}{##3}%
 \LWR at htmlsmallfontstart{}\,#1\LWR at htmlsmallfontend%
 \endgroup%
 },

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xltabular.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xltabular.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xltabular.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -0,0 +1,29 @@
+%%
+%% This is file `lwarp-xltabular.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `xltabular')
+%% This is a generated file.
+%% 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
+%% 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.
+
+
+\RequirePackage{tabularx}
+
+\LWR at ProvidesPackageDrop{xltabular}
+
+\DeclareDocumentEnvironment{xltabular}{o m m}
+{\longtable{#3}}
+{\endlongtable}
+\endinput
+%%
+%% End of file `lwarp-xltabular.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xltabular.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xpiano.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xpiano.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xpiano.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -0,0 +1,41 @@
+%%
+%% This is file `lwarp-xpiano.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `xpiano')
+%% This is a generated file.
+%% 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
+%% 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{xpiano}
+
+\ExplSyntaxOn
+\NewDocumentCommand{\LWR at print@keyboard}{ O{}m }
+{
+\xpiano_keyboard:nn { #1 } { #2 }
+}
+
+\NewDocumentCommand{\LWR at HTML@keyboard}{ O{}m }
+{
+\begin{lateximage}*
+    [-xpiano-~\packagediagramname{}: \detokenize\expandafter{#2}]
+    [\detokenize\expandafter{#1}]
+\xpiano_keyboard:nn { #1 } { #2 }
+\end{lateximage}
+}
+\ExplSyntaxOff
+
+\LWR at formatted{keyboard}
+
+\endinput
+%%
+%% End of file `lwarp-xpiano.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xpiano.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xy.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xy.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-xy.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -20,7 +20,7 @@
 
 \AtBeginDocument{
 
-\preto{\xy}{\begin{lateximage}[(xy)]}
+\preto{\xy}{\begin{lateximage}[(-xy-~\packagediagramname)]}
 \appto{\endxy}{\end{lateximage}}
 
 \@ifundefined{xymatrix}{}{
@@ -27,7 +27,7 @@
 \LetLtxMacro\LWR at origxymatrix\xymatrix
 
 \renewcommand{\xymatrix}[1]{%
-\begin{lateximage}[(xymatrix)]
+\begin{lateximage}[(-xy- xymatrix \packagediagramname)]
 \LWR at origxymatrix{#1}
 \end{lateximage}
 }
@@ -37,7 +37,7 @@
 \LetLtxMacro\LWR at origxygraph\xygraph
 
 \renewcommand{\xygraph}[1]{%
-\begin{lateximage}[(xygraph)]
+\begin{lateximage}[(-xy- xygraph \packagediagramname)]
 \LWR at origxygraph{#1}
 \end{lateximage}
 }

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty	2018-06-06 20:50:49 UTC (rev 47943)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty	2018-06-06 20:52:12 UTC (rev 47944)
@@ -17,7 +17,7 @@
 %% version 2005/12/01 or later.
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesPackage{lwarp}
-    [2018/05/12 v0.56  Allows LaTeX to directly produce HTML5 output.]
+    [2018/06/06 v0.57  Allows LaTeX to directly produce HTML5 output.]
 
 
 
@@ -264,6 +264,7 @@
 \LWR at earlyloadnever{boxedminipage}{boxedminipage2e}
 \LWR at earlyloadnever{caption2}{caption}
 \LWR at earlyloadnever{fancyheadings}{fancyhdr}
+\LWR at earlyloadnever{glossary}{glossaries}
 \LWR at earlyloadnever{t1enc}{fontenc, inputenc, inputenx}
 \LWR at earlyloadnever{wasysym}{textcomp, amssymb, amsfonts, mnsymbol, fdsymbol}
 \LWR at loadafter{a4}
@@ -274,7 +275,10 @@
 \LWR at loadafter{acronym}
 \LWR at loadafter{adjmulticol}
 \LWR at loadafter{addlines}
+\LWR at loadafter{ae}
+\LWR at loadafter{aecc}
 \LWR at loadafter{afterpage}
+\LWR at loadafter{algorithm2e}
 \LWR at loadafter{algorithmicx}
 \LWR at loadafter{alltt}
 \LWR at loadafter{amsmath}
@@ -299,6 +303,8 @@
 \LWR at loadafter{bytefield}
 \LWR at loadafter{cancel}
 \LWR at loadafter{caption}
+\LWR at loadafter{caption2}
+\LWR at loadafter{ccaption}
 \LWR at loadafter{changebar}
 \LWR at notmemoirloadafter{changepage}
 \LWR at notmemoirloadafter{chngpage}
@@ -333,6 +339,7 @@
 \LWR at notmemoirloadafter{epigraph}
 \LWR at loadafter{epstopdf}
 \LWR at loadafter{epstopdf-base}
+\LWR at loadafter{errata}
 \LWR at loadafter{eso-pic}
 \LWR at loadafter{everypage}
 \LWR at loadafter{everyshi}
@@ -339,6 +346,7 @@
 \LWR at loadafter{extramarks}
 \LWR at loadafter{fancybox}
 \LWR at loadafter{fancyhdr}
+\LWR at loadafter{fancyheadings}
 \LWR at loadafter{fancyref}
 \LWR at loadafter{fancyvrb}
 \LWR at loadafter{figcaps}
@@ -368,6 +376,7 @@
 \LWR at loadafter{fwlw}
 \LWR at loadafter{geometry}
 \LWR at loadafter{glossaries}
+\LWR at loadafter{glossary}
 \LWR at loadafter{grffile}
 \LWR at loadafter{grid}
 \LWR at loadafter{gridset}
@@ -391,6 +400,7 @@
 \LWR at loadafter{listings}
 \LWR at loadafter{longtable}
 \LWR at loadafter{lscape}
+\LWR at loadafter{ltablex}
 \LWR at loadafter{ltcaption}
 \LWR at loadafter{ltxgrid}
 \LWR at loadafter{ltxtable}
@@ -446,6 +456,7 @@
 \LWR at loadafter{quoting}
 \LWR at loadafter{ragged2e}
 \LWR at loadafter{realscripts}
+\LWR at loadafter{register}
 \LWR at loadafter{relsize}
 \LWR at loadafter{resizegather}
 \LWR at loadafter{romanbar}
@@ -477,6 +488,7 @@
 \LWR at loadafter{subfig}
 \LWR at loadafter{subfigure}
 \LWR at loadafter{supertabular}
+\LWR at loadafter{t1inc}
 \LWR at loadafter{tabls}
 \LWR at notmemoirloadafter{tabularx}
 \LWR at loadafter{tabulary}
@@ -497,6 +509,7 @@
 \LWR at loadafter{todo}
 \LWR at loadafter{todonotes}
 \LWR at loadafter{transparent}
+\LWR at loadafter{trimclip}
 \LWR at loadafter{trivfloat}
 \LWR at loadafter{turnthepage}
 \LWR at loadafter{ulem}
@@ -507,14 +520,19 @@
 \LWR at notmemoirloadafter{verse}
 \LWR at loadafter{vertbars}
 \LWR at loadafter{vmargin}
+\LWR at loadafter{vowel}
 \LWR at loadafter{vwcol}
 \LWR at loadafter{wallpaper}
+\LWR at loadafter{wasysym}
 \LWR at loadafter{watermark}
 \LWR at loadafter{wrapfig}
 \LWR at loadafter{xcolor}
+\LWR at loadafter{xellipsis}
 \LWR at loadafter{xfrac}
+\LWR at loadafter{xltabular}
 \LWR at loadafter{xltxtra}
 \LWR at loadafter{xmpincl}
+\LWR at loadafter{xpiano}
 \LWR at loadafter{xtab}
 \LWR at loadafter{xurl}
 \LWR at loadafter{xy}
@@ -645,7 +663,7 @@
 
 \begin{warpHTML}
 
-\LetLtxMacro{\LWR at origRequirePackage}{\RequirePackage}
+\LetLtxMacro\LWR at origRequirePackage\RequirePackage
 
 \newcommand*{\LWR at requirepackagenames}{}
 
@@ -706,7 +724,7 @@
     {\LWR at origRequirePackage{\LWR at parsedrequirepackagenames}}%
 }%
 }
-\LetLtxMacro{\usepackage}{\RequirePackage}
+\LetLtxMacro\usepackage\RequirePackage
 
 \NewDocumentCommand{\LWR at ProvidesPackagePass}{m o}{
 \PackageInfo{lwarp}{Using package `#1' and adding lwarp modifications, including options,}%
@@ -830,7 +848,6 @@
 \ifbool{LWR at tracinglwarp}%
 {%
     \typeout{*** lwarp: #1}%
-    % \PackageInfo{lwarp}{#1 : }%
 }%
 {}%
 }
@@ -848,6 +865,63 @@
 
 \end{warpall}
 
+
+
+
+\begin{warpHTML}
+\newcommand*{\LWR at formatting}{HTML}
+\newcommand*{\LWR at formatted}[1]{%
+    \ifcsundef{LWR at print@#1}{%
+        \expandafter\LetLtxMacro\csname LWR at print@#1\expandafter\endcsname%
+            \csname#1\endcsname%
+    }{}%
+    \ifcsundef{#1}{%
+        \expandafter\newrobustcmd\csname #1\endcsname{%
+            \csuse{LWR@\LWR at formatting @#1}%
+        }%
+    }{%
+        \expandafter\renewrobustcmd\csname #1\endcsname{%
+            \csuse{LWR@\LWR at formatting @#1}%
+        }%
+    }%
+}
+\newcommand*{\LWR at expandableformatted}[1]{%
+    \ifcsundef{LWR at print@#1}{%
+        \expandafter\LetLtxMacro\csname LWR at print@#1\expandafter\endcsname%
+            \csname#1\endcsname%
+    }{}%
+    \ifcsundef{#1}{%
+        \expandafter\newcommand\csname #1\endcsname{%
+            \csuse{LWR@\LWR at formatting @#1}%
+        }%
+    }{%
+        \expandafter\renewcommand\csname #1\endcsname{%
+            \csuse{LWR@\LWR at formatting @#1}%
+        }%
+    }%
+}
+\newcommand*{\LWR at formattedenv}[1]{%
+    \ifcsundef{LWR at print@#1}{%
+        \expandafter\LetLtxMacro\csname LWR at print@#1\expandafter\endcsname%
+            \csname#1\endcsname%
+        \csletcs{endLWR at print@#1}{end#1}%
+    }{}%
+    \DeclareDocumentEnvironment{#1}{}%
+    {\csuse{LWR@\LWR at formatting @#1}}%
+    {\csuse{endLWR@\LWR at formatting @#1}}%
+}
+\newcommand*{\LWR at expandableformattedenv}[1]{%
+    \ifcsundef{LWR at print@#1}{%
+        \expandafter\LetLtxMacro\csname LWR at print@#1\expandafter\endcsname%
+            \csname#1\endcsname%
+        \csletcs{endLWR at print@#1}{end#1}%
+    }{}%
+    \DeclareExpandableDocumentEnvironment{#1}{}%
+    {\csuse{LWR@\LWR at formatting @#1}}%
+    {\csuse{endLWR@\LWR at formatting @#1}}%
+}
+\end{warpHTML}
+
 \begin{warpall}
 \newbool{FormatEPUB}
 \boolfalse{FormatEPUB}
@@ -939,8 +1013,6 @@
 
 \begin{warpHTML}
 
-\LetLtxMacro\LWR at origmbox\mbox
-\LetLtxMacro\LWR at origmakebox\makebox
 \chardef\LWR at origpound=`\#
 \let\LWR at origcomma\,
 \let\LWR at origthinspace\thinspace
@@ -948,17 +1020,13 @@
 \let\LWR at origenskip\enskip
 \let\LWR at origquad\quad
 \let\LWR at origqquad\qquad
-
-\let\LWR at orighspace\hspace
 \let\LWR at orighfill\hfill
 \let\LWR at orighfil\hfil
-\let\LWR at origvspace\vspace
 \let\LWR at orighss\hss
 \let\LWR at origllap\llap
 \let\LWR at origrlap\rlap
 \let\LWR at orighfilneg\hfilneg
 
-\let\LWR at origrule\rule
 \let\LWR at orighrulefill\hrulefill
 \let\LWR at origdotfill\dotfill
 
@@ -978,29 +1046,29 @@
 \let\LWR at orighuge\huge
 \let\LWR at origHuge\Huge
 
-\LetLtxMacro{\LWR at origtextrm}{\textrm}
-\LetLtxMacro{\LWR at origtextsf}{\textsf}
-\LetLtxMacro{\LWR at origtexttt}{\texttt}
-\LetLtxMacro{\LWR at origtextnormal}{\textnormal}
-\LetLtxMacro{\LWR at origtextbf}{\textbf}
-\LetLtxMacro{\LWR at origtextmd}{\textmd}
-\LetLtxMacro{\LWR at origtextit}{\textit}
-\LetLtxMacro{\LWR at origtextsl}{\textsl}
-\LetLtxMacro{\LWR at origtextsc}{\textsc}
-\LetLtxMacro{\LWR at origtextup}{\textup}
-\LetLtxMacro{\LWR at origemph}{\emph}
+\LetLtxMacro\LWR at origtextrm\textrm
+\LetLtxMacro\LWR at origtextsf\textsf
+\LetLtxMacro\LWR at origtexttt\texttt
+\LetLtxMacro\LWR at origtextnormal\textnormal
+\LetLtxMacro\LWR at origtextbf\textbf
+\LetLtxMacro\LWR at origtextmd\textmd
+\LetLtxMacro\LWR at origtextit\textit
+\LetLtxMacro\LWR at origtextsl\textsl
+\LetLtxMacro\LWR at origtextsc\textsc
+\LetLtxMacro\LWR at origtextup\textup
+\LetLtxMacro\LWR at origemph\emph
 
-\LetLtxMacro{\LWR at origrmfamily}{\rmfamily}
-\LetLtxMacro{\LWR at origsffamily}{\sffamily}
-\LetLtxMacro{\LWR at origttfamily}{\ttfamily}
-\LetLtxMacro{\LWR at origbfseries}{\bfseries}
-\LetLtxMacro{\LWR at origmdseries}{\mdseries}
-\LetLtxMacro{\LWR at origupshape}{\upshape}
-\LetLtxMacro{\LWR at origslshape}{\slshape}
-\LetLtxMacro{\LWR at origscshape}{\scshape}
-\LetLtxMacro{\LWR at origitshape}{\itshape}
-\LetLtxMacro{\LWR at origem}{\em}
-\LetLtxMacro{\LWR at orignormalfont}{\normalfont}
+\LetLtxMacro\LWR at origrmfamily\rmfamily
+\LetLtxMacro\LWR at origsffamily\sffamily
+\LetLtxMacro\LWR at origttfamily\ttfamily
+\LetLtxMacro\LWR at origbfseries\bfseries
+\LetLtxMacro\LWR at origmdseries\mdseries
+\LetLtxMacro\LWR at origupshape\upshape
+\LetLtxMacro\LWR at origslshape\slshape
+\LetLtxMacro\LWR at origscshape\scshape
+\LetLtxMacro\LWR at origitshape\itshape
+\LetLtxMacro\LWR at origem\em
+\LetLtxMacro\LWR at orignormalfont\normalfont
 
 \let\LWR at origraggedright\raggedright
 \let\LWR at origonecolumn\onecolumn
@@ -1025,10 +1093,6 @@
 \let\LWR at origthispagestyle\thispagestyle
 \LetLtxMacro\LWR at origpagenumbering\pagenumbering
 
-\LetLtxMacro\LWR at origminipage\minipage
-\let\LWR at origendminipage\endminipage
-\LetLtxMacro{\LWR at origparbox}{\parbox}
-
 \let\LWR at orignewline\newline
 
 \AtBeginDocument{% in case packages change definition
@@ -1051,7 +1115,7 @@
 
 \let\LWR at origpar\par
 
-\LetLtxMacro{\LWR at origfootnote}{\footnote}
+\LetLtxMacro\LWR at origfootnote\footnote
 \let\LWR at orig@mpfootnotetext\@mpfootnotetext
 
 \let\LWR at origclearpage\clearpage
@@ -1065,15 +1129,15 @@
 
 \begin{warpHTML}
 \AtBeginDocument{
-\LetLtxMacro{\LWR at origt}{\t}
+\LetLtxMacro\LWR at origt\t
 \ifPDFTeX
-\LetLtxMacro{\LWR at origequalaccent}{\=}
-\LetLtxMacro{\LWR at origdotaccent}{\.}
-\LetLtxMacro{\LWR at origu}{\u}
-\LetLtxMacro{\LWR at origv}{\v}
-\LetLtxMacro{\LWR at origc}{\c}
-\LetLtxMacro{\LWR at origd}{\d}
-\LetLtxMacro{\LWR at origb}{\b}
+\LetLtxMacro\LWR at origequalaccent\=
+\LetLtxMacro\LWR at origdotaccent\.
+\LetLtxMacro\LWR at origu\u
+\LetLtxMacro\LWR at origv\v
+\LetLtxMacro\LWR at origc\c
+\LetLtxMacro\LWR at origd\d
+\LetLtxMacro\LWR at origb\b
 \renewcommand*{\=}[1]{#1\HTMLunicode{0305}}
 \renewcommand*{\.}[1]{#1\HTMLunicode{0307}}
 \renewcommand*{\u}[1]{#1\HTMLunicode{0306}}
@@ -1086,18 +1150,18 @@
 \renewcommand*{\t}[1]{\LWR at t#1}
 \ifPDFTeX
 \newcommand*{\LWR at restoreorigaccents}{%
-\LetLtxMacro{\=}{\LWR at origequalaccent}%
-\LetLtxMacro{\.}{\LWR at origdotaccent}%
-\LetLtxMacro{\u}{\LWR at origu}%
-\LetLtxMacro{\v}{\LWR at origu}%
-\LetLtxMacro{\t}{\LWR at origt}%
-\LetLtxMacro{\c}{\LWR at origc}%
-\LetLtxMacro{\d}{\LWR at origd}%
-\LetLtxMacro{\b}{\LWR at origb}%
+\LetLtxMacro\=\LWR at origequalaccent%
+\LetLtxMacro\.\LWR at origdotaccent%
+\LetLtxMacro\u\LWR at origu%
+\LetLtxMacro\v\LWR at origu%
+\LetLtxMacro\t\LWR at origt%
+\LetLtxMacro\c\LWR at origc%
+\LetLtxMacro\d\LWR at origd%
+\LetLtxMacro\b\LWR at origb%
 }%
 \else% XeLaTeX, LuaLaTeX:
 \newcommand*{\LWR at restoreorigaccents}{%
-\LetLtxMacro{\t}{\LWR at origt}%
+\LetLtxMacro\t\LWR at origt%
 }%
 \fi%
 }% AtBeginDocument
@@ -1973,7 +2037,7 @@
 }
 
 figure {
-    margin: 3ex auto 3ex auto ;
+    margin: 5ex auto 5ex auto ;
     padding: 1ex 1em 1ex 1em ;
     overflow-x: auto ;
 }
@@ -2036,6 +2100,27 @@
     background: none ;
 }
 
+/* For packages such as float, rotfloat, and algorithm2e: */
+
+figure.boxed, figure.boxruled {
+    border: 1px solid black ;
+}
+
+figure.ruled {
+    border-top: 1px solid black ;
+    border-bottom: 1px solid black ;
+    border-left: 0px ;
+    border-right: 0px ;
+    border-radius: 0px ;
+    background: none ;
+    box-shadow: none ;
+}
+
+figure.ruled figcaption, figure.boxruled figcaption {
+    border-top: 1px solid silver ;
+    border-bottom: 1px solid silver ;
+}
+
 table {
     margin: 1ex auto 1ex auto ;
     border-collapse: separate ;
@@ -2315,7 +2400,32 @@
     -moz-columns: 3 380px ; columns: 3 380px ; }
 div.multicols p {margin-top: 0ex}
 
-/* Used to support algorithmicx: */
+/* Used for algorithm2e: */
+div.alg2evline{
+    margin-left: 1em ;
+    padding-left: 1em ;
+    border-left: 1px solid black ;
+    border-radius: 0px 0px 0px 1ex ;
+}
+
+div.alg2evsline{
+    margin-left: 1em ;
+    padding-left: 1em ;
+    border-left: 1px solid black ;
+}
+
+div.alg2enoline{
+    margin-left: 1em ;
+    padding-left: 1em ;
+}
+
+span.alg2elinenumber{
+    margin-right: .5em ;
+    font-size: 50% ;
+    color: red ;
+}
+
+/* Used for algorithmicx: */
 span.floatright { float: right ; }
 
 /* Native LaTeX theorems: */
@@ -2880,7 +2990,7 @@
 }
 
 figure {
-    margin: 3ex 5% 3ex 5% ;
+    margin: 5ex 5% 5ex 5% ;
     padding: 1ex 1em 1ex 1em ;
     background-color: #fffcf5 ;
     overflow-x: auto ;
@@ -3117,15 +3227,16 @@
 
 -- Copyright 2016-2018 Brian Dunn
 
--- Print the usage of the lwarpmk command:
+printversion = "v0.57"
 
-printversion = "v0.56"
-
 function printhelp ()
 print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;
 end
 
 function printusage ()
+--
+-- Print the usage of the lwarpmk command:
+--
 print ( [[
 
 lwarpmk print [project]: Compile the print version if necessary.
@@ -3153,9 +3264,10 @@
 printconf ()
 end
 
+function printconf ()
+--
 -- Print the format of the configuration file lwarpmk.conf:
-
-function printconf ()
+--
 print ( [[
 An example lwarpmk.conf or <project>.lwarpmkconf project file:
 --
@@ -3177,11 +3289,12 @@
 ]] ) ;
 end
 
+function splitfile (destfile,sourcefile)
+--
 -- Split one large sourcefile into a number of files,
 -- starting with destfile.
 -- The file is split at each occurance of <!--|Start file|newfilename|*
-
-function splitfile (destfile,sourcefile)
+--
 print ("lwarpmk: Splitting " .. sourcefile .. " into " .. destfile) ;
 local sfile = io.open(sourcefile)
 io.output(destfile)
@@ -3198,20 +3311,25 @@
 io.close(sfile)
 end -- function
 
+function cvalueerror ( line, linenum , cvalue )
+--
 -- Incorrect value, so print an error and exit.
-
-function cvalueerror ( line, linenum , cvalue )
+--
     print ("lwarpmk: ===")
     print ("lwarpmk: " .. linenum .. " : " .. line ) ;
-    print ("lwarpmk: incorrect variable value \"" .. cvalue .. "\" in lwarpmk.conf.\n" ) ;
+    print (
+        "lwarpmk: incorrect variable value \"" .. cvalue ..
+        "\" in lwarpmk.conf.\n"
+    ) ;
     print ("lwarpmk: ===")
     printconf () ;
     os.exit(1) ;
 end
 
+function loadconf ()
+--
 -- Load settings from the project's "lwarpmk.conf" file:
-
-function loadconf ()
+--
 -- Default configuration filename:
 local conffile = "lwarpmk.conf"
 -- Optional configuration filename:
@@ -3233,7 +3351,10 @@
     print ("lwarpmk: recompile using pdflatex, xelatex, or lualatex,")
     print ("lwarpmk: then try using lwarpmk again.")
     if ( arg[2] ~= nil ) then
-        print ("lwarpmk: (\"" .. arg[2] .. "\" does not appear to be a project name.)")
+        print (
+            "lwarpmk: (\"" .. arg[2] ..
+            "\" does not appear to be a project name.)"
+        )
     end
     print ("lwarpmk: ===")
     printhelp () ;
@@ -3286,7 +3407,10 @@
 else
     print ("lwarpmk: ===")
     print ("lwarpmk: " .. linenum .. " : " .. line ) ;
-    print ("lwarpmk: Incorrect variable name \"" .. cvarname .. "\" in " .. conffile ..".\n" ) ;
+    print (
+        "lwarpmk: Incorrect variable name \"" .. cvarname .. "\" in " ..
+        conffile ..".\n"
+    ) ;
     print ("lwarpmk: ===")
     printconf () ;
 os.exit(1) ;
@@ -3318,7 +3442,7 @@
     opquote= "\'"
     cmdgroupopenname = " ( "
     cmdgroupclosename = " ) "
-    seqname = " ; "
+    seqname = " && "
     bgname = " &"
 elseif opsystem=="Windows" then -- For Windows
     rmname = "DEL"
@@ -3347,15 +3471,31 @@
 
 end -- loadconf
 
+function executecheckerror ( executecommands , errormessage )
+--
+-- Execute an operating system call,
+-- and maybe exit with an error message.
+--
+local err
+err = os.execute ( executecommands )
+if ( err ~= 0 ) then
+    print ("lwarpmk: ===")
+    print ("lwarpmk: " .. errormessage )
+    print ("lwarpmk: ===")
+    os.exit(1)
+end
+end -- executecheckerror
+
 function refreshdate ()
 os.execute(touchnamepre .. " " .. sourcename .. ".tex " .. touchnamepost)
 end
 
+function reruntoget (filesource)
+--
 -- Scan the LaTeX log file for the phrase "Rerun to get",
 -- indicating that the file should be compiled again.
 -- Return true if found.
-
-function reruntoget (filesource)
+--
 local fsource = io.open(filesource)
 for line in fsource:lines() do
 if ( string.find(line,"Rerun to get") ~= nil ) then
@@ -3367,10 +3507,11 @@
 return false
 end
 
+function onetime (fsuffix)
+--
 -- Compile one time, return true if should compile again.
 -- fsuffix is "" for print, "_html" for HTML output.
-
-function onetime (fsuffix)
+--
 print("lwarpmk: Compiling with " .. latexname .. " " .. sourcename..fsuffix)
 local thisshellescape = " "
 if ( shellescape == "true" ) then
@@ -3378,20 +3519,18 @@
 else
     thisshellescape = " "
 end
-err = os.execute(latexname .. thisshellescape .. sourcename..fsuffix)
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: Compile error.")
-    print ("lwarpmk: ===")
-    os.exit(1)
-end
+executecheckerror (
+    latexname .. thisshellescape .. sourcename..fsuffix ,
+    "Compile error."
+)
 return (reruntoget(sourcename .. fsuffix .. ".log") ) ;
 end
 
+function manytimes (fsuffix)
+--
 -- Compile up to five times.
 -- fsuffix is "" for print, "_html" for HTML output
-
-function manytimes (fsuffix)
+--
 if onetime(fsuffix) == true then
 if onetime(fsuffix) == true then
 if onetime(fsuffix) == true then
@@ -3400,9 +3539,10 @@
 end end end end end
 end
 
+function verifyfileexists (filename)
+--
 -- Exit if the given file does not exist.
-
-function verifyfileexists (filename)
+--
 if (lfs.attributes ( filename , "modification" ) == nil ) then
     print ("lwarpmk: ===")
     print ("lwarpmk: " .. filename .. " not found." ) ;
@@ -3411,9 +3551,10 @@
 end
 end
 
+function pdftohtml ()
+--
 -- Convert <project>_html.pdf into HTML files:
-
-function pdftohtml ()
+--
 -- Convert to text:
 print ("lwarpmk: Converting " .. sourcename
     .."_html.pdf to " .. sourcename .. "_html.html")
@@ -3423,9 +3564,11 @@
 splitfile (homehtmlfilename .. ".html" , sourcename .. "_html.html")
 end
 
+function removeaux ()
+--
 -- Remove auxiliary files:
 -- All aux files are removed since there may be many bbl*.aux files.
-function removeaux ()
+--
 os.execute ( rmname .. " *.aux " ..
     sourcename ..".toc " .. sourcename .. "_html.toc " ..
     sourcename ..".lof " .. sourcename .. "_html.lof " ..
@@ -3438,10 +3581,12 @@
     )
 end
 
+function checkhtmlpdfexists ()
+--
 -- Error if the HTML document does not exist.
--- The lateximages are drawn from the HTML PDF verison of the document,
+-- The lateximages are drawn from the HTML PDF version of the document,
 -- so "lwarpmk html" must be done before "lwarpmk limages".
-function checkhtmlpdfexists ()
+--
 local htmlpdffile = io.open(sourcename .. "_html.pdf", "r")
 if ( htmlpdffile == nil ) then
     print ("")
@@ -3454,8 +3599,10 @@
 io.close (htmlpdffile)
 end -- checkhtmlpdfexists
 
+function warnlimages ()
+--
 -- Warning of a missing lateximages.txt file:
-function warnlimages ()
+--
     print ("lwarpmk: ===")
     print ("lwarpmk: \"lateximages.txt\" does not exist.")
     print ("lwarpmk: Your project does not use SVG math or other lateximages,")
@@ -3468,9 +3615,11 @@
     print ("lwarpmk: ===")
 end -- warnlimages
 
+function checklimages ()
+--
 -- Check lateximages.txt to see if need to recompile first.
 -- If any entry has a page number of zero, then there were incorrect images.
-function checklimages ()
+--
 print ("lwarpmk: Checking for a valid lateximages.txt file.")
 local limagesfile = io.open("lateximages.txt", "r")
 if ( limagesfile == nil ) then
@@ -3502,91 +3651,34 @@
     print ("lwarpmk: ===")
     os.exit(1) ;
 end -- pagezerowarning
-end -- checklateximages
+end -- checklimages
 
--- Create lateximages based on lateximages.txt:
-function createlateximages ()
--- See if the document must be recompiled first:
-checklimages ()
--- See if the print version exists:
-checkhtmlpdfexists ()
--- Attempt to create the lateximages:
-print ("lwarpmk: Creating lateximages.")
-local limagesfile = io.open("lateximages.txt", "r")
-if ( limagesfile == nil ) then
-    warnlateximages ()
-    os.exit(1)
-end
--- Create the lateximages directory, ignore error if already exists
-err = os.execute("mkdir lateximages")
--- For Windows, create lwarp_one_limage.cmd from lwarp_one_limage.txt:
-if opsystem=="Windows" then
-    err = os.execute (
-        cpname .. " lwarp_one_limage.txt lwarp_one_limage.cmd"
-    )
-    if ( err ~= 0 ) then
-        print ("lwarpmk: ===")
-        print ("lwarpmk: File error trying to copy")
-        print ("         lwarp_one_limage.txt to lwarp_one_limage.cmd")
-        print ("lwarpmk: ===")
-        os.exit(1) ;
-    end
-end -- create lwarp_one_limage.cmd
--- Track the number of parallel processes
-numimageprocesses = 0
--- Track warning to recompile if find a page 0
-pagezerowarning = false
--- Scan lateximages.txt
-for line in limagesfile:lines() do
--- lwimgpage is the page number in the PDF which has the image
--- lwimghash is true if this filename is a hash
--- lwimgname is the lateximage filename root to assign for the image
-i,j,lwimgpage,lwimghash,lwimgname = string.find (line,"|(.*)|(.*)|(.*)|")
--- For each entry:
-if ( (i~=nil) ) then
--- Skip if the page number is 0:
-if ( lwimgpage == "0" ) then
-    pagezerowarning = true
-else
--- Skip is this image is hashed and already exists:
-local lwimgfullname = "lateximages" .. dirslash .. lwimgname .. ".svg"
-if (
-    (lwimghash ~= "true") or
-    (lfs.attributes(lwimgfullname,"mode")==nil) -- file not exists
+function createuniximage ( lwimgfullname )
+--
+-- Create one lateximage for Unix / Linux / Mac OS.
+--
+executecheckerror (
+    cmdgroupopenname ..
+    "pdfseparate -f " .. lwimgpage .. " -l " .. lwimgpage .. " " ..
+        sourcename .."_html.pdf " ..
+        "lateximages" .. dirslash .."lateximagetemp-%d" .. ".pdf" ..
+        seqname ..
+    -- Crop the image:
+    "pdfcrop  --hires  lateximages" .. dirslash .. "lateximagetemp-" ..
+        lwimgpage .. ".pdf " ..
+        "lateximages" .. dirslash .. lwimgname .. ".pdf" ..
+        seqname ..
+    -- Convert the image to svg:
+    "pdftocairo -svg  -noshrink  lateximages" .. dirslash .. lwimgname .. ".pdf " ..
+        "lateximages" .. dirslash .. lwimgname ..".svg" ..
+        seqname ..
+    -- Remove the temporary files:
+    rmname .. " lateximages" .. dirslash .. lwimgname .. ".pdf" .. seqname ..
+    rmname .. " lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf" ..
+    cmdgroupclosename .. " >/dev/null " .. bgname
+    ,
+    "File error trying to convert " .. lwimgfullname
 )
-then -- not hashed or not exists:
--- Print the name of the file being generated:
-print ( "lwarpmk: " .. lwimgname )
--- Touch/create the dest so that only once instance tries to build it:
-err = os.execute(newtouchname .. " " .. lwimgfullname)
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: File error trying to touch " .. lwimgfullname)
-    print ("lwarpmk: ===")
-    os.exit(1) ;
-end
--- Separate out the image into its own single-page pdf:
-if opsystem=="Unix" then
--- For Unix / Linux / Mac OS:
-err = os.execute(
-cmdgroupopenname ..
-"pdfseparate -f " .. lwimgpage .. " -l " .. lwimgpage .. " " ..
-    sourcename .."_html.pdf " ..
-    "lateximages" .. dirslash .."lateximagetemp-%d" .. ".pdf" ..
-    seqname ..
--- Crop the image:
-"pdfcrop  --hires  lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf " ..
-    "lateximages" .. dirslash .. lwimgname .. ".pdf" ..
-    seqname ..
--- Convert the image to svg:
-"pdftocairo -svg  -noshrink  lateximages" .. dirslash .. lwimgname .. ".pdf " ..
-    "lateximages" .. dirslash .. lwimgname ..".svg" ..
-    seqname ..
--- Remove the temporary files:
-rmname .. " lateximages" .. dirslash .. lwimgname .. ".pdf" .. seqname ..
-rmname .. " lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf" ..
-cmdgroupclosename .. " >/dev/null " .. bgname
-)
 -- Every 32 images, wait for completion at below normal priority,
 --  allowing other image tasks to catch up.
 numimageprocesses = numimageprocesses + 1
@@ -3593,10 +3685,14 @@
 if ( numimageprocesses > 32 ) then
     numimageprocesses = 0
     print ( "lwarpmk: waiting" )
-    err = os.execute ( "wait" )
+    executecheckerror ( "wait" , "File error trying to wait.")
 end
-elseif opsystem=="Windows" then
--- For Windows
+end -- createuniximage
+
+function createwindowsimage ( lwimgfullname )
+--
+-- Create one lateximage for Windows.
+--
 -- Every 32 images, wait for completion at below normal priority,
 --  allowing other image tasks to catch up.
 numimageprocesses = numimageprocesses + 1
@@ -3608,30 +3704,94 @@
     thiswaitcommand = ""
 end
 -- Execute the image generation command
-err = os.execute (
+executecheckerror (
     "start /B " .. thiswaitcommand .. " \"\" lwarp_one_limage " ..
     lwimgpage .. " " ..
     lwimghash .. " " ..
     lwimgname .. " " ..
     sourcename .. " <nul >nul"
+    ,
+    "File error trying to create image."
 )
-end -- Windows
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: File error trying to create one lateximage.")
-    print ("lwarpmk: ===")
+end -- createwindowsimage
+
+function createonelateximage ( line )
+--
+-- Given the next line of lateximages.txt, convert a single image.
+--
+-- lwimgpage is the page number in the PDF which has the image
+-- lwimghash is true if this filename is a hash
+-- lwimgname is the lateximage filename root to assign for the image
+i,j,lwimgpage,lwimghash,lwimgname = string.find (line,"|(.*)|(.*)|(.*)|")
+-- For each entry:
+if ( (i~=nil) ) then
+    -- Skip if the page number is 0:
+    if ( lwimgpage == "0" ) then
+        pagezerowarning = true
+    else
+        -- Skip is this image is hashed and already exists:
+        local lwimgfullname = "lateximages" .. dirslash .. lwimgname .. ".svg"
+        if (
+            (lwimghash ~= "true") or
+            (lfs.attributes(lwimgfullname,"mode")==nil) -- file not exists
+        )
+        then -- not hashed or not exists:
+            -- Print the name of the file being generated:
+            print ( "lwarpmk: " .. lwimgname )
+            -- Touch/create the dest so that only once instance tries to build it:
+            executecheckerror (
+                newtouchname .. " " .. lwimgfullname ,
+                "File error trying to touch " .. lwimgfullname
+            )
+            -- Separate out the image into its own single-page pdf:
+            if opsystem=="Unix" then
+                createuniximage (lwimgfullname)
+            elseif opsystem=="Windows" then
+                createwindowsimage (lwimgfullname)
+            end
+        end -- not hashed or not exists
+    end -- not page 0
+end -- not nil
+end -- createonelateximage
+
+function createlateximages ()
+--
+-- Create lateximages based on lateximages.txt:
+--
+-- See if the document must be recompiled first:
+checklimages ()
+-- See if the print version exists:
+checkhtmlpdfexists ()
+-- Attempt to create the lateximages:
+print ("lwarpmk: Creating lateximages.")
+local limagesfile = io.open("lateximages.txt", "r")
+if ( limagesfile == nil ) then
+    warnlateximages ()
     os.exit(1)
 end
-end -- not hashed or not exists
-end -- not page 0
-end -- not nil
+-- Create the lateximages directory, ignore error if already exists
+err = os.execute("mkdir lateximages")
+-- For Windows, create lwarp_one_limage.cmd from lwarp_one_limage.txt:
+if opsystem=="Windows" then
+    executecheckerror (
+        cpname .. " lwarp_one_limage.txt lwarp_one_limage.cmd" ,
+        "File error trying to copy lwarp_one_limage.txt to lwarp_one_limage.cmd"
+    )
+end -- create lwarp_one_limage.cmd
+-- Track the number of parallel processes
+numimageprocesses = 0
+-- Track warning to recompile if find a page 0
+pagezerowarning = false
+-- Scan lateximages.txt
+for line in limagesfile:lines() do
+    createonelateximage ( line )
 end -- do
 io.close(limagesfile)
 print ( "lwarpmk limages: ===")
 print ( "lwarpmk limages: Wait a moment for the images to complete" )
-print ( "lwarpmk limages: before reloading the page." )
+print ( "lwarpmk limages:   before reloading the page." )
 print ( "lwarpmk limages: ===")
-print ( "lwarpmk limages: done" )
+print ( "lwarpmk limages: Done." )
 if ( pagezerowarning == true ) then
     print ( "lwarpmk limages: WARNING: Images will be incorrect." )
     print ( "lwarpmk limages:   Enter \"lwarpmk cleanlimages\", then" )
@@ -3640,9 +3800,11 @@
 end -- pagezerowarning
 end -- function
 
+function compilelatexmk ( fsuffix )
+--
 -- Use latexmk to compile source and index:
 -- fsuffix is "" for print, or "_html" for HTML
-function compilelatexmk ( fsuffix )
+--
 -- Maybe select the shell-escape option:
 local thisshellescape = " "
 if ( shellescape == "true" ) then
@@ -3652,7 +3814,8 @@
 end
 -- The recorder option is required to detect changes in <project>.tex
 -- while we are loading <project>_html.tex.
-err=os.execute ( "latexmk -pdf -dvi- -ps- -recorder "
+executecheckerror (
+    "latexmk -pdf -dvi- -ps- -recorder "
     .. "-e "
     .. opquote
     .. "$makeindex = q/" -- $
@@ -3662,19 +3825,18 @@
     .. "  -L " .. xindylanguage .. " /"
     .. opquote
     .. " -pdflatex=\"" .. latexname .. thisshellescape .." %O %S\" "
-    .. sourcename..fsuffix ..".tex" ) ;
-if ( err ~= 0 ) then
-    print ("lwarpmk: ===")
-    print ("lwarpmk: Compile error.")
-    print ("lwarpmk: ===")
-    os.exit(1)
-end
+    .. sourcename..fsuffix ..".tex"
+    ,
+    "Compile error."
+)
 end -- function
 
+function convertpdftosvg ()
+--
 -- Converts PDF files to SVG files.
 -- The filenames are arg[2] and up.
 -- arg[1] is the command "pdftosvg".
-function convertpdftosvg ()
+--
 for i = 2 , #arg do
     if (lfs.attributes(arg[i],"mode")==nil) then
         print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.")
@@ -3685,6 +3847,8 @@
 end -- do
 end --function
 
+-- Start of the main code: --
+
 -- lwarpmk --version :
 
 if (arg[1] == "--version") then
@@ -3721,6 +3885,8 @@
     end
 end -- not latexmk
 
+-- lwarpmk print1:
+
 elseif arg[1] == "print1" then
     loadconf ()
     verifyfileexists (sourcename .. ".tex") ;
@@ -3791,6 +3957,8 @@
     end
 end -- not latexmk
 
+-- lwarpmk html1:
+
 elseif arg[1] == "html1" then
     loadconf ()
     verifyfileexists ( sourcename .. ".tex" ) ;
@@ -3798,6 +3966,7 @@
     pdftohtml ()
     print ("lwarpmk: Done.")
 
+-- lwarpmk pdftohtml:
 elseif arg[1] == "pdftohtml" then
     loadconf ()
     pdftohtml ()
@@ -3905,6 +4074,8 @@
 elseif (arg[1] == "-h" ) or (arg[1] == "--help") then
 printusage ()
 
+-- Unknown command:
+
 else
 printhelp ()
 print ("\nlwarpmk: ****** Unknown command \""..arg[1].."\". ******\n")
@@ -4030,7 +4201,44 @@
 
 \end{warpHTML}
 
+\begin{warpall}
+\newcommand{\StartDefiningTabulars}{%
+\LWR at traceinfo{StartDefiningTabulars}%
+\warpHTMLonly{\catcode`\&=\active}%
+}
+\newcommand{\StopDefiningTabulars}{%
+\LWR at traceinfo{StopDefiningTabulars}%
+\warpHTMLonly{\catcode`\&=4}%
+}
 
+\newbool{LWR at mathmacro}
+\boolfalse{LWR at mathmacro}
+
+\newcommand{\StartDefiningMath}{%
+\LWR at traceinfo{StartDefiningMath}%
+\warpHTMLonly{\catcode`\$=\active}%
+}
+\newcommand{\StopDefiningMath}{%
+\LWR at traceinfo{StopDefiningMath}%
+\warpHTMLonly{\catcode`\$=3}% math shift
+}
+
+\end{warpall}
+
+\begin{warpall}
+\newbool{LWR at dynamicmath}
+\boolfalse{LWR at dynamicmath}
+\newcommand{\StartDynamicMath}{%
+\LWR at traceinfo{StartDynamicMath}%
+\booltrue{LWR at dynamicmath}%
+}
+\newcommand{\StopDynamicMath}{%
+\LWR at traceinfo{StopDynamicMath}%
+\boolfalse{LWR at dynamicmath}%
+}
+\end{warpall}
+
+
 \begin{warpHTML}
 
 \newcommand*{\LWR at sanitized}{}
@@ -4138,9 +4346,7 @@
 \begin{warpHTML}
 
 \newcommand*{\LinkHome}{%
-\LWR at subhyperrefclass{%
-\HomeHTMLFilename.html}%
-{Home}{linkhome}%
+\LWR at subhyperrefclass{\HomeHTMLFilename.html}{Home}{linkhome}%
 }
 
 \newcommand*{\LWR at topnavigation}{
@@ -4376,7 +4582,7 @@
 \begingroup%
 \LWR at FBcancel%
 \ifmmode\else\protect\LWR at origttfamily\fi%
-\LWR at origmbox{\LWR at origtextless{}!{-}{-}}%
+\LWR at print@mbox{\LWR at origtextless{}!{-}{-}}%
 \endgroup%
 }%
 }
@@ -4386,7 +4592,7 @@
 \begingroup%
 \LWR at FBcancel%
 \ifmmode\else\protect\LWR at origttfamily\fi%
-\LWR at origmbox{{-}{-}\LWR at origtextgreater}%
+\LWR at print@mbox{{-}{-}\LWR at origtextgreater}%
 \endgroup%
 }%
 }
@@ -4463,38 +4669,51 @@
 \end{warpHTML}
 
 
+\begin{warpprint}
+\NewDocumentEnvironment{BlockClass}{o m}{}{}%
+\end{warpprint}
 \begin{warpHTML}
-\NewDocumentEnvironment{BlockClass}{o m}%
+\NewDocumentEnvironment{LWR at print@BlockClass}{o m}{}{}%
+\NewDocumentEnvironment{LWR at HTML@BlockClass}{o m}%
 {%
     \LWR at origpar%
     \LWR at htmldivclass[#1]{#2}%
 }
 {\LWR at htmldivclassend{#2}}
+
+\LWR at formattedenv{BlockClass}
 \end{warpHTML}
-\begin{warpprint}
-\NewDocumentEnvironment{BlockClass}{o m}{}{}%
-\end{warpprint}
+\begin{warpall}
+\newcommand{\BlockClassSingle}[2]{#2}
+\end{warpall}
 \begin{warpHTML}
-\newcommand{\BlockClassSingle}[2]{%
+\newcommand{\LWR at HTML@BlockClassSingle}[2]{%
 \LWR at origpar%
 \LWR at htmlelementclassline{div}{#1}{#2}%
 }
+
+\LWR at formatted{BlockClassSingle}
 \end{warpHTML}
+
 \begin{warpprint}
-\newcommand{\BlockClassSingle}[2]{#2}
+\NewDocumentCommand{\InlineClass}{o m +m}{#3}%
 \end{warpprint}
+\begin{warpHTML}
+\NewDocumentCommand{\LWR at print@InlineClass}{o m +m}{#3}%
 
-\begin{warpHTML}
-\NewDocumentCommand{\InlineClass}{o m +m}{%
-\LWR at htmlspanclass[#1]{#2}{#3}%
+\NewDocumentCommand{\LWR at HTML@InlineClass}{o m +m}{%
+    \LWR at htmlspanclass[#1]{#2}{#3}%
 }
+
+\LWR at formatted{InlineClass}
 \end{warpHTML}
+
 \begin{warpprint}
-\NewDocumentCommand{\InlineClass}{o m +m}{#3}%
+\NewDocumentEnvironment{LWR at BlockClassWP}{m m m}{}{}%
 \end{warpprint}
-
 \begin{warpHTML}
-\NewDocumentEnvironment{LWR at BlockClassWP}{m m m}%
+\NewDocumentEnvironment{LWR at print@LWR at BlockClassWP}{m m m}{}{}%
+\NewDocumentEnvironment{LWR at HTML@LWR at BlockClassWP}{m m m}%
 {%
 \LWR at stoppars%
 \ifbool{FormatWP}%
@@ -4502,7 +4721,7 @@
     \addtocounter{LWR at thisautoidWP}{1}%
     \LWR at htmltag{%
         div class="#3" %
-        id="\LWR at origmbox{autoidWP-\arabic{LWR at thisautoidWP}}"%
+        id="\LWR at print@mbox{autoidWP-\arabic{LWR at thisautoidWP}}"%
         \ifblank{#1}{}{ style="#1"}%
     }%
 }% FormatWP
@@ -4515,10 +4734,9 @@
 \LWR at startpars%
 }
 {\LWR at htmldivclassend{#3}}
+
+\LWR at formattedenv{LWR at BlockClassWP}
 \end{warpHTML}
-\begin{warpprint}
-\NewDocumentEnvironment{LWR at BlockClassWP}{m m m}{}{}%
-\end{warpprint}
 
 
 \begin{warpHTML}
@@ -4853,7 +5071,7 @@
 \ifvoid\LWR at mpfootnotes\else
     \LWR at forcenewpage
     \begin{BlockClass}{footnotes}
-    \LWR at origvspace*{\baselineskip}
+    \LWR at print@vspace*{\baselineskip}
     \unvbox\LWR at mpfootnotes
     \setbox\LWR at mpfootnotes=\vbox{}
     \end{BlockClass}
@@ -5016,6 +5234,10 @@
 
 \(\newcommand\ensuremath[1]{##1}\)
 
+\(\newcommand\footnote[2][]{\text{( Footnote ##1 )}}\)
+
+\(\newcommand\footnotemark[1][]{\text{( Footnote ##1 )}}\)
+
 \LWR at htmlcomment{Additional customizations for MathJax:}
 
 \LWR at customizedMathJax
@@ -5159,7 +5381,7 @@
 }
 
 \newcommand*{\LWR at createautosec}[1]{%
-\LWR at htmltag{#1 id="\LWR at origmbox{autosec-\arabic{page}}"}%
+\LWR at htmltag{#1 id="\LWR at print@mbox{autosec-\arabic{page}}"}%
 }
 
 \NewDocumentCommand{\LWR at pushoneclose}{m m}{%
@@ -5513,10 +5735,10 @@
 \setlength{\belowcaptionskip}{0ex}
 \setlength{\abovecaptionskip}{0ex}
 \renewcommand{\ps at plain}{}
-\LetLtxMacro{\LWR at origtabular}{\tabular}
-\LetLtxMacro{\LWR at origendtabular}{\endtabular}
-\LetLtxMacro{\tabular}{\LWR at tabular}
-\LetLtxMacro{\endtabular}{\endLWR at tabular}
+\LetLtxMacro\LWR at origtabular\tabular
+\LetLtxMacro\LWR at origendtabular\endtabular
+\LetLtxMacro\tabular\LWR at tabular
+\LetLtxMacro\endtabular\endLWR at tabular
 \let\LWR at origcaption\caption
 \let\LWR at origltx@label\ltx at label
 \let\ltx at label\LWR at htmlmathlabel
@@ -5886,7 +6108,7 @@
         \ifthenelse{\equal{#1}{}}{}{style="#1"}%
     }%
     \LWR at orignewline% pre
-    \leavevmode\unskip\LWR at origvspace*{-#2\baselineskip}%
+    \leavevmode\unskip\LWR at print@vspace*{-#2\baselineskip}%
 }{}%
 \begingroup%
 \LWR at origttfamily%
@@ -5893,7 +6115,7 @@
 \LWR at origsmall%
 \LWR at restoreoriglists%
 \LWR at FBcancel%
-\LetLtxMacro{\hspace}{\LWR at orighspace}%
+\LWR at select@print at hspace%
 }
 
 \newcommand*{\LWR at afterendverbatim}[1]{%
@@ -5900,7 +6122,7 @@
 \endgroup%
 \par%
 \ifbool{LWR at verbtags}{%
-    \LWR at origvspace*{-#1\baselineskip}%
+    \LWR at print@vspace*{-#1\baselineskip}%
     \noindent\LWR at htmltag{/pre}\LWR at orignewline% pre
 }{}%
 \LWR at startpars%
@@ -5974,7 +6196,7 @@
 
 \newcommand*{\LWR at printcloselist}{\LWR at printcloseitemize}
 
-\newcommand*{\LWR at printopenlist}{ul style="\LWR at origmbox{list-style-type:none}"}
+\newcommand*{\LWR at printopenlist}{ul style="\LWR at print@mbox{list-style-type:none}"}
 
 \AtBeginDocument{
 \def\@mklab#1{%
@@ -6070,7 +6292,7 @@
 
 \newcommand*{\LWR at itemizestart}{%
 \renewcommand*{\LWR at printcloselist}{\LWR at printcloseitemize}
-\renewcommand*{\LWR at printopenlist}{ul style="\LWR at origmbox{list-style-type:none}"}
+\renewcommand*{\LWR at printopenlist}{ul style="\LWR at print@mbox{list-style-type:none}"}
 \let\item\LWR at itemizeitem%
 \LWR at nulllistfills%
 }
@@ -6079,7 +6301,7 @@
 
 \newcommand*{\LWR at enumeratestart}{%
 \renewcommand*{\LWR at printcloselist}{\LWR at printcloseitemize}
-\renewcommand*{\LWR at printopenlist}{ul style="\LWR at origmbox{list-style-type:none}"}
+\renewcommand*{\LWR at printopenlist}{ul style="\LWR at print@mbox{list-style-type:none}"}
 \let\item\LWR at itemizeitem%
 \LWR at nulllistfills%
 }
@@ -6090,9 +6312,9 @@
 \LWR at stoppars%
 \LWR at setlatestname{#1}%
 \LWR at startnewdepth{\LWR at depthlistitem}{\LWR at printclosedescitem}%
-\LetLtxMacro\hspace\LWR at nohspace%
+\LWR at select@html at nohspace%
 \LWR at origitem[]%
-\LetLtxMacro\hspace\LWR at hspace%
+\LWR at select@html at hspace%
 \LWR at htmltag{dt}#1\LWR at htmltag{/dt}%
 \LWR at orignewline%
 \LWR at htmltag{dd}%
@@ -6289,19 +6511,7 @@
 \let\LWR at origampmacro&
 
 \end{warpHTML}
-\begin{warpall}
-\newcommand{\StartDefiningTabulars}{%
-\LWR at traceinfo{StartDefiningTabulars}%
-\warpHTMLonly{\catcode`\&=\active}%
-}
-\newcommand{\EndDefiningTabulars}{%
-\LWR at traceinfo{EndDefiningTabulars}%
-\warpHTMLonly{\catcode`\&=4}%
-}
-
-\end{warpall}
 \begin{warpHTML}
-
 \newcommand*{\LWR at tabularampersand}{%
 \LWR at traceinfo{LWR at tabularampersand}%
 \ifnumcomp{\value{LWR at tabulardepth}}{>}{0}%
@@ -6635,21 +6845,15 @@
 \newcommand*{\LWR at rowHTMLcolor}{}
 \newcommand*{\LWR at cellHTMLcolor}{}
 \newcommand*{\LWR at ruleHTMLcolor}{}
-\NewDocumentCommand{\LWR at HTMLcolumncolor}{O{named} m o o}{}
+\newcommand*{\rowcolor}{\LWR at getmynexttoken}%
 
-\NewDocumentCommand{\LWR at HTMLrowcolor}{O{named} m o o}{\LWR at getmynexttoken}
-
-\NewDocumentCommand{\LWR at HTMLcellcolor}{O{named} m o o}{}
-
 \newcommand{\arrayrulecolor}[2][named]{}
+\newcommand{\arrayrulecolornexttoken}[2][named]{\LWR at getmynexttoken}
 
-\newcommand{\LWR at HTMLarrayrulecolor}[2][named]{\LWR at getmynexttoken}
-
 \newcommand{\doublerulesepcolor}[2][named]{}
+\newcommand{\doublerulesepcolornexttoken}[2][named]{\LWR at getmynexttoken}
 
-\newcommand{\LWR at HTMLdoublerulesepcolor}[2][named]{\LWR at getmynexttoken}
 
-
 \newcommand*{\LWR at maybenewtablerow}
 {%
 \ifbool{LWR at startedrow}%
@@ -6962,7 +7166,7 @@
 
 \newcommand*{\LWR at WPcell}[2]{%
 \LWR at tdaddstyle%
-\LWR at origmbox{text-align:#1}; \LWR at origmbox{vertical-align:#2}%
+\LWR at print@mbox{text-align:#1}; \LWR at print@mbox{vertical-align:#2}%
 }
 
 \newcommand*{\LWR at addformatwpalignment}[1]{%
@@ -7298,8 +7502,8 @@
 \IfValueT{#2}{ % rows?
 rowspan="#2" %
 \IfValueT{#1}{% vpos?
-\ifstrequal{#1}{b}{style="\LWR at origmbox{vertical-align:bottom}" }{}%
-\ifstrequal{#1}{t}{style="\LWR at origmbox{vertical-align:top}" }{}%
+\ifstrequal{#1}{b}{style="\LWR at print@mbox{vertical-align:bottom}" }{}%
+\ifstrequal{#1}{t}{style="\LWR at print@mbox{vertical-align:top}" }{}%
 }% vpos?
 }% rows?
  class="td%
@@ -7374,7 +7578,8 @@
         {%
             \refstepcounter{\LTcaptype}%
             \protected at edef\@currentlabel{%
-            \csuse{p@\LTcaptype}\csuse{the\LTcaptype}}%
+                \csuse{p@\LTcaptype}\csuse{the\LTcaptype}%
+            }%
         }%
     }{}%
     \LWR at figcaption%
@@ -7450,31 +7655,41 @@
 }% whiledo
 }
 \end{warpHTML}
+\begin{warpHTML}
+\newcommand{\multirow}[2][c]{}
+\end{warpHTML}
 \begin{warpall}
 \AtBeginDocument{
 \@ifundefined{@xmultirow}
-{}% no version of multirow was loaded
+{
+\DeclareExpandableDocumentCommand{\LWR at print@multicolumnrow}%
+    {+m +m +O{c} +m +O{0} +m +O{0pt} +m}%
+    {}%
+}% no version of multirow was loaded
 {% \@xmultirow defined, so some version of multirow was loaded
 \@ifpackageloaded{multirow}{% v2.0 or newer
 \@ifpackagelater{multirow}{2016/09/01}% 2016/09/27 for v2.0
 {% v2.0+:
-\DeclareExpandableDocumentCommand{\LWR at origmulticolumnrow}%
+\DeclareExpandableDocumentCommand{\LWR at print@multicolumnrow}%
     {+m +m +O{c} +m +O{0} +m +O{0pt} +m}%
-{\multicolumn{#1}{#2}{\@xmultirow[#3]{#4}[#5]{#6}[#7]{#8}}}%
+    {\multicolumn{#1}{#2}{\@xmultirow[#3]{#4}[#5]{#6}[#7]{#8}}}%
 }
 {% loaded but older, probably not executed:
-\DeclareExpandableDocumentCommand{\LWR at origmulticolumnrow}%
+\DeclareExpandableDocumentCommand{\LWR at print@multicolumnrow}%
     {+m +m +O{c} +m +O{0} +m +O{0pt} +m}%
-{\multicolumn{#1}{#2}{\@xmultirow{#4}[#5]{#6}[#7]{#8}}}%
+    {\multicolumn{#1}{#2}{\@xmultirow{#4}[#5]{#6}[#7]{#8}}}%
 }
 }% packageloaded{multirow}
 {% v1.6 or older did not \ProvidePackage
-\DeclareExpandableDocumentCommand{\LWR at origmulticolumnrow}%
+\DeclareExpandableDocumentCommand{\LWR at print@multicolumnrow}%
     {+m +m +O{c} +m +O{0} +m +O{0pt} +m}%
-{\multicolumn{#1}{#2}{\@xmultirow{#4}[#5]{#6}[#7]{#8}}}%
+    {\multicolumn{#1}{#2}{\@xmultirow{#4}[#5]{#6}[#7]{#8}}}%
 }
-\providecommand*{\multicolumnrow}{\LWR at origmulticolumnrow}
-}% \@xmultirow defined, so multirow was loaded
+
+}% \@ifundefined{@xmultirow}
+
+\providecommand*{\multicolumnrow}{\LWR at print@multicolumnrow}
+
 }% AtBeginDocument
 \end{warpall}
 \begin{warpHTML}
@@ -7602,13 +7817,13 @@
 
 
 \begin{warpHTML}
-\newcommand*{\LWR at origtoprule}[1][]{\hline}
-\newcommand*{\LWR at origmidrule}[1][]{\hline}
-\LetLtxMacro\LWR at origcmidrule\cline
-\newcommand*{\LWR at origbottomrule}[1][]{\hline}
-\newcommand*{\LWR at origaddlinespace}[1][]{}
-\newcommand*{\LWR at origmorecmidrules}{}
-\newcommand*{\LWR at origspecialrule}[3]{\hline}
+\newcommand*{\toprule}[1][]{\hline}
+\newcommand*{\midrule}[1][]{\hline}
+\LetLtxMacro\cmidrule\cline
+\newcommand*{\bottomrule}[1][]{\hline}
+\newcommand*{\addlinespace}[1][]{}
+\newcommand*{\morecmidrules}{}
+\newcommand*{\specialrule}[3]{\hline}
 \LetLtxMacro\LWR at orignoalign\noalign
 
 \newcommand{\LWR at tabularnoalign}[1]{%
@@ -7678,11 +7893,8 @@
 \boolfalse{LWR at tabularcelladded}%
 \LWR at clearmidrules%
 \LetLtxMacro{\\}{\LWR at tabularendofline}%
-\LetLtxMacro\columncolor\LWR at HTMLcolumncolor%
-\LetLtxMacro\rowcolor\LWR at HTMLrowcolor%
-\LetLtxMacro\cellcolor\LWR at HTMLcellcolor%
-\LetLtxMacro\arrayrulecolor\LWR at HTMLarrayrulecolor%
-\LetLtxMacro\doublerulesepcolor\LWR at HTMLdoublerulesepcolor%
+\LetLtxMacro\arrayrulecolor\arrayrulecolornexttoken%
+\LetLtxMacro\doublerulesepcolor\doublerulesepcolornexttoken%
 \renewcommand*{\LWR at columnHTMLcolor}{}%
 \renewcommand*{\LWR at rowHTMLcolor}{}%
 \renewcommand*{\LWR at cellHTMLcolor}{}%
@@ -7693,44 +7905,6 @@
 \LetLtxMacro\noalign\LWR at tabularnoalign%
 \LetLtxMacro\hline\LWR at HTMLhline%
 \LetLtxMacro\cline\LWR at HTMLcline%
-\DeclareDocumentCommand{\toprule}{o d()}%
-    {%
-        \IfValueTF{##1}%
-            {\LWR at docmidrule[##1](){1-\arabic{LWR at tabletotalcols}}}%
-            {%
-                \ifbool{FormatWP}%
-                {\LWR at docmidrule[##1](){1-\arabic{LWR at tabletotalcols}}}%
-                {\booltrue{LWR at doingtbrule}}%
-            }%
-    \LWR at getmynexttoken}%
-\DeclareDocumentCommand{\midrule}{o d()}%
-    {%
-        \IfValueTF{##1}%
-            {\LWR at docmidrule[##1](){1-\arabic{LWR at tabletotalcols}}}%
-            {%
-                \ifbool{FormatWP}%
-                {\LWR at docmidrule[##1](){1-\arabic{LWR at tabletotalcols}}}%
-                {\addtocounter{LWR at hlines}{1}}%
-            }%
-    \LWR at getmynexttoken}%
-\DeclareDocumentCommand{\cmidrule}{O{\LWR at cmidrulewidth} d() m}{%
-    \LWR at docmidrule[##1](##2){##3}%
-    \LWR at getmynexttoken%
-}%
-\DeclareDocumentCommand{\bottomrule}{o d()}{%
-    \IfValueTF{##1}%
-        {\LWR at docmidrule[##1](){1-\arabic{LWR at tabletotalcols}}}%
-        {%
-            \ifbool{FormatWP}%
-            {\LWR at docmidrule[##1](){1-\arabic{LWR at tabletotalcols}}}%
-            {\booltrue{LWR at doingtbrule}}%
-        }%
-    \LWR at getmynexttoken%
-}%
-\DeclareDocumentCommand{\addlinespace}{o}{}%
-\DeclareDocumentCommand{\morecmidrules}{}{}%
-\DeclareDocumentCommand{\specialrule}{m m m d()}%
-    {\LWR at docmidrule[##1](){1-\arabic{LWR at tabletotalcols}}\LWR at getmynexttoken}%
 \DeclareDocumentCommand{\hdashline}{o}{%
     \ifbool{FormatWP}%
         {\LWR at docdashline{1-\arabic{LWR at tabletotalcols}}}%
@@ -7801,11 +7975,11 @@
 \global\boolfalse{LWR at intabularmetadata}%
 \addtocounter{LWR at tabulardepth}{-1}%
 \protected\gdef&{\LWR at origampmacro}%
-\EndDefiningTabulars%
+\StopDefiningTabulars%
 \LWR at traceinfo{LWR at tabular finished ending}%
 }
 
-\EndDefiningTabulars
+\StopDefiningTabulars
 
 \end{warpHTML}
 
@@ -7868,16 +8042,16 @@
     {% pars allowed
         \ifbool{LWR at doingapar}%
         {% par started
-            \LWR at htmltag{a \LWR at origmbox{id="\LWR at sanitized"}}\LWR at htmltag{/a}%
+            \LWR at htmltag{a \LWR at print@mbox{id="\LWR at sanitized"}}\LWR at htmltag{/a}%
         }% par started
         {% par not started
             \LWR at stoppars%
-            \LWR at htmltag{a \LWR at origmbox{id="\LWR at sanitized"}}\LWR at htmltag{/a}%
+            \LWR at htmltag{a \LWR at print@mbox{id="\LWR at sanitized"}}\LWR at htmltag{/a}%
             \LWR at startpars%
         }% par not started
     }% pars allowed
     {% pars not allowed
-        \LWR at htmltag{a \LWR at origmbox{id="\LWR at sanitized"}}\LWR at htmltag{/a}%
+        \LWR at htmltag{a \LWR at print@mbox{id="\LWR at sanitized"}}\LWR at htmltag{/a}%
     }% pars not allowed
 }% not lateximage
 }
@@ -7901,7 +8075,7 @@
 \LWR at traceinfo{LWR at startref A: !#1!}%
 \LWR at htmltag{a href="%
 \LWR at traceinfo{LWR at startref B}%
-\LWR at origmbox{\LWR at htmlrefsectionfilename{#1}}%
+\LWR at print@mbox{\LWR at htmlrefsectionfilename{#1}}%
 \LWR at traceinfo{LWR at startref C}%
 \LWR at origpound%
 \LWR at traceinfo{LWR at startref D: !#1!}%
@@ -7919,7 +8093,7 @@
     }%
     {%
         \LWR at traceinfo{LWR at startref D3}%
-        \LWR at origmbox{\LWR at sanitized}%
+        \LWR at print@mbox{\LWR at sanitized}%
     }%
 }%
 \LWR at traceinfo{LWR at startref E}%
@@ -7940,6 +8114,9 @@
 {\LWR at origref{#2}}%
 {\LWR at subnewref{#2}{#2}}%
 }
+\NewDocumentCommand{\LWR at ref@ignorestar}{s m}{%
+    \LWR at origref{#2}%
+}
 
 \newcommand*{\pagerefPageFor}{see }
 \NewDocumentCommand{\LWR at newpageref}{s m}{%
@@ -7969,8 +8146,7 @@
 }
 }
 
-
-\NewDocumentCommand{\LWR at subhyperref}{m +m}{%
+\NewDocumentCommand{\LWR at subhyperref}{m}{%
 \LWR at traceinfo{LWR at subhyperref !#1!}%
 \LWR at sanitize{#1}%
 \LWR at htmltag{%
@@ -7977,7 +8153,10 @@
     a href="\LWR at sanitized" %
     target="\_{}blank"\LWR at orignewline%
 }%
-#2%
+}
+
+\newcommand{\LWR at subhyperreftext}[1]{%
+#1%
 \LWR at htmltag{/a}%
 \LWR at ensuredoingapar%
 }
@@ -7994,10 +8173,11 @@
 \LWR at ensuredoingapar%
 }
 
-\DeclareDocumentCommand{\LWR at hrefb}{O{} m +m}{%
+\DeclareDocumentCommand{\LWR at hrefb}{O{} m}{%
 \LWR at ensuredoingapar%
-\LWR at subhyperref{#2}{#3}%
-\endgroup%
+\LWR at subhyperref{#2}%
+\endgroup% restore catcodes
+\LWR at subhyperreftext%
 }
 
 \newrobustcmd*{\href}{%
@@ -8068,7 +8248,10 @@
 \booltrue{LWR at freezethisautoid}%
 \begingroup%
 \LWR at origraggedright%
-\LWR at htmltag{figure id="\LWR at origmbox{autoid-\arabic{LWR at thisautoid}}" class="#1"}%
+\LWR at htmltag{%
+    figure id="\LWR at print@mbox{autoid-\arabic{LWR at thisautoid}}" % space
+    class="#1 \csuse{LWR at floatstyle@#1}"%
+}%
 \ifbool{FormatWP}{%
     \LWR at orignewline%
     \LWR at BlockClassWP{}{}{wp#1}%
@@ -8123,7 +8306,7 @@
 {
     \ifbool{LWR at freezethisautoid}{}{%
         \addtocounter{LWR at thisautoid}{1}%
-        \LWR at htmltag{a id="\LWR at origmbox{autoid-\arabic{LWR at thisautoid}}"}%
+        \LWR at htmltag{a id="\LWR at print@mbox{autoid-\arabic{LWR at thisautoid}}"}%
             \LWR at htmltag{/a}%
     }%
 }
@@ -8180,7 +8363,7 @@
 \LWR at htmlblocktag{figcaption}%
 \ifbool{FormatWP}{%
 \begin{BlockClass}[font-style:italic]{italic}
-\LWR at origvspace*{\baselineskip}
+\LWR at print@vspace*{\baselineskip}
 }{}%
 \LWR at traceinfo{LWR at figcaption env start: done}%
 }
@@ -8232,7 +8415,7 @@
 
 \def\LWR at LTcaptionlistentry{%
 \LWR at ensuredoingapar%
-\LWR at htmltag{a id="\LWR at origmbox{autoid-\arabic{LWR at thisautoid}}"}\LWR at htmltag{/a}%
+\LWR at htmltag{a id="\LWR at print@mbox{autoid-\arabic{LWR at thisautoid}}"}\LWR at htmltag{/a}%
   \bgroup
   \@ifstar{\egroup\LWR at LT@captionlistentry}% gobble *
           {\egroup\LWR at LT@captionlistentry}}%
@@ -8354,6 +8537,9 @@
 
 
 \NewDocumentCommand{\listof}{m +m}{%
+\@ifundefined{l@#1}{%
+    \csdef{l@#1}[2]{\hypertocfloat{1}{#1}{\csuse{ext@#1}}{##1}{##2}}%
+}{}%
 \LWR at subtableofcontents{\@nameuse{ext@#1}}{#2}
 \expandafter\newwrite\csname tf@\csname ext@#1\endcsname\endcsname
 \immediate\openout \csname tf@\csname ext@#1\endcsname\endcsname
@@ -8406,7 +8592,7 @@
 \ifthenelse{\cnttest{#1}{<=}{\value{tocdepth}}}{%
     \LWR at startpars%
     \LWR at subhyperrefclass{%
-        \LWR at htmlrefsectionfilename{autopage-#4}\LWR at origpound\LWR at origmbox{autosec-#4}%
+        \LWR at htmlrefsectionfilename{autopage-#4}\LWR at origpound\LWR at print@mbox{autosec-#4}%
     }{#3}{toc#2}%
     \LWR at stoppars%
 }%
@@ -8435,7 +8621,7 @@
     \LWR at startpars%
     \LWR at subhyperrefclass{%
     \LWR at htmlrefsectionfilename{autopage-\arabic{LWR at nextautopage}}%
-    \LWR at origpound\LWR at origmbox{autoid-\arabic{LWR at nextautoid}}}%
+    \LWR at origpound\LWR at print@mbox{autoid-\arabic{LWR at nextautoid}}}%
     {#4}{toc#2}%
     \LWR at stoppars%
 }{}%
@@ -8567,14 +8753,17 @@
 
 \end{warpHTML}
 
+
 \begin{warpHTML}
+
 \newcommand*{\LWR at restoreorigformatting}{%
 \LWR at traceinfo{LWR at restoreorigformatting}%
+\renewcommand*{\LWR at formatting}{print}%
 \linespread{1}%
 \LetLtxMacro\caption at begin\LWR at origcaption@begin%
 \LetLtxMacro\caption at end\LWR at origcaption@end%
 \let\par\LWR at origpar%
-\LetLtxMacro\ref\LWR at origref%{} syntax highlighting
+\LetLtxMacro\ref\LWR at origref%   {} syntax highlighting
 \let\normalsize\LWR at orignormalsize%
 \let\small\LWR at origsmall%
 \let\footnotesize\LWR at origfootnotesize%
@@ -8585,16 +8774,11 @@
 \let\LARGE\LWR at origLARGE%
 \let\huge\LWR at orighuge%
 \let\Huge\LWR at origHuge%
-\RenewDocumentCommand{\InlineClass}{o m +m}{##3}%
-\RenewDocumentEnvironment{BlockClass}{o m}{}{}%
-\renewcommand{\BlockClassSingle}[2]{##2}%
-\LetLtxMacro\hspace\LWR at orighspace%
+\LWR at select@print at hspace%
 \LetLtxMacro\hfill\LWR at orighfill%
 \LetLtxMacro\hfil\LWR at orighfil%
-\LetLtxMacro\rule\LWR at origrule%
 \LetLtxMacro\hrulefill\LWR at orighrulefill%
 \LetLtxMacro\dotfill\LWR at origdotfill%
-\let\vspace\LWR at origvspace%
 \let\hss\LWR at orighss%
 \let\llap\LWR at origllap%
 \let\rlap\LWR at origrlap%
@@ -8607,28 +8791,28 @@
 \let\textellipsis\LWR at origtextellipsis%
 \let\textless\LWR at origtextless%
 \let\textgreater\LWR at origtextgreater%
-\LetLtxMacro{\textrm}{\LWR at origtextrm}%
-\LetLtxMacro{\textsf}{\LWR at origtextsf}%
-\LetLtxMacro{\texttt}{\LWR at origtexttt}%
-\LetLtxMacro{\textbf}{\LWR at origtextbf}%
-\LetLtxMacro{\textmd}{\LWR at origtextmd}%
-\LetLtxMacro{\textit}{\LWR at origtextit}%
-\LetLtxMacro{\textsl}{\LWR at origtextsl}%
-\LetLtxMacro{\textsc}{\LWR at origtextsc}%
-\LetLtxMacro{\textup}{\LWR at origtextup}%
-\LetLtxMacro{\textnormal}{\LWR at origtextnormal}%
-\LetLtxMacro{\emph}{\LWR at origemph}%
-\LetLtxMacro{\rmfamily}{\LWR at origrmfamily}%
-\LetLtxMacro{\sffamily}{\LWR at origsffamily}%
-\LetLtxMacro{\ttfamily}{\LWR at origttfamily}%
-\LetLtxMacro{\bfseries}{\LWR at origbfseries}%
-\LetLtxMacro{\mdseries}{\LWR at origmdseries}%
-\LetLtxMacro{\upshape}{\LWR at origupshape}%
-\LetLtxMacro{\slshape}{\LWR at origslshape}%
-\LetLtxMacro{\scshape}{\LWR at origscshape}%
-\LetLtxMacro{\itshape}{\LWR at origitshape}%
-\LetLtxMacro{\em}{\LWR at origem}%
-\LetLtxMacro{\normalfont}{\LWR at orignormalfont}%
+\LetLtxMacro\textrm\LWR at origtextrm%
+\LetLtxMacro\textsf\LWR at origtextsf%
+\LetLtxMacro\texttt\LWR at origtexttt%
+\LetLtxMacro\textbf\LWR at origtextbf%
+\LetLtxMacro\textmd\LWR at origtextmd%
+\LetLtxMacro\textit\LWR at origtextit%
+\LetLtxMacro\textsl\LWR at origtextsl%
+\LetLtxMacro\textsc\LWR at origtextsc%
+\LetLtxMacro\textup\LWR at origtextup%
+\LetLtxMacro\textnormal\LWR at origtextnormal%
+\LetLtxMacro\emph\LWR at origemph%
+\LetLtxMacro\rmfamily\LWR at origrmfamily%
+\LetLtxMacro\sffamily\LWR at origsffamily%
+\LetLtxMacro\ttfamily\LWR at origttfamily%
+\LetLtxMacro\bfseries\LWR at origbfseries%
+\LetLtxMacro\mdseries\LWR at origmdseries%
+\LetLtxMacro\upshape\LWR at origupshape%
+\LetLtxMacro\slshape\LWR at origslshape%
+\LetLtxMacro\scshape\LWR at origscshape%
+\LetLtxMacro\itshape\LWR at origitshape%
+\LetLtxMacro\em\LWR at origem%
+\LetLtxMacro\normalfont\LWR at orignormalfont%
 \let\sp\LWR at origsp%
 \let\sb\LWR at origsb%
 \LetLtxMacro\textsuperscript\LWR at origtextsuperscript%
@@ -8644,30 +8828,8 @@
 \LetLtxMacro\endtabular\LWR at origendtabular%
 \LetLtxMacro\noalign\LWR at orignoalign%
 \LetLtxMacro\hline\LWR at orighline%
-\LetLtxMacro\toprule\LWR at origtoprule%
-\LetLtxMacro\midrule\LWR at origmidrule%
-\LetLtxMacro\cmidrule\LWR at origcmidrule%
-\LetLtxMacro\bottomrule\LWR at origbottomrule%
-\LetLtxMacro\addlinespace\LWR at origaddlinespace%
-\LetLtxMacro\morecmidrules\LWR at origmorecmidrules%
-\LetLtxMacro\specialrule\LWR at origspecialrule%
 \let\newline\LWR at orignewline%
-\LetLtxMacro{\raisebox}{\LWR at origraisebox}%
 \LetLtxMacro\includegraphics\LWR at origincludegraphics%
-\LetLtxMacro{\scalebox}{\LWR at origscalebox}%
-\LetLtxMacro{\rotatebox}{\LWR at origrotatebox}%
-\let\reflectbox\LWR at origreflectbox%
-\LetLtxMacro\resizebox\LWR at origresizebox%
-\let\framebox\LWR at origframebox%
-\LetLtxMacro\mbox\LWR at origmbox%
-\LetLtxMacro\makebox\LWR at origmakebox%
-\let\fbox\LWRprint at fbox%
-\let\fboxBlock\LWRprint at fbox%
-\LetLtxMacro\fminipage\LWRprint at fminipage%
-\LetLtxMacro\endfminipage\endLWRprint at fminipage%
-\LetLtxMacro\minipage\LWR at origminipage%
-\let\endminipage\LWR at origendminipage%
-\LetLtxMacro\parbox\LWR at origparbox%
 \let\TeX\LWR at origTeX%
 \let\LaTeX\LWR at origLaTeX%
 \let\LaTeXe\LWR at origLaTeXe%
@@ -8678,8 +8840,16 @@
 \LWR at FBcancel%
 }
 \end{warpHTML}
+
+\begin{warpall}
+
+\newcommand*{\mathimagename}{math image}
+
+\newcommand*{\packagediagramname}{diagram}
+
+\end{warpall}
+
 \begin{warpHTML}
-
 \newcounter{LWR at externalfilecnt}
 
 \newbool{LWR at indisplaymathimage}
@@ -8745,13 +8915,15 @@
         bool{mathjax} or
         ( bool{FormatWP} and bool{WPMarkMath} )
     ) and
-    ( not test { \ifstrequal {#2} {(math image)} } )% from \ensuredmath
+    ( not test { \ifstrequal {#2} {(\mathimagename)} } ) and % from \ensuredmath
+    ( not bool{LWR at dynamicmath} )
 }%
 {%
+    \LWR at traceinfo{LWR at subsingledollar: Mathjax}%
     {\textbackslash(\LWR at HTMLsanitize{#4}\textbackslash)}%
 }% mathjax
 {% not mathjax
-\LWR at traceinfo{LWR at subsingledollar: not mathjax}%
+\LWR at traceinfo{LWR at subsingledollar: NOT mathjax, or is ensuremath, or is dynamic}%
     \begingroup%
     \LWR at restoreorigformatting%
     \RenewDocumentEnvironment{lateximage}{s o o o}{}{}% inside group
@@ -8763,7 +8935,19 @@
     \LWR at traceinfo{Using font shape \LWR at f@shape}%
     \csuse{LWR at orig\LWR at f@shape shape}%
     \global\advance\c at LWR@lateximagedepth 1\relax%
-    \global\sbox{\LWR at singledollarbox}{#4}%
+    \ifmmode%
+        \global\sbox{\LWR at singledollarbox}{#4}%
+    \else%
+        \ifbool{LWR at dynamicmath}{%
+            \ifbool{mathjax}{%
+                \global\sbox{\LWR at singledollarbox}{\LWR at origensuredmath{#4}}%
+            }{%
+                \global\sbox{\LWR at singledollarbox}{#4}%
+            }%
+        }{%
+            \global\sbox{\LWR at singledollarbox}{#4}%
+        }%
+    \fi%
     \global\sbox{\LWR at singledollarbox}{%
         \usebox{\LWR at singledollarbox}%
         \hspace*{-10sp}%
@@ -8814,7 +8998,7 @@
     \ifdimgreater{\LWR at singledollardepth}{0.05ex}{%
         \def\LWR at singledollardepthstyle{%
             \ ; % extra space
-            \LWR at origmbox{%
+            \LWR at print@mbox{%
                 vertical-align:-\LWR at convertto{em}{\the\LWR at singledollardepth} em%
             } % extra space
         }%
@@ -8821,23 +9005,32 @@
     }{%
         \def\LWR at singledollardepthstyle{}%
     }%
-    \IfValueTF{#1}{%
-        \LWR at findcurrenttextcolor% sets \LWR at tempcolor
-        \begin{lateximage}*% use hashing
-            [#2]% alt
-            [% addl' hashing
-                #3%
-                FM\LWR at f@family%
-                SR\LWR at f@series%
-                SH\LWR at f@shape%
-                CL\LWR at tempcolor%
-            ]%
-            [\LWR at singledollarstyle \LWR at singledollardepthstyle]% CSS
-    }{%
+    \ifbool{LWR at dynamicmath}{%
+        \LWR at traceinfo{subsingledollar: dynamic}%
         \begin{lateximage}% no hashing
-            [#2]% alt
+            [(\mathimagename)]% alt tag
             []% no add'l hashing
             [\LWR at singledollarstyle \LWR at singledollardepthstyle]% CSS
+    }{%
+        \LWR at traceinfo{subsingledollar: static}%
+        \IfValueTF{#1}{%
+            \LWR at findcurrenttextcolor% sets \LWR at tempcolor
+            \begin{lateximage}*% use hashing
+                [#2]% alt
+                [% addl' hashing
+                    #3%
+                    FM\LWR at f@family%
+                    SR\LWR at f@series%
+                    SH\LWR at f@shape%
+                    CL\LWR at tempcolor%
+                ]%
+                [\LWR at singledollarstyle \LWR at singledollardepthstyle]% CSS
+        }{%
+            \begin{lateximage}% no hashing
+                [#2]% alt
+                []% no add'l hashing
+                [\LWR at singledollarstyle \LWR at singledollardepthstyle]% CSS
+        }%
     }%
     \LWR at addbaselinemarker%
     \hspace*{-10sp}%
@@ -8923,7 +9116,7 @@
 
 \renewcommand{\@ensuredmath}[1]{%
 \ifbool{mathjax}{%
-    \LWR at subsingledollar*{(math image)}{%
+    \LWR at subsingledollar*{(\mathimagename)}{%
            \protect\LWR at HTMLsanitize{\detokenize\expandafter{#1}}%
     }{\relax%
         \LWR at origensuredmath{#1}%
@@ -8935,7 +9128,7 @@
     \ifnumcomp{\value{LWR at lateximagedepth}}{>}{0}%
     {\LWR at origensuredmath{#1}}%
     {%
-        \LWR at subsingledollar*{(math image)}{%
+        \LWR at subsingledollar*{(\mathimagename)}{%
            \protect\LWR at HTMLsanitize{\detokenize\expandafter{#1}}%
         }{%
             \LWR at origensuredmath{#1}%
@@ -9684,7 +9877,7 @@
     \LWR at traceinfo{lateximage: about to create a new page}%
     \LWR at orignewpage%
     \LWR at traceinfo{lateximage: about to create minipage}%
-    \LWR at origminipage{6in}%
+    \LWR at print@minipage{6in}%
     \csuse{LWR at orig\LateximageFontSizeName}%
     \LWR at traceinfo{lateximage: about to temporarily restore formatting}%
     \LWR at restoreorigformatting%
@@ -9721,10 +9914,10 @@
 }%
 {% end of outer-most lateximage
 \LWR at traceinfo{lateximage: ending outer-most lateximage}%
-    \LWR at origendminipage%
+    \endLWR at print@minipage%
     \LWR at orignewpage%
     \LWR at origscriptsize%
-    \LWR at origvspace*{.5\baselineskip}%
+    \LWR at print@vspace*{.5\baselineskip}%
     \LWR at htmlclosecomment%
     \LWR at traceinfo{lateximage: The page after the image is \arabic{page}}%
     \IfBooleanTF{#1}% starred
@@ -9732,7 +9925,7 @@
         \LWR at subinlineimage[#2]{lateximage}%
         {%
             lateximages\OSPathSymbol%
-            \LWR at origmbox{\LWR at hashedname}%
+            \LWR at print@mbox{\LWR at hashedname}%
         }{svg}{#4}%
     }% hash
     {% no hash
@@ -9739,7 +9932,7 @@
         \LWR at subinlineimage[#2]{lateximage}%
         {%
             lateximages\OSPathSymbol%
-            \LWR at origmbox{lateximage-\theLWR at externalfilecnt}%
+            \LWR at print@mbox{lateximage-\theLWR at externalfilecnt}%
         }{svg}{#4}%
     }% no hash
     \LWR at ensuredoingapar%
@@ -9770,7 +9963,7 @@
 {
 \LWR at forcenewpage
 \ifbool{FormatWP}
-{\BlockClass[\LWR at origmbox{text-align:center}]{center}}
+{\BlockClass[\LWR at print@mbox{text-align:center}]{center}}
 {\BlockClass{center}}
 }
 {\endBlockClass}
@@ -9779,7 +9972,7 @@
 {
 \LWR at forcenewpage
 \ifbool{FormatWP}
-{\BlockClass[\LWR at origmbox{text-align:right}]{flushright}}
+{\BlockClass[\LWR at print@mbox{text-align:right}]{flushright}}
 {\BlockClass{flushright}}
 }
 {\endBlockClass}
@@ -9788,7 +9981,7 @@
 {
 \LWR at forcenewpage
 \ifbool{FormatWP}
-{\BlockClass[\LWR at origmbox{text-align:left}]{flushleft}}
+{\BlockClass[\LWR at print@mbox{text-align:left}]{flushleft}}
 {\BlockClass{flushleft}}
 }
 {\endBlockClass}
@@ -9880,16 +10073,12 @@
 \@ifpackageloaded{xcolor}{
 \LWR at traceinfo{patching xcolor}
 \LetLtxMacro\colorboxBlock\colorbox
-\warpprintonly{
-\LetLtxMacro\LWRprint at colorboxBlock\colorbox
-\LetLtxMacro\LWRorigprint at fcolorbox\fcolorbox
-\LetLtxMacro\LWRorigprint at fcolorboxBlock\fcolorbox
-}
+\LetLtxMacro\LWR at orig@print at fcolorbox\fcolorbox
 
 \newsavebox{\LWR at colorminipagebox}
 
-\DeclareDocumentCommand{\LWRprint at fcolorbox}{o m o m +m}{%
-\LWR at traceinfo{LWRprint at fcolorbox #2 #4}%
+\NewDocumentCommand{\LWR at print@fcolorbox}{o m o m +m}{%
+\LWR at traceinfo{LWR at print@fcolorbox #2 #4}%
 \begin{lrbox}{\LWR at colorminipagebox}%
 #5%
 \end{lrbox}%
@@ -9910,20 +10099,23 @@
 \IfValueTF{#1}%
 {%
     \IfValueTF{#3}%
-    {\LWRorigprint at fcolorbox[#1]{#2}[#3]{#4}{\usebox{\LWR at colorminipagebox}}}%
-    {\LWRorigprint at fcolorbox[#1]{#2}{#4}{\usebox{\LWR at colorminipagebox}}}%
+    {\LWR at orig@print at fcolorbox[#1]{#2}[#3]{#4}{\usebox{\LWR at colorminipagebox}}}%
+    {\LWR at orig@print at fcolorbox[#1]{#2}{#4}{\usebox{\LWR at colorminipagebox}}}%
 }%
 {% no value #1
     \IfValueTF{#3}%
-    {\LWRorigprint at fcolorbox{#2}[#3]{#4}{\usebox{\LWR at colorminipagebox}}}%
-    {\LWRorigprint at fcolorbox{#2}{#4}{\usebox{\LWR at colorminipagebox}}}%
+    {\LWR at orig@print at fcolorbox{#2}[#3]{#4}{\usebox{\LWR at colorminipagebox}}}%
+    {\LWR at orig@print at fcolorbox{#2}{#4}{\usebox{\LWR at colorminipagebox}}}%
 }% no value #1
 }% #4 not none
-\LWR at traceinfo{LWRprint at fcolorbox done}%
+\LWR at traceinfo{LWR at print@fcolorbox done}%
 }
-\LetLtxMacro\LWRprint at fcolorboxBlock\LWRprint at fcolorbox
 
-\NewDocumentEnvironment{LWRprint at fcolorminipage}{o m o m O{c} O{} o m}
+\renewcommand*{\fcolorbox}{\LWR at print@fcolorbox}
+\newcommand*{\LWR at print@fcolorboxBlock}{\LWR at print@fcolorbox}
+\newcommand*{\fcolorboxBlock}{\LWR at print@fcolorboxBlock}
+
+\NewDocumentEnvironment{LWR at print@fcolorminipage}{o m o m O{c} O{} o m}
 {%
 \LWR at traceinfo{*** fcolorminipage: #2 #4 #8}%
 \begin{lrbox}{\LWR at colorminipagebox}%
@@ -9950,32 +10142,22 @@
     \IfValueTF{#1}%
     {%
     \IfValueTF{#3}%
-    {\LWRorigprint at fcolorbox[#1]{#2}[#3]{#4}{\usebox{\LWR at colorminipagebox}}}%
-    {\LWRorigprint at fcolorbox[#1]{#2}{#4}{\usebox{\LWR at colorminipagebox}}}%
+    {\LWR at orig@print at fcolorbox[#1]{#2}[#3]{#4}{\usebox{\LWR at colorminipagebox}}}%
+    {\LWR at orig@print at fcolorbox[#1]{#2}{#4}{\usebox{\LWR at colorminipagebox}}}%
     }%
     {% no value #1
     \IfValueTF{#3}%
-    {\LWRorigprint at fcolorbox{#2}[#3]{#4}{\usebox{\LWR at colorminipagebox}}}%
-    {\LWRorigprint at fcolorbox{#2}{#4}{\usebox{\LWR at colorminipagebox}}}%
+    {\LWR at orig@print at fcolorbox{#2}[#3]{#4}{\usebox{\LWR at colorminipagebox}}}%
+    {\LWR at orig@print at fcolorbox{#2}{#4}{\usebox{\LWR at colorminipagebox}}}%
     }% no value #1
 }% #4 not none
 \LWR at traceinfo{*** finished end fcolorminipage}%
 }
 
-\newcommand*{\LWR at restoreorigprintxcolor}{%
-\LWR at traceinfo{LWR at restoreorigprintxcolor}%
-\LetLtxMacro\colorboxBlock\LWRprint at colorboxBlock%
-\LetLtxMacro\fcolorbox\LWRprint at fcolorbox%
-\LetLtxMacro\fcolorboxBlock\LWRprint at fcolorboxBlock%
-\LetLtxMacro\fcolorminipage\LWRprint at fcolorminipage%
-\LetLtxMacro\endfcolorminipage\endLWRprint at fcolorminipage%
-}
+\newenvironment*{fcolorminipage}
+    {\LWR at print@fcolorminipage}
+    {\endLWR at print@fcolorminipage}
 
-\appto\LWR at restoreorigformatting{%
-\LWR at restoreorigprintxcolor%
-}
-\warpprintonly{\LWR at restoreorigprintxcolor}
-
 \LWR at traceinfo{xcolor patches done}
 }{}% xcolor loaded
 }% AtBeginDocument
@@ -10014,7 +10196,7 @@
         \renewcommand*{\@@@setcref}[2]{#1{\ref{#2}}{}{}}
     }{
         \PackageWarning{lwarp-cleveref}{
-            Unknown verison of cleveref.
+            Unknown version of cleveref.
             \protect\cref\space will fail.
         }%
     }
@@ -10036,7 +10218,7 @@
         }
     }{
         \PackageWarning{lwarp-cleveref}{
-            Unknown verison of cleveref.
+            Unknown version of cleveref.
             \protect\crefrange\space will fail.
         }
     }
@@ -10064,7 +10246,7 @@
     }
     {
         \PackageWarning{lwarp-cleveref}{
-            Unknown verison of cleveref.
+            Unknown version of cleveref.
             \protect\cpageref\space will fail.
         }
     }
@@ -10093,7 +10275,7 @@
     }
     {
         \PackageWarning{lwarp-cleveref}{
-            Unknown verison of cleveref.
+            Unknown version of cleveref.
             \protect\cpagerefrange\space will fail.
         }
     }
@@ -10140,7 +10322,7 @@
 \begin{warpHTML}
 \newbool{LWR at minipagethispar}
 \boolfalse{LWR at minipagethispar}
-\RenewDocumentEnvironment{minipage}{O{t} o O{t} m}
+\NewDocumentEnvironment{LWR at HTML@minipage}{O{t} o O{t} m}
 {%
 \LWR at traceinfo{minipage}%
 \begingroup
@@ -10161,18 +10343,21 @@
 \ifbool{FormatWP}{%
 
 \addtocounter{LWR at thisautoidWP}{1}%
-\LWR at htmltag{div id="\LWR at origmbox{autoidWP-\arabic{LWR at thisautoidWP}}" class="wpminipage"}%
+\LWR at htmltag{%
+    div id="\LWR at print@mbox{autoidWP-\arabic{LWR at thisautoidWP}}" %
+    class="wpminipage"%
+}%
 
 }{}%
 \LWR at traceinfo{minipage: creating div class}%
 \LWR at htmltag{div class="minipage" style="%
-\ifthenelse{\equal{#1}{t}}{\LWR at origmbox{vertical-align:bottom} ; }{}%
-\ifthenelse{\equal{#1}{c}}{\LWR at origmbox{vertical-align:middle} ; }{}%
-\ifthenelse{\equal{#1}{b}}{\LWR at origmbox{vertical-align:top} ; }{}%
-\ifthenelse{\equal{#3}{t}}{\LWR at origmbox{justify-content:flex-start} ; }{}%
-\ifthenelse{\equal{#3}{c}}{\LWR at origmbox{justify-content:center} ; }{}%
-\ifthenelse{\equal{#3}{b}}{\LWR at origmbox{justify-content:flex-end} ; }{}%
-\ifthenelse{\equal{#3}{s}}{\LWR at origmbox{justify-content:space-between} ; }{}%
+\ifthenelse{\equal{#1}{t}}{\LWR at print@mbox{vertical-align:bottom} ; }{}%
+\ifthenelse{\equal{#1}{c}}{\LWR at print@mbox{vertical-align:middle} ; }{}%
+\ifthenelse{\equal{#1}{b}}{\LWR at print@mbox{vertical-align:top} ; }{}%
+\ifthenelse{\equal{#3}{t}}{\LWR at print@mbox{justify-content:flex-start} ; }{}%
+\ifthenelse{\equal{#3}{c}}{\LWR at print@mbox{justify-content:center} ; }{}%
+\ifthenelse{\equal{#3}{b}}{\LWR at print@mbox{justify-content:flex-end} ; }{}%
+\ifthenelse{\equal{#3}{s}}{\LWR at print@mbox{justify-content:space-between} ; }{}%
 \LWR at traceinfo{minipage: about to print the width of \LWR at printlength{\LWR at minipagewidth}}%
 \ifbool{LWR at minipagefullwidth}%
 {\boolfalse{LWR at minipagefullwidth}}%
@@ -10223,7 +10408,9 @@
 \global\booltrue{LWR at minipagethispar}%
 \LWR at traceinfo{LWR at minipage: done}%
 }
-\RenewDocumentCommand{\parbox}{O{t} o O{t} m +m}
+
+\LWR at formattedenv{minipage}
+\NewDocumentCommand{\LWR at HTML@parbox}{O{t} o O{t} m +m}
 {
 \LWR at traceinfo{parbox of width #4}%
 \begin{minipage}[#1][#2][#3]{#4}%
@@ -10230,8 +10417,12 @@
 #5
 \end{minipage}%
 }
-\renewcommand*{\mbox}[1]{#1}
-\RenewDocumentCommand{\makebox}{d() o o m}{%
+
+\LWR at formatted{parbox}
+\newcommand*{\LWR at HTML@mbox}[1]{#1}
+
+\LWR at formatted{mbox}
+\NewDocumentCommand{\LWR at HTML@makebox}{d() o o m}{%
 \IfValueTF{#2}%
 {%
     {% scope
@@ -10241,8 +10432,8 @@
     \ifstrequal{#3}{s}{\def\LWR at align{justify}}{}%
     \setlength{\LWR at tempwidth}{#2}%
     \InlineClass[%
-        \LWR at origmbox{display:inline-block} ; %
-        \LWR at origmbox{text-align}:\LWR at align\ ; %
+        \LWR at print@mbox{display:inline-block} ; %
+        \LWR at print@mbox{text-align}:\LWR at align\ ; %
         width:\LWR at printlength{\LWR at tempwidth}%
     ]%
     {makebox}%
@@ -10251,11 +10442,15 @@
 }%
 {#4}% no width
 }
+
+\LWR at formatted{makebox}
 \LetLtxMacro\LWR at origframebox\framebox
 
-\RenewDocumentCommand{\framebox}{o o m}{%
+\NewDocumentCommand{\LWR at HTML@framebox}{o o m}{%
 \fbox{\makebox[#1][#2]{#3}}%
 }
+
+\LWR at formatted{framebox}
 \newlength{\LWR at atleastonept}
 
 \newcommand*{\LWR at forceminwidth}[1]{%
@@ -10272,8 +10467,7 @@
 border:\LWR at printlength{\LWR at atleastonept} solid black ; %
 padding:\LWR at printlength{\fboxsep}%
 }
-\let\LWRprint at fbox\fbox
-\newcommand{\LWRhtml at fbox}[1]{%
+\newcommand{\LWR at HTML@fbox}[1]{%
 \LWR at traceinfo{HTML fbox}%
 \LWR at forceminwidth{\fboxrule}%
 \InlineClass[%
@@ -10280,9 +10474,13 @@
 \LWR at blackborderpadding%
 ]{fbox}{#1}
 }
-\AtBeginDocument{\let\fbox\LWRhtml at fbox}
-
-\newcommand{\fboxBlock}[1]{%
+\AtBeginDocument{\LWR at formatted{fbox}}
+\end{warpHTML}
+\begin{warpall}
+\let\fboxBlock\fbox
+\end{warpall}
+\begin{warpHTML}
+\newcommand{\LWR at HTML@fboxBlock}[1]{%
 \LWR at forceminwidth{\fboxrule}%
 \begin{BlockClass}[%
 \LWR at blackborderpadding%
@@ -10291,34 +10489,14 @@
 \end{BlockClass}
 }
 
-\NewDocumentEnvironment{fminipage}{O{t} o O{t} m}
-{%
-\LWR at traceinfo{fminipage #1 #2 #3 #4}%
-\LWR at forceminwidth{\fboxrule}%
-\setlength{\LWR at tempwidth}{#4}%
-\IfValueT{#2}{\setlength{\LWR at tempheight}{#2}}%
-\begin{BlockClass}[%
-\LWR at blackborderpadding ; %
-\IfValueT{#2}{height:\LWR at printlength{\LWR at tempheight} ; }%
-width:\LWR at printlength{\LWR at tempwidth}%
-]{fminipage}%
-}
-{%
-\end{BlockClass}%
-\LWR at traceinfo{fminipage done}%
-}
-\LetLtxMacro{\LWR at origraisebox}{\raisebox}
+\LWR at formatted{fboxBlock}
 
-\RenewDocumentCommand{\raisebox}{m o o m}{%
-#4%
-}
-
 \end{warpHTML}
+\begin{warpall}
 
-\begin{warpall}
 \newsavebox{\LWR at fminipagebox}
 
-\NewDocumentEnvironment{LWRprint at fminipage}{O{t} o O{t} m}
+\NewDocumentEnvironment{LWR at print@fminipage}{O{t} o O{t} m}
 {%
 \IfValueTF{#3}%
 {\def\LWR at thisalign{#3}}
@@ -10338,17 +10516,42 @@
 \endminipage%
 }
 
+\newenvironment{fminipage}{\LWR at print@fminipage}{\endLWR at print@fminipage}
+
 \end{warpall}
 
-\begin{warpprint}
-\let\fboxBlock\fbox
+\begin{warpHTML}
 
-\LetLtxMacro{\fminipage}{\LWRprint at fminipage}
-\LetLtxMacro{\endfminipage}{\endLWRprint at fminipage}
+\NewDocumentEnvironment{LWR at HTML@fminipage}{O{t} o O{t} m}
+{%
+\LWR at traceinfo{fminipage #1 #2 #3 #4}%
+\LWR at forceminwidth{\fboxrule}%
+\setlength{\LWR at tempwidth}{#4}%
+\IfValueT{#2}{\setlength{\LWR at tempheight}{#2}}%
+\begin{BlockClass}[%
+\LWR at blackborderpadding ; %
+\IfValueT{#2}{height:\LWR at printlength{\LWR at tempheight} ; }%
+width:\LWR at printlength{\LWR at tempwidth}%
+]{fminipage}%
+}
+{%
+\end{BlockClass}%
+\LWR at traceinfo{fminipage done}%
+}
 
-\end{warpprint}
+\LWR at formattedenv{fminipage}
+\end{warpHTML}
+\begin{warpHTML}
 
+\NewDocumentCommand{\LWR at HTML@raisebox}{m o o m}{%
+#4%
+}
 
+\LWR at formatted{raisebox}
+
+\end{warpHTML}
+
+
 \begin{warpHTML}
 
 
@@ -10360,7 +10563,7 @@
 
 \DeclareRobustCommand{\LWR at HTMLemph}[1]{\LWR at htmlspan{em}{#1}}
 \DeclareRobustCommand{\LWR at nullemph}[1]{#1}
-\LetLtxMacro{\emph}{\LWR at HTMLemph}
+\LetLtxMacro\emph\LWR at HTMLemph
 
 \DeclareRobustCommand{\LWR at HTMLtextmd}[1]{%
 \LWR at HTMLtextstyle{font-weight:normal}{textmd}{#1}%
@@ -10367,11 +10570,11 @@
 }
 \DeclareRobustCommand{\LWR at nulltextmd}[1]{#1}
 
-\LetLtxMacro{\textmd}{\LWR at HTMLtextmd}
+\LetLtxMacro\textmd\LWR at HTMLtextmd
 
 \DeclareRobustCommand{\LWR at HTMLtextbf}[1]{\LWR at htmlspan{b}{#1}}
 \DeclareRobustCommand{\LWR at nulltextbf}[1]{#1}
-\LetLtxMacro{\textbf}{\LWR at HTMLtextbf}
+\LetLtxMacro\textbf\LWR at HTMLtextbf
 
 \DeclareRobustCommand{\LWR at HTMLtextrm}[1]{%
 \LWR at HTMLtextstyle{font-family:serif}{textrm}{#1}%
@@ -10379,17 +10582,17 @@
 
 \DeclareRobustCommand{\LWR at nulltextrm}[1]{#1}
 
-\LetLtxMacro{\textrm}{\LWR at HTMLtextrm}
+\LetLtxMacro\textrm\LWR at HTMLtextrm
 
 \DeclareRobustCommand{\LWR at HTMLtextsf}[1]{%
 \LWR at HTMLtextstyle{font-family:sans}{textsf}{#1}%
 }
 \DeclareRobustCommand{\LWR at nulltextsf}[1]{#1}
-\LetLtxMacro{\textsf}{\LWR at HTMLtextsf}
+\LetLtxMacro\textsf\LWR at HTMLtextsf
 
 \DeclareRobustCommand{\LWR at HTMLtexttt}[1]{\LWR at htmlspan{kbd}{#1}}
 \DeclareRobustCommand{\LWR at nulltexttt}[1]{#1}
-\LetLtxMacro{\texttt}{\LWR at HTMLtexttt}
+\LetLtxMacro\texttt\LWR at HTMLtexttt
 
 \DeclareRobustCommand{\LWR at HTMLtextup}[1]{%
 \LWR at HTMLtextstyle{font-variant:normal}{textup}{#1}%
@@ -10397,11 +10600,11 @@
 
 \DeclareRobustCommand{\LWR at nulltextup}[1]{#1}
 
-\LetLtxMacro{\textup}{\LWR at HTMLtextup}
+\LetLtxMacro\textup\LWR at HTMLtextup
 
 \DeclareRobustCommand{\LWR at HTMLtextit}[1]{\LWR at htmlspan{i}{#1}}
 \DeclareRobustCommand{\LWR at nulltextit}[1]{#1}
-\LetLtxMacro{\textit}{\LWR at HTMLtextit}
+\LetLtxMacro\textit\LWR at HTMLtextit
 
 \DeclareRobustCommand{\LWR at HTMLtextsc}[1]{%
 \LWR at HTMLtextstyle{font-variant:small-caps}{textsc}{#1}%
@@ -10409,7 +10612,7 @@
 
 \DeclareRobustCommand{\LWR at nulltextsc}[1]{#1}
 
-\LetLtxMacro{\textsc}{\LWR at HTMLtextsc}
+\LetLtxMacro\textsc\LWR at HTMLtextsc
 
 \DeclareRobustCommand{\LWR at HTMLtextsl}[1]{%
 \LWR at HTMLtextstyle{font-style:oblique}{textsl}{#1}%
@@ -10417,11 +10620,11 @@
 
 \DeclareRobustCommand{\LWR at nulltextsl}[1]{#1}
 
-\LetLtxMacro{\textsl}{\LWR at HTMLtextsl}
+\LetLtxMacro\textsl\LWR at HTMLtextsl
 
 \DeclareRobustCommand{\LWR at HTMLtextnormal}[1]{\textmd{\textrm{\textup{#1}}}}
 \DeclareRobustCommand{\LWR at nulltextnormal}[1]{#1}
-\LetLtxMacro{\textnormal}{\LWR at HTMLtextnormal}
+\LetLtxMacro\textnormal\LWR at HTMLtextnormal
 
 \DeclareRobustCommand{\LWR at nullrmfamily}{}
 \DeclareRobustCommand{\LWR at nullsffamily}{}
@@ -10436,28 +10639,28 @@
 \DeclareRobustCommand{\LWR at nullnormalfont}{}
 
 \newcommand*{\LWR at nullfonts}{%
-\LetLtxMacro{\emph}{\LWR at nullemph}%
-\LetLtxMacro{\textmd}{\LWR at nulltextmd}%
-\LetLtxMacro{\textbf}{\LWR at nulltextbf}%
-\LetLtxMacro{\textrm}{\LWR at nulltextrm}%
-\LetLtxMacro{\textsf}{\LWR at nulltextsf}%
-\LetLtxMacro{\texttt}{\LWR at nulltexttt}%
-\LetLtxMacro{\textup}{\LWR at nulltextup}%
-\LetLtxMacro{\textit}{\LWR at nulltextit}%
-\LetLtxMacro{\textsc}{\LWR at nulltextsc}%
-\LetLtxMacro{\textsl}{\LWR at nulltextsl}%
-\LetLtxMacro{\textnormal}{\LWR at nulltextnormal}%
-\LetLtxMacro{\rmfamily}{\LWR at nullrmfamily}%
-\LetLtxMacro{\sffamily}{\LWR at nullsffamily}%
-\LetLtxMacro{\ttfamily}{\LWR at nullttfamily}%
-\LetLtxMacro{\bfseries}{\LWR at nullbfseries}%
-\LetLtxMacro{\mdseries}{\LWR at nullmdseries}%
-\LetLtxMacro{\upshape}{\LWR at nullupshape}%
-\LetLtxMacro{\slshape}{\LWR at nullslshape}%
-\LetLtxMacro{\scshape}{\LWR at nullscshape}%
-\LetLtxMacro{\itshape}{\LWR at nullitshape}%
-\LetLtxMacro{\em}{\LWR at nullem}%
-\LetLtxMacro{\normalfont}{\LWR at nullnormalfont}%
+\LetLtxMacro\emph\LWR at nullemph%
+\LetLtxMacro\textmd\LWR at nulltextmd%
+\LetLtxMacro\textbf\LWR at nulltextbf%
+\LetLtxMacro\textrm\LWR at nulltextrm%
+\LetLtxMacro\textsf\LWR at nulltextsf%
+\LetLtxMacro\texttt\LWR at nulltexttt%
+\LetLtxMacro\textup\LWR at nulltextup%
+\LetLtxMacro\textit\LWR at nulltextit%
+\LetLtxMacro\textsc\LWR at nulltextsc%
+\LetLtxMacro\textsl\LWR at nulltextsl%
+\LetLtxMacro\textnormal\LWR at nulltextnormal%
+\LetLtxMacro\rmfamily\LWR at nullrmfamily%
+\LetLtxMacro\sffamily\LWR at nullsffamily%
+\LetLtxMacro\ttfamily\LWR at nullttfamily%
+\LetLtxMacro\bfseries\LWR at nullbfseries%
+\LetLtxMacro\mdseries\LWR at nullmdseries%
+\LetLtxMacro\upshape\LWR at nullupshape%
+\LetLtxMacro\slshape\LWR at nullslshape%
+\LetLtxMacro\scshape\LWR at nullscshape%
+\LetLtxMacro\itshape\LWR at nullitshape%
+\LetLtxMacro\em\LWR at nullem%
+\LetLtxMacro\normalfont\LWR at nullnormalfont%
 \renewcommand*{\,}{-}%
 \renewcommand*{~}{-}%
 \renewcommand*{\newline}{ }%
@@ -10638,8 +10841,9 @@
 \newlength{\LWR at tempheight}
 \newlength{\LWR at tempraise}
 
-\NewDocumentCommand{\LWR at hspace}{s m}{%
-\setlength{\LWR at tempwidth}{#2}%
+\newcommand{\LWR at select@html at hspace}{%
+\RenewDocumentCommand{\hspace}{s m}{%
+\setlength{\LWR at tempwidth}{##2}%
 \ifnum\gluestretchorder\LWR at tempwidth>0%
 \setlength{\LWR at tempwidth}{2em}%
 \fi%
@@ -10665,14 +10869,22 @@
     }%
     \LWR at minipagestartpars%
 }% width not 0
+}%
 }
-\NewDocumentCommand{\LWR at nohspace}{s m}{}
+\newcommand{\LWR at select@html at nohspace}{%
+    \RenewDocumentCommand{\hspace}{s m}{}%
+}
 
-\LetLtxMacro\hspace\LWR at hspace
+\newcommand*{\LWR at select@print at hspace}{%
+    \renewrobustcmd\hspace{\@ifstar\@hspacer\@hspace}%
+}
 
-\NewDocumentCommand{\LWR at vspace}{s m}{}
-\LetLtxMacro\vspace\LWR at vspace
+\LWR at select@html at hspace
 
+\NewDocumentCommand{\LWR at HTML@vspace}{s m}{}
+
+\LWR at formatted{vspace}
+
 \renewcommand*{\linebreak}[1][]{\newline}
 
 \renewcommand*{\nolinebreak}[1][]{}
@@ -10686,7 +10898,7 @@
 \RenewDocumentCommand{\enlargethispage}{s m}{}
 \renewcommand*{\clearpage}{}
 \renewcommand*{\cleardoublepage}{}
-\NewDocumentCommand{\LWR at rule}{o m m}{%
+\newcommand*{\LWR at HTML@rule}[3][]{%
 \setlength{\LWR at tempwidth}{#2}%
 \ifthenelse{\lengthtest{\LWR at tempwidth=0pt}}
 {}% zero- width
@@ -10703,6 +10915,7 @@
     }%
     {\setlength{\LWR at tempheight}{1pt}}{}%
     \LWR at minipagestoppars%
+    \LWR at findcurrenttextcolor%
     \LWR at htmltagc{%
     span
     style="%
@@ -10709,7 +10922,8 @@
     \ifbool{FormatWP}{}{background:\LWR at currenttextcolor ; }%
     width:\LWR at printlength{\LWR at tempwidth} ; %
     height:\LWR at printlength{\LWR at tempheight} ; %
-    \IfValueT{#1}%
+    \ifblank{#1}%
+    {}%
     {%
         \setlength{\LWR at tempraise}{0pt-#1}%
         \setlength{\LWR at tempraise}{\LWR at tempraise*2}%
@@ -10734,8 +10948,8 @@
     \LWR at minipagestartpars%
 }% non-zero width
 }
-\renewrobustcmd{\rule}{\LWR at rule}
 
+\LWR at formatted{rule}
 \end{warpHTML}
 
 



More information about the tex-live-commits mailing list