texlive[48159] trunk: lwarp (7jul18)

commits+karl at tug.org commits+karl at tug.org
Sat Jul 7 22:46:58 CEST 2018


Revision: 48159
          http://tug.org/svn/texlive?view=revision&revision=48159
Author:   karl
Date:     2018-07-07 22:46:58 +0200 (Sat, 07 Jul 2018)
Log Message:
-----------
lwarp (7jul18)

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-algorithm2e.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-alltt.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-amsthm.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-array.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-diagbox.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-enumitem.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-errata.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-idxlayout.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-komascript.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-memoir.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-quoting.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-schemata.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-soul.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfig.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-textcomp.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-theorem.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-attachfile.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-attachfile2.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-cases.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-imakeidx.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-index.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-intopdf.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-makeidx.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pdfpages.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pdfx.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-repeatindex.sty
    trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-splitidx.sty

Modified: trunk/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua	2018-07-07 20:46:58 UTC (rev 48159)
@@ -2,7 +2,7 @@
 
 -- Copyright 2016-2018 Brian Dunn
 
-printversion = "v0.57"
+printversion = "v0.58"
 
 function printhelp ()
 print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;
@@ -14,56 +14,62 @@
 --
 print ( [[
 
-lwarpmk print [project]: Compile the print version if necessary.
-lwarpmk print1 [project]: Forced single compile of the print version.
-lwarpmk printindex [project]: Process the index for the print version.
-lwarpmk printglossary [project]: Process the glossary for the print version.
-lwarpmk html [project]: Compile the HTML version if necessary.
-lwarpmk html1 [project]: Forced single compile of the HTML version.
-lwarpmk htmlindex [project]: Process the index for the html version.
-lwarpmk htmlglossary [project]: Process the glossary for the html version.
-lwarpmk again [project]: Touch the source code to trigger recompiles.
-lwarpmk limages [project]: Process the "lateximages" created by lwarp.sty.
-lwarpmk pdftohtml [project]:
+lwarpmk print [-p project]: Compile the print version if necessary.
+lwarpmk print1 [-p project]: Forced single compile of the print version.
+lwarpmk printindex [-p project]: Process print indexes.
+lwarpmk printglossary [-p project]: Process the glossary for the print version.
+lwarpmk html [-p project]: Compile the HTML version if necessary.
+lwarpmk html1 [-p project]: Forced single compile of the HTML version.
+lwarpmk htmlindex [-p project]: Process HTML indexes.
+lwarpmk htmlglossary [-p project]: Process the glossary for the html version.
+lwarpmk again [-p project]: Touch the source code to trigger recompiles.
+lwarpmk limages [-p project]: Process the "lateximages" created by lwarp.sty.
+lwarpmk pdftohtml [-p project]:
     For use with latexmk or a Makefile:
     Converts project_html.pdf to project_html.html and individual HTML files.
     Finishes the HTML conversion even if there was a compile error.
 lwarpmk pdftosvg <list of file names>: Converts each PDF file to SVG.
-lwarpmk clean [project]: Remove .aux, .toc, .lof/t, .idx, .ind, .log, *_html_inc.*, .gl*
-lwarpmk cleanall [project]: Remove auxiliary files and also project.pdf, *.html
+lwarpmk clean [-p project]: Remove .aux, .toc, .lof/t, .idx, .ind, .log, *_html_inc.*, .gl*
+lwarpmk cleanall [-p project]: Remove auxiliary files and also project.pdf, *.html
 lwarpmk cleanlimages: Removes all images from the "lateximages" directory.
 lwarpmk -h: Print this help message.
 lwarpmk --help: Print this help message.
 
 ]] )
-printconf ()
+-- printconf ()
 end
 
-function printconf ()
+-- function printconf ()
+-- --
+-- -- Print the format of the configuration file lwarpmk.conf:
+-- --
+-- print ( [[
+-- An example lwarpmk.conf or <project>.lwarpmkconf project file:
+-- --
+-- opsystem = "Unix"   (or "Windows")
+-- latexname = "pdflatex"  (or "lualatex", or "xelatex")
+-- sourcename = "projectname"  (the source-code filename w/o .tex)
+-- homehtmlfilename = "index"  (or perhaps the project name)
+-- htmlfilename = ""  (or "projectname" - filename prefix)
+-- latexmk = "false"  (or "true" to use latexmk to build PDFs)
+-- shellescape = "false"
+-- printindexcmd = "makeindex -s lwarp.ist <name>.idx"
+-- HTMLindexcmd = "makeindex -s lwarp.ist <name>_html.idx"
+-- latexmkindexcmd = "makeindex -s lwarp.ist"
+-- -- indexprog = "makeindex" or "xindy"
+-- -- makeindexstyle = "lwarp.ist" (or a custom file based on lwarp.ist)
+-- -- xindylanguge = "english"  (use a language supported by xindy)
+-- -- xindycodepage = "utf8"  (use a codepage supported by xindy)
+-- -- xindystyle = "lwarp.xdy" (or a custom file based on lwarp.xdy)
+-- glossarycmd = "makeglossaries"
+-- pdftotextenc = "UTF-8"  (use an encoding supported by pdftotext)
+-- --
+-- Filenames must contain only letters, numbers, underscore, or dash.
+-- Values must be in upright "quotes".
 --
--- Print the format of the configuration file lwarpmk.conf:
---
-print ( [[
-An example lwarpmk.conf or <project>.lwarpmkconf project file:
---
-opsystem = "Unix"   (or "Windows")
-latexname = "pdflatex"  (or "lualatex", or "xelatex")
-sourcename = "projectname"  (the source-code filename w/o .tex)
-homehtmlfilename = "index"  (or perhaps the project name)
-htmlfilename = ""  (or "projectname" - filename prefix)
-latexmk = "false"  (or "true" to use latexmk to build PDFs)
-shellescape = "false"
-xindylanguge = "english"  (use a language supported by xindy)
-xindycodepage = "utf8"  (use a codepage supported by xindy)
-xindystyle = "lwarp.xdy" (or a custom file based on lwarp.xdy)
-pdftotextenc = "UTF-8"  (use an encoding supported by pdftotext)
---
-Filenames must contain only letters, numbers, underscore, or dash.
-Values must be in upright "quotes".
+-- ]] ) ;
+-- end
 
-]] ) ;
-end
-
 function splitfile (destfile,sourcefile)
 --
 -- Split one large sourcefile into a number of files,
@@ -97,7 +103,7 @@
         "\" in lwarpmk.conf.\n"
     ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
     os.exit(1) ;
 end
 
@@ -107,16 +113,31 @@
 --
 -- Default configuration filename:
 local conffile = "lwarpmk.conf"
+local confroot = "lwarpmk"
+-- Global argument index
+argindex = 2
 -- Optional configuration filename:
-if ( arg[2] ~= nil ) then conffile = arg[2]..".lwarpmkconf" end
+if ( arg[argindex] == "-p" ) then
+    argindex = argindex + 1
+    confroot = arg[argindex]
+    conffile = confroot..".lwarpmkconf"
+    argindex = argindex + 1
+end
 -- Additional defaults:
 opsystem = "Unix"
 latexmk = "false"
 shellescape = "false"
-xindylanguage = "english"
-xindycodepage = "utf8"
-xindystyle = "lwarp.xdy"
-pdftotextenc = "UTF-8"
+printindexcmd = ""
+HTMLindexcmd = ""
+latexmkindexcmd = ""
+-- to be removed:
+-- indexprog = "makeindex"
+-- makeindexstyle = "lwarp.ist"
+-- xindylanguage = "english"
+-- xindycodepage = "utf8"
+-- xindystyle = "lwarp.xdy"
+-- pdftotextenc = "UTF-8"
+glossarycmd = "makeglossaries"
 -- Verify the file exists:
 if (lfs.attributes(conffile,"mode")==nil) then
     -- file not exists
@@ -125,9 +146,9 @@
     print ("lwarpmk: Move to the project's source directory,")
     print ("lwarpmk: recompile using pdflatex, xelatex, or lualatex,")
     print ("lwarpmk: then try using lwarpmk again.")
-    if ( arg[2] ~= nil ) then
+    if ( arg[argindex] ~= nil ) then
         print (
-            "lwarpmk: (\"" .. arg[2] ..
+            "lwarpmk: (\"" .. confroot ..
             "\" does not appear to be a project name.)"
         )
     end
@@ -142,7 +163,7 @@
 local linenum = 0
 for line in cfile:lines() do -- scan lines
 linenum = linenum + 1
-i,j,cvarname,cvalue = string.find (line,"([%w-_]*)%s*=%s*\"([%w%-_%.]*)\"") ;
+i,j,cvarname,cvalue = string.find (line,"([%w-_]*)%s*=%s*\"([^\"]*)\"") ;
 -- Error if incorrect enclosing characters:
 if ( i == nil ) then
     print ("lwarpmk: ===")
@@ -149,7 +170,7 @@
     print ("lwarpmk: " ..  linenum .. " : " .. line ) ;
     print ("lwarpmk: Incorrect entry in " .. conffile ..".\n" ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
     os.exit(1) ;
 end -- nil
 if ( cvarname == "opsystem" ) then
@@ -175,9 +196,25 @@
 elseif ( cvarname == "htmlfilename" ) then htmlfilename = cvalue
 elseif ( cvarname == "latexmk" ) then latexmk = cvalue
 elseif ( cvarname == "shellescape" ) then shellescape = cvalue
-elseif ( cvarname == "xindylanguage" ) then xindylanguage = cvalue
-elseif ( cvarname == "xindycodepage" ) then xindycodepage = cvalue
-elseif ( cvarname == "xindystyle" ) then xindystyle = cvalue
+elseif ( cvarname == "printindexcmd" ) then printindexcmd = cvalue
+elseif ( cvarname == "HTMLindexcmd" ) then HTMLindexcmd = cvalue
+elseif ( cvarname == "latexmkindexcmd" ) then latexmkindexcmd = cvalue
+elseif ( cvarname == "glossarycmd" ) then glossarycmd = cvalue
+-- to be removed:
+-- elseif ( cvarname == "indexprog" ) then
+--     -- Verify choice of indexing program:
+--     if (
+--         (cvalue == "makeindex") or
+--         (cvalue == "xindy")
+--     ) then
+--         indexprog = cvalue
+--     else
+--         cvalueerror ( line, linenum , cvalue )
+--     end
+-- elseif ( cvarname == "makeindexstyle" ) then makeindexstyle = cvalue
+-- elseif ( cvarname == "xindylanguage" ) then xindylanguage = cvalue
+-- elseif ( cvarname == "xindycodepage" ) then xindycodepage = cvalue
+-- elseif ( cvarname == "xindystyle" ) then xindystyle = cvalue
 elseif ( cvarname == "pdftotextenc" ) then pdftotextenc = cvalue
 else
     print ("lwarpmk: ===")
@@ -187,7 +224,7 @@
         conffile ..".\n"
     ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
 os.exit(1) ;
 end -- cvarname
 end -- do scan lines
@@ -235,15 +272,6 @@
 else print ( "lwarpmk: Select Unix or Windows for opsystem" )
 end --- for Windows
 
--- set xindycmd, glossarycmd according to pdflatex vs xelatex/lualatex:
-if ( latexname == "pdflatex" ) then
-    xindycmd = "texindy  "
-    glossarycmd = "xindy  "
-else
-    xindycmd = "xindy  -M texindy  "
-    glossarycmd = "xindy "
-end
-
 end -- loadconf
 
 function executecheckerror ( executecommands , errormessage )
@@ -348,8 +376,8 @@
     sourcename ..".toc " .. sourcename .. "_html.toc " ..
     sourcename ..".lof " .. sourcename .. "_html.lof " ..
     sourcename ..".lot " .. sourcename .. "_html.lot " ..
-    sourcename ..".idx " .. sourcename .. "_html.idx " ..
-    sourcename ..".ind " .. sourcename .. "_html.ind " ..
+    " *.idx " ..
+    " *.ind " ..
     sourcename ..".log " .. sourcename .. "_html.log " ..
     sourcename ..".gl* " .. sourcename .. "_html.gl* " ..
     " *_html_inc.* "
@@ -594,10 +622,8 @@
     .. "-e "
     .. opquote
     .. "$makeindex = q/" -- $
-    .. xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -C " .. xindycodepage
-    .. "  -L " .. xindylanguage .. " /"
+    .. latexmkindexcmd
+    .. " /"
     .. opquote
     .. " -pdflatex=\"" .. latexname .. thisshellescape .." %O %S\" "
     .. sourcename..fsuffix ..".tex"
@@ -609,10 +635,10 @@
 function convertpdftosvg ()
 --
 -- Converts PDF files to SVG files.
--- The filenames are arg[2] and up.
+-- The filenames are arg[argindex] and up.
 -- arg[1] is the command "pdftosvg".
 --
-for i = 2 , #arg do
+for i = argindex , #arg do
     if (lfs.attributes(arg[i],"mode")==nil) then
         print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.")
     else
@@ -622,6 +648,14 @@
 end -- do
 end --function
 
+-- Force an update and conclude processing:
+function updateanddone ()
+print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
+refreshdate ()
+print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
+print ("lwarpmk: Done.")
+end -- function
+
 -- Start of the main code: --
 
 -- lwarpmk --version :
@@ -668,25 +702,17 @@
     onetime("")
     print ("lwarpmk: Done.") ;
 
--- lwarp printindex:
+-- lwarpmk printindex:
 -- Compile the index then touch the source
 -- to trigger a recompile of the document:
 
 elseif arg[1] == "printindex" then
 loadconf ()
-print ("lwarpmk: Processing the index.")
-os.execute(
-    xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -C " .. xindycodepage
-    .. "  -L " .. xindylanguage
-    .. " " .. sourcename .. ".idx")
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute ( printindexcmd )
+print ("lwarpmk: -------")
+updateanddone ()
 
--- lwarp printglossary:
+-- lwarpmk printglossary:
 -- Compile the glossary then touch the source
 -- to trigger a recompile of the document:
 
@@ -694,16 +720,8 @@
 loadconf ()
 print ("lwarpmk: Processing the glossary.")
 
-os.execute(glossarycmd ..
-    "  -L " .. xindylanguage ..
-    "  -C " .. xindycodepage ..
-    "  -I xindy -M " .. sourcename ..
-    " -t " .. sourcename .. ".glg -o " .. sourcename .. ".gls "
-    .. sourcename .. ".glo")
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute(glossarycmd .. " " .. sourcename)
+updateanddone ()
 
 -- lwarpmk html:
 
@@ -752,39 +770,21 @@
 
 elseif arg[1] == "htmlindex" then
 loadconf ()
-print ("lwarpmk: Processing the index.")
-os.execute(
-    xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -L " .. xindylanguage
-    .. "  -C " .. xindycodepage
-    .. " " .. sourcename .. "_html.idx"
-)
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute ( HTMLindexcmd )
+print ("lwarpmk: -------")
+updateanddone ()
 
 -- lwarpmk htmlglossary:
 -- Compile the glossary then touch the source
--- to trigger a recompile of the document:
+-- to trigger a recompile of the document.
+-- The <sourcename>.xdy file is created by the glossaries package.
 
 elseif arg[1] == "htmlglossary" then
 loadconf ()
 print ("lwarpmk: Processing the glossary.")
+os.execute(glossarycmd .. " " .. sourcename .. "_html")
+updateanddone ()
 
-os.execute(glossarycmd ..
-    "  -L " .. xindylanguage ..
-    "  -C " .. xindycodepage ..
-    "  -I xindy -M " ..sourcename ..
-    "_html -t " .. sourcename .. "_html.glg -o " ..sourcename ..
-    "_html.gls " ..sourcename .. "_html.glo")
-
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
-
 -- lwarpmk limages:
 -- Scan the lateximages.txt file to create lateximages.
 
@@ -799,13 +799,10 @@
 
 elseif arg[1] == "again" then
 loadconf ()
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+updateanddone ()
 
 -- lwarpmk clean:
--- Remove project.aux, .toc, .lof, .lot, .idx, .ind, .log, *_html_inc.*, .gl*
+-- Remove project.aux, .toc, .lof, .lot, .log, *.idx, *.ind, *_html_inc.*, .gl*
 
 elseif arg[1] == "clean" then
 loadconf ()
@@ -813,7 +810,7 @@
 print ("lwarpmk: Done.")
 
 -- lwarpmk cleanall
--- Remove project.aux, .toc, .lof, .lot, .idx, .ind, .log, *_html_inc.*, .gl*
+-- Remove project.aux, .toc, .lof, .lot, .log, *.idx, *.ind, *_html_inc.*, .gl*
 --    and also project.pdf, *.html
 
 elseif arg[1] == "cleanall" then

Modified: trunk/Master/texmf-dist/doc/latex/lwarp/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/lwarp/README.txt	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/doc/latex/lwarp/README.txt	2018-07-07 20:46:58 UTC (rev 48159)
@@ -1,5 +1,5 @@
 
-LaTeX lwarp package v0.57   README.txt
+LaTeX lwarp package v0.58   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-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/scripts/lwarp/lwarpmk.lua	2018-07-07 20:46:58 UTC (rev 48159)
@@ -2,7 +2,7 @@
 
 -- Copyright 2016-2018 Brian Dunn
 
-printversion = "v0.57"
+printversion = "v0.58"
 
 function printhelp ()
 print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;
@@ -14,56 +14,62 @@
 --
 print ( [[
 
-lwarpmk print [project]: Compile the print version if necessary.
-lwarpmk print1 [project]: Forced single compile of the print version.
-lwarpmk printindex [project]: Process the index for the print version.
-lwarpmk printglossary [project]: Process the glossary for the print version.
-lwarpmk html [project]: Compile the HTML version if necessary.
-lwarpmk html1 [project]: Forced single compile of the HTML version.
-lwarpmk htmlindex [project]: Process the index for the html version.
-lwarpmk htmlglossary [project]: Process the glossary for the html version.
-lwarpmk again [project]: Touch the source code to trigger recompiles.
-lwarpmk limages [project]: Process the "lateximages" created by lwarp.sty.
-lwarpmk pdftohtml [project]:
+lwarpmk print [-p project]: Compile the print version if necessary.
+lwarpmk print1 [-p project]: Forced single compile of the print version.
+lwarpmk printindex [-p project]: Process print indexes.
+lwarpmk printglossary [-p project]: Process the glossary for the print version.
+lwarpmk html [-p project]: Compile the HTML version if necessary.
+lwarpmk html1 [-p project]: Forced single compile of the HTML version.
+lwarpmk htmlindex [-p project]: Process HTML indexes.
+lwarpmk htmlglossary [-p project]: Process the glossary for the html version.
+lwarpmk again [-p project]: Touch the source code to trigger recompiles.
+lwarpmk limages [-p project]: Process the "lateximages" created by lwarp.sty.
+lwarpmk pdftohtml [-p project]:
     For use with latexmk or a Makefile:
     Converts project_html.pdf to project_html.html and individual HTML files.
     Finishes the HTML conversion even if there was a compile error.
 lwarpmk pdftosvg <list of file names>: Converts each PDF file to SVG.
-lwarpmk clean [project]: Remove .aux, .toc, .lof/t, .idx, .ind, .log, *_html_inc.*, .gl*
-lwarpmk cleanall [project]: Remove auxiliary files and also project.pdf, *.html
+lwarpmk clean [-p project]: Remove .aux, .toc, .lof/t, .idx, .ind, .log, *_html_inc.*, .gl*
+lwarpmk cleanall [-p project]: Remove auxiliary files and also project.pdf, *.html
 lwarpmk cleanlimages: Removes all images from the "lateximages" directory.
 lwarpmk -h: Print this help message.
 lwarpmk --help: Print this help message.
 
 ]] )
-printconf ()
+-- printconf ()
 end
 
-function printconf ()
+-- function printconf ()
+-- --
+-- -- Print the format of the configuration file lwarpmk.conf:
+-- --
+-- print ( [[
+-- An example lwarpmk.conf or <project>.lwarpmkconf project file:
+-- --
+-- opsystem = "Unix"   (or "Windows")
+-- latexname = "pdflatex"  (or "lualatex", or "xelatex")
+-- sourcename = "projectname"  (the source-code filename w/o .tex)
+-- homehtmlfilename = "index"  (or perhaps the project name)
+-- htmlfilename = ""  (or "projectname" - filename prefix)
+-- latexmk = "false"  (or "true" to use latexmk to build PDFs)
+-- shellescape = "false"
+-- printindexcmd = "makeindex -s lwarp.ist <name>.idx"
+-- HTMLindexcmd = "makeindex -s lwarp.ist <name>_html.idx"
+-- latexmkindexcmd = "makeindex -s lwarp.ist"
+-- -- indexprog = "makeindex" or "xindy"
+-- -- makeindexstyle = "lwarp.ist" (or a custom file based on lwarp.ist)
+-- -- xindylanguge = "english"  (use a language supported by xindy)
+-- -- xindycodepage = "utf8"  (use a codepage supported by xindy)
+-- -- xindystyle = "lwarp.xdy" (or a custom file based on lwarp.xdy)
+-- glossarycmd = "makeglossaries"
+-- pdftotextenc = "UTF-8"  (use an encoding supported by pdftotext)
+-- --
+-- Filenames must contain only letters, numbers, underscore, or dash.
+-- Values must be in upright "quotes".
 --
--- Print the format of the configuration file lwarpmk.conf:
---
-print ( [[
-An example lwarpmk.conf or <project>.lwarpmkconf project file:
---
-opsystem = "Unix"   (or "Windows")
-latexname = "pdflatex"  (or "lualatex", or "xelatex")
-sourcename = "projectname"  (the source-code filename w/o .tex)
-homehtmlfilename = "index"  (or perhaps the project name)
-htmlfilename = ""  (or "projectname" - filename prefix)
-latexmk = "false"  (or "true" to use latexmk to build PDFs)
-shellescape = "false"
-xindylanguge = "english"  (use a language supported by xindy)
-xindycodepage = "utf8"  (use a codepage supported by xindy)
-xindystyle = "lwarp.xdy" (or a custom file based on lwarp.xdy)
-pdftotextenc = "UTF-8"  (use an encoding supported by pdftotext)
---
-Filenames must contain only letters, numbers, underscore, or dash.
-Values must be in upright "quotes".
+-- ]] ) ;
+-- end
 
-]] ) ;
-end
-
 function splitfile (destfile,sourcefile)
 --
 -- Split one large sourcefile into a number of files,
@@ -97,7 +103,7 @@
         "\" in lwarpmk.conf.\n"
     ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
     os.exit(1) ;
 end
 
@@ -107,16 +113,31 @@
 --
 -- Default configuration filename:
 local conffile = "lwarpmk.conf"
+local confroot = "lwarpmk"
+-- Global argument index
+argindex = 2
 -- Optional configuration filename:
-if ( arg[2] ~= nil ) then conffile = arg[2]..".lwarpmkconf" end
+if ( arg[argindex] == "-p" ) then
+    argindex = argindex + 1
+    confroot = arg[argindex]
+    conffile = confroot..".lwarpmkconf"
+    argindex = argindex + 1
+end
 -- Additional defaults:
 opsystem = "Unix"
 latexmk = "false"
 shellescape = "false"
-xindylanguage = "english"
-xindycodepage = "utf8"
-xindystyle = "lwarp.xdy"
-pdftotextenc = "UTF-8"
+printindexcmd = ""
+HTMLindexcmd = ""
+latexmkindexcmd = ""
+-- to be removed:
+-- indexprog = "makeindex"
+-- makeindexstyle = "lwarp.ist"
+-- xindylanguage = "english"
+-- xindycodepage = "utf8"
+-- xindystyle = "lwarp.xdy"
+-- pdftotextenc = "UTF-8"
+glossarycmd = "makeglossaries"
 -- Verify the file exists:
 if (lfs.attributes(conffile,"mode")==nil) then
     -- file not exists
@@ -125,9 +146,9 @@
     print ("lwarpmk: Move to the project's source directory,")
     print ("lwarpmk: recompile using pdflatex, xelatex, or lualatex,")
     print ("lwarpmk: then try using lwarpmk again.")
-    if ( arg[2] ~= nil ) then
+    if ( arg[argindex] ~= nil ) then
         print (
-            "lwarpmk: (\"" .. arg[2] ..
+            "lwarpmk: (\"" .. confroot ..
             "\" does not appear to be a project name.)"
         )
     end
@@ -142,7 +163,7 @@
 local linenum = 0
 for line in cfile:lines() do -- scan lines
 linenum = linenum + 1
-i,j,cvarname,cvalue = string.find (line,"([%w-_]*)%s*=%s*\"([%w%-_%.]*)\"") ;
+i,j,cvarname,cvalue = string.find (line,"([%w-_]*)%s*=%s*\"([^\"]*)\"") ;
 -- Error if incorrect enclosing characters:
 if ( i == nil ) then
     print ("lwarpmk: ===")
@@ -149,7 +170,7 @@
     print ("lwarpmk: " ..  linenum .. " : " .. line ) ;
     print ("lwarpmk: Incorrect entry in " .. conffile ..".\n" ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
     os.exit(1) ;
 end -- nil
 if ( cvarname == "opsystem" ) then
@@ -175,9 +196,25 @@
 elseif ( cvarname == "htmlfilename" ) then htmlfilename = cvalue
 elseif ( cvarname == "latexmk" ) then latexmk = cvalue
 elseif ( cvarname == "shellescape" ) then shellescape = cvalue
-elseif ( cvarname == "xindylanguage" ) then xindylanguage = cvalue
-elseif ( cvarname == "xindycodepage" ) then xindycodepage = cvalue
-elseif ( cvarname == "xindystyle" ) then xindystyle = cvalue
+elseif ( cvarname == "printindexcmd" ) then printindexcmd = cvalue
+elseif ( cvarname == "HTMLindexcmd" ) then HTMLindexcmd = cvalue
+elseif ( cvarname == "latexmkindexcmd" ) then latexmkindexcmd = cvalue
+elseif ( cvarname == "glossarycmd" ) then glossarycmd = cvalue
+-- to be removed:
+-- elseif ( cvarname == "indexprog" ) then
+--     -- Verify choice of indexing program:
+--     if (
+--         (cvalue == "makeindex") or
+--         (cvalue == "xindy")
+--     ) then
+--         indexprog = cvalue
+--     else
+--         cvalueerror ( line, linenum , cvalue )
+--     end
+-- elseif ( cvarname == "makeindexstyle" ) then makeindexstyle = cvalue
+-- elseif ( cvarname == "xindylanguage" ) then xindylanguage = cvalue
+-- elseif ( cvarname == "xindycodepage" ) then xindycodepage = cvalue
+-- elseif ( cvarname == "xindystyle" ) then xindystyle = cvalue
 elseif ( cvarname == "pdftotextenc" ) then pdftotextenc = cvalue
 else
     print ("lwarpmk: ===")
@@ -187,7 +224,7 @@
         conffile ..".\n"
     ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
 os.exit(1) ;
 end -- cvarname
 end -- do scan lines
@@ -235,15 +272,6 @@
 else print ( "lwarpmk: Select Unix or Windows for opsystem" )
 end --- for Windows
 
--- set xindycmd, glossarycmd according to pdflatex vs xelatex/lualatex:
-if ( latexname == "pdflatex" ) then
-    xindycmd = "texindy  "
-    glossarycmd = "xindy  "
-else
-    xindycmd = "xindy  -M texindy  "
-    glossarycmd = "xindy "
-end
-
 end -- loadconf
 
 function executecheckerror ( executecommands , errormessage )
@@ -348,8 +376,8 @@
     sourcename ..".toc " .. sourcename .. "_html.toc " ..
     sourcename ..".lof " .. sourcename .. "_html.lof " ..
     sourcename ..".lot " .. sourcename .. "_html.lot " ..
-    sourcename ..".idx " .. sourcename .. "_html.idx " ..
-    sourcename ..".ind " .. sourcename .. "_html.ind " ..
+    " *.idx " ..
+    " *.ind " ..
     sourcename ..".log " .. sourcename .. "_html.log " ..
     sourcename ..".gl* " .. sourcename .. "_html.gl* " ..
     " *_html_inc.* "
@@ -594,10 +622,8 @@
     .. "-e "
     .. opquote
     .. "$makeindex = q/" -- $
-    .. xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -C " .. xindycodepage
-    .. "  -L " .. xindylanguage .. " /"
+    .. latexmkindexcmd
+    .. " /"
     .. opquote
     .. " -pdflatex=\"" .. latexname .. thisshellescape .." %O %S\" "
     .. sourcename..fsuffix ..".tex"
@@ -609,10 +635,10 @@
 function convertpdftosvg ()
 --
 -- Converts PDF files to SVG files.
--- The filenames are arg[2] and up.
+-- The filenames are arg[argindex] and up.
 -- arg[1] is the command "pdftosvg".
 --
-for i = 2 , #arg do
+for i = argindex , #arg do
     if (lfs.attributes(arg[i],"mode")==nil) then
         print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.")
     else
@@ -622,6 +648,14 @@
 end -- do
 end --function
 
+-- Force an update and conclude processing:
+function updateanddone ()
+print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
+refreshdate ()
+print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
+print ("lwarpmk: Done.")
+end -- function
+
 -- Start of the main code: --
 
 -- lwarpmk --version :
@@ -668,25 +702,17 @@
     onetime("")
     print ("lwarpmk: Done.") ;
 
--- lwarp printindex:
+-- lwarpmk printindex:
 -- Compile the index then touch the source
 -- to trigger a recompile of the document:
 
 elseif arg[1] == "printindex" then
 loadconf ()
-print ("lwarpmk: Processing the index.")
-os.execute(
-    xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -C " .. xindycodepage
-    .. "  -L " .. xindylanguage
-    .. " " .. sourcename .. ".idx")
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute ( printindexcmd )
+print ("lwarpmk: -------")
+updateanddone ()
 
--- lwarp printglossary:
+-- lwarpmk printglossary:
 -- Compile the glossary then touch the source
 -- to trigger a recompile of the document:
 
@@ -694,16 +720,8 @@
 loadconf ()
 print ("lwarpmk: Processing the glossary.")
 
-os.execute(glossarycmd ..
-    "  -L " .. xindylanguage ..
-    "  -C " .. xindycodepage ..
-    "  -I xindy -M " .. sourcename ..
-    " -t " .. sourcename .. ".glg -o " .. sourcename .. ".gls "
-    .. sourcename .. ".glo")
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute(glossarycmd .. " " .. sourcename)
+updateanddone ()
 
 -- lwarpmk html:
 
@@ -752,39 +770,21 @@
 
 elseif arg[1] == "htmlindex" then
 loadconf ()
-print ("lwarpmk: Processing the index.")
-os.execute(
-    xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -L " .. xindylanguage
-    .. "  -C " .. xindycodepage
-    .. " " .. sourcename .. "_html.idx"
-)
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute ( HTMLindexcmd )
+print ("lwarpmk: -------")
+updateanddone ()
 
 -- lwarpmk htmlglossary:
 -- Compile the glossary then touch the source
--- to trigger a recompile of the document:
+-- to trigger a recompile of the document.
+-- The <sourcename>.xdy file is created by the glossaries package.
 
 elseif arg[1] == "htmlglossary" then
 loadconf ()
 print ("lwarpmk: Processing the glossary.")
+os.execute(glossarycmd .. " " .. sourcename .. "_html")
+updateanddone ()
 
-os.execute(glossarycmd ..
-    "  -L " .. xindylanguage ..
-    "  -C " .. xindycodepage ..
-    "  -I xindy -M " ..sourcename ..
-    "_html -t " .. sourcename .. "_html.glg -o " ..sourcename ..
-    "_html.gls " ..sourcename .. "_html.glo")
-
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
-
 -- lwarpmk limages:
 -- Scan the lateximages.txt file to create lateximages.
 
@@ -799,13 +799,10 @@
 
 elseif arg[1] == "again" then
 loadconf ()
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+updateanddone ()
 
 -- lwarpmk clean:
--- Remove project.aux, .toc, .lof, .lot, .idx, .ind, .log, *_html_inc.*, .gl*
+-- Remove project.aux, .toc, .lof, .lot, .log, *.idx, *.ind, *_html_inc.*, .gl*
 
 elseif arg[1] == "clean" then
 loadconf ()
@@ -813,7 +810,7 @@
 print ("lwarpmk: Done.")
 
 -- lwarpmk cleanall
--- Remove project.aux, .toc, .lof, .lot, .idx, .ind, .log, *_html_inc.*, .gl*
+-- Remove project.aux, .toc, .lof, .lot, .log, *.idx, *.ind, *_html_inc.*, .gl*
 --    and also project.pdf, *.html
 
 elseif arg[1] == "cleanall" then

Modified: trunk/Master/texmf-dist/source/latex/lwarp/lwarp.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/lwarp/lwarp.dtx	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/source/latex/lwarp/lwarp.dtx	2018-07-07 20:46:58 UTC (rev 48159)
@@ -16,7 +16,7 @@
 % \iffalse
 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
 %<package>\ProvidesPackage{lwarp}
-%<package>    [2018/06/06 v0.57  Allows LaTeX to directly produce HTML5 output.]
+%<package>    [2018/07/07 v0.58  Allows LaTeX to directly produce HTML5 output.]
 %
 %<*driver>
 \documentclass{ltxdoc}
@@ -310,7 +310,7 @@
 \newcommand*{\rulebreak}{\bigskip\hfill\rule[.7ex]{.3\linewidth}{.4pt}\hspace*{\fill}\bigskip\@afterheading}
 \makeatother
 
-\newcommand{\DescribeDefault}[1]{\margintag{\footnotesize \textcolor{green!50!black}{Default: \texttt{#1}}}}
+\newcommand{\DescribeDefault}[1]{\margintag{\footnotesize \textgreen{Default: \texttt{#1}}}}
 
 \newcommand{\goesto}{$\Rightarrow$}
 
@@ -322,9 +322,17 @@
 
 \newcommand*{\testthis}{\textcolor{blue}{Please send bug reports!}\watchout[Not fully tested!]}
 
+\newcommand*{\fquad}{\hspace*{1em}}
+\newcommand*{\fqquad}{\hspace*{2em}}
+\newcommand*{\fqqquad}{\hspace*{3em}}
+
+\newcommand{\textred}[1]{\textcolor{red}{#1}}
+\newcommand{\textgreen}[1]{\textcolor{green!50!black}{#1}}
+\newcommand{\textblue}[1]{\textcolor{blue!70!black}{#1}}
+
 \newcommand{\userentry}[1]{%
 \par
-\hspace*{2em}\begin{minipage}{\linewidth-2em}
+\fqquad\begin{minipage}{\linewidth-2em}
 {\footnotesize Enter~$\Rightarrow$}\quad\texttt{#1}
 \end{minipage}
 \par
@@ -334,10 +342,10 @@
 {
 \leavevmode
 \par
-\hspace*{2em}\minipage{\linewidth-2em}
+\fqquad\minipage{\linewidth-2em}
 \ttfamily
 }
-{
+{%
 \endminipage
 \par
 }
@@ -346,7 +354,7 @@
 {
 \leavevmode
 \par
-\hspace*{2em}\minipage{\linewidth-2em}
+\fqquad\minipage{\linewidth-2em}
 \sffamily
 }
 {
@@ -365,8 +373,8 @@
 {\smallskip\hrule\endminipage\hspace*{\fill}\bigskip}
 
 \newcommand{\pdflatexonly}{
-\textcolor{red}{Only pre-loaded if \prog{pdflatex} is being used.}
-\marginpar{\raggedleft\textcolor{blue!70!black}{\prog{pdflatex} only:}}
+\textred{Only pre-loaded if \prog{pdflatex} is being used.}
+\marginpar{\raggedleft\textblue{\prog{pdflatex} only:}}
 }
 
 % From package dtxdescribe:
@@ -383,7 +391,7 @@
 % \makeatother
 
 % \newcommand{\margintag}[1]{%
-% \marginpar{\raggedleft\textcolor{blue!70!black}{#1}}%
+% \marginpar{\raggedleft\textblue{#1}}%
 % }
 
 
@@ -481,8 +489,8 @@
     \cs{cpageref}\{tab:first,tab:second\} \\
     \hspace*{-2em} in \HTML\ becomes:\\
     \rmfamily
-    ``pages \textbf{for} table \textcolor{red}{4.1} and
-    \textbf{for} table \textcolor{red}{4.2}''
+    ``pages \textbf{for} table \textred{4.1} and
+    \textbf{for} table \textred{4.2}''
 \end{sourcedisplay}
 See \cs{cpagerefFor} at \cpageref{sec:cpagereffor}
 to redefine the message which is printed for page number references.
@@ -542,15 +550,15 @@
 \DescribeOption{xindyLanguage}
 \DescribeDefault{english}
 \optn{xindyLanguage} sets the language used by \prog{xindy}.
-This is passed to \prog{xindy} using its \optn{-L} option, and is
-used for both index and glossary generation.
+This is passed to \prog{xindy} using its \optn{-L} option
+when using \cmds{lwarpmk printindex} and \cmds{lwarpmk htmlindex}.
 
 The option
 \DescribeOption{xindyCodepage}
 \DescribeDefault{utf8}
 \optn{xindycodepage} sets the codepage used by \prog{xindy}.
-This is passed to \prog{xindy} using its \optn{-C} option, and is
-used for both index and glossary generation.
+This is passed to \prog{xindy} using its \optn{-C} option
+when using \cmds{lwarpmk printindex} and \cmds{lwarpmk htmlindex}.
 }
 
 \newcommand{\limitspdftotextenc}{%
@@ -578,15 +586,36 @@
 }
 
 \newcommand{\limitsglossaries}{%
-\prog{xindy} is required for \pkg{glossaries}.
+\margintag{processing glossaries}
+\DescribeOption{GlossaryCmd}\DescribeDefault{makeglossaries}
+\DescribeOption[lwarpmk]{printglossary}
+\DescribeOption[lwarpmk]{htmlglossary}
+\prog{lwarpmk} has the commands \texttt{lwarpmk printglossary} and
+\texttt{lwarpmk htmlglossary}, which process the glossaries created by the
+\pkg{glossaries} package using that package's \cmds{makeglossaries} command.
 
-The default \optn{style=item} option for \pkg{glossaries} conflicts
-with \pkg{lwarp}, so the style is forced to \texttt{index} instead.
+The shell command to execute is set by the \pkg{lwarp} option \optn{GlossaryCmd},
+which defaults to \cmds{makeglossaries}.
+The print or \HTML\ glossary filename is appended to this command.
 
-The page number list in the printed form would become \cs{nameref}s in \HTML,
-which could become a very long string if many items are referenced.
-For now, the number list is simply turned off.
+In some situations it may be required to modify the default command,
+\watchout[\cmds{makeglossaries} not found]
+such as to add the \cmds{perl} command in front:
+\begin{sourcedisplay}
+\cs{usepackage}[ \\
+\fquad\ GlossaryCmd=\{\textred{perl} makeglossaries\}, \\
+] \{lwarp\}
+\end{sourcedisplay}
 
+To set the language to use for processing glossaries with \prog{xindy}:
+\margintag{\prog{xindy} language}
+\begin{sourcedisplay}
+\cs{usepackage}[ \\
+\fquad\ GlossaryCmd=\{makeglossaries \textred{-L english}\}, \\
+] \{lwarp\}
+\end{sourcedisplay}
+Other options for \cmds{makeglossaries} may be set as well.
+
 The glossaries may be placed in a numbered or unnumbered section, given
 \margintag{placement and \acro{TOC} options}
 a \acro{TOC} entry, and placed inline or on their own \HTML\ page:
@@ -615,29 +644,33 @@
     \end{sourcedisplay}
 \end{description}
 
-\limitsxindylanguage
+The default \optn{style=item} option for \pkg{glossaries} conflicts
+\watchout[glossary style]
+with \pkg{lwarp}, so the style is forced to \texttt{index} instead.
 
-\DescribeOption[lwarpmk]{printglossary}
-\DescribeOption[lwarpmk]{htmlglossary}
-\prog{lwarpmk} has the commands \texttt{lwarpmk printglossary} and
-\texttt{lwarpmk htmlglossary} to process the glossaries created by
-\pkg{glossaries} using \prog{xindy}.
+The page number list in the printed form would become \cs{nameref}s in \HTML,
+\watchout[number list]
+which could become a very long string if many items are referenced.
+For now, the number list is simply turned off.
+
+The print and \HTML\ versions of the glossary differ
+\margintag{print/\HTML\ versions}
+in their internal page numbers.
+Separate commands for generating print and \HTML\ glossaries are used, even
+though the page number is currently ignored.
 }
 
 
-\newcommand*{\limitsindex}{%
-
-\limitsxindylanguage
-
-\limitstocloft
-
+\newcommand{\limitstocbibind}{%
 An index may be placed inline with other \HTML\ text, or on its own \HTML\ page:
-\DescribePackage{makeidx}
 \margintag{placement and \acro{TOC} options}
+\index{index>placement and \acro{TOC} options}
+\index{index>table of contents}
 
 \begin{description}
 
 \item [Inline, with a manual TOC entry:] \
+\DescribePackage{makeidx}
 
     A commonly-used method to introduce an index in a \LaTeX\ document:
     \begin{sourcedisplay}
@@ -649,6 +682,7 @@
 
 \needspace{3\baselineskip}
 \item [On its own \HTML\ page, with a manual TOC entry:] \
+\DescribePackage{makeidx}
     \begin{sourcedisplay}
     \cs{begin}\{warpprint\} \\
     \cs{cleardoublepage} \\
@@ -661,9 +695,9 @@
     \end{sourcedisplay}
 
 \item [Inline, with an automatic TOC entry:] \
+    \DescribePackage{tocbibind}
 
     The \pkg{tocbibind}
-    \DescribePackage{tocbibind}
     package may be used to automatically place an entry in the \acro{TOC}.
     \begin{sourcedisplay}
     \cs{usepackage}[nottoc]\{tocbibind\} \\
@@ -673,7 +707,8 @@
     \cs{printindex}
     \end{sourcedisplay}
 
-\item [On its own \HTML\ page, with an automatic TOC entry:]
+\item [On its own \HTML\ page, with an automatic TOC entry:] \
+    \DescribePackage{tocbibind}
     \begin{sourcedisplay}
     \cs{usepackage}[nottoc]\{tocbibind\} \\
     \dots \\
@@ -688,8 +723,49 @@
 \DescribeOption[tocbibind]{numindex}
 Without this option, the index heading has no number.
 \margintag{numbered index section}
+
+Other packages, such as \pkg{imakeidx}, may also have options for including
+the index in the Table of Contents.
 }
 
+\newcommand*{\limitssplitidx}{%
+If the \optn{latexmk} option is selected for \pkg{lwarp},
+\prog{latexmk} will compile the document but will \emph{not} compile the indexes.
+\cmds{lwarpmk printindex} and \cmds{lwarpmk htmlindex} will still be required.
+
+When using \cs{AtWriteToIndex} or \cs{AtNextWriteToIndex}, the user must not
+\watchout[\cs{thepage}]
+refer to \cs{thepage} during \HTML\ output, as the concept of a page number is
+meaningless.  Instead, do
+\begin{sourcedisplay}
+    \cs{addtocounter}\{LWR at autoindex\}\{1\} \\
+    \cs{LWR at new@label}\{LWRindex-\cs{arabic}\{LWR at autoindex\}\} \\
+\end{sourcedisplay}
+where the \cs{index}-like action occurs,
+and then refer to \texttt{\cs{arabic}\{LWR at autoindex\}} instead of \cs{thepage}
+where the reference should occur.
+
+See \cref{sec:specialindex} in the \pkg{lwarp-patch-memoir} package
+for the \cs{@@wrspindexhyp} macro as an example.
+}
+
+\newcommand{\limitsimakeidx}{%
+When using \prog{makeindex}, to match the print and \HTML\ output's
+\margintag{letter headings}
+\index{index>letter headings}
+display of index letter headings, specify the \filenm{lwarp.ist} style:
+\begin{sourcedisplay}
+\cs{makeindex}[options=\{-s lwarp.ist\}]
+\end{sourcedisplay}
+(For \HTML\ the \filenm{lwarp.ist} style is used automatically,
+which displays letter headings.
+When using \prog{xindy} the default style also displays letter headings.)
+
+See \cref{sec:indexingimakeidx} for how to setup \prog{lwarpmk}
+\margintag{index setup}
+to process the indexes with \pkg{imakeidx}, both with and without shell escape.
+}
+
 \newcommand{\limitstocloft}{%
 If using \pkg{tocloft} with \pkg{tocbibind}, \pkg{anonchap},
 \DescribePackage{tocloft}
@@ -819,15 +895,15 @@
 the \pkg{footmisc} package with the \optn{stable} option,
 provide a short \TOC\ entry, and \cs{protect} the \cs{footnote}:
 \begin{sourcedisplay}
-\cs{usepackage}[\textcolor{red}{stable}]\{footmisc\}\\
+\cs{usepackage}[\textred{stable}]\{footmisc\}\\
 \dots\\
-\cs{subsection}\textcolor{red}{[Subsection Name]}\\
-\hspace*{2em}\{Subsection Name\textcolor{red}{\cs{protect}}\cs{footnote}\{A footnote.\}\}
+\cs{subsection}\textred{[Subsection Name]}\\
+\fqquad\{Subsection Name\textred{\cs{protect}}\cs{footnote}\{A footnote.\}\}
 \end{sourcedisplay}
 If using \pkg{memoir} class, with which \pkg{lwarp} preloads \pkg{footmisc}, the
 \optn{stable} option must be declared before \pkg{lwarp} is loaded:
 \begin{sourcedisplay}
-\cs{PassOptionsToPackage}\{\textcolor{red}{stable}\}\{footmisc\} \\
+\cs{PassOptionsToPackage}\{\textred{stable}\}\{footmisc\} \\
 \cs{usepackage}\{lwarp\} \\
 \dots
 \end{sourcedisplay}
@@ -846,8 +922,8 @@
 use \cs{footnotemark} and \cs{footnotetext}:
 \begin{sourcedisplay}
 \cs{subsection}[Subsection Name]\\
-\hspace*{2em}\{Subsection Name\cs{protect}\textcolor{red}{\cs{footnotemark}}\} \\
-\textcolor{red}{\cs{footnotetext}}\{A footnote with \cs{verb}+verbtim+.\} \\
+\fqquad\{Subsection Name\cs{protect}\textred{\cs{footnotemark}}\} \\
+\textred{\cs{footnotetext}}\{A footnote with \cs{verb}+verbtim+.\} \\
 \end{sourcedisplay}
 and likewise for equations or display math.
 
@@ -959,13 +1035,13 @@
 by setting \cs{LateximageFontSizeName} to a font size name --- \emph{without the backslash},
 which defaults to:
 \begin{sourcedisplay}
-\cs{renewcommand}\{\cs{LateximageFontSizeName}\}\{\textcolor{red}{normalsize}\}
+\cs{renewcommand}\{\cs{LateximageFontSizeName}\}\{\textred{normalsize}\}
 \end{sourcedisplay}
 
 For inline \SVG\ math, font size is instead controlled by \cs{LateximageFontScale},
 which defaults to:
 \begin{sourcedisplay}
-\cs{newcommand}*\{\cs{LateximageFontScale}\}\{\textcolor{red}{.75}\}
+\cs{newcommand}*\{\cs{LateximageFontScale}\}\{\textred{.75}\}
 \end{sourcedisplay}
 }
 
@@ -1002,8 +1078,8 @@
 Examples:
 \begin{sourcedisplay}
 \cs{CustomizeMathJax}\{ \\
-    \hspace*{2em}\cs{newcommand}\{\cs{expval}\}[1]\{\cs{langle}\#1\cs{rangle}\} \\
-    \hspace*{2em}\cs{newcommand}\{\cs{abs}\}[1]\{\cs{lvert}\#1\cs{rvert}\} \\
+    \fqquad\cs{newcommand}\{\cs{expval}\}[1]\{\cs{langle}\#1\cs{rangle}\} \\
+    \fqquad\cs{newcommand}\{\cs{abs}\}[1]\{\cs{lvert}\#1\cs{rvert}\} \\
 \} \\
 \cs{CustomizeMathJax}\{\cs{newcommand}\{\cs{arsinh}\}\{\cs{text}\{arsinh\}\}\} \\
 \cs{CustomizeMathJax}\{\cs{newcommand}\{\cs{arcosh}\}\{\cs{text}\{arcosh\}\}\}
@@ -1114,7 +1190,7 @@
 
     \href{https://groups.google.com/forum/\#!topic/mathjax-users/jUtewUcE2bY}
         {\texttt{https://groups.google.com/forum/\#!topic/\\
-            \hspace*{2em}mathjax-users/jUtewUcE2bY}}
+            \fqquad\ mathjax-users/jUtewUcE2bY}}
 
 \item \brand{MathJax} itself does not support subequations.
     \margintag{subequations}
@@ -1159,9 +1235,9 @@
 must be enclosed between \cs{StartDefiningMath} and \cs{StopDefiningMath}
 to temporarily change to the \HTML\ meaning of \texttt{\$}:
 \begin{sourcedisplay}
-\textcolor{red}{\cs{StartDefiningMath}} \\
+\textred{\cs{StartDefiningMath}} \\
 \cs{newcommand}\{\dots\} \\
-\textcolor{red}{\cs{StopDefiningMath}}
+\textred{\cs{StopDefiningMath}}
 \end{sourcedisplay}
 
 As an alternative, use \cs{(} and \cs{)} instead of \texttt{\$}, in which
@@ -1230,7 +1306,7 @@
 \watchout[\texttt{.pdf} image files]
 the user should provide a \texttt{.pdf} image file, and also
 a \texttt{.svg}, \texttt{.png}, or \texttt{.jpg} version of the same image.
-\textcolor{red}{These should be referred to without a file extension:}
+\textred{These should be referred to without a file extension:}
 \watchout[no file extension]
 \begin{sourcedisplay}
 \cs{includegraphics}\{filename\}    \% print:.pdf,  HTML:.svg or other
@@ -1459,9 +1535,9 @@
         then restore \texttt{\&} to its default catcode after, using the following commands.
         These are are ignored in print mode.
         \begin{sourcedisplay}
-        \textcolor{red}{\cs{StartDefiningTabulars}} \\
+        \textred{\cs{StartDefiningTabulars}} \\
         <define macros or environments using \env{tabular} and \texttt{\&} here> \\
-        \textcolor{red}{\cs{StopDefiningTabulars}}
+        \textred{\cs{StopDefiningTabulars}}
         \end{sourcedisplay}
         This includes before and after defining any macro
         \watchout[floatrow]
@@ -1482,7 +1558,7 @@
         \small
         \begin{tabular}{lll}
         \dots\ \& & \cs{multirow}\{2\}\{.5in\}\{text\} & \&\ \dots \\
-        \dots\ \& & \textcolor{red}{\cs{mrowcell}} & \&\ \dots \\
+        \dots\ \& & \textred{\cs{mrowcell}} & \&\ \dots \\
         \end{tabular}
         \end{sourcedisplay}
         Note that recent versions of \pkg{multirow} include a new optional
@@ -1505,7 +1581,7 @@
         To avoid this, use \cs{TabularMacro} just before the macro.
         This is ignored in print mode.
         \begin{sourcedisplay}
-        \textcolor{red}{\cs{TabularMacro}}\cs{somemacro} \&
+        \textred{\cs{TabularMacro}}\cs{somemacro} \&
             more row contents \textbackslash\textbackslash
         \end{sourcedisplay}
     \end {itemize}
@@ -1573,7 +1649,7 @@
         \end{sourcedisplay}
         to
         \begin{sourcedisplay}
-        \textcolor{red}{\cs{warpprintonly}\{}This \& That \cs{endhead}\textcolor{red}{\}}
+        \textred{\cs{warpprintonly}\{}This \& That \cs{endhead}\textred{\}}
         \end{sourcedisplay}
         and likewise with the other \cs{end} headings.
         Keep the \cs{endfirsthead} row unchanged, as it is still relevent to \HTML\ output.
@@ -1601,7 +1677,7 @@
         To resolve this problem, make a copy of the row, with one version
         for print output, containing the extra braces, and another version
         for \HTML\ output, without the extra braces, such as: \\
-        \hspace*{.375in} \cs{warpprintonly}\{\texttt{1 \& 2 \& \textcolor{red}{\{}\cs{multirow}\{2\}\{2cm\}\{Text\}\textcolor{red}{\}} \& 3 \textbackslash\textbackslash\}} \\
+        \hspace*{.375in} \cs{warpprintonly}\{\texttt{1 \& 2 \& \textred{\{}\cs{multirow}\{2\}\{2cm\}\{Text\}\textred{\}} \& 3 \textbackslash\textbackslash\}} \\
         \hspace*{.375in} \cs{warpHTMLonly}\{\texttt{1 \& 2 \& \cs{multirow}\{2\}\{2cm\}\{Text\} \& 3 \textbackslash\textbackslash\}}
     \end{itemize}
 \end{description}
@@ -1616,7 +1692,7 @@
 \begin{sourcedisplay}
 \cs{multicolumnrow}%
   \textcolor{blue}{\{2\}\{c\}}%
-  \textcolor{green!50!black}{[c]\{3\}[0]\{1in\}[0pt]}\{Text\}
+  \textgreen{[c]\{3\}[0]\{1in\}[0pt]}\{Text\}
 \end{sourcedisplay}
 The two arguments for \cs{multicolumn} come first, followed by
 the five arguments for \cs{multirow}, many of which are optional,
@@ -1633,8 +1709,8 @@
 \small
 \begin{tabular}{lll}
 \dots\ \& & \cs{multicolumnrow}\{2\}\{c\}[c]\{3\}[0]\{1in\}[0pt]\{Text\} & \&\ \dots \\
-\dots\ \& & \textcolor{red}{\cs{mcolrowcell}} \hfill \& \hfill \textcolor{red}{\cs{mcolrowcell}} & \&\ \dots \\
-\dots\ \& & \textcolor{red}{\cs{mcolrowcell}} \hfill \& \hfill \textcolor{red}{\cs{mcolrowcell}} & \&\ \dots \\
+\dots\ \& & \textred{\cs{mcolrowcell}} \hfill \& \hfill \textred{\cs{mcolrowcell}} & \&\ \dots \\
+\dots\ \& & \textred{\cs{mcolrowcell}} \hfill \& \hfill \textred{\cs{mcolrowcell}} & \&\ \dots \\
 \end{tabular}
 \end{sourcedisplay}
 
@@ -1652,7 +1728,7 @@
 To fix this, use \cs{ResumeTabular} as follows.
 This is ignored in print mode.
 \begin{sourcedisplay}
-\textcolor{red}{\cs{StartDefiningTabulars}} \% because \& is used in a definition \\
+\textred{\cs{StartDefiningTabulars}} \% because \& is used in a definition \\
 \cs{newenvironment}\{outerenvironment\} \\
 \{ \\
 \cs{tabular}\{cc\} \\
@@ -1659,11 +1735,11 @@
 left \& right \textbackslash\textbackslash \\
 \} \\
 \{ \\
-\textcolor{red}{\cs{TabularMacro}\cs{ResumeTabular}} \\
+\textred{\cs{TabularMacro}\cs{ResumeTabular}} \\
 left \& right \textbackslash\textbackslash \\
 \cs{endtabular} \\
 \} \\
-\textcolor{red}{\cs{StopDefiningTabulars}} \\
+\textred{\cs{StopDefiningTabulars}} \\
 \end{sourcedisplay}
 }
 
@@ -1697,10 +1773,10 @@
 For \cs{tablefirsthead}, etc., enclose them as follows:
 \watchout[misplaced alignment alignment tab character \&]
 \begin{sourcedisplay}
-\textcolor{red}{\cs{StartDefiningTabulars}} \\
+\textred{\cs{StartDefiningTabulars}} \\
 \cs{tablefirsthead} \\
 \dots \\
-\textcolor{red}{\cs{StopDefiningTabulars}}
+\textred{\cs{StopDefiningTabulars}}
 \end{sourcedisplay}
 See \cref{sec:limitstabular}.
 
@@ -1717,17 +1793,17 @@
 \begin{sourcedisplay}
 \hrule\smallskip
 \cs{begin}\{tabular\}\{lll\} \\
-\textcolor{green!50!black}{<empty>} \& a \& b \textbackslash\textbackslash \\
+\textgreen{<empty>} \& a \& b \textbackslash\textbackslash \\
 \cs{ldelim}\{\textbackslash\{\}\{2\}\{.25in\}[left ] \& c \& d \textbackslash\textbackslash \\
-\textcolor{red}{\cs{mrowcell}} \& e \& f \textbackslash\textbackslash \\
-\textcolor{green!50!black}{<empty>} \& g \& h \textbackslash\textbackslash \\
+\textred{\cs{mrowcell}} \& e \& f \textbackslash\textbackslash \\
+\textgreen{<empty>} \& g \& h \textbackslash\textbackslash \\
 \cs{end}\{tabular\}
 \smallskip\hrule
 \begin{tabular}{lll}
-\textcolor{green!50!black}{<>} & a & b \\
+\textgreen{<>} & a & b \\
 \ldelim{\{}{2}{.25in}[left ] & c & d \\
 \mrowcell & e & f \\
-\textcolor{green!50!black}{<>} & g & h \\
+\textgreen{<>} & g & h \\
 \end{tabular}
 \hrule
 \end{sourcedisplay}
@@ -2034,7 +2110,7 @@
 Some units will require that the expression be placed inside math mode.
 \watchout[math mode required]
 
-\textcolor{red}{NOTE: As of this writing, the \pkg{siunitx} extension
+\textred{NOTE: As of this writing, the \pkg{siunitx} extension
 for \brand{MathJax} is not currently hosted at any public CDN,
 thus \pkg{siunitx} is not usable with \brand{MathJax} unless a local copy
 of this extension is created first.}
@@ -2209,7 +2285,6 @@
 \setlength{\marginparpush}{.7ex}
 \setlength{\IndexMin}{40ex}
 
-
 \setcounter{IndexColumns}{2}
 
 \DisableCrossrefs
@@ -2227,7 +2302,7 @@
 %<*package>
 % \fi
 %
-% \CheckSum{24592}
+% \CheckSum{25214}
 %
 % \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
@@ -2326,6 +2401,8 @@
 % \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}
+% \changes{v0.58}{2018/07/07}{\ 2018/07/07}
+% \changes{v0.58}{2018/06/07}{Replaced each \cs{csuse} with \cs{@nameuse} to force error if undefined.}
 
 
 
@@ -2487,12 +2564,12 @@
 % To make a contribution: \hfill
 % \href{https://www.tug.org/donate.html}{\texttt{https://www.tug.org/donate.html}}
 %
+% For users of MiK\TeX: \hfill
+% \href{https://miktex.org/donations.html}{\texttt{https://miktex.org/donations.html}}
+%
 % For country-specific \TeX\ users groups: \hfill
 % \href{http://tug.org/usergroups.html}{\texttt{http://tug.org/usergroups.html}}
 %
-% For users of MiK\TeX: \hfill
-% \href{https://miktex.org/donations.html}{\texttt{https://miktex.org/donations.html}}
-%
 % \endgroup
 %
 % \clearpage
@@ -2523,8 +2600,56 @@
 %
 % \begin{description}
 % \needspace{2\baselineskip}
-% \item[v0.57:] \
+% \item[v0.58:] Extensive improvements in indexing, glossaries.
+%   Adds \PDF-inclusion packages.
 %   \begin{itemize}
+%       \item Due to changes in \prog{lwarpmk} and the configuration files
+%       \watchout[recompile from scratch]
+%       \filenm{lwarpmk.conf} and \filenm{*.lwarpmkconf},
+%       \textred{it is necessary to recompile an existing project a single time}
+%       using \cmds{pdflatex filename.tex}, or similar for \prog{xelatex} or \prog{lualatex}.
+%       After this single recompile, the configuration files will work with the
+%       new version of \prog{lwarpmk}.
+%       \item \prog{lwarpmk}: Added the |-p| option to specify the project name.
+%           \margintag{\prog{lwarpmk}}
+%       \item \prog{lwarpmk}: Now uses \prog{makeglossaries} for glossary generation,
+%           \margintag{\pkg{glossaries}}
+%           allowing the processing of multiple glossaries at once.
+%       \item Added \pkg{lwarp} option \optn{GlossaryCmd}
+%           to specify the shell command used by \cmds{lwarpmk printglossary} and
+%           \cmds{lwarpmk htmlglossary}.  Defaults to \cmds{makeglossaries}.
+%       \item Docs: Extra indexing options.  See \cref{sec:indexingoverview}.
+%           \margintag{index and glossary}
+%       \item Added support for \prog{makeindex}.  (Previously supported only \prog{xindy}.)
+%           Also added indexing packages listed below.
+%       \item Added \pkg{lwarp} options \optn{PrintIndexCmd}, \optn{HTMLIndexCmd},
+%           and \optn{LatexmkIndexCmd}
+%           to specify shell commands used by \cmds{lwarpmk printindex},
+%           \cmds{lwarpmk htmlindex}, and \prog{latexmk}.  May be preset with the
+%           \optn{makeindex} or \optn{xindy} \pkg{lwarp} options. See \cref{sec:loading}.
+%       \item Added \pkg{lwarp} options \optn{makeindex} and \optn{xindy} to
+%           set \optn{PrintIndexCmd}, \optn{HTMLIndexCmd}, and \optn{LatexmkIndexCmd}
+%           to sensible values for a typical single index.  See \cref{sec:loading}.
+%       \item Added \pkg{lwarp} option \optn{makeindexStyle} to tell \prog{lwarpmk} to
+%           use a custom style instead of \filenm{lwarp.ist}.
+%           See \cref{sec:modifymakeindex}.
+%       \item Fix for index entries with \cs{see}, \cs{seealso}, \cs{emph}, \cs{textbf}, etc.
+%       \item Replaced each \cs{csuse} with \cs{@nameuse} for improved error detection.
+%           \margintag{misc. fixes}
+%       \item Additional internal print/\HTML\ macro selection improvements.
+%       \item Fix: \cs{printindex} finishes pending \cs{index} writes first.
+%       \item Fixes for \pkg{memoir}: \pkg{makeidx}, \pkg{ccaption}, multiple indexes, \cs{specialindex}.
+%           \margintag{packages}
+%       \item Fixes for \pkg{komascript}: Indexing improvements.
+%       \item Added \pkg{imakeidx}, \pkg{index}, \pkg{repeatindex}, \pkg{splitidx}.
+%       \item Added  \pkg{attachfile}, \pkg{attachfile2}, \pkg{intopdf},
+%           \pkg{pdfpages}, \pkg{pdfx}.
+%       \item Added \pkg{cases}.
+%       \item Tested to work as-is: \pkg{notes2bib}, \pkg{hvindex}.
+%   \end{itemize}
+% \needspace{2\baselineskip}
+% \item[v0.57:] \pkg{algorithm2e}, \pkg{float} styles, tabular packages, internal improvements.
+%   \begin{itemize}
 %       \item Added support for MathJax equations with \cs{footnote}, \cs{footnotemark}.
 %           \margintag{MathJax}
 %       \item Added \cs{StartDefiningMath} and \cs{StopDefiningMath} for
@@ -2549,7 +2674,7 @@
 %           (-xy- diagram)
 %           \end{sourcedisplay}
 %           See \cref{sec:packagediagramname}.
-%       \item Fix: Restoring various macros in a \env{lateximage} and similar situations.
+%       \item Fix: Improved print/\HTML\ macro selection.
 %       \item Fix: \cs{href} text catcodes.
 %       \margintag{misc. fixes}
 %       \item Fix: \cs{subref} text.
@@ -2563,11 +2688,11 @@
 %       \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},
+%       \item Tested to work as-is with \pkg{gauss}, \pkg{phonrule}, \pkg{piano},
 %           \pkg{SIunits}, \pkg{tikzcodeblocks}.
 %   \end{itemize}
 % \needspace{2\baselineskip}
-% \item[v0.56:] \
+% \item[v0.56:] Shell escape, tabular packages.
 %   \begin{itemize}
 %       \item Added
 %           \margintag{\prog{lwarpmk}}
@@ -2591,11 +2716,11 @@
 %       \item Added \pkg{parnotes}, \pkg{quoting}, \pkg{lua-check-hyphen},
 %           \pkg{tocenter}, \pkg{underscore}.
 %           \margintag{packages}
-%       \item Verified works as-is with \pkg{babelbib}, \pkg{bibunits}, \pkg{bodegraph},
+%       \item Tested to work as-is with \pkg{babelbib}, \pkg{bibunits}, \pkg{bodegraph},
 %           \pkg{fast-diagram}, \pkg{nicematrix}, \pkg{structmech}.
 %   \end{itemize}
 % \needspace{2\baselineskip}
-% \item[v0.55:] \
+% \item[v0.55:] Various fixes.
 %   \begin{itemize}
 %       \item Fix: Extraneous space in file links, which also
 %           \margintag{misc fixes}
@@ -2609,7 +2734,7 @@
 %       \item Added \pkg{clrdblpg}.
 %   \end{itemize}
 % \needspace{2\baselineskip}
-% \item[v0.54:] \
+% \item[v0.54:] Float \cs{centering}, improved image checks.
 %   \begin{itemize}
 %       \item \progcode{lwarpmk limages} checks for the presence of the \HTML\ version
 %           \margintag{\prog{lwarpmk}}
@@ -2646,7 +2771,7 @@
 %           to process documents in an encoding other than UTF-8.
 %           See \cref{sec:fonts}.
 %
-%           \textcolor{red}{For an existing document, \watchout[Reset the configuration]
+%           \textred{For an existing document, \watchout[Reset the configuration]
 %           recompile the print version with \prog{pdflatex}, \prog{xelatex}, or
 %           \prog{lualatex} a single time,
 %           to readjust the \filenm{lwarpmk.conf} configuration file,
@@ -2676,7 +2801,7 @@
 %       \item Prevents loading \pkg{ae}, \pkg{aecc}, \pkg{t1enc}, and \pkg{wasysym}.
 %   \end{itemize}
 % \needspace{2\baselineskip}
-% \item[v0.53:] \
+% \item[v0.53:] Improved image checks.
 %   \begin{itemize}
 %       \item \prog{lwarpmk}: Added a warning about corrupted images due to the
 %           \margintag{\prog{lwarpmk}}
@@ -2686,7 +2811,7 @@
 %           \cmds{lwarpmk pdftohtml}.
 %   \end{itemize}
 % \needspace{2\baselineskip}
-% \item[v0.52:] \
+% \item[v0.52:] Improved footnotes, \SVG\ math.
 %   \begin{itemize}
 %       \item Improved install instructions regarding \filenm{lwarp\_baseline\_marker.png}.
 %           \margintag{documentation}
@@ -2725,7 +2850,7 @@
 %       \item \pkg{url}: Fixes for active characters.
 %   \end{itemize}
 % \needspace{2\baselineskip}
-% \item[v0.51:] \
+% \item[v0.51:] Improved \SVG\ math, added numerous chemistry packages.
 %   \begin{itemize}
 %       \item Docs: Added \nameref{sec:thingstoavoid}.
 %           \margintag{documentation}
@@ -2752,7 +2877,7 @@
 %           \pkg{epstopdf-base}, \pkg{grid}, \pkg{ltxgrid}.
 %   \end{itemize}
 % \needspace{2\baselineskip}
-% \item[v0.50:] \
+% \item[v0.50:] Improved \SVG\ math.
 %   \begin{itemize}
 %       \item \SVG\ math and other \env{lateximage}s now are
 %           converted to \SVG\ using \margintag{\SVG\ math}
@@ -2942,11 +3067,11 @@
 %           boolean |FormatWP| is set |true|.
 %           See \cref{sec:wordprocessorconversion}.
 %           \begin{itemize}
-%           \item \textcolor{red}{The} \watchout[name change]
-%               \textcolor{red}{boolean |FormatWordProcessor| has
+%           \item \textred{The} \watchout[name change]
+%               \textred{boolean |FormatWordProcessor| has
 %               been renamed |FormatWP|.}
-%           \item \textcolor{red}{The} \watchout[name change]
-%               \textcolor{red}{boolean |HTMLMarkFloats| has
+%           \item \textred{The} \watchout[name change]
+%               \textred{boolean |HTMLMarkFloats| has
 %               been renamed |WPMarkFloats|.}
 %           \item New booleans control whether to place additional
 %               marks around minipages, at the table of contents,
@@ -2979,7 +3104,7 @@
 %       \item Improved \pkg{booktabs}: Width and trim are honored.
 %       \item Added \cs{mcolrowcell} for empty cells inside a \cs{multicolumnrow}.
 %           \watchout[new syntax]
-%           \textcolor{red}{Use \cs{mcolrowcell} instead of \cs{mrowcell} for two-dimensional
+%           \textred{Use \cs{mcolrowcell} instead of \cs{mrowcell} for two-dimensional
 %           cells created by \cs{multicolumnrow}.}
 %           Continue to use \cs{mrowcell} for empty cells in a \cs{multirow}.
 %           See \cref{sec:multicolumnmultirow} on \cpageref{sec:multicolumnmultirow}.
@@ -2996,7 +3121,7 @@
 %       \item Improved \pkg{graphics} \cs{graphicspath} support.
 %           \margintag{\cs{includegraphics} path}
 %           Multiple image directories may now be used.
-%           \textcolor{red}{Refer to |.pdf| files without a file extension}
+%           \textred{Refer to |.pdf| files without a file extension}
 %           \watchout[image file extensions]
 %           to allow the \HTML\ version
 %           to use a |.svg|, |.png|, |.jpg|, or |.gif| version instead.
@@ -3281,7 +3406,7 @@
 %		\item The old file |lwarp_html.xdy| may be deleted.
 %		\end{enumerate}
 %
-%	\item The new \pkg{lwarp} package option optn{xindyStyle} may be used to tell
+%	\item The new \pkg{lwarp} package option \optn{xindyStyle} may be used to tell
 %	\prog{lwarpmk} to use a custom |.xdy| file instead of |lwarp.xdy|.
 %	See \cref{sec:modifyxindy}.
 %
@@ -3671,13 +3796,19 @@
 %
 % Front \&\ back matter: & \pkg{abstract}, \pkg{appendix}. \\
 %
-% Indexing: & \prog{texindy} is used, with hyperlinks. \pkg{idxlayout}. \\
+% Indexing: & \prog{makeindex} and \prog{xindy} are supported, with hyperlinks.
 %
+%   \pkg{idxlayout}, \pkg{imakeidx}, \pkg{index}, \pkg{makeidx}, \pkg{repeatindex}, \pkg{splitidx}.
+%
+%   Tested to work as-is: \pkg{hvindex}.\\
+%
 % Glossary: & \pkg{glossaries} and \prog{xindy} are used. \\
 %
 % Bibliography: & \pkg{babelbib}, \pkg{backref}, \pkg{biblatex}, \pkg{bibunits},
-%   \pkg{chapterbib}, \pkg{cite}, \pkg{hypernat}, \pkg{natbib}. \\
+%   \pkg{chapterbib}, \pkg{cite}, \pkg{hypernat}, \pkg{natbib}.
 %
+%   Tested to work as-is: \pkg{notes2bib}. \\
+%
 % \midrule
 %
 % Cross-references: & 
@@ -3708,7 +3839,7 @@
 % Theorems: & Native \LaTeX\ theorems,
 %	\pkg{amsthm}, \pkg{ntheorem}, \pkg{theorem}. \\
 %
-% Additional math: & Math fonts via \SVG\ images, \pkg{resizegather}, \pkg{xy}.
+% Additional math: & Math fonts via \SVG\ images, \pkg{cases}, \pkg{resizegather}, \pkg{xy}.
 %
 %   Tested to work as-is:
 %   \pkg{amscd}, \pkg{bm}, \pkg{braket}, \pkg{delarray}, \pkg{guass}, \pkg{nicematrix},
@@ -3839,6 +3970,12 @@
 %
 % \midrule
 %
+% Files: &
+%   \pkg{attachfile}, \pkg{attachfile2}, \pkg{hyperxmp}, \pkg{intopdf},
+%   \pkg{pdfpages}, \pkg{pdfx}, \pkg{xmpincl}. \\
+%
+% \midrule
+%
 % Science and engineering: &
 %   \pkg{algorithm2e}, \pkg{algorithmicx}, \pkg{axodraw2}, \pkg{bytefield},
 %   \pkg{chemfig}, \pkg{chemformula}, \pkg{chemgreek}, \pkg{chemmacros}, \pkg{chemnum},
@@ -4451,7 +4588,7 @@
 % \end{description}
 %
 % \vfill
-% \textcolor{red}{\textbf{Any utilities installed by hand must be added to the |PATH|.}}
+% \textred{\textbf{Any utilities installed by hand must be added to the |PATH|.}}
 % \vfill
 %
 %
@@ -4531,7 +4668,7 @@
 %
 % \begin{center}
 % \footnotesize
-% \textcolor{red}{Note: There are two pages!}
+% \textred{Note: There are two pages!}
 % \end{center}
 %
 % \small
@@ -4583,7 +4720,11 @@
 % \item [|sample\_project.css|:] An example of a user-customized \CSS\ file,
 %	which may be used for project-specific changes to the \pkg{lwarp} defaults.
 %
-% \item [|lwarp.xdy|:] Used by \pkg{lwarp} while creating an index.
+% \item [|lwarp.ist|:] Used by \pkg{lwarp} while creating an index using \prog{makeindex}.
+%   This file should not be modified by the user.
+%   A custom file may be used instead, if necessary.
+%
+% \item [|lwarp.xdy|:] Used by \pkg{lwarp} while creating an index using \prog{xindy}.
 %	This file should not be modified by the user.
 %	A custom file may be used instead, if necessary.
 %
@@ -4650,9 +4791,11 @@
 %	Although, when using the utility \prog{latexmk} (introduced later), the changed date is
 %	ignored and an actual change in contents must occur to cause a recompile.}
 %
-% \item Process the index.\index{index>processing}\footnote{A \cmds{lwarpmk printglossary} command is also
-%	available to process a glossary produced with the \textsf{glossaries} package.
-%	See \cref{sec:glossaries}.}\footnote{Also see \cref{sec:indextocbibind} for index options.}
+% \item Process the index.\index{index>processing}%
+%   \footnote{The command \cmds{lwarpmk printglossary} is also
+%	    available to process a glossary produced with the \textsf{glossaries} package.
+%	    See \cref{sec:glossaries}.}%
+%   \footnote{Also see \cref{sec:indexsetup} for index options.}
 %	\userentry{lwarpmk printindex}
 %
 % \item Recompile again to include the index.
@@ -4714,9 +4857,10 @@
 %	\userentry{lwarpmk html}
 %	\userentry{lwarpmk print}
 %
-% \item Process the \HTML\ index and recompile:\index{index>processing}\footnote{A \texttt{lwarpmk htmlglossary} command is also
+% \item Process the \HTML\ index and recompile:\index{index>processing}
+%   \footnote{The command \cmds{lwarpmk htmlglossary} is also
 %	available to process a glossary produced with the \textsf{glossaries} package.
-%	See \cref{sec:glossaries}.}\footnote{Also see \cref{sec:indextocbibind} for index options.}
+%	See \cref{sec:glossaries}.}\footnote{Also see \cref{sec:indexsetup} for index options.}
 %	\userentry{lwarpmk htmlindex}
 %	\userentry{lwarpmk html}
 %
@@ -4797,7 +4941,7 @@
 % \begin{sourcedisplay}
 % \cs{usepackage}\{lwarp\} \\
 % \dots \\
-% \textcolor{red}{\cs{CSSFilename}\{lwarp\_formal.css\}} \\
+% \textred{\cs{CSSFilename}\{lwarp\_formal.css\}} \\
 % \dots \\
 % \cs{begin}\{document\} \\
 % \end{sourcedisplay}
@@ -4904,24 +5048,14 @@
 % \pkg{lwarp} supports the \pkg{glossaries} package, although this tutorial
 % does not supply an example.
 %
-% \DescribeOption{xindyLanguage}
-% To assign the \prog{xindy} language and codepage to be used
-% while processing the index and glossary,
-% use the \optn{xindyLanguage} and \optn{xindyCodepage} options:
-% \index{language>glossary}
-% \index{language>index}
-% \index{glossary>language}
-% \index{index>language}
 %
-% \begin{Verbatim}[gobble=2,frame=lines]
-% \usepackage[xindyLanguage=english, xindyCodepage=utf8]{lwarp}
-% \end{Verbatim}
-%
 % \index{glossary>processing}
 % To process the glossary for the print version:
 % \index{glossary>processing}
 %	\userentry{lwarpmk printglossary}
 %
+% \fquad (If \cmds{makeglossaries} is not found, see \cref{sec:glossaries}.)\watchout
+%
 % To process the glossary for the \HTML\ version:
 %	\userentry{lwarpmk htmlglossary}
 %
@@ -4931,9 +5065,9 @@
 % \userentry{lwarpmk print1}
 % \userentry{lwarpmk print}
 %
+% See \cref{sec:glossaries} to set options for processing glossaries.
 %
 %
-%
 % \clearpage
 %
 % \subsection{Cleaning auxiliary files}
@@ -4977,7 +5111,7 @@
 % During testing it may be useful to finish the \HTML\ conversion even when
 % the document had errors and did not compile successfully.  To attempt an
 % \HTML\ conversion of an incomplete document:
-%   \userentry{lwarpmk pdftohtml [project]}
+%   \userentry{lwarpmk pdftohtml [-p project]}
 %
 %
 % \subsection{Processing multiple projects in the same directory}
@@ -4995,8 +5129,8 @@
 %	\end{sourcedisplay}
 %
 % To compile each project with |lwarkmk|:
-% \userentry{lwarpmk print project\_a}
-% \userentry{lwarpmk html project\_b}
+% \userentry{lwarpmk print -p project\_a}
+% \userentry{lwarpmk html -p project\_b}
 %
 %
 % \subsection{Using the \prog{make} utility}
@@ -5004,7 +5138,7 @@
 % \prog{lwarpmk} has an action which may be useful for integration with the
 % common \prog{make} utility:
 %	\begin{sourcedisplay}
-%	|lwarpmk pdftohtml [project]|
+%	|lwarpmk pdftohtml [-p project]|
 %	\end{sourcedisplay}
 %
 % \prog{make} may be used to compile the code to \PDF\ with \HTML\
@@ -5056,6 +5190,10 @@
 %       |*| columns, \pkg{multirow}, \pkg{longtable}, \pkg{supertabular}, \pkg{xtab},
 %       \pkg{bigdelim}.  See \cref{sec:limitstabular}.
 %   \item Possible option clashes with \pkg{memoir}.  See \cref{sec:limitsmemoir}.
+%   \item If using indexes, see \cref{sec:indexsetup}.
+%   \item If using many indexes, glossaries, |.aux| files, etc.,
+%       see \cref{sec:indexsetup} regarding \pkg{morewrites}.
+%       If \pkg{morewrites} is already used, be sure to add the setup with |allocate=10|.
 %   \item Other changes as per \nameref{sec:limitations}, \cref{sec:limitations}.
 % \end{enumerate}
 % \item Convert any \PDF\ images to \SVG.  See \cref{sec:limitsgraphics}.
@@ -5226,7 +5364,11 @@
 %
 % The \pkg{lwarp} option \optn{xindyLanguage} may be used to set the language option
 % for \pkg{xindy}, and the \optn{xindyCodepage} option may be used to set the codepage
-% option for \pkg{xindy}.  These are used for both index and glossary generation.
+% option for \pkg{xindy}.  These are used for
+% ^^A both
+% index
+% ^^A and glossary
+% generation.
 %
 %
 % \clearpage
@@ -5236,25 +5378,42 @@
 % \index{settings>lwarp package options}
 % 
 % \begin{table}
-% \caption{Package options\label{tab:options}}
+% \caption{\pkg{lwarp} package options\label{tab:options}}
 % \centering
 % \begin{tabular}{>{\ttfamily}lp{3.25in}}
 % Option & Description \\ \midrule
-% warpprint & Generate print output, and also generate configuration files. \\
-% warpHTML & Generate \HTML\ output. \\
 % mathsvg & Show math using \SVG\ images. \\
 % mathjax & Show math using \brand{MathJax}. \\
+% latexmk & Boolean for \prog{lwarpmk} to use \prog{latexmk} for compiling documents. \\
+% HomeHTMLFilename & The filename of the home page. \\
+% HTMLFilename & A prefix for the filenames of the remaining web pages. \\
+% \midrule
+% \multicolumn{2}{l}{\small For indexing (\cref{sec:indexsetup}) and glossaries (\cref{sec:glossaries}):} \\
+% makeindex & Use \prog{makeindex} to generate indices. \\
+% xindy & Use \prog{xindy} to generate indices. \\
+% makeindexStyle & Set a custom style for \prog{makeindex}. \\
+% xindyStyle & Set a custom style for \prog{xindy}. \\
+% xindyLanguage & The \prog{xindy} language option used for index
+% ^^A and glossary
+% generation. \\
+% xindyCodepage & The \prog{xindy} codepage option used for index
+% ^^A and glossary
+% generation. \\
+% PrintIndexCmd & Shell commands executed by \cmds{lwarpmk printindex}. \\
+% HTMLIndexCmd & Shell commands executed by \cmds{lwarpmk htmlindex}. \\
+% LatexmkIndexCmd & Shell commands executed by \prog{latexmk}. \\
+% GlossaryCmd & Shell command executed by \cmds{lwarpmk printglossary} and \cmds{lwarpmk htmlglossary}. \\
+% \midrule
+% \multicolumn{2}{l}{\small Seldom necessary:} \\
 % OSWindows & Force compatibility with \brand{MS-Windows}. \\
+% pdftotextEnc & Set the encoding for \prog{pdftotext}. \\
+% lwarpmk & Generate a local copy of \filenm{lwarpmk.lua}. \\
+% \midrule
+% \multicolumn{2}{l}{\small Used internally by \pkg{lwarp}:} \\
+% warpprint & Generate print output, and also generate configuration files. \\
+% warpHTML & Generate \HTML\ output. \\
 % BaseJobname & The \cs{jobname} to use.
 %   Set to the \cs{jobname} of the printed version even while generating \HTML. \\
-% HomeHTMLFilename & The filename of the home page. \\
-% HTMLFilename & A prefix for the filenames of the remaining web pages. \\
-% latexmk & Boolean for \prog{lwarpmk} to use \prog{latexmk} for compiling documents. \\
-% lwarpmk & Generate a local copy of \filenm{lwarpmk.lua}. \\
-% xindyLanguage & The \prog{xindy} language option used for index and glossary generation. \\
-% xindyCodepage & The \prog{xindy} codepage option used for index and glossary generation. \\
-% xindyStyle & Set a custom filename for \prog{xindy}. \\
-% pdftotextEnc & Set the encoding for \prog{pdftotext}. \\
 % \bottomrule
 % \end{tabular}
 % \end{table}
@@ -5269,62 +5428,198 @@
 % \DescribePackage{lwarp}
 % \index{lwarp>loading}\index{lwarp>options}
 %
-% \DescribeOption{warpprint}
-% \DescribeOption{warpHTML}
-% Usually controlled by \prog{lwarpmk}, and not set in the document.
-% Select the \optn{warpprint} option to generate print output (default),
-% or the \optn{warpHTML} option to generate \HTMLfive\ output.
-% The default is print output, so the print version may be
-% compiled with the usual \prog{pdflatex}, etc.
-% When \pkg{lwarp} is loaded in print mode, it creates
-% |<project>_html.tex|, which sets the \optn{warpHTML} option before calling
-% the user's source code |<project>.tex|.  In this way, |<project>.tex|
-% can |\usepackage{lwarp}| without any options to create a printed version,
-% while |<project>_html.tex| will create an \HTML\ version.
+% \begin{description}
 %
+% \item[\optn{mathsvg}, \optn{mathjax}:]
 % \DescribeOption{mathsvg}
 % \DescribeOption{mathjax}
-% For math display, select |mathsvg| (default), or |mathjax|.
+% For math display, select \optn{mathsvg} (default), or \optn{mathjax}.
 % For more information about the math options, see \cref{sec:limitsmath}.
+%
 % 
-% \DescribeOption{OSWindows} See \cref{sec:OSportabilityusage} if using \brand{Windows}.
+% \item[\optn{latexmk}:]
+% \DescribeOption{latexmk}
+% \DescribeDefault{false} Tells \prog{lwarpmk} to use \prog{latexmk} to recompile the
+%   document several times if necessary.
+%   Otherwise, \prog{lwarpmk} attempts to determing for itself whether to recompile.
+%   See \cref{sec:htmlsettings}.
 %
-% \DescribeOption{BaseJobname}
-% \DescribeDefault{\cs{jobname}} Not intended for the user.
-%   Used internally by \pkg{lwarp} when
-%   creating the |*_html.tex| file used to compile the \HTML\ version.
-%   See \cref{sec:handlingpackageoptions}.
 %
+% \item[\optn{HomeHTMLFilename}:]
 % \DescribeOption{HomeHTMLFilename}
-% \DescribeDefault{\{\}} See \cref{sec:htmlsettings}. \\
+% \DescribeDefault{\{\}}
+% See \cref{sec:htmlsettings}.
 %
+%
+% \item[\optn{HTMLFilename}:]
 % \DescribeOption{HTMLFilename}
-% \DescribeDefault{\{\}} See \cref{sec:htmlsettings}. \\
+% \DescribeDefault{\{\}}
+% See \cref{sec:htmlsettings}.
 %
-% \DescribeOption{xindyLanguage}
-% \DescribeDefault{english} If using an index or glossary,
-%   see \cref{sec:handlingpackageoptions}. \\
 %
-% \DescribeOption{xindyCodepage}
-% \DescribeDefault{utf8} If using an index or glossary,
-%   see \cref{sec:handlingpackageoptions}. \\
+% \item[\optn{makeindex}:]
+% \DescribeOption{makeindex}
+% \DescribeDefault{makeindex} Sets \optn{PrintIndexCmd}, \optn{HTMLIndexCmd},
+%   and \optn{LatexmkImageCmd}
+%   to use \prog{makeindex} when generating indexes with
+%   \cmds{lwarpmk printindex}, \cmds{lwarpmk htmlindex}, or \prog{latexmk}.
+%   If neither \optn{makeindex} nor \optn{xindy} is used, \optn{makeindex} is assumed.
 %
-% \DescribeOption{latexmk}
-% \DescribeDefault{false} Tells \prog{lwarpmk} to use \prog{latexmk} to recompile the
-%   document several times if necessary.
-%   Otherwise, \prog{lwarpmk} attempts to determing for itself whether to recompile.
-%   See \cref{sec:htmlsettings}.
 %
-% \DescribeOption{lwarpmk}  If you wish to have \pkg{lwarp} generate a local
-%   copy of \filenm{lwarpmk.lua} for archival or local-installation purposes,
-%   compile the print version with the \optn{lwarpmk} option set.
-%   See \cref{sec:handlingpackageoptions}.
+% \item[\optn{xindy}:]
+% \DescribeOption{xindy}
+% \DescribeDefault{makeindex} Sets \optn{PrintIndexCmd}, \optn{HTMLIndexCmd},
+%   and \optn{LatexmkImageCmd}
+%   to use \prog{xindy} when generating indexes with
+%   \cmds{lwarpmk printindex}, \cmds{lwarpmk htmlindex}, or \prog{latexmk}.
 %
+%
+% \item[\optn{makeindexStyle}:]
+% \DescribeOption{makeindexStyle}
+% \DescribeDefault{lwarp.ist}
+%   If you wish to use a custom |.ist| file for
+%   index generation, see \cref{sec:handlingpackageoptions}.
+%
+%
+% \item[\optn{xindyStyle}:]
 % \DescribeOption{xindyStyle}
 % \DescribeDefault{lwarp.xdy}
 %   If you wish to use a custom |.xdy| file for
-%   index generation, see \cref{sec:handlingpackageoptions}. \\
+%   index generation, see \cref{sec:handlingpackageoptions}.
 %
+%
+% \item[\optn{xindyLanguage}:]
+% \DescribeOption{xindyLanguage}
+% \DescribeDefault{english} If using an index or glossary,
+%   see \cref{sec:handlingpackageoptions}.
+%
+%
+% \item[\optn{xindyCodepage}:]
+% \DescribeOption{xindyCodepage}
+% \DescribeDefault{utf8} If using an index,
+% ^^A or glossary,
+%   see \cref{sec:handlingpackageoptions}.
+%
+%
+% \item[\optn{PrintIndexCmd}:]
+% \DescribeOption{PrintIndexCmd}
+% \DescribeDefault{<automatic>} Sets the shell commands executed by \cmds{lwarpmk printindex}.
+%   If not specified, will be set by the selection of \optn{makeindex} or
+%   \optn{xindy}.  May be used to specify the creation of multiple indexes.
+%   See \cref{sec:indexsetup}.
+%
+% \needspace{2\baselineskip}
+% Examples:
+% \begin{sourcedisplay}
+% \small
+% makeindex  -s lwarp.ist  projectname.idx \hfill (\prog{makeindex}) \\
+% xindy  -M lwarp.xdy  -L english  -C utf8 projectname.idx \hfill (\prog{xindy})
+% \end{sourcedisplay}
+%
+% The use of the \optn{makeindex} or \optn{xindy} options sets \optn{PrintIndexCmd}
+% \margintag{automatic setting}
+% to sensible values for each of those programs while compiling a single index.
+% \pkg{lwarp}'s \optn{makeindexStyle}, \optn{xindyStyle},
+% \optn{xindyLanuage}, and \optn{xindyCodepage} options will be used if specified.
+%
+% If specifying \optn{PrintIndexCmd} manually,
+% \watchout[xindy]
+% be sure to assign an \prog{xindy}
+% language and codepage with the |-L| and |-C| \prog{xindy} options, as the
+% \prog{lwarp} \optn{xindyLanguage} and \optn{xindyCodepage} options are not
+% used for the \optn{PrintIndexCmd} option when it is set manually.
+%
+% This option is stored in the configuration files \filenm{lwarpmk.conf}
+% and \filenm{*.lwarpmkconf}, and is then passed by the \cmds{lwarpmk printindex}
+% command to the operating system to compile the print indexes.
+% Since the command string is parsed by \TeX, written to a file,
+% read from the file by Lua\TeX, and finally passed to the operating system,
+% any attempt at quoting will be problematic.  For complicated commands,
+% it would be best to create a shell script, and simply refer to the script
+% with the \pkg{lwarp} \optn{PrintIndexCmd} option.
+%
+%
+% \item[\optn{HTMLIndexCmd}:]
+% \DescribeOption{HTMLIndexCmd}
+% \DescribeDefault{<automatic>} Sets the shell commands executed by \cmds{lwarpmk htmlindex}.
+%   If not specified, will be set by the selection of \optn{makeindex} or
+%   \optn{xindy}.  May be used to specify the creation of multiple indexes.
+%   See \cref{sec:indexsetup}.
+%
+% \needspace{2\baselineskip}
+% Example settings are similar to \optn{PrintIndexCmd},
+% \watchout[filenames]
+% but append |_html| to the filenames:
+% \begin{sourcedisplay}
+% \small
+% makeindex  -s lwarp.ist  projectname\textred{\_html}.idx \hfill (\prog{makeindex}) \\
+% xindy  -M lwarp.xdy  -L english  -C utf8  projectname\textred{\_html}.idx \hfill (\prog{xindy})
+% \end{sourcedisplay}
+%
+% The use of the \optn{makeindex} or \optn{xindy} options sets \optn{HTMLIndexCmd}
+% \margintag{automatic setting}
+% to sensible values for each of those programs while compiling a single index.
+% \pkg{lwarp}'s \optn{makeindexStyle}, \optn{xindyStyle},
+% \optn{xindyLanuage}, and \optn{xindyCodepage} options will be used if specified.
+%
+% If specifying \optn{HTMLIndexCmd} manually,
+% \watchout[xindy]
+% be sure to assign an \prog{xindy}
+% language and codepage with the |-L| and |-C| \prog{xindy} options, as the
+% \prog{lwarp} \optn{xindyLanguage} and \optn{xindyCodepage} options are not
+% used for the \optn{HTMLIndexCmd} option when it is set manually.
+%
+% As with \optn{PrintIndexCmd}, to generate complicated indexes it may be
+% worthwhile to use a shell script, then refer to that script with \optn{HTMLIndexCmd}.
+%
+%
+% \item[\optn{LatexmkIndexCmd}:]
+% \DescribeOption{LatexmkIndexCmd}
+% \DescribeDefault{<automatic>} Sets the shell commands executed by \prog{latexmk}.
+%   Unlike \optn{PrintIndexCmd} and \optn{HTMLIndexCmd}, \optn{LatexmkIndexCmd}
+%   does not include any filenames, which will be provided instead by \prog{latexmk}.
+%   See \cref{sec:indexsetup}.
+%
+% \needspace{2\baselineskip}
+% Example settings are similar to \optn{PrintIndexCmd}, but without a filename:
+% \begin{sourcedisplay}
+% \small
+% makeindex  -s lwarp.ist \hfill (\prog{makeindex}) \\
+% xindy  -M lwarp.xdy  -L english  -C utf8 \hfill (\prog{xindy})
+% \end{sourcedisplay}
+%
+% The use of the \optn{makeindex} or \optn{xindy} options sets \optn{LatexmkIndexCmd}
+% \margintag{automatic setting}
+% to either of the two settings show above.
+% \pkg{lwarp}'s \optn{makeindexStyle}, \optn{xindyStyle},
+% \optn{xindyLanuage}, and \optn{xindyCodepage} options will be used if specified.
+% Unlike \optn{PrintIndexCmd} and \optn{HTMLIndexCmd},
+% \prog{latexmk} uses either of the single-line settings of \optn{LatexmkIndexCmd}
+% shown above to compile each of multiple indexes if necessary.
+%
+% If specifying \optn{LatexmkIndexCmd} manually,
+% \watchout[xindy]
+% be sure to assign an \prog{xindy}
+% language and codepage with the |-L| and |-C| \prog{xindy} options, as the
+% \prog{lwarp} \optn{xindyLanguage} and \optn{xindyCodepage} options are not
+% used for the \optn{LatexmkIndexCmd} option when it is set manually.
+%
+%
+% \item[\optn{GlossaryCmd}:]
+% \DescribeOption{GlossaryCmd}
+% \DescribeDefault{\cmds{makeglossaries}} Sets the shell command
+%   executed by \cmds{lwarpmk printglossary} and \cmds{lwarpmk htmlglossary}.
+%   The print or \HTML\ glossary filename is appended to this command.
+%   See \cref{sec:glossaries}.
+%
+%
+% \item[\optn{OSWindows}:]
+% \DescribeOption{OSWindows} \pkg{lwarp} attempts to automatically sense \brand{Windows},
+%   but it may be forced with this option.
+%   See \cref{sec:OSportabilityusage}.
+%
+%
+% \item[\optn{pdftotextEnc}:]
 % \DescribeOption{pdftotextEnc}
 % \DescribeDefault{UTF-8} Used to specify
 %   the encoding used by \prog{pdftotext} during the \PDF-\HTML\ conversion.
@@ -5331,6 +5626,45 @@
 %   In most situations, the default is the correct choice.
 %
 %
+% \item[\optn{lwarpmk}:]
+% \DescribeOption{lwarpmk}  If you wish to have \pkg{lwarp} generate a local
+%   copy of \filenm{lwarpmk.lua} for archival or local-installation purposes,
+%   compile the print version with the \optn{lwarpmk} option set.
+%   See \cref{sec:handlingpackageoptions}.
+%
+% \begin{quote}
+% \hrule
+% The following options are used internally by \pkg{lwarp}, and
+% usually are not used in the user's document:
+% \smallskip
+% \hrule
+% \end{quote}
+%
+%
+% \item[\optn{warpprint} and \optn{warpHTML}:]
+% \DescribeOption{warpprint}
+% \DescribeOption{warpHTML}
+% Usually controlled by \prog{lwarpmk}, and not set in the document.
+% Select the \optn{warpprint} option to generate print output (default),
+% or the \optn{warpHTML} option to generate \HTMLfive\ output.
+% The default is print output, so the print version may be
+% compiled with the usual \prog{pdflatex}, etc.
+% When \pkg{lwarp} is loaded in print mode, it creates
+% |<project>_html.tex|, which sets the \optn{warpHTML} option before calling
+% the user's source code |<project>.tex|.  In this way, |<project>.tex|
+% can |\usepackage{lwarp}| without any options to create a printed version,
+% while |<project>_html.tex| will create an \HTML\ version.
+%
+%
+% \item[\optn{BaseJobname}:]
+% \DescribeOption{BaseJobname}
+% \DescribeDefault{\cs{jobname}} Not intended for the user.
+%   Used internally by \pkg{lwarp} when
+%   creating the |*_html.tex| file used to compile the \HTML\ version.
+%   See \cref{sec:handlingpackageoptions}.
+%
+% \end{description}
+%
 % \clearpage
 %
 % \subsection{Customizing the HTML output}
@@ -5340,8 +5674,9 @@
 %
 % \changes{v0.43}{2017/11/04}{Docs: HTML settings table.}
 % \changes{v0.43}{2017/11/06}{Docs: Reorganized HTML customization.}
-% \begin{table}
+% \begin{table}[p]
 % \caption{HTML settings}
+% \label{tab:htmlsettings}
 % \begin{tabular}{>{\ttfamily}lp{3in}}
 % \toprule
 % Option & Description \\ \midrule
@@ -5365,7 +5700,8 @@
 % \end{tabular}
 % \end{table}
 %
-% Several settings may be used to customize the \HTML\ output.
+% \Cref{tab:htmlsettings} shows several settings may be used
+% to customize the \HTML\ output.
 % Watch for the correct placement of each!\watchout[Placement!]
 %
 % Note that if changes are made,
@@ -5400,7 +5736,7 @@
 %   \index{underscore>filename}\index{file>underscore in name}
 %   \changes{v0.24}{2017/03/13}{Docs: Filename underscore.}
 %   \begin{sourcedisplay}
-%        \cs{item} [\cs{href}\{file\textcolor{red}{\textbackslash\_}name.pdf\}\{text\}] \textbackslash
+%        \cs{item} [\cs{href}\{file\textred{\textbackslash\_}name.pdf\}\{text\}] \textbackslash
 %   \end{sourcedisplay}
 %   See \cref{sec:filenameexamples} for examples of naming and numbering \HTML\ files.
 %
@@ -5420,6 +5756,12 @@
 % \ItemDescribeOption{mathjax} \DescribeDefault{false}
 %   Selects \brand{MathJax} for math output.
 %
+% \ItemDescribeOption{makeindex} \DescribeDefault{makeindex}
+%   Selects \prog{makeindex} for index generation by \prog{lwarpmk}.
+%
+% \ItemDescribeOption{xindy} \DescribeDefault{makeindex}
+%   Selects \prog{xindy} for index generation by \prog{lwarpmk}.
+%
 %   \end{description} \bigskip
 %
 % \item[Placed in the preamble before \texttt{\cs{begin}\{document\}}:] \
@@ -5955,8 +6297,10 @@
 %
 % To disable the generation of \HTML\ description meta tags,
 % \margintag{disabling}
-% use:\\
-% \hspace*{1em} |\HTMLDescription{}|
+% use:
+% \begin{sourcedisplay}
+% \fqquad \cs{HTMLDescription}\{\}
+% \end{sourcedisplay}
 %
 %
 % \subsection{HTML page meta title}
@@ -5986,43 +6330,7 @@
 % \cs{HTMLAuthor} may be used to set the meta tag to a simple list of names.
 %
 %
-% \subsection{Modifying \prog{xindy} index processing}
-% \label{sec:modifyxindy}
 %
-% \DescribeProgram{xindy}
-% \DescribeFile{lwarp.xdy}
-% \prog{lwarpmk} uses the file |lwarp.xdy| to process the index.
-% \index{lwarp.xdy>customizing}
-% \index{xindy>customizing}
-% This file is over-written by \pkg{lwarp} whenever a print version of
-% the document is processed.
-%
-% To customize index processing:
-% \begin{enumerate}
-% \item Copy |lwarp.xdy| to a new filename such as |projectname.xdy|
-% \item Make changes to |projectname.xdy|.
-%	Keep the line which says
-%	\begin{Verbatim}[gobble=2,tabsize=4]
-%		(markup-locref :open "\hyperindexref{" :close "}")
-%	\end{Verbatim}
-%	This line creates the hyperlinks for the \HTML\ index.  During print output
-%	\cs{hyperindexref} becomes a null function.
-% \item In the document source use the \optn{xindyStyle} option for \pkg{lwarp}:
-% \DescribeOption{xindyStyle}
-%	\begin{Verbatim}[gobble=2,tabsize=4]
-%		\usepackage[
-%			... other options ...
-%			xindyStyle=projectname.xdy,
-%		]{lwarp}
-%	\end{Verbatim}
-% \item Recompile the print version, which causes
-%	\pkg{lwarp} to rewrite the |lwarpmk.conf| configuration file.
-%	This tells \prog{lwarpmk} to use the custom |projectname.xdy| file instead of |lwarp.xdy|.
-% \end{enumerate}
-%
-%
-%
-%
 % \section{Special cases and limitations}
 % \label{sec:limitations}
 %
@@ -6269,9 +6577,9 @@
 %    \cs{ref}\{sec:name\} on page \cs{pageref}\{sec:name\} \\
 %    \rmfamily
 % \hspace*{-2em} in \HTML\ becomes: \\
-%    ``Sec.~\textcolor{red}{1.23}
+%    ``Sec.~\textred{1.23}
 %    on page (\textbf{see}
-%    sec.~\textcolor{red}{1.23})''.
+%    sec.~\textred{1.23})''.
 % \end{sourcedisplay}
 % \cs{pagerefPageFor} may be redefined to ``page for '', empty, etc.
 % See \cpageref{sec:pagerefpagefor}.
@@ -6418,7 +6726,7 @@
 % \subsubsection{BibTeX}
 % \label{sec:limitsbibtex}
 % \index{BibTeX>\cs{etalchar} error}
-% \index{warning>Improper \cs{prevdepth}.}
+% \index{error>Improper \cs{prevdepth}.}
 % \index{Improper \cs{prevdepth}.}
 % \DescribeMacro{\etalchar} Displays a superscript ``+'' to indicate ``and others''.
 % \changes{v0.54}{2018/03/09}{Docs: BibTeX.}
@@ -6430,23 +6738,668 @@
 % \label{sec:glossaries}
 %
 % \DescribePackage{glossaries}
+% \index{glossary>options}
+% \index{language>glossary}
+% \index{glossary>language}
 % \limitsglossaries
 %
 %
-% \subsubsection{Index and the \pkg{tocbibind} package}
-% \label{sec:indextocbibind}
-% \index{index>placement and \acro{TOC} options}
+% \subsubsection{Indexing overview}
+% \label{sec:indexingoverview}
 %
-% \changes{v0.38}{2017/08/24}{Docs: Index, \pkg{tocbibind}.}
+% There are many ways to process indexes for a \LaTeX\ document,
+% including native \LaTeX\ capabilities, a number of packages and classes,
+% the possible availability of shell escape and \prog{latexmk}, and the
+% need to process print and \HTML\ versions.
+% \pkg{lwarp} attempts to provide easy recompilation of indexes along with
+% the rest of the document, but the various indexing options must be set correctly.
+% Numerous examples are given below.
+% Some differ in minor details, so the important parts are highlighted in red,
+% and options are in green.
 %
-% \limitsindex
+% Once set up properly, the entire document may be recompiled with
+% \cmds{lwarpmk print} and \cmds{lwarpmk html}.
+% In some cases, it will also be necessary to compile the indexes with
+% \cmds{lwarpmk printindex} and \cmds{lwarpmk htmlindex}.
+% A recompile may then be forced with \cmds{lwarpmk print1} and \cmds{lwarpmk html1}.
 %
+% The user may continue to process indexes manually or by shell script
+% \margintag{manual processing}
+% without the use of \prog{lwarpmk}, but adjustments will be required to
+% process \HTML\ indexes as well.  In general, \filenm{*.idx} and \filenm{*.ind} files
+% will be accompanied by \filenm{*\_html.idx} and \filenm{*\_html.ind} files.
+%
+% If using a custom indexing style file,
+% \margintag{custom index style}
+% see \cref{sec:modifymakeindex,sec:modifyxindy}.
+%
 % See \cref{sec:index} for \pkg{lwarp}'s core index and glossary code,
-% and \cref{sec:tocbibind} for \pkg{tocbibind}.
+% \margintag{source code}
+% \index{index>source code}
+% \cref{sec:indexpkg} for \pkg{index},
+% \cref{sec:splitidx} for \pkg{splitidx},
+% \cref{sec:imakeidx} for \pkg{imakeidx},
+% \cref{sec:tocbibind} for \pkg{tocbibind},
+% and \cref{sec:memoirbackmatter} for \pkg{memoir}'s indexing patches.
 %
 %
+% \subsubsection{Indexing with basic \LaTeX\ and \pkg{makeidx}}
+% \label{sec:indexsetup}
 %
+% \changes{v0.38}{2017/08/24}{Docs: Index, \pkg{tocbibind}.}
+% \changes{v0.58}{2018/06/14}{Docs: Index, \prog{makeindex}, \pkg{imakeidx}.}
 %
+% \index{xindy>and hyperref}
+% \index{hyperref>and xindy}
+% \index{index>xindy and hyperref}
+% \index{index>missing entries}
+% \index{index>see, seealso, ranges}
+% \index{index>processing}
+%
+% The following allow the user to process indexes automatically, or
+% \margintag{\prog{lwarpmk} processing}
+% using \prog{lwarpmk}'s commands:
+% \userentry{lwarpmk printindex}
+% \userentry{lwarpmk htmlindex}
+% 
+% \begin{description}
+% 
+% \needspace{2\baselineskip}
+% \item [For a single index using \prog{makeindex}:]
+%     \begin{sourcedisplay}
+%     \cs{usepackage}\textred{[makeindex\textgreen{,latexmk}]}
+%           \{\textblue{lwarp}\}
+%     \end{sourcedisplay}
+%     The usual \filenm{.idx} and \filenm{.ind} files will be used,
+%     along with the new \filenm{lwarp.ist} style file.
+%     When creating the \HTML\ index, ``\texttt{\_html}'' is automatically appended
+%     to each of the names.
+%
+%     \prog{lwarpmk} will use \prog{latexmk} if specified, in which case
+%     \prog{latexmk} will create the index automatically.
+%     Otherwise, use \userentry{lwarpmk printindex} \userentry{lwarpmk htmlindex}
+%     to compile the indexes.
+%
+% \needspace{8\baselineskip}
+% \item [For a single index using \prog{xindy}:]
+%     \begin{sourcedisplay}
+%     \cs{usepackage}[ \\
+%       \fqquad \textred{xindy,} \\
+%       \fqquad \textgreen{xindyLanguage=english,}   \hfill \textrm{<optional>} \\
+%       \fqquad \textgreen{xindyCodepage=utf8,}   \hfill \textrm{<optional>} \\
+%       \fqquad \textgreen{latexmk} \hfill \textrm{<optional>}\\
+%     ]\{\textblue{lwarp}\}
+%     \end{sourcedisplay}
+%     The usual \filenm{.idx} and \filenm{.ind} files will be used,
+%     along with the new \filenm{lwarp.xdy} style file.
+%
+%     \prog{lwarpmk} will use \prog{latexmk} if specified, in which case
+%     \prog{latexmk} will create the index automatically.
+%     Otherwise, use \userentry{lwarpmk printindex} \userentry{lwarpmk htmlindex}
+%     to compile the indexes.
+% \end{description}
+%
+%
+% \subsubsection{Indexing with \pkg{index}}
+%
+% \pkg{lwarp} is told how to use \prog{makeindex} using the
+% \optn{PrintIndexCmd} and \optn{HTMLIndexCmd} options.
+% The file \filenm{lwarp.ist} is specified, which generates index letter heads for
+% print output and also allows special \HTML\ formatting for \HTML\ output.
+%
+% \begin{description}
+%
+% \needspace{20\baselineskip}
+% \item [For multiple indexes using \prog{makeindex} and \pkg{index}:] \
+%
+% \textgreen{
+%   (Assuming that the second index has file extensions \filenm{.sist} and \filenm{.sind})
+% }
+% \begin{sourcedisplay}
+% \cs{usepackage}[ \\
+%     \fquad\textred{makeindex,} \textgreen{latexmk,} \\
+%     \fquad\textred{PrintIndexCmd}=\{ \\
+%         \fqquad makeindex -s lwarp.ist  <projectname>.idx \textred{;} \\
+%         \fqquad makeindex -s lwarp.ist  \\
+%             \fqqquad -o <projectname>\textred{.sind}  <projectname>\textred{.sidx} \\
+%     \fquad\}, \\
+%     \fquad\textred{HTMLIndexCmd}=\{ \\
+%         \fqquad makeindex -s lwarp.ist  <projectname>\textred{\_html}.idx \textred{;} \\
+%         \fqquad makeindex -s lwarp.ist  \\
+%             \fqqquad -o <projectname>\textred{\_html.sind}  <projectname>\textred{\_html.sidx} \\
+%     \fquad\} \\
+% ]\{\textblue{lwarp}\} \\
+% \cs{usepackage}\{\textblue{index}\} \\
+% \dots \\
+% \cs{makeindex} \\
+% \cs{newindex}\{secondname\}\{\textred{sidx}\}\{\textred{sind}\}\{Second Index\}
+% \end{sourcedisplay}
+% \emph{For \brand{Windows}, replace the two ``;'' characters with ``\&''.}\watchout[\brand{Windows}]
+%
+% When creating the \HTML\ index, ``\texttt{\_html}'' is automatically appended
+% to the index filenames.
+%
+% Use \userentry{lwarpmk printindex} \userentry{lwarpmk htmlindex}
+% to compile the indexes.
+%
+% If the \optn{latexmk} option is selected for \pkg{lwarp},
+% \prog{latexmk} will compile the document but will \emph{not} compile the indexes.
+% \cmds{lwarpmk printindex} and \cmds{lwarpmk htmlindex} will still be required.
+% 
+% \end{description}
+%
+%
+% \subsubsection{Indexing with \pkg{splitidx}}
+%
+% \pkg{lwarp} is told how to use \prog{splitindex} using the
+% \optn{PrintIndexCmd} and \optn{HTMLIndexCmd} options.
+% The file \filenm{lwarp.ist} is specified, which generates index letter heads for
+% print output and also allows special \HTML\ formatting for \HTML\ output.
+%
+% \limitssplitidx
+%
+% \begin{description}
+%
+% \needspace{16\baselineskip}
+% \item [For multiple indexes using \prog{makeindex} and \pkg{splitidx}:]
+%     \begin{sourcedisplay}
+%     \cs{usepackage}[ \\
+%         \fquad\textred{makeindex,} \textgreen{latexmk,} \\
+%         \fquad\textred{PrintIndexCmd}=\{ \\
+%             \fqquad splitindex <projectname> \textred{-\/- -s lwarp.ist} \\
+%         \fquad\}, \\
+%         \fquad\textred{HTMLIndexCmd}=\{ \\
+%             \fqquad splitindex <projectname>\textred{\_html} \textred{-\/- -s lwarp.ist} \\
+%         \fquad\} \\
+%     ]\{\textblue{lwarp}\} \\
+%     \cs{usepackage}\{\textblue{splitidx}\} \\
+%     \dots \\
+%     \cs{makeindex} \\
+%     \cs{newindex}[Second Index]\{secondname\} \\
+%     \end{sourcedisplay}
+%     When creating the \HTML\ index, ``\texttt{\_html}'' is automatically appended
+%     to each of the names.
+%
+%     Use \userentry{lwarpmk printindex} \userentry{lwarpmk htmlindex}
+%     to compile the indexes.
+%
+% \needspace{18\baselineskip}
+% \item [For multiple indexes using \prog{xindy} and \pkg{splitidx}:]
+%     \begin{sourcedisplay}
+%     \cs{usepackage}[ \\
+%         \fquad\textred{xindy,} \textgreen{latexmk,} \\
+%         \fquad\textred{PrintIndexCmd}=\{ \\
+%             \fqquad splitindex  \textred{-m xindy}  <projectname>  \textred{-\/- -M lwarp.xdy} \\
+%               \fqqquad \textgreen{-L english -C utf8} \hfill{<optional>} \\
+%         \fquad\}, \\
+%         \fquad\textred{HTMLIndexCmd}=\{ \\
+%             \fqquad splitindex  \textred{-m xindy}  <projectname>\textred{\_html}  \textred{-\/- -M lwarp.xdy} \\
+%               \fqqquad \textgreen{-L english -C utf8} \hfill{<optional>} \\
+%         \fquad\} \\
+%     ]\{\textblue{lwarp}\} \\
+%     \cs{usepackage}\{\textblue{splitidx}\} \\
+%     \dots \\
+%     \cs{makeindex} \\
+%     \cs{newindex}[Second Index]\{secondname\} \\
+%     \end{sourcedisplay}
+%     When creating the \HTML\ index, ``\texttt{\_html}'' is automatically appended
+%     to each of the names.
+%
+%     Use \userentry{lwarpmk printindex} \userentry{lwarpmk htmlindex}
+%     to compile the indexes.
+%
+% \end{description}
+%
+%
+%
+%
+% \subsubsection{Indexing with \pkg{imakeidx}}
+% \label{sec:indexingimakeidx}
+%
+% Due to the number of methods which may be used to process multiple indexes,
+% the options for style file and \prog{xindy} language and codepage must be
+% specified in one of several different ways.  These are described in detail later in
+% this section, but are summarized here.
+%
+% If shell escape is used, \pkg{imakeidx} will automatically compile the indexes by itself.
+% Options specifying a custom style file and \prog{xindy} language and
+% codepage must be specified for each \cs{makeindex} command using its
+% \optn{options=} option, which must include
+% \pkg{lwarp}'s special \filenm{lwarp.ist} or \filenm{lwarp.xdy} file,
+% or a file based on them.
+% If using a custom indexing style file, see \cref{sec:modifymakeindex,sec:modifyxindy}.
+% The \optn{splitindex} option is also available of shell escape is used,
+% in which case the \pkg{splitidx} package and \prog{splitindex} program will also be used.
+%
+% If shell escape is not possible, \prog{latexmk} may be used to
+% automatically compile the indexes.
+% The style, language, and codepage options are specified with \pkg{lwarp}'s
+% \optn{makeindexStyle}, \optn{xindyStyle}, \optn{xindyLanguage}, and
+% \optn{xindyCodepage} options.  These are passed to \prog{latexmk} by
+% \prog{lwarpmk}'s \cmds{lwarpmk} \cmds{printindex} and \cmds{lwarpmk} \cmds{htmlindex} commands.
+%
+% Where shell escape and \prog{latexmk} are not possible,
+% \prog{lwarpmk} may be used to manually compile the indexes.
+% \pkg{lwarp}'s \optn{PrintIndexCmd} and \optn{HTMLIndexCmd} options are used.
+%
+% \begin{description}
+% \needspace{2\baselineskip}
+% \item [For a single or multiple indexes using \prog{makeindex} and \pkg{imakeidx}:] \
+%
+% The index style \filenm{lwarp.ist} is automatically used for \HTML\ output.
+% This file turns on letter headings, so it may be desirable to specify it as
+% an option, in which case it will also be used for print output, which will
+% help match the print and \HTML\ output.
+%     \begin{sourcedisplay}
+%     \cs{usepackage}\textred{[makeindex\textgreen{,latexmk}]}
+%       \{\textblue{lwarp}\} \\
+%     \cs{usepackage}\textred{[makeindex]}\{\textblue{imakeidx}\} \\
+%     \dots \\
+%     \cs{makeindex}[\textgreen{options=\{-s lwarp.ist\}}] \\
+%     \cs{makeindex}[name=secondname,\textgreen{options=\{-s lwarp.ist\}}] \\
+%     \end{sourcedisplay}
+%     \pkg{imakeidx} will automatically compile the indexes.
+%     Shell escape is not required while using \prog{makeindex}.
+%     \optn{latexmk} may be specified, and if so it will be used for
+%     \cmds{lwarpmk print} and \cmds{lwarpmk html}, but \prog{imakeidx} will actually
+%     create the indexes.
+%
+% \needspace{2\baselineskip}
+% \item [For a single or multiple indexes using \prog{makeindex} and \prog{splitindex} with \pkg{imakeidx}:] \
+%
+% The index style \filenm{lwarp.ist} is automatically used for \HTML\ output.
+% This file turns on letter headings, so it may be desirable to specify it as
+% an option, in which case it will also be used for print output, which will
+% help match the print and \HTML\ output.
+%     \begin{sourcedisplay}
+%     \cs{usepackage}\textred{[makeindex\textgreen{,latexmk}]}
+%       \{\textblue{lwarp}\} \\
+%     \cs{usepackage}\textred{[makeindex,splitindex]}\{\textblue{imakeidx}\} \\
+%     \dots \\
+%     \cs{makeindex}[\textgreen{options=\{-s lwarp.ist\}}] \\
+%     \cs{makeindex}[name=secondname,\textgreen{options=\{-s lwarp.ist\}}] \\
+%     \end{sourcedisplay}
+%     Shell escape is required while using \prog{splitindex}.
+%     For the first compile, use
+%       \watchout[enable shell escape]
+%     \userentry{pdflatex \textred{-shell-escape} projectname.tex}
+%     \userentry{pdflatex \textred{-\/-enable-write18} projectname.tex \quad \textrm{(MikTeX)}}
+%     or similar with \prog{xelatex} or \prog{lualatex}.
+%     \prog{lwarp} will remember that shell escape was used.
+%
+%     \prog{imakeidx} will automatically execute \prog{splitindex},
+%       and will also use \prog{makeindex} to compile the indexes.
+%
+%     \optn{latexmk} may be specified, and if so it will be used for
+%     \cmds{lwarpmk print} and \cmds{lwarpmk html}, but \prog{imakeidx} will actually
+%     create the indexes.
+%
+% \needspace{2\baselineskip}
+% \item [For multiple indexes using \prog{xindy} and \pkg{imakeidx}, using shell escape:] \
+%
+% Options may be given to \pkg{imakeidx}'s \cs{makeindex} command.
+% The style file \filenm{lwarp.xdy} is automatically used for \HTML\ output,
+% and is not necessary for print output since the output will be similar.
+% If language or codepage must be set, they should be specified as
+% options for \cs{makeindex}, since \pkg{imakeidx} will process the indexes.
+%     \begin{sourcedisplay}
+%     \cs{usepackage}\textred{[xindy\textgreen{,latexmk}]}
+%       \{\textblue{lwarp}\} \\
+%     \cs{usepackage}\textred{[xindy\textgreen{,splitindex}]}\{\textblue{imakeidx}\} \\
+%     \dots \\
+%     \cs{makeindex}[ \\
+%       \fquad \textgreen{options=\{ -M lwarp.xdy \textgreen{-L english -c utf8} \}} \\
+%     ] \\
+%     \cs{makeindex}[ \\
+%       \fquad name=secondname, \\
+%       \fquad \textgreen{options=\{ -M lwarp.xdy \textgreen{-L english -c utf8} \}} \\
+%     ] \\
+%     \end{sourcedisplay}
+%     For the first compile, use
+%       \watchout[enable shell escape]
+%     \userentry{pdflatex \textred{-shell-escape} projectname.tex}
+%     \userentry{pdflatex \textred{-\/-enable-write18} projectname.tex \quad \textrm{(MikTeX)}}
+%     or similar with \prog{xelatex} or \prog{lualatex}.
+%     \prog{lwarp} will remember that shell escape was used.
+%
+%     \prog{imakeidx} will automatically execute \prog{splitindex} if selected,
+%       and will also use \prog{xindy} to compile the indexes.
+%
+%     If selected, \prog{latexmk} will automatically recompile the entire document
+%       as necessary.
+%
+% \needspace{14\baselineskip}
+% \item [For indexes using \prog{xindy} and \prog{imakeidx}, without shell escape,
+%   but \emph{with} \prog{latexmk}:] \
+%
+% \pkg{lwarp}'s options are used, and are passed to \prog{latexmk}.
+%
+%   \begin{sourcedisplay}
+%     \cs{usepackage}[ \\
+%         \fquad\textred{xindy,} \\
+%         \fquad \textgreen{xindyLanguage=english,}   \hfill \textrm{<optional>} \\
+%         \fquad \textgreen{xindyCodepage=utf8,}   \hfill \textrm{<optional>} \\
+%         \fquad\textred{latexmk,} \\
+%     ]\{\textblue{lwarp}\} \\
+%     \cs{usepackage}\textred{[xindy]}\{\textblue{imakeidx}\} \\
+%     \dots \\
+%     \cs{makeindex} \\
+%     \cs{makeindex}[name=secondname] \\
+%   \end{sourcedisplay}
+%   \prog{latexmk} will create the indexes automatically when
+%   \cmds{lwarpmk print} and \cmds{lwarpmk html} are executed.
+%
+% \needspace{20\baselineskip}
+% \item [For indexes using \prog{xindy} and \prog{imakeidx}, without shell escape,
+%   and \emph{without} \prog{latexmk}:] \
+%
+%   \prog{lwarpmk} must be told how to create the indexes:
+%   \begin{sourcedisplay}
+%     \cs{usepackage}[ \\
+%         \fquad\textred{xindy,} \\
+%         \fquad\textred{PrintIndexCmd}=\{ \\
+%             \fqquad xindy \textred{-M lwarp.xdy} \textgreen{-L english -C utf8} \\
+%               \fqqquad <projectname>.idx \textred{;} \\
+%             \fqquad xindy \textred{-M lwarp.xdy} \textgreen{-L english -C utf8} \\
+%               \fqqquad secondname.idx \\
+%         \fquad\}, \\
+%         \fquad\textred{HTMLIndexCmd}=\{ \\
+%             \fqquad xindy \textred{-M lwarp.xdy} \textgreen{-L english -C utf8} \\
+%             \fqqquad <projectname>\textred{\_html}.idx \textred{;} \\
+%             \fqquad xindy \textred{-M lwarp.xdy} \textgreen{-L english -C utf8} \\
+%             \fqqquad secondname\textred{\_html}.idx \\
+%         \fquad\} \\
+%     ]\{\textblue{lwarp}\} \\
+%     \cs{usepackage}\textred{[xindy]}\{\textblue{imakeidx}\} \\
+%     \dots \\
+%     \cs{makeindex} \\
+%     \cs{makeindex}[name=secondname] \\
+% \end{sourcedisplay}
+% \emph{For \brand{Windows}, replace the two ``;'' characters with ``\&''.}\watchout[\brand{Windows}]
+% 
+% \texttt{<projectname>} is the \cs{jobname}:
+% if compiling ``\filenm{name.tex}'', use the filenames \filenm{name.idx} and
+% \filenm{name\_html.idx}.
+%
+%     Use \userentry{lwarpmk printindex} \userentry{lwarpmk htmlindex}
+%     to compile the indexes.
+% \end{description}
+%
+%
+% \subsubsection{Indexes with \pkg{memoir}}
+%
+% \begin{description}
+% \needspace{7\baselineskip}
+% \item [For a single index with \pkg{memoir} and \pkg{makeindex}:]
+%   \begin{sourcedisplay}
+%       \cs{documentclass}\{\textblue{memoir}\} \\
+%       \cs{usepackage}\textred{[makeindex\textgreen{,latexmk}]}\{\textblue{lwarp}\} \\
+%       \dots \\
+%       \cs{makeindex}
+%   \end{sourcedisplay}
+%     The usual \filenm{.idx} and \filenm{.ind} files will be used,
+%     along with the \filenm{lwarp.ist} style file.
+%
+%     \prog{lwarpmk} will use \prog{latexmk} if specified, in which case
+%     \prog{latexmk} will create the index automatically.
+%     Otherwise, use \userentry{lwarpmk printindex} \userentry{lwarpmk htmlindex}
+%     to compile the indexes.
+%
+% \needspace{9\baselineskip}
+% \item [For multiple indexes with \pkg{memoir} and \pkg{makeindex},
+%   using \prog{latexmk}:] \
+%
+% \pkg{lwarp}'s options are used, and are passed to \prog{latexmk}.
+%   \begin{sourcedisplay}
+%       \cs{documentclass}\{\textblue{memoir}\} \\
+%       \cs{usepackage}\textred{[makeindex,latexmk]}\{\textblue{lwarp}\} \\
+%       \dots \\
+%       \cs{makeindex} \\
+%       \cs{makeindex}[secondname]
+%   \end{sourcedisplay}
+%     \prog{lwarpmk} will use \prog{latexmk} to create the indexes automatically
+%     when the user executes \cmds{lwarpmk print} and \cmds{lwarpmk html}.
+%
+% \needspace{19\baselineskip}
+% \item [For multiple indexes with \pkg{memoir} and \pkg{makeindex},
+%   \emph{without} \pkg{latexmk}:] \
+%
+%   \prog{lwarpmk} must be told how to create the indexes:
+%   \begin{sourcedisplay}
+%     \cs{documentclass}\{\textblue{memoir}\} \\
+%     \cs{usepackage}[ \\
+%         \fquad\textred{makeindex,} \\
+%         \fquad\textred{PrintIndexCmd}=\{ \\
+%             \fqquad makeindex \textred{-s lwarp.ist} <projectname>.idx \textred{;} \\
+%             \fqquad makeindex \textred{-s lwarp.ist} secondname.idx \\
+%         \fquad\}, \\
+%         \fquad\textred{HTMLIndexCmd}=\{ \\
+%             \fqquad makeindex \textred{-s lwarp.ist} <projectname>\textred{\_html}.idx \textred{;} \\
+%             \fqquad makeindex \textred{-s lwarp.ist} secondname\textred{\_html}.idx \\
+%         \fquad\} \\
+%     ]\{\textblue{lwarp}\} \\
+%     \dots \\
+%     \cs{makeindex} \\
+%     \cs{makeindex}[secondname] \\
+%   \end{sourcedisplay}
+%   \emph{For \brand{Windows}, replace the two ``;'' characters with ``\&''.}\watchout[\brand{Windows}]
+% 
+%   \texttt{<projectname>} is the \cs{jobname}:
+%   if compiling ``\filenm{name.tex}'', use the filenames \filenm{name.idx} and
+%   \filenm{name\_html.idx}.
+%
+%     Use \userentry{lwarpmk printindex} \userentry{lwarpmk htmlindex}
+%     to compile the indexes.
+%
+% \needspace{13\baselineskip}
+% \item [For a single index with \pkg{memoir} and \pkg{xindy}:]
+%       \begin{sourcedisplay}
+%       \cs{documentclass}\{\textblue{memoir}\} \\
+%       \cs{usepackage}[ \\
+%           \fqquad \textred{xindy,} \\
+%           \fqquad \textgreen{xindyLanguage=english,}   \hfill \textrm{<optional>} \\
+%           \fqquad \textgreen{xindyCodepage=utf8,}   \hfill \textrm{<optional>} \\
+%           \fqquad \textgreen{latexmk} \hfill \textrm{<optional>}\\
+%       ]\{\textblue{lwarp}\} \\
+%       \dots \\
+%       \textred{\cs{xindyindex}} \\
+%       \cs{makeindex}
+%       \end{sourcedisplay}
+%       The usual \filenm{.idx} and \filenm{.ind} files will be used,
+%       along with the \filenm{lwarp.xdy} style file.
+%
+%       \prog{lwarpmk} will use \prog{latexmk} if specified, in which case
+%       \prog{latexmk} will create the index automatically.
+%       Otherwise, use \userentry{lwarpmk printindex} \userentry{lwarpmk htmlindex}
+%       to compile the indexes.
+%
+% \needspace{17\baselineskip}
+% \item [For multiple indexes with \pkg{memoir} and \pkg{xindy},
+%   using \pkg{latexmk}:] \
+%
+% \pkg{lwarp}'s options are used, and are passed to \prog{latexmk}.
+%       \begin{sourcedisplay}
+%       \cs{documentclass}\{\textblue{memoir}\} \\
+%       \cs{usepackage}[ \\
+%           \fqquad \textred{xindy,} \\
+%           \fqquad \textgreen{xindyLanguage=english,}   \hfill \textrm{<optional>} \\
+%           \fqquad \textgreen{xindyCodepage=utf8,}   \hfill \textrm{<optional>} \\
+%           \fqquad \textred{latexmk} \\
+%       ]\{\textblue{lwarp}\} \\
+%       \dots \\
+%       \textred{\cs{xindyindex}} \\
+%       \cs{makeindex} \\
+%       \cs{makeindex}[secondname] \\
+%       \end{sourcedisplay}
+%       \prog{lwarpmk} will use \prog{latexmk} to create the indexes automatically.
+%
+% \needspace{24\baselineskip}
+% \item [For multiple indexes with \pkg{memoir} and \pkg{xindy},
+%   \emph{without} \pkg{latexmk}:] \
+%
+%   \prog{lwarpmk} must be told how to create the indexes:
+%   \begin{sourcedisplay}
+%     \cs{documentclass}\{\textblue{memoir}\} \\
+%     \cs{usepackage}[ \\
+%         \fquad\textred{xindy,} \\
+%         \fquad\textred{PrintIndexCmd}=\{ \\
+%             \fqquad xindy \textred{-M lwarp.xdy} \textgreen{-L english -C utf8} \\
+%               \fqqquad <projectname>.idx \textred{;} \\
+%             \fqquad xindy \textred{-M lwarp.xdy} \textgreen{-L english -C utf8} \\
+%               \fqqquad secondname.idx \\
+%         \fquad\}, \\
+%         \fquad\textred{HTMLIndexCmd}=\{ \\
+%             \fqquad xindy \textred{-M lwarp.xdy} \textgreen{-L english -C utf8} \\
+%             \fqqquad <projectname>\textred{\_html}.idx \textred{;} \\
+%             \fqquad xindy \textred{-M lwarp.xdy} \textgreen{-L english -C utf8} \\
+%             \fqqquad secondname\textred{\_html}.idx \\
+%         \fquad\} \\
+%     ]\{\textblue{lwarp}\} \\
+%     \dots \\
+%     \textred{\cs{xindyindex}} \\
+%     \cs{makeindex} \\
+%     \cs{makeindex}[secondname] \\
+%   \end{sourcedisplay}
+%   \emph{For \brand{Windows}, replace the four ``;'' characters with ``\&''.}\watchout[\brand{Windows}]
+% 
+%   \texttt{<projectname>} is the \cs{jobname}:
+%   if compiling ``\filenm{name.tex}'', use the filenames \filenm{name.idx} and
+%   \filenm{name\_html.idx}.
+%
+%     Use \userentry{lwarpmk printindex} \userentry{lwarpmk htmlindex}
+%     to compile the indexes.
+% \end{description}
+%
+%
+% \subsubsection{Using a custom \prog{makeindex} style file}
+% \label{sec:modifymakeindex}
+%
+% \DescribeProgram{makeindex}
+% \DescribeFile{lwarp.ist}
+% When using \prog{makeindex}, \prog{lwarpmk} uses the file |lwarp.ist| to process the index.
+% \index{lwarp.ist>customizing}
+% \index{makeindex>customizing}
+% \index{index>custom \pkg{makeindex} style file}
+% This file is over-written by \pkg{lwarp} whenever a print version of
+% the document is processed.
+%
+% To use a custom \prog{makeindex} style file:
+% \begin{enumerate}
+% \item Copy |lwarp.ist| to a new filename such as |projectname.ist|
+% \item Make changes to |projectname.ist|.
+%   Keep the lines which refer to \cs{hyperindexref}.
+%   These lines creates the hyperlinks for the \HTML\ index.  During print output
+%   \cs{hyperindexref} becomes a null function.
+% \item In the document source use the \optn{makeindexStyle} option for \pkg{lwarp}:
+% \DescribeOption{makeindexStyle}
+%   \begin{Verbatim}[gobble=2,tabsize=4]
+%       \usepackage[
+%           ... other options ...
+%           \textred{makeindexStyle=projectname.ist},
+%       ]{lwarp}
+%   \end{Verbatim}
+%   Likewise, refer to the custom style file if using \cs{PrintIndexCmd},
+%   \cs{HTMLIndexCmd}, or \cs{LatexmkIndexCmd}.
+% \item Recompile the print version, which causes
+%   \pkg{lwarp} to rewrite the |lwarpmk.conf| configuration file.
+%   This tells \prog{lwarpmk} to use the custom |projectname.ist| file
+% instead of |lwarp.ist|.
+% \end{enumerate}
+%
+%
+% \subsubsection{Using a custom \prog{xindy} style file}
+% \label{sec:modifyxindy}
+%
+% \DescribeProgram{xindy}
+% \DescribeFile{lwarp.xdy}
+% When using \prog{xindy}, \prog{lwarpmk} uses the file |lwarp.xdy| to process the index.
+% \index{lwarp.xdy>customizing}
+% \index{xindy>customizing}
+% \index{index>custom \pkg{xindy} style file}
+% This file is over-written by \pkg{lwarp} whenever a print version of
+% the document is processed.
+%
+% To use a custom \prog{xindy} style file:
+% \begin{enumerate}
+% \item Copy |lwarp.xdy| to a new filename such as |projectname.xdy|
+% \item Make changes to |projectname.xdy|.
+%
+%   Keep the lines which refer to \cs{hyperindexref}:
+%   \begin{Verbatim}[gobble=2,tabsize=4]
+%   (define-attributes (("hyperindexref")))
+%   (markup-locref :open "\hyperindexref{" :close "}")
+%   ...
+%   (markup-locref :open "\textit{\hyperindexref{" :close "}}" :attr "textit")
+%   \end{Verbatim}
+%   These lines create the hyperlinks for the \HTML\ index.  During print output
+%   \cs{hyperindexref} becomes a null function.
+%
+%   To create custom styles, refer to the lines for \cs{textbf} and \cs{textit}.
+% \item In the document source use the \optn{xindyStyle} option for \pkg{lwarp}:
+% \DescribeOption{xindyStyle}
+%   \begin{Verbatim}[gobble=2,tabsize=4]
+%       \usepackage[
+%           ... other options ...
+%           \textred{xindyStyle=projectname.xdy},
+%       ]{lwarp}
+%   \end{Verbatim}
+%   Likewise, refer to the custom style file if using \cs{PrintIndexCmd},
+%   \cs{HTMLIndexCmd}, or \cs{LatexmkIndexCmd}.
+% \item Recompile the print version, which causes
+%   \pkg{lwarp} to rewrite the |lwarpmk.conf| configuration file.
+%   This tells \prog{lwarpmk} to use the custom |projectname.xdy| file instead of |lwarp.xdy|.
+% \end{enumerate}
+% 
+% 
+% \subsubsection{Additional indexing limitations}
+% \prog{xindy} and \pkg{hyperref} may not work well together for print output
+% \margintag{\pkg{xindy} with \pkg{hyperref}}
+% with ``see'', ``see also'', reference ranges, or stylized index references.
+% It may be necessary to turn off hyper-referencing for indexes:
+% \begin{sourcedisplay}
+% \cs{usepackage}\textred{[hyperindex=false]}\{hyperref\}
+% \end{sourcedisplay}
+% 
+% If an \HTML\ index is empty, it may be necessary to add the following
+% \watchout[empty index]
+% before \pkg{lwarp} is loaded:
+% \index{index>empty}
+% \begin{sourcedisplay}
+% \textred{\cs{usepackage}\{morewrites\}} \\
+% \textred{\cs{morewritessetup}\{allocate=10\}} \\
+% \dots \\
+% \cs{usepackage}\{lwarp\}
+% \end{sourcedisplay}
+% 
+% When using \prog{makeindex}, custom display styles are possible:
+% \index{index>custom display styles}
+% \margintag{\prog{makeindex} custom display styles}
+% \begin{sourcedisplay}
+% \cs{begin}\{warpprint\} \\
+% \cs{newcommand}\{\cs{notesstyle}\}[1]\{\#1nn\} \\
+% \cs{end}\{warpprint\} \\
+% ~ \\
+% \cs{begin}\{warpHTML\} \\
+% \cs{makeatletter} \\
+% \cs{newcommand}\{\cs{notesstyle}\}[1]\{\cs{LWR at doindexentry}\{\#1\} notes \} \\
+% \cs{makeatother} \\
+% \cs{end}\{warpHTML\} \\
+% \dots \\
+% A sentence.\cs{index}\{key\textbar{}notesstyle\}
+% \end{sourcedisplay}
+% 
+% For custom styles with \prog{xindy},
+% \margintag{\prog{xindy} custom display styles}
+% see \filenm{lwarp.xdy} for \cs{textbf} and \cs{textit} as examples.
+%
+% 
+% \subsubsection{Index positions, \acro{TOC}, \pkg{tocbibind}}
+% \limitstocbibind
+%
+% \limitstocloft
+% 
+%
+%
 % \subsection{Math}
 %
 % \changes{v0.42}{2017/10/30}{Docs: Reorganized math limitations}
@@ -6646,7 +7599,7 @@
 % \limitsmemoir
 % \index{memoir>options clash}
 % \index{options clash, memoir}
-% \index{warning>Options clash, memoir}
+% \index{error>Options clash, memoir}
 %
 %
 % \subsection{Miscellaneous}
@@ -7378,6 +8331,7 @@
 % \changes{v0.16}{2016/04/08}{Docs: Text not converting.}
 % \changes{v0.34}{2017/08/08}{Docs: Misplaced alignment character.}
 % \changes{v0.42}{2017/10/13}{Docs: Improper \cs{prevdepth}.}
+% \changes{v0.58}{2018/06/07}{Docs: Misplaced \cs{omit}.}
 %
 % \begin{description}
 %
@@ -7407,9 +8361,18 @@
 %
 %       \item [Options clash:] If using \pkg{memoir}, see \cref{sec:limitsmemoir}.
 %
+%       \item [``No room for a new \cs{write}.'':] Before |\usepackage{lwarp}|, add:
+%           \index{error>No Room for a new \cs{write}.}
+%           \index{No room for a new \cs{write}.}
+%           \index{morewrites>No room for a new \cs{write}.}
+%           \begin{sourcedisplay}
+%           \cs{usepackage}\{morewrites\} \\
+%           \cs{morewritessetup}\{allocate=10\}
+%           \end{sourcedisplay}
+%
 %       \item [``Missing \$ inserted.'':] If using a filename or URL in a
 %           footnote or \cs{item}, escape underscores with \cs{\_}.
-%           \index{warning>Missing \$ inserted.}
+%           \index{error>Missing \$ inserted.}
 %           \index{Missing \$ inserted.}
 %
 %       \item [``Label(s) may have changed. Rerun to get cross-references right.'':] \
@@ -7419,17 +8382,17 @@
 %           \begin{sourcedisplay}
 %           \cs{textit}\{X\}\cs{,}=\cs{,}1
 %           \end{sourcedisplay}
-%           \index{warning>Label(s) may have changed.}
+%           \index{error>Label(s) may have changed.}
 %           \index{Label(s) may have changed}
 %
 %         \item [``Leaders not followed by proper glue'':] This can be caused by
 %         a missing |l@<floattype>| or |l@<sectiontype>| definition.
 %         See \pkg{lwarp}'s definitions for examples.
-%           \index{warning>Leaders not followed by proper glue.}
+%           \index{error>Leaders not followed by proper glue.}
 %           \index{Leaders not followed by proper glue.}
 % 
 %         \item [``Improper \cs{prevdepth}'':]
-%           \index{warning>Improper \cs{prevdepth}.}
+%           \index{error>Improper \cs{prevdepth}.}
 %           \index{Improper \cs{prevdepth}.}
 %           \env{lateximage}s and \SVG\ math require \cs{newpage}, which
 %           cannot work inside \TeX\ boxes or \cs{ensuremath}.
@@ -7464,6 +8427,12 @@
 %           \dots \\
 %           \cs{end}\{equation\}
 %           \end{sourcedisplay}
+%
+%       \item[``\texttt{Misplaced \cs{omit}}'':] If using \cs{LWR at formatted} to
+%           \watchout[\cs{LWR at formatted}]
+%           define new macros for print and \HTML\ modes, see \cref{sec:definingprinthtml}
+%           regarding \cs{LWR at expandableformatted}.
+%
 %       \item[Complicated objects inside display math:] Some objects, such as \tikz,
 %           \watchout[display math]
 %           may not compile in \pkg{lwarp}'s normal display math emulation.
@@ -7906,8 +8875,21 @@
 %    \end{macrocode}
 % \end{macro}
 
+
+% \begin{macro}{\LWR at patcherror} \marg{packagename} \marg{macroname}
 %
+% Prints an error if could not patch a macro.
+%    \begin{macrocode}
+\newcommand*{\LWR at patcherror}[2]{%
+\PackageError{lwarp}
+{Unable to patch package #1, macro #2}
+{Please contact the author of the lwarp package.}
+}
+%    \end{macrocode}
+% \end{macro}
+
 %
+%
 % \section{Early package requirements}
 %
 % \DescribePackage{etoolbox}
@@ -8017,6 +8999,7 @@
 %    \end{macrocode}
 
 
+
 % \DescribeBoolean{warpingprint}
 % \DescribeBoolean{warpingHTML}
 % \DescribeBoolean{mathjax}
@@ -8124,7 +9107,34 @@
 %    \end{macrocode}
 
 
+% \DescribeOption{makeindexStyle} Selects a custom |.ist| file.
+% The default is |lwarp.ist|.
+% A customized file should be based on |lwarp.ist|, and must retain
+% the lines related to \cs{hyperindexref}.
+%
+% \changes{v0.58}{2018/06/21}{Added option \optn{makeindexStyle.}}
+%
+%    \begin{macrocode}
+\DeclareStringOption[lwarp.ist]{makeindexStyle}
+%    \end{macrocode}
 
+
+% \DescribeOption{xindyStyle} Selects a custom |.xdy| file.
+% The default is |lwarp.xdy|.
+% A customized file should be based on |lwarp.xdy|, and must retain
+% the line
+% \begin{Verbatim}[gobble=2]
+% (markup-locref :open "\hyperindexref{" :close "}")
+% \end{Verbatim}
+%
+% \changes{v0.30}{2017/04/28}{Option \optn{xdyFilename} added.}
+% \changes{v0.54}{2018/04/06}{Option \optn{xdyFilename} changed to \optn{xindyStyle.}}
+%
+%    \begin{macrocode}
+\DeclareStringOption[lwarp.xdy]{xindyStyle}
+%    \end{macrocode}
+
+
 % \DescribeOption{xindyLanguage} Sets the \pkg{xindy} language to be assigned
 %	in \prog{lwarpmk}'s configuration files.  This is then used by \prog{lwarpmk} while
 %	processing the index and glossary.
@@ -8140,7 +9150,8 @@
 
 % \DescribeOption{xindyCodepage} Sets the \pkg{xindy} codepage to be assigned
 %   in \prog{lwarpmk}'s configuration files.  This is then used by \prog{lwarpmk} while
-%   processing the index and glossary.
+%   processing the index.
+% ^^A and glossary.
 %
 % \changes{v0.54}{2018/04/06}{Add: \optn{xindyCodepage}.}
 %
@@ -8150,22 +9161,6 @@
 
 
 
-% \DescribeOption{xindyStyle} Selects a custom |.xdy| file.
-% The default is |lwarp.xdy|.
-% A customized file should be based on |lwarp.xdy|, and must retain
-% the line
-% \begin{Verbatim}[gobble=2]
-% (markup-locref :open "\hyperindexref{" :close "}")
-% \end{Verbatim}
-%
-% \changes{v0.30}{2017/04/28}{Option \optn{xdyFilename} added.}
-% \changes{v0.54}{2018/04/06}{Option \optn{xdyFilename} changed to \optn{xindyStyle.}}
-%
-%    \begin{macrocode}
-\DeclareStringOption[lwarp.xdy]{xindyStyle}
-%    \end{macrocode}
-
-
 % \limitspdftotextenc
 %
 % \changes{v0.54}{2018/04/06}{Add: \optn{pdftotextEnc}.}
@@ -8237,6 +9232,67 @@
 
 
 
+% \DescribeOption{PrintIndexCmd} \DescribeDefault{<empty>}
+% The shell commands to use to compile the print indexes.
+%
+%    \begin{macrocode}
+\DeclareStringOption[]{PrintIndexCmd}
+%    \end{macrocode}
+
+% \DescribeOption{HTMLIndexCmd} \DescribeDefault{<empty>}
+% The shell commands to use to compile the \HTML\ indexes.
+%
+%    \begin{macrocode}
+\DeclareStringOption[]{HTMLIndexCmd}
+%    \end{macrocode}
+
+
+% \DescribeOption{LatexmkIndexCmd} \DescribeDefault{<empty>}
+% The shell commands to by used by \prog{latexmk} to compile the print indexes.
+% Unlike \optn{PrintIndexCmd} and \optn{HTMLIndexCmd},
+% \optn{LatexmkIndexCmd} does not include the filename, which will be
+% provided by \prog{latexmk}.
+%
+%    \begin{macrocode}
+\DeclareStringOption[]{LatexmkIndexCmd}
+%    \end{macrocode}
+
+% \DescribeOption{makeindex} Tells \pkg{lwarp} to
+%   use \pkg{makeindex} for index generation.
+%   When \filenm{lwarpmk.conf} and \filenm{*.lwarpmkconf} are generated,
+%   \optn{PrintIndexCmd} and \optn{HTMLIndexCmd} will be set for \prog{makeindex}
+%   with a single index file.
+% \changes{v0.58}{2018/06/20}{Added \optn{makeindex} option.}
+%    \begin{macrocode}
+\DeclareBoolOption[false]{makeindex}
+%    \end{macrocode}
+
+
+% \DescribeOption{xindy} Tells \pkg{lwarp} to
+%   use \pkg{xindy} for index generation.
+%   When \filenm{lwarpmk.conf} and \filenm{*.lwarpmkconf} are generated,
+%   \optn{PrintIndexCmd} and \optn{HTMLIndexCmd} will be set for \prog{xindy}
+%   with a single index file.
+% \changes{v0.58}{2018/06/20}{Added \optn{xindy} option.}
+%    \begin{macrocode}
+\DeclareBoolOption[false]{xindy}
+%    \end{macrocode}
+
+
+% \DescribeOption{GlossaryCmd} \DescribeDefault{makeglossaries}
+% The shell command to use to compile the glossary.
+% The print or \HTML\ version of the glossary filename will be appended to this command.
+%
+%    \begin{macrocode}
+\DeclareStringOption[makeglossaries]{GlossaryCmd}
+%    \end{macrocode}
+
+
+
+
+
+
+
 % \DescribeOption{latexmk}
 % Option \optn{latexmk} tells \prog{lwarpmk} to use \prog{latexmk} when compiling documents.
 %
@@ -8273,10 +9329,61 @@
 % 
 %
 %
-% \subsection{Conditional compilation}
+% \cs{LWR at PrintIndexCmd} and \cs{LWR at HTMLIndexCmd} are tested to see if they are empty.
+% If so, they are set to a reasonable defaults for a single index using \prog{makeindex},
+% then possibly set to defaults for \prog{xindy}
+% if the \pkg{lwarp} \optn{xindy} option was selected.
 %
+%    \begin{macrocode}
+\ifdefempty{\LWR at PrintIndexCmd}{
+    \renewcommand{\LWR at PrintIndexCmd}{%
+        makeindex  -s \LWR at makeindexStyle \space  \jobname.idx%
+    }
+    \ifbool{LWR at xindy}{
+        \renewcommand{\LWR at PrintIndexCmd}{%
+            xindy
+            -M \LWR at xindyStyle \space
+            -L \LWR at xindyLanguage \space
+            -C \LWR at xindyCodepage \space
+            \jobname.idx%
+        }
+    }{}
+}{}
+
+\ifdefempty{\LWR at HTMLIndexCmd}{
+    \renewcommand{\LWR at HTMLIndexCmd}{%
+        makeindex  -s \LWR at makeindexStyle \space  \jobname_html.idx%
+    }
+    \ifbool{LWR at xindy}{
+        \renewcommand{\LWR at HTMLIndexCmd}{%
+            xindy
+            -M \LWR at xindyStyle \space
+            -L \LWR at xindyLanguage \space
+            -C \LWR at xindyCodepage \space
+            \jobname_html.idx%
+        }
+    }{}
+}{}
+
+\ifdefempty{\LWR at LatexmkIndexCmd}{
+    \renewcommand{\LWR at LatexmkIndexCmd}{%
+        makeindex  -s \LWR at makeindexStyle%
+    }
+    \ifbool{LWR at xindy}{
+        \renewcommand{\LWR at LatexmkIndexCmd}{%
+            xindy
+            -M \LWR at xindyStyle \space
+            -L \LWR at xindyLanguage \space
+            -C \LWR at xindyCodepage%
+        }
+    }{}
+}{}
+%    \end{macrocode}
 %
 %
+%
+% \subsection{Conditional compilation}
+%
 % \begin{macro}{\warpprintonly} \marg{contents}
 %
 % Only process the contents if producing printed output.
@@ -8517,6 +9624,7 @@
 % \changes{v0.25}{2017/03/16}{Fix: Allows XE\LaTeX\ and
 %	\LuaLaTeX\ to preload graphics and graphicx.}
 % \changes{v0.45}{2017/12/03}{Allows \pkg{memoir}'s preloaded packages.}
+% \changes{v0.58}{2018/06/21}{Fix: \pkg{memoir} and \pkg{ccaption}.}
 %
 % The following packages must be loaded after \pkg{lwarp}:
 % ^^A *loadafter
@@ -8543,6 +9651,8 @@
 \LWR at loadafter{arabicfront}
 \LWR at notmemoirloadafter{array}
 % \LWR at loadafter{atbegshi}% used by morewrites
+\LWR at loadafter{attachfile}
+\LWR at loadafter{attachfile2}
 \LWR at loadafter{authblk}
 \LWR at loadafter{axodraw2}
 \LWR at loadafter{backref}
@@ -8559,7 +9669,8 @@
 \LWR at loadafter{cancel}
 \LWR at loadafter{caption}
 \LWR at loadafter{caption2}
-\LWR at loadafter{ccaption}
+\LWR at loadafter{cases}
+% \LWR at loadafter{ccaption}% may be preloaded by memoir
 \LWR at loadafter{changebar}
 \LWR at notmemoirloadafter{changepage}
 \LWR at notmemoirloadafter{chngpage}
@@ -8649,9 +9760,12 @@
 \LWR at loadafter{hyphenat}
 \LWR at loadafter{idxlayout}
 \LWR at loadafter{ifoddpage}
+\LWR at loadafter{imakeidx}
 \LWR at loadafter{indentfirst}
+\LWR at notmemoirloadafter{index}
 % inputenc must be loaded before lwarp
 % inputenx must be loaded before lwarp
+\LWR at loadafter{intopdf}
 \LWR at loadafter{keyfloat}
 \LWR at loadafter{layout}
 \LWR at loadafter{letterspace}
@@ -8669,6 +9783,7 @@
 \LWR at loadafter{luacolor}
 \LWR at loadafter{luatodonotes}
 \LWR at loadafter{magaz}
+\LWR at notmemoirloadafter{makeidx}
 \LWR at loadafter{marginfit}
 \LWR at loadafter{marginfix}
 \LWR at loadafter{marginnote}
@@ -8710,7 +9825,9 @@
 \LWR at loadafter{pbox}
 \LWR at loadafter{pdfrender}
 \LWR at loadafter{pdflscape}
+\LWR at loadafter{pdfpages}
 \LWR at loadafter{pdfsync}
+\LWR at loadafter{pdfx}
 \LWR at loadafter{pfnote}
 \LWR at loadafter{phfqit}
 \LWR at loadafter{placeins}
@@ -8723,6 +9840,7 @@
 \LWR at loadafter{realscripts}
 \LWR at loadafter{register}
 \LWR at loadafter{relsize}
+\LWR at loadafter{repeatindex}
 \LWR at loadafter{resizegather}
 \LWR at loadafter{romanbar}
 \LWR at loadafter{romanbarpagenumber}
@@ -8749,6 +9867,7 @@
 \LWR at loadafter{soul}
 \LWR at loadafter{soulpos}
 \LWR at loadafter{soulutf8}
+\LWR at loadafter{splitidx}
 \LWR at loadafter{stabular}
 \LWR at loadafter{stfloats}
 \LWR at loadafter{subfig}
@@ -9160,13 +10279,6 @@
 %    \end{macrocode}
 
 
-% \DescribePackage{makeidx}
-%    \begin{macrocode}
-\RequirePackage{makeidx}
-\makeindex
-%    \end{macrocode}
-
-
 % \DescribePackage{calc}
 %    \begin{macrocode}
 \RequirePackage{calc}
@@ -9228,14 +10340,12 @@
 % \DescribePackage{amsmath}
 % Preloaded to avoid options clash and to add patches.
 %
-% \changes{v0.16}{2016/04/09}{Fix: amsmath options clash}
+% ^^A \changes{v0.16}{2016/04/09}{Fix: amsmath options clash}
 %
-% Equation numbers are placed to the left for \HTML.
-%
-% \pkg{newtxmath} automatically loads \pkg{amsmath},
-% so the option \optn{leqno} is passed beforehand to be
-% picked up both here and by \pkg{newtxmath} if it is used.
-% \changes{v0.16}{2016/04/11}{Fix: newtxmath compatibility.}
+% ^^A \pkg{newtxmath} automatically loads \pkg{amsmath},
+% ^^A so the option \optn{leqno} is passed beforehand to be
+% ^^A picked up both here and by \pkg{newtxmath} if it is used.
+% ^^A \changes{v0.16}{2016/04/11}{Fix: newtxmath compatibility.}
 % \changes{v0.33}{2016/06/21}{\pkg{amsmath}: Removed \optn{fleqn} option.}
 %
 % ^^A *8* remove leqno and references
@@ -9765,7 +10875,9 @@
 % 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.
+% other places.  The copies of the print versions may also be used by the \HTML\
+% versions, such as when the \HTML\ version merely encloses the print version
+% inside \HTML\ tags.
 %
 % The general structure for providing print and \HTML\ versions of a macro or
 % environment is as follows:
@@ -9882,7 +10994,10 @@
 % 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:
+% Expandable versions are also provided as well.
+% These areusually necessary for anything which could appear inside a \env{tabular},
+% without which an |Misplaced \omit| error may occur.
+% \watchout[Misplaced \cs{omit} error]
 % \begin{sourcedisplay}
 % \cs{LWR at expandableformatted} \\
 % \cs{LWR at expandableformattedenv}
@@ -9926,11 +11041,11 @@
     }{}%
     \ifcsundef{#1}{%
         \expandafter\newrobustcmd\csname #1\endcsname{%
-            \csuse{LWR@\LWR at formatting @#1}%
+            \@nameuse{LWR@\LWR at formatting @#1}%
         }%
     }{%
         \expandafter\renewrobustcmd\csname #1\endcsname{%
-            \csuse{LWR@\LWR at formatting @#1}%
+            \@nameuse{LWR@\LWR at formatting @#1}%
         }%
     }%
 }
@@ -9950,11 +11065,11 @@
     }{}%
     \ifcsundef{#1}{%
         \expandafter\newcommand\csname #1\endcsname{%
-            \csuse{LWR@\LWR at formatting @#1}%
+            \@nameuse{LWR@\LWR at formatting @#1}%
         }%
     }{%
         \expandafter\renewcommand\csname #1\endcsname{%
-            \csuse{LWR@\LWR at formatting @#1}%
+            \@nameuse{LWR@\LWR at formatting @#1}%
         }%
     }%
 }
@@ -9976,8 +11091,8 @@
         \csletcs{endLWR at print@#1}{end#1}%
     }{}%
     \DeclareDocumentEnvironment{#1}{}%
-    {\csuse{LWR@\LWR at formatting @#1}}%
-    {\csuse{endLWR@\LWR at formatting @#1}}%
+    {\@nameuse{LWR@\LWR at formatting @#1}}%
+    {\@nameuse{endLWR@\LWR at formatting @#1}}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -9993,8 +11108,8 @@
         \csletcs{endLWR at print@#1}{end#1}%
     }{}%
     \DeclareExpandableDocumentEnvironment{#1}{}%
-    {\csuse{LWR@\LWR at formatting @#1}}%
-    {\csuse{endLWR@\LWR at formatting @#1}}%
+    {\@nameuse{LWR@\LWR at formatting @#1}}%
+    {\@nameuse{endLWR@\LWR at formatting @#1}}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -10222,7 +11337,6 @@
 \let\LWR at origenskip\enskip
 \let\LWR at origquad\quad
 \let\LWR at origqquad\qquad
-\let\LWR at orighfill\hfill
 \let\LWR at orighfil\hfil
 \let\LWR at orighss\hss
 \let\LWR at origllap\llap
@@ -10229,25 +11343,11 @@
 \let\LWR at origrlap\rlap
 \let\LWR at orighfilneg\hfilneg
 
-\let\LWR at orighrulefill\hrulefill
-\let\LWR at origdotfill\dotfill
-
 \let\LWR at origmedskip\medskip
 \let\LWR at origbigskip\bigskip
 
 \let\LWR at origtextellipsis\textellipsis
 
-\let\LWR at orignormalsize\normalsize
-\let\LWR at origsmall\small
-\let\LWR at origfootnotesize\footnotesize
-\let\LWR at origscriptsize\scriptsize
-\let\LWR at origtiny\tiny
-\let\LWR at origlarge\large
-\let\LWR at origLarge\Large
-\let\LWR at origLARGE\LARGE
-\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
@@ -10272,7 +11372,6 @@
 \LetLtxMacro\LWR at origem\em
 \LetLtxMacro\LWR at orignormalfont\normalfont
 
-\let\LWR at origraggedright\raggedright
 \let\LWR at origonecolumn\onecolumn
 
 \let\LWR at origsp\sp
@@ -10288,13 +11387,7 @@
 \LetLtxMacro\LWR at origunderline\underline
 %    \end{macrocode}
 %
-% \changes{v0.50}{2018/02/22}{Fix: \cs{centering}, etc. in \SVG\ math, \env{lateximage}, \tikz.}
 %    \begin{macrocode}
-\let\LWR at origraggedright\raggedright
-\let\LWR at origraggedleft\raggedleft
-\let\LWR at origcentering\centering
-%    \end{macrocode}
-%    \begin{macrocode}
 \let\LWR at orignewpage\newpage
 
 \let\LWR at origpagestyle\pagestyle
@@ -10476,15 +11569,6 @@
 % which is the default unless the \optn{warpHTML} option is given.
 % |lwarpmk.conf| is then used by the utility \prog{lwarpmk}.
 %
-% An example |lwarpmk.conf|:
-% \begin{Verbatim}[gobble=2,frame=lines,obeytabs,tabsize=4,formatcom={\unskip}]
-% opsystem = "Unix"   -- or "Windows"
-% latexname = "pdflatex"   -- or "lualatex" or "xelatex"
-% sourcename = "projectname"   -- your .tex source
-% homehtmlfilename = "index"   -- or "projectname"
-% htmlfilename = ""   -- or "projectname" if numbered HTML files
-% \end{Verbatim}
-%
 % \changes{v0.29}{2017/04/15}{\filenm{lwarpmk.conf}: Add: \optn{language}
 %       option for config files.}
 % \changes{v0.54}{2018/04/06}{\filenm{lwarpmk.conf}: Option \optn{xdyFilename} changed to \optn{xindyStyle}.}
@@ -10492,10 +11576,14 @@
 % \changes{v0.54}{2018/04/06}{\filenm{lwarpmk.conf}: Option \optn{xindyCodepage} added.}
 % \changes{v0.54}{2018/04/06}{\filenm{lwarpmk.conf}: Option \optn{pdftotextEnc} added.}
 % \changes{v0.56}{2018/05/11}{\filenm{lwarpmk.conf}: Records \texttt{-shell-escape}.}
+% \changes{v0.58}{2018/06/20}{\filenm{lwarpmk.conf}: Generated \cs{AtBeginDocument}.}
+% \changes{v0.58}{2018/06/20}{\filenm{lwarpmk.conf}: Added options \optn{makeindex} and \optn{xindy}.}
+% \changes{v0.58}{2018/06/21}{\filenm{lwarpmk.conf}: Added option \optn{makeindexstyle}.}
 %
 % \codeprint
 %    \begin{macrocode}
 \begin{warpprint}
+\AtBeginDocument{
 \ifcsdef{LWR at quickfile}{}{\newwrite{\LWR at quickfile}}
 \immediate\openout\LWR at quickfile=lwarpmk.conf
 \ifbool{usingOSWindows}{
@@ -10519,11 +11607,19 @@
 \immediate\write\LWR at quickfile{htmlfilename = "\HTMLFilename"}
 \immediate\write\LWR at quickfile{latexmk = "\ifbool{LWR at latexmk}{true}{false}"}
 \immediate\write\LWR at quickfile{shellescape = "\ifshellescape true\else false\fi"}
-\immediate\write\LWR at quickfile{xindylanguage = "\LWR at xindyLanguage"}
-\immediate\write\LWR at quickfile{xindycodepage = "\LWR at xindyCodepage"}
-\immediate\write\LWR at quickfile{xindystyle = "\LWR at xindyStyle"}
+\immediate\write\LWR at quickfile{printindexcmd = "\LWR at PrintIndexCmd"}
+\immediate\write\LWR at quickfile{HTMLindexcmd = "\LWR at HTMLIndexCmd"}
+\immediate\write\LWR at quickfile{latexmkindexcmd = "\LWR at LatexmkIndexCmd"}
+\immediate\write\LWR at quickfile{glossarycmd = "\LWR at GlossaryCmd"}
+%    \end{macrocode}
+% ^^A \immediate\write\LWR at quickfile{makeindexstyle = "\LWR at makeindexStyle"}
+% ^^A  \immediate\write\LWR at quickfile{xindylanguage = "\LWR at xindyLanguage"}
+% ^^A  \immediate\write\LWR at quickfile{xindycodepage = "\LWR at xindyCodepage"}
+% ^^A  \immediate\write\LWR at quickfile{xindystyle = "\LWR at xindyStyle"}
+%    \begin{macrocode}
 \immediate\write\LWR at quickfile{pdftotextenc = "\LWR at pdftotextEnc"}
 \immediate\closeout\LWR at quickfile
+}% AtBeginDocument
 \end{warpprint}
 %    \end{macrocode}
 
@@ -10540,9 +11636,15 @@
 % \changes{v0.54}{2018/04/06}{\filenm{*.lwarpmkconf}: Option \optn{xindyCodepage} added.}
 % \changes{v0.54}{2018/04/06}{\filenm{*.lwarpmkconf}: Option \optn{pdftotextEnc} added.}
 % \changes{v0.56}{2018/05/11}{\filenm{*.lwarpmkconf}: Records \texttt{-shell-escape}.}
+% \changes{v0.58}{2018/06/20}{\filenm{*.lwarpmkconf}: Generated \cs{AtBeginDocument}.}
+% \changes{v0.58}{2018/06/20}{\filenm{*.lwarpmkconf}: Added options \optn{makeindex} and \optn{xindy}.}
+% \changes{v0.58}{2018/06/21}{\filenm{*.lwarpmkconf}: Added option \optn{makeindexstyle}.}
 %
+% The \optn{makeindex} and \optn{xindy} options have already previously been handled
+%   for \filenm{lwarp.conf}.
 %    \begin{macrocode}
 \begin{warpprint}
+\AtBeginDocument{
 \ifcsdef{LWR at quickfile}{}{\newwrite{\LWR at quickfile}}
 \immediate\openout\LWR at quickfile=\jobname.lwarpmkconf
 \ifbool{usingOSWindows}{
@@ -10566,11 +11668,19 @@
 \immediate\write\LWR at quickfile{htmlfilename = "\HTMLFilename"}
 \immediate\write\LWR at quickfile{latexmk = "\ifbool{LWR at latexmk}{true}{false}"}
 \immediate\write\LWR at quickfile{shellescape = "\ifshellescape true\else false\fi"}
-\immediate\write\LWR at quickfile{xindylanguage = "\LWR at xindyLanguage"}
-\immediate\write\LWR at quickfile{xindycodepage = "\LWR at xindyCodepage"}
-\immediate\write\LWR at quickfile{xindystyle = "\LWR at xindyStyle"}
+\immediate\write\LWR at quickfile{printindexcmd = "\LWR at PrintIndexCmd"}
+\immediate\write\LWR at quickfile{HTMLindexcmd = "\LWR at HTMLIndexCmd"}
+\immediate\write\LWR at quickfile{latexmkindexcmd = "\LWR at LatexmkIndexCmd"}
+\immediate\write\LWR at quickfile{glossarycmd = "\LWR at GlossaryCmd"}
+%    \end{macrocode}
+%  ^^A \immediate\write\LWR at quickfile{makeindexstyle = "\LWR at makeindexStyle"}
+%  ^^A \immediate\write\LWR at quickfile{xindylanguage = "\LWR at xindyLanguage"}
+%  ^^A \immediate\write\LWR at quickfile{xindycodepage = "\LWR at xindyCodepage"}
+%  ^^A \immediate\write\LWR at quickfile{xindystyle = "\LWR at xindyStyle"}
+%    \begin{macrocode}
 \immediate\write\LWR at quickfile{pdftotextenc = "\LWR at pdftotextEnc"}
 \immediate\closeout\LWR at quickfile
+}% AtBeginDocument
 \end{warpprint}
 %    \end{macrocode}
 
@@ -12577,7 +13687,49 @@
 %    \end{macrocode}
 
 
+% \subsection{lwarp.ist}
 
+% \DescribeFile{lwarp.ist}
+% Used to modify the index for \pkg{lwarp}.
+%
+% This must be present when compiling the project,
+% but does not need to be present when distributing
+% the resulting \HTML\ files.
+%
+% The page compositor line is for \pkg{memoir}'s \cs{specialindex}.
+%
+% \changes{v0.58}{2018/06/17}{\filenm{lwarp\_html.ist}: Added.}
+%
+% ^^A *lwarp.ist
+%    \begin{macrocode}
+\begin{warpprint}
+\begin{filecontents*}{lwarp.ist}
+preamble
+"\\begin{theindex}
+  \\providecommand*\\lettergroupDefault[1]{}
+  \\providecommand*\\lettergroup[1]{%
+      \\par\\textbf{#1}\\par
+      \\nopagebreak
+  }
+"
+headings_flag 1
+heading_prefix "
+  \\lettergroup{"
+heading_suffix "}"
+delim_0 ", \\hyperindexref{"
+delim_1 ", \\hyperindexref{"
+delim_2 ", \\hyperindexref{"
+delim_n "}, \\hyperindexref{"
+delim_r "} -- \\hyperindexref{"
+delim_t "}"
+page_compositor "."
+\end{filecontents*}
+% \end{Verbatim}% for syntax highlighting
+\end{warpprint}
+%    \end{macrocode}
+
+
+
 % \subsection{lwarp.xdy}
 
 % \DescribeFile{lwarp.xdy}
@@ -12587,8 +13739,14 @@
 % but does not need to be present when distributing
 % the resulting \HTML\ files.
 %
+% See: \\
+% \href{https://tex.stackexchange.com/questions/80300/how-can-i-convince-hyperref-and-xindy-to-play-together-nicely}
+% {https://tex.stackexchange.com/questions/80300/ \\ \fqquad\ how-can-i-convince-hyperref-and-xindy-to-play-together-nicely}
+%
 % \changes{v0.30}{2017/04/28}{File: \filenm{lwarp\_html.xdy} renamed to \filenm{lwarp.xdy}.}
 % \changes{v0.30}{2017/04/26}{Fix: \filenm{lwarp.xdy} only written in print mode.}
+% \changes{v0.58}{2018/06/19}{\filenm{lwarp.xdy}: Requires \filenm{makeindex.xdy}.}
+% \changes{v0.58}{2018/06/21}{\filenm{lwarp.xdy}: Supports bold, italic.}
 %
 % ^^A *lwarp.xdy
 %    \begin{macrocode}
@@ -12599,10 +13757,14 @@
 (require "texindy.xdy")
 (require "page-ranges.xdy")
 (require "book-order.xdy")
-(require "page-ranges.xdy")
-(markup-locref :open "\hyperindexref{" :close "}")
 (define-location-class "arabic-page-numbers"
     ("arabic-numbers") :min-range-length 1)
+(require "makeindex.xdy")
+(define-attributes (("hyperindexref")))
+(markup-locref :open "\hyperindexref{" :close "}")
+(markup-locref :open "\hyperindexref{" :close "}" :attr "hyperpage")
+(markup-locref :open "\textbf{\hyperindexref{" :close "}}" :attr "textbf")
+(markup-locref :open "\textit{\hyperindexref{" :close "}}" :attr "textit")
 (define-location-class-order ("roman-page-numbers"
                   "arabic-page-numbers"
                   "alpha-page-numbers"
@@ -12840,6 +14002,11 @@
 % \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.}
+% \changes{v0.58}{2018/06/14}{\prog{lwarpmk}: Added \texttt{-p} option for project name.}
+% \changes{v0.58}{2018/06/14}{\prog{lwarpmk}: Added optional list of names for \cmds{lwarpmk printindex} and /cmds{lwarpmk htmlindex}.}
+% \changes{v0.58}{2018/06/18}{\prog{lwarpmk}: Glossary generation now uses \prog{makeglossaries}.}
+% \changes{v0.58}{2018/06/20}{\prog{lwarpmk}: Added \optn{makeindex} and \optn{xindy} options.}
+% \changes{v0.58}{2018/06/20}{\prog{lwarpmk}: \cmds{lwarpmk clean} removes all \filenm{*.ind} and \filenm{*.idx} files.}
 %
 % The following is only generated if the \optn{lwarpmk} option
 %   was given to \pkg{lwarp}.
@@ -12855,7 +14022,7 @@
 -- Copyright 2016-2018 Brian Dunn
 
 
-printversion = "v0.57"
+printversion = "v0.58"
 
 
 function printhelp ()
@@ -12869,59 +14036,65 @@
 --
 print ( [[
 
-lwarpmk print [project]: Compile the print version if necessary.
-lwarpmk print1 [project]: Forced single compile of the print version.
-lwarpmk printindex [project]: Process the index for the print version.
-lwarpmk printglossary [project]: Process the glossary for the print version.
-lwarpmk html [project]: Compile the HTML version if necessary.
-lwarpmk html1 [project]: Forced single compile of the HTML version.
-lwarpmk htmlindex [project]: Process the index for the html version.
-lwarpmk htmlglossary [project]: Process the glossary for the html version.
-lwarpmk again [project]: Touch the source code to trigger recompiles.
-lwarpmk limages [project]: Process the "lateximages" created by lwarp.sty.
-lwarpmk pdftohtml [project]:
+lwarpmk print [-p project]: Compile the print version if necessary.
+lwarpmk print1 [-p project]: Forced single compile of the print version.
+lwarpmk printindex [-p project]: Process print indexes.
+lwarpmk printglossary [-p project]: Process the glossary for the print version.
+lwarpmk html [-p project]: Compile the HTML version if necessary.
+lwarpmk html1 [-p project]: Forced single compile of the HTML version.
+lwarpmk htmlindex [-p project]: Process HTML indexes.
+lwarpmk htmlglossary [-p project]: Process the glossary for the html version.
+lwarpmk again [-p project]: Touch the source code to trigger recompiles.
+lwarpmk limages [-p project]: Process the "lateximages" created by lwarp.sty.
+lwarpmk pdftohtml [-p project]:
     For use with latexmk or a Makefile:
     Converts project_html.pdf to project_html.html and individual HTML files.
     Finishes the HTML conversion even if there was a compile error.
 lwarpmk pdftosvg <list of file names>: Converts each PDF file to SVG.
-lwarpmk clean [project]: Remove .aux, .toc, .lof/t, .idx, .ind, .log, *_html_inc.*, .gl*
-lwarpmk cleanall [project]: Remove auxiliary files and also project.pdf, *.html
+lwarpmk clean [-p project]: Remove .aux, .toc, .lof/t, .idx, .ind, .log, *_html_inc.*, .gl*
+lwarpmk cleanall [-p project]: Remove auxiliary files and also project.pdf, *.html
 lwarpmk cleanlimages: Removes all images from the "lateximages" directory.
 lwarpmk -h: Print this help message.
 lwarpmk --help: Print this help message.
 
 ]] )
-printconf ()
+-- printconf ()
 end
 
 
-function printconf ()
---
--- Print the format of the configuration file lwarpmk.conf:
---
-print ( [[
-An example lwarpmk.conf or <project>.lwarpmkconf project file:
---
-opsystem = "Unix"   (or "Windows")
-latexname = "pdflatex"  (or "lualatex", or "xelatex")
-sourcename = "projectname"  (the source-code filename w/o .tex)
-homehtmlfilename = "index"  (or perhaps the project name)
-htmlfilename = ""  (or "projectname" - filename prefix)
-latexmk = "false"  (or "true" to use latexmk to build PDFs)
-shellescape = "false"
-xindylanguge = "english"  (use a language supported by xindy)
-xindycodepage = "utf8"  (use a codepage supported by xindy)
-xindystyle = "lwarp.xdy" (or a custom file based on lwarp.xdy)
-pdftotextenc = "UTF-8"  (use an encoding supported by pdftotext)
---
-Filenames must contain only letters, numbers, underscore, or dash.
-Values must be in upright "quotes".
+-- function printconf ()
+-- --
+-- -- Print the format of the configuration file lwarpmk.conf:
+-- --
+-- print ( [[
+-- An example lwarpmk.conf or <project>.lwarpmkconf project file:
+-- --
+-- opsystem = "Unix"   (or "Windows")
+-- latexname = "pdflatex"  (or "lualatex", or "xelatex")
+-- sourcename = "projectname"  (the source-code filename w/o .tex)
+-- homehtmlfilename = "index"  (or perhaps the project name)
+-- htmlfilename = ""  (or "projectname" - filename prefix)
+-- latexmk = "false"  (or "true" to use latexmk to build PDFs)
+-- shellescape = "false"
+-- printindexcmd = "makeindex -s lwarp.ist <name>.idx"
+-- HTMLindexcmd = "makeindex -s lwarp.ist <name>_html.idx"
+-- latexmkindexcmd = "makeindex -s lwarp.ist"
+-- -- indexprog = "makeindex" or "xindy"
+-- -- makeindexstyle = "lwarp.ist" (or a custom file based on lwarp.ist)
+-- -- xindylanguge = "english"  (use a language supported by xindy)
+-- -- xindycodepage = "utf8"  (use a codepage supported by xindy)
+-- -- xindystyle = "lwarp.xdy" (or a custom file based on lwarp.xdy)
+-- glossarycmd = "makeglossaries"
+-- pdftotextenc = "UTF-8"  (use an encoding supported by pdftotext)
+-- --
+-- Filenames must contain only letters, numbers, underscore, or dash.
+-- Values must be in upright "quotes".
+-- 
+-- ]] ) ;
+-- end
 
-]] ) ;
-end
 
 
-
 function splitfile (destfile,sourcefile)
 --
 -- Split one large sourcefile into a number of files,
@@ -12956,7 +14129,7 @@
         "\" in lwarpmk.conf.\n"
     ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
     os.exit(1) ;
 end
 
@@ -12967,16 +14140,31 @@
 --
 -- Default configuration filename:
 local conffile = "lwarpmk.conf"
+local confroot = "lwarpmk"
+-- Global argument index
+argindex = 2
 -- Optional configuration filename:
-if ( arg[2] ~= nil ) then conffile = arg[2]..".lwarpmkconf" end
+if ( arg[argindex] == "-p" ) then
+    argindex = argindex + 1
+    confroot = arg[argindex]
+    conffile = confroot..".lwarpmkconf"
+    argindex = argindex + 1
+end
 -- Additional defaults:
 opsystem = "Unix"
 latexmk = "false"
 shellescape = "false"
-xindylanguage = "english"
-xindycodepage = "utf8"
-xindystyle = "lwarp.xdy"
-pdftotextenc = "UTF-8"
+printindexcmd = ""
+HTMLindexcmd = ""
+latexmkindexcmd = ""
+-- to be removed:
+-- indexprog = "makeindex"
+-- makeindexstyle = "lwarp.ist"
+-- xindylanguage = "english"
+-- xindycodepage = "utf8"
+-- xindystyle = "lwarp.xdy"
+-- pdftotextenc = "UTF-8"
+glossarycmd = "makeglossaries"
 -- Verify the file exists:
 if (lfs.attributes(conffile,"mode")==nil) then
     -- file not exists
@@ -12985,9 +14173,9 @@
     print ("lwarpmk: Move to the project's source directory,")
     print ("lwarpmk: recompile using pdflatex, xelatex, or lualatex,")
     print ("lwarpmk: then try using lwarpmk again.")
-    if ( arg[2] ~= nil ) then
+    if ( arg[argindex] ~= nil ) then
         print (
-            "lwarpmk: (\"" .. arg[2] ..
+            "lwarpmk: (\"" .. confroot ..
             "\" does not appear to be a project name.)"
         )
     end
@@ -13002,7 +14190,7 @@
 local linenum = 0
 for line in cfile:lines() do -- scan lines
 linenum = linenum + 1
-i,j,cvarname,cvalue = string.find (line,"([%w-_]*)%s*=%s*\"([%w%-_%.]*)\"") ;
+i,j,cvarname,cvalue = string.find (line,"([%w-_]*)%s*=%s*\"([^\"]*)\"") ;
 -- Error if incorrect enclosing characters:
 if ( i == nil ) then
     print ("lwarpmk: ===")
@@ -13009,7 +14197,7 @@
     print ("lwarpmk: " ..  linenum .. " : " .. line ) ;
     print ("lwarpmk: Incorrect entry in " .. conffile ..".\n" ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
     os.exit(1) ;
 end -- nil
 if ( cvarname == "opsystem" ) then
@@ -13035,9 +14223,25 @@
 elseif ( cvarname == "htmlfilename" ) then htmlfilename = cvalue
 elseif ( cvarname == "latexmk" ) then latexmk = cvalue
 elseif ( cvarname == "shellescape" ) then shellescape = cvalue
-elseif ( cvarname == "xindylanguage" ) then xindylanguage = cvalue
-elseif ( cvarname == "xindycodepage" ) then xindycodepage = cvalue
-elseif ( cvarname == "xindystyle" ) then xindystyle = cvalue
+elseif ( cvarname == "printindexcmd" ) then printindexcmd = cvalue
+elseif ( cvarname == "HTMLindexcmd" ) then HTMLindexcmd = cvalue
+elseif ( cvarname == "latexmkindexcmd" ) then latexmkindexcmd = cvalue
+elseif ( cvarname == "glossarycmd" ) then glossarycmd = cvalue
+-- to be removed:
+-- elseif ( cvarname == "indexprog" ) then
+--     -- Verify choice of indexing program:
+--     if (
+--         (cvalue == "makeindex") or
+--         (cvalue == "xindy")
+--     ) then
+--         indexprog = cvalue
+--     else
+--         cvalueerror ( line, linenum , cvalue )
+--     end
+-- elseif ( cvarname == "makeindexstyle" ) then makeindexstyle = cvalue
+-- elseif ( cvarname == "xindylanguage" ) then xindylanguage = cvalue
+-- elseif ( cvarname == "xindycodepage" ) then xindycodepage = cvalue
+-- elseif ( cvarname == "xindystyle" ) then xindystyle = cvalue
 elseif ( cvarname == "pdftotextenc" ) then pdftotextenc = cvalue
 else
     print ("lwarpmk: ===")
@@ -13047,7 +14251,7 @@
         conffile ..".\n"
     ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
 os.exit(1) ;
 end -- cvarname
 end -- do scan lines
@@ -13095,15 +14299,6 @@
 else print ( "lwarpmk: Select Unix or Windows for opsystem" )
 end --- for Windows
 
--- set xindycmd, glossarycmd according to pdflatex vs xelatex/lualatex:
-if ( latexname == "pdflatex" ) then
-    xindycmd = "texindy  "
-    glossarycmd = "xindy  "
-else
-    xindycmd = "xindy  -M texindy  "
-    glossarycmd = "xindy "
-end
-
 end -- loadconf
 
 
@@ -13219,8 +14414,8 @@
     sourcename ..".toc " .. sourcename .. "_html.toc " ..
     sourcename ..".lof " .. sourcename .. "_html.lof " ..
     sourcename ..".lot " .. sourcename .. "_html.lot " ..
-    sourcename ..".idx " .. sourcename .. "_html.idx " ..
-    sourcename ..".ind " .. sourcename .. "_html.ind " ..
+    " *.idx " ..
+    " *.ind " ..
     sourcename ..".log " .. sourcename .. "_html.log " ..
     sourcename ..".gl* " .. sourcename .. "_html.gl* " ..
     " *_html_inc.* "
@@ -13472,10 +14667,8 @@
     .. "-e "
     .. opquote
     .. "$makeindex = q/" -- $
-    .. xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -C " .. xindycodepage
-    .. "  -L " .. xindylanguage .. " /"
+    .. latexmkindexcmd
+    .. " /"
     .. opquote
     .. " -pdflatex=\"" .. latexname .. thisshellescape .." %O %S\" "
     .. sourcename..fsuffix ..".tex"
@@ -13488,10 +14681,10 @@
 function convertpdftosvg ()
 --
 -- Converts PDF files to SVG files.
--- The filenames are arg[2] and up.
+-- The filenames are arg[argindex] and up.
 -- arg[1] is the command "pdftosvg".
 --
-for i = 2 , #arg do
+for i = argindex , #arg do
     if (lfs.attributes(arg[i],"mode")==nil) then
         print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.")
     else
@@ -13502,7 +14695,15 @@
 end --function
 
 
+-- Force an update and conclude processing:
+function updateanddone ()
+print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
+refreshdate ()
+print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
+print ("lwarpmk: Done.")
+end -- function
 
+
 -- Start of the main code: --
 
 
@@ -13554,26 +14755,18 @@
     print ("lwarpmk: Done.") ;
 
 
--- lwarp printindex:
+-- lwarpmk printindex:
 -- Compile the index then touch the source
 -- to trigger a recompile of the document:
 
 elseif arg[1] == "printindex" then
 loadconf ()
-print ("lwarpmk: Processing the index.")
-os.execute(
-    xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -C " .. xindycodepage
-    .. "  -L " .. xindylanguage
-    .. " " .. sourcename .. ".idx")
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute ( printindexcmd )
+print ("lwarpmk: -------")
+updateanddone ()
 
 
--- lwarp printglossary:
+-- lwarpmk printglossary:
 -- Compile the glossary then touch the source
 -- to trigger a recompile of the document:
 
@@ -13581,16 +14774,8 @@
 loadconf ()
 print ("lwarpmk: Processing the glossary.")
 
-os.execute(glossarycmd ..
-    "  -L " .. xindylanguage ..
-    "  -C " .. xindycodepage ..
-    "  -I xindy -M " .. sourcename ..
-    " -t " .. sourcename .. ".glg -o " .. sourcename .. ".gls "
-    .. sourcename .. ".glo")
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute(glossarycmd .. " " .. sourcename)
+updateanddone ()
 
 
 -- lwarpmk html:
@@ -13643,41 +14828,23 @@
 
 elseif arg[1] == "htmlindex" then
 loadconf ()
-print ("lwarpmk: Processing the index.")
-os.execute(
-    xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -L " .. xindylanguage
-    .. "  -C " .. xindycodepage
-    .. " " .. sourcename .. "_html.idx"
-)
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute ( HTMLindexcmd )
+print ("lwarpmk: -------")
+updateanddone ()
 
 
 -- lwarpmk htmlglossary:
 -- Compile the glossary then touch the source
--- to trigger a recompile of the document:
+-- to trigger a recompile of the document.
+-- The <sourcename>.xdy file is created by the glossaries package.
 
 elseif arg[1] == "htmlglossary" then
 loadconf ()
 print ("lwarpmk: Processing the glossary.")
+os.execute(glossarycmd .. " " .. sourcename .. "_html")
+updateanddone ()
 
-os.execute(glossarycmd ..
-    "  -L " .. xindylanguage ..
-    "  -C " .. xindycodepage ..
-    "  -I xindy -M " ..sourcename ..
-    "_html -t " .. sourcename .. "_html.glg -o " ..sourcename ..
-    "_html.gls " ..sourcename .. "_html.glo")
 
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
-
-
 -- lwarpmk limages:
 -- Scan the lateximages.txt file to create lateximages.
 
@@ -13693,14 +14860,11 @@
 
 elseif arg[1] == "again" then
 loadconf ()
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+updateanddone ()
 
 
 -- lwarpmk clean:
--- Remove project.aux, .toc, .lof, .lot, .idx, .ind, .log, *_html_inc.*, .gl*
+-- Remove project.aux, .toc, .lof, .lot, .log, *.idx, *.ind, *_html_inc.*, .gl*
 
 elseif arg[1] == "clean" then
 loadconf ()
@@ -13709,7 +14873,7 @@
 
 
 -- lwarpmk cleanall
--- Remove project.aux, .toc, .lof, .lot, .idx, .ind, .log, *_html_inc.*, .gl*
+-- Remove project.aux, .toc, .lof, .lot, .log, *.idx, *.ind, *_html_inc.*, .gl*
 --    and also project.pdf, *.html
 
 elseif arg[1] == "cleanall" then
@@ -13987,7 +15151,7 @@
 % 
 % \begin{macro}{\LWR at getexparray} \marg{name} \marg{index}
 %    \begin{macrocode}
-\newcommand*{\LWR at getexparray}[2]{\csuse{#1#2}}
+\newcommand*{\LWR at getexparray}[2]{\@nameuse{#1#2}}
 %    \end{macrocode}
 % \end{macro}
 
@@ -17029,15 +18193,15 @@
 \ifthenelse{%
     \(%
         \(\NOT\equal{#1}{\BooleanTrue}\)\OR%
-        \(\cnttest{\csuse{LWR at depth#4}}{=}{\LWR at depthpart}\)\OR%
+        \(\cnttest{\@nameuse{LWR at depth#4}}{=}{\LWR at depthpart}\)\OR%
         \(\boolean{LWR at forcinghtmlpage}\)%
     \)%
     \AND%
-    \cnttest{\csuse{LWR at depth#4}}{<=}{\value{FileDepth}}%
+    \cnttest{\@nameuse{LWR at depth#4}}{<=}{\value{FileDepth}}%
     \AND%
     \(%
         \NOT\boolean{CombineHigherDepths}\OR%
-        \cnttest{\csuse{LWR at depth#4}}{<=}{\value{LWR at prevFileDepth}}%
+        \cnttest{\@nameuse{LWR at depth#4}}{<=}{\value{LWR at prevFileDepth}}%
     \)%
     \AND%
 %    \end{macrocode}
@@ -17114,7 +18278,7 @@
 % For inline sections paragraph and subparagraph, start a new paragraph now:
 %    \begin{macrocode}
 \ifthenelse{%
-    \cnttest{\csuse{LWR at depth#4}}{>=}{\LWR at depthparagraph}%
+    \cnttest{\@nameuse{LWR at depth#4}}{>=}{\LWR at depthparagraph}%
 }%
 {\LWR at startpars}%
 {}%
@@ -17122,7 +18286,7 @@
 % Create the opening tag with an autosec:
 %    \begin{macrocode}
 \LWR at traceinfo{LWR at section: about to LWR at createautosec}%
-\LWR at createautosec{\csuse{LWR at tag#4}}%
+\LWR at createautosec{\@nameuse{LWR at tag#4}}%
 %    \end{macrocode}
 % \changes{v0.43}{2017/11/01}{Fix: Math in section name.}
 %    \begin{macrocode}
@@ -17149,7 +18313,7 @@
 % Only add a numbered TOC entry if section number is not too deep:
 %    \begin{macrocode}
     \ifthenelse{%
-        \cnttest{\csuse{LWR at depth#4}}{<=}{\value{secnumdepth}}%
+        \cnttest{\@nameuse{LWR at depth#4}}{<=}{\value{secnumdepth}}%
     }%
     {% if secnumdepth
 %    \end{macrocode}
@@ -17167,7 +18331,7 @@
             \LWR at traceinfo{LWR at section: about to addcontentsline}%
             \addcontentsline{toc}{#4}%
             {%
-                 \protect\numberline{\csuse{the#4}}%
+                 \protect\numberline{\@nameuse{the#4}}%
                 {\ignorespaces\IfValueTF{#2}{#2}{#3}\protect\relax}%
             }%
             \LWR at traceinfo{LWR at section: finished addcontentsline}%
@@ -17192,11 +18356,11 @@
     \ifbool{LWR at mainmatter}%
     {%
         \ifthenelse{%
-            \(\cnttest{\csuse{LWR at depth#4}}{<=}%
+            \(\cnttest{\@nameuse{LWR at depth#4}}{<=}%
                 {\value{secnumdepth}}\) \AND%
-            \(\cnttest{\csuse{LWR at depth#4}}{<=}{\LWR at depthpart}\)%
+            \(\cnttest{\@nameuse{LWR at depth#4}}{<=}{\LWR at depthpart}\)%
         }%
-        {\csuse{#4name}~{}}%
+        {\@nameuse{#4name}~{}}%
         {}%
 %    \end{macrocode}
 % Print the section number:
@@ -17203,7 +18367,7 @@
 %    \begin{macrocode}
         \LWR at traceinfo{LWR at section: about to print section number}%
         \ifthenelse{%
-            \cnttest{\csuse{LWR at depth#4}}{<=}{\value{secnumdepth}}%
+            \cnttest{\@nameuse{LWR at depth#4}}{<=}{\value{secnumdepth}}%
         }%
         {%
             \ifstrequal{#4}{chapter}%
@@ -17223,7 +18387,7 @@
 % Close the heading tag, such as /H2:
 %    \begin{macrocode}
 \LWR at traceinfo{LWR at section: about to close the heading tag}%
-\LWR at htmltag{\csuse{LWR at tag#4end}}%
+\LWR at htmltag{\@nameuse{LWR at tag#4end}}%
 %    \end{macrocode}
 % Generate a \LaTeX{} label:
 % \changes{v0.43}{2017/11/01}{Fix: Math in section name.}
@@ -17235,7 +18399,7 @@
 % Start paragraph handing unless is an inline paragraph or subparagraph:
 %    \begin{macrocode}
 \ifthenelse{%
-    \cnttest{\csuse{LWR at depth#4}}{<}{\LWR at depthparagraph}%
+    \cnttest{\@nameuse{LWR at depth#4}}{<}{\LWR at depthparagraph}%
 }%
 {\LWR at startpars}%
 {}%
@@ -17255,10 +18419,10 @@
 %    \begin{macrocode}
 \ifthenelse{%
     \NOT\equal{#1}{\BooleanTrue}\OR%
-    \cnttest{\csuse{LWR at depth#4}}{=}{\LWR at depthpart}%
+    \cnttest{\@nameuse{LWR at depth#4}}{=}{\LWR at depthpart}%
 }%
 {% not starred
-    \setcounter{LWR at prevFileDepth}{\csuse{LWR at depth#4}}%
+    \setcounter{LWR at prevFileDepth}{\@nameuse{LWR at depth#4}}%
 }% not starred
 {}%
 %    \end{macrocode}
@@ -17638,11 +18802,11 @@
 %    \end{macrocode}
 % Reduce chance of line overflow in verbatim environments:
 %    \begin{macrocode}
-\LWR at origscriptsize%
+\LWR at print@scriptsize%
 %    \end{macrocode}
 % In \PDF\ output, don't allow line breaks to interfere with \HTML\ tags:
 %    \begin{macrocode}
-\LWR at origraggedright%
+\LWR at print@raggedright%
 \LetLtxMacro{\\}{\LWR at endofline}%
 %    \end{macrocode}
 % Spread the lines for \prog{pdftotext} to read them well:
@@ -17795,8 +18959,8 @@
 \newcommand*{\LWR at requesttoc}[2]{%
 \ifbool{#1}
 {
-    \expandafter\newwrite\csuse{tf@#2}
-    \immediate\openout \csuse{tf@#2} \jobname.#2\relax
+    \expandafter\newwrite\@nameuse{tf@#2}
+    \immediate\openout \@nameuse{tf@#2} \jobname.#2\relax
 }{}
 }
 %    \end{macrocode}
@@ -18797,9 +19961,9 @@
 % \changes{v0.50}{2018/03/02}{Improved column alignment.}
 % \changes{v0.54}{2018/04/06}{Improved column alignment.}
 %    \begin{macrocode}
-% \LWR at orignormalsize%
+% \LWR at print@normalsize%
 \LWR at origttfamily%
-\LWR at origsmall%
+\LWR at print@small%
 %    \end{macrocode}
 % Since inside a \element{pre}, restore the original list processing:
 %    \begin{macrocode}
@@ -18887,32 +20051,23 @@
 %
 % \changes{v0.42}{2017/10/13}{Added.}
 % \changes{v0.52}{2018/03/27}{Fix to allow inside \env{lateximage}.}
-%
+% \changes{v0.58}{2018/06/07}{Improved print/\HTML\ output selection.}
 %    \begin{macrocode}
-\LetLtxMacro\LWR at origtabbing\tabbing
-\LetLtxMacro\LWR at origendtabbing\endtabbing
-
-\renewcommand*{\tabbing}{%
+\newcommand*{\LWR at HTML@tabbing}{%
 \LWR at forcenewpage%
 \LWR at atbeginverbatim{3}{tabbing}%
-\LWR at origtabbing%
+\LWR at print@tabbing%
 }
 
-\renewcommand*{\endtabbing}{%
-    \LWR at origendtabbing%
+\newcommand*{\LWR at HTML@endtabbing}{%
+    \LWR at print@endtabbing%
     \LWR at afterendverbatim{1}%
 }
+
+\LWR at formatted{tabbing}
+\LWR at formatted{endtabbing}
 %    \end{macrocode}
 %
-% \cs{AtBeginDocument} because \cs{LWR at restoreorigformatting} has not yet been defined:
-%    \begin{macrocode}
-\AtBeginDocument{
-\appto\LWR at restoreorigformatting{%
-\LetLtxMacro\tabbing\LWR at origtabbing%
-\LetLtxMacro\endtabbing\LWR at origendtabbing%
-}
-}
-%    \end{macrocode}
 % \end{environment}
 
 %    \begin{macrocode}
@@ -20610,8 +21765,10 @@
 %    \end{macrocode}
 % \begin{docsidebar}
 %	\raggedright
-% Many people define centered versions ``|P|'', ``|M|'', and ``|B|'': \\
-% \hspace*{1em}|\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}|
+% Many people define centered versions ``|P|'', ``|M|'', and ``|B|'':
+% \begin{Verbatim}[tabsize=4,gobble=2]
+%   \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
+% \end{Verbatim}
 % \end{docsidebar}
 %    \begin{macrocode}
 \IfStrEq{\LWR at strresult}{P}{\LWR at parsepcolumn{P}}{}%
@@ -22140,7 +23297,7 @@
         {%
             \refstepcounter{\LTcaptype}%
             \protected at edef\@currentlabel{%
-                \csuse{p@\LTcaptype}\csuse{the\LTcaptype}%
+                \@nameuse{p@\LTcaptype}\@nameuse{the\LTcaptype}%
             }%
         }%
     }{}%
@@ -22148,7 +23305,7 @@
 % Create an \HTML\ caption.  Afterwards, maybe make a LOT entry.
 %    \begin{macrocode}
     \LWR at figcaption%
-    \csuse{fnum@\LTcaptype}\CaptionSeparator#3%
+    \@nameuse{fnum@\LTcaptype}\CaptionSeparator#3%
     \endLWR at figcaption%
 %    \end{macrocode}
 % See if an optional caption was given:
@@ -22168,11 +23325,11 @@
 %    \begin{macrocode}
         {% No TOC entry
             \addcontentsline%
-            {\csuse{ext@\LTcaptype}}%
+            {\@nameuse{ext@\LTcaptype}}%
             {\LTcaptype}%
             {%
             \protect\numberline%
-            {\csuse{p@\LTcaptype}\csuse{the\LTcaptype}}%
+            {\@nameuse{p@\LTcaptype}\@nameuse{the\LTcaptype}}%
             {\ignorespaces #3\protect\relax}%
             }%
         }% end of No TOC entry
@@ -22181,11 +23338,11 @@
 %    \begin{macrocode}
         {% yes TOC entry
             \addcontentsline%
-            {\csuse{ext@\LTcaptype}}%
+            {\@nameuse{ext@\LTcaptype}}%
             {\LTcaptype}%
             {%
             \protect\numberline%
-            {\csuse{p@\LTcaptype}\csuse{the\LTcaptype}}%
+            {\@nameuse{p@\LTcaptype}\@nameuse{the\LTcaptype}}%
             {\ignorespaces #2\protect\relax}%
             }%
         }% end of yes TOC entry
@@ -22416,6 +23573,15 @@
 \newcommand*{\LWR at donothing}{}
 %    \end{macrocode}
 %
+% In case \pkg{array} is not loaded:
+% \changes{v0.58}{2018/06/21}{\pkg{memoir}: Fix for \cs{firsthlline}, \cs{lasthline}.}
+%    \begin{macrocode}
+\let\firsthline\relax
+\let\lasthline\relax
+\newcommand*{\firsthline}{}
+\newcommand*{\lasthline}{}
+%    \end{macrocode}
+%
 % In case \pkg{bigdelim} is not loaded:
 %    \begin{macrocode}
 \newcommand*{\ldelim}{}
@@ -22742,9 +23908,19 @@
 %
 % These are default defininitions in case \pkg{booktabs} is not loaded,
 % and are not expected to used, but must exist as placeholders.
+% They are pre-deleted in case \pkg{memoir} has already loaded \pkg{booktabs}.
 %
 % \changes{v0.34}{2017/08/08}{\pkg{booktabs}: Works inside \env{lateximage}.}
+% \changes{v0.58}{2018/06/21}{\pkg{memoir}: Fix for \pkg{booktabs}.}
 %    \begin{macrocode}
+\LetLtxMacro\toprule\relax
+\LetLtxMacro\midrule\relax
+\LetLtxMacro\cmidrule\cline
+\LetLtxMacro\bottomrule\relax
+\LetLtxMacro\addlinespace\relax
+\LetLtxMacro\morecmidrules\relax
+\LetLtxMacro\specialrule\relax
+
 \newcommand*{\toprule}[1][]{\hline}
 \newcommand*{\midrule}[1][]{\hline}
 \LetLtxMacro\cmidrule\cline
@@ -23213,7 +24389,7 @@
 % See: \\
 % \href{http://tex.stackexchange.com/questions/57194/extract-section-number-from-equation-reference}
 %    {\ttfamily http://tex.stackexchange.com/questions/57194/ \\
-%		\hspace*{2em}extract-section-number-from-equation-reference}
+%		\fqquad\ extract-section-number-from-equation-reference}
 %
 % Create a new property list called special:
 %    \begin{macrocode}
@@ -23361,43 +24537,47 @@
 % \end{macro}
 %
 %
-% \begin{macro}{\LWR at newlabel} \parg{bookmark} \marg{label} \oarg{type}
+% \begin{macro}{\LWR at new@label} \parg{bookmark} \marg{label} \oarg{type}
 %
 % \cs{label} during \HTML\ output when not in \SVG\ math mode,
 % removing extra spaces around the label, as done by regular \LaTeX\ \cs{label}.
 %
+% The is also used during a \env{lateximage}, including \SVG\ math, since
+% the special label handling is required, but \cs{LWR at sublabel} does not
+% generate \HTML\ tags inside a \env{lateximage}.
+%
 % \pkg{clevereref} later encases this to add its own cross-referencing.
 %
 % The optional \meta{bookmark} is per the \pkg{memoir} class, and is ignored.
 %
 % The optional \meta{type} is per the \pkg{ntheorem} package, and is ignored.
+%
 %    \begin{macrocode}
-\NewDocumentCommand{\LWR at newlabel}{d() m o}{%
-\LWR at traceinfo{LWR at newlabel: starting}%
-\LWR at traceinfo{LWR at newlabel: !#2!}%
+\NewDocumentCommand{\LWR at new@label}{d() m o}{%
+\LWR at traceinfo{LWR at new@label: starting}%
+\LWR at traceinfo{LWR at new@label: !#2!}%
 % \@bsphack%
 %    \end{macrocode}
 % Create a traditional \LaTeX\ label, as modified by \pkg{cleveref}:
 %    \begin{macrocode}
-\LWR at origlabel{#2}%
+\LWR at orig@label{#2}%
 %    \end{macrocode}
 % Create a special label which holds the section number,
 % |LWR at htmlfilenumber|, |LWR at lateximagedepth|, and |LWR at lateximagenumber|:
 %    \begin{macrocode}
-\LWR at traceinfo{LWR at newlabel: filesectionnames is \ifbool{FileSectionNames}{true}{false}}%
-\LWR at traceinfo{LWR at newlabel: LWR at thisfilename is !\LWR at thisfilename!}%
-\LWR at traceinfo{LWR at newlabel: LWR at htmlfilenumber is \arabic{LWR at htmlfilenumber}}%
+\LWR at traceinfo{LWR at new@label: filesectionnames is \ifbool{FileSectionNames}{true}{false}}%
+\LWR at traceinfo{LWR at new@label: LWR at thisfilename is !\LWR at thisfilename!}%
+\LWR at traceinfo{LWR at new@label: LWR at htmlfilenumber is \arabic{LWR at htmlfilenumber}}%
 \LWR at splabel{#2}%
 \LWR at sublabel{#2}%
 % \@esphack%
-\LWR at traceinfo{LWR at newlabel: done}%
+\LWR at traceinfo{LWR at new@label: done}%
 }
 %    \end{macrocode}
 % \end{macro}
-%
-%
 
 
+
 % \subsection{References}
 % \label{sec:references}
 
@@ -23479,7 +24659,7 @@
 \NewDocumentCommand{\LWR at subnewref}{m m}{%
 \LWR at traceinfo{LWR at subnewref #1 #2}%
 \LWR at startref{#1}%
-\LWR at origref{#2}%
+\LWR at print@ref{#2}%
 \LWR at htmltag{/a}%
 }
 %    \end{macrocode}
@@ -23486,19 +24666,23 @@
 % \end{macro}
 
 % \begin{macro}{\ref} * \marg{label} \quad
-%   \cs{ref} is redefined to \cs{LWR at newref},
+%   \cs{ref} is redefined to \cs{LWR at HTML@ref},
 %   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}
+% \begin{macro}{\LWR at HTML@ref} * \marg{label}
 %   Create an internal document reference link,
 %   or without a link if starred per \pkg{hyperref}.
+%
+% \changes{v0.58}{2018/06/07}{Improved print/\HTML\ output selection.}
 %    \begin{macrocode}
-\NewDocumentCommand{\LWR at newref}{s m}{%
-\LWR at traceinfo{LWR at newref !#2!}%
+\NewDocumentCommand{\LWR at HTML@ref}{s m}{%
+\LWR at traceinfo{LWR at HTML@ref !#2!}%
 \IfBooleanTF{#1}%
-{\LWR at origref{#2}}%
+{\LWR at print@ref{#2}}%
 {\LWR at subnewref{#2}{#2}}%
 }
+
+\LWR at formatted{ref}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -23509,7 +24693,7 @@
 % \changes{v0.57}{2018/06/05}{\pkg{subcaption}: Fix: \cs{subref}.}
 %    \begin{macrocode}
 \NewDocumentCommand{\LWR at ref@ignorestar}{s m}{%
-    \LWR at origref{#2}%
+    \LWR at print@ref{#2}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -23532,9 +24716,9 @@
 % \changes{v0.20}{2017/01/03}{Added.}
 %
 %    \begin{macrocode}
-\NewDocumentCommand{\LWR at newpageref}{s m}{%
+\NewDocumentCommand{\LWR at new@pageref}{s m}{%
 \IfBooleanTF{#1}%
-{(\pagerefPageFor\LWR at origref{#2})}%
+{(\pagerefPageFor\LWR at print@ref{#2})}%
 {(\cpageref{#2})}%
 }
 %    \end{macrocode}
@@ -23844,7 +25028,7 @@
 %    \end{macrocode}
 % Settings while inside the environment:
 %    \begin{macrocode}
-\LWR at origraggedright%
+\LWR at print@raggedright%
 %    \end{macrocode}
 % Open an \HTML\ |figure| tag.
 % The figure is assigned a \attribute{class} equal to its type,
@@ -23857,7 +25041,7 @@
 %    \begin{macrocode}
 \LWR at htmltag{%
     figure id="\LWR at print@mbox{autoid-\arabic{LWR at thisautoid}}" % space
-    class="#1 \csuse{LWR at floatstyle@#1}"%
+    class="#1 \@nameuse{LWR at floatstyle@#1}"%
 }%
 \ifbool{FormatWP}{%
     \LWR at orignewline%
@@ -24044,7 +25228,7 @@
 % \changes{v0.54}{2018/04/19}{Honor \cs{centering}, etc. in floats.}
 %    \begin{macrocode}
 \newcommand*{\LWR at endfloatalignment}{%
-\ifdefvoid{\LWR at floatalignmentname}{}{\csuse{end\LWR at floatalignmentname}}%
+\ifdefvoid{\LWR at floatalignmentname}{}{\@nameuse{end\LWR at floatalignmentname}}%
 \renewcommand*{\LWR at floatalignmentname}{}%
 }
 %    \end{macrocode}
@@ -24144,24 +25328,17 @@
 }
 %    \end{macrocode}
 % \end{environment}
-
 %
-% After packages have loaded, remember the print-mode version of the following:
-%    \begin{macrocode}
-\AtBeginDocument{
-\LetLtxMacro\LWR at origcaption@begin\caption at begin
-\LetLtxMacro\LWR at origcaption@end\caption at end
-}
-%    \end{macrocode}
-
-% \begin{macro}{\LWR at caption@begin} \marg{type}
 %
+% \begin{macro}{\LWR at HTML@caption at 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}.}
+% \changes{v0.58}{2018/06/07}{Improved print/\HTML\ output selection.}
 %    \begin{macrocode}
-\newcommand{\LWR at caption@begin}[1]
+\newcommand*{\LWR at HTML@caption at begin}[1]
 {
-\LWR at traceinfo{LWR at caption@begin}%
+\LWR at traceinfo{LWR at HTML@caption at begin}%
 %    \end{macrocode}
 % Keep par and minipage changes local:
 %    \begin{macrocode}
@@ -24179,20 +25356,21 @@
 % Enclose the original caption code inside an \HTML\ tag:
 %    \begin{macrocode}
 \LWR at figcaption%
-\LWR at traceinfo{LWR at caption@begin: about to LWR at origcaption@begin}%
-\LWR at origcaption@begin{#1}%
-\LWR at traceinfo{LWR at caption@begin: done}%
+\LWR at traceinfo{LWR at HTML@caption at begin: about to LWR at origcaption@begin}%
+\LWR at print@caption at begin{#1}%
+\LWR at traceinfo{LWR at HTML@caption at begin: done}%
 }
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\LWR at caption@end}
+% \begin{macro}{\LWR at HTML@caption at end}
 % Low-level patches to create \HTML\ tags for captions.
+% \changes{v0.58}{2018/06/07}{Improved print/\HTML\ output selection.}
 %    \begin{macrocode}
-\newcommand{\LWR at caption@end}
+\newcommand*{\LWR at HTML@caption at end}
 {%
-\LWR at traceinfo{LWR at caption@end}%
-\LWR at origcaption@end%
+\LWR at traceinfo{LWR at HTML@caption at end}%
+\LWR at print@caption at end%
 %    \end{macrocode}
 % Closing tag:
 %    \begin{macrocode}
@@ -24199,7 +25377,7 @@
 \endLWR at figcaption%
 \endgroup%
 % \leavevmode% avoid bad space factor (0) error
-\LWR at traceinfo{LWR at caption@end: done}%
+\LWR at traceinfo{LWR at HTML@caption at end: done}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -24207,10 +25385,13 @@
 % \begin{macro}{\caption at begin}
 % \begin{macro}{\caption at end}
 % Low-level patches to create \HTML\ tags for captions.
+% These are assigned \cs{AtBeginDocument} so that other packages
+% which modify captions will have already been loaded before saving the
+% print-mode version.
 %    \begin{macrocode}
 \AtBeginDocument{
-\let\caption at begin\LWR at caption@begin
-\let\caption at end\LWR at caption@end
+\LWR at formatted{caption at begin}
+\LWR at formatted{caption at end}
 }
 %    \end{macrocode}
 % \end{macro}
@@ -24518,12 +25699,12 @@
 %    \begin{macrocode}
 \NewDocumentCommand{\listof}{m +m}{%
 \@ifundefined{l@#1}{%
-    \csdef{l@#1}[2]{\hypertocfloat{1}{#1}{\csuse{ext@#1}}{##1}{##2}}%
+    \csdef{l@#1}[2]{\hypertocfloat{1}{#1}{\@nameuse{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
-    \jobname.\csuse{ext@#1}\relax
+    \jobname.\@nameuse{ext@#1}\relax
 }
 %    \end{macrocode}
 % \end{macro}
@@ -24812,7 +25993,7 @@
 % See:\\
 % \href{http://tex.stackexchange.com/questions/187038/how-to-mention-section-number-in-index-created-by-imakeidx}
 %   {\texttt{http://tex.stackexchange.com/questions/187038/\\
-%		\hspace*{2em}how-to-mention-section-number-in-index-created-by-imakeidx}}
+%		\fqquad\ how-to-mention-section-number-in-index-created-by-imakeidx}}
 
 % Index links are tracked by the counter |LWR at autoindex|.
 % This counter is used to create a label for each index entry, and
@@ -24835,18 +26016,6 @@
 
 
 
-% \begin{macro}{\printindex}
-%    \begin{macrocode}
-\let\LWR at origprintindex\printindex
-
-\renewcommand*{\printindex}
-{
-\LWR at startpars
-\LWR at origprintindex
-}
-%    \end{macrocode}
-% \end{macro}
-
 % \begin{environment}{theindex}
 %    \begin{macrocode}
 \@ifundefined{chapter}
@@ -24853,26 +26022,31 @@
 {\newcommand*{\LWR at indexsection}[1]{\section*{#1}}}
 {\newcommand*{\LWR at indexsection}[1]{\chapter*{#1}}}
 
+\AtBeginDocument{
 \renewenvironment*{theindex}{%
-\LWR at indexsection{\indexname}%
-\let\item\LWR at indexitem%
-\let\subitem\LWR at indexsubitem%
-\let\subsubitem\LWR at indexsubsubitem%
+    \LWR at indexsection{\indexname}%
+    \let\item\LWR at indexitem%
+    \let\subitem\LWR at indexsubitem%
+    \let\subsubitem\LWR at indexsubsubitem%
 }{}
+}% AtBeginDocument
 %    \end{macrocode}
 % \end{environment}
 
 
-% \begin{macro}{\LWR at indexitem}
+% \begin{macro}{\LWR at indexitem} \oarg{index key} \qquad
+% The optional argument is added to support \pkg{repeatindex}.
+%
+% \changes{v0.58}{2018/06/21}{Accepts optional arg for \pkg{repeatindex}.}
 %    \begin{macrocode}
-\newcommand{\LWR at indexitem}{
+\newcommand{\LWR at indexitem}[1][\@empty]{
 
-\InlineClass{indexitem}{}
+\InlineClass{indexitem}{}#1%
 }
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\LWR at indexitem}
+% \begin{macro}{\LWR at indexsubitem}
 %    \begin{macrocode}
 \newcommand{\LWR at indexsubitem}{
 
@@ -24881,7 +26055,7 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{macro}{\LWR at indexitem}
+% \begin{macro}{\LWR at indexsubsubitem}
 %    \begin{macrocode}
 \newcommand{\LWR at indexsubsubitem}{
 
@@ -24892,28 +26066,30 @@
 
 
 % \begin{macro}{\@wrindex} \marg{term} \qquad
-% Redefined to write the |LWR at autoindex| counter instead of |page|
+% Redefined to write the |LWR at autoindex| counter instead of |page|.
 % \changes{v0.28}{2017/04/13}{Improved indexing.}
 %    \begin{macrocode}
 \def\LWR at wrindex#1{%
 \addtocounter{LWR at autoindex}{1}%
-\LWR at newlabel{LWRindex-\arabic{LWR at autoindex}}%
+\LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%
 \protected at write\@indexfile{}%
 {\string\indexentry{#1}{\arabic{LWR at autoindex}}}%
 \endgroup
 \@esphack}
 
+\AtBeginDocument{
 \let\@wrindex\LWR at wrindex
+}
 %    \end{macrocode}
 % \end{macro}
 
 
 % \begin{macro}{\@wrglossary} \marg{term} \qquad
-% Redefined to write the |LWR at latestautopage| counter instead of |page|
+% Redefined to write the |LWR at latestautopage| counter instead of |page|.
 %    \begin{macrocode}
 \def\@wrglossary#1{%
 \addtocounter{LWR at autoglossary}{1}%
-\LWR at newlabel{LWRglossary-\theLWR at autoglossary}%
+\LWR at new@label{LWRglossary-\theLWR at autoglossary}%
 \protected at write\@glossaryfile{}%
 {\string\glossaryentry{#1}{\theLWR at autoglossary}}%
 \endgroup
@@ -24922,16 +26098,74 @@
 % \end{macro}
 
 
+% \begin{macro}{\LWR at indexnameref} \marg{LWR at autoindex}
+%
+% Creates a hyperlink based on the given entry's autoindex.
+%    \begin{macrocode}
+\newcommand*{\LWR at indexnameref}[1]{\nameref{LWRindex-#1}}
+%    \end{macrocode}
+% \end{macro}
 
-% \begin{macro}{\hyperindexref} \marg{autosecnumber}
+% \begin{macro}{\LWR at doindexentry} \marg{LWR at autoindex, or macros.}
 %
-% |\hyperindexref{web address}| is inserted into |*.ind| by
-% the xindy style file |lwarp.xdy|
+% Creates a hyperlink, or handles \cs{see}, \cs{textbf}, etc.
 %
+% \changes{v0.58}{2018/06/17}{Adds support for \cs{see}, \cs{seealso}, \cs{emph}, \cs{textbf}, etc.}
+%    \begin{macrocode}
+\newrobustcmd{\LWR at doindexentry}[1]{%
+\IfInteger{#1}%
+    {\LWR at indexnameref{#1}}%
+    {#1}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+% \begin{macro}{\LWR at hyperindexrefnullified} \qquad
+% Handles macros commonly seen inside an \cs{index} entry.
+%
+% To handle additional macros:
+% \begin{sourcedisplay}
+% \cs{appto}\cs{LWR at hyperindexrefnullified}\{\dots\}
+% \end{sourcedisplay}
+%
+% \changes{v0.58}{2018/06/17}{Adds support for \cs{see}, \cs{seealso}, \cs{emph}, \cs{textbf}, etc.}
+%    \begin{macrocode}
+\newcommand{\LWR at hyperindexrefnullified}{%
+\renewcommand{\emph}[1]{\LWR at HTMLemph{\LWR at doindexentry{##1}}}%
+\renewcommand{\textbf}[1]{\LWR at HTMLtextbf{\LWR at doindexentry{##1}}}%
+\renewcommand{\textrm}[1]{\LWR at HTMLtextrm{\LWR at doindexentry{##1}}}%
+\renewcommand{\textsf}[1]{\LWR at HTMLtextsf{\LWR at doindexentry{##1}}}%
+\renewcommand{\texttt}[1]{\LWR at HTMLtexttt{\LWR at doindexentry{##1}}}%
+\renewcommand{\textup}[1]{\LWR at HTMLtextup{\LWR at doindexentry{##1}}}%
+\renewcommand{\textsc}[1]{\LWR at HTMLtextsc{\LWR at doindexentry{##1}}}%
+\renewcommand{\textit}[1]{\LWR at HTMLtextit{\LWR at doindexentry{##1}}}%
+\renewcommand{\textsl}[1]{\LWR at HTMLtextsl{\LWR at doindexentry{##1}}}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+% \begin{macro}{\hyperindexref} \marg{LWR at autoindex}
+%
+% |\hyperindexref{LWR at autoindex}| is inserted into |*.ind| by
+% the \pkg{makeindex} style file \filenm{lwarp.ist} or
+% the \pkg{xindy} style file \filenm{lwarp.xdy}.
+%
 % \changes{v0.20}{2016/12/19}{Print mode provided in case \pkg{hyperref} not used.}
 % \changes{v0.28}{2017/04/13}{Improved indexing.}
+% \changes{v0.58}{2018/06/17}{Adds support for \cs{see}, \cs{seealso}, \cs{emph}, \cs{textbf}, etc.}
 %    \begin{macrocode}
-\newcommand*{\hyperindexref}[1]{\nameref{LWRindex-#1}}
+\newcommand{\hyperindexref}[1]{%
+\IfInteger{#1}%
+    {\LWR at indexnameref{#1}}%
+    {%
+        \begingroup%
+        \LWR at hyperindexrefnullified
+        #1%
+        \endgroup%
+    }%
+}
 %    \end{macrocode}
 % \end{macro}
 
@@ -25011,7 +26245,7 @@
 % {
 %   \footnotesize
 %   \textit{Adapted from |embracedef.sty|, which is by \textup{\textsc{Takayuki YATO}}:} \\
-%   \hspace*{2em}\url{https://gist.github.com/zr-tex8r/b72555e3e7ad2f0a37f1}
+%   \fqquad\url{https://gist.github.com/zr-tex8r/b72555e3e7ad2f0a37f1}
 % }
 %
 % \changes{v0.45}{2018/01/13}{Patched to emphasize titles.}
@@ -25076,54 +26310,30 @@
 %    \begin{macrocode}
 \newcommand*{\LWR at restoreorigformatting}{%
 \LWR at traceinfo{LWR at restoreorigformatting}%
+%    \end{macrocode}
+% Numerous macros change their print/\HTML\ meaning depending on \cs{LWR at formatting}:
+%    \begin{macrocode}
 \renewcommand*{\LWR at formatting}{print}%
 \linespread{1}%
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\LetLtxMacro\caption at begin\LWR at origcaption@begin%
-\LetLtxMacro\caption at end\LWR at origcaption@end%
 \let\par\LWR at origpar%
 %    \end{macrocode}
 %
-% \changes{v0.43}{2017/10/31}{Fix: \cs{ref} in math or lateximage.}
 %    \begin{macrocode}
-\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}
-\let\normalsize\LWR at orignormalsize%
-\let\small\LWR at origsmall%
-\let\footnotesize\LWR at origfootnotesize%
-\let\scriptsize\LWR at origscriptsize%
-\let\tiny\LWR at origtiny%
-\let\large\LWR at origlarge%
-\let\Large\LWR at origLarge%
-\let\LARGE\LWR at origLARGE%
-\let\huge\LWR at orighuge%
-\let\Huge\LWR at origHuge%
-%    \end{macrocode}
-%    \begin{macrocode}
 \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\hrulefill\LWR at orighrulefill%
-\LetLtxMacro\dotfill\LWR at origdotfill%
 \let\hss\LWR at orighss%
 \let\llap\LWR at origllap%
 \let\rlap\LWR at origrlap%
 \let\hfilneg\LWR at orighfilneg%
 %    \end{macrocode}
-% \changes{v0.50}{2018/02/22}{Fix: \cs{centering}, etc. in \SVG\ math, \env{lateximage}, \tikz.}
 %    \begin{macrocode}
-\let\raggedright\LWR at origraggedright%
-\let\raggedleft\LWR at origraggedleft%
-\let\centering\LWR at origcentering%
-%    \end{macrocode}
-%    \begin{macrocode}
 \let\,\LWR at origcomma% disable HTML short unbreakable space
 \let\thinspace\LWR at origthinspace% disable HTML short unbreakable space
 \let\textellipsis\LWR at origtextellipsis%
@@ -25429,17 +26639,17 @@
 %    \begin{macrocode}
     \LWR at restoreorigformatting%
     \RenewDocumentEnvironment{lateximage}{s o o o}{}{}% inside group
-    \LWR at orignormalsize%
+    \LWR at print@normalsize%
 %    \end{macrocode}
 % Temporarily set font for the \HTML\ \PDF\ output:
 % \changes{v0.51}{2018/03/14}{Fix: Honors text font around \SVG\ math.}
 %    \begin{macrocode}
     \LWR at traceinfo{Using font family \LWR at f@family}%
-    \csuse{LWR at orig\LWR at f@family family}%
+    \@nameuse{LWR at orig\LWR at f@family family}%
     \LWR at traceinfo{Using font series \LWR at f@series}%
-    \csuse{LWR at orig\LWR at f@series series}%
+    \@nameuse{LWR at orig\LWR at f@series series}%
     \LWR at traceinfo{Using font shape \LWR at f@shape}%
-    \csuse{LWR at orig\LWR at f@shape shape}%
+    \@nameuse{LWR at orig\LWR at f@shape shape}%
 %    \end{macrocode}
 % |lateximagedepth| must be nested to avoid generating paragraph tags.
 % \AmS\ math modifies the \cs{text} macro such that \cs{addtocounter} does not
@@ -25971,7 +27181,7 @@
 % Start the \LaTeX\ math environment inside the \HTML\ comment:
 %    \begin{macrocode}
 \begingroup
-\csuse{LWR at orig#1}
+\@nameuse{LWR at orig#1}
 %    \end{macrocode}
 % While in the math environment,
 % restore various commands to their \LaTeX\ meanings.
@@ -25989,7 +27199,7 @@
 %    \end{macrocode}
 % End the \LaTeX{} math environment inside the \HTML\ comment:
 %    \begin{macrocode}
-\csuse{LWR at origend#1}
+\@nameuse{LWR at origend#1}
 \endgroup
 
 %    \end{macrocode}
@@ -26040,7 +27250,8 @@
 %    \end{macrocode}
 %
 %
-% \begin{macro}{\LWR at doequation}
+% \begin{macro}{\LWR at doequation} \marg{env contents} \marg{env name}
+%
 % \changes{v0.19}{2016/05/25}{\brand{MathJax} support.}
 % \changes{v0.52}{2018/03/28}{Fix: \env{equation*} with \env{split}.}
 %
@@ -26115,11 +27326,11 @@
 % Create the actual \LaTeX-formatted equation inside
 % the |lateximage| using the contents of the environment.
 %    \begin{macrocode}
-    \csuse{LWR at orig#2}
+    \@nameuse{LWR at orig#2}%
     #1% contents collected by \collect at body
-    \csuse{LWR at origend#2}
+    \@nameuse{LWR at origend#2}%
     \end{lateximage}%
-    \end{BlockClass}
+    \end{BlockClass}%
 }% not mathjax
 }
 %    \end{macrocode}
@@ -26154,10 +27365,8 @@
 % which stores the contents of its environment in a
 % macro called \cs{BODY}.
 %    \begin{macrocode}
-\NewEnviron{equation}
-{
-\LWR at doequation{\BODY}{equation}
-}
+\NewEnviron{equation}%
+{\LWR at doequation{\BODY}{equation}}%
 [\LWR at doendequation{equation}]
 
 \LetLtxMacro\LWR at equationnormal\equation
@@ -26168,8 +27377,8 @@
 
 % \begin{environment}{equation*}
 %    \begin{macrocode}
-\NewEnviron{equation*}
-{\LWR at doequation{\BODY}{equation*}}
+\NewEnviron{equation*}%
+{\LWR at doequation{\BODY}{equation*}}%
 [\LWR at doendequation{equation*}]
 
 \csletcs{LWR at equationnormalstar}{equation*}
@@ -26300,12 +27509,12 @@
 %    \end{macrocode}
 % The combined \LaTeX\ \& \HTML\ label is printed in a \cs{text} field:
 %    \begin{macrocode}
-    \text{
+    \text{%
 %    \end{macrocode}
 % Shift the label over to the right side of the environment to avoid
 % over-printing the math:
 %    \begin{macrocode}
-    \ifbool{LWR at amsmultline}{}{\hspace*{\totwidth@}}
+    \ifbool{LWR at amsmultline}{}{\hspace*{\totwidth@}}%
 %    \end{macrocode}
 % Temporarily end the \HTML\ comment,
 % insert the \LaTeX{} \& \HTML\ label, then
@@ -27365,7 +28574,7 @@
 %    \begin{macrocode}
     \LWR at traceinfo{lateximage: about to create minipage}%
     \LWR at print@minipage{6in}%
-    \csuse{LWR at orig\LateximageFontSizeName}%
+    \@nameuse{LWR at print@\LateximageFontSizeName}%
 %    \end{macrocode}
 % Temporarily restore formatting to its \PDF\ definitions:
 % Do not produce \HTML\ tags for \cs{hspace}, etc. inside a lateximage.
@@ -27383,7 +28592,7 @@
 % Create the |LWRlateximage<number>| label:
 %    \begin{macrocode}
     \LWR at traceinfo{lateximage: about to create label}%
-    \LWR at origlabel{LWRlateximage\arabic{LWR at lateximagenumber}}%
+    \LWR at orig@label{LWRlateximage\arabic{LWR at lateximagenumber}}%
     \LWR at traceinfo{lateximage: finished creating the label}%
 %    \end{macrocode}
 % Enable print-mode math functions:
@@ -27446,7 +28655,7 @@
 \LWR at traceinfo{lateximage: ending outer-most lateximage}%
     \endLWR at print@minipage%
     \LWR at orignewpage%
-    \LWR at origscriptsize%
+    \LWR at print@scriptsize%
 %    \end{macrocode}
 % Close the \HTML\ comment which encapsulated any traces of the lateximage picked up by \prog{pdftotext}:
 %    \begin{macrocode}
@@ -27582,11 +28791,12 @@
 % \begin{macro}{\centering}
 % \changes{v0.54}{2018/04/19}{Added debug comment.}
 %    \begin{macrocode}
-\renewcommand*{\centering}{%
+\newcommand*{\LWR at HTML@centering}{%
 \ifbool{HTMLDebugComments}{%
     \LWR at htmlcomment{centering}%
 }{}%
 }
+\LWR at formatted{centering}
 %    \end{macrocode}
 % \end{macro}
 
@@ -27593,11 +28803,12 @@
 % \begin{macro}{\raggedleft}
 % \changes{v0.54}{2018/04/19}{Added debug comment.}
 %    \begin{macrocode}
-\renewcommand*{\raggedleft}{%
+\newcommand*{\LWR at HTML@raggedleft}{%
 \ifbool{HTMLDebugComments}{%
     \LWR at htmlcomment{raggedleft}%
 }{}%
 }
+\LWR at formatted{raggedleft}
 %    \end{macrocode}
 % \end{macro}
 
@@ -27604,11 +28815,12 @@
 % \begin{macro}{\raggedright}
 % \changes{v0.54}{2018/04/19}{Added debug comment.}
 %    \begin{macrocode}
-\renewcommand*{\raggedright}{%
+\newcommand*{\LWR at HTML@raggedright}{%
 \ifbool{HTMLDebugComments}{%
     \LWR at htmlcomment{raggedright}%
 }{}%
 }
+\LWR at formatted{raggedright}
 %    \end{macrocode}
 % \end{macro}
 
@@ -27790,11 +29002,11 @@
 %    \end{macrocode}
 %
 %
-% \textcolor{red}{After \pkg{xparse} may have been loaded \dots}
+% \textred{After \pkg{xparse} may have been loaded \dots}
 %    \begin{macrocode}
 \AtBeginDocument{
 %    \end{macrocode}
-% \textcolor{red}{\dots\ and \emph{only} if \pkg{xcolor} was loaded:}
+% \textred{\dots\ and \emph{only} if \pkg{xcolor} was loaded:}
 %    \begin{macrocode}
 \@ifpackageloaded{xcolor}{
 \LWR at traceinfo{patching xcolor}
@@ -28214,23 +29426,20 @@
 % Remember and patch some label-related defintions.
 % These will be further encased and patched by other packages later.
 %
+% \cs{label} and \cs{pageref} do NOT change their behavior according to
+% print or \HTML\ output, and thus do not use the \cs{LWR at formatted} system.
+%
 %    \begin{macrocode}
-\LetLtxMacro\LWR at origlabel\label
-\RenewDocumentCommand{\label}{}{\LWR at newlabel}
+\LetLtxMacro\LWR at orig@label\label
+\RenewDocumentCommand{\label}{}{\LWR at new@label}
 
-\LetLtxMacro\LWR at origref\ref
-\RenewDocumentCommand{\ref}{}{\LWR at newref}%
-
-\LetLtxMacro\LWR at origpageref\pageref
-\RenewDocumentCommand{\pageref}{}{\LWR at newpageref}
-
+\LetLtxMacro\LWR at orig@pageref\pageref
+\RenewDocumentCommand{\pageref}{}{\LWR at new@pageref}
 \end{warpHTML}
 %    \end{macrocode}
 
 
 
-
-
 % \section{Picture}
 % \label{sec:picture}
 
@@ -28471,7 +29680,7 @@
 %    \end{macrocode}
 % \cs{raggedright} cancels hyphenation, which will be done by \HTML\ instead.
 %    \begin{macrocode}
-\LWR at origraggedright%
+\LWR at print@raggedright%
 %    \end{macrocode}
 % Set minipage footnotes:
 %    \begin{macrocode}
@@ -29033,7 +30242,7 @@
 
 % \begin{macro}{\LWR at nullfonts} Removes formatting during filename operations.
 %
-% \textcolor{red}{Use only inside a group.}\watchout
+% \textred{Use only inside a group.}\watchout
 %
 % The following are \emph{not} made robust,
 %   since they must be expanded to their nullified versions.
@@ -29390,18 +30599,40 @@
 
 \renewrobustcmd*{\textellipsis}{\HTMLunicode{2026}}
 %    \end{macrocode}
+%
 % Direct-formatting font sizes are ignored:
+%
+% \changes{v0.58}{2018/06/07}{Improved print/\HTML\ output selection.}
 %    \begin{macrocode}
-\renewrobustcmd*{\normalsize}{}
-\renewrobustcmd*{\small}{}
-\renewrobustcmd*{\footnotesize}{}
-\renewrobustcmd*{\scriptsize}{}
-\renewrobustcmd*{\tiny}{}
-\renewrobustcmd*{\large}{}
-\renewrobustcmd*{\Large}{}
-\renewrobustcmd*{\LARGE}{}
-\renewrobustcmd*{\huge}{}
-\renewrobustcmd*{\Huge}{}
+\newrobustcmd*{\LWR at HTML@normalsize}{}
+\LWR at formatted{normalsize}
+
+\newrobustcmd*{\LWR at HTML@small}{}
+\LWR at formatted{small}
+
+\newrobustcmd*{\LWR at HTML@footnotesize}{}
+\LWR at formatted{footnotesize}
+
+\newrobustcmd*{\LWR at HTML@scriptsize}{}
+\LWR at formatted{scriptsize}
+
+\newrobustcmd*{\LWR at HTML@tiny}{}
+\LWR at formatted{tiny}
+
+\newrobustcmd*{\LWR at HTML@large}{}
+\LWR at formatted{large}
+
+\newrobustcmd*{\LWR at HTML@Large}{}
+\LWR at formatted{Large}
+
+\newrobustcmd*{\LWR at HTML@LARGE}{}
+\LWR at formatted{LARGE}
+
+\newrobustcmd*{\LWR at HTML@huge}{}
+\LWR at formatted{huge}
+
+\newrobustcmd*{\LWR at HTML@Huge}{}
+\LWR at formatted{Huge}
 %    \end{macrocode}
 %
 % \changes{v0.49}{2018/02/18}{Fix: Adapt to classes.}
@@ -29418,22 +30649,28 @@
 
 % \begin{macro}{\hfill}
 % \changes{v0.20}{2016/12/12}{Inserts a \cs{qquad}.}
+% \changes{v0.58}{2018/06/07}{Improved print/\HTML\ output selection.}
 %    \begin{macrocode}
-\renewcommand*{\hfill}{\qquad}
+\newcommand*{\LWR at HTML@hfill}{\qquad}
+\LWR at formatted{hfill}
 %    \end{macrocode}
 % \end{macro}
 
 % \begin{macro}{\hrulefill}
 % \changes{v0.20}{2017/01/19}{Inserts a short rule.}
+% \changes{v0.58}{2018/06/07}{Improved print/\HTML\ output selection.}
 %    \begin{macrocode}
-\renewcommand*{\hrulefill}{\rule{1in}{1pt}}
+\newcommand*{\LWR at HTML@hrulefill}{\rule{1in}{1pt}}
+\LWR at formatted{hrulefill}
 %    \end{macrocode}
 % \end{macro}
 
 % \begin{macro}{\dotfill}
 % \changes{v0.20}{2017/01/19}{Inserts an ellipsis.}
+% \changes{v0.58}{2018/06/07}{Improved print/\HTML\ output selection.}
 %    \begin{macrocode}
-\renewcommand*{\dotfill}{\dots}
+\newcommand*{\LWR at HTML@dotfill}{\dots}
+\LWR at formatted{dotfill}
 %    \end{macrocode}
 % \end{macro}
 
@@ -30871,9 +32108,9 @@
 % \pkg{lwarp} caption handling:
 %    \begin{macrocode}
 \renewcommand{\algocf at makecaption}[2]{%
-\LWR at caption@begin{algocf}%
+\LWR at HTML@caption at begin{algocf}%
 \algocf at captiontext{#1}{#2}%
-\LWR at caption@end%
+\LWR at HTML@caption at end%
 }
 %    \end{macrocode}
 %
@@ -30881,21 +32118,21 @@
 % Print any caption where it is declared:
 %    \begin{macrocode}
 \renewcommand{\algocf at makecaption@plain}[2]{%
-    \LWR at caption@begin{algocf}%
+    \LWR at HTML@caption at begin{algocf}%
     \algocf at captiontext{#1}{#2}%
-    \LWR at caption@end%
+    \LWR at HTML@caption at end%
 }
 
 \renewcommand{\algocf at makecaption@boxed}[2]{%
-    \LWR at caption@begin{algocf}%
+    \LWR at HTML@caption at begin{algocf}%
     \algocf at captiontext{#1}{#2}%
-    \LWR at caption@end%
+    \LWR at HTML@caption at end%
 }
 
 \renewcommand{\algocf at makecaption@ruled}[2]{%
-    \LWR at caption@begin{algocf}%
+    \LWR at HTML@caption at begin{algocf}%
     \algocf at captiontext{#1}{#2}%
-    \LWR at caption@end%
+    \LWR at HTML@caption at end%
 }
 %    \end{macrocode}
 %
@@ -31128,7 +32365,7 @@
 % \fi
 %
 % \part{lwarp-alltt.sty}
-
+%
 % \section{alltt}
 %
 % \credits{Johannes Braams}
@@ -31143,7 +32380,7 @@
 %    \begin{macrocode}
 \LWR at ProvidesPackagePass{alltt}
 %    \end{macrocode}
-
+%
 %    \begin{macrocode}
 \AfterEndPreamble{
 \LWR at traceinfo{Patching alltt.}
@@ -31156,7 +32393,7 @@
 }
 }
 %    \end{macrocode}
-
+%
 % \iffalse
 %</alltt>
 % \fi
@@ -31239,7 +32476,7 @@
     \else % numbered theorem, need to check for optional arg
       \def\@tempa{\@oparg{\@ynthm{#2}}[]}%
     \fi
-    \AtBeginEnvironment{#2}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#2}}}% lwarp
+    \AtBeginEnvironment{#2}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#2}}}% lwarp
   }%
   \@tempa
 }
@@ -31558,24 +32795,24 @@
 % \pkg{array} is used as-is for print output, and emulated for \HTML.
 %
 % \changes{v0.45}{2017/12/03}{\pkg{array}: Added.}
+% \changes{v0.58}{2018/06/07}{\pkg{array}: Improved print/\HTML\ output selection.}
 %
 % \codehtml
 %
+% Remove the dummy macros:
 %    \begin{macrocode}
+\let\firsthline\relax
+\let\lasthline\relax
+
 \LWR at ProvidesPackagePass{array}
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\let\LWR at origfirsthline\firsthline
-\let\LWR at origlasthline\lasthline
+\newcommand*{\LWR at HTML@firsthline}{\LWR at HTMLhline}%
+\LWR at expandableformatted{firsthline}
 
-\appto\LWR at restoreorigformatting{%
-\let\firsthline\LWR at origfirsthline%
-\let\lasthline\LWR at origlasthline%
-}
-
-\renewcommand*{\firsthline}{\LWR at HTMLhline}%
-\renewcommand*{\lasthline}{\LWR at HTMLhline}%
+\newcommand*{\LWR at HTML@lasthline}{\LWR at HTMLhline}%
+\LWR at expandableformatted{lasthline}
 %    \end{macrocode}
 %
 % \iffalse
@@ -31753,6 +32990,223 @@
 %
 %
 % \iffalse
+%<*attachfile>
+% \fi
+%
+% \part{lwarp-attachfile.sty}
+
+% \section{attachfile}
+%
+% \credits{Scott Pakin}
+%
+% \DescribePackage{attachfile}
+% \pkg{attachfile} is patched for use by \pkg{lwarp}.
+%
+% Metadata is ignored for now.\watchout
+%
+% \changes{v0.58}{2018/06/08}{\pkg{attachfile}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{attachfile}
+%    \end{macrocode}
+%
+% Encloses each icon:
+%    \begin{macrocode}
+\newenvironment*{LWR at attachfile@icon}
+{
+    \begin{lateximage}*%
+        [-attachfile-]%
+        [%
+            \detokenize\expandafter{\atfi at icon@icon}-%
+            \detokenize\expandafter{\atfi at color@rgb}%
+        ]%
+}
+{
+    \end{lateximage}
+}
+%    \end{macrocode}
+%
+% Each icon is enclosed inside a \env{LWR at attachfile@icon} environment:
+%    \begin{macrocode}
+\xpretocmd{\atfi at acroGraph}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroGraph}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroPaperclip}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroPaperclip}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroPushPin}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroPushPin}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroTag}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroTag}{\endLWR at attachfile@icon}{}{}
+%    \end{macrocode}
+%
+% Disable \PDF\ file embedding:
+%    \begin{macrocode}
+\DeclareRobustCommand{\atfi at embedfile}[1]{}
+%    \end{macrocode}
+%
+% The displayed output for an \cs{attachfile} reference:
+%    \begin{macrocode}
+\newcommand*{\LWR at attachfile@appearance}{}
+
+\DeclareRobustCommand{\atfi at set@appearance}[1]{%
+    \def\LWR at attachfile@appearance{#1}%
+}
+%    \end{macrocode}
+%
+% A file annotation becomes a reference:
+%    \begin{macrocode}
+\DeclareRobustCommand{\atfi at insert@file at annot}[1]{%
+    \href{#1}{\LWR at attachfile@appearance}%
+}
+%    \end{macrocode}
+
+% \iffalse
+%</attachfile>
+% \fi
+%
+%
+%
+%
+% \iffalse
+%<*attachfile2>
+% \fi
+%
+% \part{lwarp-attachfile2.sty}
+
+% \section{attachfile2}
+%
+% \credits{Heiko Oberdiek}
+%
+% \DescribePackage{attachfile2}
+% \pkg{attachfile2} is patched for use by \pkg{lwarp}.
+%
+% Metadata is ignored for now.\watchout
+%
+% \changes{v0.58}{2018/06/08}{\pkg{attachfile2}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{attachfile2}
+%    \end{macrocode}
+%
+% Adds memory of the selected color:
+%    \begin{macrocode}
+\def\LWR at attachfiletwo@color{}%
+
+\define at key{AtFi}{color}{%
+    \def\LWR at attachfiletwo@color{#1}%   lwarp
+  \HyColor at AttachfileColor{#1}%
+          \atfi at color@tex\atfi at color@inline\atfi at color@annot
+          {attachfile2}{color}%
+}
+%    \end{macrocode}
+%
+% Encloses each icon:
+%    \begin{macrocode}
+\newenvironment*{LWR at attachfile@icon}
+{
+    \begin{lateximage}*%
+        [-attachfile-]%
+        [%
+            \detokenize\expandafter{\atfi at icon@icon}-%
+            \detokenize\expandafter{\LWR at attachfiletwo@color}%
+        ]%
+}
+{
+    \end{lateximage}
+}
+%    \end{macrocode}
+%
+% Each icon is enclosed inside a \env{LWR at attachfile@icon} environment:
+%    \begin{macrocode}
+\xpretocmd{\atfi at acroGraph}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroGraph}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroPaperclip}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroPaperclip}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroPushPin}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroPushPin}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroTag}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroTag}{\endLWR at attachfile@icon}{}{}
+%    \end{macrocode}
+%
+% Disable \PDF\ file embedding:
+%    \begin{macrocode}
+\DeclareRobustCommand{\atfi at embedfile}[1]{}
+%    \end{macrocode}
+%
+% The displayed output for an \cs{attachfile} reference:
+%    \begin{macrocode}
+\newcommand*{\LWR at attachfile@appearance}{}
+
+\def\atfi at set@appearance at icon{%
+    \atfi at set@appearance{\csname atfi at acro\atfi at icon@icon\endcsname}%
+}
+
+\DeclareRobustCommand{\atfi at set@appearance}[1]{%
+    \def\LWR at attachfile@appearance{#1}%
+}
+%    \end{macrocode}
+%
+% A file annotation becomes a reference:
+%    \begin{macrocode}
+\DeclareRobustCommand{\atfi at insert@file at annot}[1]{%
+    \href{#1}{\LWR at attachfile@appearance}%
+}
+%    \end{macrocode}
+%
+% Modified for text color:
+%    \begin{macrocode}
+\DeclareRobustCommand{\notextattachfile}[2][]{%
+  \begingroup
+    \atfi at setup{#1}%
+    \ifatfi at print
+      \leavevmode
+      \begingroup
+        \HyColor at UseColor\atfi at color@tex
+        \LWR at textcurrentcolor{#2}%      lwarp
+% \strut
+      \endgroup
+%     \else
+%       \sbox\ltx at zero{#2\strut}%
+%       \makebox[\wd0]{}%
+    \fi
+  \endgroup
+}
+%    \end{macrocode}
+%
+% Modified to draw the icon:
+%    \begin{macrocode}
+\DeclareRobustCommand{\noattachfile}[1][]{%
+  \begingroup
+    \atfi at setup{#1}%
+    \atfi at set@appearance at icon
+    \ifatfi at print
+        \LWR at attachfile@appearance%     lwarp
+%       \expandafter
+%       \atfi at refxform\csname atfi at appobj@\atfi at icon@icon\endcsname
+%     \else
+%       \makebox[\atfi at appearancewidth]{}%
+    \fi
+  \endgroup
+}
+%    \end{macrocode}
+
+% \iffalse
+%</attachfile2>
+% \fi
+%
+%
+%
+%
+% \iffalse
 %<*authblk>
 % \fi
 %
@@ -32666,6 +34120,59 @@
 %
 %
 % \iffalse
+%<*cases>
+% \fi
+%
+% \part{lwarp-cases.sty}
+%
+% \section{cases}
+%
+% \credits{Donald Arseneau}
+%
+% \DescribePackage{cases}
+% \pkg{cases} is patched for use by \pkg{lwarp}.
+%
+% \changes{v0.58}{2018/06/08}{\pkg{cases}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{cases}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\BeforeBeginEnvironment{numcases}{
+    \begin{BlockClass}{displaymathnumbered}
+    \LWR at newautoidanchor%
+    \booltrue{LWR at indisplaymathimage}%
+    \begin{lateximage}[-cases- \mathimagename]
+}
+
+\AfterEndEnvironment{numcases}{
+    \end{lateximage}\end{BlockClass}
+}
+
+\BeforeBeginEnvironment{subnumcases}{
+    \begin{BlockClass}{displaymathnumbered}
+    \LWR at newautoidanchor%
+    \booltrue{LWR at indisplaymathimage}%
+    \begin{lateximage}[-cases- \mathimagename]
+}
+
+\AfterEndEnvironment{subnumcases}{
+    \end{lateximage}\end{BlockClass}
+}
+%    \end{macrocode}
+%
+% \iffalse
+%</cases>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*ccaption>
 % \fi
 
@@ -33923,7 +35430,7 @@
 % \subsection{Reactions}
 %
 % \begin{noindmacro}{\chemmacros\_declare\_reaction\_env} \\
-%   \hspace*{2em} \marg{chem} \marg{math} \marg{args number} \marg{argument list (\{\#2\}\{\#3\}...)}
+%   \fqquad \marg{chem} \marg{math} \marg{args number} \marg{argument list (\{\#2\}\{\#3\}...)}
 %    \begin{macrocode}
 \AtBeginDocument{
 \@ifchemmacrosmoduleloaded{reactions}{
@@ -34979,7 +36486,7 @@
 %    \begin{macrocode}
 \def\diagbox at double#1#2#3{%
 \setkeys{diagbox}{dir=NW,#1}%
-\csuse{LWR at diagbox\diagbox at dir}{#2}{#3}%
+\@nameuse{LWR at diagbox\diagbox at dir}{#2}{#3}%
 }
 %    \end{macrocode}
 % \end{noindmacro}
@@ -35015,7 +36522,7 @@
 %    \begin{macrocode}
 \def\diagbox at triple#1#2#3#4{%
 \setkeys{diagbox}{dir=NW,#1}%
-\csuse{LWR at diagboxT\diagbox at dir}{#3}{#2}{#4}%
+\@nameuse{LWR at diagboxT\diagbox at dir}{#3}{#2}{#4}%
 }
 %    \end{macrocode}
 % \end{noindmacro}
@@ -35460,8 +36967,8 @@
 
 \renewcommand*{\newlist}[3]{%
 \LWR at orignewlist{#1}{#2}{#3}%
-\AtBeginEnvironment{#1}{\csuse{LWR@#2start}}%
-\AtEndEnvironment{#1}{\csuse{LWR@#2end}}%
+\AtBeginEnvironment{#1}{\@nameuse{LWR@#2start}}%
+\AtEndEnvironment{#1}{\@nameuse{LWR@#2end}}%
 }
 %    \end{macrocode}
 
@@ -35680,11 +37187,7 @@
 %     {\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.}
-    }
+    {\LWR at patcherror{erratum}{erratumAdd}}
 
 \xpatchcmd{\erratumDelete}
     {$_d^{\arabic{erratum}}$}
@@ -35691,11 +37194,7 @@
 %     {\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.}
-    }
+    {\LWR at patcherror{erratum}{erratumDelete}}
 
 \xpatchcmd{\erratumReplace}
     {$_r^{\arabic{erratum}}$}
@@ -35702,11 +37201,7 @@
 %     {\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.}
-    }
+    {\LWR at patcherror{erratum}{erratumReplace}}
 
 \xpatchcmd{\erratum}
     {$_a$}
@@ -35713,11 +37208,7 @@
 %     {\StartDynamicMath$_a$\StopDynamicMath}
     {\textsubscript{a}}
     {}
-    {
-        \PackageError{lwarp}
-        {Unable to patch the erratum package, eDelete macro}
-        {Please contact the author of the lwarp package.}
-    }
+    {\LWR at patcherror{erratum}{erratumDelete}}
 
 \xpatchcmd{\erratum}
     {$_d^{\@thefnmark}$}
@@ -35724,11 +37215,7 @@
 %     {\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.}
-    }
+    {\LWR at patcherror{erratum}{eDelete}}
 
 \xpatchcmd{\erratum}
     {$_r^{\@thefnmark}$}
@@ -35735,11 +37222,7 @@
 %     {\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.}
-    }
+    {\LWR at patcherror{erratum}{eReplace}}
 %    \end{macrocode}
 
 % Finish the current page's errata before closing and reloading the list:
@@ -38414,6 +39897,7 @@
 \setupglossaries{nonumberlist}
 \setglossarystyle{index}
 %    \end{macrocode}
+%
 % Patched to fix \acro{TOC} pointing to the previous page:
 %    \begin{macrocode}
 \renewcommand*{\@p at glossarysection}[2]{%
@@ -39465,7 +40949,7 @@
 %
 % \begin{noindmacro}{\hangpara} \marg{indent} \marg{afternum}
 %
-% \textcolor{red}{Use \env{hangparas} instead.}
+% \textred{Use \env{hangparas} instead.}
 %    \begin{macrocode}
 \newcommand*{\hangpara}[2]{}
 %    \end{macrocode}
@@ -40152,13 +41636,13 @@
 %    \begin{macrocode}
 \newcommand{\LWR at indexprenote}{}
 
-\renewcommand*{\printindex}
-{
+\preto\printindex{
+
+\LWR at orignewpage
 \LWR at startpars
 
 \LWR at indexprenote
 
-\LWR at origprintindex
 }
 
 \newcommand{\setindexprenote}[1]{\renewcommand{\LWR at indexprenote}{#1}}
@@ -40225,8 +41709,274 @@
 %
 %
 %
+% \iffalse
+%<*imakeidx>
+% \fi
 %
+% \part{lwarp-imakeidx.sty}
+%
+% \section{imakeidx}
+% \label{sec:imakeidx}
+%
+% \credits{Enrico Gregorio}
+%
+% \DescribePackage{imakeidx}
+% \pkg{imakeidx} is patched for use by \pkg{lwarp}.
+%
+% \limitsimakeidx
+%
+% \changes{v0.58}{2018/06/13}{\pkg{imakeidx}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{imakeidx}
+%    \end{macrocode}
+%
+% Use the new \HTML\ suffix:
+%    \begin{macrocode}
+\catcode`\_=12%
+\define at key{imki}{name}{\def\imki at name{#1_html}}
+\catcode`\_=8%
+%    \end{macrocode}
+%
+% \begin{noindmacro}{\printindex}
+% The \HTML\ version of \cs{printindex}:
+%    \begin{macrocode}
+\catcode`\_=12%
+
+\renewcommand*{\printindex}[1][\imki at jobname]{%
+\LWR at orignewpage%
+\LWR at startpars%
+\ifstrequal{#1}{\imki at jobname}{%
+  \@ifundefined{#1 at idxfile}{%
+        \imki at error{#1}%
+    }{%
+        \imki at putindex{#1}%
+    }%
+}{%
+  \@ifundefined{#1_html at idxfile}{\imki at error{#1_html}}{\imki at putindex{#1_html}}%
+}%
+}
+
+\catcode`\_=8%
+%    \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\@index}
+% The \HTML\ version of \cs{\@index}:
+%    \begin{macrocode}
+\catcode`\_=12%
+
+\def\@index[#1]{%
+    \ifstrequal{#1}{\imki at jobname}%
+    {%
+        \@ifundefined{#1 at idxfile}%
+        {%
+            \PackageWarning{imakeidx}{Undefined index file `#1'}%
+            \begingroup
+            \@sanitize
+            \imki at nowrindex%
+        }%
+        {%
+            \edef\@idxfile{#1}%
+            \begingroup
+            \@sanitize
+            \@wrindex\@idxfile%
+        }%
+    }%
+    {%
+        \@ifundefined{#1_html at idxfile}%
+        {%
+            \PackageWarning{imakeidx}{Undefined index file `#1_html'}%
+            \begingroup
+            \@sanitize
+            \imki at nowrindex%
+        }%
+        {%
+            \edef\@idxfile{#1_html}%
+            \begingroup
+            \@sanitize
+            \@wrindex\@idxfile%
+        }%
+    }%
+}
+
+\catcode`\_=8%
+%    \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\item}
+% \begin{noindmacro}{\subitem}
+% \begin{noindmacro}{\subsubitem}
+% \HTML\ versions of \cs{item}, etc.:
+%    \begin{macrocode}
+\appto\theindex{%
+    \let\item\LWR at indexitem%
+    \let\subitem\LWR at indexsubitem%
+    \let\subsubitem\LWR at indexsubsubitem%
+}
+%    \end{macrocode}
+% \end{noindmacro}
+% \end{noindmacro}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\imki at wrindexentrysplit} \marg{file} \marg{entry} \marg{page}
+% \begin{noindmacro}{\imki at wrindexentryunique} \marg{file} \marg{entry} \marg{page}
+%
+% While writing index entries, adds an \HTML\ label, and
+% writes the label's index instead of the page number:
+%    \begin{macrocode}
+\renewcommand\imki at wrindexentrysplit[3]{%
+\addtocounter{LWR at autoindex}{1}%
+\LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%
+  \expandafter\protected at write\csname#1 at idxfile\endcsname{}%
+    {\string\indexentry{#2}{\arabic{LWR at autoindex}}}%
+}
+
+\renewcommand\imki at wrindexentryunique[3]{%
+\addtocounter{LWR at autoindex}{1}%
+\LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%
+  \protected at write\@indexfile{}%
+    {\string\indexentry[#1]{#2}{\arabic{LWR at autoindex}}}%
+}
+
+\def\imki at wrindexsplit#1#2{%
+\imki at wrindexentrysplit{#1}{#2}{\thepage}%
+\endgroup\imki at showidxentry{#1}{#2}%
+  \@esphack%
+}
+
+\def\imki at wrindexunique#1#2{%
+\imki at wrindexentryunique{#1}{#2}{\thepage}%
+\endgroup\imki at showidxentry{#1}{#2}%
+  \@esphack%
+  }
+
+%    \end{macrocode}
+% \end{noindmacro}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\LWR at imki@setxdydefopts}
+%
+% Sets the \pkg{xindy} \HTML\ options, ignoring the user's settings.
+%    \begin{macrocode}
+\newcommand*{\LWR at imki@setxdydefopts}{%
+    \edef\imki at options{ \space %
+        -M \space \LWR at xindyStyle\space %
+        -L \space \LWR at xindyLanguage\space %
+        -C \space \LWR at xindyCodepage\space %
+    }%
+}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\LWR at imki@setdefopts} \marg{user options}
+%
+% Sets the \HTML\ options, added to the user's settings,
+% depending on whether \pkg{makeindex} or \pkg{xindy} are used.
+%
+% For \prog{makeindex}, the user's choice is ignored, and only the \pkg{lwarp}
+% version is used.  (Only one style at a time is possible.)
+%
+% For \prog{xindy}, multiple modules may be specified, and the \pkg{lwarp}
+% version is appended.
+%    \begin{macrocode}
+\newcommand*{\LWR at imki@setdefopts}[1]{%
+\ifblank{#1}{%
+    \edef\imki at options{\space -s \space \LWR at makeindexStyle \space}%
+    \ifdefstring{\imki at progdefault}{xindy}{\LWR at imki@setxdydefopts}{}%
+    \ifdefstring{\imki at progdefault}{texindy}{\LWR at imki@setxdydefopts}{}%
+    \ifdefstring{\imki at progdefault}{truexindy}{\LWR at imki@setxdydefopts}{}%
+}{%
+    \edef\imki at options{\space #1 \space}%
+}%
+}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\imki at makeindex}
+% Use the new \HTML\ options:
+%    \begin{macrocode}
+\xpatchcmd{\imki at makeindex}
+    {\let\imki at options\space}
+    {\LWR at imki@setdefopts{}}%
+    {}
+    {\LWR at patcherror{imakeidx}{makeindex}}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+% Use the new \HTML\ options.
+%    \begin{macrocode}
+\define at key{imki}{options}{\LWR at imki@setdefopts{#1}}
+%    \end{macrocode}
+%
+% \begin{noindmacro}{\imki at resetdefaults}
+% Use the new \HTML\ options:
+%    \begin{macrocode}
+\xpatchcmd{\imki at resetdefaults}
+    {\def\imki at options{ }}
+    {\LWR at imki@setdefopts{}}
+    {}
+    {\LWR at patcherror{imakeidx}{resetdefaults}}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+% \env{theindex} was already defined \cs{AtBeginDocument} by  the \pkg{lwarp} core,
+% so it must be redefined here similarly, but patched for \pkg{imakeidx}:
+% \begin{noindenvironment}{theindex}
+%    \begin{macrocode}
+\AtBeginDocument{
+\renewenvironment*{theindex}{%
+    \imki at maybeaddtotoc
+     \imki at indexlevel{\indexname}
+    \let\item\LWR at indexitem%
+    \let\subitem\LWR at indexsubitem%
+    \let\subsubitem\LWR at indexsubsubitem%
+}{}
+}% AtBeginDocument
+%    \end{macrocode}
+% \end{noindenvironment}
+%
+%
+% Update to the new defaults:
+%    \begin{macrocode}
+\imki at resetdefaults
+%    \end{macrocode}
+%
+% Update to the new patches:
+%
+% \cs{AtBeginDocument} is because \cs{@wrindex} is previously defined
+% as \cs{AtBeginDocument} in the \pkg{lwarp} core.
+%
+%    \begin{macrocode}
+\ifimki at splitindex
+  \let\imki at startidx\imki at startidxunique
+  \AtBeginDocument{\let\@wrindex\imki at wrindexunique}
+  \let\imki at putindex\imki at putindexunique
+  \let\imki at wrindexentry\imki at wrindexentryunique
+  \let\imki at startidxsplit\@undefined
+  \let\imki at wrindexsplit\@undefined
+  \let\imki at putindexsplit\@undefined
+\else
+  \let\imki at startidx\imki at startidxsplit
+  \AtBeginDocument{\let\@wrindex\imki at wrindexsplit}
+  \let\imki at putindex\imki at putindexsplit
+  \let\imki at wrindexentry\imki at wrindexentrysplit
+  \let\imki at startidxunique\@undefined
+  \let\imki at wrindexunique\@undefined
+  \let\imki at putindexunique\@undefined
+\fi
+%    \end{macrocode}
+%
 % \iffalse
+%</imakeidx>
+% \fi
+%
+%
+%
+%
+% \iffalse
 %<*indentfirst>
 % \fi
 
@@ -40255,6 +42005,110 @@
 %
 %
 % \iffalse
+%<*index>
+% \fi
+%
+% \part{lwarp-index.sty}
+%
+% \section{index}
+% \label{sec:indexpkg}
+%
+% \credits{David M. Jones}
+%
+% \DescribePackage{index}
+% \pkg{index} is patched for use by \pkg{lwarp}.
+%
+% \changes{v0.58}{2018/07/06}{\pkg{index}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{index}
+%    \end{macrocode}
+%
+% Use \cs{theLWR at autoindex} instead of \cs{thepage}.
+% \cs{@tempswatrue} is used to force an immediate write to the index file
+% instead of waiting until the end of the page.
+%    \begin{macrocode}
+\xpatchcmd{\newindex}
+    {\x at newindex[thepage]}
+    {%
+        \@tempswatrue%
+        \x at newindex[theLWR at autoindex]%
+    }
+    {}
+    {\LWR at patcherror{index}{newindex}}
+
+\xpatchcmd{\renewindex}
+    {\x at renewindex[thepage]}
+    {%
+        \@tempswatrue%
+        \x at renewindex[theLWR at autoindex]%
+    }
+    {}
+    {\LWR at patcherror{index}{renewindex}}
+%    \end{macrocode}
+%
+% Patched to set a new autoindex:
+%    \begin{macrocode}
+\xpatchcmd{\@wrindex}
+    {\begingroup}
+    {%
+        \addtocounter{LWR at autoindex}{1}%                    lwarp
+        \LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%    lwarp
+        \begingroup%
+    }
+    {}
+    {\LWR at patcherror{index}{@wrindex}}
+%    \end{macrocode}
+%
+% \cs{AtBeginDocument} \pkg{lwarp} core \cs{let}s \cs{@wrindex} to \cs{LWR at wrindex}.
+% Since the \pkg{index} package has been loaded, \cs{let} to its version instead:
+%    \begin{macrocode}
+\let\LWR at index@wrindex\@wrindex
+
+\AtBeginDocument{
+\let\@wrindex\LWR at index@wrindex
+}
+%    \end{macrocode}
+%
+% Modified to add \cs{index at prologue}:
+%    \begin{macrocode}
+\AtBeginDocument{
+\renewenvironment*{theindex}{%
+    \LWR at indexsection{\indexname}%
+    \ifx\index at prologue\@empty\else
+        \index at prologue
+        \bigskip
+    \fi
+    \let\item\LWR at indexitem%
+    \let\subitem\LWR at indexsubitem%
+    \let\subsubitem\LWR at indexsubsubitem%
+}{}
+}% AtBeginDocument
+%    \end{macrocode}
+%
+%
+% Disabled:
+%    \begin{macrocode}
+\def\@showidx#1{}
+\let\@texttop\relax
+\renewcommand*{\raggedbottom}{}
+\renewcommand*{\flushbottom}{}
+\renewcommand*{\markboth}[2]{}
+\renewcommand*{\markright}[1]{}
+%    \end{macrocode}
+
+%
+% \iffalse
+%</index>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*inputenc>
 % \fi
 %
@@ -40317,6 +42171,40 @@
 %
 %
 % \iffalse
+%<*intopdf>
+% \fi
+%
+% \part{lwarp-intopdf.sty}
+%
+% \section{intopdf}
+%
+% \DescribePackage{intopdf}
+% \pkg{intopdf} is emulated.
+%
+% \changes{v0.58}{2018/06/08}{\pkg{intopdf}: Added.}
+%
+% The MIME type and description are ignored for now.
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{intopdf}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\NewDocumentCommand{\attachandlink}{m o m m}{%
+    \href{#1}{#4}%
+}
+%    \end{macrocode}
+%
+% \iffalse
+%</intopdf>
+% \fi
+%
+%
+%
+%
+% \iffalse
 %<*keyfloat>
 % \fi
 
@@ -41638,6 +43526,46 @@
 %
 %
 % \iffalse
+%<*makeidx>
+% \fi
+%
+% \part{lwarp-makeidx.sty}
+%
+% \section{makeidx}
+%
+% \credits{\LaTeX\ Project Team}
+%
+% \DescribePackage{makeidx}
+% \pkg{makeidx} is patched for use by \pkg{lwarp}.
+%
+% \changes{v0.58}{2018/06/30}{\pkg{makeidx}: Added.  Moved from \pkg{lwarp} core.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{makeidx}
+%    \end{macrocode}
+%
+% \cs{@wrindex} is redefined \cs{AtBeginDocument} by the \pkg{lwarp} core.
+%
+% \begin{macro}{\printindex}
+%
+% \changes{v0.58}{2018/06/13}{Fix: Extra \cs{newpage} to flush pending \cs{index} writes.}
+%    \begin{macrocode}
+\preto\printindex{%
+    \LWR at orignewpage%
+    \LWR at startpars%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \iffalse
+%</makeidx>
+% \fi
+%
+%
+%
+% \iffalse
 %<*marginfit>
 % \fi
 %
@@ -41882,15 +43810,15 @@
 % ^^A \DescribeMacro{\mdfsetup}
 % To handle CSS and paragraphs,
 % patch code at start and end of environment and contents.
-% \cs{LWR at origraggedright} helps avoid hyphenation.
+% \cs{LWR at print@raggedright} helps avoid hyphenation.
 %
 % \changes{v0.25}{2017/03/16}{\pkg{mdframed}: Help avoid hyphenation.}
 %
 %    \begin{macrocode}
 \mdfsetup{
-startcode={\LWR at mdframedstart\LWR at origraggedright},
+startcode={\LWR at mdframedstart\LWR at print@raggedright},
 endcode={\LWR at mdframedend},
-startinnercode={\LWR at startpars\LWR at origraggedright},
+startinnercode={\LWR at startpars\LWR at print@raggedright},
 endinnercode={\LWR at stoppars},
 }
 %    \end{macrocode}
@@ -41903,7 +43831,7 @@
 % Given the \pkg{mdframed} key, print the color.
 %    \begin{macrocode}
 \newcommand*{\LWR at mdfprintcolor}[1]{%
-\convertcolorspec{named}{\csuse{mdf@#1}}{HTML}\LWR at tempcolor%
+\convertcolorspec{named}{\@nameuse{mdf@#1}}{HTML}\LWR at tempcolor%
 \LWR at origpound\LWR at tempcolor
 }
 %    \end{macrocode}
@@ -41914,7 +43842,7 @@
 % Given the \pkg{mdframed} key, print the length.
 %    \begin{macrocode}
 \newcommand*{\LWR at mdfprintlength}[1]{%
-\LWR at printlength{\csuse{mdf@#1 at length}}
+\LWR at printlength{\@nameuse{mdf@#1 at length}}
 }
 %    \end{macrocode}
 % \end{noindmacro}
@@ -42201,8 +44129,8 @@
 % Perform the original subtitle action:
 %    \begin{macrocode}
 \IfNoValueTF{#2}
-{\csuse{LWR at origmdf#1title}{#3}}%
-{\csuse{LWR at origmdf#1title}[#2]{#3}}%
+{\@nameuse{LWR at origmdf#1title}{#3}}%
+{\@nameuse{LWR at origmdf#1title}[#2]{#3}}%
 %    \end{macrocode}
 % Close the span and unnest the paragraph tag restriction:
 %    \begin{macrocode}
@@ -43868,7 +45796,7 @@
         \@thm{#1}{#1}{#2}
         }%
      \global\@namedef{end#1}{\@endtheorem}
-     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
   \fi
 }
 
@@ -43884,7 +45812,7 @@
         \@thm{#1}{#1}{#2}
         }%
      \global\@namedef{end#1}{\@endtheorem}
-     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
   \fi
 }
 
@@ -43905,7 +45833,7 @@
                 \@thm{#1}{#2}{#3}
         }%
      \global\@namedef{end#1}{\@endtheorem}
-     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
   \fi}
 }
 %    \end{macrocode}
@@ -44712,6 +46640,178 @@
 %
 %
 % \iffalse
+%<*pdfpages>
+% \fi
+%
+% \part{lwarp-pdfpages.sty}
+%
+% \section{pdfpages}
+%
+% \credits{Andreas Matthias}
+%
+% \DescribePackage{pdfpages}
+% \pkg{pdfpages} is patched for use by \pkg{lwarp}.
+%
+% Option \optn{link} and \optn{linkname} work:
+% \begin{Verbatim}[tabsize=4,gobble=2,frame=lines]
+% \hyperlink{<filename>.pdf.<pagenubmer}}{some text}
+% \hyperlink{<linkname>.<pagenubmer}}{some text}
+% \end{Verbatim}
+%
+% Options which make no sense in \HTML\ are disabled.
+%
+% \changes{v0.58}{2018/06/11}{\pkg{pdfpages}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{pdfpages}
+%    \end{macrocode}
+%
+% Disable option which have no meaning for \HTML\ output:
+%    \begin{macrocode}
+\define at key{pdfpages}{fitpaper}[false]{}
+\define at key{pdfpages}{landscape}[false]{}
+\define at key{pdfpages}{openright}[false]{}
+\define at key{pdfpages}{signature}{}
+\define at key{pdfpages}{signature*}{}
+\define at key{pdfpages}{booklet}[false]{}
+\define at key{pdfpages}{rotateoversize}[false]{}
+\define at key{pdfpages}{doublepages}[false]{}
+\define at key{pdfpages}{doublepagestwist}[false]{}
+\define at key{pdfpages}{doublepagestwistodd}[false]{}
+\define at key{pdfpages}{doublepagestwist*}[false]{}
+\define at key{pdfpages}{doublepagestwistodd*}[false]{}
+\define at key{pdfpages}{duplicatepages}[2]{}
+\define at key{pdfpages}{thread}[false]{}
+\define at key{pdfpages}{threadname}{}
+\define at key{pdfpages}{linkfit}{}
+\define at key{pdfpages}{linktodoc}[false]{}
+\define at key{pdfpages}{linktodocfit}{}
+\define at key{pdfpages}{linkfilename}{}
+\define at key{pdfpages}{survey}[false]{}
+\define at key{pdfpages}{survey-nolink}[false]{}
+\define at key{pdfpages}{newwindow}[false]{}
+%    \end{macrocode}
+%
+% Use print mode while measuring the page numbers:
+%    \begin{macrocode}
+\xpretocmd{\AM at getpagecount}{\LWR at restoreorigformatting}{}{}
+%    \end{macrocode}
+%
+% Emulate a bit of \pkg{eso-pic}:
+%    \begin{macrocode}
+\newif\ifESO at texcoord
+
+\newcommand{\ESO at HookIIBG}{}
+
+\renewcommand{\AM at AddToShipoutPicture}{\g at addto@macro\ESO at HookIIBG}
+
+\renewcommand{\ClearShipoutPicture}{}
+%    \end{macrocode}
+%
+% \begin{noindmacro}{\LWR at esopic@newpage}
+% At each \cs{newpage}.
+%
+%    \begin{macrocode}
+\newcommand*{\LWR at esopic@newpage}{%
+%    \end{macrocode}
+%
+% Is there something to draw?
+%    \begin{macrocode}
+\ifdefvoid{\ESO at HookIIBG}%
+{}%
+{%
+%    \end{macrocode}
+%
+% If the \optn{link} option was specified, add a hyper taraget:
+%    \begin{macrocode}
+    \ifAM at link%
+        \hypertarget{\AM at linkname.\AM at page}{}%
+    \fi%
+%    \end{macrocode}
+%
+% Draw inside a picture environment of the size of a virtual page:
+%    \begin{macrocode}
+    \begingroup%
+    \setlength{\unitlength}{1in}%
+    \begin{picture}(8,10.5)%
+    \ESO at HookIIBG%
+    \end{picture}%
+    \endgroup%
+    \global\let\ESO at HookIIBG\@empty%
+}
+}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\AM at output}
+% Patched to use \cs{LWR at esopic@newpage}.
+%    \begin{macrocode}
+\xpatchcmd{\AM at output}
+    {\newpage}
+    {\LWR at esopic@newpage}
+    {}
+    {\LWR at patcherror{pdfpages}{AM at output-1}}
+
+\xpatchcmd{\AM at output}
+    {\newpage}
+    {\LWR at esopic@newpage}
+    {}
+    {\LWR at patcherror{pdfpages}{AM at output-2}}
+
+\xpatchcmd{\AM at output}
+    {\newpage}
+    {\LWR at esopic@newpage}
+    {}
+    {\LWR at patcherror{pdfpages}{AM at output-3}}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\includepdf} Patched to set a reasonable paper size.
+%    \begin{macrocode}
+\xpretocmd{\includepdf}{%
+    \begingroup%
+    \setlength{\paperwidth}{8in}%
+    \setlength{\paperheight}{10.5in}%
+}{}{}
+
+\xapptocmd{\includepdf}{%
+    \endgroup%
+}{}{}
+%    \end{macrocode}
+% \end{noindmacro}
+
+% \begin{noindmacro}{\includepdfmerge} Patched to set a reasonable paper size.
+%    \begin{macrocode}
+\xpretocmd{\includepdfmerge}{%
+    \begingroup%
+    \setlength{\paperwidth}{8in}%
+    \setlength{\paperheight}{10.5in}%
+}{}{}
+
+\xapptocmd{\includepdfmerge}{%
+    \endgroup%
+}{}{}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\AM at hyper@begin at i}
+% Hyper links are created by \cs{LWR at esopic@newpage},
+% so don't create them here:
+%    \begin{macrocode}
+\renewcommand{\AM at hyper@begin at i}{}
+%    \end{macrocode}
+% \end{noindmacro}
+%
+% \iffalse
+%</pdfpages>
+% \fi
+%
+%
+%
+%
+% \iffalse
 %<*pdfrender>
 % \fi
 %
@@ -44776,8 +46876,33 @@
 %
 %
 %
+% \iffalse
+%<*pdfx>
+% \fi
 %
+% \part{lwarp-pdfx.sty}
+%
+% \section{pdfx}
+%
+% \DescribePackage{pdfx}
+% \pkg{pdfx} is ignored.
+%
+% \changes{v0.58}{2018/06/08}{\pkg{pdfx}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{pdfx}
+%    \end{macrocode}
+%
 % \iffalse
+%</pdfx>
+% \fi
+%
+%
+%
+%
+% \iffalse
 %<*pfnote>
 % \fi
 %
@@ -45039,7 +47164,7 @@
 % and make the length assignment global, per: \\ 
 %\href{https://tex.stackexchange.com/questions/300823/why-is-setlength-ineffective-inside-a-tabular-environment}
 %{\ttfamily https://tex.stackexchange.com/questions/300823/ \\
-%	\hspace*{2em} why-is-setlength-ineffective-inside-a-tabular-environment}
+%	\fqquad\ why-is-setlength-ineffective-inside-a-tabular-environment}
 %    \begin{macrocode}
 \setlength{\LWR at quotchapwidth}{#1*2}%
 \global\LWR at quotchapwidth=\LWR at quotchapwidth%
@@ -45092,19 +47217,12 @@
 \xpatchcmd{\quoting}{\quo at begintext}
     {\begin{LWR at blocktextcurrentfont}\quo at begintext}
     {}
-    {
-        \PackageError{lwarp}
-        {Unable to patch the quoting package}
-        {Please contact the author of the lwarp package.}
-    }
+    {\LWR at patcherror{quoting}{quoting}}
+
 \xpatchcmd{\endquoting}{\quo at endtext}
     {\quo at endtext\end{LWR at blocktextcurrentfont}}
     {}
-    {
-        \PackageError{lwarp}
-        {Unable to patch the quoting package}
-        {Please contact the author of the lwarp package.}
-    }
+    {\LWR at patcherror{imakeidx}{endquoting}}
 %    \end{macrocode}
 
 % \iffalse
@@ -45359,9 +47477,72 @@
 %
 %
 %
+% \iffalse
+%<*repeatindex>
+% \fi
 %
+% \part{lwarp-repeatindex.sty}
 %
+% \section{repeatindex}
+%
+% \DescribePackage{repeatindex}
+% \pkg{repeatindex} is emulated for \pkg{lwarp}.
+%
+% \pkg{lwarp} must be used with a special style file:
+% \begin{sourcedisplay}
+% \cs{usepackage}[makeindex,\textred{makeindexStyle=\{lwarp\_repeatindex\}}]\{lwarp\}
+% \end{sourcedisplay}
+% where \filenm{lwarp\_repeatindex.ist} may be copied from the following
+% modified version of \filenm{lwarp.ist}:
+% \begin{Verbatim}[gobble=2,obeytabs,tabsize=4,frame=leftline]
+% preamble
+% "\\begin{theindex}
+%   \\providecommand*\\lettergroupDefault[1]{}
+%   \\providecommand*\\lettergroup[1]{%
+%       \\par\\textbf{#1}\\par
+%       \\nopagebreak
+%   }
+% "
+% headings_flag 1
+% heading_prefix "
+%   \\lettergroup{"
+% heading_suffix "}"
+% delim_0 "], \\hyperindexref{"
+% delim_1 ", \\hyperindexref{"
+% delim_2 ", \\hyperindexref{"
+% delim_n "}, \\hyperindexref{"
+% delim_r "} -- \\hyperindexref{"
+% delim_t "}"
+% 
+% item_0 "\n  \\item ["
+% \end{Verbatim}
+% (The modifications are the |delim_0| and |item_0| entries.)
+%
+% \changes{v0.58}{2018/06/21}{\pkg{repeatindex}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackageDrop{repeatindex}[2001/10/13]
+%    \end{macrocode}
+%
+% In the \pkg{lwarp} core, \cs{LWR at indexitem} is modified
+% to accept the optional \cs{item} argument.
+%
+%    \begin{macrocode}
+\RequirePackage{makeidx}
+\def\entryprefix{\itshape}
+\def\entrypostfix{\dots}
+%    \end{macrocode}
+%
 % \iffalse
+%</repeatindex>
+% \fi
+%
+%
+%
+%
+% \iffalse
 %<*resizegather>
 % \fi
 %
@@ -45662,7 +47843,7 @@
 
 \renewcommand{\schema}[3][open]{%
 \begin{lateximage}%
-\LWR at orignormalsize
+\LWR at print@normalsize
 \LWR at schemata@origschema[#1]{#2}{#3}%
 \end{lateximage}%
 }
@@ -45669,7 +47850,7 @@
 
 \renewcommand{\Schema}[5][open]{%
 \begin{lateximage}%
-\LWR at orignormalsize
+\LWR at print@normalsize
 \LWR at schemata@origSchema[#1]{#2}{#3}{#4}{#5}%
 \end{lateximage}%
 }
@@ -45829,7 +48010,7 @@
 %   \href
 %   {https://tex.stackexchange.com/questions/45401/use-the-s-star-argument-with-newdocumentenvironment}
 %   {\ttfamily https://tex.stackexchange.com/questions/45401/ \\
-%       \hspace*{2em} use-the-s-star-argument-with-newdocumentenvironment}
+%       \fqquad\ use-the-s-star-argument-with-newdocumentenvironment}
 %    \begin{macrocode}
 
 \ExplSyntaxOn
@@ -46374,7 +48555,9 @@
 %    \begin{macrocode}
 \LWR at ProvidesPackageDrop{showidx}
 %    \end{macrocode}
-
+%
+% \cs{@wrindex} is redefined \cs{AtBeginDocument} by the \pkg{lwarp} core.
+%
 % \iffalse
 %</showidx>
 % \fi
@@ -46937,7 +49120,7 @@
 \ifcsempty{#2}%
 {\LWR at HTMLtextstyle{#5}{#3}{#1}}%
 {%
-    \convertcolorspec{named}{\csuse{#2}}{HTML}\LWR at tempcolor%
+    \convertcolorspec{named}{\@nameuse{#2}}{HTML}\LWR at tempcolor%
     \LWR at htmlspanclass[#5;#4:\LWR at origpound\LWR at tempcolor]{#3}{#1}%
 }%
 }
@@ -47078,9 +49261,100 @@
 %
 %
 %
+% \iffalse
+%<*splitidx>
+% \fi
 %
+% \part{lwarp-splitidx.sty}
 %
+% \section{splitidx}
+% \label{sec:splitidx}
+%
+% \credits{Markus Kohm}
+%
+% \DescribePackage{splitidx}
+% \pkg{splitidx} is patched for use by \pkg{lwarp}.
+%
+% \limitssplitidx
+%
+% \changes{v0.58}{2018/06/30}{\pkg{splitidx}: Added.}
+%
+% \codehtml
+%
+%    \begin{macrocode}
+\LWR at ProvidesPackagePass{splitidx}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\catcode`\_=12%
+\xpatchcmd{\newindex}
+    {\jobname-#2.idx}
+    {\jobname-#2_html.idx}
+    {}
+    {\LWR at patcherror{splitidx}{@newindex}}
+\catcode`\_=8%
+%    \end{macrocode}
+%
+% Patched to use \pkg{lwarp}'s automatic indexing counter instead of \cs{thepage}:
+%    \begin{macrocode}
+\renewcommand*{\@wrsindex}[2][]{%
+  \ifx\relax#1\relax
+    \if at splitidx
+      \@wrsindex[idx]{#2}%
+    \else
+      \def\@tempa{#2}%
+      \if at verbindex\@onelevel at sanitize\@tempa\fi
+      \@wrindex{\@tempa}%
+    \fi
+  \else
+    \def\@tempa{#2}%
+    \csname index@#1 at hook\endcsname
+%     \expandafter\ifx\csname @@wrsindex\endcsname\relax
+    \addtocounter{LWR at autoindex}{1}%                    lwarp
+    \LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%    lwarp
+%       \@@@wrsindex{#1}{{\@tempa}{\thepage}}%
+      \@@@wrsindex{#1}{{\@tempa}{\arabic{LWR at autoindex}}}%
+%     \else
+%       \def\@tempb{\@@wrsindex{#1}}%
+%       \expandafter\@tempb\@tempa||\\%
+%     \fi
+    \endgroup
+    \@esphack
+  \fi
+}
+%    \end{macrocode}
+%
+% \pkg{lwarp} defines sectioning commands with \pkg{xparse},
+% so the below patches are done as temporary redefinitions instead of being \cs{let}.
+%    \begin{macrocode}
+\xpatchcmd{\printsubindex}
+    {\let\section\subsection}
+    {\renewcommand*{\section}{\subsection}}
+    {}
+    {\LWR at patcherror{splitidx}{printsubindex-section}}
+
+\xpatchcmd{\printsubindex}
+    {\let\chapter\section}
+    {\renewcommand*{\chapter}{\section}}
+    {}
+    {\LWR at patcherror{splitidx}{printsubindex-chapter}}
+
+\xpatchcmd{\printsubindex}
+    {\let\@makechapterhead\section}
+    {\def\@makechapterhead{\section}}
+    {}
+    {\LWR at patcherror{splitidx}{printsubindex-chapter}}
+%    \end{macrocode}
+%
 % \iffalse
+%</splitidx>
+% \fi
+%
+%
+%
+%
+%
+% \iffalse
 %<*stabular>
 % \fi
 %
@@ -47424,7 +49698,7 @@
 % The starred version uses the printed |sub@<label>| which is stored as
 % if it were a page number:
 %    \begin{macrocode}
-\renewcommand{\sf@@subref}[1]{\LWR at origpageref{sub@#1}}
+\renewcommand{\sf@@subref}[1]{\LWR at orig@pageref{sub@#1}}
 %    \end{macrocode}
 % \end{noindmacro}
 %
@@ -47859,6 +50133,7 @@
 %       improved XeLaTeX and LuaLaTeX support.}
 % \changes{v0.42}{2017/10/13}{\pkg{textcomp}: Improved \cs{interrobangdown}.}
 % \changes{v0.54}{2018/04/08}{\pkg{textcomp}: Fix for \cs{textperthousand}.}
+% \changes{v0.58}{2018/06/07}{\pkg{textcomp}: Improved print/\HTML\ output selection.}
 %
 % \codehtml
 %
@@ -47867,46 +50142,6 @@
 %    \end{macrocode}
 %
 %
-% \subsection{Remembering original defintions}
-%
-% The following are restored for print when inside a \env{lateximage}:
-%    \begin{macrocode}
-\let\LWR at origtextdegree\textdegree
-\let\LWR at origtextcelsius\textcelsius
-\let\LWR at origtextohm\textohm
-\let\LWR at origtextmu\textmu
-\let\LWR at origtextlquill\textlquill
-\let\LWR at origtextrquill\textrquill
-\let\LWR at origtextcircledP\textcircledP
-\let\LWR at origtexttwelveudash\texttwelveudash
-\let\LWR at origtextthreequartersemdash\textthreequartersemdash
-\let\LWR at origtextmho\textmho
-\let\LWR at origtextnaira\textnaira
-\let\LWR at origtextpeso\textpeso
-\let\LWR at origtextrecipe\textrecipe
-\let\LWR at origtextinterrobangdown\textinterrobangdown
-\let\LWR at origtextperthousand\textperthousand
-\let\LWR at origtextpertenthousand\textpertenthousand
-\let\LWR at origtextbaht\textbaht
-\let\LWR at origtextdiscount\textdiscount
-\let\LWR at origtextservicemark\textservicemark
-\LetLtxMacro\LWR at origcapitalcedilla\capitalcedilla
-\LetLtxMacro\LWR at origcapitalogonek\capitalogonek
-\LetLtxMacro\LWR at origcapitalgrave\capitalgrave
-\LetLtxMacro\LWR at origcapitalacute\capitalacute
-\LetLtxMacro\LWR at origcapitalcircumflex\capitalcircumflex
-\LetLtxMacro\LWR at origcapitaltilde\capitaltilde
-\LetLtxMacro\LWR at origcapitaldieresis\capitaldieresis
-\LetLtxMacro\LWR at origcapitalhungarumlaut\capitalhungarumlaut
-\LetLtxMacro\LWR at origcapitalring\capitalring
-\LetLtxMacro\LWR at origcapitalcaron\capitalcaron
-\LetLtxMacro\LWR at origcapitalbreve\capitalbreve
-\LetLtxMacro\LWR at origcapitalmacron\capitalmacron
-\LetLtxMacro\LWR at origcapitaldotaccent\capitaldotaccent
-\LetLtxMacro\LWR at origtextcircled\textcircled
-%    \end{macrocode}
-%
-%
 % \subsection{HTML symbols}
 %
 % For \HTML, use \HTML\ entities or direct Unicode, depending on the engine.
@@ -47918,25 +50153,25 @@
 %    \begin{macrocode}
 \AtBeginDocument{
 \ifPDFTeX
-\renewcommand*{\textdegree}{\HTMLentity{deg}}
-\renewcommand*{\textcelsius}{\HTMLunicode{2103}}
-\renewcommand*{\textohm}{\HTMLunicode{2126}}
-\renewcommand*{\textmu}{\HTMLunicode{00B5}}
-\renewcommand*{\textlquill}{\HTMLunicode{2045}}
-\renewcommand*{\textrquill}{\HTMLunicode{2046}}
-\renewcommand*{\textcircledP}{\HTMLunicode{2117}}
-\renewcommand*{\texttwelveudash}{\HTMLunicode{2014}}% emdash
-\renewcommand*{\textthreequartersemdash}{\HTMLunicode{2014}}% emdash
-\renewcommand*{\textmho}{\HTMLunicode{2127}}
-\renewcommand*{\textnaira}{\HTMLunicode{20A6}}
-\renewcommand*{\textpeso}{\HTMLunicode{20B1}}
-\renewcommand*{\textrecipe}{\HTMLunicode{211E}}
-\renewcommand*{\textinterrobangdown}{\HTMLunicode{2E18}}
-\renewcommand*{\textperthousand}{\HTMLunicode{2030}}
-\renewcommand*{\textpertenthousand}{\HTMLunicode{2031}}
-\renewcommand*{\textbaht}{\HTMLunicode{0E3F}}
-\renewcommand*{\textdiscount}{\%}
-\renewcommand*{\textservicemark}{\HTMLunicode{2120}}
+\newcommand*{\LWR at HTML@textdegree}{\HTMLentity{deg}}
+\newcommand*{\LWR at HTML@textcelsius}{\HTMLunicode{2103}}
+\newcommand*{\LWR at HTML@textohm}{\HTMLunicode{2126}}
+\newcommand*{\LWR at HTML@textmu}{\HTMLunicode{00B5}}
+\newcommand*{\LWR at HTML@textlquill}{\HTMLunicode{2045}}
+\newcommand*{\LWR at HTML@textrquill}{\HTMLunicode{2046}}
+\newcommand*{\LWR at HTML@textcircledP}{\HTMLunicode{2117}}
+\newcommand*{\LWR at HTML@texttwelveudash}{\HTMLunicode{2014}}% emdash
+\newcommand*{\LWR at HTML@textthreequartersemdash}{\HTMLunicode{2014}}% emdash
+\newcommand*{\LWR at HTML@textmho}{\HTMLunicode{2127}}
+\newcommand*{\LWR at HTML@textnaira}{\HTMLunicode{20A6}}
+\newcommand*{\LWR at HTML@textpeso}{\HTMLunicode{20B1}}
+\newcommand*{\LWR at HTML@textrecipe}{\HTMLunicode{211E}}
+\newcommand*{\LWR at HTML@textinterrobangdown}{\HTMLunicode{2E18}}
+\newcommand*{\LWR at HTML@textperthousand}{\HTMLunicode{2030}}
+\newcommand*{\LWR at HTML@textpertenthousand}{\HTMLunicode{2031}}
+\newcommand*{\LWR at HTML@textbaht}{\HTMLunicode{0E3F}}
+\newcommand*{\LWR at HTML@textdiscount}{\%}
+\newcommand*{\LWR at HTML@textservicemark}{\HTMLunicode{2120}}
 \else
 %    \end{macrocode}
 %
@@ -47945,26 +50180,46 @@
 % NOTE: Some of the following do not print well in the listing.
 % Consult the .dtx or .sty file for the actual characters.
 %    \begin{macrocode}
-\renewcommand*{\textdegree}{°}
-\renewcommand*{\textcelsius}{℃}
-\renewcommand*{\textohm}{Ω}
-\renewcommand*{\textmu}{µ}
-\renewcommand*{\textlquill}{⁅}
-\renewcommand*{\textrquill}{⁆}
-\renewcommand*{\textcircledP}{℗}
-\renewcommand*{\texttwelveudash}{—}% emdash
-\renewcommand*{\textthreequartersemdash}{—}% emdash
-\renewcommand*{\textmho}{℧}
-\renewcommand*{\textnaira}{₦}
-\renewcommand*{\textpeso}{₱}
-\renewcommand*{\textrecipe}{℞}
-\renewcommand*{\textinterrobangdown}{⸘}
-\renewcommand*{\textperthousand}{‰}
-\renewcommand*{\textpertenthousand}{‱}
-\renewcommand*{\textbaht}{฿}
-\renewcommand*{\textdiscount}{\%}
-\renewcommand*{\textservicemark}{℠}
+\newcommand*{\LWR at HTML@textdegree}{°}
+\newcommand*{\LWR at HTML@textcelsius}{℃}
+\newcommand*{\LWR at HTML@textohm}{Ω}
+\newcommand*{\LWR at HTML@textmu}{µ}
+\newcommand*{\LWR at HTML@textlquill}{⁅}
+\newcommand*{\LWR at HTML@textrquill}{⁆}
+\newcommand*{\LWR at HTML@textcircledP}{℗}
+\newcommand*{\LWR at HTML@texttwelveudash}{—}% emdash
+\newcommand*{\LWR at HTML@textthreequartersemdash}{—}% emdash
+\newcommand*{\LWR at HTML@textmho}{℧}
+\newcommand*{\LWR at HTML@textnaira}{₦}
+\newcommand*{\LWR at HTML@textpeso}{₱}
+\newcommand*{\LWR at HTML@textrecipe}{℞}
+\newcommand*{\LWR at HTML@textinterrobangdown}{⸘}
+\newcommand*{\LWR at HTML@textperthousand}{‰}
+\newcommand*{\LWR at HTML@textpertenthousand}{‱}
+\newcommand*{\LWR at HTML@textbaht}{฿}
+\newcommand*{\LWR at HTML@textdiscount}{\%}
+\newcommand*{\LWR at HTML@textservicemark}{℠}
 \fi
+
+\LWR at formatted{textdegree}
+\LWR at formatted{textcelsius}
+\LWR at formatted{textohm}
+\LWR at formatted{textmu}
+\LWR at formatted{textlquill}
+\LWR at formatted{textrquill}
+\LWR at formatted{textcircledP}
+\LWR at formatted{texttwelveudash}
+\LWR at formatted{textthreequartersemdash}
+\LWR at formatted{textmho}
+\LWR at formatted{textnaira}
+\LWR at formatted{textpeso}
+\LWR at formatted{textrecipe}
+\LWR at formatted{textinterrobangdown}
+\LWR at formatted{textperthousand}
+\LWR at formatted{textpertenthousand}
+\LWR at formatted{textbaht}
+\LWR at formatted{textdiscount}
+\LWR at formatted{textservicemark}
 %    \end{macrocode}
 %
 %
@@ -47972,71 +50227,46 @@
 %
 % For \HTML, Unicode diacritical marks are used:
 %    \begin{macrocode}
-\renewcommand*{\capitalcedilla}[1]{#1\HTMLunicode{0327}}
-\renewcommand*{\capitalogonek}[1]{#1\HTMLunicode{0328}}
-\renewcommand*{\capitalgrave}[1]{#1\HTMLunicode{0300}}
-\renewcommand*{\capitalacute}[1]{#1\HTMLunicode{0301}}
-\renewcommand*{\capitalcircumflex}[1]{#1\HTMLunicode{0302}}
-\renewcommand*{\capitaltilde}[1]{#1\HTMLunicode{0303}}
-\renewcommand*{\capitaldieresis}[1]{#1\HTMLunicode{0308}}
-\renewcommand*{\capitalhungarumlaut}[1]{#1\HTMLunicode{30B}}
-\renewcommand*{\capitalring}[1]{#1\HTMLunicode{30A}}
-\renewcommand*{\capitalcaron}[1]{#1\HTMLunicode{30C}}
-\renewcommand*{\capitalbreve}[1]{#1\HTMLunicode{306}}
-\renewcommand*{\capitalmacron}[1]{#1\HTMLunicode{304}}
-\renewcommand*{\capitaldotaccent}[1]{#1\HTMLunicode{307}}
+\newcommand*{\LWR at HTML@capitalcedilla}[1]{#1\HTMLunicode{0327}}
+\newcommand*{\LWR at HTML@capitalogonek}[1]{#1\HTMLunicode{0328}}
+\newcommand*{\LWR at HTML@capitalgrave}[1]{#1\HTMLunicode{0300}}
+\newcommand*{\LWR at HTML@capitalacute}[1]{#1\HTMLunicode{0301}}
+\newcommand*{\LWR at HTML@capitalcircumflex}[1]{#1\HTMLunicode{0302}}
+\newcommand*{\LWR at HTML@capitaltilde}[1]{#1\HTMLunicode{0303}}
+\newcommand*{\LWR at HTML@capitaldieresis}[1]{#1\HTMLunicode{0308}}
+\newcommand*{\LWR at HTML@capitalhungarumlaut}[1]{#1\HTMLunicode{30B}}
+\newcommand*{\LWR at HTML@capitalring}[1]{#1\HTMLunicode{30A}}
+\newcommand*{\LWR at HTML@capitalcaron}[1]{#1\HTMLunicode{30C}}
+\newcommand*{\LWR at HTML@capitalbreve}[1]{#1\HTMLunicode{306}}
+\newcommand*{\LWR at HTML@capitalmacron}[1]{#1\HTMLunicode{304}}
+\newcommand*{\LWR at HTML@capitaldotaccent}[1]{#1\HTMLunicode{307}}
 %    \end{macrocode}
 % \cs{textcircled} becomes a span with a rounded border:
 %    \begin{macrocode}
-\renewcommand*{\textcircled}[1]{%
+\newcommand*{\LWR at HTML@textcircled}[1]{%
 \InlineClass[border: 1px solid \LWR at currenttextcolor]{textcircled}{#1}%
 }
+
+\LWR at formatted{capitalcedilla}
+\LWR at formatted{capitalogonek}
+\LWR at formatted{capitalgrave}
+\LWR at formatted{capitalacute}
+\LWR at formatted{capitalcircumflex}
+\LWR at formatted{capitaltilde}
+\LWR at formatted{capitaldieresis}
+\LWR at formatted{capitalhungarumlaut}
+\LWR at formatted{capitalring}
+\LWR at formatted{capitalcaron}
+\LWR at formatted{capitalbreve}
+\LWR at formatted{capitalmacron}
+\LWR at formatted{capitaldotaccent}
+\LWR at formatted{textcircled}
+
 }% AtBeginDocument
 %    \end{macrocode}
 %
 %
-% \subsection{Inside a \env{lateximage}}
 %
-% When a \env{lateximage} is begun:
-%    \begin{macrocode}
-\appto\LWR at restoreorigformatting{%
-\let\textdegree\LWR at origtextdegree%
-\let\textcelsius\LWR at origtextcelsius%
-\let\textohm\LWR at origtextohm%
-\let\textmu\LWR at origtextmu%
-\let\textlquill\LWR at origtextlquill%
-\let\textrquill\LWR at origtextrquill%
-\let\textcircledP\LWR at origtextcircledP%
-\let\texttwelveudash\LWR at origtexttwelveudash%
-\let\textthreequartersemdash\LWR at origtextthreequartersemdash%
-\let\textmho\LWR at origtextmho%
-\let\textnaira\LWR at origtextnaira%
-\let\textpeso\LWR at origtextpeso%
-\let\textrecipe\LWR at origtextrecipe%
-\let\textinterrobangdown\LWR at origtextinterrobangdown%
-\let\textperthousand\LWR at origtextperthousand%
-\let\textpertenthousand\LWR at origtextpertenthousand%
-\let\textbaht\LWR at origtextbaht%
-\let\textdiscount\LWR at origtextdiscount%
-\let\textservicemark\LWR at origtextservicemark%
-\LetLtxMacro\capitalcedilla\LWR at origcapitalcedilla%
-\LetLtxMacro\capitalogonek\LWR at origcapitalogonek%
-\LetLtxMacro\capitalgrave\LWR at origcapitalgrave%
-\LetLtxMacro\capitalacute\LWR at origcapitalacute%
-\LetLtxMacro\capitalcircumflex\LWR at origcapitalcircumflex%
-\LetLtxMacro\capitaltilde\LWR at origcapitaltilde%
-\LetLtxMacro\capitaldieresis\LWR at origcapitaldieresis%
-\LetLtxMacro\capitalhungarumlaut\LWR at origcapitalhungarumlaut%
-\LetLtxMacro\capitalring\LWR at origcapitalring%
-\LetLtxMacro\capitalcaron\LWR at origcapitalcaron%
-\LetLtxMacro\capitalbreve\LWR at origcapitalbreve%
-\LetLtxMacro\capitalmacron\LWR at origcapitalmacron%
-\LetLtxMacro\capitaldotaccent\LWR at origcapitaldotaccent%
-\LetLtxMacro\textcircled\LWR at origtextcircled%
-}
-%    \end{macrocode}
-%
-%
 % \iffalse
 %</textcomp>
 % \fi
@@ -48227,7 +50457,7 @@
             \expandafter \endcsname \the \theorem at bodyfont
      \@thm{#1}{#2}}%
     \global \expandafter \let \csname end#1\endcsname \@endtheorem
-    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
    }}
 
 \gdef\@ynthm#1#2{%
@@ -48240,7 +50470,7 @@
      \expandafter{\csname th@\the \theorem at style \expandafter
      \endcsname \the\theorem at bodyfont \@thm{#1}{#2}}%
     \global \expandafter \let \csname end#1\endcsname \@endtheorem
-    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
    }}
 
 \gdef\@othm#1[#2]#3{%
@@ -48256,7 +50486,7 @@
      \expandafter{\csname th@\the \theorem at style \expandafter
      \endcsname \the\theorem at bodyfont \@thm{#2}{#3}}%
     \global \expandafter \let \csname end#1\endcsname \@endtheorem
-    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
     }%
   \fi}
 %    \end{macrocode}
@@ -48499,7 +50729,7 @@
 % Also see:\\
 %	\href{https://tex.stackexchange.com/questions/16199/test-if-a-package-or-package-option-is-loaded}
 %	{https://tex.stackexchange.com/questions/16199/\\
-%		\hspace*{2em}test-if-a-package-or-package-option-is-loaded}
+%		\fqquad\ test-if-a-package-or-package-option-is-loaded}
 
 
 %    \begin{macrocode}
@@ -48542,18 +50772,18 @@
 \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
+\let\pgfutil at raggedleft\LWR at print@raggedleft
+\let\pgfutil at raggedright\LWR at print@raggedright
 
-\def\pgfutil at font@tiny{\LWR at origtiny}
-\def\pgfutil at font@scriptsize{\LWR at origscriptsize}
-\def\pgfutil at font@footnotesize{\LWR at origfootnotesize}
-\def\pgfutil at font@small{\LWR at origsmall}
-\def\pgfutil at font@normalsize{\LWR at orignormalsize}
-\def\pgfutil at font@large{\LWR at origlarge}
-\def\pgfutil at font@Large{\LWR at origLarge}
-\def\pgfutil at font@huge{\LWR at orighuge}
-\def\pgfutil at font@Huge{\LWR at origHuge}
+\def\pgfutil at font@tiny{\LWR at printtiny}
+\def\pgfutil at font@scriptsize{\LWR at printscriptsize}
+\def\pgfutil at font@footnotesize{\LWR at printfootnotesize}
+\def\pgfutil at font@small{\LWR at print@small}
+\def\pgfutil at font@normalsize{\LWR at print@normalsize}
+\def\pgfutil at font@large{\LWR at printlarge}
+\def\pgfutil at font@Large{\LWR at printLarge}
+\def\pgfutil at font@huge{\LWR at printhuge}
+\def\pgfutil at font@Huge{\LWR at printHuge}
 
 \def\pgfutil at font@itshape{\LWR at origitshape}
 \def\pgfutil at font@bfseries{\LWR at origbfseries}
@@ -49518,7 +51748,7 @@
 % \DescribePackage{tocbibind}
 % \pkg{tocbibind} is patched for use by \pkg{lwarp}.
 %
-% \limitsindex
+% \limitstocbibind
 %
 % \changes{v0.38}{2017/08/22}{\pkg{tocbibind}: Added.}
 % \changes{v0.40}{2017/09/12}{\pkg{tocbibind}: Improved for \cs{simplechapter}.}
@@ -50411,7 +52641,7 @@
 \begin{warpall}
 %    \end{macrocode}
 
-% \textcolor{red}{For both print and \HTML\ output:}
+% \textred{For both print and \HTML\ output:}
 %
 % When using \pkg{float}, \pkg{trivfloat}, or \pkg{algorithmicx} at the same time,
 % be aware of conflicting file usage.
@@ -52735,6 +54965,31 @@
 \RequirePackage{lwarp-scrextend}
 %    \end{macrocode}
 %
+%
+% Indexing macros, simplified for \pkg{lwarp}:
+% \changes{v0.58}{2018/07/06}{\pkg{lwarp-patch-komascript}: Modified indexing.}
+%    \begin{macrocode}
+\AtBeginDocument{
+
+\renewcommand*{\idx at heading}{%
+  \idx@@heading{\indexname}%
+}
+
+\renewenvironment{theindex}{%
+  \idx at heading%
+  \index at preamble\par\nobreak
+    \let\item\LWR at indexitem%
+    \let\subitem\LWR at indexsubitem%
+    \let\subsubitem\LWR at indexsubsubitem%
+}
+{}
+
+\renewcommand*\indexspace{}
+
+}% AtBeginDocument
+%    \end{macrocode}
+%
+%
 % The \cs{minisec} is placed inside a \element{div} of class \attribute{minisec}.
 %    \begin{macrocode}
 \renewcommand*{\minisec}[1]{
@@ -52849,6 +55104,7 @@
 \RequirePackage{lwarp-footmisc}% req'd
 \RequirePackage{lwarp-framed}% req'd
 \RequirePackage{lwarp-hanging}% req'd
+\RequirePackage{lwarp-makeidx}% req'd
 \DisemulatePackage{moreverb}
 \RequirePackage{lwarp-moreverb}
 \RequirePackage{lwarp-mparhack}
@@ -52859,6 +55115,7 @@
 \RequirePackage{lwarp-setspace}% req'd
 \RequirePackage{lwarp-showidx}
 \RequirePackage{lwarp-subfigure}% red'q
+\makeindex
 %    \end{macrocode}
 % \pkg{subfigure} is emulated via \pkg{subfig}, which pre-defines
 % |subfigure| and |subtable|, but \pkg{memoir} does not, so
@@ -52883,25 +55140,9 @@
 %
 % Bypass the \pkg{memoir} package mechanism:
 %    \begin{macrocode}
-\LetLtxMacro\LWR at origlabel\@mem at old@label
+\LetLtxMacro\LWR at orig@label\@mem at old@label
 %    \end{macrocode}
 
-
-% Redefined to write the |LWR at autoindex| counter instead of |page|
-%    \begin{macrocode}
-\AtBeginDocument{
-    \def\@@wrindexhyp#1||\\{%
-        \addtocounter{LWR at autoindex}{1}%
-        \LWR at newlabel{LWRindex-\arabic{LWR at autoindex}}%
-      \ifshowindexmark\@showidx{#1}\fi
-      \protected at write\@auxout{}%
-        {\string\@@wrindexm at m{\@idxfile}{#1}{\arabic{LWR at autoindex}}}%
-      \endgroup
-      \@esphack}%
-}
-%    \end{macrocode}
-
-
 %
 % \pkg{memoir} already set the page size to a default,
 % so it must be forced large for \pkg{lwarp}'s use,
@@ -53091,7 +55332,7 @@
 %
 % \subsection{Titles}
 %
-% \changes{v0.54}{2018/04/06}{\pkg{memoir}: Update for v3.7g.}
+% \changes{v0.54}{2018/04/06}{\pkg{lwarp-patch-memoir}: Update for v3.7g.}
 %    \begin{macrocode}
 \csletcs{titlingpage*}{titlingpage}
 \csletcs{endtitlingpage*}{endtitlingpage}
@@ -53762,7 +56003,7 @@
 %    \begin{macrocode}
 \renewenvironment{sidenamedlegend}[2][]{
 \begin{center}
-\csuse{\@captype name}\CaptionSeparator#2
+\@nameuse{\@captype name}\CaptionSeparator#2
 \end{center}
 }
 {}
@@ -54011,8 +56252,72 @@
 %    \end{macrocode}
 %
 % \subsection{Back matter}
+% \label{sec:memoirbackmatter}
 %
+% Redefined to write the |LWR at autoindex| counter instead of |page|.
+% Note that \pkg{memoir} has two versions, depending on the use of \pkg{hyperref}.
 %    \begin{macrocode}
+\AtBeginDocument{
+
+\def\@@wrindexhyp#1||\\{%
+    \addtocounter{LWR at autoindex}{1}%
+    \LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%
+%     \ifshowindexmark\@showidx{#1}\fi
+    \protected at write\@auxout{}%
+    {\string\@@wrindexm at m{\@idxfile}{#1}{\arabic{LWR at autoindex}}}%
+    \endgroup
+    \@esphack}%
+%    \end{macrocode}
+%
+% \label{sec:specialindex}
+% \cs{specialindex} behaves like a regular \cs{index}, pointing to where
+% \cs{specialindex} is used.
+% If \cs{specialindex} is used inside a figure or table after the \cs{caption},
+% then the hyperlink will be given the name of that particular figure or table.
+% \changes{v0.58}{2018/06/22}{\pkg{lwarp-patch-memoir}: Fix for \cs{specialindex}.}
+%    \begin{macrocode}
+\def\@@wrspindexhyp#1||\\{%
+    \addtocounter{LWR at autoindex}{1}%
+    \LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%
+%     \ifshowindexmark\@showidx{#1}\fi
+    \protected at write\@auxout{}%
+    {%
+%         \string\@@wrindexm at m{\@idxfile}{#1}{\@nameuse{the\@sptheidx}}%
+        \string\@@wrindexm at m{\@idxfile}{#1}{\arabic{LWR at autoindex}}%
+    }%
+    \endgroup
+    \@esphack}%
+
+}% \AtBeginDocument
+%    \end{macrocode}
+
+% Patched to use |_html| filename and \cs{BaseJobname}:
+% \changes{v0.58}{2018/06/22}{\pkg{lwarp-patch-memoir}: Fix for multiple indexes.}
+%    \begin{macrocode}
+\catcode`\_=12%
+\renewcommand*{\makeindex}[1][\BaseJobname]{%
+  \if at filesw
+    \def\index{\@bsphack%
+      \@ifnextchar [{\@index}{\@index[\BaseJobname]}}
+    \def\specialindex{\@bsphack\@spindex}%
+    \makememindexhook
+    \expandafter\newwrite\csname #1 at idxfile\endcsname
+    \expandafter\immediate\openout \csname #1 at idxfile\endcsname #1_html.idx\relax
+    \typeout{Writing index file #1_html.idx }%
+  \fi}
+\catcode`\_=8%
+%    \end{macrocode}
+
+% Patched to use |_html| filename and \cs{BaseJobname}.
+% This will later be patched by the \pkg{lwarp} core.
+% \changes{v0.58}{2018/06/22}{\pkg{lwarp-patch-memoir}: Fix for multiple indexes.}
+%    \begin{macrocode}
+\catcode`\_=12%
+\renewcommand{\printindex}[1][\BaseJobname]{\@input@{#1_html.ind}}
+\catcode`\_=8%
+%    \end{macrocode}
+%
+%    \begin{macrocode}
 \DeclareDocumentCommand{\newblock}{}{}
 % 
 \renewcommand*{\showindexmarks}{}
@@ -54083,7 +56388,7 @@
 % \ContinuedFloat%
 % \caption{#1}%
 \begin{LWR at figcaption}% later becomes \caption*
-\csuse{\@captype name} \thechapter.\the\value{\@captype}\CaptionSeparator #1
+\@nameuse{\@captype name} \thechapter.\the\value{\@captype}\CaptionSeparator #1
 \end{LWR at figcaption}
 }
 %    \end{macrocode}
@@ -54102,9 +56407,9 @@
 
 \renewcommand{\namedlegend}[2][]{
 \begin{center}
-\csuse{fleg\@captype}\CaptionSeparator#2\\
+\@nameuse{fleg\@captype}\CaptionSeparator#2\\
 \end{center}
-\csuse{flegtoc\@captype}{#1}
+\@nameuse{flegtoc\@captype}{#1}
 }
 
 \renewcommand{\newfixedcaption}[3][\caption]{%

Modified: trunk/Master/texmf-dist/source/latex/lwarp/lwarp.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/lwarp/lwarp.ins	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/source/latex/lwarp/lwarp.ins	2018-07-07 20:46:58 UTC (rev 48159)
@@ -55,6 +55,8 @@
 \file{lwarp-array.sty}{\from{lwarp.dtx}{array}}
 \file{lwarp-arydshln.sty}{\from{lwarp.dtx}{arydshln}}
 \file{lwarp-atbegshi.sty}{\from{lwarp.dtx}{atbegshi}}
+\file{lwarp-attachfile.sty}{\from{lwarp.dtx}{attachfile}}
+\file{lwarp-attachfile2.sty}{\from{lwarp.dtx}{attachfile2}}
 \file{lwarp-authblk.sty}{\from{lwarp.dtx}{authblk}}
 \file{lwarp-axodraw2.sty}{\from{lwarp.dtx}{axodraw2}}
 \file{lwarp-backref.sty}{\from{lwarp.dtx}{backref}}
@@ -72,6 +74,7 @@
 \file{lwarp-cancel.sty}{\from{lwarp.dtx}{cancel}}
 \file{lwarp-caption.sty}{\from{lwarp.dtx}{caption}}
 \file{lwarp-caption2.sty}{\from{lwarp.dtx}{caption2}}
+\file{lwarp-cases.sty}{\from{lwarp.dtx}{cases}}
 \file{lwarp-ccaption.sty}{\from{lwarp.dtx}{ccaption}}
 \file{lwarp-changebar.sty}{\from{lwarp.dtx}{changebar}}
 \file{lwarp-changepage.sty}{\from{lwarp.dtx}{changepage}}
@@ -163,9 +166,12 @@
 \file{lwarp-hyphenat.sty}{\from{lwarp.dtx}{hyphenat}}
 \file{lwarp-idxlayout.sty}{\from{lwarp.dtx}{idxlayout}}
 \file{lwarp-ifoddpage.sty}{\from{lwarp.dtx}{ifoddpage}}
+\file{lwarp-imakeidx.sty}{\from{lwarp.dtx}{imakeidx}}
 \file{lwarp-indentfirst.sty}{\from{lwarp.dtx}{indentfirst}}
+\file{lwarp-index.sty}{\from{lwarp.dtx}{index}}
 \file{lwarp-inputenc.sty}{\from{lwarp.dtx}{inputenc}}
 \file{lwarp-inputenx.sty}{\from{lwarp.dtx}{inputenx}}
+\file{lwarp-intopdf.sty}{\from{lwarp.dtx}{intopdf}}
 \file{lwarp-keyfloat.sty}{\from{lwarp.dtx}{keyfloat}}
 \file{lwarp-layout.sty}{\from{lwarp.dtx}{layout}}
 \file{lwarp-letterspace.sty}{\from{lwarp.dtx}{letterspace}}
@@ -183,6 +189,7 @@
 \file{lwarp-luacolor.sty}{\from{lwarp.dtx}{luacolor}}
 \file{lwarp-luatodonotes.sty}{\from{lwarp.dtx}{luatodonotes}}
 \file{lwarp-magaz.sty}{\from{lwarp.dtx}{magaz}}
+\file{lwarp-makeidx.sty}{\from{lwarp.dtx}{makeidx}}
 \file{lwarp-marginfit.sty}{\from{lwarp.dtx}{marginfit}}
 \file{lwarp-marginfix.sty}{\from{lwarp.dtx}{marginfix}}
 \file{lwarp-marginnote.sty}{\from{lwarp.dtx}{marginnote}}
@@ -223,7 +230,9 @@
 \file{lwarp-pbox.sty}{\from{lwarp.dtx}{pbox}}
 \file{lwarp-pdfrender.sty}{\from{lwarp.dtx}{pdfrender}}
 \file{lwarp-pdflscape.sty}{\from{lwarp.dtx}{pdflscape}}
+\file{lwarp-pdfpages.sty}{\from{lwarp.dtx}{pdfpages}}
 \file{lwarp-pdfsync.sty}{\from{lwarp.dtx}{pdfsync}}
+\file{lwarp-pdfx.sty}{\from{lwarp.dtx}{pdfx}}
 \file{lwarp-pfnote.sty}{\from{lwarp.dtx}{pfnote}}
 \file{lwarp-phfqit.sty}{\from{lwarp.dtx}{phfqit}}
 \file{lwarp-placeins.sty}{\from{lwarp.dtx}{placeins}}
@@ -236,6 +245,7 @@
 \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-repeatindex.sty}{\from{lwarp.dtx}{repeatindex}}
 \file{lwarp-resizegather.sty}{\from{lwarp.dtx}{resizegather}}
 \file{lwarp-romanbar.sty}{\from{lwarp.dtx}{romanbar}}
 \file{lwarp-romanbarpagenumber.sty}{\from{lwarp.dtx}{romanbarpagenumber}}
@@ -262,6 +272,7 @@
 \file{lwarp-soul.sty}{\from{lwarp.dtx}{soul}}
 \file{lwarp-soulpos.sty}{\from{lwarp.dtx}{soulpos}}
 \file{lwarp-soulutf8.sty}{\from{lwarp.dtx}{soulutf8}}
+\file{lwarp-splitidx.sty}{\from{lwarp.dtx}{splitidx}}
 \file{lwarp-stabular.sty}{\from{lwarp.dtx}{stabular}}
 \file{lwarp-stfloats.sty}{\from{lwarp.dtx}{stfloats}}
 \file{lwarp-subfig.sty}{\from{lwarp.dtx}{subfig}}

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-algorithm2e.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-algorithm2e.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-algorithm2e.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -47,26 +47,26 @@
 }{}%
 }
 \renewcommand{\algocf at makecaption}[2]{%
-\LWR at caption@begin{algocf}%
+\LWR at HTML@caption at begin{algocf}%
 \algocf at captiontext{#1}{#2}%
-\LWR at caption@end%
+\LWR at HTML@caption at end%
 }
 \renewcommand{\algocf at makecaption@plain}[2]{%
-    \LWR at caption@begin{algocf}%
+    \LWR at HTML@caption at begin{algocf}%
     \algocf at captiontext{#1}{#2}%
-    \LWR at caption@end%
+    \LWR at HTML@caption at end%
 }
 
 \renewcommand{\algocf at makecaption@boxed}[2]{%
-    \LWR at caption@begin{algocf}%
+    \LWR at HTML@caption at begin{algocf}%
     \algocf at captiontext{#1}{#2}%
-    \LWR at caption@end%
+    \LWR at HTML@caption at end%
 }
 
 \renewcommand{\algocf at makecaption@ruled}[2]{%
-    \LWR at caption@begin{algocf}%
+    \LWR at HTML@caption at begin{algocf}%
     \algocf at captiontext{#1}{#2}%
-    \LWR at caption@end%
+    \LWR at HTML@caption at end%
 }
 \long\def\algocf at latexcaption#1[#2]#3{% original definition of caption
 \boolfalse{LWR at algocf@dopars}%  lwarp

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-alltt.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-alltt.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-alltt.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -15,9 +15,7 @@
 %%   http://www.latex-project.org/lppl.txt
 %% and version 1.3 or later is part of all distributions of LaTeX
 %% version 2005/12/01 or later.
-
 \LWR at ProvidesPackagePass{alltt}
-
 \AfterEndPreamble{
 \LWR at traceinfo{Patching alltt.}
 \AtBeginEnvironment{alltt}{%
@@ -28,7 +26,6 @@
     \LWR at afterendverbatim{2}%
 }
 }
-
 \endinput
 %%
 %% End of file `lwarp-alltt.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-amsthm.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-amsthm.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-amsthm.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -45,7 +45,7 @@
     \else % numbered theorem, need to check for optional arg
       \def\@tempa{\@oparg{\@ynthm{#2}}[]}%
     \fi
-    \AtBeginEnvironment{#2}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#2}}}% lwarp
+    \AtBeginEnvironment{#2}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#2}}}% lwarp
   }%
   \@tempa
 }

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-array.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-array.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-array.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -15,17 +15,15 @@
 %%   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\firsthline\relax
+\let\lasthline\relax
+
 \LWR at ProvidesPackagePass{array}
-\let\LWR at origfirsthline\firsthline
-\let\LWR at origlasthline\lasthline
+\newcommand*{\LWR at HTML@firsthline}{\LWR at HTMLhline}%
+\LWR at expandableformatted{firsthline}
 
-\appto\LWR at restoreorigformatting{%
-\let\firsthline\LWR at origfirsthline%
-\let\lasthline\LWR at origlasthline%
-}
-
-\renewcommand*{\firsthline}{\LWR at HTMLhline}%
-\renewcommand*{\lasthline}{\LWR at HTMLhline}%
+\newcommand*{\LWR at HTML@lasthline}{\LWR at HTMLhline}%
+\LWR at expandableformatted{lasthline}
 \endinput
 %%
 %% End of file `lwarp-array.sty'.

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-attachfile.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-attachfile.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-attachfile.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,55 @@
+%%
+%% This is file `lwarp-attachfile.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `attachfile')
+%% 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{attachfile}
+\newenvironment*{LWR at attachfile@icon}
+{
+    \begin{lateximage}*%
+        [-attachfile-]%
+        [%
+            \detokenize\expandafter{\atfi at icon@icon}-%
+            \detokenize\expandafter{\atfi at color@rgb}%
+        ]%
+}
+{
+    \end{lateximage}
+}
+\xpretocmd{\atfi at acroGraph}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroGraph}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroPaperclip}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroPaperclip}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroPushPin}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroPushPin}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroTag}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroTag}{\endLWR at attachfile@icon}{}{}
+\DeclareRobustCommand{\atfi at embedfile}[1]{}
+\newcommand*{\LWR at attachfile@appearance}{}
+
+\DeclareRobustCommand{\atfi at set@appearance}[1]{%
+    \def\LWR at attachfile@appearance{#1}%
+}
+\DeclareRobustCommand{\atfi at insert@file at annot}[1]{%
+    \href{#1}{\LWR at attachfile@appearance}%
+}
+
+\endinput
+%%
+%% End of file `lwarp-attachfile.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-attachfile.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-attachfile2.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-attachfile2.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-attachfile2.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,88 @@
+%%
+%% This is file `lwarp-attachfile2.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `attachfile2')
+%% 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{attachfile2}
+\def\LWR at attachfiletwo@color{}%
+
+\define at key{AtFi}{color}{%
+    \def\LWR at attachfiletwo@color{#1}%   lwarp
+  \HyColor at AttachfileColor{#1}%
+          \atfi at color@tex\atfi at color@inline\atfi at color@annot
+          {attachfile2}{color}%
+}
+\newenvironment*{LWR at attachfile@icon}
+{
+    \begin{lateximage}*%
+        [-attachfile-]%
+        [%
+            \detokenize\expandafter{\atfi at icon@icon}-%
+            \detokenize\expandafter{\LWR at attachfiletwo@color}%
+        ]%
+}
+{
+    \end{lateximage}
+}
+\xpretocmd{\atfi at acroGraph}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroGraph}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroPaperclip}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroPaperclip}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroPushPin}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroPushPin}{\endLWR at attachfile@icon}{}{}
+
+\xpretocmd{\atfi at acroTag}{\LWR at attachfile@icon}{}{}
+\xapptocmd{\atfi at acroTag}{\endLWR at attachfile@icon}{}{}
+\DeclareRobustCommand{\atfi at embedfile}[1]{}
+\newcommand*{\LWR at attachfile@appearance}{}
+
+\def\atfi at set@appearance at icon{%
+    \atfi at set@appearance{\csname atfi at acro\atfi at icon@icon\endcsname}%
+}
+
+\DeclareRobustCommand{\atfi at set@appearance}[1]{%
+    \def\LWR at attachfile@appearance{#1}%
+}
+\DeclareRobustCommand{\atfi at insert@file at annot}[1]{%
+    \href{#1}{\LWR at attachfile@appearance}%
+}
+\DeclareRobustCommand{\notextattachfile}[2][]{%
+  \begingroup
+    \atfi at setup{#1}%
+    \ifatfi at print
+      \leavevmode
+      \begingroup
+        \HyColor at UseColor\atfi at color@tex
+        \LWR at textcurrentcolor{#2}%      lwarp
+      \endgroup
+    \fi
+  \endgroup
+}
+\DeclareRobustCommand{\noattachfile}[1][]{%
+  \begingroup
+    \atfi at setup{#1}%
+    \atfi at set@appearance at icon
+    \ifatfi at print
+        \LWR at attachfile@appearance%     lwarp
+    \fi
+  \endgroup
+}
+
+\endinput
+%%
+%% End of file `lwarp-attachfile2.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-attachfile2.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-cases.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-cases.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-cases.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,42 @@
+%%
+%% This is file `lwarp-cases.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `cases')
+%% 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{cases}
+\BeforeBeginEnvironment{numcases}{
+    \begin{BlockClass}{displaymathnumbered}
+    \LWR at newautoidanchor%
+    \booltrue{LWR at indisplaymathimage}%
+    \begin{lateximage}[-cases- \mathimagename]
+}
+
+\AfterEndEnvironment{numcases}{
+    \end{lateximage}\end{BlockClass}
+}
+
+\BeforeBeginEnvironment{subnumcases}{
+    \begin{BlockClass}{displaymathnumbered}
+    \LWR at newautoidanchor%
+    \booltrue{LWR at indisplaymathimage}%
+    \begin{lateximage}[-cases- \mathimagename]
+}
+
+\AfterEndEnvironment{subnumcases}{
+    \end{lateximage}\end{BlockClass}
+}
+\endinput
+%%
+%% End of file `lwarp-cases.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-cases.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-diagbox.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-diagbox.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-diagbox.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -47,7 +47,7 @@
 
 \def\diagbox at double#1#2#3{%
 \setkeys{diagbox}{dir=NW,#1}%
-\csuse{LWR at diagbox\diagbox at dir}{#2}{#3}%
+\@nameuse{LWR at diagbox\diagbox at dir}{#2}{#3}%
 }
 
 \newcommand{\LWR at diagboxTNW}[3]{%
@@ -71,7 +71,7 @@
 }
 \def\diagbox at triple#1#2#3#4{%
 \setkeys{diagbox}{dir=NW,#1}%
-\csuse{LWR at diagboxT\diagbox at dir}{#3}{#2}{#4}%
+\@nameuse{LWR at diagboxT\diagbox at dir}{#3}{#2}{#4}%
 }
 \endinput
 %%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-enumitem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-enumitem.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-enumitem.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -22,8 +22,8 @@
 
 \renewcommand*{\newlist}[3]{%
 \LWR at orignewlist{#1}{#2}{#3}%
-\AtBeginEnvironment{#1}{\csuse{LWR@#2start}}%
-\AtEndEnvironment{#1}{\csuse{LWR@#2end}}%
+\AtBeginEnvironment{#1}{\@nameuse{LWR@#2start}}%
+\AtEndEnvironment{#1}{\@nameuse{LWR@#2end}}%
 }
 
 \end{warpHTML}

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-errata.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-errata.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-errata.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -24,61 +24,37 @@
     {$_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.}
-    }
+    {\LWR at patcherror{erratum}{erratumAdd}}
 
 \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.}
-    }
+    {\LWR at patcherror{erratum}{erratumDelete}}
 
 \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.}
-    }
+    {\LWR at patcherror{erratum}{erratumReplace}}
 
 \xpatchcmd{\erratum}
     {$_a$}
     {\textsubscript{a}}
     {}
-    {
-        \PackageError{lwarp}
-        {Unable to patch the erratum package, eDelete macro}
-        {Please contact the author of the lwarp package.}
-    }
+    {\LWR at patcherror{erratum}{erratumDelete}}
 
 \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.}
-    }
+    {\LWR at patcherror{erratum}{eDelete}}
 
 \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.}
-    }
+    {\LWR at patcherror{erratum}{eReplace}}
 
 \preto\PrintErrata{\LWR at orignewpage}
 

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-idxlayout.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-idxlayout.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-idxlayout.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -18,13 +18,13 @@
 \LWR at ProvidesPackageDrop{idxlayout}
 \newcommand{\LWR at indexprenote}{}
 
-\renewcommand*{\printindex}
-{
+\preto\printindex{
+
+\LWR at orignewpage
 \LWR at startpars
 
 \LWR at indexprenote
 
-\LWR at origprintindex
 }
 
 \newcommand{\setindexprenote}[1]{\renewcommand{\LWR at indexprenote}{#1}}

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-imakeidx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-imakeidx.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-imakeidx.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,164 @@
+%%
+%% This is file `lwarp-imakeidx.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `imakeidx')
+%% 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{imakeidx}
+\catcode`\_=12%
+\define at key{imki}{name}{\def\imki at name{#1_html}}
+\catcode`\_=8%
+\catcode`\_=12%
+
+\renewcommand*{\printindex}[1][\imki at jobname]{%
+\LWR at orignewpage%
+\LWR at startpars%
+\ifstrequal{#1}{\imki at jobname}{%
+  \@ifundefined{#1 at idxfile}{%
+        \imki at error{#1}%
+    }{%
+        \imki at putindex{#1}%
+    }%
+}{%
+  \@ifundefined{#1_html at idxfile}{\imki at error{#1_html}}{\imki at putindex{#1_html}}%
+}%
+}
+
+\catcode`\_=8%
+\catcode`\_=12%
+
+\def\@index[#1]{%
+    \ifstrequal{#1}{\imki at jobname}%
+    {%
+        \@ifundefined{#1 at idxfile}%
+        {%
+            \PackageWarning{imakeidx}{Undefined index file `#1'}%
+            \begingroup
+            \@sanitize
+            \imki at nowrindex%
+        }%
+        {%
+            \edef\@idxfile{#1}%
+            \begingroup
+            \@sanitize
+            \@wrindex\@idxfile%
+        }%
+    }%
+    {%
+        \@ifundefined{#1_html at idxfile}%
+        {%
+            \PackageWarning{imakeidx}{Undefined index file `#1_html'}%
+            \begingroup
+            \@sanitize
+            \imki at nowrindex%
+        }%
+        {%
+            \edef\@idxfile{#1_html}%
+            \begingroup
+            \@sanitize
+            \@wrindex\@idxfile%
+        }%
+    }%
+}
+
+\catcode`\_=8%
+\appto\theindex{%
+    \let\item\LWR at indexitem%
+    \let\subitem\LWR at indexsubitem%
+    \let\subsubitem\LWR at indexsubsubitem%
+}
+\renewcommand\imki at wrindexentrysplit[3]{%
+\addtocounter{LWR at autoindex}{1}%
+\LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%
+  \expandafter\protected at write\csname#1 at idxfile\endcsname{}%
+    {\string\indexentry{#2}{\arabic{LWR at autoindex}}}%
+}
+
+\renewcommand\imki at wrindexentryunique[3]{%
+\addtocounter{LWR at autoindex}{1}%
+\LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%
+  \protected at write\@indexfile{}%
+    {\string\indexentry[#1]{#2}{\arabic{LWR at autoindex}}}%
+}
+
+\def\imki at wrindexsplit#1#2{%
+\imki at wrindexentrysplit{#1}{#2}{\thepage}%
+\endgroup\imki at showidxentry{#1}{#2}%
+  \@esphack%
+}
+
+\def\imki at wrindexunique#1#2{%
+\imki at wrindexentryunique{#1}{#2}{\thepage}%
+\endgroup\imki at showidxentry{#1}{#2}%
+  \@esphack%
+  }
+
+\newcommand*{\LWR at imki@setxdydefopts}{%
+    \edef\imki at options{ \space %
+        -M \space \LWR at xindyStyle\space %
+        -L \space \LWR at xindyLanguage\space %
+        -C \space \LWR at xindyCodepage\space %
+    }%
+}
+\newcommand*{\LWR at imki@setdefopts}[1]{%
+\ifblank{#1}{%
+    \edef\imki at options{\space -s \space \LWR at makeindexStyle \space}%
+    \ifdefstring{\imki at progdefault}{xindy}{\LWR at imki@setxdydefopts}{}%
+    \ifdefstring{\imki at progdefault}{texindy}{\LWR at imki@setxdydefopts}{}%
+    \ifdefstring{\imki at progdefault}{truexindy}{\LWR at imki@setxdydefopts}{}%
+}{%
+    \edef\imki at options{\space #1 \space}%
+}%
+}
+\xpatchcmd{\imki at makeindex}
+    {\let\imki at options\space}
+    {\LWR at imki@setdefopts{}}%
+    {}
+    {\LWR at patcherror{imakeidx}{makeindex}}
+\define at key{imki}{options}{\LWR at imki@setdefopts{#1}}
+\xpatchcmd{\imki at resetdefaults}
+    {\def\imki at options{ }}
+    {\LWR at imki@setdefopts{}}
+    {}
+    {\LWR at patcherror{imakeidx}{resetdefaults}}
+\AtBeginDocument{
+\renewenvironment*{theindex}{%
+    \imki at maybeaddtotoc
+     \imki at indexlevel{\indexname}
+    \let\item\LWR at indexitem%
+    \let\subitem\LWR at indexsubitem%
+    \let\subsubitem\LWR at indexsubsubitem%
+}{}
+}% AtBeginDocument
+\imki at resetdefaults
+\ifimki at splitindex
+  \let\imki at startidx\imki at startidxunique
+  \AtBeginDocument{\let\@wrindex\imki at wrindexunique}
+  \let\imki at putindex\imki at putindexunique
+  \let\imki at wrindexentry\imki at wrindexentryunique
+  \let\imki at startidxsplit\@undefined
+  \let\imki at wrindexsplit\@undefined
+  \let\imki at putindexsplit\@undefined
+\else
+  \let\imki at startidx\imki at startidxsplit
+  \AtBeginDocument{\let\@wrindex\imki at wrindexsplit}
+  \let\imki at putindex\imki at putindexsplit
+  \let\imki at wrindexentry\imki at wrindexentrysplit
+  \let\imki at startidxunique\@undefined
+  \let\imki at wrindexunique\@undefined
+  \let\imki at putindexunique\@undefined
+\fi
+\endinput
+%%
+%% End of file `lwarp-imakeidx.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-imakeidx.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-index.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-index.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-index.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,71 @@
+%%
+%% This is file `lwarp-index.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `index')
+%% 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{index}
+\xpatchcmd{\newindex}
+    {\x at newindex[thepage]}
+    {%
+        \@tempswatrue%
+        \x at newindex[theLWR at autoindex]%
+    }
+    {}
+    {\LWR at patcherror{index}{newindex}}
+
+\xpatchcmd{\renewindex}
+    {\x at renewindex[thepage]}
+    {%
+        \@tempswatrue%
+        \x at renewindex[theLWR at autoindex]%
+    }
+    {}
+    {\LWR at patcherror{index}{renewindex}}
+\xpatchcmd{\@wrindex}
+    {\begingroup}
+    {%
+        \addtocounter{LWR at autoindex}{1}%                    lwarp
+        \LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%    lwarp
+        \begingroup%
+    }
+    {}
+    {\LWR at patcherror{index}{@wrindex}}
+\let\LWR at index@wrindex\@wrindex
+
+\AtBeginDocument{
+\let\@wrindex\LWR at index@wrindex
+}
+\AtBeginDocument{
+\renewenvironment*{theindex}{%
+    \LWR at indexsection{\indexname}%
+    \ifx\index at prologue\@empty\else
+        \index at prologue
+        \bigskip
+    \fi
+    \let\item\LWR at indexitem%
+    \let\subitem\LWR at indexsubitem%
+    \let\subsubitem\LWR at indexsubsubitem%
+}{}
+}% AtBeginDocument
+\def\@showidx#1{}
+\let\@texttop\relax
+\renewcommand*{\raggedbottom}{}
+\renewcommand*{\flushbottom}{}
+\renewcommand*{\markboth}[2]{}
+\renewcommand*{\markright}[1]{}
+
+\endinput
+%%
+%% End of file `lwarp-index.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-index.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-intopdf.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-intopdf.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-intopdf.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,24 @@
+%%
+%% This is file `lwarp-intopdf.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `intopdf')
+%% 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{intopdf}
+\NewDocumentCommand{\attachandlink}{m o m m}{%
+    \href{#1}{#4}%
+}
+\endinput
+%%
+%% End of file `lwarp-intopdf.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-intopdf.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-makeidx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-makeidx.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-makeidx.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,25 @@
+%%
+%% This is file `lwarp-makeidx.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `makeidx')
+%% 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{makeidx}
+\preto\printindex{%
+    \LWR at orignewpage%
+    \LWR at startpars%
+}
+\endinput
+%%
+%% End of file `lwarp-makeidx.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-makeidx.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-mdframed.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -36,18 +36,18 @@
 }
 }% AtBeginDocument
 \mdfsetup{
-startcode={\LWR at mdframedstart\LWR at origraggedright},
+startcode={\LWR at mdframedstart\LWR at print@raggedright},
 endcode={\LWR at mdframedend},
-startinnercode={\LWR at startpars\LWR at origraggedright},
+startinnercode={\LWR at startpars\LWR at print@raggedright},
 endinnercode={\LWR at stoppars},
 }
 \newcommand*{\LWR at mdfprintcolor}[1]{%
-\convertcolorspec{named}{\csuse{mdf@#1}}{HTML}\LWR at tempcolor%
+\convertcolorspec{named}{\@nameuse{mdf@#1}}{HTML}\LWR at tempcolor%
 \LWR at origpound\LWR at tempcolor
 }
 
 \newcommand*{\LWR at mdfprintlength}[1]{%
-\LWR at printlength{\csuse{mdf@#1 at length}}
+\LWR at printlength{\@nameuse{mdf@#1 at length}}
 }
 \newcommand*{\LWR at mdframedstart}{%
 \LWR at traceinfo{LWR at mdframedstart start}%
@@ -169,8 +169,8 @@
 "}% span
 \begin{LWR at nestspan}%
 \IfNoValueTF{#2}
-{\csuse{LWR at origmdf#1title}{#3}}%
-{\csuse{LWR at origmdf#1title}[#2]{#3}}%
+{\@nameuse{LWR at origmdf#1title}{#3}}%
+{\@nameuse{LWR at origmdf#1title}[#2]{#3}}%
 \LWR at htmltagc{/span}% the following empty line is required
 \end{LWR at nestspan}% must follow the /span or an extra <p> appears
 

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-ntheorem.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -137,7 +137,7 @@
         \@thm{#1}{#1}{#2}
         }%
      \global\@namedef{end#1}{\@endtheorem}
-     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
   \fi
 }
 
@@ -153,7 +153,7 @@
         \@thm{#1}{#1}{#2}
         }%
      \global\@namedef{end#1}{\@endtheorem}
-     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
   \fi
 }
 
@@ -174,7 +174,7 @@
                 \@thm{#1}{#2}{#3}
         }%
      \global\@namedef{end#1}{\@endtheorem}
-     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+     \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
   \fi}
 }
 \newcommand{\LWR at inctheorem}{%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-komascript.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-komascript.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-komascript.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -19,6 +19,24 @@
 \RequirePackage{lwarp-typearea}
 \RequirePackage{lwarp-tocbasic}
 \RequirePackage{lwarp-scrextend}
+\AtBeginDocument{
+
+\renewcommand*{\idx at heading}{%
+  \idx@@heading{\indexname}%
+}
+
+\renewenvironment{theindex}{%
+  \idx at heading%
+  \index at preamble\par\nobreak
+    \let\item\LWR at indexitem%
+    \let\subitem\LWR at indexsubitem%
+    \let\subsubitem\LWR at indexsubsubitem%
+}
+{}
+
+\renewcommand*\indexspace{}
+
+}% AtBeginDocument
 \renewcommand*{\minisec}[1]{
 \begin{BlockClass}{minisec}
 #1

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-memoir.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-memoir.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-patch-memoir.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -28,6 +28,7 @@
 \RequirePackage{lwarp-footmisc}% req'd
 \RequirePackage{lwarp-framed}% req'd
 \RequirePackage{lwarp-hanging}% req'd
+\RequirePackage{lwarp-makeidx}% req'd
 \DisemulatePackage{moreverb}
 \RequirePackage{lwarp-moreverb}
 \RequirePackage{lwarp-mparhack}
@@ -38,6 +39,7 @@
 \RequirePackage{lwarp-setspace}% req'd
 \RequirePackage{lwarp-showidx}
 \RequirePackage{lwarp-subfigure}% red'q
+\makeindex
 \LetLtxMacro\LWR at memorignewsubfloat\newsubfloat
 \RenewDocumentCommand{\newsubfloat}{O{} m}{%
     \@ifundefined{c at sub#2}{%
@@ -49,19 +51,8 @@
 \RequirePackage{lwarp-titling}% req'd
 \RequirePackage{lwarp-tocloft}% req'd
 \RequirePackage{lwarp-verse}% req'd
-\LetLtxMacro\LWR at origlabel\@mem at old@label
+\LetLtxMacro\LWR at orig@label\@mem at old@label
 
-\AtBeginDocument{
-    \def\@@wrindexhyp#1||\\{%
-        \addtocounter{LWR at autoindex}{1}%
-        \LWR at newlabel{LWRindex-\arabic{LWR at autoindex}}%
-      \ifshowindexmark\@showidx{#1}\fi
-      \protected at write\@auxout{}%
-        {\string\@@wrindexm at m{\@idxfile}{#1}{\arabic{LWR at autoindex}}}%
-      \endgroup
-      \@esphack}%
-}
-
 \setstocksize{190in}{20in}
 \setlrmarginsandblock{2in}{2in}{*}
 \setulmarginsandblock{1in}{1in}{*}
@@ -739,7 +730,7 @@
 }
 \renewenvironment{sidenamedlegend}[2][]{
 \begin{center}
-\csuse{\@captype name}\CaptionSeparator#2
+\@nameuse{\@captype name}\CaptionSeparator#2
 \end{center}
 }
 {}
@@ -929,6 +920,43 @@
 \renewcommand*{\theTitleReference}[2]{}
 \renewcommand*{\namerefon}{}
 \renewcommand*{\namerefoff}{}
+\AtBeginDocument{
+
+\def\@@wrindexhyp#1||\\{%
+    \addtocounter{LWR at autoindex}{1}%
+    \LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%
+    \protected at write\@auxout{}%
+    {\string\@@wrindexm at m{\@idxfile}{#1}{\arabic{LWR at autoindex}}}%
+    \endgroup
+    \@esphack}%
+\def\@@wrspindexhyp#1||\\{%
+    \addtocounter{LWR at autoindex}{1}%
+    \LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%
+    \protected at write\@auxout{}%
+    {%
+        \string\@@wrindexm at m{\@idxfile}{#1}{\arabic{LWR at autoindex}}%
+    }%
+    \endgroup
+    \@esphack}%
+
+}% \AtBeginDocument
+
+\catcode`\_=12%
+\renewcommand*{\makeindex}[1][\BaseJobname]{%
+  \if at filesw
+    \def\index{\@bsphack%
+      \@ifnextchar [{\@index}{\@index[\BaseJobname]}}
+    \def\specialindex{\@bsphack\@spindex}%
+    \makememindexhook
+    \expandafter\newwrite\csname #1 at idxfile\endcsname
+    \expandafter\immediate\openout \csname #1 at idxfile\endcsname #1_html.idx\relax
+    \typeout{Writing index file #1_html.idx }%
+  \fi}
+\catcode`\_=8%
+
+\catcode`\_=12%
+\renewcommand{\printindex}[1][\BaseJobname]{\@input@{#1_html.ind}}
+\catcode`\_=8%
 \DeclareDocumentCommand{\newblock}{}{}
 \renewcommand*{\showindexmarks}{}
 \renewcommand*{\hideindexmarks}{}
@@ -985,7 +1013,7 @@
 \renewcommand{\midbicaption}[1]{}
 \renewcommand{\contcaption}[1]{%
 \begin{LWR at figcaption}% later becomes \caption*
-\csuse{\@captype name} \thechapter.\the\value{\@captype}\CaptionSeparator #1
+\@nameuse{\@captype name} \thechapter.\the\value{\@captype}\CaptionSeparator #1
 \end{LWR at figcaption}
 }
 
@@ -998,9 +1026,9 @@
 
 \renewcommand{\namedlegend}[2][]{
 \begin{center}
-\csuse{fleg\@captype}\CaptionSeparator#2\\
+\@nameuse{fleg\@captype}\CaptionSeparator#2\\
 \end{center}
-\csuse{flegtoc\@captype}{#1}
+\@nameuse{flegtoc\@captype}{#1}
 }
 
 \renewcommand{\newfixedcaption}[3][\caption]{%

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pdfpages.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pdfpages.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pdfpages.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,104 @@
+%%
+%% This is file `lwarp-pdfpages.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `pdfpages')
+%% 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{pdfpages}
+\define at key{pdfpages}{fitpaper}[false]{}
+\define at key{pdfpages}{landscape}[false]{}
+\define at key{pdfpages}{openright}[false]{}
+\define at key{pdfpages}{signature}{}
+\define at key{pdfpages}{signature*}{}
+\define at key{pdfpages}{booklet}[false]{}
+\define at key{pdfpages}{rotateoversize}[false]{}
+\define at key{pdfpages}{doublepages}[false]{}
+\define at key{pdfpages}{doublepagestwist}[false]{}
+\define at key{pdfpages}{doublepagestwistodd}[false]{}
+\define at key{pdfpages}{doublepagestwist*}[false]{}
+\define at key{pdfpages}{doublepagestwistodd*}[false]{}
+\define at key{pdfpages}{duplicatepages}[2]{}
+\define at key{pdfpages}{thread}[false]{}
+\define at key{pdfpages}{threadname}{}
+\define at key{pdfpages}{linkfit}{}
+\define at key{pdfpages}{linktodoc}[false]{}
+\define at key{pdfpages}{linktodocfit}{}
+\define at key{pdfpages}{linkfilename}{}
+\define at key{pdfpages}{survey}[false]{}
+\define at key{pdfpages}{survey-nolink}[false]{}
+\define at key{pdfpages}{newwindow}[false]{}
+\xpretocmd{\AM at getpagecount}{\LWR at restoreorigformatting}{}{}
+\newif\ifESO at texcoord
+
+\newcommand{\ESO at HookIIBG}{}
+
+\renewcommand{\AM at AddToShipoutPicture}{\g at addto@macro\ESO at HookIIBG}
+
+\renewcommand{\ClearShipoutPicture}{}
+\newcommand*{\LWR at esopic@newpage}{%
+\ifdefvoid{\ESO at HookIIBG}%
+{}%
+{%
+    \ifAM at link%
+        \hypertarget{\AM at linkname.\AM at page}{}%
+    \fi%
+    \begingroup%
+    \setlength{\unitlength}{1in}%
+    \begin{picture}(8,10.5)%
+    \ESO at HookIIBG%
+    \end{picture}%
+    \endgroup%
+    \global\let\ESO at HookIIBG\@empty%
+}
+}
+\xpatchcmd{\AM at output}
+    {\newpage}
+    {\LWR at esopic@newpage}
+    {}
+    {\LWR at patcherror{pdfpages}{AM at output-1}}
+
+\xpatchcmd{\AM at output}
+    {\newpage}
+    {\LWR at esopic@newpage}
+    {}
+    {\LWR at patcherror{pdfpages}{AM at output-2}}
+
+\xpatchcmd{\AM at output}
+    {\newpage}
+    {\LWR at esopic@newpage}
+    {}
+    {\LWR at patcherror{pdfpages}{AM at output-3}}
+\xpretocmd{\includepdf}{%
+    \begingroup%
+    \setlength{\paperwidth}{8in}%
+    \setlength{\paperheight}{10.5in}%
+}{}{}
+
+\xapptocmd{\includepdf}{%
+    \endgroup%
+}{}{}
+
+\xpretocmd{\includepdfmerge}{%
+    \begingroup%
+    \setlength{\paperwidth}{8in}%
+    \setlength{\paperheight}{10.5in}%
+}{}{}
+
+\xapptocmd{\includepdfmerge}{%
+    \endgroup%
+}{}{}
+\renewcommand{\AM at hyper@begin at i}{}
+\endinput
+%%
+%% End of file `lwarp-pdfpages.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pdfpages.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pdfx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pdfx.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pdfx.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,21 @@
+%%
+%% This is file `lwarp-pdfx.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `pdfx')
+%% 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{pdfx}
+\endinput
+%%
+%% End of file `lwarp-pdfx.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-pdfx.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-quoting.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-quoting.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-quoting.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -21,19 +21,12 @@
 \xpatchcmd{\quoting}{\quo at begintext}
     {\begin{LWR at blocktextcurrentfont}\quo at begintext}
     {}
-    {
-        \PackageError{lwarp}
-        {Unable to patch the quoting package}
-        {Please contact the author of the lwarp package.}
-    }
+    {\LWR at patcherror{quoting}{quoting}}
+
 \xpatchcmd{\endquoting}{\quo at endtext}
     {\quo at endtext\end{LWR at blocktextcurrentfont}}
     {}
-    {
-        \PackageError{lwarp}
-        {Unable to patch the quoting package}
-        {Please contact the author of the lwarp package.}
-    }
+    {\LWR at patcherror{imakeidx}{endquoting}}
 
 \endinput
 %%

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-repeatindex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-repeatindex.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-repeatindex.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,24 @@
+%%
+%% This is file `lwarp-repeatindex.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `repeatindex')
+%% 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{repeatindex}[2001/10/13]
+\RequirePackage{makeidx}
+\def\entryprefix{\itshape}
+\def\entrypostfix{\dots}
+\endinput
+%%
+%% End of file `lwarp-repeatindex.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-repeatindex.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-schemata.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-schemata.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-schemata.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -23,7 +23,7 @@
 
 \renewcommand{\schema}[3][open]{%
 \begin{lateximage}%
-\LWR at orignormalsize
+\LWR at print@normalsize
 \LWR at schemata@origschema[#1]{#2}{#3}%
 \end{lateximage}%
 }
@@ -30,7 +30,7 @@
 
 \renewcommand{\Schema}[5][open]{%
 \begin{lateximage}%
-\LWR at orignormalsize
+\LWR at print@normalsize
 \LWR at schemata@origSchema[#1]{#2}{#3}{#4}{#5}%
 \end{lateximage}%
 }

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-soul.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-soul.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-soul.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -35,7 +35,7 @@
 \ifcsempty{#2}%
 {\LWR at HTMLtextstyle{#5}{#3}{#1}}%
 {%
-    \convertcolorspec{named}{\csuse{#2}}{HTML}\LWR at tempcolor%
+    \convertcolorspec{named}{\@nameuse{#2}}{HTML}\LWR at tempcolor%
     \LWR at htmlspanclass[#5;#4:\LWR at origpound\LWR at tempcolor]{#3}{#1}%
 }%
 }

Added: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-splitidx.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-splitidx.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-splitidx.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -0,0 +1,64 @@
+%%
+%% This is file `lwarp-splitidx.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% lwarp.dtx  (with options: `splitidx')
+%% 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{splitidx}
+\catcode`\_=12%
+\xpatchcmd{\newindex}
+    {\jobname-#2.idx}
+    {\jobname-#2_html.idx}
+    {}
+    {\LWR at patcherror{splitidx}{@newindex}}
+\catcode`\_=8%
+\renewcommand*{\@wrsindex}[2][]{%
+  \ifx\relax#1\relax
+    \if at splitidx
+      \@wrsindex[idx]{#2}%
+    \else
+      \def\@tempa{#2}%
+      \if at verbindex\@onelevel at sanitize\@tempa\fi
+      \@wrindex{\@tempa}%
+    \fi
+  \else
+    \def\@tempa{#2}%
+    \csname index@#1 at hook\endcsname
+    \addtocounter{LWR at autoindex}{1}%                    lwarp
+    \LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%    lwarp
+      \@@@wrsindex{#1}{{\@tempa}{\arabic{LWR at autoindex}}}%
+    \endgroup
+    \@esphack
+  \fi
+}
+\xpatchcmd{\printsubindex}
+    {\let\section\subsection}
+    {\renewcommand*{\section}{\subsection}}
+    {}
+    {\LWR at patcherror{splitidx}{printsubindex-section}}
+
+\xpatchcmd{\printsubindex}
+    {\let\chapter\section}
+    {\renewcommand*{\chapter}{\section}}
+    {}
+    {\LWR at patcherror{splitidx}{printsubindex-chapter}}
+
+\xpatchcmd{\printsubindex}
+    {\let\@makechapterhead\section}
+    {\def\@makechapterhead{\section}}
+    {}
+    {\LWR at patcherror{splitidx}{printsubindex-chapter}}
+\endinput
+%%
+%% End of file `lwarp-splitidx.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-splitidx.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfig.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfig.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-subfig.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -155,7 +155,7 @@
 \renewcommand{\sf at subref}[1]{%
 \LWR at subnewref{#1}{sub@#1}%
 }
-\renewcommand{\sf@@subref}[1]{\LWR at origpageref{sub@#1}}
+\renewcommand{\sf@@subref}[1]{\LWR at orig@pageref{sub@#1}}
 \LetLtxMacro\LWR at orig@newsubfloat\@newsubfloat
 
 \def\@newsubfloat[#1]#2{%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-textcomp.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-textcomp.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-textcomp.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -18,133 +18,101 @@
 
 
 \LWR at ProvidesPackagePass{textcomp}
-\let\LWR at origtextdegree\textdegree
-\let\LWR at origtextcelsius\textcelsius
-\let\LWR at origtextohm\textohm
-\let\LWR at origtextmu\textmu
-\let\LWR at origtextlquill\textlquill
-\let\LWR at origtextrquill\textrquill
-\let\LWR at origtextcircledP\textcircledP
-\let\LWR at origtexttwelveudash\texttwelveudash
-\let\LWR at origtextthreequartersemdash\textthreequartersemdash
-\let\LWR at origtextmho\textmho
-\let\LWR at origtextnaira\textnaira
-\let\LWR at origtextpeso\textpeso
-\let\LWR at origtextrecipe\textrecipe
-\let\LWR at origtextinterrobangdown\textinterrobangdown
-\let\LWR at origtextperthousand\textperthousand
-\let\LWR at origtextpertenthousand\textpertenthousand
-\let\LWR at origtextbaht\textbaht
-\let\LWR at origtextdiscount\textdiscount
-\let\LWR at origtextservicemark\textservicemark
-\LetLtxMacro\LWR at origcapitalcedilla\capitalcedilla
-\LetLtxMacro\LWR at origcapitalogonek\capitalogonek
-\LetLtxMacro\LWR at origcapitalgrave\capitalgrave
-\LetLtxMacro\LWR at origcapitalacute\capitalacute
-\LetLtxMacro\LWR at origcapitalcircumflex\capitalcircumflex
-\LetLtxMacro\LWR at origcapitaltilde\capitaltilde
-\LetLtxMacro\LWR at origcapitaldieresis\capitaldieresis
-\LetLtxMacro\LWR at origcapitalhungarumlaut\capitalhungarumlaut
-\LetLtxMacro\LWR at origcapitalring\capitalring
-\LetLtxMacro\LWR at origcapitalcaron\capitalcaron
-\LetLtxMacro\LWR at origcapitalbreve\capitalbreve
-\LetLtxMacro\LWR at origcapitalmacron\capitalmacron
-\LetLtxMacro\LWR at origcapitaldotaccent\capitaldotaccent
-\LetLtxMacro\LWR at origtextcircled\textcircled
 \AtBeginDocument{
 \ifPDFTeX
-\renewcommand*{\textdegree}{\HTMLentity{deg}}
-\renewcommand*{\textcelsius}{\HTMLunicode{2103}}
-\renewcommand*{\textohm}{\HTMLunicode{2126}}
-\renewcommand*{\textmu}{\HTMLunicode{00B5}}
-\renewcommand*{\textlquill}{\HTMLunicode{2045}}
-\renewcommand*{\textrquill}{\HTMLunicode{2046}}
-\renewcommand*{\textcircledP}{\HTMLunicode{2117}}
-\renewcommand*{\texttwelveudash}{\HTMLunicode{2014}}% emdash
-\renewcommand*{\textthreequartersemdash}{\HTMLunicode{2014}}% emdash
-\renewcommand*{\textmho}{\HTMLunicode{2127}}
-\renewcommand*{\textnaira}{\HTMLunicode{20A6}}
-\renewcommand*{\textpeso}{\HTMLunicode{20B1}}
-\renewcommand*{\textrecipe}{\HTMLunicode{211E}}
-\renewcommand*{\textinterrobangdown}{\HTMLunicode{2E18}}
-\renewcommand*{\textperthousand}{\HTMLunicode{2030}}
-\renewcommand*{\textpertenthousand}{\HTMLunicode{2031}}
-\renewcommand*{\textbaht}{\HTMLunicode{0E3F}}
-\renewcommand*{\textdiscount}{\%}
-\renewcommand*{\textservicemark}{\HTMLunicode{2120}}
+\newcommand*{\LWR at HTML@textdegree}{\HTMLentity{deg}}
+\newcommand*{\LWR at HTML@textcelsius}{\HTMLunicode{2103}}
+\newcommand*{\LWR at HTML@textohm}{\HTMLunicode{2126}}
+\newcommand*{\LWR at HTML@textmu}{\HTMLunicode{00B5}}
+\newcommand*{\LWR at HTML@textlquill}{\HTMLunicode{2045}}
+\newcommand*{\LWR at HTML@textrquill}{\HTMLunicode{2046}}
+\newcommand*{\LWR at HTML@textcircledP}{\HTMLunicode{2117}}
+\newcommand*{\LWR at HTML@texttwelveudash}{\HTMLunicode{2014}}% emdash
+\newcommand*{\LWR at HTML@textthreequartersemdash}{\HTMLunicode{2014}}% emdash
+\newcommand*{\LWR at HTML@textmho}{\HTMLunicode{2127}}
+\newcommand*{\LWR at HTML@textnaira}{\HTMLunicode{20A6}}
+\newcommand*{\LWR at HTML@textpeso}{\HTMLunicode{20B1}}
+\newcommand*{\LWR at HTML@textrecipe}{\HTMLunicode{211E}}
+\newcommand*{\LWR at HTML@textinterrobangdown}{\HTMLunicode{2E18}}
+\newcommand*{\LWR at HTML@textperthousand}{\HTMLunicode{2030}}
+\newcommand*{\LWR at HTML@textpertenthousand}{\HTMLunicode{2031}}
+\newcommand*{\LWR at HTML@textbaht}{\HTMLunicode{0E3F}}
+\newcommand*{\LWR at HTML@textdiscount}{\%}
+\newcommand*{\LWR at HTML@textservicemark}{\HTMLunicode{2120}}
 \else
-\renewcommand*{\textdegree}{°}
-\renewcommand*{\textcelsius}{℃}
-\renewcommand*{\textohm}{Ω}
-\renewcommand*{\textmu}{µ}
-\renewcommand*{\textlquill}{⁅}
-\renewcommand*{\textrquill}{⁆}
-\renewcommand*{\textcircledP}{℗}
-\renewcommand*{\texttwelveudash}{—}% emdash
-\renewcommand*{\textthreequartersemdash}{—}% emdash
-\renewcommand*{\textmho}{℧}
-\renewcommand*{\textnaira}{₦}
-\renewcommand*{\textpeso}{₱}
-\renewcommand*{\textrecipe}{℞}
-\renewcommand*{\textinterrobangdown}{⸘}
-\renewcommand*{\textperthousand}{‰}
-\renewcommand*{\textpertenthousand}{‱}
-\renewcommand*{\textbaht}{฿}
-\renewcommand*{\textdiscount}{\%}
-\renewcommand*{\textservicemark}{℠}
+\newcommand*{\LWR at HTML@textdegree}{°}
+\newcommand*{\LWR at HTML@textcelsius}{℃}
+\newcommand*{\LWR at HTML@textohm}{Ω}
+\newcommand*{\LWR at HTML@textmu}{µ}
+\newcommand*{\LWR at HTML@textlquill}{⁅}
+\newcommand*{\LWR at HTML@textrquill}{⁆}
+\newcommand*{\LWR at HTML@textcircledP}{℗}
+\newcommand*{\LWR at HTML@texttwelveudash}{—}% emdash
+\newcommand*{\LWR at HTML@textthreequartersemdash}{—}% emdash
+\newcommand*{\LWR at HTML@textmho}{℧}
+\newcommand*{\LWR at HTML@textnaira}{₦}
+\newcommand*{\LWR at HTML@textpeso}{₱}
+\newcommand*{\LWR at HTML@textrecipe}{℞}
+\newcommand*{\LWR at HTML@textinterrobangdown}{⸘}
+\newcommand*{\LWR at HTML@textperthousand}{‰}
+\newcommand*{\LWR at HTML@textpertenthousand}{‱}
+\newcommand*{\LWR at HTML@textbaht}{฿}
+\newcommand*{\LWR at HTML@textdiscount}{\%}
+\newcommand*{\LWR at HTML@textservicemark}{℠}
 \fi
-\renewcommand*{\capitalcedilla}[1]{#1\HTMLunicode{0327}}
-\renewcommand*{\capitalogonek}[1]{#1\HTMLunicode{0328}}
-\renewcommand*{\capitalgrave}[1]{#1\HTMLunicode{0300}}
-\renewcommand*{\capitalacute}[1]{#1\HTMLunicode{0301}}
-\renewcommand*{\capitalcircumflex}[1]{#1\HTMLunicode{0302}}
-\renewcommand*{\capitaltilde}[1]{#1\HTMLunicode{0303}}
-\renewcommand*{\capitaldieresis}[1]{#1\HTMLunicode{0308}}
-\renewcommand*{\capitalhungarumlaut}[1]{#1\HTMLunicode{30B}}
-\renewcommand*{\capitalring}[1]{#1\HTMLunicode{30A}}
-\renewcommand*{\capitalcaron}[1]{#1\HTMLunicode{30C}}
-\renewcommand*{\capitalbreve}[1]{#1\HTMLunicode{306}}
-\renewcommand*{\capitalmacron}[1]{#1\HTMLunicode{304}}
-\renewcommand*{\capitaldotaccent}[1]{#1\HTMLunicode{307}}
-\renewcommand*{\textcircled}[1]{%
+
+\LWR at formatted{textdegree}
+\LWR at formatted{textcelsius}
+\LWR at formatted{textohm}
+\LWR at formatted{textmu}
+\LWR at formatted{textlquill}
+\LWR at formatted{textrquill}
+\LWR at formatted{textcircledP}
+\LWR at formatted{texttwelveudash}
+\LWR at formatted{textthreequartersemdash}
+\LWR at formatted{textmho}
+\LWR at formatted{textnaira}
+\LWR at formatted{textpeso}
+\LWR at formatted{textrecipe}
+\LWR at formatted{textinterrobangdown}
+\LWR at formatted{textperthousand}
+\LWR at formatted{textpertenthousand}
+\LWR at formatted{textbaht}
+\LWR at formatted{textdiscount}
+\LWR at formatted{textservicemark}
+\newcommand*{\LWR at HTML@capitalcedilla}[1]{#1\HTMLunicode{0327}}
+\newcommand*{\LWR at HTML@capitalogonek}[1]{#1\HTMLunicode{0328}}
+\newcommand*{\LWR at HTML@capitalgrave}[1]{#1\HTMLunicode{0300}}
+\newcommand*{\LWR at HTML@capitalacute}[1]{#1\HTMLunicode{0301}}
+\newcommand*{\LWR at HTML@capitalcircumflex}[1]{#1\HTMLunicode{0302}}
+\newcommand*{\LWR at HTML@capitaltilde}[1]{#1\HTMLunicode{0303}}
+\newcommand*{\LWR at HTML@capitaldieresis}[1]{#1\HTMLunicode{0308}}
+\newcommand*{\LWR at HTML@capitalhungarumlaut}[1]{#1\HTMLunicode{30B}}
+\newcommand*{\LWR at HTML@capitalring}[1]{#1\HTMLunicode{30A}}
+\newcommand*{\LWR at HTML@capitalcaron}[1]{#1\HTMLunicode{30C}}
+\newcommand*{\LWR at HTML@capitalbreve}[1]{#1\HTMLunicode{306}}
+\newcommand*{\LWR at HTML@capitalmacron}[1]{#1\HTMLunicode{304}}
+\newcommand*{\LWR at HTML@capitaldotaccent}[1]{#1\HTMLunicode{307}}
+\newcommand*{\LWR at HTML@textcircled}[1]{%
 \InlineClass[border: 1px solid \LWR at currenttextcolor]{textcircled}{#1}%
 }
+
+\LWR at formatted{capitalcedilla}
+\LWR at formatted{capitalogonek}
+\LWR at formatted{capitalgrave}
+\LWR at formatted{capitalacute}
+\LWR at formatted{capitalcircumflex}
+\LWR at formatted{capitaltilde}
+\LWR at formatted{capitaldieresis}
+\LWR at formatted{capitalhungarumlaut}
+\LWR at formatted{capitalring}
+\LWR at formatted{capitalcaron}
+\LWR at formatted{capitalbreve}
+\LWR at formatted{capitalmacron}
+\LWR at formatted{capitaldotaccent}
+\LWR at formatted{textcircled}
+
 }% AtBeginDocument
-\appto\LWR at restoreorigformatting{%
-\let\textdegree\LWR at origtextdegree%
-\let\textcelsius\LWR at origtextcelsius%
-\let\textohm\LWR at origtextohm%
-\let\textmu\LWR at origtextmu%
-\let\textlquill\LWR at origtextlquill%
-\let\textrquill\LWR at origtextrquill%
-\let\textcircledP\LWR at origtextcircledP%
-\let\texttwelveudash\LWR at origtexttwelveudash%
-\let\textthreequartersemdash\LWR at origtextthreequartersemdash%
-\let\textmho\LWR at origtextmho%
-\let\textnaira\LWR at origtextnaira%
-\let\textpeso\LWR at origtextpeso%
-\let\textrecipe\LWR at origtextrecipe%
-\let\textinterrobangdown\LWR at origtextinterrobangdown%
-\let\textperthousand\LWR at origtextperthousand%
-\let\textpertenthousand\LWR at origtextpertenthousand%
-\let\textbaht\LWR at origtextbaht%
-\let\textdiscount\LWR at origtextdiscount%
-\let\textservicemark\LWR at origtextservicemark%
-\LetLtxMacro\capitalcedilla\LWR at origcapitalcedilla%
-\LetLtxMacro\capitalogonek\LWR at origcapitalogonek%
-\LetLtxMacro\capitalgrave\LWR at origcapitalgrave%
-\LetLtxMacro\capitalacute\LWR at origcapitalacute%
-\LetLtxMacro\capitalcircumflex\LWR at origcapitalcircumflex%
-\LetLtxMacro\capitaltilde\LWR at origcapitaltilde%
-\LetLtxMacro\capitaldieresis\LWR at origcapitaldieresis%
-\LetLtxMacro\capitalhungarumlaut\LWR at origcapitalhungarumlaut%
-\LetLtxMacro\capitalring\LWR at origcapitalring%
-\LetLtxMacro\capitalcaron\LWR at origcapitalcaron%
-\LetLtxMacro\capitalbreve\LWR at origcapitalbreve%
-\LetLtxMacro\capitalmacron\LWR at origcapitalmacron%
-\LetLtxMacro\capitaldotaccent\LWR at origcapitaldotaccent%
-\LetLtxMacro\textcircled\LWR at origtextcircled%
-}
 \endinput
 %%
 %% End of file `lwarp-textcomp.sty'.

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-theorem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-theorem.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-theorem.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -49,7 +49,7 @@
             \expandafter \endcsname \the \theorem at bodyfont
      \@thm{#1}{#2}}%
     \global \expandafter \let \csname end#1\endcsname \@endtheorem
-    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
    }}
 
 \gdef\@ynthm#1#2{%
@@ -62,7 +62,7 @@
      \expandafter{\csname th@\the \theorem at style \expandafter
      \endcsname \the\theorem at bodyfont \@thm{#1}{#2}}%
     \global \expandafter \let \csname end#1\endcsname \@endtheorem
-    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
    }}
 
 \gdef\@othm#1[#2]#3{%
@@ -78,7 +78,7 @@
      \expandafter{\csname th@\the \theorem at style \expandafter
      \endcsname \the\theorem at bodyfont \@thm{#2}{#3}}%
     \global \expandafter \let \csname end#1\endcsname \@endtheorem
-    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\csuse{LWR at thmstyle#1}}}% lwarp
+    \AtBeginEnvironment{#1}{\edef\LWR at thisthmstyle{\@nameuse{LWR at thmstyle#1}}}% lwarp
     }%
   \fi}
 \gdef\th at plain{%

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp-tikz.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -37,18 +37,18 @@
 \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
+\let\pgfutil at raggedleft\LWR at print@raggedleft
+\let\pgfutil at raggedright\LWR at print@raggedright
 
-\def\pgfutil at font@tiny{\LWR at origtiny}
-\def\pgfutil at font@scriptsize{\LWR at origscriptsize}
-\def\pgfutil at font@footnotesize{\LWR at origfootnotesize}
-\def\pgfutil at font@small{\LWR at origsmall}
-\def\pgfutil at font@normalsize{\LWR at orignormalsize}
-\def\pgfutil at font@large{\LWR at origlarge}
-\def\pgfutil at font@Large{\LWR at origLarge}
-\def\pgfutil at font@huge{\LWR at orighuge}
-\def\pgfutil at font@Huge{\LWR at origHuge}
+\def\pgfutil at font@tiny{\LWR at printtiny}
+\def\pgfutil at font@scriptsize{\LWR at printscriptsize}
+\def\pgfutil at font@footnotesize{\LWR at printfootnotesize}
+\def\pgfutil at font@small{\LWR at print@small}
+\def\pgfutil at font@normalsize{\LWR at print@normalsize}
+\def\pgfutil at font@large{\LWR at printlarge}
+\def\pgfutil at font@Large{\LWR at printLarge}
+\def\pgfutil at font@huge{\LWR at printhuge}
+\def\pgfutil at font@Huge{\LWR at printHuge}
 
 \def\pgfutil at font@itshape{\LWR at origitshape}
 \def\pgfutil at font@bfseries{\LWR at origbfseries}

Modified: trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty	2018-07-07 20:46:19 UTC (rev 48158)
+++ trunk/Master/texmf-dist/tex/latex/lwarp/lwarp.sty	2018-07-07 20:46:58 UTC (rev 48159)
@@ -17,7 +17,7 @@
 %% version 2005/12/01 or later.
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesPackage{lwarp}
-    [2018/06/06 v0.57  Allows LaTeX to directly produce HTML5 output.]
+    [2018/07/07 v0.58  Allows LaTeX to directly produce HTML5 output.]
 
 
 
@@ -89,6 +89,12 @@
 }
 \newcommand*{\LWR at convertto}[2]{\strip at pt\dimexpr #2*65536/\number\dimexpr 1#1}
 
+\newcommand*{\LWR at patcherror}[2]{%
+\PackageError{lwarp}
+{Unable to patch package #1, macro #2}
+{Please contact the author of the lwarp package.}
+}
+
 \RequirePackage{etoolbox}[2011/01/03]% v2.6 for \BeforeBeginEnvironment, etc.
 \RequirePackage{xpatch}
 
@@ -147,12 +153,14 @@
 
 \DeclareStringOption[\jobname]{BaseJobname}
 
+\DeclareStringOption[lwarp.ist]{makeindexStyle}
+
+\DeclareStringOption[lwarp.xdy]{xindyStyle}
+
 \DeclareStringOption[english]{xindyLanguage}
 
 \DeclareStringOption[utf8]{xindyCodepage}
 
-\DeclareStringOption[lwarp.xdy]{xindyStyle}
-
 \DeclareStringOption[UTF-8]{pdftotextEnc}
 
 \newbool{LWR at creatinglwarpmk}
@@ -172,6 +180,18 @@
 
 \DeclareStringOption[]{HTMLFilename}
 
+\DeclareStringOption[]{PrintIndexCmd}
+
+\DeclareStringOption[]{HTMLIndexCmd}
+
+\DeclareStringOption[]{LatexmkIndexCmd}
+
+\DeclareBoolOption[false]{makeindex}
+
+\DeclareBoolOption[false]{xindy}
+
+\DeclareStringOption[makeglossaries]{GlossaryCmd}
+
 \DeclareBoolOption[false]{latexmk}
 
 \ProcessKeyvalOptions*\relax
@@ -185,6 +205,49 @@
 }
 
 \csedef{HTMLFilename}{\LWR at HTMLFilename}
+\ifdefempty{\LWR at PrintIndexCmd}{
+    \renewcommand{\LWR at PrintIndexCmd}{%
+        makeindex  -s \LWR at makeindexStyle \space  \jobname.idx%
+    }
+    \ifbool{LWR at xindy}{
+        \renewcommand{\LWR at PrintIndexCmd}{%
+            xindy
+            -M \LWR at xindyStyle \space
+            -L \LWR at xindyLanguage \space
+            -C \LWR at xindyCodepage \space
+            \jobname.idx%
+        }
+    }{}
+}{}
+
+\ifdefempty{\LWR at HTMLIndexCmd}{
+    \renewcommand{\LWR at HTMLIndexCmd}{%
+        makeindex  -s \LWR at makeindexStyle \space  \jobname_html.idx%
+    }
+    \ifbool{LWR at xindy}{
+        \renewcommand{\LWR at HTMLIndexCmd}{%
+            xindy
+            -M \LWR at xindyStyle \space
+            -L \LWR at xindyLanguage \space
+            -C \LWR at xindyCodepage \space
+            \jobname_html.idx%
+        }
+    }{}
+}{}
+
+\ifdefempty{\LWR at LatexmkIndexCmd}{
+    \renewcommand{\LWR at LatexmkIndexCmd}{%
+        makeindex  -s \LWR at makeindexStyle%
+    }
+    \ifbool{LWR at xindy}{
+        \renewcommand{\LWR at LatexmkIndexCmd}{%
+            xindy
+            -M \LWR at xindyStyle \space
+            -L \LWR at xindyLanguage \space
+            -C \LWR at xindyCodepage%
+        }
+    }{}
+}{}
 \newcommand{\warpprintonly}[1]{\ifbool{warpingprint}{#1}{}}
 \newcommand{\warpHTMLonly}[1]{\ifbool{warpingHTML}{#1}{}}
 \RequirePackage{comment}
@@ -288,6 +351,8 @@
 \LWR at notmemoirloadafter{appendix}
 \LWR at loadafter{arabicfront}
 \LWR at notmemoirloadafter{array}
+\LWR at loadafter{attachfile}
+\LWR at loadafter{attachfile2}
 \LWR at loadafter{authblk}
 \LWR at loadafter{axodraw2}
 \LWR at loadafter{backref}
@@ -304,7 +369,7 @@
 \LWR at loadafter{cancel}
 \LWR at loadafter{caption}
 \LWR at loadafter{caption2}
-\LWR at loadafter{ccaption}
+\LWR at loadafter{cases}
 \LWR at loadafter{changebar}
 \LWR at notmemoirloadafter{changepage}
 \LWR at notmemoirloadafter{chngpage}
@@ -390,7 +455,10 @@
 \LWR at loadafter{hyphenat}
 \LWR at loadafter{idxlayout}
 \LWR at loadafter{ifoddpage}
+\LWR at loadafter{imakeidx}
 \LWR at loadafter{indentfirst}
+\LWR at notmemoirloadafter{index}
+\LWR at loadafter{intopdf}
 \LWR at loadafter{keyfloat}
 \LWR at loadafter{layout}
 \LWR at loadafter{letterspace}
@@ -408,6 +476,7 @@
 \LWR at loadafter{luacolor}
 \LWR at loadafter{luatodonotes}
 \LWR at loadafter{magaz}
+\LWR at notmemoirloadafter{makeidx}
 \LWR at loadafter{marginfit}
 \LWR at loadafter{marginfix}
 \LWR at loadafter{marginnote}
@@ -445,7 +514,9 @@
 \LWR at loadafter{pbox}
 \LWR at loadafter{pdfrender}
 \LWR at loadafter{pdflscape}
+\LWR at loadafter{pdfpages}
 \LWR at loadafter{pdfsync}
+\LWR at loadafter{pdfx}
 \LWR at loadafter{pfnote}
 \LWR at loadafter{phfqit}
 \LWR at loadafter{placeins}
@@ -458,6 +529,7 @@
 \LWR at loadafter{realscripts}
 \LWR at loadafter{register}
 \LWR at loadafter{relsize}
+\LWR at loadafter{repeatindex}
 \LWR at loadafter{resizegather}
 \LWR at loadafter{romanbar}
 \LWR at loadafter{romanbarpagenumber}
@@ -483,6 +555,7 @@
 \LWR at loadafter{soul}
 \LWR at loadafter{soulpos}
 \LWR at loadafter{soulutf8}
+\LWR at loadafter{splitidx}
 \LWR at loadafter{stabular}
 \LWR at loadafter{stfloats}
 \LWR at loadafter{subfig}
@@ -612,9 +685,6 @@
 
 \RequirePackage{verbatim}
 
-\RequirePackage{makeidx}
-\makeindex
-
 \RequirePackage{calc}
 
 \RequirePackage{refcount}
@@ -877,11 +947,11 @@
     }{}%
     \ifcsundef{#1}{%
         \expandafter\newrobustcmd\csname #1\endcsname{%
-            \csuse{LWR@\LWR at formatting @#1}%
+            \@nameuse{LWR@\LWR at formatting @#1}%
         }%
     }{%
         \expandafter\renewrobustcmd\csname #1\endcsname{%
-            \csuse{LWR@\LWR at formatting @#1}%
+            \@nameuse{LWR@\LWR at formatting @#1}%
         }%
     }%
 }
@@ -892,11 +962,11 @@
     }{}%
     \ifcsundef{#1}{%
         \expandafter\newcommand\csname #1\endcsname{%
-            \csuse{LWR@\LWR at formatting @#1}%
+            \@nameuse{LWR@\LWR at formatting @#1}%
         }%
     }{%
         \expandafter\renewcommand\csname #1\endcsname{%
-            \csuse{LWR@\LWR at formatting @#1}%
+            \@nameuse{LWR@\LWR at formatting @#1}%
         }%
     }%
 }
@@ -907,8 +977,8 @@
         \csletcs{endLWR at print@#1}{end#1}%
     }{}%
     \DeclareDocumentEnvironment{#1}{}%
-    {\csuse{LWR@\LWR at formatting @#1}}%
-    {\csuse{endLWR@\LWR at formatting @#1}}%
+    {\@nameuse{LWR@\LWR at formatting @#1}}%
+    {\@nameuse{endLWR@\LWR at formatting @#1}}%
 }
 \newcommand*{\LWR at expandableformattedenv}[1]{%
     \ifcsundef{LWR at print@#1}{%
@@ -917,8 +987,8 @@
         \csletcs{endLWR at print@#1}{end#1}%
     }{}%
     \DeclareExpandableDocumentEnvironment{#1}{}%
-    {\csuse{LWR@\LWR at formatting @#1}}%
-    {\csuse{endLWR@\LWR at formatting @#1}}%
+    {\@nameuse{LWR@\LWR at formatting @#1}}%
+    {\@nameuse{endLWR@\LWR at formatting @#1}}%
 }
 \end{warpHTML}
 
@@ -1020,7 +1090,6 @@
 \let\LWR at origenskip\enskip
 \let\LWR at origquad\quad
 \let\LWR at origqquad\qquad
-\let\LWR at orighfill\hfill
 \let\LWR at orighfil\hfil
 \let\LWR at orighss\hss
 \let\LWR at origllap\llap
@@ -1027,25 +1096,11 @@
 \let\LWR at origrlap\rlap
 \let\LWR at orighfilneg\hfilneg
 
-\let\LWR at orighrulefill\hrulefill
-\let\LWR at origdotfill\dotfill
-
 \let\LWR at origmedskip\medskip
 \let\LWR at origbigskip\bigskip
 
 \let\LWR at origtextellipsis\textellipsis
 
-\let\LWR at orignormalsize\normalsize
-\let\LWR at origsmall\small
-\let\LWR at origfootnotesize\footnotesize
-\let\LWR at origscriptsize\scriptsize
-\let\LWR at origtiny\tiny
-\let\LWR at origlarge\large
-\let\LWR at origLarge\Large
-\let\LWR at origLARGE\LARGE
-\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
@@ -1070,7 +1125,6 @@
 \LetLtxMacro\LWR at origem\em
 \LetLtxMacro\LWR at orignormalfont\normalfont
 
-\let\LWR at origraggedright\raggedright
 \let\LWR at origonecolumn\onecolumn
 
 \let\LWR at origsp\sp
@@ -1084,9 +1138,6 @@
 }
 
 \LetLtxMacro\LWR at origunderline\underline
-\let\LWR at origraggedright\raggedright
-\let\LWR at origraggedleft\raggedleft
-\let\LWR at origcentering\centering
 \let\LWR at orignewpage\newpage
 
 \let\LWR at origpagestyle\pagestyle
@@ -1186,6 +1237,7 @@
 \end{warpprint}
 
 \begin{warpprint}
+\AtBeginDocument{
 \ifcsdef{LWR at quickfile}{}{\newwrite{\LWR at quickfile}}
 \immediate\openout\LWR at quickfile=lwarpmk.conf
 \ifbool{usingOSWindows}{
@@ -1209,14 +1261,17 @@
 \immediate\write\LWR at quickfile{htmlfilename = "\HTMLFilename"}
 \immediate\write\LWR at quickfile{latexmk = "\ifbool{LWR at latexmk}{true}{false}"}
 \immediate\write\LWR at quickfile{shellescape = "\ifshellescape true\else false\fi"}
-\immediate\write\LWR at quickfile{xindylanguage = "\LWR at xindyLanguage"}
-\immediate\write\LWR at quickfile{xindycodepage = "\LWR at xindyCodepage"}
-\immediate\write\LWR at quickfile{xindystyle = "\LWR at xindyStyle"}
+\immediate\write\LWR at quickfile{printindexcmd = "\LWR at PrintIndexCmd"}
+\immediate\write\LWR at quickfile{HTMLindexcmd = "\LWR at HTMLIndexCmd"}
+\immediate\write\LWR at quickfile{latexmkindexcmd = "\LWR at LatexmkIndexCmd"}
+\immediate\write\LWR at quickfile{glossarycmd = "\LWR at GlossaryCmd"}
 \immediate\write\LWR at quickfile{pdftotextenc = "\LWR at pdftotextEnc"}
 \immediate\closeout\LWR at quickfile
+}% AtBeginDocument
 \end{warpprint}
 
 \begin{warpprint}
+\AtBeginDocument{
 \ifcsdef{LWR at quickfile}{}{\newwrite{\LWR at quickfile}}
 \immediate\openout\LWR at quickfile=\jobname.lwarpmkconf
 \ifbool{usingOSWindows}{
@@ -1240,11 +1295,13 @@
 \immediate\write\LWR at quickfile{htmlfilename = "\HTMLFilename"}
 \immediate\write\LWR at quickfile{latexmk = "\ifbool{LWR at latexmk}{true}{false}"}
 \immediate\write\LWR at quickfile{shellescape = "\ifshellescape true\else false\fi"}
-\immediate\write\LWR at quickfile{xindylanguage = "\LWR at xindyLanguage"}
-\immediate\write\LWR at quickfile{xindycodepage = "\LWR at xindyCodepage"}
-\immediate\write\LWR at quickfile{xindystyle = "\LWR at xindyStyle"}
+\immediate\write\LWR at quickfile{printindexcmd = "\LWR at PrintIndexCmd"}
+\immediate\write\LWR at quickfile{HTMLindexcmd = "\LWR at HTMLIndexCmd"}
+\immediate\write\LWR at quickfile{latexmkindexcmd = "\LWR at LatexmkIndexCmd"}
+\immediate\write\LWR at quickfile{glossarycmd = "\LWR at GlossaryCmd"}
 \immediate\write\LWR at quickfile{pdftotextenc = "\LWR at pdftotextEnc"}
 \immediate\closeout\LWR at quickfile
+}% AtBeginDocument
 \end{warpprint}
 
 
@@ -3084,6 +3141,31 @@
 
 
 \begin{warpprint}
+\begin{filecontents*}{lwarp.ist}
+preamble
+"\\begin{theindex}
+  \\providecommand*\\lettergroupDefault[1]{}
+  \\providecommand*\\lettergroup[1]{%
+      \\par\\textbf{#1}\\par
+      \\nopagebreak
+  }
+"
+headings_flag 1
+heading_prefix "
+  \\lettergroup{"
+heading_suffix "}"
+delim_0 ", \\hyperindexref{"
+delim_1 ", \\hyperindexref{"
+delim_2 ", \\hyperindexref{"
+delim_n "}, \\hyperindexref{"
+delim_r "} -- \\hyperindexref{"
+delim_t "}"
+page_compositor "."
+\end{filecontents*}
+\end{warpprint}
+
+
+\begin{warpprint}
 \begin{filecontents*}{lwarp.xdy}
 (require "tex/inputenc/latin.xdy")
 (merge-rule "\\PS *" "Postscript")
@@ -3090,10 +3172,14 @@
 (require "texindy.xdy")
 (require "page-ranges.xdy")
 (require "book-order.xdy")
-(require "page-ranges.xdy")
-(markup-locref :open "\hyperindexref{" :close "}")
 (define-location-class "arabic-page-numbers"
     ("arabic-numbers") :min-range-length 1)
+(require "makeindex.xdy")
+(define-attributes (("hyperindexref")))
+(markup-locref :open "\hyperindexref{" :close "}")
+(markup-locref :open "\hyperindexref{" :close "}" :attr "hyperpage")
+(markup-locref :open "\textbf{\hyperindexref{" :close "}}" :attr "textbf")
+(markup-locref :open "\textit{\hyperindexref{" :close "}}" :attr "textit")
 (define-location-class-order ("roman-page-numbers"
                   "arabic-page-numbers"
                   "alpha-page-numbers"
@@ -3227,7 +3313,7 @@
 
 -- Copyright 2016-2018 Brian Dunn
 
-printversion = "v0.57"
+printversion = "v0.58"
 
 function printhelp ()
 print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;
@@ -3239,56 +3325,62 @@
 --
 print ( [[
 
-lwarpmk print [project]: Compile the print version if necessary.
-lwarpmk print1 [project]: Forced single compile of the print version.
-lwarpmk printindex [project]: Process the index for the print version.
-lwarpmk printglossary [project]: Process the glossary for the print version.
-lwarpmk html [project]: Compile the HTML version if necessary.
-lwarpmk html1 [project]: Forced single compile of the HTML version.
-lwarpmk htmlindex [project]: Process the index for the html version.
-lwarpmk htmlglossary [project]: Process the glossary for the html version.
-lwarpmk again [project]: Touch the source code to trigger recompiles.
-lwarpmk limages [project]: Process the "lateximages" created by lwarp.sty.
-lwarpmk pdftohtml [project]:
+lwarpmk print [-p project]: Compile the print version if necessary.
+lwarpmk print1 [-p project]: Forced single compile of the print version.
+lwarpmk printindex [-p project]: Process print indexes.
+lwarpmk printglossary [-p project]: Process the glossary for the print version.
+lwarpmk html [-p project]: Compile the HTML version if necessary.
+lwarpmk html1 [-p project]: Forced single compile of the HTML version.
+lwarpmk htmlindex [-p project]: Process HTML indexes.
+lwarpmk htmlglossary [-p project]: Process the glossary for the html version.
+lwarpmk again [-p project]: Touch the source code to trigger recompiles.
+lwarpmk limages [-p project]: Process the "lateximages" created by lwarp.sty.
+lwarpmk pdftohtml [-p project]:
     For use with latexmk or a Makefile:
     Converts project_html.pdf to project_html.html and individual HTML files.
     Finishes the HTML conversion even if there was a compile error.
 lwarpmk pdftosvg <list of file names>: Converts each PDF file to SVG.
-lwarpmk clean [project]: Remove .aux, .toc, .lof/t, .idx, .ind, .log, *_html_inc.*, .gl*
-lwarpmk cleanall [project]: Remove auxiliary files and also project.pdf, *.html
+lwarpmk clean [-p project]: Remove .aux, .toc, .lof/t, .idx, .ind, .log, *_html_inc.*, .gl*
+lwarpmk cleanall [-p project]: Remove auxiliary files and also project.pdf, *.html
 lwarpmk cleanlimages: Removes all images from the "lateximages" directory.
 lwarpmk -h: Print this help message.
 lwarpmk --help: Print this help message.
 
 ]] )
-printconf ()
+-- printconf ()
 end
 
-function printconf ()
+-- function printconf ()
+-- --
+-- -- Print the format of the configuration file lwarpmk.conf:
+-- --
+-- print ( [[
+-- An example lwarpmk.conf or <project>.lwarpmkconf project file:
+-- --
+-- opsystem = "Unix"   (or "Windows")
+-- latexname = "pdflatex"  (or "lualatex", or "xelatex")
+-- sourcename = "projectname"  (the source-code filename w/o .tex)
+-- homehtmlfilename = "index"  (or perhaps the project name)
+-- htmlfilename = ""  (or "projectname" - filename prefix)
+-- latexmk = "false"  (or "true" to use latexmk to build PDFs)
+-- shellescape = "false"
+-- printindexcmd = "makeindex -s lwarp.ist <name>.idx"
+-- HTMLindexcmd = "makeindex -s lwarp.ist <name>_html.idx"
+-- latexmkindexcmd = "makeindex -s lwarp.ist"
+-- -- indexprog = "makeindex" or "xindy"
+-- -- makeindexstyle = "lwarp.ist" (or a custom file based on lwarp.ist)
+-- -- xindylanguge = "english"  (use a language supported by xindy)
+-- -- xindycodepage = "utf8"  (use a codepage supported by xindy)
+-- -- xindystyle = "lwarp.xdy" (or a custom file based on lwarp.xdy)
+-- glossarycmd = "makeglossaries"
+-- pdftotextenc = "UTF-8"  (use an encoding supported by pdftotext)
+-- --
+-- Filenames must contain only letters, numbers, underscore, or dash.
+-- Values must be in upright "quotes".
 --
--- Print the format of the configuration file lwarpmk.conf:
---
-print ( [[
-An example lwarpmk.conf or <project>.lwarpmkconf project file:
---
-opsystem = "Unix"   (or "Windows")
-latexname = "pdflatex"  (or "lualatex", or "xelatex")
-sourcename = "projectname"  (the source-code filename w/o .tex)
-homehtmlfilename = "index"  (or perhaps the project name)
-htmlfilename = ""  (or "projectname" - filename prefix)
-latexmk = "false"  (or "true" to use latexmk to build PDFs)
-shellescape = "false"
-xindylanguge = "english"  (use a language supported by xindy)
-xindycodepage = "utf8"  (use a codepage supported by xindy)
-xindystyle = "lwarp.xdy" (or a custom file based on lwarp.xdy)
-pdftotextenc = "UTF-8"  (use an encoding supported by pdftotext)
---
-Filenames must contain only letters, numbers, underscore, or dash.
-Values must be in upright "quotes".
+-- ]] ) ;
+-- end
 
-]] ) ;
-end
-
 function splitfile (destfile,sourcefile)
 --
 -- Split one large sourcefile into a number of files,
@@ -3322,7 +3414,7 @@
         "\" in lwarpmk.conf.\n"
     ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
     os.exit(1) ;
 end
 
@@ -3332,16 +3424,31 @@
 --
 -- Default configuration filename:
 local conffile = "lwarpmk.conf"
+local confroot = "lwarpmk"
+-- Global argument index
+argindex = 2
 -- Optional configuration filename:
-if ( arg[2] ~= nil ) then conffile = arg[2]..".lwarpmkconf" end
+if ( arg[argindex] == "-p" ) then
+    argindex = argindex + 1
+    confroot = arg[argindex]
+    conffile = confroot..".lwarpmkconf"
+    argindex = argindex + 1
+end
 -- Additional defaults:
 opsystem = "Unix"
 latexmk = "false"
 shellescape = "false"
-xindylanguage = "english"
-xindycodepage = "utf8"
-xindystyle = "lwarp.xdy"
-pdftotextenc = "UTF-8"
+printindexcmd = ""
+HTMLindexcmd = ""
+latexmkindexcmd = ""
+-- to be removed:
+-- indexprog = "makeindex"
+-- makeindexstyle = "lwarp.ist"
+-- xindylanguage = "english"
+-- xindycodepage = "utf8"
+-- xindystyle = "lwarp.xdy"
+-- pdftotextenc = "UTF-8"
+glossarycmd = "makeglossaries"
 -- Verify the file exists:
 if (lfs.attributes(conffile,"mode")==nil) then
     -- file not exists
@@ -3350,9 +3457,9 @@
     print ("lwarpmk: Move to the project's source directory,")
     print ("lwarpmk: recompile using pdflatex, xelatex, or lualatex,")
     print ("lwarpmk: then try using lwarpmk again.")
-    if ( arg[2] ~= nil ) then
+    if ( arg[argindex] ~= nil ) then
         print (
-            "lwarpmk: (\"" .. arg[2] ..
+            "lwarpmk: (\"" .. confroot ..
             "\" does not appear to be a project name.)"
         )
     end
@@ -3367,7 +3474,7 @@
 local linenum = 0
 for line in cfile:lines() do -- scan lines
 linenum = linenum + 1
-i,j,cvarname,cvalue = string.find (line,"([%w-_]*)%s*=%s*\"([%w%-_%.]*)\"") ;
+i,j,cvarname,cvalue = string.find (line,"([%w-_]*)%s*=%s*\"([^\"]*)\"") ;
 -- Error if incorrect enclosing characters:
 if ( i == nil ) then
     print ("lwarpmk: ===")
@@ -3374,7 +3481,7 @@
     print ("lwarpmk: " ..  linenum .. " : " .. line ) ;
     print ("lwarpmk: Incorrect entry in " .. conffile ..".\n" ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
     os.exit(1) ;
 end -- nil
 if ( cvarname == "opsystem" ) then
@@ -3400,9 +3507,25 @@
 elseif ( cvarname == "htmlfilename" ) then htmlfilename = cvalue
 elseif ( cvarname == "latexmk" ) then latexmk = cvalue
 elseif ( cvarname == "shellescape" ) then shellescape = cvalue
-elseif ( cvarname == "xindylanguage" ) then xindylanguage = cvalue
-elseif ( cvarname == "xindycodepage" ) then xindycodepage = cvalue
-elseif ( cvarname == "xindystyle" ) then xindystyle = cvalue
+elseif ( cvarname == "printindexcmd" ) then printindexcmd = cvalue
+elseif ( cvarname == "HTMLindexcmd" ) then HTMLindexcmd = cvalue
+elseif ( cvarname == "latexmkindexcmd" ) then latexmkindexcmd = cvalue
+elseif ( cvarname == "glossarycmd" ) then glossarycmd = cvalue
+-- to be removed:
+-- elseif ( cvarname == "indexprog" ) then
+--     -- Verify choice of indexing program:
+--     if (
+--         (cvalue == "makeindex") or
+--         (cvalue == "xindy")
+--     ) then
+--         indexprog = cvalue
+--     else
+--         cvalueerror ( line, linenum , cvalue )
+--     end
+-- elseif ( cvarname == "makeindexstyle" ) then makeindexstyle = cvalue
+-- elseif ( cvarname == "xindylanguage" ) then xindylanguage = cvalue
+-- elseif ( cvarname == "xindycodepage" ) then xindycodepage = cvalue
+-- elseif ( cvarname == "xindystyle" ) then xindystyle = cvalue
 elseif ( cvarname == "pdftotextenc" ) then pdftotextenc = cvalue
 else
     print ("lwarpmk: ===")
@@ -3412,7 +3535,7 @@
         conffile ..".\n"
     ) ;
     print ("lwarpmk: ===")
-    printconf () ;
+--    printconf () ;
 os.exit(1) ;
 end -- cvarname
 end -- do scan lines
@@ -3460,15 +3583,6 @@
 else print ( "lwarpmk: Select Unix or Windows for opsystem" )
 end --- for Windows
 
--- set xindycmd, glossarycmd according to pdflatex vs xelatex/lualatex:
-if ( latexname == "pdflatex" ) then
-    xindycmd = "texindy  "
-    glossarycmd = "xindy  "
-else
-    xindycmd = "xindy  -M texindy  "
-    glossarycmd = "xindy "
-end
-
 end -- loadconf
 
 function executecheckerror ( executecommands , errormessage )
@@ -3573,8 +3687,8 @@
     sourcename ..".toc " .. sourcename .. "_html.toc " ..
     sourcename ..".lof " .. sourcename .. "_html.lof " ..
     sourcename ..".lot " .. sourcename .. "_html.lot " ..
-    sourcename ..".idx " .. sourcename .. "_html.idx " ..
-    sourcename ..".ind " .. sourcename .. "_html.ind " ..
+    " *.idx " ..
+    " *.ind " ..
     sourcename ..".log " .. sourcename .. "_html.log " ..
     sourcename ..".gl* " .. sourcename .. "_html.gl* " ..
     " *_html_inc.* "
@@ -3819,10 +3933,8 @@
     .. "-e "
     .. opquote
     .. "$makeindex = q/" -- $
-    .. xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -C " .. xindycodepage
-    .. "  -L " .. xindylanguage .. " /"
+    .. latexmkindexcmd
+    .. " /"
     .. opquote
     .. " -pdflatex=\"" .. latexname .. thisshellescape .." %O %S\" "
     .. sourcename..fsuffix ..".tex"
@@ -3834,10 +3946,10 @@
 function convertpdftosvg ()
 --
 -- Converts PDF files to SVG files.
--- The filenames are arg[2] and up.
+-- The filenames are arg[argindex] and up.
 -- arg[1] is the command "pdftosvg".
 --
-for i = 2 , #arg do
+for i = argindex , #arg do
     if (lfs.attributes(arg[i],"mode")==nil) then
         print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.")
     else
@@ -3847,6 +3959,14 @@
 end -- do
 end --function
 
+-- Force an update and conclude processing:
+function updateanddone ()
+print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
+refreshdate ()
+print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
+print ("lwarpmk: Done.")
+end -- function
+
 -- Start of the main code: --
 
 -- lwarpmk --version :
@@ -3893,25 +4013,17 @@
     onetime("")
     print ("lwarpmk: Done.") ;
 
--- lwarp printindex:
+-- lwarpmk printindex:
 -- Compile the index then touch the source
 -- to trigger a recompile of the document:
 
 elseif arg[1] == "printindex" then
 loadconf ()
-print ("lwarpmk: Processing the index.")
-os.execute(
-    xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -C " .. xindycodepage
-    .. "  -L " .. xindylanguage
-    .. " " .. sourcename .. ".idx")
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute ( printindexcmd )
+print ("lwarpmk: -------")
+updateanddone ()
 
--- lwarp printglossary:
+-- lwarpmk printglossary:
 -- Compile the glossary then touch the source
 -- to trigger a recompile of the document:
 
@@ -3919,16 +4031,8 @@
 loadconf ()
 print ("lwarpmk: Processing the glossary.")
 
-os.execute(glossarycmd ..
-    "  -L " .. xindylanguage ..
-    "  -C " .. xindycodepage ..
-    "  -I xindy -M " .. sourcename ..
-    " -t " .. sourcename .. ".glg -o " .. sourcename .. ".gls "
-    .. sourcename .. ".glo")
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute(glossarycmd .. " " .. sourcename)
+updateanddone ()
 
 -- lwarpmk html:
 
@@ -3977,39 +4081,21 @@
 
 elseif arg[1] == "htmlindex" then
 loadconf ()
-print ("lwarpmk: Processing the index.")
-os.execute(
-    xindycmd
-    .. "  -M " .. xindystyle
-    .. "  -L " .. xindylanguage
-    .. "  -C " .. xindycodepage
-    .. " " .. sourcename .. "_html.idx"
-)
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+os.execute ( HTMLindexcmd )
+print ("lwarpmk: -------")
+updateanddone ()
 
 -- lwarpmk htmlglossary:
 -- Compile the glossary then touch the source
--- to trigger a recompile of the document:
+-- to trigger a recompile of the document.
+-- The <sourcename>.xdy file is created by the glossaries package.
 
 elseif arg[1] == "htmlglossary" then
 loadconf ()
 print ("lwarpmk: Processing the glossary.")
+os.execute(glossarycmd .. " " .. sourcename .. "_html")
+updateanddone ()
 
-os.execute(glossarycmd ..
-    "  -L " .. xindylanguage ..
-    "  -C " .. xindycodepage ..
-    "  -I xindy -M " ..sourcename ..
-    "_html -t " .. sourcename .. "_html.glg -o " ..sourcename ..
-    "_html.gls " ..sourcename .. "_html.glo")
-
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
-
 -- lwarpmk limages:
 -- Scan the lateximages.txt file to create lateximages.
 
@@ -4024,13 +4110,10 @@
 
 elseif arg[1] == "again" then
 loadconf ()
-print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.")
-refreshdate ()
-print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.")
-print ("lwarpmk: Done.")
+updateanddone ()
 
 -- lwarpmk clean:
--- Remove project.aux, .toc, .lof, .lot, .idx, .ind, .log, *_html_inc.*, .gl*
+-- Remove project.aux, .toc, .lof, .lot, .log, *.idx, *.ind, *_html_inc.*, .gl*
 
 elseif arg[1] == "clean" then
 loadconf ()
@@ -4038,7 +4121,7 @@
 print ("lwarpmk: Done.")
 
 -- lwarpmk cleanall
--- Remove project.aux, .toc, .lof, .lot, .idx, .ind, .log, *_html_inc.*, .gl*
+-- Remove project.aux, .toc, .lof, .lot, .log, *.idx, *.ind, *_html_inc.*, .gl*
 --    and also project.pdf, *.html
 
 elseif arg[1] == "cleanall" then
@@ -4197,7 +4280,7 @@
 {\csdef{#1#2}{}}%
 {\expandafter\edef\csname #1#2\endcsname{\expandonce#3}}%
 }
-\newcommand*{\LWR at getexparray}[2]{\csuse{#1#2}}
+\newcommand*{\LWR at getexparray}[2]{\@nameuse{#1#2}}
 
 \end{warpHTML}
 
@@ -5410,15 +5493,15 @@
 \ifthenelse{%
     \(%
         \(\NOT\equal{#1}{\BooleanTrue}\)\OR%
-        \(\cnttest{\csuse{LWR at depth#4}}{=}{\LWR at depthpart}\)\OR%
+        \(\cnttest{\@nameuse{LWR at depth#4}}{=}{\LWR at depthpart}\)\OR%
         \(\boolean{LWR at forcinghtmlpage}\)%
     \)%
     \AND%
-    \cnttest{\csuse{LWR at depth#4}}{<=}{\value{FileDepth}}%
+    \cnttest{\@nameuse{LWR at depth#4}}{<=}{\value{FileDepth}}%
     \AND%
     \(%
         \NOT\boolean{CombineHigherDepths}\OR%
-        \cnttest{\csuse{LWR at depth#4}}{<=}{\value{LWR at prevFileDepth}}%
+        \cnttest{\@nameuse{LWR at depth#4}}{<=}{\value{LWR at prevFileDepth}}%
     \)%
     \AND%
     \(% phantomsection
@@ -5457,12 +5540,12 @@
 }{}%
 
 \ifthenelse{%
-    \cnttest{\csuse{LWR at depth#4}}{>=}{\LWR at depthparagraph}%
+    \cnttest{\@nameuse{LWR at depth#4}}{>=}{\LWR at depthparagraph}%
 }%
 {\LWR at startpars}%
 {}%
 \LWR at traceinfo{LWR at section: about to LWR at createautosec}%
-\LWR at createautosec{\csuse{LWR at tag#4}}%
+\LWR at createautosec{\@nameuse{LWR at tag#4}}%
 \setcounter{LWR at currentautosec}{\value{page}}
 \IfBooleanTF{#1}%
 {%
@@ -5473,7 +5556,7 @@
 }% starred
 {% not starred
     \ifthenelse{%
-        \cnttest{\csuse{LWR at depth#4}}{<=}{\value{secnumdepth}}%
+        \cnttest{\@nameuse{LWR at depth#4}}{<=}{\value{secnumdepth}}%
     }%
     {% if secnumdepth
         \LWR at traceinfo{LWR at section: about to test main matter}%
@@ -5484,7 +5567,7 @@
             \LWR at traceinfo{LWR at section: about to addcontentsline}%
             \addcontentsline{toc}{#4}%
             {%
-                 \protect\numberline{\csuse{the#4}}%
+                 \protect\numberline{\@nameuse{the#4}}%
                 {\ignorespaces\IfValueTF{#2}{#2}{#3}\protect\relax}%
             }%
             \LWR at traceinfo{LWR at section: finished addcontentsline}%
@@ -5500,15 +5583,15 @@
     \ifbool{LWR at mainmatter}%
     {%
         \ifthenelse{%
-            \(\cnttest{\csuse{LWR at depth#4}}{<=}%
+            \(\cnttest{\@nameuse{LWR at depth#4}}{<=}%
                 {\value{secnumdepth}}\) \AND%
-            \(\cnttest{\csuse{LWR at depth#4}}{<=}{\LWR at depthpart}\)%
+            \(\cnttest{\@nameuse{LWR at depth#4}}{<=}{\LWR at depthpart}\)%
         }%
-        {\csuse{#4name}~{}}%
+        {\@nameuse{#4name}~{}}%
         {}%
         \LWR at traceinfo{LWR at section: about to print section number}%
         \ifthenelse{%
-            \cnttest{\csuse{LWR at depth#4}}{<=}{\value{secnumdepth}}%
+            \cnttest{\@nameuse{LWR at depth#4}}{<=}{\value{secnumdepth}}%
         }%
         {%
             \ifstrequal{#4}{chapter}%
@@ -5522,20 +5605,20 @@
 \LWR at traceinfo{LWR at section: about to print the section name}%
 #3%
 \LWR at traceinfo{LWR at section: about to close the heading tag}%
-\LWR at htmltag{\csuse{LWR at tag#4end}}%
+\LWR at htmltag{\@nameuse{LWR at tag#4end}}%
 \LWR at traceinfo{LWR at section: about to create the LaTeX label}%
 \LWR at newautopagelabel{LWR at currentautosec}%
 \ifthenelse{%
-    \cnttest{\csuse{LWR at depth#4}}{<}{\LWR at depthparagraph}%
+    \cnttest{\@nameuse{LWR at depth#4}}{<}{\LWR at depthparagraph}%
 }%
 {\LWR at startpars}%
 {}%
 \ifthenelse{%
     \NOT\equal{#1}{\BooleanTrue}\OR%
-    \cnttest{\csuse{LWR at depth#4}}{=}{\LWR at depthpart}%
+    \cnttest{\@nameuse{LWR at depth#4}}{=}{\LWR at depthpart}%
 }%
 {% not starred
-    \setcounter{LWR at prevFileDepth}{\csuse{LWR at depth#4}}%
+    \setcounter{LWR at prevFileDepth}{\@nameuse{LWR at depth#4}}%
 }% not starred
 {}%
 \ifstrempty{#3}%
@@ -5725,8 +5808,8 @@
 \LWR at origonecolumn%
 \LWR at origpagestyle{empty}%
 \overfullrule=0pt
-\LWR at origscriptsize%
-\LWR at origraggedright%
+\LWR at print@scriptsize%
+\LWR at print@raggedright%
 \LetLtxMacro{\\}{\LWR at endofline}%
 \linespread{1.3}%
 \setlength{\parindent}{0pt}
@@ -5782,8 +5865,8 @@
 \newcommand*{\LWR at requesttoc}[2]{%
 \ifbool{#1}
 {
-    \expandafter\newwrite\csuse{tf@#2}
-    \immediate\openout \csuse{tf@#2} \jobname.#2\relax
+    \expandafter\newwrite\@nameuse{tf@#2}
+    \immediate\openout \@nameuse{tf@#2} \jobname.#2\relax
 }{}
 }
 
@@ -6112,7 +6195,7 @@
 }{}%
 \begingroup%
 \LWR at origttfamily%
-\LWR at origsmall%
+\LWR at print@small%
 \LWR at restoreoriglists%
 \LWR at FBcancel%
 \LWR at select@print at hspace%
@@ -6148,26 +6231,20 @@
 }
 }
 
-\LetLtxMacro\LWR at origtabbing\tabbing
-\LetLtxMacro\LWR at origendtabbing\endtabbing
-
-\renewcommand*{\tabbing}{%
+\newcommand*{\LWR at HTML@tabbing}{%
 \LWR at forcenewpage%
 \LWR at atbeginverbatim{3}{tabbing}%
-\LWR at origtabbing%
+\LWR at print@tabbing%
 }
 
-\renewcommand*{\endtabbing}{%
-    \LWR at origendtabbing%
+\newcommand*{\LWR at HTML@endtabbing}{%
+    \LWR at print@endtabbing%
     \LWR at afterendverbatim{1}%
 }
-\AtBeginDocument{
-\appto\LWR at restoreorigformatting{%
-\LetLtxMacro\tabbing\LWR at origtabbing%
-\LetLtxMacro\endtabbing\LWR at origendtabbing%
-}
-}
 
+\LWR at formatted{tabbing}
+\LWR at formatted{endtabbing}
+
 \end{warpHTML}
 
 
@@ -7578,12 +7655,12 @@
         {%
             \refstepcounter{\LTcaptype}%
             \protected at edef\@currentlabel{%
-                \csuse{p@\LTcaptype}\csuse{the\LTcaptype}%
+                \@nameuse{p@\LTcaptype}\@nameuse{the\LTcaptype}%
             }%
         }%
     }{}%
     \LWR at figcaption%
-    \csuse{fnum@\LTcaptype}\CaptionSeparator#3%
+    \@nameuse{fnum@\LTcaptype}\CaptionSeparator#3%
     \endLWR at figcaption%
     \ifblank{#2}% TOC entry empty
     {}%
@@ -7591,21 +7668,21 @@
         \IfNoValueTF{#2}% No TOC entry?
         {% No TOC entry
             \addcontentsline%
-            {\csuse{ext@\LTcaptype}}%
+            {\@nameuse{ext@\LTcaptype}}%
             {\LTcaptype}%
             {%
             \protect\numberline%
-            {\csuse{p@\LTcaptype}\csuse{the\LTcaptype}}%
+            {\@nameuse{p@\LTcaptype}\@nameuse{the\LTcaptype}}%
             {\ignorespaces #3\protect\relax}%
             }%
         }% end of No TOC entry
         {% yes TOC entry
             \addcontentsline%
-            {\csuse{ext@\LTcaptype}}%
+            {\@nameuse{ext@\LTcaptype}}%
             {\LTcaptype}%
             {%
             \protect\numberline%
-            {\csuse{p@\LTcaptype}\csuse{the\LTcaptype}}%
+            {\@nameuse{p@\LTcaptype}\@nameuse{the\LTcaptype}}%
             {\ignorespaces #2\protect\relax}%
             }%
         }% end of yes TOC entry
@@ -7694,6 +7771,10 @@
 \end{warpall}
 \begin{warpHTML}
 \newcommand*{\LWR at donothing}{}
+\let\firsthline\relax
+\let\lasthline\relax
+\newcommand*{\firsthline}{}
+\newcommand*{\lasthline}{}
 \newcommand*{\ldelim}{}
 \newcommand*{\rdelim}{}
 
@@ -7817,6 +7898,14 @@
 
 
 \begin{warpHTML}
+\LetLtxMacro\toprule\relax
+\LetLtxMacro\midrule\relax
+\LetLtxMacro\cmidrule\cline
+\LetLtxMacro\bottomrule\relax
+\LetLtxMacro\addlinespace\relax
+\LetLtxMacro\morecmidrules\relax
+\LetLtxMacro\specialrule\relax
+
 \newcommand*{\toprule}[1][]{\hline}
 \newcommand*{\midrule}[1][]{\hline}
 \LetLtxMacro\cmidrule\cline
@@ -8055,16 +8144,16 @@
     }% pars not allowed
 }% not lateximage
 }
-\NewDocumentCommand{\LWR at newlabel}{d() m o}{%
-\LWR at traceinfo{LWR at newlabel: starting}%
-\LWR at traceinfo{LWR at newlabel: !#2!}%
-\LWR at origlabel{#2}%
-\LWR at traceinfo{LWR at newlabel: filesectionnames is \ifbool{FileSectionNames}{true}{false}}%
-\LWR at traceinfo{LWR at newlabel: LWR at thisfilename is !\LWR at thisfilename!}%
-\LWR at traceinfo{LWR at newlabel: LWR at htmlfilenumber is \arabic{LWR at htmlfilenumber}}%
+\NewDocumentCommand{\LWR at new@label}{d() m o}{%
+\LWR at traceinfo{LWR at new@label: starting}%
+\LWR at traceinfo{LWR at new@label: !#2!}%
+\LWR at orig@label{#2}%
+\LWR at traceinfo{LWR at new@label: filesectionnames is \ifbool{FileSectionNames}{true}{false}}%
+\LWR at traceinfo{LWR at new@label: LWR at thisfilename is !\LWR at thisfilename!}%
+\LWR at traceinfo{LWR at new@label: LWR at htmlfilenumber is \arabic{LWR at htmlfilenumber}}%
 \LWR at splabel{#2}%
 \LWR at sublabel{#2}%
-\LWR at traceinfo{LWR at newlabel: done}%
+\LWR at traceinfo{LWR at new@label: done}%
 }
 
 
@@ -8104,24 +8193,26 @@
 \NewDocumentCommand{\LWR at subnewref}{m m}{%
 \LWR at traceinfo{LWR at subnewref #1 #2}%
 \LWR at startref{#1}%
-\LWR at origref{#2}%
+\LWR at print@ref{#2}%
 \LWR at htmltag{/a}%
 }
 
-\NewDocumentCommand{\LWR at newref}{s m}{%
-\LWR at traceinfo{LWR at newref !#2!}%
+\NewDocumentCommand{\LWR at HTML@ref}{s m}{%
+\LWR at traceinfo{LWR at HTML@ref !#2!}%
 \IfBooleanTF{#1}%
-{\LWR at origref{#2}}%
+{\LWR at print@ref{#2}}%
 {\LWR at subnewref{#2}{#2}}%
 }
+
+\LWR at formatted{ref}
 \NewDocumentCommand{\LWR at ref@ignorestar}{s m}{%
-    \LWR at origref{#2}%
+    \LWR at print@ref{#2}%
 }
 
 \newcommand*{\pagerefPageFor}{see }
-\NewDocumentCommand{\LWR at newpageref}{s m}{%
+\NewDocumentCommand{\LWR at new@pageref}{s m}{%
 \IfBooleanTF{#1}%
-{(\pagerefPageFor\LWR at origref{#2})}%
+{(\pagerefPageFor\LWR at print@ref{#2})}%
 {(\cpageref{#2})}%
 }
 
@@ -8247,10 +8338,10 @@
 \addtocounter{LWR at thisautoid}{1}%
 \booltrue{LWR at freezethisautoid}%
 \begingroup%
-\LWR at origraggedright%
+\LWR at print@raggedright%
 \LWR at htmltag{%
     figure id="\LWR at print@mbox{autoid-\arabic{LWR at thisautoid}}" % space
-    class="#1 \csuse{LWR at floatstyle@#1}"%
+    class="#1 \@nameuse{LWR at floatstyle@#1}"%
 }%
 \ifbool{FormatWP}{%
     \LWR at orignewline%
@@ -8332,7 +8423,7 @@
 }
 
 \newcommand*{\LWR at endfloatalignment}{%
-\ifdefvoid{\LWR at floatalignmentname}{}{\csuse{end\LWR at floatalignmentname}}%
+\ifdefvoid{\LWR at floatalignmentname}{}{\@nameuse{end\LWR at floatalignmentname}}%
 \renewcommand*{\LWR at floatalignmentname}{}%
 }
 
@@ -8373,37 +8464,31 @@
 \LWR at htmlblocktag{/figcaption}%
 \LWR at traceinfo{LWR at figcaption env end: done}%
 }
-
-\AtBeginDocument{
-\LetLtxMacro\LWR at origcaption@begin\caption at begin
-\LetLtxMacro\LWR at origcaption@end\caption at end
-}
-
-\newcommand{\LWR at caption@begin}[1]
+\newcommand*{\LWR at HTML@caption at begin}[1]
 {
-\LWR at traceinfo{LWR at caption@begin}%
+\LWR at traceinfo{LWR at HTML@caption at begin}%
 \begingroup%
 \@setpar{\LWR at closeparagraph\@@par}%
 \RenewDocumentEnvironment{minipage}{O{t} o O{t} m}{}{}%
 \RenewDocumentCommand{\parbox}{O{t} o O{t} m +m}{##5}%
 \LWR at figcaption%
-\LWR at traceinfo{LWR at caption@begin: about to LWR at origcaption@begin}%
-\LWR at origcaption@begin{#1}%
-\LWR at traceinfo{LWR at caption@begin: done}%
+\LWR at traceinfo{LWR at HTML@caption at begin: about to LWR at origcaption@begin}%
+\LWR at print@caption at begin{#1}%
+\LWR at traceinfo{LWR at HTML@caption at begin: done}%
 }
 
-\newcommand{\LWR at caption@end}
+\newcommand*{\LWR at HTML@caption at end}
 {%
-\LWR at traceinfo{LWR at caption@end}%
-\LWR at origcaption@end%
+\LWR at traceinfo{LWR at HTML@caption at end}%
+\LWR at print@caption at end%
 \endLWR at figcaption%
 \endgroup%
-\LWR at traceinfo{LWR at caption@end: done}%
+\LWR at traceinfo{LWR at HTML@caption at end: done}%
 }
 
 \AtBeginDocument{
-\let\caption at begin\LWR at caption@begin
-\let\caption at end\LWR at caption@end
+\LWR at formatted{caption at begin}
+\LWR at formatted{caption at end}
 }
 
 \let\LWR at origcaptionlistentry\captionlistentry
@@ -8538,12 +8623,12 @@
 
 \NewDocumentCommand{\listof}{m +m}{%
 \@ifundefined{l@#1}{%
-    \csdef{l@#1}[2]{\hypertocfloat{1}{#1}{\csuse{ext@#1}}{##1}{##2}}%
+    \csdef{l@#1}[2]{\hypertocfloat{1}{#1}{\@nameuse{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
-    \jobname.\csuse{ext@#1}\relax
+    \jobname.\@nameuse{ext@#1}\relax
 }
 
 
@@ -8659,28 +8744,22 @@
 \newcounter{LWR at autoglossary}
 \setcounter{LWR at autoglossary}{0}
 
-\let\LWR at origprintindex\printindex
-
-\renewcommand*{\printindex}
-{
-\LWR at startpars
-\LWR at origprintindex
-}
-
 \@ifundefined{chapter}
 {\newcommand*{\LWR at indexsection}[1]{\section*{#1}}}
 {\newcommand*{\LWR at indexsection}[1]{\chapter*{#1}}}
 
+\AtBeginDocument{
 \renewenvironment*{theindex}{%
-\LWR at indexsection{\indexname}%
-\let\item\LWR at indexitem%
-\let\subitem\LWR at indexsubitem%
-\let\subsubitem\LWR at indexsubsubitem%
+    \LWR at indexsection{\indexname}%
+    \let\item\LWR at indexitem%
+    \let\subitem\LWR at indexsubitem%
+    \let\subsubitem\LWR at indexsubsubitem%
 }{}
+}% AtBeginDocument
 
-\newcommand{\LWR at indexitem}{
+\newcommand{\LWR at indexitem}[1][\@empty]{
 
-\InlineClass{indexitem}{}
+\InlineClass{indexitem}{}#1%
 }
 
 \newcommand{\LWR at indexsubitem}{
@@ -8695,24 +8774,55 @@
 
 \def\LWR at wrindex#1{%
 \addtocounter{LWR at autoindex}{1}%
-\LWR at newlabel{LWRindex-\arabic{LWR at autoindex}}%
+\LWR at new@label{LWRindex-\arabic{LWR at autoindex}}%
 \protected at write\@indexfile{}%
 {\string\indexentry{#1}{\arabic{LWR at autoindex}}}%
 \endgroup
 \@esphack}
 
+\AtBeginDocument{
 \let\@wrindex\LWR at wrindex
+}
 
 \def\@wrglossary#1{%
 \addtocounter{LWR at autoglossary}{1}%
-\LWR at newlabel{LWRglossary-\theLWR at autoglossary}%
+\LWR at new@label{LWRglossary-\theLWR at autoglossary}%
 \protected at write\@glossaryfile{}%
 {\string\glossaryentry{#1}{\theLWR at autoglossary}}%
 \endgroup
 \@esphack}
 
-\newcommand*{\hyperindexref}[1]{\nameref{LWRindex-#1}}
+\newcommand*{\LWR at indexnameref}[1]{\nameref{LWRindex-#1}}
 
+\newrobustcmd{\LWR at doindexentry}[1]{%
+\IfInteger{#1}%
+    {\LWR at indexnameref{#1}}%
+    {#1}%
+}
+
+\newcommand{\LWR at hyperindexrefnullified}{%
+\renewcommand{\emph}[1]{\LWR at HTMLemph{\LWR at doindexentry{##1}}}%
+\renewcommand{\textbf}[1]{\LWR at HTMLtextbf{\LWR at doindexentry{##1}}}%
+\renewcommand{\textrm}[1]{\LWR at HTMLtextrm{\LWR at doindexentry{##1}}}%
+\renewcommand{\textsf}[1]{\LWR at HTMLtextsf{\LWR at doindexentry{##1}}}%
+\renewcommand{\texttt}[1]{\LWR at HTMLtexttt{\LWR at doindexentry{##1}}}%
+\renewcommand{\textup}[1]{\LWR at HTMLtextup{\LWR at doindexentry{##1}}}%
+\renewcommand{\textsc}[1]{\LWR at HTMLtextsc{\LWR at doindexentry{##1}}}%
+\renewcommand{\textit}[1]{\LWR at HTMLtextit{\LWR at doindexentry{##1}}}%
+\renewcommand{\textsl}[1]{\LWR at HTMLtextsl{\LWR at doindexentry{##1}}}%
+}
+
+\newcommand{\hyperindexref}[1]{%
+\IfInteger{#1}%
+    {\LWR at indexnameref{#1}}%
+    {%
+        \begingroup%
+        \LWR at hyperindexrefnullified
+        #1%
+        \endgroup%
+    }%
+}
+
 \end{warpHTML}
 
 \begin{warpprint}
@@ -8760,32 +8870,13 @@
 \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
-\let\normalsize\LWR at orignormalsize%
-\let\small\LWR at origsmall%
-\let\footnotesize\LWR at origfootnotesize%
-\let\scriptsize\LWR at origscriptsize%
-\let\tiny\LWR at origtiny%
-\let\large\LWR at origlarge%
-\let\Large\LWR at origLarge%
-\let\LARGE\LWR at origLARGE%
-\let\huge\LWR at orighuge%
-\let\Huge\LWR at origHuge%
 \LWR at select@print at hspace%
-\LetLtxMacro\hfill\LWR at orighfill%
 \LetLtxMacro\hfil\LWR at orighfil%
-\LetLtxMacro\hrulefill\LWR at orighrulefill%
-\LetLtxMacro\dotfill\LWR at origdotfill%
 \let\hss\LWR at orighss%
 \let\llap\LWR at origllap%
 \let\rlap\LWR at origrlap%
 \let\hfilneg\LWR at orighfilneg%
-\let\raggedright\LWR at origraggedright%
-\let\raggedleft\LWR at origraggedleft%
-\let\centering\LWR at origcentering%
 \let\,\LWR at origcomma% disable HTML short unbreakable space
 \let\thinspace\LWR at origthinspace% disable HTML short unbreakable space
 \let\textellipsis\LWR at origtextellipsis%
@@ -8927,13 +9018,13 @@
     \begingroup%
     \LWR at restoreorigformatting%
     \RenewDocumentEnvironment{lateximage}{s o o o}{}{}% inside group
-    \LWR at orignormalsize%
+    \LWR at print@normalsize%
     \LWR at traceinfo{Using font family \LWR at f@family}%
-    \csuse{LWR at orig\LWR at f@family family}%
+    \@nameuse{LWR at orig\LWR at f@family family}%
     \LWR at traceinfo{Using font series \LWR at f@series}%
-    \csuse{LWR at orig\LWR at f@series series}%
+    \@nameuse{LWR at orig\LWR at f@series series}%
     \LWR at traceinfo{Using font shape \LWR at f@shape}%
-    \csuse{LWR at orig\LWR at f@shape shape}%
+    \@nameuse{LWR at orig\LWR at f@shape shape}%
     \global\advance\c at LWR@lateximagedepth 1\relax%
     \ifmmode%
         \global\sbox{\LWR at singledollarbox}{#4}%
@@ -9205,10 +9296,10 @@
 \LWR at htmlopencomment
 
 \begingroup
-\csuse{LWR at orig#1}
+\@nameuse{LWR at orig#1}
 \LWR at restoreorigformatting
 #2
-\csuse{LWR at origend#1}
+\@nameuse{LWR at origend#1}
 \endgroup
 
 \LWR at htmlclosecomment
@@ -9255,11 +9346,11 @@
         \LWR at HTMLsanitizeexpand{\detokenize\expandafter{#1}} % extra space
         \textbackslash{end\{#2\}}%
     ]% alt tag
-    \csuse{LWR at orig#2}
+    \@nameuse{LWR at orig#2}%
     #1% contents collected by \collect at body
-    \csuse{LWR at origend#2}
+    \@nameuse{LWR at origend#2}%
     \end{lateximage}%
-    \end{BlockClass}
+    \end{BlockClass}%
 }% not mathjax
 }
 \newcommand*{\LWR at doendequation}[1]{%
@@ -9275,17 +9366,15 @@
 \csletcs{equation*}{relax}
 \csletcs{endequation*}{relax}
 
-\NewEnviron{equation}
-{
-\LWR at doequation{\BODY}{equation}
-}
+\NewEnviron{equation}%
+{\LWR at doequation{\BODY}{equation}}%
 [\LWR at doendequation{equation}]
 
 \LetLtxMacro\LWR at equationnormal\equation
 \LetLtxMacro\LWR at endequationnormal\endequation
 
-\NewEnviron{equation*}
-{\LWR at doequation{\BODY}{equation*}}
+\NewEnviron{equation*}%
+{\LWR at doequation{\BODY}{equation*}}%
 [\LWR at doendequation{equation*}]
 
 \csletcs{LWR at equationnormalstar}{equation*}
@@ -9338,8 +9427,8 @@
 \LWR at traceinfo{LWR at htmlmathlabelb #1}%
 \ifboolexpr{bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) }%
 {%
-    \text{
-    \ifbool{LWR at amsmultline}{}{\hspace*{\totwidth@}}
+    \text{%
+    \ifbool{LWR at amsmultline}{}{\hspace*{\totwidth@}}%
     \LWR at htmlclosecomment%
     \LWR at origltx@label{#1}%
     \LWR at htmlopencomment%
@@ -9878,7 +9967,7 @@
     \LWR at orignewpage%
     \LWR at traceinfo{lateximage: about to create minipage}%
     \LWR at print@minipage{6in}%
-    \csuse{LWR at orig\LateximageFontSizeName}%
+    \@nameuse{LWR at print@\LateximageFontSizeName}%
     \LWR at traceinfo{lateximage: about to temporarily restore formatting}%
     \LWR at restoreorigformatting%
     \def\@mpfn{footnote}%
@@ -9885,7 +9974,7 @@
     \def\thempfn{\thefootnote}%
     \LetLtxMacro\@footnotetext\LWR at footnotetext%
     \LWR at traceinfo{lateximage: about to create label}%
-    \LWR at origlabel{LWRlateximage\arabic{LWR at lateximagenumber}}%
+    \LWR at orig@label{LWRlateximage\arabic{LWR at lateximagenumber}}%
     \LWR at traceinfo{lateximage: finished creating the label}%
     \LetLtxMacro$\LWR at origdollar%
     \catcode`\$=3% math shift
@@ -9916,7 +10005,7 @@
 \LWR at traceinfo{lateximage: ending outer-most lateximage}%
     \endLWR at print@minipage%
     \LWR at orignewpage%
-    \LWR at origscriptsize%
+    \LWR at print@scriptsize%
     \LWR at print@vspace*{.5\baselineskip}%
     \LWR at htmlclosecomment%
     \LWR at traceinfo{lateximage: The page after the image is \arabic{page}}%
@@ -9987,23 +10076,26 @@
 {\endBlockClass}
 
 
-\renewcommand*{\centering}{%
+\newcommand*{\LWR at HTML@centering}{%
 \ifbool{HTMLDebugComments}{%
     \LWR at htmlcomment{centering}%
 }{}%
 }
+\LWR at formatted{centering}
 
-\renewcommand*{\raggedleft}{%
+\newcommand*{\LWR at HTML@raggedleft}{%
 \ifbool{HTMLDebugComments}{%
     \LWR at htmlcomment{raggedleft}%
 }{}%
 }
+\LWR at formatted{raggedleft}
 
-\renewcommand*{\raggedright}{%
+\newcommand*{\LWR at HTML@raggedright}{%
 \ifbool{HTMLDebugComments}{%
     \LWR at htmlcomment{raggedright}%
 }{}%
 }
+\LWR at formatted{raggedright}
 
 \renewcommand{\leftline}[1]{\begin{flushleft}#1\end{flushleft}}
 
@@ -10283,15 +10375,11 @@
 
 }% AfterEndPreamble
 
-\LetLtxMacro\LWR at origlabel\label
-\RenewDocumentCommand{\label}{}{\LWR at newlabel}
+\LetLtxMacro\LWR at orig@label\label
+\RenewDocumentCommand{\label}{}{\LWR at new@label}
 
-\LetLtxMacro\LWR at origref\ref
-\RenewDocumentCommand{\ref}{}{\LWR at newref}%
-
-\LetLtxMacro\LWR at origpageref\pageref
-\RenewDocumentCommand{\pageref}{}{\LWR at newpageref}
-
+\LetLtxMacro\LWR at orig@pageref\pageref
+\RenewDocumentCommand{\pageref}{}{\LWR at new@pageref}
 \end{warpHTML}
 
 
@@ -10373,7 +10461,7 @@
 \setlength{\linewidth}{#4}% the original width
 \setlength{\textwidth}{6in}%
 \setlength{\textheight}{9in}%
-\LWR at origraggedright%
+\LWR at print@raggedright%
 \def\@mpfn{mpfootnote}%
 \def\thempfn{\thempfootnote}\c at mpfootnote\z@%
 \let\@footnotetext\@mpfootnotetext%
@@ -10778,16 +10866,35 @@
 \renewrobustcmd*{~}{\HTMLentity{nbsp}}
 
 \renewrobustcmd*{\textellipsis}{\HTMLunicode{2026}}
-\renewrobustcmd*{\normalsize}{}
-\renewrobustcmd*{\small}{}
-\renewrobustcmd*{\footnotesize}{}
-\renewrobustcmd*{\scriptsize}{}
-\renewrobustcmd*{\tiny}{}
-\renewrobustcmd*{\large}{}
-\renewrobustcmd*{\Large}{}
-\renewrobustcmd*{\LARGE}{}
-\renewrobustcmd*{\huge}{}
-\renewrobustcmd*{\Huge}{}
+\newrobustcmd*{\LWR at HTML@normalsize}{}
+\LWR at formatted{normalsize}
+
+\newrobustcmd*{\LWR at HTML@small}{}
+\LWR at formatted{small}
+
+\newrobustcmd*{\LWR at HTML@footnotesize}{}
+\LWR at formatted{footnotesize}
+
+\newrobustcmd*{\LWR at HTML@scriptsize}{}
+\LWR at formatted{scriptsize}
+
+\newrobustcmd*{\LWR at HTML@tiny}{}
+\LWR at formatted{tiny}
+
+\newrobustcmd*{\LWR at HTML@large}{}
+\LWR at formatted{large}
+
+\newrobustcmd*{\LWR at HTML@Large}{}
+\LWR at formatted{Large}
+
+\newrobustcmd*{\LWR at HTML@LARGE}{}
+\LWR at formatted{LARGE}
+
+\newrobustcmd*{\LWR at HTML@huge}{}
+\LWR at formatted{huge}
+
+\newrobustcmd*{\LWR at HTML@Huge}{}
+\LWR at formatted{Huge}
 \DeclareDocumentCommand{\onecolumn}{}{}
 
 \DeclareDocumentCommand{\twocolumn}{O{}}{
@@ -10796,11 +10903,14 @@
 
 }
 
-\renewcommand*{\hfill}{\qquad}
+\newcommand*{\LWR at HTML@hfill}{\qquad}
+\LWR at formatted{hfill}
 
-\renewcommand*{\hrulefill}{\rule{1in}{1pt}}
+\newcommand*{\LWR at HTML@hrulefill}{\rule{1in}{1pt}}
+\LWR at formatted{hrulefill}
 
-\renewcommand*{\dotfill}{\dots}
+\newcommand*{\LWR at HTML@dotfill}{\dots}
+\LWR at formatted{dotfill}
 
 \renewcommand*{\newpage}{
 



More information about the tex-live-commits mailing list