summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/lwarp
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-03-25 21:28:55 +0000
committerKarl Berry <karl@freefriends.org>2018-03-25 21:28:55 +0000
commit67a0d74b3ba80ada1c0ae1e1b3fc523bd0136699 (patch)
tree8c0f3bd63b4f10cbc26da1e5e8fe305286e8aa63 /Master/texmf-dist/source/latex/lwarp
parentb0d484d66da70017e2f7617211629a579a3b6056 (diff)
lwarp (24mar18)
git-svn-id: svn://tug.org/texlive/trunk@47115 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/lwarp')
-rw-r--r--Master/texmf-dist/source/latex/lwarp/lwarp.dtx3882
-rw-r--r--Master/texmf-dist/source/latex/lwarp/lwarp.ins9
2 files changed, 3316 insertions, 575 deletions
diff --git a/Master/texmf-dist/source/latex/lwarp/lwarp.dtx b/Master/texmf-dist/source/latex/lwarp/lwarp.dtx
index 7d6037ecbe8..7ca53bf2b44 100644
--- a/Master/texmf-dist/source/latex/lwarp/lwarp.dtx
+++ b/Master/texmf-dist/source/latex/lwarp/lwarp.dtx
@@ -16,7 +16,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{lwarp}
-%<package> [2018/03/03 v0.50 Allows LaTeX to directly produce HTML5 output.]
+%<package> [2018/03/24 v0.51 Allows LaTeX to directly produce HTML5 output.]
%
%<*driver>
\documentclass{ltxdoc}
@@ -265,11 +265,11 @@ Keywords={LaTeX, HTML, conversion}%
\providerobustcmd*{\lmacro}[1]{\textbackslash#1}
-\providerobustcmd*{\cmds}[1]{\mbox{\texttt{#1}}}
+\providerobustcmd*{\cmds}[1]{\mbox{\texttt{\textbf{\textsl{#1}}}}}
\providerobustcmd*{\env}[1]{\mbox{\texttt{#1}}}
\providerobustcmd*{\ctr}[1]{\mbox{\texttt{#1}}}
-\providerobustcmd*{\pkg}[1]{\mbox{\textsf{#1}}}
-\providerobustcmd*{\prog}[1]{\mbox{\textsf{#1}}}
+\providerobustcmd*{\pkg}[1]{\mbox{\textbf{\textsf{#1}}}}
+\providerobustcmd*{\prog}[1]{\mbox{\textbf{\textsf{#1}}}}
\providerobustcmd*{\progcode}[1]{\mbox{\texttt{#1}}}
\providerobustcmd*{\optn}[1]{\mbox{\texttt{#1}}}
\providerobustcmd*{\filenm}[1]{\mbox{\texttt{#1}}}
@@ -381,6 +381,19 @@ Keywords={LaTeX, HTML, conversion}%
% The following text is used in multiple places in the documentation:
+\newcommand{\needhelp}{
+\begin{minipage}{\linewidth}
+\hrule\smallskip
+\small
+The index to this document contains several hundred
+custom entries.
+Also included are automated entries for each package, macro, environment,
+counter, boolean, and other objects; individually and also sorted by category.
+A \nameref{sec:troubleshooting} section is also available.
+\hrule
+\end{minipage}\margintag{Need help?}
+}
+
\newcommand{\usedbykomascript}{
This package may be loaded standalone, but
is also loaded automatically if \pkg{koma-script} classes are in use.
@@ -418,20 +431,6 @@ Green-colored tags in the left margin show which sections of source
code apply to the generation of \HTML, print, or both forms of output.
}
-\newcommand{\limitssectioningmath}{%
-When using \SVG\ math in sectioning commands, \watchout[math in \cs{section}]
-use \cs{(} and \cs{)} to delimit math
-instead of \$:
-\begin{sourcedisplay}
-\cs{section}\{Section name with math \cs{(}1+2=3\cs{)}\}
-\end{sourcedisplay}
-\index{section>math in heading}
-\index{math>in section heading}
-}
-
-\newcommand{\limitssectioning}{%
-\limitssectioningmath
-}
\newcommand{\limitscpageref}{\pkg{cleveref} and \pkg{varioref} are supported,
\watchout[\pkg{cleveref} page numbers]
@@ -832,7 +831,8 @@ exactly, in which case a label may be shifted by one space.
\newcommand{\limitslateximagefontsize}{%
-The size of the math and text used
+For the \env{lateximage} environment,
+the size of the math and text used
\margintag{SVG image font size}
in the \SVG\ image may be adjusted
\index{font>size --- lateximage}%
@@ -844,6 +844,29 @@ by setting \cs{LateximageFontSizeName} to a font size name --- \emph{without the
}
+\newcommand*{\describedisplaymathother}{
+\DescribeMacro{\displaymathnormal}
+By default, or when selecting \cs{displaymathnormal},
+math display environments print their contents in \brand{Mathjax},
+and render their contents in \SVG\ math as well as
+use their contents in the \attribute{alt} tag of \HTML\ output.
+To do so, the contents are loaded into a macro for reuse.
+In some cases, such as complicated \tikz\ pictures, compilation will fail.
+
+\DescribeMacro{\displaymathother}
+When selecting \cs{displaymathother},
+it is assumed that the contents are more complicated than ``pure''
+math.
+An example is an elaborate \tikz\ picture, which will not render in \brand{MathJax} and
+will not make sense as an \HTML\ \attribute{alt} tag.
+In this mode, \brand{MathJax} is turned off,
+math display environments become \SVG\ images, even for
+\brand{MathJax}, and the \HTML\ \attribute{alt} tags become simple messages.
+The contents are internally processed as an environment instead of a macro argument,
+so complicated objects such as \tikz\ pictures are more likely to compile successfully.
+}
+
+
\newcommand{\limitsmath}{%
\subsubsection{Rendering tradeoffs}
@@ -999,6 +1022,20 @@ Limitations when using \brand{MathJax} include:
\end{itemize}
}
+\newcommand{\limitschemformula}{%
+\pkg{chemformula} works best without \brand{MathJax}.
+\watchout[\pkg{chemformula} with \brand{MathJax}]
+If \brand{MathJax} is used,
+\cs{displaymathother} must be used before \env{array}, and then
+\cs{displaymathnormal} may be used after.
+(The \pkg{chemformula} package adapts to \env{array},
+but does not know about \brand{Mathjax}, and
+\brand{MathJax} does not know about \pkg{chemformula}.)
+
+While using \brand{Mathjax}, \cs{displaymathother} may also be used
+for other forms of display and inline math which contain \pkg{chemformula} expressions.
+}
+
\newcommand{\limitsntheorem}{%
This conversion is not total.
\watchout[Font control]
@@ -1078,22 +1115,23 @@ enclose them inside \env{warpHTML} environments.
For font-proportional image sizes, use \texttt{ex} or \texttt{em}.
For fixed-sized images, use
\texttt{cm}, \texttt{mm}, \texttt{in}, \texttt{pt}, or \texttt{pc}.
-Use the keys \cmds{width=.5\lmacro{linewidth}},
+Use the keys \optn{width=.5\lmacro{linewidth}},
or similar for \cs{textwidth} or \cs{textheight}
to give fixed-sized images proportional to a 6 by 9 inch text area.
+Do not use the \optn{scale} option, since it is not well supported by \HTML\ browsers.
-\cs{includegraphics} accepts \texttt{width} and \texttt{height},
+\cs{includegraphics} accepts \optn{width} and \optn{height},
\margintag{options}
-\texttt{origin}, \texttt{rotate} and \texttt{scale},
-plus a new \texttt{class} key.
+\optn{origin}, \optn{rotate} and \optn{scale},
+plus a new \optn{class} key.
With \HTML\ output, \cs{includegraphics} accepts an optional
\margintag{\HTML\ class}
-\texttt{class=xyz} keyval combination, and if this is given then
+\optn{class=xyz} keyval combination, and if this is given then
the \HTML\ output will include that class for the image.
The class is ignored for print output.
-\cs{rotatebox} accepts the optional \texttt{origin} key.
+\cs{rotatebox} accepts the optional \optn{origin} key.
\margintag{\cs{rotatebox}}
\cs{rotatebox}, \cs{scalebox}, and \cs{reflectbox} depend
@@ -1106,21 +1144,26 @@ ugly results for scaling and rotating.
}
\newcommand{\limitssvgimages}{%
-\limitssectioningmath
-
-When a math expression, \texttt{picture}, or \tikz\ environment is added or
-\watchout[Adding/removing]
-removed, the \SVG\ images must be re-created with \texttt{lwarpmk limages}
+When a math expression, \env{picture}, or \tikz\ environment is added or
+\watchout[adding/removing]
+removed, the \SVG\ images must be re-created by entering \cmds{lwarpmk limages}
to maintain the proper image file sequence numbers.
If \HTML\ appears where an \SVG\ image should be,\watchout[\HTML\ instead of images]%
-\index{math>showing as HTML}%
-\index{images>showing as HTML}%
-\index{SVG>images showing as HTML}%
-\index{HTML>in place of SVG images}
+\index{math>appearing as \HTML}%
+\index{images>appearing as \HTML}%
+\index{SVG>images appearing as \HTML}%
+\index{HTML>appearing in \SVG\ images}
recompile the document one more
time to get the page numbers back in sync, then remake the images one more time.
+Incorrect \SVG\ images will also occur if the document has\watchout[page counter]
+\begin{sourcedisplay}
+\cs{setcounter}\{page\}\{<value>\}
+\end{sourcedisplay}
+The \texttt{page} counter must not be adjusted by the user.
+\index{page>counter}
+
Expressing math as \SVG\ images has the advantage of representing
the math exactly as \LaTeX\ would, but has the disadvantage of requiring
an individual file for each math expression.
@@ -1133,6 +1176,18 @@ For a document with a large amount of math,
see \cref{sec:tutorialmathjax} to use \brand{MathJax} instead.
}
+\newcommand{\limitstikz}{%
+If using display math with \env{tikzpicture} or \cs{tikz}, along
+\watchout[displaymath and matrices]
+with matrices with the \texttt{\&} character, the document must be modified as follows:
+\begin{sourcedisplay}
+\cs{usepackage}\{tikz\} \\
+\cs{tikzset}\{every picture/.style=\{ampersand replacement=\textbackslash\&\}\} \\
+\end{sourcedisplay}
+and each instance of \texttt{\&} in the \pkg{tikz} expression must be
+replaced with \texttt{\textbackslash\&}.\
+}
+
\newcommand{\limitsgrffile}{%
\pkg{grffile} is supported as-is.
File types known to the browser are displayed, and unknown file types are given a link.
@@ -1163,8 +1218,8 @@ text is placed before or after each.
Print-mode definitions for \cs{colorboxBlock} and \cs{fcolorboxBlock}
are created by \pkg{lwarp}'s core if \pkg{xcolor} is loaded.
-\cs{fcolorbox} and \cs{fcolorboxBlock} allow a background color of \texttt{none},
-\margintag{background: \texttt{none}}
+\cs{fcolorbox} and \cs{fcolorboxBlock} allow a background color of \optn{none},
+\margintag{background: \optn{none}}
in which case only the frame is drawn, which can be useful for \HTML.
Color definitions, models, and mixing are fully supported
@@ -1172,7 +1227,7 @@ Color definitions, models, and mixing are fully supported
without any changes required.
\cs{rowcolors} is supported, except that the optional argument is ignored so far.
-\margintag{tables}
+\margintag{colored tables}
\cs{textcolor}, \cs{colorbox}, and \cs{fcolorbox} are supported.
\margintag{colored text and boxes}
@@ -1184,7 +1239,7 @@ Use \CSS\ or \cs{textcolor} where possible.
\newcommand{\limitsepstopdf}{%
When using \pkg{epstopdf} to convert images to \PDF,
-use the \texttt{pdftocairo} utility to also provide an \SVG\ version as well.
+use the \prog{pdftocairo} utility to also provide an \SVG\ version as well.
In the document, refer to the image filename without a suffix. The
\PDF\ version will be used in print output, and the \SVG\ version will
be used for \HTML.
@@ -1249,8 +1304,8 @@ or the packages \pkg{multirow}, \pkg{longtable}, \pkg{supertabular}, or \pkg{xta
\end{tabular}
\end{sourcedisplay}
Note that recent versions of \pkg{multirow} include a new optional
- \margintag{\texttt{vposn}}
- \texttt{vposn} argument.
+ \margintag{\optn{vposn}}
+ \optn{vposn} argument.
\item The \pkg{multirow} documentation regarding colored cells recommends using
a negative number of rows. This will not work with \pkg{lwarp}, so
\cs{warpprintonly} and \cs{warpHTMLonly} must be used to make versions for
@@ -1400,8 +1455,8 @@ of each column and each row to be skipped:
\end{sourcedisplay}
Note that recent versions of \pkg{multirow} include a new optional
-\margintag{\texttt{vposn}}
-\texttt{vposn} argument.
+\margintag{\optn{vposn}}
+\optn{vposn} argument.
}
\newcommand{\limitsresumetabular}{%
@@ -1542,7 +1597,7 @@ the page will be corrupted.
A line of text with an inline minipage
\watchout[inline]
or parbox will have the minipage or parbox placed onto its own line,
-because a paragraph is a block element and cannot be made \texttt{inline-block}.
+because a paragraph is a block element and cannot be made \attribute{inline-block}.
Minipages and parboxes will be placed side-by-side in \HTML\
\margintag{placement}
@@ -1551,7 +1606,7 @@ unless you place a \cs{newline} between them.
Side-by-side minipages may be separated by \cs{quad}, \cs{qquad}, \cs{enskip},
\margintag{side-by-side}
\cs{hspace}, \cs{hfill}, or a \cs{rule}.
-When inside a \texttt{center} environment, the result is
+When inside a \env{center} environment, the result is
similar in print and \HTML. Paragraph tags are surpressed between
side-by-side minipages and these spacing commands, but not at the start or end
of the paragraph.
@@ -1662,7 +1717,7 @@ title and subtitle background colors and borders and thickness,
border radius, and shadow.
CSS classes are created for \pkg{mdframed} environments and frame titles.
-When used, \pkg{lwarp} loads \pkg{mdframed} in \HTML\ with \texttt{framemethod=none}.
+When used, \pkg{lwarp} loads \pkg{mdframed} in \HTML\ with \optn{framemethod=none}.
\watchout[loading]
For title font, use
@@ -1680,14 +1735,14 @@ in the \pkg{mdframed} source).
Since \pkg{lwarp} does not support \cs{bfseries} and friends,
only one font selection may be made at a time.
-\texttt{theoremtitlefont} is not supported, since the following text is not
+\optn{theoremtitlefont} is not supported, since the following text is not
\margintag{theoremtitlefont}
in braces in the \pkg{mdframed} source.
Footnotes are currently placed at the bottom of the \HTML\ page.
\margintag{footnotes}
-\texttt{userdefinedwidth} and \texttt{align} are currently ignored.
+\optn{userdefinedwidth} and \optn{align} are currently ignored.
\margintag{ignored options}
}
@@ -1709,8 +1764,8 @@ such as:
\cs{captionsetup}[table]\{position=top\} \\
\cs{captionsetup}[figure]\{position=bottom\}
\end{sourcedisplay}
-Similarly for \texttt{subtable}, \texttt{subfigure},
-and \texttt{longtable}.
+Similarly for \pkg{subtable}, \pkg{subfigure},
+and \pkg{longtable}.
}
\newcommand{\limitscombiningfloats}{%
@@ -1725,8 +1780,8 @@ If using \cs{newfloat}, \pkg{trivfloat}, and/or
% would appear in the List of Figures/Tables before the enclosing figure/table,
% therefore \pkg{lwarp} does not place subfigures in the LOF/LOT.
-At present, the package options for \texttt{lofdepth} and \texttt{lotdepth}
-\watchout[\texttt{lof/lotdepth}]
+At present, the package options for \optn{lofdepth} and \optn{lotdepth}
+\watchout[\optn{lof/lotdepth}]
are not working. These counters must be set separately after the
package has been loaded.
@@ -1767,10 +1822,10 @@ Possible solutions include:
}
\newcommand{\limitskeyfloat}{%
-If placing a \cs{keyfig}\texttt{[H]} inside a \env{keywrap},
+If placing a \cs{keyfig}\optn{[H]} inside a \env{keywrap},
\watchout[\env{keywrap}]
use an absolute width for
-\cs{keyfig}, instead of \texttt{lw}-proportional widths.
+\cs{keyfig}, instead of \optn{lw}-proportional widths.
(The \optn{[H]} option forces the use of a minipage, which internally adjusts for
a virtual 6-inch wide minipage, which then corrupts the \optn{lw} option.)
}
@@ -1778,7 +1833,7 @@ a virtual 6-inch wide minipage, which then corrupts the \optn{lw} option.)
\newcommand{\limitssiunitx}{%
Due to \prog{pdftolatex} limitations, fraction output is replaced by symbol
\margintag{fractions}
-output for \texttt{per-mode} and \texttt{quotient-mode}.
+output for \optn{per-mode} and \optn{quotient-mode}.
Some units will require that the expression be placed inside math mode.
\watchout[math mode required]
@@ -1810,7 +1865,7 @@ When French is used, the caption separator is
\margintag{\cs{CaptionSeparator}}
changed to a dash. The following may be used to restore it to a colon:
\begin{sourcedisplay}
-\texttt{\cs{renewcommand}*\{\cs{CaptionSeparator}\}\{:\textasciitilde\}}
+\cs{renewcommand}*\{\cs{CaptionSeparator}\}\{:\textasciitilde\}
\end{sourcedisplay}
Also when French is used,
@@ -1883,6 +1938,27 @@ The proper load order is:
\end{sourcedisplay}
}
+\newcommand*{\describehashing}{%
+If starred, a hashed filename is used.\margintag{image filename hashing}
+\index{hash>SVG image filename}
+\index{file>hashed name}
+\index{images>hashed filenames}
+\index{MD5 hash>SVG image filename}
+If so, the hash is based on the \attribute{alt} tag and also the additional hashing argument.
+
+This may be used to provide an expression with a simple \attribute{alt} tag
+but also enough additional information to provide a unique hash.
+
+An example is when the expression is a complicated \TeX\ expression, which would not
+copy/paste well. A simplified tag may be used, while the complicated expression is
+duplicated in the additional hashing argument.
+
+Another example is when the expression is simple, but the image depends
+on options. These options may be decoded into text form and
+included in the additional hashing argument in order to make the hash
+unique according to the set of options, even if the simple \attribute{alt} tag
+is still the same.
+}
\newcommand{\osportabilityusage}{%
@@ -1925,7 +2001,7 @@ This boolean may be tested by the user for later use.
%<*package>
% \fi
%
-% \CheckSum{21481}
+% \CheckSum{22904}
%
% \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
@@ -2017,8 +2093,7 @@ This boolean may be tested by the user for later use.
% \changes{v0.48}{2018/02/14}{\ 2018/02/14}
% \changes{v0.49}{2018/02/19}{\ 2018/02/19}
% \changes{v0.50}{2018/03/03}{\ 2018/03/03}
-
-
+% \changes{v0.51}{2018/03/24}{\ 2018/03/24}
@@ -2207,9 +2282,35 @@ This boolean may be tested by the user for later use.
% highlighting new features and any special changes which must be made due
% to improvements or modifications in \pkg{lwarp} itself.
%
-% For a detailed list of changes, see the Change History on page \pageref{sec:changehistory}.
+% For a detailed list of the most recent changes,
+% see the end of the Change History on page \pageref{sec:changesend}.
%
% \begin{description}
+% \item[v0.51:] \
+% \begin{itemize}
+% \item Docs: Added \nameref{sec:thingstoavoid}.
+% \item Docs: Added to \nameref{sec:convertexisting}.
+% \item Docs: Multiple authors and affiliations with custom classes.
+% See \cref{sec:authorsaffils}.
+% \item Docs: \pkg{tikz} with matrices. See \cref{sec:limitstikz}.
+% \item Improved \SVG\ math baseline.\margintag{SVG math}
+% \item Improved \SVG\ math font and color.
+% \item Faster \SVG\ math rendering.
+% \item Improved support for display math containing complicated math objects,
+% such as \pkg{tikz-cd}. See \cref{sec:displaymathother}.
+% \item Fix: \cs{addcontentsline} inside \SVG\ math.
+% \item Fix: SVG math containing an embedded \env{lateximage}.
+% \item MathJax now handles \cs{ensuremath} in expressions.\margintag{MathJax}
+% \item Fix: Added \env{alignat} environment. \margintag{misc. fixes}
+% \item Fix: \pkg{afterpackage} no longer required, which conflicted with \pkg{scrlfile}.
+% \item Fix: \pkg{titling} \cs{thanks} mark.
+% \item Fix: \pkg{fancybox} improvements.
+% \item Fix: \pkg{tikz} \cs{tikz} macro. (Previously only the \env{tikzpicture} environment worked.)
+% \item Fix: \pkg{tikz} with optional argument.
+% \item Added \pkg{mhchem}, \margintag{packages}
+% \pkg{chemfig}, \pkg{chemformula}, \pkg{chemmacros}, \pkg{chemnum}, \pkg{chemgreek},
+% \pkg{epstopdf-base}, \pkg{grid}, \pkg{ltxgrid}.
+% \end{itemize}
% \item[v0.50:] \
% \begin{itemize}
% \item \SVG\ math and other \env{lateximage}s now are
@@ -2224,7 +2325,7 @@ This boolean may be tested by the user for later use.
% already exists.
% Display math and other forms of \SVG\ image such as \env{picture} and
% \tikz\ still use individual image files which are recreated each time
-% |lwarpmk limages| is run.
+% \cmds{lwarpmk limages} is run.
% \item Fixes: SVG math and/or \cs{underline} in a sectioning file name.
% \item Improved \SVG\ display math and tags.
% \item Improved \SVG\ math and \pkg{siunitx} \attribute{alt} tags.
@@ -2515,7 +2616,7 @@ This boolean may be tested by the user for later use.
% \end{itemize}
% \item[v0.38:] \
% \begin{itemize}
-% \item Added |lwarpmk print1| and |lwarpmk html1| actions to
+% \item Added \cmds{lwarpmk print1} and \cmds{lwarpmk html1} actions to
% \margintag{forced single-pass compile}
% force a compile of the project a single time.
% Useful when multiple passes are not needed,
@@ -2701,8 +2802,8 @@ This boolean may be tested by the user for later use.
% \cs{useLatexmk} & |latexmk| \\
% \cs{warpOSwindows} & |OSWindows| \\[2.5ex] \toprule
% Old Package Option & New Package Option \\ \midrule
-% |lwarpmklang| & |IndexLanguage| \\
-% (new) & |xdyFilename| \\[2.5ex] \toprule
+% \optn{lwarpmklang} & \optn{IndexLanguage} \\
+% (new) & \optn{xdyFilename} \\[2.5ex] \toprule
% Old Macro & New Macro \\ \midrule
% \cs{MetaLanguage} & \cs{HTMLLanguage} \\
% \cs{HTMLauthor} & \cs{HTMLAuthor} \\
@@ -2747,7 +2848,7 @@ This boolean may be tested by the user for later use.
% \item Print mode without \prog{latexmk} now uses \prog{xindy} instead of \prog{makeindex}.
% \item \prog{texindy}/\prog{xindy} usage depends on \prog{pdflatex} vs \prog{xelatex}, \prog{lualatex}.
% \item For \prog{pdflatex} and \prog{texindy}, the \optn{-C utf8} option is used. This is
-% supported in modern distributions, but a customized |lwarpmk.lua| may
+% supported in modern distributions, but a customized \filenm{lwarpmk.lua} may
% need to be created for use with older distributions.
% \end{itemize}
%
@@ -2804,7 +2905,7 @@ This boolean may be tested by the user for later use.
% ^^A \pkg{pagenote} now works as per the print version.
% ^^A \pkg{footnote}, \pkg{footnotehyper}, \pkg{footmisc}, \pkg{endnotes},
% ^^A \pkg{marginnote}, and \pkg{sidenotes} are also supported.
-% ^^A \item \LaTeX\ labels now are used to track the page numbers of |latexiamge|s.
+% ^^A \item \LaTeX\ labels now are used to track the page numbers of |lateximage|s.
% ^^A This allows the correct inclusion of |lateximage|s in footnotes, pagenotes, and endnotes.
% ^^A \item \pkg{cutwin} and \pkg{floatflt} are also supported.
% ^^A \end{itemize}
@@ -2837,7 +2938,7 @@ This boolean may be tested by the user for later use.
% ^^A has been replaced with a |lateximages.txt| file, which is parsed
% ^^A by \prog{lwarpmk} to generate lateximages.
% ^^A This does not require any changes in the user's code.
-% ^^A \item \brand{Windows} |lwarpmk again| now functions.
+% ^^A \item \brand{Windows} \cmds{lwarpmk again} now functions.
% ^^A \item For improved error handling, \pkg{lwarp} now verifies the
% ^^A order in which packages are loaded, and signals an error for misplaced packages.
% ^^A \pkg{inputenc}, \pkg{fontenc}, \pkg{newunicode}, and \pkg{fontspec}
@@ -2979,7 +3080,7 @@ This boolean may be tested by the user for later use.
%
% \rulebreak
%
-% Assistance is also provide for modifying the \HTML\ output to suit the creation
+% Assistance is also provided for modifying the \HTML\ output to suit the creation
% of \EPUB\ documents, and for modifying the \HTML\ output to ease import into
% a word processor.
%
@@ -3047,6 +3148,8 @@ This boolean may be tested by the user for later use.
% code used to emulate or replace functions for \HTML\ output.
%
%
+%
+%
% \clearpage
%
% \subsection{Supported packages and features}
@@ -3100,9 +3203,9 @@ This boolean may be tested by the user for later use.
% \pkg{preview},
% \pkg{draftwatermark}, \pkg{watermark},
% \pkg{everyshi}, \pkg{atbegshi}, \pkg{continue}, \pkg{fwlw}, \pkg{turnthepage},
-% \pkg{pagesel}, \pkg{blowup}, \pkg{pagegrid}. \\
+% \pkg{pagesel}, \pkg{blowup}, \pkg{pagegrid}, \pkg{grid}, \pkg{ltxgrid}. \\
%
-% Sectioning: & Adds \cmds{FileDepth} for splitting the \HTML\ output.
+% Sectioning: & Adds \progcode{FileDepth} for splitting the \HTML\ output.
% Files may be numbered sequentially or named according to section name.
% Common short words and punctuation are removed from the filenames.
% \pkg{titlesec}, \pkg{fncychap}, \pkg{sectsty}, \pkg{section},
@@ -3135,7 +3238,7 @@ This boolean may be tested by the user for later use.
%
% Margin notes: & \pkg{marginfit}, \pkg{marginfix}, \pkg{scrlayer-notecolumn}. \\
%
-% Footnotes: & Adds \cmds{FootnoteDepth} to print footnotes at section breaks.
+% Footnotes: & Adds \progcode{FootnoteDepth} to print footnotes at section breaks.
% \pkg{footnote}, \pkg{footmisc},
% \pkg{marginnote}, \pkg{sidenote}, \pkg{pagenote},
% \pkg{endnotes}, \pkg{endheads}, \pkg{footnpag}, \pkg{nccfoots}. \\
@@ -3153,7 +3256,10 @@ This boolean may be tested by the user for later use.
% \pkg{theorem}, \pkg{amsthm}, \pkg{ntheorem}. \\
%
% Additional math: & Math fonts via \SVG\ images, \pkg{resizegather}.
-% As-is: \pkg{delarray}, \pkg{bm}, \pkg{braket}, etc. \\
+% As-is: \pkg{delarray}, \pkg{bm}, \pkg{braket}, \pkg{tikz-cd}, etc. \\
+%
+% Display math with \cs{displaymathother}: & %
+% Complicated math objects in display math, such as \pkg{tikz-cd}, etc. \\
%
% \midrule
%
@@ -3161,12 +3267,15 @@ This boolean may be tested by the user for later use.
%
% Science and engineering: &
% \pkg{listings}, \pkg{algorithmicx}, \pkg{bytefield}, \pkg{axodraw2},
-% \pkg{phfqit}.
-% Tested to work with SVG math: \pkg{physics}, \pkg{slashed},
+% \pkg{phfqit}, \pkg{mhchem},
+% \pkg{chemfig}, \pkg{chemformula}, \pkg{chemmacros}, \pkg{chemnum}. \pkg{chemgreek},
+% Tested to work with \SVG\ math: \pkg{physics}, \pkg{slashed},
% \pkg{heppennames}, \pkg{hepnicenames},
-% \pkg{simpler-wick}, \pkg{linop}, \pkg{blochsphere}, etc.
+% \pkg{simpler-wick}, \pkg{linop}, \pkg{blochsphere}, \pkg{elements}, etc.
% \emph{(Math-mode packages generally work as-is with \SVG\ math.)} \\
%
+% \midrule
+%
% Liberal arts: & \pkg{schemata} \\
%
% \midrule
@@ -3189,8 +3298,8 @@ This boolean may be tested by the user for later use.
% \midrule
%
% Graphics: & \pkg{graphics} and \pkg{graphicx}.
-% \cs{includegraphics} supports \cmds{width}, \cmds{height},
-% \cmds{origin}, \cmds{angle}, and \cmds{scale} tags, and adds \cmds{class}.
+% \cs{includegraphics} supports \optn{width}, \optn{height},
+% \optn{origin}, \optn{angle}, and \optn{scale} tags, and adds \optn{class}.
% References to \PDF\ files are changed to \SVG, other image types
% are accepted as well.
% \cs{rotatebox} and \cs{scalebox} are supported as well as \HTML\ can handle.
@@ -3270,7 +3379,7 @@ This boolean may be tested by the user for later use.
%
% Fonts: & Used as-is. Appear in \SVG\ math expressions or embedded image environments. \\
%
-% Symbols: & Native \LaTeX\ diacriticals, \pkg{textcomp}, \pkg{textgreek}. \\
+% Symbols: & Native \LaTeX\ diacriticals, \pkg{textcomp}, \pkg{textgreek}, \pkg{textalpha}. \\
%
% \midrule
%
@@ -3482,7 +3591,7 @@ This boolean may be tested by the user for later use.
% should be an operating-system executable in the same way that
% \prog{pdflatex} or \prog{latexmk} is. It is possible to have the
% \pkg{lwarp} package generate a local copy of \prog{lwarpmk}
-% called |lwarpmk.lua|.
+% called \filenm{lwarpmk.lua}.
% See \cref{sec:genlatexmk}.
%
% \item[\prog{luatex}:] Used by the \prog{lwarpmk} program to simplify and automate document generation.
@@ -3605,7 +3714,7 @@ This boolean may be tested by the user for later use.
% and click on the button called \textsf{Refresh FNDB}.
% \end{enumerate}
%
-% \item[CTAN \texttt{.dtx} and \texttt{.ins} files:] Another form of \TeX\ package
+% \item[CTAN \filenm{.dtx} and \filenm{.ins} files:] Another form of \TeX\ package
% is the |.dtx| and |.ins| source files. These files are used to create
% the documentation and |.sty| files.
%
@@ -3634,13 +3743,13 @@ This boolean may be tested by the user for later use.
% and click on the button called \textsf{Refresh FNDB}.
%
% \item See \cref{sec:locallwarpmk} to generate your local copy of \prog{lwarpmk}.
-% \item Once the local version of |lwarpmk.lua| is installed, it may be made
+% \item Once the local version of \filenm{lwarpmk.lua} is installed, it may be made
% available system-wide as per \cref{sec:installlwarpmk}.
% \end{enumerate}
-% \item[Project-local \CTAN\ \texttt{.dtx} and \texttt{.ins} files:] The
+% \item[Project-local \CTAN\ \filenm{.dtx} and \filenm{.ins} files:] The
% |.dtx| and |.ins| files may be downloaded to a project
% directory, then compiled right there, alongside the
-% document source files. The resultant |*.sty| and |lwarpmk.lua| files
+% document source files. The resultant |*.sty| and \filenm{lwarpmk.lua} files
% may be used as-is, so long as they are in the same directory
% as the document source. This approach is especially useful if
% you would like to temporarily test\margintag{Just testing!}\
@@ -3672,7 +3781,7 @@ This boolean may be tested by the user for later use.
%
% Otherwise, continue with the following:
%
-% \item Locate the file |lwarpmk.lua|, which should be in the |scripts| directory
+% \item Locate the file \filenm{lwarpmk.lua}, which should be in the |scripts| directory
% of the \TDS\ tree. On a \TeX\ Live or MiK\TeX\ system you may use
% \userentry{kpsewhich lwarpmk.lua}
%
@@ -3697,7 +3806,7 @@ This boolean may be tested by the user for later use.
% In this directory you will find programs
% such as \prog{pdflatex} and \prog{makeindex}.
% \item In the binaries directory,
-% create a new symbolic link from the binaries directory to |lwarpmk.lua|:
+% create a new symbolic link from the binaries directory to \filenm{lwarpmk.lua}:
% \userentry{ln -s <pathtolwarpmk.lua> lwarpmk}
% \item Make the link executable:
% \userentry{chmod 0755 lwarpmk}
@@ -3707,7 +3816,7 @@ This boolean may be tested by the user for later use.
% \item Locate the \TeX\ Live binaries as shown above for Unix.
% \item In the binaries directory, make a \emph{copy} of |runscript.exe|
% and call it |lwarpmk.exe|
-% This will call the copy of |lwarpmk.lua|
+% This will call the copy of \filenm{lwarpmk.lua}
% which is in the |scripts| directory of the distribution.
% \end{enumerate}
% \item [\brand{Windows} MiK\TeX:] Create a new |lwarpmk.bat| file:
@@ -3723,7 +3832,7 @@ This boolean may be tested by the user for later use.
% {\footnotesize
% |texlua "C:\Program Files\MiKTeX 2.9\scripts\lwarp\lwarp.texlua" %*|}
% \end{sourcedisplay}
-% This will call the copy of |lwarpmk.lua|
+% This will call the copy of \filenm{lwarpmk.lua}
% which is in the |scripts| directory of the distribution.
% \end{enumerate}
% \end{description}
@@ -3738,13 +3847,13 @@ This boolean may be tested by the user for later use.
% \begin{sourcedisplay}
% |\usepackage[lwarpmk]{lwarp}|
% \end{sourcedisplay}
-% \item When the tutorial is compiled with \prog{pdflatex}, the file |lwarpmk.lua|
+% \item When the tutorial is compiled with \prog{pdflatex}, the file \filenm{lwarpmk.lua}
% will be generated along with the other configuration files.
-% \item |lwarpmk.lua| may be used for this project:
+% \item \filenm{lwarpmk.lua} may be used for this project:
% \begin{description}
% \item[Unix:] \
% \begin{enumerate}
-% \item Make |lwarpmk.lua| executable: \userentry{chmod 0755 lwarpmk.lua}
+% \item Make \filenm{lwarpmk.lua} executable: \userentry{chmod 0755 lwarpmk.lua}
% \item Compile documents with
% \userentry{./lwarpmk.lua html}
% \userentry{./lwarpmk.lua print} \quad etc.
@@ -3869,6 +3978,7 @@ This boolean may be tested by the user for later use.
%
% This section shows an example of how to create an \pkg{lwarp} document.
%
+% \needhelp
%
% \subsection{Starting a new project}
%
@@ -3928,7 +4038,6 @@ This boolean may be tested by the user for later use.
% the additional helper program \prog{latexmk} will be used to compile the document.)
%
%
-%
% \clearpage
%
% \begingroup
@@ -4009,7 +4118,7 @@ This boolean may be tested by the user for later use.
% \label{sec:genlatexmk}
% When the \optn{lwarpmk} option is given to the \pkg{lwarp} package:
% \begin{description}
-% \item [|lwarpmk.lua|:] A local copy of the \prog{lwarpmk} utility.
+% \item [\filenm{lwarpmk.lua}:] A local copy of the \prog{lwarpmk} utility.
%
% On Unix-related operating systems this file must be made executable:
% \begin{sourcedisplay}
@@ -4056,7 +4165,7 @@ This boolean may be tested by the user for later use.
% 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 \texttt{lwarpmk printglossary} command is also
+% \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.}
% \userentry{lwarpmk printindex}
@@ -4292,7 +4401,7 @@ This boolean may be tested by the user for later use.
% \userentry{lwarpmk print} \quad -and-
% \userentry{lwarpmk html}
%
-% \item Also rememeber to update the indexes and recompile again.
+% \item Also remember to update the indexes and recompile again.
% \end{enumerate}
%
%
@@ -4378,7 +4487,7 @@ This boolean may be tested by the user for later use.
% convert each target to \HTML\ files.
%
%
-% \subsection{Converting an existing document}
+% \section{Converting an existing document}
% \label{sec:convertexisting}
%
% \index{modifying>document}
@@ -4387,6 +4496,7 @@ This boolean may be tested by the user for later use.
% \index{document>convert existing}
%
% \changes{v0.48}{2018/02/05}{Docs: Converting an existing document.}
+% \changes{v0.51}{2018/03/04}{Docs: Updated Converting an existing document.}
%
% To convert an existing document for use with \pkg{lwarp}:
% \begin{enumerate}
@@ -4400,24 +4510,37 @@ This boolean may be tested by the user for later use.
% \end{enumerate}
% \item Also modify the document:
% \begin{enumerate}
-% \item Change \cs{includegraphics} \PDF\ filenames
-% from |filename.pdf| to |filename| without a suffix.
-% Other image formats may be left unmodified,
-% or may be loaded without a file suffix.
-% \item Possible changes to \env{tabular} environments:
+% \item Remove \filenm{.pdf} file extensions. Change:
+% \begin{sourcedisplay}
+% \cs{includegraphics}\{filename.pdf\}
+% \end{sourcedisplay} to:
+% \begin{sourcedisplay}
+% \cs{includegraphics}\{filename\}
+% \end{sourcedisplay}
+% Other image formats may have a file extension.
+% \item Avoid the \optn{scale} option. Change:
+% \begin{sourcedisplay}
+% \cs{includegraphics}[scale=<xx>]
+% \end{sourcedisplay} to:
+% \begin{sourcedisplay}
+% \cs{includegraphics}[width=<yy>\textbackslash{linewidth}]
+% \end{sourcedisplay}
+% \item Possible changes to \env{tabular} environments include
% |*| 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 Other changes as per \cref{sec:limitations}.
+% \item Other changes as per \nameref{sec:limitations}, \cref{sec:limitations}.
% \end{enumerate}
% \item Create an SVG version of any PDF image.
-% \item Manually compile print version with \prog{pdflatex},
+% \item Manually compile the print version with \prog{pdflatex},
% \prog{lualatex}, or \prog{xelatex}.
% \item |lwarpmk print| to finish the print version.
% \item |lwarpmk html| to create the \HTML\ version.
% \item |lwarpmk limages| to create the \SVG\ images of any \SVG\ math, \env{lateximage}, \tikz, etc.
% \end{enumerate}
%
+% \needhelp
+%
% \clearpage
%
% \section{Additional details}
@@ -4465,7 +4588,7 @@ This boolean may be tested by the user for later use.
% \index{font>Deja Vu}%
% \index{Unicode>enhanced coverage}%
% \index{UTF-8>enhanced coverage}%
-% or other other font packages, which may provide an increased coverage of Unicode mappings.
+% or other font packages, which may provide an increased coverage of Unicode mappings.
% Avoid bit-mapped fonts.
%
% \XeLaTeX{} and \LuaLaTeX{} users must use the \pkg{fontspec} package.
@@ -4549,7 +4672,7 @@ This boolean may be tested by the user for later use.
% well with others. \XeLaTeX\ or \LuaLaTeX\ are recommended for non-Latin languages.
%
% For an older distribution of \LaTeX, it may be necessary to generate a local version of
-% |lwarpmk.lua| and modify it to remove the \optn{-C utf8} option from the \prog{texindy} call.
+% \filenm{lwarpmk.lua} and modify it to remove the \optn{-C utf8} option from the \prog{texindy} call.
% See \cref{sec:modifylwarpmk}.
%
%
@@ -4575,7 +4698,7 @@ This boolean may be tested by the user for later use.
% HTMLFilename & A prefix for the filenames of the remaining web pages. \\
% IndexLanguage & The \prog{xindy} language option used for index and glossary generation. \\
% latexmk & Boolean for \prog{lwarpmk} to use \prog{latexmk} for compiling documents. \\
-% lwarpmk & Generate a local copy of |lwarpmk.lua|. \\
+% lwarpmk & Generate a local copy of \filenm{lwarpmk.lua}. \\
% xdyFilename & Set a custom filename for \prog{xindy}. \\
% \bottomrule
% \end{tabular}
@@ -4629,7 +4752,7 @@ This boolean may be tested by the user for later use.
% See \cref{sec:htmlsettings}.
%
% \DescribeOption{lwarpmk} If you wish to have \pkg{lwarp} generate a local
-% copy of |lwarpmk.lua| for archival or local-installation purposes,
+% 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}.
%
@@ -5319,16 +5442,27 @@ This boolean may be tested by the user for later use.
% \changes{v0.14}{2016/03/26}{Docs: Commands for a successful \HTML\ conversion.}
% \changes{v0.36}{2017/08/11}{Docs: Reorganized: Special cases and limitations.}
%
-% Also see \cref{sec:troubleshooting}: \nameref{sec:troubleshooting}.
-%
-% Some commonly-used \LaTeX{} expressions should be modified to allow
-% for a smooth conversion to both \HTML\ and print-formatted outputs:
+% Some commonly-used \LaTeX{} expressions should be modified as follows to allow
+% for a smooth conversion to both \HTML\ and print-formatted outputs.
%
+% \needhelp
%
-% \subsection{Sectioning}
+% \subsection{Things to avoid}
+% \label{sec:thingstoavoid}
+% \changes{v0.51}{2018/03/04}{Docs: Things to avoid.}
%
-% \limitssectioning
+% In the document, avoid the following:
%
+% \begin{description}
+% \item [\texttt{page} counter:] Do not adjust the \texttt{page} counter.
+% If doing so is required for the print version, place the
+% adjustment inside a \env{warpprint} environment.
+% \item [Custom math environment macros:] Do not use expressions such as
+% \cs{beq} as a replacement for \texttt{\cs{begin}\{equation\}}.
+% \item [Custom macros in section, figure, table names:] Custom macros which appear in the
+% \filenm{.toc}, \filenm{.lof}, and \filenm{.lot} files should be made robust,
+% using \cs{newrobustcmd} or \cs{robustify} from \pkg{etoolbox}, \pkg{xparse}, etc.
+% \end{description}
%
% \subsection{Formatting}
%
@@ -5559,6 +5693,25 @@ This boolean may be tested by the user for later use.
% \subsection{Front and back matter}
% \label{sec:frontbackmatter}
%
+% \subsubsection{Custom classes with multiple authors and affiliations}
+% \label{sec:authorsaffils}
+% \changes{v0.51}{2018/03/04}{Docs: Multiple authors and affiliations.}
+%
+% Some classes allow multiple authors and affiliations.
+% \index{author>multiple}\index{affiliation>multiple authors}
+% Often it is possible to emulate these using a standard class
+% along with \pkg{authblk}:
+% \begin{sourcedisplay}
+% \%\cs{documentclass}\{customclass\}~\% for print document \\
+% \cs{documentclass}\{article\}~\% for HTML document \\
+% \\
+% \cs{usepackage}\{lwarp\} \\
+% \cs{begin}\{warpHTML\} \\
+% \cs{usepackage}\{authblk\} \\
+% \cs{let}\cs{affiliation}\cs{affil}~\% maybe required \\
+% \cs{end}\{warpHTML\}
+% \end{sourcedisplay}
+%
% \subsubsection{Starred chapters and sections}
% \label{sec:forcesectionstar}
%
@@ -5669,7 +5822,26 @@ This boolean may be tested by the user for later use.
% \label{sec:limitsmath}
% \limitsmath
%
+% \subsubsection{Display math}
+% \label{sec:displaymathother}
+% \index{math>\cs{displayingmath}}\index{math>\cs{displayingmore}}
+% \index{display math>complicated objects}
+% \index{math>display with complicated objects}
+% \index{tikz>in display math}
+% \index{math>with \tikz}\index{equation>with \tikz}
+% \index{MathJax>errors}\index{HTML>alt tags}\index{alt tags}
+%
+% \describedisplaymathother
+%
+% \subsubsection{\pkg{chemformula} package}
+% \limitschemformula
+% \index{chemformula>troubleshooting}
+% \index{array>and chemformula}
+% \index{math>and chemformula}
%
+% \subsubsection{\pkg{mhchem} package}
+%
+% See \cref{sec:mhchem}.
%
% \subsubsection{\pkg{ntheorem} package}
%
@@ -5705,6 +5877,14 @@ This boolean may be tested by the user for later use.
% \limitsgraphics
%
%
+% \subsubsection{\pkg{tikz} package}
+% \label{sec:limitstikz}
+%
+% \DescribePackage{tikz}
+% \limitstikz
+% \changes{v0.51}{2018/03/18}{Docs: \pkg{tikz} limitations.}
+%
+%
% \subsubsection{\pkg{grffile} package}
%
% \DescribePackage{grffile}
@@ -6458,26 +6638,26 @@ This boolean may be tested by the user for later use.
%
% \DescribeProgram{lwarpmk}
% \DescribeFile{lwarpmk.lua}
-% In most installations, |lwarpmk.lua| is an executable file located somewhere
+% In most installations, \filenm{lwarpmk.lua} is an executable file located somewhere
% \index{lwarpmk>customizing}
% the operating system knows about, and it is called by typing ``|lwarpmk|'' into
% a terminal.
%
-% A project-local copy of |lwarpmk.lua| may be generated, modified, and then used to
+% A project-local copy of \filenm{lwarpmk.lua} may be generated, modified, and then used to
% compile documents:
% \begin{enumerate}
% \item Add the \optn{lwarpmk} option to the \pkg{lwarp} package.
% \item Recompile the printed version of the document.
-% The \optn{lwarpmk} option causes \pkg{lwarp} to create a local copy of |lwarpmk.lua|
+% The \optn{lwarpmk} option causes \pkg{lwarp} to create a local copy of \filenm{lwarpmk.lua}
% \item The \optn{lwarpmk} option may now be removed from the \pkg{lwarp} package.
-% \item Copy and rename |lwarpmk.lua| to a new file such as |mymake.lua|.
-% \item Modify |mymake.lua| as desired.
-% \item If necessary, make |mymake.lua| executable.
-% \item Use |mymake.lua| instead of |lwarpmk.lua|.
+% \item Copy and rename \filenm{lwarpmk.lua} to a new file such as \filenm{mymake.lua}.
+% \item Modify \filenm{mymake.lua} as desired.
+% \item If necessary, make \filenm{mymake.lua} executable.
+% \item Use \filenm{mymake.lua} instead of \filenm{lwarpmk.lua}.
% \end{enumerate}
%
% To adjust the command-line arguments for compiling the document,
-% look in |mymake.lua| for ``|latexname|''.
+% look in \filenm{mymake.lua} for ``|latexname|''.
%
% To adjust the command-line arguments for processing the index,
% look for ``|xindy|''.
@@ -6522,6 +6702,7 @@ This boolean may be tested by the user for later use.
%
% \item [Obscure error messages:] ~
% \begin{description}
+% \setlength{\parskip}{1ex}
% \item [Print first:] Be sure that a print version of the document compiles and
% that your document's \LaTeX{} code is correct, before attempting
% to generate an \HTML\ version.
@@ -6556,18 +6737,43 @@ This boolean may be tested by the user for later use.
% \cs{savebox}, \cs{hbox}, \cs{vbox}, \cs{usebox}, \cs{sbox},
% etc., must be modified to work without box commands.
%
-% \medskip
-%
-% If you can locate what used \cs{ensuremath}, have it temporarily set:
+% If you find something using \cs{ensuremath}, have it temporarily set:
% \begin{sourcedisplay}
% \cs{LetLtxMacro}\cs{@ensuredmath}\cs{LWR@origensuredmath}
% \end{sourcedisplay}
% inside a group first.
+%
+% Also, custom macros which appear inside a section, \watchout[custom macros in section names]
+% figure, or table name should be
+% made robust since they appear inside the \filenm{.toc}, \filenm{.lof}, or
+% \filenm{.lot} files.
+% Use \cs{newrobustcmd} or \cs{robustify} from \pkg{etoolbox}, \pkg{xparse}, etc.
% \index{warning>Improper \cs{prevdepth}.}
% \index{Improper \cs{prevdepth}.}
+% \item[``\texttt{\cs{begin}\{equation\} ended by \cs{end}\{document\}}'':] Do not
+% \watchout[custom macros for environments]
+% use custom macros such as \cs{beq} and \cs{eeq} to replace
+% \begin{sourcedisplay}
+% \cs{begin}\{equation\} \\
+% \dots \\
+% \cs{end}\{equation\}
+% \end{sourcedisplay}
+% \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.
+% Insert \cs{displaymathother} before the display math environment,
+% and then \cs{displaymathnormal} when displaying ``normal'' math.
+% See \cref{sec:displaymathother}.
% \end{description}
%
% \needspace{3\baselineskip}
+% \item [Incorrect \brand{MathJax}:] Some objects do not convert to \brand{Mathjax}.
+% \watchout[MathJax]
+% Use \cs{displaymathother} before these objects, then \cs{displaymathnormal} to return
+% to ``normal'' display math.
+% See \cref{sec:displaymathother}.
+%
+% \needspace{3\baselineskip}
% \item [Missing sections:] ~
% \begin{itemize}
% \item See \cref{sec:filedepth} regarding the
@@ -6613,13 +6819,14 @@ This boolean may be tested by the user for later use.
% \item [Images are appearing in strange places:] ~
% \index{images>in strange places}
% \begin{itemize}
-% \item |lwarpmk limages| to refresh the |lateximage| images.
+% \item Enter \cmds{lwarpmk limages} to refresh the \env{lateximage} images.
% \end{itemize}
%
% \item[SVG images:] \
%
% \limitssvgimages
%
+% \needspace{3\baselineskip}
% \item [Plain-looking document:] \
% \begin{itemize}
% \item The document's \CSS\ stylesheet may not be available, or may be
@@ -6671,16 +6878,16 @@ This boolean may be tested by the user for later use.
% \subsection{Compiling the \filenm{lwarp.dtx} file}
%
% \begin{description}
-% \item [\texttt{lwarp\_tutorial.tex}:] Copy or link |lwarp_tutorial.txt|
+% \item [\filenm{lwarp\_tutorial.tex}:] Copy or link \filenm{lwarp\_tutorial.txt}
% from the \acro{TDS} |doc| directory to the |source| directory,
% or wherever you wish to compile the documentation.
-% This file is included verbatim into the documentation, but is in the |doc|
-% directory so that it may be found by |texdoc| and copied by the user.
-% \item [Illogical error messages caused by an out-of-sync |lwarp.sty| file:] ~
+% This file is included verbatim in the documentation, but is in the \filenm{doc}
+% directory so that it may be found by \prog{texdoc} and copied by the user.
+% \item [Illogical error messages caused by an out-of-sync \filenm{lwarp.sty} file:] ~
% \begin{enumerate}
-% \item Delete the |lwarp.sty| file.
-% \item |pdflatex lwarp.ins| to generate a new |lwarp.sty| file.
-% \item |pdflatex lwarp.dtx| to recompile the |lwarp.pdf| documentation.
+% \item Delete the \filenm{lwarp.sty} file.
+% \item Enter \cmds{pdflatex lwarp.ins} to generate a new \filenm{lwarp.sty} file.
+% \item Enter \cmds{pdflatex lwarp.dtx} to recompile the \filenm{lwarp.pdf} documentation.
% \end{enumerate}
%
% \item [Un-nested environments:]~
@@ -6696,7 +6903,15 @@ This boolean may be tested by the user for later use.
%
%
%
-% \StopEventually{\PrintChanges\PrintIndex}
+% \StopEventually{
+% \PrintChanges
+% \phantomsection
+% \label{sec:changesend}
+% \PrintIndex
+% \vfill
+% For the most recent changes and the start of the Index,
+% see page \pageref{sec:changesend}.
+% }
%
%
%
@@ -6720,7 +6935,7 @@ This boolean may be tested by the user for later use.
% Examples include \pkg{xcolor} with its color models and conversion to \HTML\
% color output, and \pkg{siunitx} which provides many number and unit-formatting
% options, almost all of which are available in pure-text form, and thus
-% easily used by \cmds{pdftotext}.
+% easily used by \prog{pdftotext}.
%
% Packages were emulated where their primary purpose was visual formatting which is not
% relevent to \HTML\ output. For example, packages related to sectioning
@@ -7075,13 +7290,18 @@ This boolean may be tested by the user for later use.
% \DescribeBoolean{warpingprint}
% \DescribeBoolean{warpingHTML}
% \DescribeBoolean{mathjax}
+% \DescribeBoolean{LWR@origmathjax}
%
% Set to true/false depending on the package option selections for
-% print/\HTML/\EPUB\ output and mathsvg/mathjax:
+% print/\HTML/\EPUB\ output and mathsvg/mathjax.
+%
+% \optn{LWR@origmathjax} remembers the original setting to be restored
+% by \cs{displaymathnormal}.
% \begin{macrocode}
\newbool{warpingprint}
\newbool{warpingHTML}
\newbool{mathjax}
+\newbool{LWR@origmathjax}
% \end{macrocode}
%
%
@@ -7143,6 +7363,7 @@ This boolean may be tested by the user for later use.
\DeclareVoidOption{mathsvg}{%
\PackageInfo{lwarp}{Using option 'mathsvg'}
\boolfalse{mathjax}%
+\boolfalse{LWR@origmathjax}%
}
% \end{macrocode}
%
@@ -7155,6 +7376,7 @@ This boolean may be tested by the user for later use.
\DeclareVoidOption{mathjax}{%
\PackageInfo{lwarp}{Using option 'mathjax'}
\booltrue{mathjax}%
+\booltrue{LWR@origmathjax}%
}
% \end{macrocode}
@@ -7202,11 +7424,11 @@ This boolean may be tested by the user for later use.
% \DescribeOption{lwarpmk} Tells \pkg{lwarp} to
-% generate a local copy of \prog{lwarpmk} called |lwarpmk.lua|.
+% generate a local copy of \prog{lwarpmk} called \filenm{lwarpmk.lua}.
% Useful for archiving for future use.
% This file may be made executable and acts just like \prog{lwarpmk}.
%
-% If \optn{lwarpmk} option, creates a local copy of |lwarpmk.lua|:
+% If \optn{lwarpmk} option, creates a local copy of \filenm{lwarpmk.lua}:
% \begin{macrocode}
\newbool{LWR@creatinglwarpmk}
\boolfalse{LWR@creatinglwarpmk}
@@ -7548,6 +7770,11 @@ For a possible alternative, see package(s) #2.}
\LWR@notmemoirloadafter{chngpage}
\LWR@loadafter{chappg}
\LWR@loadafter{chapterbib}
+\LWR@loadafter{chemfig}
+\LWR@loadafter{chemformula}
+\LWR@loadafter{chemgreek}
+\LWR@loadafter{chemmacros}
+\LWR@loadafter{chemnum}
\LWR@loadafter{cite}
\LWR@loadafter{color}
\LWR@loadafter{colortbl}
@@ -7571,6 +7798,7 @@ For a possible alternative, see package(s) #2.}
\LWR@loadafter{enumitem}
\LWR@notmemoirloadafter{epigraph}
\LWR@loadafter{epstopdf}
+\LWR@loadafter{epstopdf-base}
\LWR@loadafter{eso-pic}
\LWR@loadafter{everypage}
\LWR@loadafter{everyshi}
@@ -7610,6 +7838,7 @@ For a possible alternative, see package(s) #2.}
% \LWR@loadafter{graphics}% pre-loaded by xunicode
% \LWR@loadafter{graphicx}% pre-loaded by xunicode
\LWR@loadafter{grffile}
+\LWR@loadafter{grid}
\LWR@loadafter{hang}
\LWR@loadafter{hanging}
\LWR@loadafter{hypcap}
@@ -7632,6 +7861,7 @@ For a possible alternative, see package(s) #2.}
\LWR@loadafter{longtable}
\LWR@loadafter{lscape}
\LWR@loadafter{ltcaption}
+\LWR@loadafter{ltxgrid}
\LWR@loadafter{ltxtable}
\LWR@loadafter{luacolor}
\LWR@loadafter{luatodonotes}
@@ -7642,6 +7872,7 @@ For a possible alternative, see package(s) #2.}
\LWR@loadafter{mdframed}
\LWR@loadafter{memhfixc}
\LWR@loadafter{metalogo}
+\LWR@loadafter{mhchem}
\LWR@loadafter{microtype}
\LWR@loadafter{midfloat}
\LWR@loadafter{midpage}
@@ -7981,16 +8212,7 @@ top=1in,bottom=1in,%
\RequirePackage{xparse}
% \end{macrocode}
-% \DescribePackage{afterpackage}
-% Used to patch \pkg{titling} to add \cs{AddSubtitlePublished}.
-% Provided by \pkg{scrlfile} or \pkg{afterpackage}.
-% \changes{v0.44}{2017/11/19}{Adjustment for \pkg{koma-script}.}
-% \begin{macrocode}
-\@ifundefined{AfterPackage}%
-{
-\RequirePackage{afterpackage}
-}{}
-% \end{macrocode}
+% \changes{v0.51}{2018/03/06}{\pkg{afterpackage}: No longer required.}
% \begin{macrocode}
\end{warpall}
@@ -8314,7 +8536,8 @@ top=1in,bottom=1in,%
%
% \begin{macro}{\LWR@lookforpackagename} \marg{index}
%
-% If this is a package name, re-direct it to the \pkg{lwarp} version
+% If this is an \pkg{lwarp}-supported package name,
+% re-direct it to the \pkg{lwarp} version
% by renaming it |lwarp-| followed by the original name.
%
% Looks |index| deep into the list of package names, \cs{LWR@requirepackagenames}, and
@@ -8914,7 +9137,14 @@ top=1in,bottom=1in,%
% \begin{macrocode}
\LetLtxMacro\LWR@origmbox\mbox
\LetLtxMacro\LWR@origmakebox\makebox
-
+% \end{macrocode}
+% Some packages redefine \cs{\#}, which is used to generate \HTML, so the original must
+% be remembered here.
+% \changes{v0.51}{2018/03/12}{Fix: Remember original \cs{\#} in case is redefined.}
+% \begin{macrocode}
+\chardef\LWR@origpound=`\#
+% \end{macrocode}
+% \begin{macrocode}
\let\LWR@origcomma\,
\let\LWR@origtilde~
\let\LWR@origenskip\enskip
@@ -9113,12 +9343,12 @@ top=1in,bottom=1in,%
\LetLtxMacro{\c}{\LWR@origc}%
\LetLtxMacro{\d}{\LWR@origd}%
\LetLtxMacro{\b}{\LWR@origb}%
-}
+}%
\else% XeLaTeX, LuaLaTeX:
\newcommand*{\LWR@restoreorigaccents}{%
\LetLtxMacro{\t}{\LWR@origt}%
-}
-\fi
+}%
+\fi%
}% AtBeginDocument
% \end{macrocode}
% \end{macro}
@@ -10280,7 +10510,9 @@ div.flushright table {margin-left:auto ; margin-right: 0em ;}
/* Fancybox */
-div.Btrivlist table tr td { padding: .2ex 0em ; }
+div.Btrivlist table tr td {
+ padding: .2ex 0em ;
+}
/* program listing callouts: */
@@ -10406,12 +10638,11 @@ a.linkhome { font-weight:bold ; font-size: 1em ;}
div.lateximagesource { padding: 0px ; margin: 0px ; display: none; }
img.lateximage{
- padding: 0px 0px 0px 0px ;
+ padding: 0pt ;
+ margin: 0pt ;
box-shadow: none ;
border: none ;
background: none ;
- margin: 0px 0px -.15ex 0px ;
- /* pdfcrop leaves a slight margin, adjust to baseline */
max-width: 100% ;
border-radius: 0ex ;
border: none ;
@@ -10629,8 +10860,6 @@ http://nitens.org/taraborelli/texlogo
}
-
-
/* Only display top and bottom navigation if a small screen: */
/* Hide the sidetoc if a small screen: */
nav.topnavigation { display:none; }
@@ -11264,17 +11493,18 @@ nav.botnavigation {
% This occurs each time \prog{lwarpmk} used to create \env{lateximage}s.
%
% \changes{v0.50}{2018/02/27}{\filenm{lwarp\_one\_limage.txt}: Added.}
+% \changes{v0.51}{2018/03/16}{\filenm{lwarp\_one\_limage.txt}: \prog{pdftocairo} \optn{-noshrink} added.}
%
% ^^A *lwarp_one_limage.txt
% \begin{macrocode}
\begin{warpprint}
\begin{filecontents*}{lwarp_one_limage.txt}
@echo off
-pdfseparate -f %1 -l %1 %4_html.pdf lateximages\lateximagetemp-%%d.pdf"
-pdfcrop lateximages\lateximagetemp-%1.pdf lateximages\%3.pdf
-pdftocairo -svg lateximages\%3.pdf lateximages\%3.svg
+pdfseparate -f %1 -l %1 %4_html.pdf lateximages\lateximagetemp-%%d.pdf
+pdfcrop --hires lateximages\lateximagetemp-%1.pdf lateximages\%3.pdf
+pdftocairo -svg -noshrink lateximages\%3.pdf lateximages\%3.svg
del lateximages\%3.pdf
-del lateximages\lateximagetemp-%1.pdf"
+del lateximages\lateximagetemp-%1.pdf
exit
\end{filecontents*}
\end{warpprint}
@@ -11438,6 +11668,8 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-
% \changes{v0.50}{2018/02/28}{\prog{lwarpmk}: Error if \filenm{lateximages.txt} does not exist.}
% \changes{v0.50}{2018/02/28}{\prog{lwarpmk}: Error if \filenm{lwarpmk.conf} points to \pkg{lwarp}.}
% \changes{v0.50}{2018/02/28}{\prog{lwarpmk}: Improved error messages.}
+% \changes{v0.51}{2018/03/14}{\prog{lwarpmk}: \prog{pdfcrop}: Restored \optn{hires} option.}
+% \changes{v0.51}{2018/03/16}{\prog{lwarpmk}: \prog{pdftocairo} \optn{-noshrink} added.}
%
% ^^A *lwarpmk.lua
% \begin{macrocode}
@@ -11448,7 +11680,7 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-
-- Print the usage of the lwarpmk command:
-printversion = "v0.50"
+printversion = "v0.51"
function printhelp ()
print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ;
@@ -11819,11 +12051,11 @@ cmdgroupopenname ..
"lateximages" .. dirslash .."lateximagetemp-%d" .. ".pdf" ..
seqname ..
-- Crop the image:
-"pdfcrop lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf " ..
+"pdfcrop --hires lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf " ..
"lateximages" .. dirslash .. lwimgname .. ".pdf" ..
seqname ..
-- Convert the image to svg:
-"pdftocairo -svg lateximages" .. dirslash .. lwimgname .. ".pdf " ..
+"pdftocairo -svg -noshrink lateximages" .. dirslash .. lwimgname .. ".pdf " ..
"lateximages" .. dirslash .. lwimgname ..".svg" ..
seqname ..
-- Remove the temporary files:
@@ -12390,7 +12622,7 @@ end -- not --version
% \end{macro}
% \begin{macro}{\HTMLunicode} \marg{hex\_unicode}
% \begin{macrocode}
-\newcommand*{\HTMLunicode}[1]{\HTMLentity{\#x#1}}
+\newcommand*{\HTMLunicode}[1]{\HTMLentity{\LWR@origpound{}x#1}}
% \end{macrocode}
% \end{macro}
@@ -12914,7 +13146,7 @@ end -- not --version
\renewrobustcmd*{\FBthinspace}{%
\begingroup%
\LWR@FBcancel%
- \LWR@origampersand\#x202f;% \,
+ \LWR@origampersand\LWR@origpound{}x202f;% \,
\endgroup%
}%
\renewrobustcmd*{\FBguillspace}{%
@@ -12926,7 +13158,7 @@ end -- not --version
\DeclareDocumentCommand{\FBmedkern}{}{%
\begingroup%
\LWR@FBcancel%
- \LWR@origampersand\#x202f;% \,
+ \LWR@origampersand\LWR@origpound{}x202f;% \,
\endgroup%
}%
\DeclareDocumentCommand{\FBthickkern}{}{%
@@ -13053,7 +13285,7 @@ end -- not --version
%
% \begin{macrocode}
\NewDocumentCommand{\LWR@htmlspanclass}{o m +m}{%
-\LWR@traceinfo{LWR@htmlspanclass #2}%
+\LWR@traceinfo{LWR@htmlspanclass |#1|#2|}%
\LWR@ensuredoingapar%
\LWR@subhtmlelementclass{span}[#1]{#2}%
\begin{LWR@nestspan}%
@@ -13159,7 +13391,7 @@ end -- not --version
%
% \begin{macrocode}
\NewDocumentCommand{\LWR@subhtmlelementclass}{m O{} m}{%
-\LWR@traceinfo{LWR@subhtmlelementclass #1 #3}%
+\LWR@traceinfo{LWR@subhtmlelementclass !#1!#2!#3!}%
\ifblank{#2}%
{\LWR@htmltag{#1 class="#3"}}% empty option
{\LWR@htmltag{#1 class="#3" style="#2"}}% non-empty option
@@ -14517,7 +14749,7 @@ end -- not --version
{\textless}{-}[\LWR@thisnewfilename]
\StrSubstitute{\LWR@thisnewfilename}%
{\textgreater}{-}[\LWR@thisnewfilename]
-\StrSubstitute{\LWR@thisnewfilename}{\#}{-}[\LWR@thisnewfilename]
+\StrSubstitute{\LWR@thisnewfilename}{\LWR@origpound}{-}[\LWR@thisnewfilename]
% \end{macrocode}
% \changes{v0.45}{2017/12/29}{Fix: Section names with underscores.}
% \begin{macrocode}
@@ -14601,6 +14833,24 @@ end -- not --version
% \end{macro}
+% \begin{macro}{\LWR@nullifymathjaxensuremath}
+% \changes{v0.51}{2018/03/18}{MathJax: Nullifies \cs{ensuremath}.}
+% \begin{macrocode}
+\newcommand{\LWR@nullifymathjaxensuremath}{%
+\ifbool{mathjax}{
+\LWR@stoppars
+\LWR@htmlcomment{Nullify \textbackslash{}ensuremath for MathJax:}
+
+\(
+\newcommand\ensuremath[1]{##1}
+\)
+\LWR@startpars
+}{}
+}
+% \end{macrocode}
+% \end{macro}
+
+
% \begin{macro}{\LWR@newhtmlfile} \marg{section name}
% \changes{v0.18}{2016/04/23}{side\TOC\ after title, improving responsive design.}
% \changes{v0.21}{2017/02/22}{Skip title if not given.}
@@ -14755,6 +15005,14 @@ end -- not --version
\LWR@stoppars
% \end{macrocode}
+%
+% If using MathJax, disable \cs{ensuremath} by printing a nullified
+% definition at the start of each file:
+% \changes{v0.51}{2018/03/18}{MathJax: Nullifies \cs{ensuremath}.}
+% \begin{macrocode}
+\LWR@nullifymathjaxensuremath
+% \end{macrocode}
+%
% \begin{macrocode}
\LWR@traceinfo{LWR@newhtmlfile: done}
}
@@ -15773,6 +16031,16 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% Allow \HTML\ paragraphs to begin:
% \begin{macrocode}
\LWR@startpars
+% \end{macrocode}
+%
+% If using MathJax, disable \cs{ensuremath} by printing a nullified
+% definition at the start of each file:
+% \changes{v0.51}{2018/03/18}{MathJax: Nullifies \cs{ensuremath}.}
+% \begin{macrocode}
+\LWR@nullifymathjaxensuremath
+% \end{macrocode}
+%
+% \begin{macrocode}
\LWR@traceinfo{LWR@lwarpStart: done}
}
\catcode`\$=3% math shift until lwarp starts
@@ -16339,7 +16607,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% \begin{macro}{\@fnsymbol} \marg{counter}
%
% Re-defined to use an \HTML\ entity for the double vertical bar symbol.
-% The original definition used \cs{\textbar} which was not being seen by \cmds{pdftotext}.
+% The original definition used \cs{\textbar} which was not being seen by \prog{pdftotext}.
%
% \changes{v0.34}{2017/08/07}{Text symbols instead of math.}
%
@@ -16485,9 +16753,10 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
%
% The default |lwarp.css| has definitions for the |published| and |subtitle| classes.
%
-% After \pkg{titling} is loaded, \cs{AddSubtitlePublished} is created,
-% which when used then creates a number of additional macros,
-% and also assigns some of the \pkg{titling} hooks.
+% If \pkg{titling} is loaded, \cs{AddSubtitlePublished} creates a number
+% of additional macros, and also assigns some of the \pkg{titling} hooks.
+% If \pkg{titling} is not loaded, \cs{AddSubtitlePublished} creates null macros.
+%
% Do not use \cs{AddSubtitlePublished} if the user has patched the \pkg{titling}
% \watchout[\pkg{titling} hooks]
% hooks for some other reason.
@@ -16507,41 +16776,38 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% \changes{v0.39}{2017/09/05}{Added.}
%
% \begin{macrocode}
-\AfterPackage{titling}{
\newcommand*{\AddSubtitlePublished}{%
-
-\newcommand{\@published}{}
-
-\newcommand{\published}[1]{\gdef\@published{##1}}
-
-\renewcommand*{\maketitlehooka}{\printpublished}
-
-\newcommand*{\printpublished}{%
-\warpprintonly{\begin{center}\unskip}%
-\begin{BlockClass}{published}%
-\warpprintonly{\large\itshape}%
-\@published%
-\end{BlockClass}%
-\warpprintonly{\end{center}}%
-}
-
-\newcommand{\@subtitle}{}
-
-\newcommand{\subtitle}[1]{\gdef\@subtitle{##1}}
-
-\renewcommand*{\maketitlehookb}{\printsubtitle}
-
-\newcommand*{\printsubtitle}{%
-\warpprintonly{\begin{center}\unskip}%
-\begin{BlockClass}{subtitle}%
-\warpprintonly{\Large\itshape}%
-\@subtitle%
-\end{BlockClass}%
-\warpprintonly{\end{center}}%
-}
-
+\@ifpackageloaded{titling}{% yes titling package
+ \newcommand{\@published}{}%
+ \newcommand{\published}[1]{\gdef\@published{##1}}%
+ \renewcommand*{\maketitlehooka}{\printpublished}%
+ \newcommand*{\printpublished}{%
+ \warpprintonly{\begin{center}\unskip}%
+ \begin{BlockClass}{published}%
+ \warpprintonly{\large\itshape}%
+ \@published%
+ \end{BlockClass}%
+ \warpprintonly{\end{center}}%
+ }%
+ \newcommand{\@subtitle}{}%
+ \newcommand{\subtitle}[1]{\gdef\@subtitle{##1}}%
+ \renewcommand*{\maketitlehookb}{\printsubtitle}%
+ \newcommand*{\printsubtitle}{%
+ \warpprintonly{\begin{center}\unskip}%
+ \begin{BlockClass}{subtitle}%
+ \warpprintonly{\Large\itshape}%
+ \@subtitle%
+ \end{BlockClass}%
+ \warpprintonly{\end{center}}%
+ }%
+}% yes titling package
+{% no titling package
+ \newcommand{\published}[1]{}%
+ \newcommand*{\printpublished}{}%
+ \newcommand{\subtitle}{}%
+ \newcommand*{\printsubtitle}%
+}% no titling package
}% \AddSubtitlePublished
-}% AfterPackage
% \end{macrocode}
% \end{macro}
@@ -16748,11 +17014,16 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% \end{macrocode}
-% \begin{macro}{\LWR@atbeginverbatim} \oarg{style} \marg{class}
+% \begin{macro}{\LWR@atbeginverbatim}
+% \oarg{1: style}
+% \marg{2: negative \cs{baselineskip} \cs{vspace}}
+% \marg{3: class}
%
% Encloses a verbatim environment with the given \CSS\ class.
+%
+% \changes{v0.51}{2018/03/17}{Adds vertical offset.}
% \begin{macrocode}
-\newcommand*{\LWR@atbeginverbatim}[2][]
+\newcommand*{\LWR@atbeginverbatim}[3][]
{%
% \end{macrocode}
% Avoid excessive space between lines:
@@ -16768,9 +17039,11 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% as loading the \brand{MathJax} script.
% \begin{macrocode}
\ifbool{LWR@verbtags}{%
- \LWR@htmltag{pre class="#2"
- \ifthenelse{\equal{#1}{}}{}{style="#1"}%
-}\LWR@orignewline% pre
+ \LWR@htmltag{pre class="#3"
+ \ifthenelse{\equal{#1}{}}{}{style="#1"}%
+ }%
+ \unskip\LWR@origvspace*{-#2\baselineskip}%
+ \LWR@orignewline% pre
}{}%
% \end{macrocode}
% Use a mono-spaced font to preserve horizontal positioning.
@@ -16832,7 +17105,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
\renewcommand{\verbatim@input}[2]{%
\ifbool{LWR@verbtags}{\LWR@forcenewpage}{}%
-\LWR@atbeginverbatim{Verbatim}\unskip\LWR@origvspace*{-\baselineskip}%%
+\LWR@atbeginverbatim{3.5}{Verbatim}%
\LWRV@origverbatim@input{#1}{#2}%
\unskip\LWR@origvspace*{-\baselineskip}\LWR@afterendverbatim%
}
@@ -16850,7 +17123,8 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
\LWR@traceinfo{Patching verbatim.}
\AtBeginEnvironment{verbatim}{%
\LWR@forcenewpage%
-\LWR@atbeginverbatim{verbatim}\unskip\LWR@origvspace*{-2\baselineskip}%
+\LWR@atbeginverbatim{.5}{verbatim}%
+\unskip\LWR@origvspace*{-1.5\baselineskip}%
}
\AfterEndEnvironment{verbatim}{%
\unskip\LWR@origvspace*{-\baselineskip}\LWR@afterendverbatim%
@@ -16871,7 +17145,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
\LWR@traceinfo{Patching tabbing.}
\AtBeginEnvironment{tabbing}{%
\LWR@forcenewpage
-\LWR@atbeginverbatim{tabbing}\unskip\LWR@origvspace*{-\baselineskip}%
+\LWR@atbeginverbatim{3.5}{tabbing}%
}
\AfterEndEnvironment{tabbing}{%
\unskip\LWR@origvspace*{-\baselineskip}\LWR@afterendverbatim%
@@ -17117,8 +17391,9 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
\fi
\fi
% \end{macrocode}
+% \changes{v0.51}{2018/03/17}{Restored list label space.}
% \begin{macrocode}
- \makelabel{#1}%
+ \makelabel{#1} % extra space
% \sbox\@tempboxa{\makelabel{#1}%
% \global\setbox\@labels\hbox{%
% \unhbox\@labels
@@ -17316,7 +17591,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% \begin{macro}{\LWR@patchlists} Patches list environments.
%
-% \cs{LWr@patchlists} remembers \cs{item} as defined by whatever packages have
+% \cs{LWR@patchlists} remembers \cs{item} as defined by whatever packages have
% been loaded, then
% patches the |itemize|, |enumerate|, and |description| environments and \cs{item}.
% This works with the native \LaTeX\ environments, as well as
@@ -18642,7 +18917,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
}{%
\LWR@htmltag{%
tr class="hline" %
- style="border-top: 1px solid \#\LWR@ruleHTMLcolor "%
+ style="border-top: 1px solid \LWR@origpound\LWR@ruleHTMLcolor "%
}%
}%
\LWR@orignewline%
@@ -18655,7 +18930,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
}{%
\LWR@htmltag{%
tr class="tbrule" %
- style="border-top: 1px solid \#\LWR@ruleHTMLcolor "%
+ style="border-top: 1px solid \LWR@origpound\LWR@ruleHTMLcolor "%
}%
}%
\LWR@orignewline%
@@ -19136,14 +19411,14 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% \begin{macrocode}
\ifdefvoid{\LWR@ruleHTMLcolor}{%
\ifdimcomp{#1}{<}{\LWR@lightrulewidth}%
- {\#A0A0A0}%
+ {\LWR@origpound{}A0A0A0}%
{% lightrule or heaver
\ifdimcomp{#1}{<}{\LWR@heavyrulewidth}%
- {\#808080}%
+ {\LWR@origpound{}808080}%
{black}%
}% lightrule or heavier
}{%
- \#\LWR@ruleHTMLcolor%
+ \LWR@origpound\LWR@ruleHTMLcolor%
}
}% custom width and/or color
}
@@ -19214,12 +19489,12 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
\ifdefvoid{\LWR@xcolorrowHTMLcolor}{}%
{% xcolor row color
\LWR@tdaddstyle%
- background:\#\LWR@xcolorrowHTMLcolor%
+ background:\LWR@origpound\LWR@xcolorrowHTMLcolor%
}%
}%
{% explicit row color
\LWR@tdaddstyle%
- background:\#\LWR@rowHTMLcolor%
+ background:\LWR@origpound\LWR@rowHTMLcolor%
}%
}%
}
@@ -19245,7 +19520,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
\ifdefvoid{\LWR@ruleHTMLcolor}{}%
{%
\LWR@tdaddstyle%
- border-top: 1px solid \#\LWR@ruleHTMLcolor%
+ border-top: 1px solid \LWR@origpound\LWR@ruleHTMLcolor%
}{}%
}{}%
}
@@ -19282,7 +19557,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% \begin{macrocode}
\ifdefstring{\LWR@tempone}{tvertbarl}{%
\LWR@tdaddstyle%
- border-left: 1px solid \#\LWR@vertruleHTMLcolor%
+ border-left: 1px solid \LWR@origpound\LWR@vertruleHTMLcolor%
}{}%
}{}%
% \end{macrocode}
@@ -19294,7 +19569,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% Add a custom style if a vertical bar was requested:
% \begin{macrocode}
\LWR@tdaddstyle%
- border-right: 1px solid \#\LWR@vertruleHTMLcolor%
+ border-right: 1px solid \LWR@origpound\LWR@vertruleHTMLcolor%
}{}%
}%
}
@@ -19313,7 +19588,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% \begin{macrocode}
\newcommand*{\LWR@subaddtabularcellcolor}[1]{%
\LWR@htmltag{div class="cellcolor" style="%
- background:\#{}#1 %
+ background:\LWR@origpound{}{}#1 %
" }%
\addtocounter{LWR@cellcolordepth}{1}%
}
@@ -19550,14 +19825,14 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}%
% \begin{macrocode}
\ifbool{LWR@mcolvertbarl}{%
\LWR@tdaddstyle%
- border-left: 1px solid \#\LWR@vertruleHTMLcolor%
+ border-left: 1px solid \LWR@origpound\LWR@vertruleHTMLcolor%
}{}%
% \end{macrocode}
% Right side:
% \begin{macrocode}
\ifbool{LWR@mcolvertbarr}{%
\LWR@tdaddstyle%
- border-right: 1px solid \#\LWR@vertruleHTMLcolor%
+ border-right: 1px solid \LWR@origpound\LWR@vertruleHTMLcolor%
}{}%
}%
}
@@ -21021,7 +21296,7 @@ rowspan="#2" %
\LWR@traceinfo{LWR@startref B}%
\LWR@origmbox{\LWR@htmlrefsectionfilename{#1}}%
\LWR@traceinfo{LWR@startref C}%
-\#%
+\LWR@origpound%
% \end{macrocode}
% Create the destination id:
%
@@ -21334,7 +21609,7 @@ autopage-\theLWR@currentautosec%
% \item [\cs{<type>}:] Starts the float environment. |\figure| or |\begin{figure}|
% \item [\cs{end<type>}:] Ends the float environment. |\endfigure| or |\end{figure}|
% \item [\cs{tf@<ext>}:] The \LaTeX{} file identifier for the output file.
-% \item [\progcode{LWR@have<type>}:] A boolean rememebering whether a \cs{listof} was
+% \item [\progcode{LWR@have<type>}:] A boolean remembering whether a \cs{listof} was
% requested for a float of this type.
% \item [File with extension \filenm{lo<f,t,a-z>}:] An output file containing
% the commands to build the
@@ -21481,12 +21756,18 @@ autopage-\theLWR@currentautosec%
% Adds a new \element{autoid} anchor.
% \changes{v0.45}{2017/12/07}{Fix: No anchor if frozen autoid.}
% \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.}
+% \changes{v0.51}{2018/03/16}{Fix: No autoid is inside a \env{lateximage}.}
% \begin{macrocode}
\newcommand*{\LWR@newautoidanchor}{%
-\ifbool{LWR@freezethisautoid}{}{%
- \addtocounter{LWR@thisautoid}{1}%
- \LWR@htmltag{a id="\LWR@origmbox{autoid-\arabic{LWR@thisautoid}}"}\LWR@htmltag{/a}%
-}%
+\ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}%
+{}%
+{
+ \ifbool{LWR@freezethisautoid}{}{%
+ \addtocounter{LWR@thisautoid}{1}%
+ \LWR@htmltag{a id="\LWR@origmbox{autoid-\arabic{LWR@thisautoid}}"}%
+ \LWR@htmltag{/a}%
+ }%
+}
}
% \end{macrocode}
% \end{macro}
@@ -21696,14 +21977,22 @@ autopage-\theLWR@currentautosec%
%
% \changes{v0.25}{2017/03/16}{Handles theorems.}
% \changes{v0.44}{2017/11/10}{Automatic \cs{LWR@newfloatanchor}.}
-%
+%f
% \begin{macrocode}
\let\LWR@origaddcontentsline\addcontentsline
\renewcommand*{\addcontentsline}[3]{%
\ifstrequal{#1}{toc}{}{% not TOC
- \LWR@newautoidanchor%
- \ifthenelse{\equal{#1}{thm}}{\csdef{ext@#2}{thm}}{}%
+% \end{macrocode}
+% \changes{v0.51}{2018/03/11}{No anchor ID if inside \SVG\ image.}
+% \begin{macrocode}
+\ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}%
+ {}
+ {\LWR@newautoidanchor}%
+% \end{macrocode}
+% \changes{v0.51}{2018/03/11}{Add missing support for float mechanism if necessary.}
+% \begin{macrocode}
+ \ifcsvoid{ext@#2}{\csdef{ext@#2}{#1}}{}%
\addtocontents{\@nameuse{ext@#2}}{%
\protect\LWRsetnextfloat%
{\arabic{LWR@latestautopage}}%
@@ -22111,7 +22400,7 @@ autopage-\theLWR@currentautosec%
% \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.}
% \begin{macrocode}
\LWR@subhyperrefclass{%
- \LWR@htmlrefsectionfilename{autopage-#4}\#\LWR@origmbox{autosec-#4}%
+ \LWR@htmlrefsectionfilename{autopage-#4}\LWR@origpound\LWR@origmbox{autosec-#4}%
}{#3}{toc#2}%
\LWR@stoppars%
}
@@ -22176,7 +22465,7 @@ autopage-\theLWR@currentautosec%
% \begin{macrocode}
\LWR@subhyperrefclass{%
\LWR@htmlrefsectionfilename{autopage-\arabic{LWR@nextautopage}}%
- \#\LWR@origmbox{autoid-\arabic{LWR@nextautoid}}}%
+ \LWR@origpound\LWR@origmbox{autoid-\arabic{LWR@nextautoid}}}%
{#4}{toc#2}%
\LWR@stoppars%
}{}%
@@ -22566,9 +22855,9 @@ autopage-\theLWR@currentautosec%
% \end{macrocode}
% \changes{v0.50}{2018/02/22}{Fix: \cs{centering}, etc. in \SVG\ math, \env{lateximage}, \tikz.}
% \begin{macrocode}
-\let\raggedright\LWR@origraggedright
-\let\raggedleft\LWR@origraggedleft
-\let\centering\LWR@origcentering
+\let\raggedright\LWR@origraggedright%
+\let\raggedleft\LWR@origraggedleft%
+\let\centering\LWR@origcentering%
% \end{macrocode}
% \begin{macrocode}
\let\,\LWR@origcomma% disable HTML short unbreakable space
@@ -22649,11 +22938,6 @@ autopage-\theLWR@currentautosec%
% \changes{v0.42}{2017/10/16}{Improved \cs{ensuremath}.}
% \begin{macrocode}
\LetLtxMacro\@ensuredmath\LWR@origensuredmath%
-% \end{macrocode}
-% \changes{v0.43}{2017/10/31}{Fix: Improved math inside lateximages.}
-% \begin{macrocode}
-\csletcs{equation*}{LWR@origequationstar}%
-\csletcs{endequation*}{LWR@origendequationstar}%
%
\LWR@restoreorigaccents%
\LWR@restoreoriglists%
@@ -22678,6 +22962,10 @@ autopage-\theLWR@currentautosec%
%
% \limitsmath
%
+% \subsubsection{Display math}
+%
+% \describedisplaymathother
+%
%
%
% \subsection{Inline and display math}
@@ -22689,112 +22977,103 @@ autopage-\theLWR@currentautosec%
% \end{macrocode}
+%
+% \DescribeCounter{LWR@externalfilecnt}
+% Counter for the external files which are generated and then referenced from the \HTML:
+% \begin{macrocode}
+\newcounter{LWR@externalfilecnt}
+% \end{macrocode}
+
+
+% \DescribeBoolean{LWR@indisplaymathimage}
+% True if processing display math for \SVG\ output.
+% Inside a \env{lateximage}, display math is only set to print-mode output
+% if |LWR@indisplaymathimage| is false.
+% Used to avoid nullifying display math before it has been completed.
+% \begin{macrocode}
+\newbool{LWR@indisplaymathimage}
+% \end{macrocode}
+
+
% \DescribeMacro{\$}
% Plain dollar signs appearing in the \HTML\ output may be interpreted
% by \brand{MathJax} to be math shifts.
-% For a plain text dollar |\$|, print it inside a span to avoid
+% For a plain text dollar |\$|, use an \HTML\ entity to avoid
% it being interpreted by \brand{MathJax}, unless are inside a lateximage,
% in which case it will not be seen by \brand{MathJax}.
% \changes{v0.19}{2016/06/08}{Avoids \brand{MathJax}.}
% \changes{v0.26}{2017/03/30}{Dollar span avoided in a lateximage.}
+% \changes{v0.51}{2018/03/23}{HTML entity used for text dollar.}
% \begin{macrocode}
\let\LWR@origtextdollar\$
\renewcommand*{\$}{%
\ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}%
{\LWR@origtextdollar}%
-{\LWR@htmltagc{span}\LWR@origtextdollar\LWR@htmltagc{/span}}%
+{\HTMLentity{dollar}}%
}
% \end{macrocode}
-
+% \DescribeFile{lwarp_baseline_marker.png}
+% A marker to be used to help \prog{pdfcrop} identify the inline math baseline
+% and width. If either \pkg{graphicx} or \pkg{graphics} is loaded, this marker is
+% placed at the lower left and lower right corners of the inline math.
+% \prog{pdfcrop} is then able to identify the width of the image, and also
+% the height of an image such as a horizontal dash which does not
+% otherwise touch the baseline.
%
-% \DescribeCounter{LWR@externalfilecnt}
-% Counter for the external files which are generated and then referenced from the \HTML:
-% \begin{macrocode}
-\newcounter{LWR@externalfilecnt}
-% \end{macrocode}
-
-
-
-% \begin{macrocode}
-\LetLtxMacro\LWR@origdollar$
-\LetLtxMacro\LWR@secondorigdollar$% balance for editor syntax highlighting
-% \end{macrocode}
-
-% \begin{macrocode}
-\LetLtxMacro\LWR@origopenparen\(
-\LetLtxMacro\LWR@origcloseparen\)
-\LetLtxMacro\LWR@origopenbracket\[
-\LetLtxMacro\LWR@origclosebracket\]
-% \end{macrocode}
-
-% \DescribeObject{\$}
-% \DescribeObject{\$\$}
-% Redefine the dollar sign to place math inside a \env{lateximage}, or use \brand{MathJax}:
-% \begin{macrocode}
-\begingroup
-\catcode`\$=\active%
-\protected\gdef${\@ifnextchar$\LWR@doubledollar\LWR@singledollar}%
-% \end{macrocode}
-
-
-% \begin{macro}{\LWR@doubledollar}
+% A marker with alpha or opacity of 0\% is not registered by \prog{pdfcrop}, so
+% the marker is a small square block of 1\% alpha, which seems to work while still being
+% effectively invisible in the final SVG image.
%
-% \changes{v0.19}{2016/05/25}{\brand{MathJax} support.}
-% \changes{v0.42}{2017/10/16}{Improved \cs{ensuremath}.}
-% \changes{v0.42}{2017/10/16}{Improved line spacing with mathjax.}
+% If \pkg{graphicx} is loaded, this marker is sized as a tiny 1\,sp square.
+% If \pkg{graphics} is loaded, this marker is used at its default size of around
+% .25\,pt.
+% If neither graphics package is loaded, the marker is replaced by a 10\,sp horizontal
+% space, and there is no assistance for determining baseline or width of the inline
+% math image.
+% The best results are obtained when using \pkg{graphicx}.
%
-% Redefine the double dollar sign to place math inside a \env{lateximage}, or use \brand{MathJax}:
+% \begin{macro}{\LWR@addbaselinemarker} Places a small marker in an \SVG\ inline image.
+% If \pkg{graphics} or \pkg{graphicx} are loaded, the marker is a mostly transparent
+% image.
+% If neither is loaded, no marker is used.
+% \changes{v0.51}{2018/03/16}{Improved \SVG\ math baseline.}
% \begin{macrocode}
-\protected\gdef\LWR@doubledollar$#1$${
-% \end{macrocode}
-% If \brand{MathJax} or formatting for a word processor, print the \LaTeX\ expression:
-% \changes{v0.42}{2017/10/26}{If \progcode{FormatWP} print LaTeX expression.}
-% \begin{macrocode}
-\ifboolexpr{bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) }%
-% \end{macrocode}
-% For \brand{MathJax}, print the math between |\[| and |\]|:
-% \begin{macrocode}
-{
+\AtBeginDocument{
- \textbackslash[%
- \LWR@HTMLsanitize{#1}%
- \textbackslash]
+\@ifpackageloaded{graphicx}{
+ \newcommand*{\LWR@addbaselinemarker}{%
+ \LWR@origincludegraphics[%
+ width=10sp,height=10sp%
+ ]{lwarp_baseline_marker.png}%
+ }
+}{
+ \@ifpackageloaded{graphics}{
+ \newcommand*{\LWR@addbaselinemarker}{%
+ \LWR@origincludegraphics{lwarp_baseline_marker.png}%
+ }
+ }{
+ \newcommand*{\LWR@addbaselinemarker}{%
+ \hspace*{10sp}%
+ }
+ }
+}
-}% mathjax
+}% AtBeginDocument
% \end{macrocode}
-% For SVG, print the math inside a \env{lateximage},
-% with an \element{alt} tag of the \LaTeX\ code:
-% \changes{v0.50}{2018/02/24}{Improved \SVG\ math \attribute{alt} tags.}
-% \changes{v0.50}{2018/03/02}{Improved \SVG\ math display.}
-% \begin{macrocode}
-{% not mathjax
+% \end{macro}
- \begin{BlockClass}{displaymath}
- \begin{lateximage}%
- [%
- \textbackslash{[} % extra space
- \LWR@HTMLsanitize{#1} % extra space
- \textbackslash{]}%
- ]%
- \LWR@origdollar\LWR@origdollar#1\LWR@origdollar\LWR@origdollar%
- \end{lateximage}%
- \end{BlockClass}
-}% not mathjax
-}%
-% \end{macrocode}
-% \end{macro}
+% \begin{macro}{\LWR@subsingledollar} * \marg{2: alt text} \marg{3: add'l hashing}
+% \marg{4: math expression}
%
+% For inline math.
+% Uses MathJax, or for \SVG\ math the image is measured and ajusted to the baseline
+% of the \HTML\ output, and placed inside a \env{lateximage}.
%
-%
-% \begin{macro}{\LWR@subsingledollar} \marg{alt text} \marg{math expression}
-% Redefine the single dollar sign to place math inside a \env{lateximage},
-% or use \brand{MathJax}:
-% If the \attribute{alt} text is empty, the math expression is used
-% for the \attribute{alt} text.
+% \describehashing
%
% \changes{v0.19}{2016/05/25}{\brand{MathJax} support.}
% \changes{v0.42}{2017/10/26}{If \progcode{FormatWP} print LaTeX expression.}
@@ -22806,29 +23085,40 @@ autopage-\theLWR@currentautosec%
\newlength{\LWR@singledollarheight}
\newlength{\LWR@singledollardepth}
-\protected\gdef\LWR@subsingledollar#1#2{%
+\newsavebox{\LWR@singledollarbox}
+
+\NewDocumentCommand{\LWR@subsingledollar}{s m m m}{%
+% \end{macrocode}
+% \begin{macrocode}
+\ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}%
+{%
+ #4% contents
+}%
+{% not in a lateximage
\begingroup%
% \end{macrocode}
% MathJax cannot parse the often complicated \TeX\ expressions which
% appear in the various uses of \cs{ensuredmath}.
-% \cs{ensuremath} forces the \attribute{alt} tag to ``|math image|''.
+% \cs{ensuremath} forces the \attribute{alt} tag to ``|(math image)|''.
% If this is the case, force the use of a \env{lateximage} even if MathJax.
% Likewise for \pkg{siunitx} if |parse-numbers=false|.
%
-% If MathJax, or if formatting math for a word processor, print the math expression.
+% If MathJax, or if formatting math for a word processor, and not \cs{ensuredmath},
+% print the math expression.
+% \changes{v0.51}{2018/03/11}{Fix: \cs{ensuredmath} inside \SVG\ image.}
% \begin{macrocode}
\ifboolexpr{%
(
bool{mathjax} or
( bool{FormatWP} and bool{WPMarkMath} )
) and
- ( not test { \ifstrequal {#1} {math image} } )
+ ( not test { \ifstrequal {#2} {(math image)} } )% from \ensuredmath
}%
% \end{macrocode}
% For \brand{MathJax}, print the math between |\(| and |\)|:
% \begin{macrocode}
{%
- {\textbackslash(\LWR@HTMLsanitize{#2}\textbackslash)}%
+ {\textbackslash(\LWR@HTMLsanitize{#4}\textbackslash)}%
}% mathjax
% \end{macrocode}
% For SVG, print the math inside a \env{lateximage},
@@ -22838,53 +23128,107 @@ autopage-\theLWR@currentautosec%
{% not mathjax
% \end{macrocode}
% Measure the depth, width, and height of the math image:
+% \changes{v0.51}{2018/03/04}{Fix: SVG math with enclosed \env{lateximage}.}
+% \begin{macrocode}
+ \begingroup%
+% \end{macrocode}
+% Temporarily disable formatting while measuring the image parameters:
% \begin{macrocode}
\LWR@restoreorigformatting%
+ \RenewDocumentEnvironment{lateximage}{s o o o}{}{}% inside group
\LWR@orignormalsize%
- \global\setlength{\LWR@singledollardepth}{\depthof{%
- \LWR@origdollar#2\LWR@origdollar%
- }*\real{.8}}%
- \global\setlength{\LWR@singledollarwidth}{\widthof{%
- \LWR@origdollar#2\LWR@origdollar%
- }*\real{.8}}%
- \global\setlength{\LWR@singledollarheight}{\totalheightof{%
- \LWR@origdollar#2\LWR@origdollar%
- }*\real{.8}}%
-% \end{macrocode}
-% \changes{v0.49}{2018/02/18}{Fix: Incorrect \PDF\ output size corrupted \HTML.}
+% \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@origscriptsize%
+ \csuse{LWR@orig\LWR@f@family family}%
+ \csuse{LWR@orig\LWR@f@series series}%
+ \csuse{LWR@orig\LWR@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
+% always occur as expected. Lower-level code is used instead.
+% \begin{macrocode}
+ \global\advance\c@LWR@lateximagedepth 1\relax%
+% \end{macrocode}
+% Typeset and save the contents:
+% \changes{v0.51}{2018/03/07}{Fix: \env{lateximage} inside \AmS\ \cs{text}.}
+% \changes{v0.51}{2018/03/12}{Typeset \SVG\ math only once during measurement.}
+% \begin{macrocode}
+ \global\sbox{\LWR@singledollarbox}{#4}%
+% \end{macrocode}
+% Add a small and almost transparent marker at the depth of the image.
+%
+% A math minus sign has the same depth as a plus, even though it does not draw
+% anything below the baseline. This means that \prog{pdfcrop} would crop the image
+% without depth. The marker below the baseline is seen by \prog{pdfcrop}
+% and preserves the depth.
+% \changes{v0.51}{2018/03/16}{Improved \SVG\ math baseline.}
+% \begin{macrocode}
+ \global\sbox{\LWR@singledollarbox}{%
+ \usebox{\LWR@singledollarbox}%
+ \hspace*{-10sp}%
+ \raisebox{-\dp\LWR@singledollarbox}{%
+ \LWR@addbaselinemarker%
+ }%
+ }%
+% \end{macrocode}
+% More low-level code to undo the counter change.
+% \begin{macrocode}
+ \global\advance\c@LWR@lateximagedepth -1\relax% Due to AmS \text macro.
+% \end{macrocode}
+% Measure the depth:
+% \begin{macrocode}
+ \setlength{\LWR@singledollardepth}{.70\dp\LWR@singledollarbox}%
+% \end{macrocode}
+% Make the length a global change:
+% \begin{macrocode}
+ \global\LWR@singledollardepth=\LWR@singledollardepth%
+% \end{macrocode}
+% Likewise for width:
+% \begin{macrocode}
+ \setlength{\LWR@singledollarwidth}{.70\wd\LWR@singledollarbox}%
+ \global\LWR@singledollarwidth=\LWR@singledollarwidth%
+% \end{macrocode}
+% Likewise for total height:
+% \begin{macrocode}
+ \setlength{\LWR@singledollarheight}{.70\ht\LWR@singledollarbox}%
+ \addtolength{\LWR@singledollarheight}{.70\dp\LWR@singledollarbox}%
+ \global\LWR@singledollarheight=\LWR@singledollarheight%
+% \end{macrocode}
+% \begin{macrocode}
+ \endgroup%
% \end{macrocode}
%
% Set a style for the the height or width.
% The |em| unit is used so that the math scales according to the
% user's selected font size.
-% Start with the larger of width or height:
+%
+% Start with the greater of the width or the height, biased towards the width:
% \begin{macrocode}
- \ifdimgreater{\LWR@singledollarwidth}{\LWR@singledollarheight}{%
+ \ifdimgreater{\LWR@singledollarwidth}{.7\LWR@singledollarheight}{%
\def\LWR@singledollarstyle{%
width:\LWR@convertto{em}{\the\LWR@singledollarwidth} em%
}%
}{%
\def\LWR@singledollarstyle{%
- height:\LWR@convertto{em}{\the\LWR@singledollarheight }em%
+ height:\LWR@convertto{em}{\the\LWR@singledollarheight} em%
}%
}%
% \end{macrocode}
-% If narrow width, use the height. Single-letter variables look best if they all are
-% scaled according to height.
+% If a very narrow width, use the height.
% \begin{macrocode}
- \ifdimless{\LWR@singledollarwidth}{.8em}%
+ \ifdimless{\LWR@singledollarwidth}{.2em}%
{%
\def\LWR@singledollarstyle{%
- height:\LWR@convertto{em}{\the\LWR@singledollarheight }em%
+ height:\LWR@convertto{em}{\the\LWR@singledollarheight} em%
}%
}%
{}%
% \end{macrocode}
-% If extremely wide and short, use the width:
+% If very wide and short, use the width:
% \begin{macrocode}
- \ifdimless{\LWR@singledollarheight}{.3em}%
+ \ifdimless{\LWR@singledollarheight}{.2em}%
{%
\def\LWR@singledollarstyle{%
width:\LWR@convertto{em}{\the\LWR@singledollarwidth} em%
@@ -22895,7 +23239,7 @@ autopage-\theLWR@currentautosec%
% If there is significant text depth, add the depth to the style.
% \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.}
% \begin{macrocode}
- \ifdimgreater{\LWR@singledollardepth}{0.01em}{%
+ \ifdimgreater{\LWR@singledollardepth}{0.05ex}{%
\def\LWR@singledollardepthstyle{%
\ ; % extra space
\LWR@origmbox{%
@@ -22909,33 +23253,162 @@ autopage-\theLWR@currentautosec%
% Create the \env{lateximage} using the alternate tag and the computed
% size and depth.
% The star causes \env{lateximage} to use an MD5 hash as the filename.
+% When hashing, also include the current font and color in the hash.
% \changes{v0.50}{2018/02/22}{MD5 hash avoids duplicate \SVG\ math.}
% \begin{macrocode}
- \ifblank{#1}{%
- \begin{lateximage}*%
- [%
- \textbackslash( %
- \LWR@HTMLsanitize{#2} % extra space
- \textbackslash)%
+ \IfValueTF{#1}{%
+ \LWR@findcurrenttextcolor% sets \LWR@tempcolor
+ \begin{lateximage}*% use hashing
+ [#2]% alt
+ [% addl' hashing
+ #3%
+ FM\LWR@f@family%
+ SR\LWR@f@series%
+ SH\LWR@f@shape%
+ CL\LWR@tempcolor%
]%
- [\LWR@singledollarstyle \LWR@singledollardepthstyle]%
+ [\LWR@singledollarstyle \LWR@singledollardepthstyle]% CSS
}{%
- \begin{lateximage}%
- [#1]%
- [\LWR@singledollarstyle \LWR@singledollardepthstyle]%
+ \begin{lateximage}% no hashing
+ [#2]% alt
+ []% no add'l hashing
+ [\LWR@singledollarstyle \LWR@singledollardepthstyle]% CSS
}%
- \LWR@origdollar#2\LWR@origdollar%
+% \end{macrocode}
+% Place small and almost transparent markers on the baseline
+% at the left and right edges of the image.
+% These markers are seen by \prog{pdfcrop},
+% and force vertically-centered objects such as a dash
+% to be raised off the baseline in the cropped image,
+% and also force the total width and left \spslash right margins to be correct.
+% (Except that in some fonts a character may exceed the bounding box, and thus
+% may appear wider than expected when converted to an image.)
+% \changes{v0.51}{2018/03/10}{SVG math baseline improved with invisible rule at corner.}
+% \begin{macrocode}
+ \LWR@addbaselinemarker%
+ \hspace*{-10sp}%
+% \end{macrocode}
+% Typeset the contents:
+% \begin{macrocode}
+ \usebox{\LWR@singledollarbox}%
+% \end{macrocode}
+% The closing baseline marker:
+% \begin{macrocode}
+ \hspace*{-10sp}%
+ \LWR@addbaselinemarker%
+% \end{macrocode}
+% \begin{macrocode}
\end{lateximage}%
-}%
+%
+}% not mathjax
\endgroup%
+}% not in a lateximage
}
% \end{macrocode}
% \end{macro}
+
+% \begin{macrocode}
+\LetLtxMacro\LWR@origdollar$
+\LetLtxMacro\LWR@secondorigdollar$% balance for editor syntax highlighting
+% \end{macrocode}
+
+% \begin{macrocode}
+\LetLtxMacro\LWR@origopenparen\(
+\LetLtxMacro\LWR@origcloseparen\)
+\LetLtxMacro\LWR@origopenbracket\[
+\LetLtxMacro\LWR@origclosebracket\]
+% \end{macrocode}
+
+% \DescribeObject{\$}
+% \DescribeObject{\$\$}
+% Redefine the dollar sign to place math inside a \env{lateximage},
+% or use \brand{MathJax}:
+% \begin{macrocode}
+\begingroup
+\catcode`\$=\active%
+\protected\gdef${\@ifnextchar$\LWR@doubledollar\LWR@singledollar}%
+% \end{macrocode}
+
+% Used by \pkg{chemformula} to escape single-dollar math:
+% \begin{macrocode}
+\protected\gdef\LWR@newsingledollar{\@ifnextchar$\LWR@doubledollar\LWR@singledollar}%
+% \end{macrocode}
+
+
+% \begin{macro}{\LWR@doubledollar}
+%
+% \changes{v0.42}{2017/10/16}{Improved \cs{ensuremath}.}
+%
+% Redefine the double dollar sign to place math inside a \env{lateximage}, or use \brand{MathJax}:
+% \begin{macrocode}
+\protected\gdef\LWR@doubledollar$#1$${%
+% \end{macrocode}
+% If \brand{MathJax} or formatting for a word processor, print the \LaTeX\ expression:
+% \changes{v0.19}{2016/05/25}{\brand{MathJax} support.}
+% \changes{v0.42}{2017/10/26}{If \progcode{FormatWP} print LaTeX expression.}
+% \begin{macrocode}
+\ifboolexpr{bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) }%
+% \end{macrocode}
+% For \brand{MathJax}, print the math between |\[| and |\]|:
+% \changes{v0.42}{2017/10/16}{Improved line spacing with mathjax.}
+% \begin{macrocode}
+{
+
+ \textbackslash[%
+ \LWR@HTMLsanitize{#1}%
+ \textbackslash]
+
+}% mathjax
+% \end{macrocode}
+% For SVG, print the math inside a \env{lateximage},
+% with an \element{alt} tag of the \LaTeX\ code:
+% \changes{v0.50}{2018/02/24}{Improved \SVG\ math \attribute{alt} tags.}
+% \changes{v0.50}{2018/03/02}{Improved \SVG\ math display.}
+% \changes{v0.51}{2018/03/11}{Fix: \cs{addcontentsline} inside \SVG\ math. Provides an autoid anchor.}
+% \begin{macrocode}
+{% not mathjax
+ \begin{BlockClass}{displaymath}%
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
+ \begin{lateximage}%
+ [%
+ \textbackslash{[} % extra space
+ \LWR@HTMLsanitize{#1} % extra space
+ \textbackslash{]}%
+ ]%
+ \LWR@origdollar\LWR@origdollar#1\LWR@origdollar\LWR@origdollar%
+ \end{lateximage}%
+ \end{BlockClass}%
+}% not mathjax
+}%
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
% \begin{macro}{\LWR@singledollar} \marg{alt text} \marg{math expression}
% \begin{macrocode}
\protected\gdef\LWR@singledollar#1${%
-\LWR@subsingledollar{}{#1}%
+\ifbool{mathjax}{%
+\LWR@subsingledollar*%
+ {% alt tag
+ \textbackslash( %
+ \LWR@HTMLsanitize{#1} % extra space
+ \textbackslash)%
+ }%
+ {singledollar}% add'l hashing
+ {#1}% contents
+}{% not mathjax
+\LWR@subsingledollar*%
+ {% alt tag
+ \textbackslash( %
+ \LWR@HTMLsanitize{#1} % extra space
+ \textbackslash)%
+ }%
+ {singledollar}% add'l hashing
+ {\LWR@origensuredmath{#1}}% contents
+}% not mathjax
}
% \end{macrocode}
% \end{macro}
@@ -22949,12 +23422,14 @@ autopage-\theLWR@currentautosec%
\protected\gdef\[#1\]{$$#1$$}
\endgroup
+
+\LetLtxMacro\LWR@openbracketnormal\[
+\LetLtxMacro\LWR@closebracketnormal\]
% \end{macrocode}
% \end{macro}
% \end{macro}
-
% \begin{macro}{\@ensuredmath} \marg{expression}
%
% \changes{v0.42}{2017/10/16}{Improved \cs{ensuremath}.}
@@ -22968,11 +23443,13 @@ autopage-\theLWR@currentautosec%
% \end{macrocode}
% If MathJax, a \env{lateximage} is used, since \cs{ensuremath} is
% often used for complex \TeX\ expressions which MathJax may not render.
+% If \SVG\ math, a hashed file is used with a simple \attribute{alt} tag, but
+% additional hashing provided by the contents.
+% \changes{v0.51}{2018/02/24}{Hashes \cs{ensuremath}.}
% \begin{macrocode}
-% \begin{lateximage}[math image]
-% \LWR@origensuredmath{#1}
-% \end{lateximage}
- \LWR@subsingledollar{math image}{\relax#1}%
+ \LWR@subsingledollar*{(math image)}{\LWR@HTMLsanitize{#1}}{\relax%
+ \LWR@origensuredmath{#1}%
+ }%
}{% SVG math
% \end{macrocode}
% If already inside a \env{lateximage} in math mode, continue as-is.
@@ -22981,11 +23458,16 @@ autopage-\theLWR@currentautosec%
\LWR@origensuredmath{#1}%
\else%
% \end{macrocode}
-% Create an inline math \env{lateximage},
-% but don't use the expression as the \attribute{alt} tag, since
-% the expression may be complex internal code used to draw a math expression.
+% Create an inline math \env{lateximage} with a simple \attribute{alt} tag
+% and additional hashing according to the contents.
% \begin{macrocode}
- \LWR@subsingledollar{math image}{\relax#1}%
+ \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}%
+ {\LWR@origensuredmath{#1}}%
+ {%
+ \LWR@subsingledollar*{(math image)}{\LWR@HTMLsanitize{#1}}{%
+ \LWR@origensuredmath{#1}%
+ }%
+ }%
\fi%
}%
}
@@ -23009,15 +23491,69 @@ autopage-\theLWR@currentautosec%
% \end{macrocode}
% \end{environment}
%
-% \begin{environment}{displaymath}
+% \begin{environment}{LWR@displaymathnormal}
% Set math mode then typeset the body of what was between the begin/end.
% See the \pkg{environ} package for \cs{BODY}.
% \begin{macrocode}
-\NewEnviron{displaymath}{\expandafter\[\BODY\]\@ignoretrue}
+\NewEnviron{LWR@displaymathnormal}{\expandafter\[\BODY\]\@ignoretrue}
% \end{macrocode}
% \end{environment}
+% Set the default displaymath to the normal version:
+% \begin{macrocode}
+\LetLtxMacro\[\LWR@openbracketnormal%
+\LetLtxMacro\]\LWR@closebracketnormal%
+\LetLtxMacro\displaymath\LWR@displaymathnormal%
+\LetLtxMacro\enddisplaymath\endLWR@displaymathnormal%
+% \end{macrocode}
+%
+%
+% \begin{environment}{LWR@displaymathother}
+% A version of \env{displaymath} which can handle complicated objects,
+% but does not supply \brand{MathJax} or \HTML\ \attribute{alt} tags.
+% \changes{v0.51}{2018/03/21}{Processing for complicated display math.}
+% \begin{macrocode}
+\newenvironment{LWR@displaymathother}
+{%
+ \begin{BlockClass}{displaymath}%
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
+ \begin{lateximage}%
+ [(display math)]%
+ \LWR@origdollar\LWR@origdollar%
+}
+{%
+ \LWR@origdollar\LWR@origdollar%
+ \end{lateximage}%
+ \end{BlockClass}%
+}
+% \end{macrocode}
+% \end{environment}
+%
+%
+% \begin{environment}{LWR@equationother}
+% A version of \env{displaymath} which can handle complicated objects,
+% but does not supply \brand{MathJax} or \HTML\ \attribute{alt} tags.
+% \changes{v0.51}{2018/03/21}{Processing for complicated display math.}
+% \begin{macrocode}
+\newenvironment{LWR@equationother}
+{%
+ \begin{BlockClass}{displaymathnumbered}%
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
+ \begin{lateximage}%
+ [(display math)]%
+ \LWR@origequation%
+}
+{%
+ \LWR@origendequation%
+ \end{lateximage}%
+ \end{BlockClass}%
+}
+% \end{macrocode}
+% \end{environment}
+
% \subsection{\brand{MathJax} support}
% \changes{v0.19}{2016/05/25}{\brand{MathJax} support added.}
@@ -23213,8 +23749,11 @@ autopage-\theLWR@currentautosec%
% \end{macrocode}
% Begin the \env{lateximage} with an \element{alt} tag containing the math source:
% \changes{v0.50}{2018/03/02}{Improved \SVG\ math display.}
+% \changes{v0.51}{2018/03/11}{Fix: \cs{addcontentsline} inside \SVG\ math. Provides an autoid anchor.}
% \begin{macrocode}
\begin{BlockClass}{displaymathnumbered}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[%
(\LWR@equationtag) \textbackslash{begin\{equation\}} % extra space
\LWR@HTMLsanitizeexpand{\detokenize\expandafter{\BODY}} % extra space
@@ -23242,6 +23781,9 @@ autopage-\theLWR@currentautosec%
}{}%
]
+
+\LetLtxMacro\LWR@equationnormal\equation
+\LetLtxMacro\LWR@endequationnormal\endequation
% \end{macrocode}
% \end{environment}
@@ -23250,13 +23792,97 @@ autopage-\theLWR@currentautosec%
% \begin{macrocode}
\csletcs{LWR@origequationstar}{equation*}
\csletcs{LWR@origendequationstar}{endequation*}
+
\renewenvironment*{equation*}
{\displaymath}
{\enddisplaymath}
+
+\csletcs{LWR@equationnormalstar}{equation*}
+\csletcs{LWR@endequationnormalstar}{endequation*}
% \end{macrocode}
% \end{environment}
+% Remember the ``less'' version of \env{equation}, which use \brand{MathJax}
+% and \attribute{alt} tags, but does not support complicated contents such as
+% some \tikz\ expressions.
+% \begin{macrocode}
+\LetLtxMacro\LWR@equationless\equation
+\LetLtxMacro\LWR@endequationless\endequation
+\csletcs{LWR@equationlessstar}{equation*}
+\csletcs{LWR@endequationlessstar}{endequation*}
+% \end{macrocode}
+
+
+% \subsection{\cs{displaymathnormal} and \cs{displaymathother}}
+%
+% \describedisplaymathother
+%
+% \begin{macro}{\displaymathnormal} Use when display math environments have simple
+% math which is to sent to \brand{MathJax} or included in \HTML\ \attribute{alt} tags.
+% \margintag{simple math objects}
+% \changes{v0.51}{2018/03/21}{Processing for complicated display math.}
+% \begin{macrocode}
+\newcommand*{\displaymathnormal}{%
+\ifbool{LWR@origmathjax}{\booltrue{mathjax}}{\boolfalse{mathjax}}%
+\LetLtxMacro\[\LWR@openbracketnormal%
+\LetLtxMacro\]\LWR@closebracketnormal%
+\LetLtxMacro\displaymath\LWR@displaymathnormal%
+\LetLtxMacro\enddisplaymath\endLWR@displaymathnormal%
+\LetLtxMacro\equation\LWR@equationnormal%
+\LetLtxMacro\endequation\LWR@endequationnormal%
+\csletcs{equation*}{LWR@equationnormalstar}%
+\csletcs{endequation*}{LWR@endequationnormalstar}%
+}
+% \end{macrocode}
+% \end{macro}
+
+
+% \begin{macro}{\displaymathother} Use when display math environments have complicated
+% objects which will not work with MathJax or should not be
+% included in \HTML\ \attribute{alt} tags. \margintag{complicated math objects}
+% Complicated contents are more likely to compile correctly.
+% \changes{v0.51}{2018/03/21}{Processing for complicated display math.}
+% \begin{macrocode}
+\newcommand*{\displaymathother}{%
+\boolfalse{mathjax}%
+\LetLtxMacro\displaymath\LWR@displaymathother%
+\LetLtxMacro\enddisplaymath\endLWR@displaymathother%
+\LetLtxMacro\[\LWR@displaymathother%
+\LetLtxMacro\]\endLWR@displaymathother%
+\LetLtxMacro\equation\LWR@equationother%
+\LetLtxMacro\endequation\endLWR@equationother%
+\csletcs{equation*}{displaymath}%
+\csletcs{endequation*}{enddisplaymath}%
+}
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macrocode}
+\end{warpHTML}
+% \end{macrocode}
+
+
+% \codeprint
+% \begin{macrocode}
+\begin{warpprint}
+% \end{macrocode}
+
+% Print-mode versions:
+% \begin{macrocode}
+\newcommand*{\displaymathnormal}{}
+\newcommand*{\displaymathother}{}
+% \end{macrocode}
+
+% \begin{macrocode}
+\end{warpprint}
+% \end{macrocode}
+
+
+% \codehtml
+% \begin{macrocode}
+\begin{warpHTML}
+% \end{macrocode}
% \subsection{AMS Math environments}
@@ -23448,8 +24074,11 @@ autopage-\theLWR@currentautosec%
% an \attribute{alt} attribute containing sanitized copy of the source code:
% \changes{v0.42}{2017/10/12}{Fix: Numbering and naming AMS math environments.}
% \changes{v0.50}{2018/03/02}{Improved \SVG\ math display.}
+% \changes{v0.51}{2018/03/11}{Fix: \cs{addcontentsline} inside \SVG\ math. Provides an autoid anchor.}
% \begin{macrocode}
- \begin{BlockClass}{displaymathnumbered}
+ \begin{BlockClass}{displaymathnumbered}%
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[(\LWR@startingequationtag--\LWR@equationtag)
\LWR@addmathjax{eqnarray}{\BODY}]
% \end{macrocode}
@@ -23465,8 +24094,11 @@ autopage-\theLWR@currentautosec%
% \end{macrocode}
% If not numbered, do the same, but an extra \cs{nonumber} seems to be required:
% \changes{v0.50}{2018/03/02}{Improved \SVG\ math display.}
+% \changes{v0.51}{2018/03/11}{Fix: \cs{addcontentsline} inside \SVG\ math. Provides an autoid anchor.}
% \begin{macrocode}
\begin{BlockClass}{displaymath}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[\LWR@addmathjax{eqnarray*}{\BODY}]
\LWR@origeqnarray
\BODY
@@ -23506,6 +24138,7 @@ autopage-\theLWR@currentautosec%
%
% \changes{v0.44}{2017/11/16}{AMS environments: Fix: Groups for \env{lateximage}s.}
% \changes{v0.50}{2018/03/01}{AMS environments: Improved \SVG\ math display.}
+% \changes{v0.51}{2018/03/11}{AMS environments: Fix: \cs{addcontentsline} inside \SVG\ math. Provides an autoid anchor.}
%
% \begin{environment}{multline}
% \begin{macrocode}
@@ -23519,6 +24152,8 @@ autopage-\theLWR@currentautosec%
}
{
\begin{BlockClass}{displaymathnumbered}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[\LWR@amsmathbodynumbered{multline}]
}
}
@@ -23550,6 +24185,8 @@ autopage-\theLWR@currentautosec%
}
{
\begin{BlockClass}{displaymath}
+ \LWR@newautoidanchor
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[\LWR@amsmathbody{multline*}]
}
}
@@ -23581,7 +24218,9 @@ autopage-\theLWR@currentautosec%
\LWR@beginhideamsmath
}
{
- \begin{BlockClass}{displaymathnumbered}
+ \begin{BlockClass}{displaymathnumbered}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[\LWR@amsmathbodynumbered{gather}]
}
}
@@ -23611,6 +24250,8 @@ autopage-\theLWR@currentautosec%
}
{
\begin{BlockClass}{displaymath}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[\LWR@amsmathbody{gather*}]
}
}
@@ -23640,7 +24281,9 @@ autopage-\theLWR@currentautosec%
\LWR@beginhideamsmath
}
{
- \begin{BlockClass}{displaymathnumbered}
+ \begin{BlockClass}{displaymathnumbered}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[\LWR@amsmathbodynumbered{align}]
}
}
@@ -23671,6 +24314,8 @@ autopage-\theLWR@currentautosec%
}
{
\begin{BlockClass}{displaymath}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[\LWR@amsmathbody{align*}]
}
}
@@ -23701,6 +24346,8 @@ autopage-\theLWR@currentautosec%
}
{
\begin{BlockClass}{displaymathnumbered}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[\LWR@amsmathbodynumbered{flalign}]
}
}
@@ -23731,6 +24378,8 @@ autopage-\theLWR@currentautosec%
}
{
\begin{BlockClass}{displaymath}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
\begin{lateximage}[\LWR@amsmathbody{flalign*}]
}
}
@@ -23748,6 +24397,72 @@ autopage-\theLWR@currentautosec%
% \end{macrocode}
% \end{environment}
+
+% \begin{environment}{alignat}
+% \changes{v0.51}{2018/03/11}{Fix: Added.}
+% \begin{macrocode}
+\BeforeBeginEnvironment{alignat}{
+
+\ifboolexpr{bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) }%
+{
+ \LWR@syncmathjax
+ \boolfalse{LWR@amsmultline}
+ \LWR@beginhideamsmath
+}
+{
+ \begin{BlockClass}{displaymathnumbered}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
+ \begin{lateximage}[\LWR@amsmathbodynumbered{alignat}]
+}
+}
+
+\AfterEndEnvironment{alignat}{
+
+\ifboolexpr{bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) }%
+{
+ \LWR@endhideamsmath
+ \LWR@addmathjax{alignat}{\the\@envbody}
+}
+{\end{lateximage}\end{BlockClass}}
+
+}
+% \end{macrocode}
+% \end{environment}
+
+
+% \begin{environment}{alignat*}
+% \begin{macrocode}
+\BeforeBeginEnvironment{alignat*}{
+
+\ifboolexpr{bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) }%
+{
+ \LWR@syncmathjax
+ \boolfalse{LWR@amsmultline}
+ \LWR@beginhideamsmath
+}
+{
+ \begin{BlockClass}{displaymath}
+ \LWR@newautoidanchor%
+ \booltrue{LWR@indisplaymathimage}%
+ \begin{lateximage}[\LWR@amsmathbody{alignat*}]
+}
+}
+
+\AfterEndEnvironment{alignat*}{
+
+\ifboolexpr{bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) }%
+{
+ \LWR@endhideamsmath
+ \LWR@addmathjax{alignat*}{\the\@envbody}
+}
+{\end{lateximage}\end{BlockClass}}
+
+}
+% \end{macrocode}
+% \end{environment}
+
+
% \begin{macrocode}
\end{warpHTML}
% \end{macrocode}
@@ -23863,62 +24578,98 @@ autopage-\theLWR@currentautosec%
% \begin{macro}{\LWR@HTMLsanitize} \marg{text}
%
-% Math expressions are converted to |lateximage|s, and some math environments may contain
-% ``\&'', ``\textless'', or ``\textgreater'', which should not be allowed
+% Math expressions are converted to |lateximage|s,
+% and some math environments may contain
+% |&|, |<|, or |>|, which should not be allowed
% inside an \HTML\ \element{alt} tag, so must convert them to \HTML\ entities.
%
% Two versions follow, depending on expansion needs.
% There may be a better way\dots
%
% \changes{v0.36}{2017/08/16}{Fix for \pkg{babel-french}.}
-%
+% \changes{v0.51}{2018/03/07}{Fix: Escapes double quotes.}
+% \begin{macrocode}
+\newrobustcmd{\LWR@HTMLsanitize}[1]{%
+% \end{macrocode}
+% Cancel French \pkg{babel} character handling,
+% and fully expand the strings:
% \begin{macrocode}
-\newcommand{\LWR@HTMLsanitize}[1]{%
\begingroup%
\LWR@FBcancel%
+\fullexpandarg%
+% \end{macrocode}
+% The |&|, |<|, and |>| may be interpreted by the browser:
+% \begin{macrocode}
\protect\StrSubstitute{\detokenize{#1}}%
-{\detokenize{&}}%
-{\detokenize{&amp;}}[\LWR@strresult]%
+{\detokenize{&}}{\detokenize{&amp;}}[\LWR@strresult]%
+% \end{macrocode}
+% \begin{macrocode}
\protect\StrSubstitute{\detokenize\expandafter{\LWR@strresult}}%
-{\detokenize{<}}%
-{\detokenize{&lt;}}%
-[\LWR@strresult]%
+{\detokenize{<}}{\detokenize{&lt;}}[\LWR@strresult]%
+% \end{macrocode}
+% \begin{macrocode}
\protect\StrSubstitute{\detokenize\expandafter{\LWR@strresult}}%
-{\detokenize{>}}%
-{\detokenize{&gt;}}%
-[\LWR@strresult]%
+{\detokenize{>}}{\detokenize{&gt;}}[\LWR@strresult]%
+% \end{macrocode}
+% The double quote occasionally causes problems.
+% \begin{macrocode}
\protect\StrSubstitute{\detokenize\expandafter{\LWR@strresult}}%
-{\detokenize{##}}%
-{\#}%
-[\LWR@strresult]%
+{\detokenize{"}}{\detokenize{&quot;}}[\LWR@strresult]%
+% \end{macrocode}
+% MathJax allows expressions to be defined with \cs{newcommand}.
+% These expressions would appear with |##| for each argument,
+% and each must be changed to a single |#|.
+% This must be done after all the above changes.
+% Attempting another conversion after this causes an error upon further expansion.
+% \begin{macrocode}
+\protect\StrSubstitute{\detokenize\expandafter{\LWR@strresult}}%
+{\detokenize{##}}{\LWR@origpound}[\LWR@strresult]%
+% \end{macrocode}
+% \begin{macrocode}
\LWR@strresult%
\endgroup%
}
% \end{macrocode}
% \end{macro}
+
% \begin{macro}{\LWR@HTMLsanitizeexpand} \marg{text}
%
% This version expands the argument before sanitizing it.
%
% \changes{v0.36}{2017/08/16}{Fix for \pkg{babel-french}.}
-%
+% \changes{v0.51}{2018/03/07}{Fix: Escapes double quotes.}
+% \begin{macrocode}
+\newrobustcmd{\LWR@HTMLsanitizeexpand}[1]{%
+% \end{macrocode}
+% Cancel French \pkg{babel} character handling,
+% and fully expand the strings:
% \begin{macrocode}
-\newcommand{\LWR@HTMLsanitizeexpand}[1]{%
\begingroup%
\LWR@FBcancel%
+\fullexpandarg%
+% \end{macrocode}
+% The difference between this and \cs{LWR@HTMLsanitize} (without ``expand'')
+% is the following \cs{expandafter}:
+% \begin{macrocode}
\protect\StrSubstitute{\detokenize\expandafter{#1}}%
-{\detokenize{&}}%
-{\detokenize{&amp;}}%
-[\LWR@strresult]%
+{\detokenize{&}}{\detokenize{&amp;}}[\LWR@strresult]%
+% \end{macrocode}
+% \begin{macrocode}
+\protect\StrSubstitute{\detokenize\expandafter{\LWR@strresult}}%
+{\detokenize{<}}{\detokenize{&lt;}}[\LWR@strresult]%
+% \end{macrocode}
+% \begin{macrocode}
\protect\StrSubstitute{\detokenize\expandafter{\LWR@strresult}}%
-{\detokenize{<}}%
-{\detokenize{&lt;}}%
-[\LWR@strresult]%
+{\detokenize{>}}{\detokenize{&gt;}}[\LWR@strresult]%
+% \end{macrocode}
+% \begin{macrocode}
\protect\StrSubstitute{\detokenize\expandafter{\LWR@strresult}}%
-{\detokenize{>}}%
-{\detokenize{&gt;}}%
-[\LWR@strresult]%
+{\detokenize{"}}{\detokenize{&quot;}}[\LWR@strresult]%
+% \end{macrocode}
+% \cs{LWR@HTMLsanitizeexpand} is not used for defining new MathJax macros,
+% so the |##| conversion is not needed here.
+% \begin{macrocode}
\LWR@strresult%
\endgroup%
}
@@ -24043,7 +24794,7 @@ autopage-\theLWR@currentautosec%
% \begin{macro}{\LWR@amsmathbodynumbered} \marg{envname} \qquad
% For use inside the optional argument to a \env{lateximage}
-% to add the contents of a AMS math environment to the \element{alt} tag,
+% to add the contents of a AMS math environment to the \attribute{alt} tag,
% prefixed by the equation numbers.
%
% \changes{v0.42}{2017/10/12}{Fix: Numbering and naming AMS math environments.}
@@ -24062,17 +24813,14 @@ autopage-\theLWR@currentautosec%
% \subsection{\env{lateximage}}
-% \begin{environment}{lateximage} * \oarg{\element{alt} tag} \oarg{CSS style}
+% \begin{environment}{lateximage} * \oarg{2: \element{alt} tag}
+% \oarg{3: add'l hashing} \oarg{4: CSS style}
%
% Typesets the contents and then renders the result as an \SVG\ file.
%
% The optional \element{alt} tag is included in the \HTML\ code for use with copy/paste.
%
-% The starred version also uses the \element{alt} tag to create an MD5 hash which is
-% used as the image's filename. This is used for \SVG\ math expressions, and
-% may also be of some use for the document creator.
-% The use of the hash for the filename means that identical expressions will all share a
-% single file, and the file must be converted to \SVG\ only a single time.
+% \describehashing
%
% \changes{v0.18}{2016/05/18}{Surpress extra space.}
% \changes{v0.18}{2016/05/18}{pdfcrop: -{}-hires added.}
@@ -24085,22 +24833,28 @@ autopage-\theLWR@currentautosec%
% \changes{v0.36}{2017/08/16}{Footnotes appear in regular text instead of
% the \protect\env{lateximage} \protect\env{minipage}.}
% \changes{v0.47}{2018/01/24}{Added \CSS\ style option.}
+% \changes{v0.51}{2018/03/07}{Added additional hashing option.}
%
% \begin{macrocode}
\catcode`\$=\active%
-\NewDocumentEnvironment{lateximage}{s O{image} O{}}
+\NewDocumentEnvironment{lateximage}{s O{(image)} O{} O{}}
{%
\LWR@traceinfo{lateximage: starting on \jobname.pdf page \arabic{page}}%
+\LWR@traceinfo{lateximage: entering depth is \arabic{LWR@lateximagedepth}}%
% \end{macrocode}
% Nested |lateximage|s remain one large |lateximage|:
% \begin{macrocode}
-\ifthenelse{\cnttest{\value{LWR@lateximagedepth}}{>}{0}}%
+\ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}%
% \end{macrocode}
-% If nesting inside an already-existing lateximage, simply record one more level:
+% If nesting inside an already-existing lateximage, simply record one more level.
+% \AmS\ packages redefine \cs{addtocounter} to do nothing if inside a \cs{text},
+% so lower-level \TeX\ macros are used for tracking nested \env{lateximage}s.
+% \changes{v0.51}{2018/03/07}{Fix: \env{lateximage} inside \AmS\ \cs{text}.}
% \begin{macrocode}
{%
- \addtocounter{LWR@lateximagedepth}{1}%
+% \addtocounter{LWR@lateximagedepth}{1}%
+ \global\advance\c@LWR@lateximagedepth 1\relax% Due to AmS \text macro.
}%
% \end{macrocode}
% Otherwise, this is the outer-most lateximage:
@@ -24111,6 +24865,7 @@ autopage-\theLWR@currentautosec%
% printed in a multi-equation environment:
% \changes{v0.42}{2017/10/12}{Fix: Numbering and naming AMS math environments.}
% \begin{macrocode}
+\LWR@traceinfo{lateximage: starting outer-most lateximage}%
\setcounter{LWR@startingequation}{\value{equation}}%
\addtocounter{LWR@startingequation}{1}%
\booltrue{LWR@isstartingequation}%
@@ -24145,7 +24900,7 @@ autopage-\theLWR@currentautosec%
% Create an \HTML\ span which will hold the comment which contains the \prog{pdftotext} translation
% of the image's page, and also will hold the link to the |.svg| file:
% \begin{macrocode}
- \LWR@htmltag{span id="lateximage\arabic{LWR@lateximagenumber}" %
+ \LWR@htmltag{span id="lateximage\arabic{LWR@lateximagenumber}" % extra space
class="lateximagesource"}%
% \end{macrocode}
% Write instructions to the |lateximages.txt| file:
@@ -24154,8 +24909,10 @@ autopage-\theLWR@currentautosec%
\LWR@traceinfo{lateximage: about to write to lateximages.txt}%
\IfBooleanTF{#1}% starred
{% hash
- \LWR@traceinfo{lateximage: hash true}%
- \edef\LWR@hashedname{\LWR@mdfive{\detokenize\expandafter{#2}}}%
+ \LWR@traceinfo{lateximage: hash true, adding !#2!#3!}%
+ \edef\LWR@hashedname{%
+ \LWR@mdfive{\detokenize\expandafter{#2}-!-#3}%
+ }%
\LWR@traceinfo{lateximage: hash is \LWR@hashedname}%
\immediate\write\LWR@lateximagesfile{%
|\arabic{LWR@LIpage}|true|\LWR@hashedname|%
@@ -24175,9 +24932,11 @@ autopage-\theLWR@currentautosec%
\LWR@traceinfo{lateximage: about to create open comment}%
\LWR@htmlopencomment%
% \end{macrocode}
-% One level deeper:
+% One level deeper. At this outer-most \env{lateximage}, it is known
+% that this is not being used inside an \AmS\ \cs{text}, since the outer-most
+% level will never be in math mode.
% \begin{macrocode}
- \addtocounter{LWR@lateximagedepth}{1}%
+ \addtocounter{LWR@lateximagedepth}{1}%
% \end{macrocode}
% Start the new \PDF\ page:
% \begin{macrocode}
@@ -24216,8 +24975,25 @@ autopage-\theLWR@currentautosec%
\catcode`\$=3% math shift
\LetLtxMacro\(\LWR@origopenparen%
\LetLtxMacro\)\LWR@origcloseparen%
- \LetLtxMacro\[\LWR@origopenbracket%
- \LetLtxMacro\]\LWR@origclosebracket%
+% \end{macrocode}
+% Only enable print-mode display math if are not already inside display math:
+% \changes{v0.51}{2018/03/21}{Processing for complicated display math.}
+% \begin{macrocode}
+ \ifbool{LWR@indisplaymathimage}{}{% not in display math
+ \LetLtxMacro\[\LWR@origopenbracket%
+ \LetLtxMacro\]\LWR@origclosebracket%
+ \let\equation\LWR@origequation%
+ \let\endequation\LWR@origendequation%
+ \csletcs{equation*}{LWR@origequationstar}%
+ \csletcs{endequation*}{LWR@origendequationstar}%
+ }% not in display math
+% \end{macrocode}
+% For \pkg{chemformula}:
+% \begin{macrocode}
+ \LetLtxMacro\LWR@newsingledollar$%
+ \LetLtxMacro\LWR@newsingledollar$% syntax highlighting
+% \end{macrocode}
+% \begin{macrocode}
}% end of outer-most lateximage
\LWR@traceinfo{lateximage: finished start of environment}%
}% end of \begin{lateximage}
@@ -24228,15 +25004,20 @@ autopage-\theLWR@currentautosec%
%
% \begin{macrocode}
{% start of \end{lateximage}
-\LWR@traceinfo{lateximage: starting end of environment}%
+\LWR@traceinfo{lateximage: starting end of lateximage}%
% \end{macrocode}
% Nested more than one deep?
% \begin{macrocode}
-\ifthenelse{\cnttest{\value{LWR@lateximagedepth}}{>}{1}}%
+\LWR@traceinfo{lateximage: internal depth was \arabic{LWR@lateximagedepth}}%
+\ifnumcomp{\value{LWR@lateximagedepth}}{>}{1}%
% \end{macrocode}
-% If nesting inside an already-existing lateximage, simply record one more level:
+% If nesting inside an already existing lateximage, simply record one less level.
+% Uses a lower-level \TeX\ macro due to \AmS\ \cs{text} change of \cs{addtocounter}.
% \begin{macrocode}
-{\addtocounter{LWR@lateximagedepth}{-1}}%
+{%
+ \LWR@traceinfo{lateximage: unnesting}%
+ \global\advance\c@LWR@lateximagedepth -1\relax%
+}%
% \end{macrocode}
% If this is the outer-most lateximage:
% \begin{macrocode}
@@ -24244,6 +25025,7 @@ autopage-\theLWR@currentautosec%
% \end{macrocode}
% Finish the lateximage minipage and start a new \PDF\ page:
% \begin{macrocode}
+\LWR@traceinfo{lateximage: ending outer-most lateximage}%
\LWR@origendminipage%
\LWR@orignewpage%
\LWR@origscriptsize%
@@ -24264,14 +25046,14 @@ autopage-\theLWR@currentautosec%
{%
lateximages\OSPathSymbol%
\LWR@origmbox{\LWR@hashedname}%
- }{svg}{#3}%
+ }{svg}{#4}%
}% hash
{% no hash
\LWR@subinlineimage[#2]{lateximage}%
{%
lateximages\OSPathSymbol%
\LWR@origmbox{lateximage-\theLWR@externalfilecnt}%
- }{svg}{#3}%
+ }{svg}{#4}%
}% no hash
% \end{macrocode}
% Be sure that are doing a paragraph:
@@ -24284,12 +25066,13 @@ autopage-\theLWR@currentautosec%
\ifbool{HTMLDebugComments}{%
\LWR@htmlcomment{End of lateximage}%
}{}%
-% \LWR@orignewline% Removed to prevent extra space.
% \end{macrocode}
-% Undo one lateximage level:
+% Undo one lateximage level.
+% This is not inside an \AmS\ \cs{text}, so regular \cs{addtocounter} may be used here.
% \begin{macrocode}
\addtocounter{LWR@lateximagedepth}{-1}%
}% end of outer-most lateximage
+\LWR@traceinfo{lateximage: exiting depth is \arabic{LWR@lateximagedepth}}%
\LWR@traceinfo{lateximage: done}%
}%
\catcode`\$=3% math shift
@@ -24308,7 +25091,7 @@ autopage-\theLWR@currentautosec%
%
% \changes{v0.48}{2018/02/02}{Print mode boxed to natural width.}
% \begin{macrocode}
-\NewDocumentEnvironment{lateximage}{s o o}
+\NewDocumentEnvironment{lateximage}{s o o o}
{\begin{varwidth}[b]{\linewidth}}
{\end{varwidth}}
% \end{macrocode}
@@ -24467,14 +25250,14 @@ autopage-\theLWR@currentautosec%
\newrobustcmd{\LWR@siunitx@textdegree}{\HTMLentity{deg}}
\newrobustcmd{\LWR@siunitx@textprime}{\HTMLunicode{2032}}
\newrobustcmd{\LWR@siunitx@textdblprime}{\HTMLunicode{2033}}
-\newrobustcmd{\LWR@siunitx@textplanckbar}{\text{\HTMLunicode{0127}}}
+\newrobustcmd{\LWR@siunitx@textplanckbar}{\text{\textit{\HTMLunicode{0127}}}}
-\appto\LWR@restoreorigformatting{
-\renewrobustcmd{\LWR@siunitx@textcelsius}{\text{\ensuremath{^\circ}C}}
-\renewrobustcmd{\LWR@siunitx@textdegree}{\text{\ensuremath{^\circ}}}
-\renewrobustcmd{\LWR@siunitx@textprime}{\text{\ensuremath{^\prime}}}
-\renewrobustcmd{\LWR@siunitx@textdblprime}{\text{\ensuremath{^{\prime\prime}}}}
-\renewrobustcmd{\LWR@siunitx@textplanckbar}{\text{\ensuremath{\hbar}}}
+\appto\LWR@restoreorigformatting{%
+\renewrobustcmd{\LWR@siunitx@textcelsius}{\text{\ensuremath{^\circ}C}}%
+\renewrobustcmd{\LWR@siunitx@textdegree}{\text{\ensuremath{^\circ}}}%
+\renewrobustcmd{\LWR@siunitx@textprime}{\text{\ensuremath{^\prime}}}%
+\renewrobustcmd{\LWR@siunitx@textdblprime}{\text{\ensuremath{^{\prime\prime}}}}%
+\renewrobustcmd{\LWR@siunitx@textplanckbar}{\text{\ensuremath{\hbar}}}%
}
\PassOptionsToPackage{
@@ -24722,7 +25505,7 @@ autopage-\theLWR@currentautosec%
\LetLtxMacro\endfcolorminipage\endLWRprint@fcolorminipage%
}
-\appto{\LWR@restoreorigformatting}{%
+\appto\LWR@restoreorigformatting{%
\LWR@restoreorigprintxcolor%
}
% \end{macrocode}
@@ -24743,6 +25526,54 @@ autopage-\theLWR@currentautosec%
+% \section{Chemmacros environments}
+% \label{sec:chemmacrosprintenvs}
+%
+% \cs{makepolymerdelims} and redox reactions must be enclosed in a \env{lateximage}
+% during \HTML\ output.
+% These environments are provided here in print mode, and in the \pkg{chemmacros}
+% code in \HTML\ mode, as a high-level semantic syntax which automatically embeds the
+% contents in a \env{lateximage} with an appropriate \attribute{alt} tag.
+%
+% \codeprint
+%
+% \begin{macrocode}
+\begin{warpprint}
+% \end{macrocode}
+
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifpackageloaded{chemmacros}{
+% \end{macrocode}
+%
+% \begin{noindenvironment}{polymerdelims}
+% \begin{macrocode}
+\DeclareDocumentEnvironment{polymerdelims}{}
+ {}{}
+% \end{macrocode}
+% \end{noindenvironment}
+
+% \begin{noindenvironment}{redoxreaction} \marg{space above} \marg{space below}
+%
+% For print output, extra space is include above and below the image, and
+% a \env{lateximage} is not necessary.
+% This extra space must be enforced, even inside a float, so zero-width rules are used.
+%
+% For the \HTML\ version, see \cref{sec:chemmacroshtmlenvs}.
+% \begin{macrocode}
+\DeclareDocumentEnvironment{redoxreaction}{m m}
+ {\rule{0pt}{#1}}{\rule[-#2]{0pt}{#2}}
+% \end{macrocode}
+% \end{noindenvironment}
+%
+% \begin{macrocode}
+}{}% chemmacros
+}% AtBeginDocument
+% \end{macrocode}
+
+% \begin{macrocode}
+\end{warpprint}
+% \end{macrocode}
@@ -25837,7 +26668,7 @@ width:\LWR@printlength{\LWR@tempwidth}%
% \begin{macrocode}
\def\(##1\){}%
\def\[##1\]{}%
-\renewcommand{\LWR@subsingledollar}[2]{}
+\RenewDocumentCommand{\LWR@subsingledollar}{s m m m}{}
}
% \end{macrocode}
% \end{macro}
@@ -26028,6 +26859,50 @@ width:\LWR@printlength{\LWR@tempwidth}%
% \end{macro}
+% \begin{macro}{\LWR@currenttextcolor}
+% The color to use for text and \cs{rule}, defaulting to black:
+%
+% \changes{v0.36}{2017/08/16}{Fix for \cs{rule} when \pkg{xcolor} not loaded.}
+%
+% \begin{macrocode}
+\newcommand*{\LWR@currenttextcolor}{black}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LWR@tempcolor}
+% \begin{macro}{\LWR@tempcolortwo}
+% The color converted to \HTML\ colorspace.
+% \begin{macrocode}
+\newcommand*{\LWR@tempcolor}{}
+\newcommand*{\LWR@tempcolortwo}{}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\LWR@findcurrenttextcolor}
+% \changes{v0.51}{2018/03/14}{Added \cs{LWR@findcurrenttextcolor} when no \pkg{xcolor}.}
+% Sets \cs{LWR@tempcolor} to the current color.
+% \begin{macrocode}
+\newcommand*{\LWR@findcurrenttextcolor}{%
+\renewcommand{\LWR@tempcolor}{black}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\LWR@textcurrentcolor} \marg{text}
+% Like \cs{textcolor} but uses the current \cs{color} instead.
+% \changes{v0.51}{2018/03/11}{\pkg{xcolor}: \cs{LWR@textcurrentcolor} if \pkg{xcolor} not loaded.}
+% \begin{macrocode}
+\NewDocumentCommand{\LWR@textcurrentcolor}{m}{%
+ \renewcommand*{\LWR@currenttextcolor}{black}%
+ #1%
+}
+% \end{macrocode}
+% \end{macro}
+
+
% \begin{macrocode}
\end{warpHTML}
% \end{macrocode}
@@ -26388,17 +27263,6 @@ width:\LWR@printlength{\LWR@tempwidth}%
% \end{macro}
%
%
-% \begin{macro}{\LWR@currenttextcolor}
-% The color to use for text and \cs{rule}, defaulting to black:
-%
-% \changes{v0.36}{2017/08/16}{Fix for \cs{rule} when \pkg{xcolor} not loaded.}
-%
-% \begin{macrocode}
-\newcommand*{\LWR@currenttextcolor}{black}
-% \end{macrocode}
-% \end{macro}
-%
-%
%
%
% \begin{macro}{\LWR@rule} \oarg{raise} \marg{width} \marg{height}
@@ -27518,7 +28382,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
\LWR@traceinfo{Patching alltt.}
\AtBeginEnvironment{alltt}{%
\LWR@forcenewpage
-\LWR@atbeginverbatim{alltt}\unskip\LWR@origvspace*{-\baselineskip}%
+\LWR@atbeginverbatim{3.5}{alltt}%
}
\AfterEndEnvironment{alltt}{\unskip\LWR@origvspace*{-\baselineskip}\LWR@afterendverbatim}
}
@@ -27923,7 +28787,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
\let\LWR@origfirsthline\firsthline
\let\LWR@origlasthline\lasthline
-\appto{\LWR@restoreorigformatting}{%
+\appto\LWR@restoreorigformatting{%
\let\firsthline\LWR@origfirsthline%
\let\lasthline\LWR@origlasthline%
}
@@ -28065,7 +28929,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
% \end{macrocode}
% \begin{macrocode}
-\BeforeBeginEnvironment{axopicture}{\begin{lateximage}[axopicture]}
+\BeforeBeginEnvironment{axopicture}{\begin{lateximage}[(axopicture)]}
\AfterEndEnvironment{axopicture}{\end{lateximage}}
% \end{macrocode}
@@ -28213,7 +29077,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
% \end{macrocode}
% When entering a \env{lateximage}, restore the print-mode versions:
% \begin{macrocode}
-\appto{\LWR@restoreorigformatting}{%
+\appto\LWR@restoreorigformatting{%
\LetLtxMacro{\ldelim}{\LWR@origldelim}%
\LetLtxMacro{\rdelim}{\LWR@origrdelim}%
}
@@ -28255,7 +29119,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
\renewcommand\bigstrut[1][x]{}
-\appto{\LWR@restoreorigformatting}{%
+\appto\LWR@restoreorigformatting{%
\LetLtxMacro{\bigstrut}{\LWR@origbigstrut}%
}
% \end{macrocode}
@@ -28515,7 +29379,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
% \end{macrocode}
% \begin{macrocode}
-\BeforeBeginEnvironment{bytefield}{\begin{lateximage}[bytefield]}
+\BeforeBeginEnvironment{bytefield}{\begin{lateximage}[(bytefield)]}
\AfterEndEnvironment{bytefield}{\end{lateximage}}
% \end{macrocode}
@@ -28554,7 +29418,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
\LetLtxMacro\LWR@origbcancel\bcancel
\LetLtxMacro\LWR@origxcancel\xcancel
-\appto{\LWR@restoreorigformatting}{%
+\appto\LWR@restoreorigformatting{%
\LetLtxMacro\cancel\LWR@origcancel%
\LetLtxMacro\bcancel\LWR@origbcancel%
\LetLtxMacro\xcancel\LWR@origxcancel%
@@ -28570,7 +29434,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
\newcommand{\LWR@cancelcolor}[5]{%
\ifcsempty{#2}%
{\LWR@HTMLtextstyle{#5}{#3}{#1}}%
-{\LWR@htmlspanclass[#5;#4:\#\LWR@tempcolor]{#3}{#1}}%
+{\LWR@htmlspanclass[#5;#4:\LWR@origpound\LWR@tempcolor]{#3}{#1}}%
}
% \end{macrocode}
% \end{noindmacro}
@@ -29024,6 +29888,1548 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
%
%
% \iffalse
+%<*chemfig>
+% \fi
+%
+% \part{lwarp-chemfig.sty}
+
+% \section{chemfig}
+%
+% \credits{Christian Tellechea}
+%
+% \DescribePackage{chemfig}
+% \pkg{chemfig} is patched for use by \pkg{lwarp}.
+%
+% The images are not hashed because they depend on external settings which
+% may be changed at any time, and are unlikely to be reused inline anyhow.
+%
+% \changes{v0.51}{2018/03/04}{\pkg{chemfig}: Added.}
+%
+% \codehtml
+%
+% \begin{macrocode}
+\LWR@ProvidesPackagePass{chemfig}
+% \end{macrocode}
+
+% \begin{macrocode}
+\LetLtxMacro\LWR@chemfig@origchemfig\chemfig
+
+\DeclareDocumentCommand\chemfig{s O{} O{} m}{%
+ \begin{lateximage}[(chemfig)]%
+ \IfBooleanTF{#1}{%
+ \LWR@chemfig@origchemfig*[#2][#3]{#4}%
+ }{%
+ \LWR@chemfig@origchemfig[#2][#3]{#4}%
+ }
+ \end{lateximage}%
+}
+
+\LetLtxMacro\LWR@chemfig@origCF@lewis@b\CF@lewis@b
+
+\def\CF@lewis@b#1#2{%
+\begin{lateximage}[(chemfig)]%
+\LWR@chemfig@origCF@lewis@b{#1}{#2}%
+\end{lateximage}%
+}
+
+\preto{\schemestart}{\begin{lateximage}[(chemfig)]}
+\appto{\CF@schemestop}{\end{lateximage}}
+
+\LetLtxMacro\LWR@chemfig@origchemleft\chemleft
+
+\def\chemleft#1#2\chemright#3{%
+\begin{lateximage}[(chemfig)]%
+\LWR@chemfig@origchemleft#1#2\chemright#3%
+\end{lateximage}%
+}
+
+\LetLtxMacro\LWR@chemfig@origchemup\chemup
+
+\def\chemup#1#2\chemdown#3{%
+\begin{lateximage}[(chemfig)]%
+\LWR@chemfig@origchemup#1#2\chemdown#3%
+\end{lateximage}%
+}
+% \end{macrocode}
+
+% \iffalse
+%</chemfig>
+% \fi
+%
+%
+%
+% \iffalse
+%<*chemformula>
+% \fi
+%
+% \part{lwarp-chemformula.sty}
+
+% \section{chemformula}
+%
+% \credits{Clemens Niederberger}
+%
+% \DescribePackage{chemformula}
+% \pkg{chemformula} is patched for use by \pkg{lwarp}.
+%
+% The \SVG\ images are hashed according to contents and local options.
+% Global options are assumed to be constant document-wide.
+%
+% \limitschemformula
+%
+% \changes{v0.51}{2018/03/05}{\pkg{chemformula}: Added.}
+%
+% \codehtml
+%
+% \begin{macrocode}
+\LWR@ProvidesPackagePass{chemformula}[2017/03/23]
+% \end{macrocode}
+
+% \begin{macrocode}
+\ExplSyntaxOn
+% \end{macrocode}
+%
+% \begin{noindmacro}{\ch}
+% Enclose in an inline \SVG\ image or MathJax.
+% The \attribute{alt} tag is is the contents of the \cs{ch} expression.
+% The filename is hashed, and also has additional hashing information based on
+% the local options.
+% \begin{macrocode}
+\RenewDocumentCommand \ch { O{}m }
+ {%
+% \end{macrocode}
+% To work inside \env{align} with \cs{displaymathother}, a simple version
+% must be used to work with \pkg{chemformula}'s adaptation to \env{align}.
+% \begin{macrocode}
+ \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% lwarp
+ {
+ \chemformula_ch:nn {#1} {#2}% original
+ }
+% \end{macrocode}
+% If used as the outer level, must temporarily ensure \brand{MathJax} is disabled:
+% \begin{macrocode}
+ {
+ \begingroup%
+ \boolfalse{mathjax}%
+% \end{macrocode}
+% An inline image is used, adjusted for the baseline:
+% \begin{macrocode}
+ \LWR@subsingledollar*{% lwarp
+ \textbackslash{}ch\{\LWR@HTMLsanitize{#2}\}% alt text
+ }{%
+ \LWR@HTMLsanitize{#1}% add'l hashing
+ }%
+ {%
+ \chemformula_ch:nn {#1} {#2}% original
+ }%
+ \endgroup%
+ }
+ }
+% \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\chcpd}
+% Similar to \cs{ch}.
+% \begin{macrocode}
+\cs_gset_protected:Npn \chemformula_chcpd:nn #1#2
+ {
+ \begingroup%
+ \boolfalse{mathjax}%
+ \LWR@subsingledollar*{% lwarp
+ \textbackslash{}chcpd\{\LWR@HTMLsanitize{#2}\}%
+ }{%
+ \LWR@HTMLsanitize{#1}%
+ }{% original
+ \group_begin:
+ \tl_if_blank:nF {#2}
+ {
+ \keys_set:nn {chemformula} {#1}
+ \__chemformula_save_catcodes:
+ \__chemformula_sanitize:Nn
+ \l__chemformula_chemformula_tmpa_tl
+ {#2}
+ \__chemformula_input_compound_no_check:NV
+ \l__chemformula_compound_tl
+ \l__chemformula_chemformula_tmpa_tl
+ \__chemformula_prepare_output:N \l__chemformula_compound_tl
+ \chemformula_write:V \l__chemformula_compound_tl
+ }
+ \group_end:
+ }
+ \endgroup
+ }
+% \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\charrow}
+% If standalone, appears in a regular \env{lateximage}.
+% \begin{macrocode}
+\RenewDocumentCommand \charrow { mO{}O{} }
+{
+ \begin{lateximage}[(charrow)]
+ \group_begin:
+ \__chemformula_draw_arrow:nnn {#1} {#2} {#3}
+ \group_end:
+ \end{lateximage}
+}
+% \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\chname}
+% If standalone, appears in a regular \env{lateximage}, hashed according to contents.
+% \begin{macrocode}
+\RenewDocumentCommand \chname { R(){}R(){} }
+ {
+ \begin{lateximage}*[%
+ \textbackslash{}chname(\LWR@HTMLsanitize{#1})(\LWR@HTMLsanitize{#2})
+ ]%
+ \chemformula_chwritebelow:nn {#1} {#2}
+ \end{lateximage}
+ }
+% \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\chlewis}
+% Placed inline, hashed according to contents and options.
+% \begin{macrocode}
+\RenewDocumentCommand \chlewis { O{}mm }
+ {
+ \begingroup%
+ \boolfalse{mathjax}%
+ \LWR@subsingledollar*{\textbackslash{}chlewis\{#2\}\{#3\}}{#1}{
+ \chemformula_lewis:nnn {#1} {#2} {#3}
+ }
+ \endgroup%
+ }
+% \end{macrocode}
+% \end{noindmacro}
+%
+%
+% \pkg{lwarp} redefines the |$| character, so special handling is required
+% to escape math expressions inside \cs{ch}.
+%
+% This boolean tracks a new kind of escaped math:
+% \begin{macrocode}
+\bool_new:N \l__chemformula_first_last_LWRdollar_bool
+% \end{macrocode}
+%
+% \begin{noindmacro}{\chemformula\_input\_escape\_math} \\
+%
+% Adds additional escaping for the new dollar definition:
+% \begin{macrocode}
+\cs_gset_protected:Npn \__chemformula_input_escape_math:n #1
+ {
+ \__chemformula_first_last_math:n {#1}
+ \bool_if:NT \l__chemformula_first_last_dollar_bool
+ {
+ \bool_set_true:N \l__chemformula_first_last_math_bool
+ \__chemformula_read_escape_dollar:w #1 \q_nil
+ }
+ \bool_if:NT \l__chemformula_first_last_mathbraces_bool
+ {
+ \bool_set_true:N \l__chemformula_first_last_math_bool
+ \__chemformula_read_escape_mathbraces:w #1 \q_nil
+ }
+% \end{macrocode}
+% Added by \pkg{lwarp}:
+% \begin{macrocode}
+ \bool_if:NT \l__chemformula_first_last_LWRdollar_bool% lwarp
+ {
+ \bool_set_true:N \l__chemformula_first_last_math_bool% lwarp
+ \__chemformula_read_escape_LWRdollar:w #1 \q_nil% lwarp
+ }
+ }
+% \end{macrocode}
+% \end{noindmacro}
+%
+% \begin{noindmacro}{\chemformula\_read\_escape\_LWRdollar} \\
+%
+% The following parses the contents inside the new dollars.
+%
+% \pkg{lwarp} keeps the dollar as its original math shift until the document
+% starts.
+% While \pkg{chemmacros} is being patched, the dollar must temporarily
+% be set to its new meaning during the following definition.
+%
+% \begin{macrocode}
+\begingroup
+\catcode`\$=\active
+
+\cs_new_protected:Npn \__chemformula_read_escape_LWRdollar:w $#1$ \q_nil
+{
+ \__chemformula_read_escape_math:n {#1}
+}
+
+\endgroup
+% \end{macrocode}
+% \end{noindmacro}
+%
+%
+% \begin{noindmacro}{\chemformula\_bool\_set\_if\_first\_last} \\
+%
+% The following looks at the first and last tokens for delimiters to escape
+% math inside \cs{ch}.
+% The original definition is modified to look for the
+% control sequences which are used by the new meaning of |$|.
+% \begin{macrocode}
+\cs_new_protected:Npn \__chemformula_bool_cs_set_if_first_last:NnNN #1#2#3#4
+ {
+ \int_zero:N \l__chemformula_tmpa_int
+ \int_zero:N \l__chemformula_tmpb_int
+ \int_set:Nn \l__chemformula_tmpa_int { \tl_count:n {#2} }
+ \tl_map_inline:nn {#2}
+ {
+ \int_incr:N \l__chemformula_tmpb_int
+ \int_compare:nT { \l__chemformula_tmpb_int = 1 }
+ {
+% \end{macrocode}
+% At the start, the |cs_| version compares control sequences:
+% \begin{macrocode}
+ \ifdefstrequal{##1}{#3}% lwarp
+ {
+ \bool_set_true:N #1
+ }% lwarp
+ {}
+ }
+% \end{macrocode}
+% At the end, compare more control sequences:
+% \begin{macrocode}
+ \int_compare:nT { \l__chemformula_tmpb_int = \l__chemformula_tmpa_int }
+ {
+ \ifdefstrequal{##1}{#4}
+ {}
+ {
+ \bool_set_false:N #1
+ }
+ }
+ }
+ }
+% \end{macrocode}
+% \end{noindmacro}
+%
+%
+% \begin{noindmacro}{\chemformula\_first\_last\_math} \\
+%
+% Modified to check for the new meaning of |$| at first/last:
+% \begin{macrocode}
+\cs_gset_protected:Npn \__chemformula_first_last_math:n #1
+ {
+ \bool_set_false:N \l__chemformula_first_last_math_bool
+ \bool_set_false:N \l__chemformula_first_last_dollar_bool
+ \bool_set_false:N \l__chemformula_first_last_LWRdollar_bool% lwarp
+ \bool_set_false:N \l__chemformula_first_last_mathbraces_bool
+ \__chemformula_bool_set_if_first_last:Nnnn
+ \l__chemformula_first_last_dollar_bool
+ {#1}
+ { $ } { $ }
+ \bool_if:NF \l__chemformula_first_last_dollar_bool
+ {
+ \__chemformula_bool_set_if_first_last:Nnnn
+ \l__chemformula_first_last_mathbraces_bool
+ {#1}
+ { \( } { \) }
+% \end{macrocode}
+% Added by \pkg{lwarp}:
+% \begin{macrocode}
+ \bool_if:NF \l__chemformula_first_last_mathbraces_bool% lwarp
+ {
+ \__chemformula_bool_cs_set_if_first_last:NnNN
+ \l__chemformula_first_last_LWRdollar_bool
+ {#1}
+ { \LWR@newsingledollar } { \LWR@newsingledollar }
+ }% lwarp
+ }
+ }
+% \end{macrocode}
+% \end{noindmacro}
+%
+%
+% \begin{macrocode}
+\ExplSyntaxOff
+% \end{macrocode}
+%
+% \iffalse
+%</chemformula>
+% \fi
+%
+%
+%
+% \iffalse
+%<*chemgreek>
+% \fi
+%
+% \part{lwarp-chemgreek.sty}
+
+% \section{chemgreek}
+%
+% \credits{Clemens Niederberger}
+%
+% \DescribePackage{chemgreek}
+% \pkg{chemgreek} is patched for use by \pkg{lwarp}.
+%
+% To use text-mode symbols, \margintag{Greek symbols}
+% use packages \pkg{textalpha} or \pkg{textgreek}.
+% Using the other packages supported by \pkg{chemgreek} \watchout[package selection]
+% will result in math-mode greek characters,
+% which will result in \SVG\ images being used.
+% These images will be hashed.
+% \index{chemistry>Greek symbols}
+% \index{Greek>chemistry symbols}
+%
+% If using \XeLaTeX\ or \LuaLaTeX, select the |fontspec| mapping:\watchout[\XeLaTeX, \LuaLaTeX]
+% \begin{sourcedisplay}
+% \cs{selectchemgreekmapping}\{fontspec\}
+% \end{sourcedisplay}
+%
+%
+% \changes{v0.51}{2018/03/08}{\pkg{chemgreek}: Added.}
+%
+% \codehtml
+%
+% \begin{macrocode}
+\LWR@ProvidesPackagePass{chemgreek}[2016/02/10]
+% \end{macrocode}
+
+% \begin{macrocode}
+\ExplSyntaxOn
+
+\cs_undefine:N \chemgreek_text:n
+
+\cs_new_protected:Npn \chemgreek_text:n #1
+ { { \text {#1} } }
+
+\appto\LWR@restoreorigformatting{%
+\cs_set_protected:Npn \chemgreek_text:n #1%
+ { \ensuremath { \text {#1} } }%
+}
+
+\ExplSyntaxOff
+% \end{macrocode}
+
+% \iffalse
+%</chemgreek>
+% \fi
+%
+%
+%
+%
+% \iffalse
+%<*chemmacros>
+% \fi
+%
+% \part{lwarp-chemmacros.sty}
+
+% \section{chemmacros}
+%
+% \credits{Clemens Niederberger}
+%
+% \DescribePackage{chemmacros}
+% \pkg{chemmacros} is patched for use by \pkg{lwarp}.
+%
+% \changes{v0.51}{2018/03/13}{\pkg{chemmacros}: Added.}
+%
+% \codehtml
+%
+% \begin{macrocode}
+\LWR@ProvidesPackagePass{chemmacros}
+% \end{macrocode}
+%
+% SVG file hashing assumes that the relevent options are constant for the entire document.
+%
+% \subsection{Changes to the user's document}
+%
+% When using \cs{makepolymerdelims}, \watchout[\cs{makepolymerdelims}]
+% enclose the entire expression inside a \env{polymerdelims} environment,
+% such as (from the \pkg{chemmacros} manual):
+%
+% \begin{Verbatim}[gobble=2]
+% \begin{polymerdelims}
+% \chemfig{-[@{op,.75}]CH_2-CH(-[6]Cl)-[@{cl,0.25}]}
+% \makepolymerdelims{5pt}[27pt]{op}{cl}
+% \end{polymerdelims}
+% \end{Verbatim}
+%
+% \hrule
+%
+% Redox reactions must be enclosed inside
+% a \env{redoxreaction} environment. \watchout[redox reactions]
+% For print output, extra space must be included above and/or below the result,
+% so they are declared as arguments to the environment, instead of
+% being manually entered as per the \pkg{chemmacros} manual.
+% For \HTML\ output, the extra space is ignored and a \env{lateximage} is used instead.
+% \begin{Verbatim}[gobble=2]
+% \begin{redoxreaction}{7mm}{7mm}
+% \OX{a,Na} $\rightarrow$ \OX{b,Na}\pch\redox(a,b){oxidation}
+% \end{redoxreaction}
+% \end{Verbatim}
+%
+% \subsection{Code}
+%
+%
+% \subsection{Loading modules}
+%
+% Patching \pkg{chemmacros} modules must be done \cs{AtBeginDocument},
+% since modules are invoked by the user in the preamble, and each patch is
+% only done if the module is loaded.
+%
+% \begin{macrocode}
+\ExplSyntaxOn
+
+\newcommand{\@ifchemmacrosmoduleloaded}[1]{%
+\@ifl@aded{\c__chemmacros_module_extension_tl}{\c__chemmacros_module_prefix_tl.#1}%
+}
+
+\ExplSyntaxOff
+% \end{macrocode}
+%
+%
+% \subsection{New environments}
+% \label{sec:chemmacroshtmlenvs}
+%
+% \cs{makepolymerdelims} and redox reactions must be enclosed in a \env{lateximage}
+% during \HTML\ output.
+% These environments are provided here in \HTML\ mode, and in the \pkg{lwarp} core
+% in print mode, as a high-level semantic syntax which automatically embeds the
+% contents in a \env{lateximage} with an appropriate \attribute{alt} tag.
+%
+% \begin{noindenvironment}{polymerdelims}
+% \begin{macrocode}
+\DeclareDocumentEnvironment{polymerdelims}{}
+{\begin{lateximage}[(polymer)]}
+{\end{lateximage}}
+% \end{macrocode}
+% \end{noindenvironment}
+
+% \begin{noindenvironment}{redoxreaction} \marg{space above} \marg{space below}
+%
+% For \HTML\ output, the above and below space is ignored, and a \env{lateximage}
+% is used instead.
+% For the print output version, see \cref{sec:chemmacrosprintenvs}.
+% \begin{macrocode}
+\DeclareDocumentEnvironment{redoxreaction}{m m}
+{\begin{lateximage}[(redox~reaction)]}
+{\end{lateximage}}
+% \end{macrocode}
+% \end{noindenvironment}
+%
+%
+% \begin{macrocode}
+\ExplSyntaxOn
+% \end{macrocode}
+%
+%
+% \subsection{Acid-base}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{acid-base}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~acid-base}
+
+\cs_gset_protected:Npn \chemmacros_p:n #1
+ {
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{
+ \textbackslash{}p\{\LWR@HTMLsanitize{#1}\}
+ }{
+ chemmacrosp\LWR@HTMLsanitize{#1}
+ }{
+ \group_begin:
+ \mbox
+ {
+ \chemmacros_p_style:n {p}
+ \ensuremath {#1}
+ }
+ \group_end:
+ }
+ \endgroup
+ }
+
+\RenewDocumentCommand \pH {} {
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}pH}{chemmacros}{
+ \chemmacros_p:n { \chemmacros_chemformula:n {H} }
+ }
+ \endgroup
+}
+
+\RenewDocumentCommand \pOH {} {
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}pOH}{chemmacros}{
+ \chemmacros_p:n { \chemmacros_chemformula:n {OH} }
+ }
+ \endgroup
+}
+
+\RenewDocumentCommand \pKa {O{}}
+ {
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}pKa{[}#1{]}}{chemmacros #1}{
+ \chemmacros_p:n
+ {
+ \Ka \ifblank {#1} {}
+ { {} \c_math_subscript_token { \chemmacros_bold:n {#1} } }
+ }
+ }
+ \endgroup
+ }
+
+\RenewDocumentCommand \pKb {O{}}
+ {
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}pKb{[}#1{]}}{chemmacros #1}{
+ \chemmacros_p:n
+ {
+ \Kb \ifblank {#1} {}
+ { {} \c_math_subscript_token { \chemmacros_bold:n {#1} } }
+ }
+ }
+ \endgroup
+ }
+
+\LetLtxMacro\LWR@chemmacros@origKa\Ka
+\renewcommand*{\Ka}{%
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}Ka}{chemmacros}{%
+ \LWR@chemmacros@origKa%
+ }%
+ \endgroup
+}
+
+\LetLtxMacro\LWR@chemmacros@origKb\Kb
+\renewcommand*{\Kb}{%
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}Kb}{chemmacros}{%
+ \LWR@chemmacros@origKb%
+ }%
+ \endgroup
+}
+
+\LetLtxMacro\LWR@chemmacros@origKw\Kw
+\renewcommand*{\Kw}{%
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}Kw}{chemmacros}{
+ \LWR@chemmacros@origKw
+ }
+ \endgroup
+}
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+%
+% \subsection{Charges}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{charges}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~charges}
+
+\cs_gset_protected:Npn \fplus {
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}fplus}{chemmacros}
+ { \LWR@origensuredmath{\chemformula_fplus:} }
+ \endgroup
+}
+\cs_gset_protected:Npn \fminus {
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}fminus}{chemmacros}
+ { \LWR@origensuredmath{\chemformula_fminus:} }
+ \endgroup
+}
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+%
+% \subsection{Nomenclature}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{nomenclature}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~nomenclature}
+
+\cs_gset_protected:Npn \chemmacros_charge:n #1
+ {
+ \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}
+ {\chemmacros_chemformula:n { {}^{#1} }}
+ {
+ \ifmmode
+ {\chemmacros_chemformula:n { {}^{#1} }}
+ \else
+ { \textsuperscript{\ensuremath{#1}} }
+ \fi
+ }
+ }
+
+
+\LetLtxMacro\LWR@chemmacros@origchemprime\chemprime
+
+\protected\def\chemprime { \HTMLunicode{2032} }
+
+\appto\LWR@restoreorigformatting{%
+\LetLtxMacro\chemprime\LWR@chemmacros@origchemprime%
+}
+% \end{macrocode}
+%
+% ^^A \RenewChemIUPAC \chemprime { \HTMLunicode{2032} }
+%
+% \begin{macrocode}
+\ChemCompatibilityFrom{5.8}
+\cs_gset_protected:Npn \__chemmacros_cip:n #1
+ {
+ \tl_set:Nn \l__chemmacros_tmpa_tl {#1}
+ \int_step_inline:nnnn {0} {1} {9}
+ {
+ \tl_replace_all:Nnn \l__chemmacros_tmpa_tl
+ {##1}
+ { { \l__chemmacros_cip_number_tl ##1} }
+ }
+ {
+ \l__chemmacros_cip_inner_tl
+ \LWR@textcurrentcolor{\LWR@textcurrentfont{% lwarp
+ \l__chemmacros_tmpa_tl
+ }}% lwarp
+ }
+ }
+\EndChemCompatibility
+% \end{macrocode}
+%
+% \begin{macrocode}
+\RenewDocumentCommand \Sconf { O{S} } {
+\begin{lateximage}[\textbackslash{}Sconf{[}#1{]}]
+ \chemmacros_sconf:n {#1}
+\end{lateximage}
+}
+
+\RenewDocumentCommand \Rconf { O{R} } {
+\begin{lateximage}[\textbackslash{}Rconf{[}#1{]}]
+ \chemmacros_rconf:n {#1}
+\end{lateximage}
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_gset_protected:Npn \chemmacros_hapto:n #1
+ {
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}hapto\{#1\}}{chemmacros}{
+ \chemmacros_coordination_symbol:nnnn
+ { \l__chemmacros_coord_use_hyphen_bool }
+ {
+ \chemmacros_if_compatibility:nnTF {>} {5.7}
+ { \c_true_bool }
+ { \c_false_bool }
+ }
+ { \chemeta }
+ {#1}
+ }
+ \endgroup
+ }
+
+\cs_gset_protected:Npn \chemmacros_dento:n #1
+ {
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}dento\{#1\}}{chemmacros}{
+ \chemmacros_coordination_symbol:nnnn
+ { \l__chemmacros_coord_use_hyphen_bool }
+ {
+ \chemmacros_if_compatibility:nnTF {>} {5.7}
+ { \c_true_bool }
+ { \c_false_bool }
+ }
+ { \chemkappa }
+ {#1}
+ }
+ \endgroup
+ }
+
+\cs_gset_protected:Npn \chemmacros_bridge:n #1
+ {
+ \begingroup
+ \boolfalse{mathjax}
+ \LWR@subsingledollar*{\textbackslash{}bridge\{#1\}}{chemmacros}{
+ \chemmacros_coordination_symbol:nnnn
+ { \l__chemmacros_coord_use_hyphen_bool }
+ { \l__chemmacros_bridge_super_bool }
+ { \chemmu }
+ {#1}
+ }
+ \endgroup
+ }
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+%
+% \subsection{Particles}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{particles}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~particles}
+
+\cs_gset_protected:Npn \chemmacros_declare_nucleophile:Nn #1#2
+ {
+ \cs_set_protected:cpn {__chemmacros_ \chemmacros_remove_backslash:N #1:}
+ {
+ \bool_if:NTF \l__chemmacros_nucleophile_elpair_bool
+ {
+ \chemmacros_elpair:n { #2 }
+ \chemmacros_if_compatibility:nnT {>=} {5.3}
+ { \skip_horizontal:N \l__chemmacros_nucleophile_dim }
+ \chemmacros_chemformula:n { {}^{-} }
+ }
+ { \chemmacros_chemformula:n { #2^{-} } }
+ }
+ \DeclareDocumentCommand #1 {o}
+ {%
+ \begin{lateximage}%
+ \group_begin:%
+ \IfNoValueF {##1}%
+ { \chemmacros_set_keys:nn {particles} {##1} }%
+ \use:c {__chemmacros_ \chemmacros_remove_backslash:N #1:}%
+ \group_end:%
+ \end{lateximage}%
+ }
+ }
+
+\RenewChemNucleophile \Nuc {Nu}
+\RenewChemNucleophile \ba {ba}
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+%
+% \subsection{Phases}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{phases}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~phases}
+
+\cs_undefine:N \chemmacros_phase:n
+\cs_new_protected:Npn \chemmacros_phase:n #1
+ {
+ \chemmacros_leave_vmode:
+ \bool_if:NTF \l__chemmacros_phases_sub_bool
+ {
+ \ifnumequal{\value{LWR@lateximagedepth}}{0}
+ {
+ \textsubscript{ (#1) }
+ }
+ {
+ \chemformula_subscript:n { (#1) }
+ }
+ }
+ {
+ \skip_horizontal:N \l__chemmacros_phases_space_dim
+ \chemmacros_text:n { (#1) }
+ }
+ }
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+% \subsection{Mechanisms}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{mechanisms}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~mechanisms}
+
+\chemmacros_define_keys:nn {textmechanisms}
+ {
+ type .choice: ,
+ type / .code:n =
+ {
+ \__chemmacros_set_mechanisms:nnn { S }
+ {
+ \textsubscript{N}
+ }
+ { }
+ } ,
+ type / 1 .code:n =
+ {
+ \__chemmacros_set_mechanisms:nnn { S }
+ {
+ \textsubscript{N}
+ 1
+ }
+ { }
+ } ,
+ type / 2 .code:n =
+ {
+ \__chemmacros_set_mechanisms:nnn { S }
+ {
+ \textsubscript{N}
+ 2
+ }
+ { }
+ } ,
+ type / se .code:n =
+ {
+ \__chemmacros_set_mechanisms:nnn { S }
+ {
+ \textsubscript{E}
+ }
+ { }
+ } ,
+ type / 1e .code:n =
+ {
+ \__chemmacros_set_mechanisms:nnn { S }
+ {
+ \textsubscript{E}
+ 1
+ }
+ { }
+ } ,
+ type / 2e .code:n =
+ {
+ \__chemmacros_set_mechanisms:nnn { S }
+ {
+ \textsubscript{E}
+ 2
+ }
+ { }
+ } ,
+ type / ar .code:n =
+ {
+ \__chemmacros_set_mechanisms:nnn { S }
+ {
+ \textsubscript{E}
+ }
+ { Ar - }
+ } ,
+ type / e .code:n =
+ { \__chemmacros_set_mechanisms:nnn { E } { } { } } ,
+ type / e1 .code:n =
+ { \__chemmacros_set_mechanisms:nnn { E } { 1 } { } } ,
+ type / e2 .code:n =
+ { \__chemmacros_set_mechanisms:nnn { E } { 2 } { } } ,
+ type / cb .code:n =
+ {
+ \__chemmacros_set_mechanisms:nnn { E }
+ {
+ 1
+ \textsubscript{cb}
+ }
+ { }
+ } ,
+ type .default:n =
+ }
+
+\cs_gset_protected:Npn \chemmacros_mechanisms:n #1
+ {
+ \tl_if_blank:nTF {#1}
+ { \chemmacros_set_keys:nn {textmechanisms} { type } }
+ { \chemmacros_set_keys:nn {textmechanisms} { type = #1 } }
+ \mbox
+ {
+ \tl_use:N \l__chemmacros_mechanisms_ar_tl
+ \tl_use:N \l__chemmacros_mechanisms_type_tl
+ \tl_use:N \l__chemmacros_mechanisms_mol_tl
+ }
+ }
+
+\appto\LWR@restoreorigformatting{%
+\cs_set_protected:Npn \chemmacros_mechanisms:n #1%
+ {%
+ \tl_if_blank:nTF {#1}%
+ { \chemmacros_set_keys:nn {mechanisms} { type } }%
+ { \chemmacros_set_keys:nn {mechanisms} { type = #1 } }%
+ \mbox%
+ {%
+ \tl_use:N \l__chemmacros_mechanisms_ar_tl%
+ \tl_use:N \l__chemmacros_mechanisms_type_tl%
+ \tl_use:N \l__chemmacros_mechanisms_mol_tl%
+ }%
+ }%
+}
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+% \subsection{Newman}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{newman}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~newman}
+
+\RenewDocumentCommand \newman {od()m}%
+ {
+ \IfValueTF{#2}
+ {\begin{lateximage}[\textbackslash{}newman(#2)\{#3\}]}
+ {\begin{lateximage}[\textbackslash{}newman\{#3\}]}
+ \group_begin:
+ \IfNoValueF {#1} { \chemmacros_set_keys:nn {newman} {#1} }
+ \IfNoValueTF {#2}
+ { \chemmacros_newman:nn { } {#3} }
+ { \chemmacros_newman:nn {#2} {#3} }
+ \group_end:
+ \end{lateximage}
+ }%
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+% \subsection{Orbital}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{orbital}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~orbital}
+
+\RenewDocumentCommand \orbital {om}
+ {
+ \IfValueTF{#1}
+ {
+ \begin{lateximage}[%
+ \textbackslash{}orbital{[}\LWR@HTMLsanitize{#1}{]}\{#2\}%
+ ][][margin-left: 1em ; margin-right: 1em]
+ }
+ {
+ \begin{lateximage}[%
+ \textbackslash{}orbital\{#2\}%
+ ][][margin-left: 1em ; margin-right: 1em]
+ }
+ \group_begin:
+ \chemmacros_set_keys:nn {orbital/type} {#2}
+ \IfNoValueTF {#1}
+ { \chemmacros_orbital:n { } }
+ { \chemmacros_orbital:n {#1} }
+ \group_end:
+ \end{lateximage}
+ }
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+%
+% \subsection{Reactions}
+%
+% \begin{noindmacro}{\chemmacros\_declare\_reaction\_env} \\
+% \hspace*{2em} \marg{chem} \marg{math} \marg{args number} \marg{argument list (\{\#2\}\{\#3\}...)}
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{reactions}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~orbital}
+
+\cs_gset_protected:Npn \chemmacros_declare_reaction_env:nnnn #1#2#3#4
+ {
+ \exp_args:Nnx \DeclareDocumentEnvironment {#1} { O{} \prg_replicate:nn {#3+0} {m} }
+ {
+ \boolfalse{mathjax}% lwarp
+ \chemmacros_add_reaction_description:n {##1}
+ \__chemmacros_begin_reaction:
+ \chemmacros_reaction_read:nnw {#2} {#4}
+ }
+ {
+ \__chemmacros_end_reaction:
+ }
+ }
+\cs_generate_variant:Nn \chemmacros_declare_reaction_env:nnnn {nnnV}
+
+\RenewChemReaction {reaction} {equation}
+\RenewChemReaction {reaction*} {equation*}
+\RenewChemReaction {reactions} {align}
+\RenewChemReaction {reactions*} {align*}
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+% \end{noindmacro}
+%
+%
+% \subsection{Redox}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{redox}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~redox}
+
+\NewDocumentCommand \LWR@chemmacros@ox { s m >{\SplitArgument{1}{,}}m }
+ {
+ \IfBooleanTF {#1}
+ { \chemmacros_ox:nnnn {#1} {#2} #3 }
+ { \chemmacros_ox:nnnn { } {#2} #3 }
+ }
+
+\RenewDocumentCommand \ox { s O{} m }
+ {
+ \begingroup
+ \boolfalse{mathjax}
+ \IfBooleanTF {#1}
+ {
+ \LWR@subsingledollar*{% yes hash
+ \textbackslash{}ox*\{\LWR@HTMLsanitize{#3}\}% alt
+ }{%
+ star \LWR@HTMLsanitize{#2}% addl' hashing with star
+ }{%
+ \LWR@chemmacros@ox* {#2} {#3}% contents
+ }%
+ }
+ {
+ \LWR@subsingledollar*{% yes hash
+ \textbackslash{}ox*\{\LWR@HTMLsanitize{#3}\}% alt
+ }{%
+ \LWR@HTMLsanitize{#2}% addl' hashing without star
+ }{%
+ \LWR@chemmacros@ox {#2} {#3}% contents
+ }%
+ }
+ \endgroup
+ }
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+% \subsection{Scheme}
+%
+% Bug fix for \pkg{chemmacros} when using \pkg{newfloat}:
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{scheme}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~scheme}
+
+\ifdefstring{\schemename}{los}{
+\SetupFloatingEnvironment{scheme}{
+name = \chemmacros_translate:n {scheme-name}
+}
+}{}
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+% \subsection{Spectroscopy}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{spectroscopy}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~spectroscopy}
+
+\ChemCompatibilityTo{5.8}
+\cs_gset_protected:Npn \__chemmacros_nmr_base:nn #1#2
+ {
+ \tl_if_blank:VF \g__chemmacros_nmr_element_coupled_tl
+ {
+ \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl { \{ }
+ \tl_put_right:Nn \g__chemmacros_nmr_element_coupled_tl { \} }
+ }
+ \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl {#2}
+% \chemmacros_chemformula:n { ^{#1} }
+ \textsuperscript{#1}
+ \bool_if:NTF \l__chemmacros_nmr_parse_bool
+ { \chemformula_ch:nV {} \g__chemmacros_nmr_element_coupled_tl }
+ { \chemmacros_chemformula:V \g__chemmacros_nmr_element_coupled_tl }
+ \tl_use:N \l__chemmacros_nmr_element_method_connector_tl
+ \tl_use:N \l__chemmacros_nmr_method_tl
+ }
+\EndChemCompatibility
+\ChemCompatibilityFrom{5.8}
+\cs_gset_protected:Npn \__chemmacros_nmr_base:nn #1#2
+ {
+ \group_begin:
+ \tl_use:N \l__chemmacros_nmr_base_format_tl
+ \tl_if_blank:VF \g__chemmacros_nmr_element_coupled_tl
+ {
+ \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl { \{ }
+ \tl_put_right:Nn \g__chemmacros_nmr_element_coupled_tl { \} }
+ }
+ \tl_put_left:Nn \g__chemmacros_nmr_element_coupled_tl {#2}
+% \chemmacros_chemformula:n { ^{#1} }
+ \textsuperscript{#1}
+ \tl_if_blank:VF \g__chemmacros_nmr_element_coupled_tl
+ {
+ \bool_if:NTF \l__chemmacros_nmr_parse_bool
+ { \chemformula_ch:nV {} \g__chemmacros_nmr_element_coupled_tl }
+ { \chemmacros_chemformula:V \g__chemmacros_nmr_element_coupled_tl }
+ }
+ \tl_use:N \l__chemmacros_nmr_element_method_connector_tl
+ \tl_use:N \l__chemmacros_nmr_method_tl
+ \group_end:
+ }
+\EndChemCompatibility
+
+
+\cs_gset_protected:Npn \chemmacros_nmr_position:n #1
+ {
+ \chemmacros_chemformula:x
+ {
+ \exp_not:V \g__chemmacros_nmr_element_tl
+ \bool_if:NF \l__chemmacros_nmr_position_side_bool
+ {
+ \tl_if_eq:NnTF \l__chemmacros_nmr_position_tl {^}% lwarp
+ { \textsuperscript{\exp_not:n { {#1} }} }% lwarp
+ { \textsubscript{\exp_not:n { {#1} }} }% lwarp
+% \exp_not:V \l__chemmacros_nmr_position_tl
+% \exp_not:n { {#1} }
+ }
+ }
+ \bool_if:NT \l__chemmacros_nmr_position_side_bool
+ {
+ \tl_use:N \l__chemmacros_nmr_position_tl
+ \__chemmacros_nmr_position:n {#1}
+ }
+ }
+
+\cs_gset_protected:Npn \__chemmacros_nmr_coupling:w (#1;#2)
+ {
+ \tl_set:Nn \l__chemmacros_nmr_coupling_bonds_tl
+ {
+ \l__chemmacros_nmr_coupling_bonds_pre_tl
+ #1
+ \l__chemmacros_nmr_coupling_bonds_post_tl
+ }
+ \bool_if:NTF \l__chemmacros_nmr_coupling_nuclei_sub_bool
+ {
+ \tl_set:Nn \l__chemmacros_nmr_coupling_nuclei_tl
+ {
+% \c_math_subscript_token
+ \textsubscript% lwarp
+ {
+ \l__chemmacros_nmr_coupling_nuclei_pre_tl
+ \chemmacros_chemformula:n {#2}
+ \l__chemmacros_nmr_coupling_nuclei_post_tl
+ }
+ }
+ }
+ {
+ \tl_set:Nn \l__chemmacros_nmr_coupling_nuclei_tl
+ {
+ \l__chemmacros_nmr_coupling_nuclei_pre_tl
+ \chemmacros_chemformula:n {#2}
+ \l__chemmacros_nmr_coupling_nuclei_post_tl
+ }
+ }
+ \__chemmacros_nmr_coupling_aux_i:w
+ }
+
+\AfterEndPreamble{% After \AtBeginDocument
+% \NMR{<num>,<elem>}(<num>,<unit>)[<solvent>] ALL arguments are optional
+% \NMR* same but without ": $\delta$" at end
+\cs_gset_protected:Npn \chemmacros_nmr:nnnn #1#2#3#4
+ {
+ \bool_if:NT \l__chemmacros_nmr_list_bool { \item \scan_stop: }
+ \group_begin:
+ \chemmacros_leave_vmode:
+ \bool_set_false:N \l__chemmacros_nmr_frequency_bool
+ \bool_set_false:N \l__chemmacros_nmr_solvent_bool
+ \tl_if_empty:nF {#3}
+ { \bool_set_true:N \l__chemmacros_nmr_frequency_bool }
+ \tl_if_empty:nF {#4}
+ { \bool_set_true:N \l__chemmacros_nmr_solvent_bool }
+ \bool_if:nT
+ {
+ \l__chemmacros_nmr_frequency_bool
+ ||
+ \l__chemmacros_nmr_solvent_bool
+ }
+ { \bool_set_true:N \l__chemmacros_nmr_delimiters_bool }
+ \bool_if:nT
+ {
+ \l__chemmacros_nmr_frequency_bool
+ &&
+ \l__chemmacros_nmr_solvent_bool
+ }
+ { \bool_set_true:N \l__chemmacros_nmr_comma_bool }
+ \tl_if_empty:nTF {#2}
+ {
+ \__chemmacros_nmr_nucleus:VV
+ \l__chemmacros_nmr_isotope_default_tl
+ \l__chemmacros_nmr_element_default_tl
+ }
+ { \__chemmacros_nmr_nucleus:w #2 \q_stop }
+ \mode_if_math:TF
+ {
+ \text
+ {
+ \group_begin:
+ \tl_use:N \l__chemmacros_nmr_format_tl
+\LWR@textcurrentcolor{\LWR@textcurrentfont{% lwarp
+ \__chemmacros_nmr_base:VV
+ \g__chemmacros_nmr_isotope_tl
+ \g__chemmacros_nmr_element_tl
+ \bool_if:NT \l__chemmacros_nmr_delimiters_bool
+ { ~ ( }
+ \bool_if:NT \l__chemmacros_nmr_frequency_bool
+ { \__chemmacros_nmr_frequency:n {#3} }
+ \bool_if:NT \l__chemmacros_nmr_comma_bool
+ { , ~ }
+ \bool_if:NT \l__chemmacros_nmr_solvent_bool
+ { \chemmacros_chemformula:n {#4} }
+ \bool_if:NT \l__chemmacros_nmr_delimiters_bool
+ { ) }
+ \tl_if_blank:nT {#1} {:~}
+}}% lwarp
+ \group_end:
+ }
+ \tl_if_blank:nT {#1}
+ {
+ \delta
+ \text { \l__chemmacros_nmr_delta_tl }
+ \bool_if:NT \l__chemmacros_nmr_use_equal_bool {=}
+ }
+ }
+ {
+ \group_begin:
+ \tl_use:N \l__chemmacros_nmr_format_tl
+\LWR@textcurrentcolor{\LWR@textcurrentfont{% lwarp
+ \__chemmacros_nmr_base:VV
+ \g__chemmacros_nmr_isotope_tl
+ \g__chemmacros_nmr_element_tl
+ \bool_if:NT \l__chemmacros_nmr_delimiters_bool
+ {~(}
+ \bool_if:NT \l__chemmacros_nmr_frequency_bool
+ { \__chemmacros_nmr_frequency:n {#3} }
+ \bool_if:NT \l__chemmacros_nmr_comma_bool
+ {,~}
+ \bool_if:NT \l__chemmacros_nmr_solvent_bool
+ {
+ \bool_if:NTF \l__chemmacros_nmr_parse_bool
+ { \chemformula_ch:nn { } {#4} }
+ {#4}
+ }
+ \bool_if:NT \l__chemmacros_nmr_delimiters_bool
+ {)}
+}}% lwarp
+ \tl_if_blank:nT {#1} {:}
+ \group_end:
+ \tl_if_blank:nT {#1}
+ {
+ \tl_use:N \c_space_tl
+ \c_math_toggle_token
+ \delta
+ \c_math_toggle_token
+ \l__chemmacros_nmr_delta_tl
+ \bool_if:NT \l__chemmacros_nmr_use_equal_bool {~=}
+ }
+ }
+ \group_end:
+ }
+}% AfterEndPremble
+
+
+\RenewDocumentCommand \chemmacros_data:w { smo }
+ {
+ \bool_if:NT \l__chemmacros_nmr_list_bool { \item }
+ {
+% \tl_use:N \l__chemmacros_nmr_format_tl #2
+ \tl_use:N \l__chemmacros_nmr_format_tl
+ \LWR@textcurrentcolor{\LWR@textcurrentfont{% lwarp
+ #2
+ \IfNoValueF {#3} { ~ ( #3 ) }
+ \IfBooleanT {#1} { \bool_if:NT \l__chemmacros_nmr_use_equal_bool { : } }
+ }}% lwarp
+ }
+ \IfBooleanF {#1} { \bool_if:NT \l__chemmacros_nmr_use_equal_bool { ~ = } }
+ }
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+% \subsection{Thermodynamics}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifchemmacrosmoduleloaded{thermodynamics}{
+\PackageInfo{lwarp}{Patching~chemmacros~module~thermodynamics}
+
+\cs_gset_protected:Npn \chemmacros_state:nn #1#2
+ {
+ \group_begin:
+ \boolfalse{mathjax}
+ \chemmacros_set_keys:nn {thermodynamics} {#1}
+ \LWR@subsingledollar*{% yes hashing
+ \textbackslash{}state\{\LWR@HTMLsanitize{#2}\}% alt
+ }{%
+ chemmacros_state% add'l hashing
+ #1% options
+ LSP \tl_use:N \l__chemmacros_state_sp_left_tl% super/subscripts
+ LSB \tl_use:N \l__chemmacros_state_sb_left_tl
+ RSP \tl_use:N \l__chemmacros_state_sp_right_tl
+ RSB \tl_use:N \l__chemmacros_state_sb_right_tl
+ }
+ {
+ \LWR@origensuredmath{
+ \chemmacros_text:V \l__chemmacros_state_pre_tl
+ \c_math_superscript_token
+ { \chemmacros_text:V \l__chemmacros_state_sp_left_tl }
+% \end{macrocode}
+% Only add the subscripts if they are being used.
+% This avoids causing an incorrect depth, as the empty subscript will be
+% measured by \TeX\ but cropped out by \prog{pdfcrop}.
+% \begin{macrocode}
+ \tl_if_empty:NTF \l__chemmacros_state_sb_left_tl
+ {}
+ {
+ \c_math_subscript_token
+ { \chemmacros_text:V \l__chemmacros_state_sb_left_tl }
+ }
+ #2
+ \c_math_superscript_token
+ { \chemmacros_text:V \l__chemmacros_state_sp_right_tl }
+ \tl_if_empty:NTF \l__chemmacros_state_sb_right_tl
+ {}
+ {
+ \c_math_subscript_token
+ { \chemmacros_text:V \l__chemmacros_state_sb_right_tl }
+ }
+ \chemmacros_text:V \l__chemmacros_state_post_tl
+ }
+ }
+ \group_end:
+ }
+\cs_generate_variant:Nn \chemmacros_state:nn { nV }
+
+\cs_gset_protected:Npn \chemmacros_declare_state:Nn #1#2
+ {
+ \chemmacros_define_keys:xn
+ {thermodynamics/\chemmacros_remove_backslash:N #1}
+ {
+ pre .meta:nn = {chemmacros/thermodynamics} { pre = ##1 } ,
+ post .meta:nn = {chemmacros/thermodynamics} { post = ##1 } ,
+ superscript-left .meta:nn = {chemmacros/thermodynamics} { superscript-left = ##1 } ,
+ superscript-right .meta:nn = {chemmacros/thermodynamics} { superscript-right = ##1 } ,
+ superscript .meta:n = { superscript-right = ##1 } ,
+ subscript-left .meta:nn = {chemmacros/thermodynamics} { subscript-left = ##1 } ,
+ subscript-right .meta:nn = {chemmacros/thermodynamics} { subscript-right = ##1 } ,
+ subscript .meta:n = { subscript-left = ##1 } ,
+ subscript-pos .choices:nn =
+ { left , right }
+ { \tl_set_eq:NN \l__chemmacros_state_sb_pos_tl \l_keys_choice_tl } ,
+ symbol .tl_set:N = \l__chemmacros_state_symbol_tl ,
+ unit .tl_set:N = \l__chemmacros_state_unit_tl
+ }
+ \DeclareDocumentCommand #1 { sO{}D(){}m }
+ {
+ \group_begin:
+ \chemmacros_set_keys:xn
+ {thermodynamics/\chemmacros_remove_backslash:N #1}
+ {#2}
+ \tl_if_blank:nF {##3}
+ {
+ \chemmacros_set_keys:nx {thermodynamics}
+ { subscript-\l__chemmacros_state_sb_pos_tl = \exp_not:n {##3} }
+ }
+ \chemmacros_state:nV {##2} \l__chemmacros_state_symbol_tl
+ \chemmacros_set_keys_groups:nnn {thermodynamics} {variables} {##2}
+ \IfBooleanF {##1} { = ~ \SI {##4} { \l__chemmacros_state_unit_tl } }
+ \group_end:
+ }
+ }
+% \end{macrocode}
+%
+% The pre-existing macros are redefined with the new definition:
+% \begin{macrocode}
+\RenewChemState \enthalpy { symbol = H , unit = \kilo\joule\per\mole }
+\RenewChemState \entropy { symbol = S , unit = \joule\per\kelvin\per\mole , pre = }
+\RenewChemState \gibbs { symbol = G , unit = \kilo\joule\per\mole }
+
+}{}% \@ifchemmacrosmoduleloaded
+}% AtBeginDocument
+% \end{macrocode}
+%
+% \begin{macrocode}
+\ExplSyntaxOff
+% \end{macrocode}
+
+% \iffalse
+%</chemmacros>
+% \fi
+%
+%
+%
+%
+% \iffalse
+%<*chemnum>
+% \fi
+%
+% \part{lwarp-chemnum.sty}
+
+% \section{chemnum}
+%
+% \credits{Clemens Niederberger}
+%
+% \DescribePackage{chemnum}
+% \pkg{chemnum} is patched for use by \pkg{lwarp}.
+%
+% \changes{v0.51}{2018/03/04}{\pkg{chemnum}: Added.}
+%
+% \codehtml
+%
+% \begin{macrocode}
+\LWR@ProvidesPackagePass{chemnum}
+% \end{macrocode}
+
+% \begin{macrocode}
+\ExplSyntaxOn
+
+\cs_undefine:N \chemnum_compound_write:n
+\cs_new_protected:Npn \chemnum_compound_write:n #1
+ {
+ \chemnum_get_compound_property:nn {#1} {pre-main-label-code}
+ \group_begin:
+ \bool_if:NTF \l__chemnum_compound_local_bool
+ { \l__chemnum_local_label_format_tl }
+ { \chemnum_get_compound_property:nn {#1} {label-format} }
+ {
+ \LWR@textcurrentfont{
+ \chemnum_get_compound_property:nn {#1} {counter-representation}
+ }
+ }
+ \group_end:
+ \chemnum_get_compound_property:nn {#1} {post-main-label-code}
+ }
+
+\cs_undefine:N \chemnum_subcompound_write:nn
+\cs_new_protected:Npn \chemnum_subcompound_write:nn #1#2
+ {
+ \group_begin:
+ \bool_if:NTF \l__chemnum_compound_local_bool
+ { \l__chemnum_local_label_format_tl }
+ { \chemnum_get_compound_property:nn {#1} {label-format} }
+ {
+ \LWR@textcurrentfont{
+ \chemnum_get_subcompound_property:nnn {#1} {#2}
+ {counter-representation}
+ }
+ }
+ \group_end:
+ }
+
+\ExplSyntaxOff
+% \end{macrocode}
+
+% \iffalse
+%</chemnum>
+% \fi
+%
+%
+%
+%
+% \iffalse
%<*cite>
% \fi
%
@@ -29128,12 +31534,12 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
\LetLtxMacro\LWR@origarrayrulecolor\arrayrulecolor
\LetLtxMacro\LWR@origdoublerulesepcolor\doublerulesepcolor
-\appto{\LWR@restoreorigformatting}{%
-\LetLtxMacro\columncolor\LWR@origcolumncolor
-\LetLtxMacro\rowcolor\LWR@origrowcolor
-\LetLtxMacro\cellcolor\LWR@origcellcolor
-\LetLtxMacro\arrayrulecolor\LWR@origarrayrulecolor
-\LetLtxMacro\doublerulesepcolor\LWR@origdoublerulesepcolor
+\appto\LWR@restoreorigformatting{%
+\LetLtxMacro\columncolor\LWR@origcolumncolor%
+\LetLtxMacro\rowcolor\LWR@origrowcolor%
+\LetLtxMacro\cellcolor\LWR@origcellcolor%
+\LetLtxMacro\arrayrulecolor\LWR@origarrayrulecolor%
+\LetLtxMacro\doublerulesepcolor\LWR@origdoublerulesepcolor%
}
% \end{macrocode}
@@ -29499,9 +31905,9 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
\LetLtxMacro\LWR@origdiagbox@double\diagbox@double
\LetLtxMacro\LWR@origdiagbox@triple\diagbox@triple
-\appto\LWR@restoreorigformatting{
-\LetLtxMacro\diagbox@double\LWR@origdiagbox@double
-\LetLtxMacro\diagbox@triple\LWR@origdiagbox@triple
+\appto\LWR@restoreorigformatting{%
+\LetLtxMacro\diagbox@double\LWR@origdiagbox@double%
+\LetLtxMacro\diagbox@triple\LWR@origdiagbox@triple%
}
% \end{macrocode}
@@ -30148,9 +32554,9 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
% \end{macrocode}
%
% \begin{macrocode}
-\newcommand*{\epstopdfsetup}[1]{}
-\newcommand*{\epstopdfcall}[1]{}
-\newcommand*{\epstopdfDeclareGraphicsRule}[4]{}
+\providecommand*{\epstopdfsetup}[1]{}
+\providecommand*{\epstopdfcall}[1]{}
+\providecommand*{\epstopdfDeclareGraphicsRule}[4]{}
% \end{macrocode}
%
% \iffalse
@@ -30159,6 +32565,39 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
%
%
%
+% \iffalse
+%<*epstopdf-base>
+% \fi
+%
+% \part{lwarp-epstopdf-base.sty}
+%
+% \section{epstopdf-base}
+%
+% \DescribePackage{epstopdf-base}
+% \pkg{epstopdf-base} is ignored.
+%
+% Filenames should be used without a suffix so that
+% \SVG, \PNG, or \JPG\ versions of the file will be used for \HTML\ output.
+%
+% \changes{v0.51}{2018/03/03}{\pkg{epstopdf-base}: Added.}
+%
+% \codehtml
+%
+% \begin{macrocode}
+\LWR@ProvidesPackageDrop{epstopdf-base}[2016/05/15]
+% \end{macrocode}
+%
+% \begin{macrocode}
+\providecommand*{\epstopdfsetup}[1]{}
+\providecommand*{\epstopdfcall}[1]{}
+\providecommand*{\epstopdfDeclareGraphicsRule}[4]{}
+% \end{macrocode}
+%
+% \iffalse
+%</epstopdf-base>
+% \fi
+%
+%
%
%
% \iffalse
@@ -30416,20 +32855,28 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
}
% \end{macrocode}
%
-% \env{Btrivlist} is enclosed in an \HTML\ block:
+% \env{Btrivlist} is enclosed in an \HTML\ block.
+% This is a tabular, and does not use \cs{item}.
%
+% \begin{noindmacro}{Btrivlist} \marg{l/c/r} \oarg{t/c/b}
% \begin{macrocode}
\RenewDocumentEnvironment{Btrivlist}{m o}
-{\begin{BlockClass}{Btrivlist}\tabular{#1}}
-{\endtabular\end{BlockClass}}
+{%
+ \begin{BlockClass}{Btrivlist}%
+ \tabular{#1}%
+}
+{%
+ \endtabular%
+ \end{BlockClass}%
+}
% \end{macrocode}
+% \end{noindmacro}
%
% \env{Btrivlist} is also neutralized when used inside a span:
%
% \begin{macrocode}
\AtBeginEnvironment{LWR@nestspan}{%
\RenewDocumentEnvironment{Btrivlist}{m o}{}{}%
-\RenewDocumentCommand{\LWR@origitem}{d()}{\LWRFB@origitem}%
}
% \end{macrocode}
%
@@ -30439,10 +32886,30 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
% \begin{macrocode}
\let\LWRFB@origitemizeitem\LWR@itemizeitem
\let\LWRFB@origdescitem\LWR@descitem
-\LetLtxMacro{\LWRFB@origitem}{\LWR@origitem}
-\RenewDocumentCommand{\LWR@itemizeitem}{d()}{\LWRFB@origitemizeitem}
-\RenewDocumentCommand{\LWR@descitem}{d()}{\LWRFB@origdescitem}
+\RenewDocumentCommand{\LWR@itemizeitem}{d()o}{%
+ \IfValueTF{#2}{%
+ \LWRFB@origitemizeitem[#2]%
+ }{%
+ \LWRFB@origitemizeitem%
+ }%
+}
+
+\RenewDocumentCommand{\LWR@descitem}{d()o}{%
+ \IfValueTF{#2}{%
+ \LWRFB@origdescitem[#2]~%
+ }{%
+ \LWRFB@origdescitem%
+ }%
+}
+% \end{macrocode}
+%
+% \changes{v0.51}{2018/03/17}{\pkg{fancybox}: Fix: Optional tag for \cs{item} in a span.}
+% \begin{macrocode}
+\RenewDocumentCommand{\LWR@nestspanitem}{d()}{%
+\if@newlist\else{\LWR@htmltagc{br /}}\fi%
+\LWR@origitem%
+}
% \end{macrocode}
%
% The various boxed lists become regular lists:
@@ -30482,7 +32949,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
% \begin{macrocode}
\let\LWRFB@UseVerbatim\UseVerbatim
\renewcommand*{\UseVerbatim}[1]{%
-\LWR@atbeginverbatim{Verbatim}\unskip\LWR@origvspace*{-.5\baselineskip}%%
+\LWR@atbeginverbatim{3.5}{Verbatim}%
\LWRFB@UseVerbatim{#1}%
\LWR@afterendverbatim%
}
@@ -30490,14 +32957,14 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
\let\LWRFB@LUseVerbatim\LUseVerbatim
\renewcommand*{\LUseVerbatim}[1]{%
-\LWR@atbeginverbatim{LVerbatim}%\unskip\LWR@origvspace*{-\baselineskip}%%
+\LWR@atbeginverbatim{3.5}{LVerbatim}%
\noindent%
\LWRFB@LUseVerbatim{#1}%
\LWR@afterendverbatim%
}
\def\@BUseVerbatim[#1]#2{%
-\LWR@atbeginverbatim{BVerbatim}\unskip\LWR@origvspace*{-.5\baselineskip}%%
+\LWR@atbeginverbatim{3.5}{BVerbatim}%
\LWRFB@UseVerbatim{#2}%
\LWR@afterendverbatim%
}
@@ -30747,7 +33214,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
% Adds \HTML\ formatting:
% \begin{macrocode}
\def\FV@BUseVerbatim#1{%
- \LWR@atbeginverbatim[\LWR@FVstyle]{verbatim}%
+ \LWR@atbeginverbatim[\LWR@FVstyle]{.5}{verbatim}%
\FV@BVerbatimBegin#1\FV@BVerbatimEnd%
\LWR@afterendverbatim%
}
@@ -30767,7 +33234,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
\newcommand*{\LWR@fvstartnone}{%
\LWR@traceinfo{fvstartnone}%
% \hbox to\z@{
-\LWR@atbeginverbatim[\LWR@FVstyle]{verbatim}%
+\LWR@atbeginverbatim[\LWR@FVstyle]{.5}{verbatim}%
% }%
}
@@ -30820,7 +33287,8 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"%
\newcommand*{\LWR@FVborderstyle}[1]{%
padding#1: \strip@pt\dimexpr \FV@FrameSep\relax\relax pt ; %
\LWR@FVfindbordercolor %
-border#1: \strip@pt\dimexpr \FV@FrameRule\relax\relax pt solid \#\LWR@tempcolor ; %
+border#1: \strip@pt\dimexpr \FV@FrameRule\relax\relax pt %
+solid \LWR@origpound\LWR@tempcolor ; %
}
\def\FV@Frame@none{%
@@ -30899,7 +33367,10 @@ border#1: \strip@pt\dimexpr \FV@FrameRule\relax\relax pt solid \#\LWR@tempcolor
\ifx\FV@LabelPositionTopLine\relax
\else
\LWR@FVfindbordercolor
- \LWR@htmltagc{div class="fancyvrblabel" style="color: \#\LWR@tempcolor"}
+ \LWR@htmltagc{%
+ div class="fancyvrblabel" % extra space
+ style="color: \LWR@origpound\LWR@tempcolor"%
+ }
\LWR@origtextrm{\FV@LabelBegin}% \textrm preserves emdash
\LWR@htmltagc{/div}
\fi
@@ -30909,7 +33380,10 @@ border#1: \strip@pt\dimexpr \FV@FrameRule\relax\relax pt solid \#\LWR@tempcolor
\else
\LWR@FVfindbordercolor
- \LWR@htmltagc{div class="fancyvrblabel" style="color: \#\LWR@tempcolor"}
+ \LWR@htmltagc{%
+ div class="fancyvrblabel" % extra space
+ style="color: \LWR@origpound\LWR@tempcolor"%
+ }
\LWR@origtextrm{\FV@LabelEnd}
\LWR@htmltagc{/div}
\fi
@@ -30945,7 +33419,7 @@ border#1: \strip@pt\dimexpr \FV@FrameRule\relax\relax pt solid \#\LWR@tempcolor
\AtBeginEnvironment{BVerbatim}
{%
\LWR@forcenewpage% instead of \preto
-\LWR@atbeginverbatim{bverbatim}%
+\LWR@atbeginverbatim{0}{bverbatim}%
}
\AfterEndEnvironment{BVerbatim}
@@ -32299,14 +34773,14 @@ border#1: \strip@pt\dimexpr \FV@FrameRule\relax\relax pt solid \#\LWR@tempcolor
\renewenvironment{shaded}{%
\convertcolorspec{named}{shadecolor}{HTML}\LWR@tempcolor%
\LWR@forcenewpage
-\BlockClass[background: \#\LWR@tempcolor]{shaded}%
+\BlockClass[background: \LWR@origpound\LWR@tempcolor]{shaded}%
}
{\endBlockClass}
\renewenvironment{shaded*}{%
\convertcolorspec{named}{shadecolor}{HTML}\LWR@tempcolor%
\LWR@forcenewpage
-\BlockClass[background: \#\LWR@tempcolor]{shaded}%
+\BlockClass[background: \LWR@origpound\LWR@tempcolor]{shaded}%
}
{\endBlockClass}
@@ -32323,14 +34797,14 @@ border#1: \strip@pt\dimexpr \FV@FrameRule\relax\relax pt solid \#\LWR@tempcolor
\renewenvironment{snugshade}{%
\convertcolorspec{named}{shadecolor}{HTML}\LWR@tempcolor%
\LWR@forcenewpage
-\BlockClass[background: \#\LWR@tempcolor]{snugframed}%
+\BlockClass[background: \LWR@origpound\LWR@tempcolor]{snugframed}%
}
{\endBlockClass}
\renewenvironment{snugshade*}{%
\convertcolorspec{named}{shadecolor}{HTML}\LWR@tempcolor%
\LWR@forcenewpage
-\BlockClass[background: \#\LWR@tempcolor]{snugframed}%
+\BlockClass[background: \LWR@origpound\LWR@tempcolor]{snugframed}%
}
{\endBlockClass}
@@ -32352,9 +34826,9 @@ border#1: \strip@pt\dimexpr \FV@FrameRule\relax\relax pt solid \#\LWR@tempcolor
\renewcommand{\CustomFBox}[7]{%
\convertcolorspec{named}{TFFrameColor}{HTML}\LWR@tempcolor%
\LWR@forcenewpage
-\begin{BlockClass}[border: 3px solid \#\LWR@tempcolor]{framed}%
+\begin{BlockClass}[border: 3px solid \LWR@origpound\LWR@tempcolor]{framed}%
\ifthenelse{\isempty{#1}}{}{% not empty
- \begin{BlockClass}[background: \#\LWR@tempcolor]{framedtitle}%
+ \begin{BlockClass}[background: \LWR@origpound\LWR@tempcolor]{framedtitle}%
\textcolor{TFTitleColor}{\textbf{#1}}%
\end{BlockClass}
}% not empty
@@ -32363,7 +34837,7 @@ border#1: \strip@pt\dimexpr \FV@FrameRule\relax\relax pt solid \#\LWR@tempcolor
\ifthenelse{\isempty{#2}}{}{% not empty
\convertcolorspec{named}{TFFrameColor}{HTML}\LWR@tempcolor%
- \begin{BlockClass}[background: \#\LWR@tempcolor]{framedtitle}%
+ \begin{BlockClass}[background: \LWR@origpound\LWR@tempcolor]{framedtitle}%
\textcolor{TFTitleColor}{\textbf{#2}}%
\end{BlockClass}
}% not empty
@@ -33356,6 +35830,38 @@ img src="%
%
%
%
+%
+%
+% \iffalse
+%<*grid>
+% \fi
+%
+% \part{lwarp-grid.sty}
+%
+% \section{grid}
+%
+% \DescribePackage{grid}
+% \pkg{grid} is ignored.
+%
+% \changes{v0.51}{2018/03/08}{\pkg{grid}: Added.}
+%
+% \codehtml
+%
+% \begin{macrocode}
+\LWR@ProvidesPackageDrop{grid}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newenvironment*{gridenv}{}{}
+% \end{macrocode}
+%
+% \iffalse
+%</grid>
+% \fi
+%
+%
+%
+%
% \iffalse
%<*hang>
% \fi
@@ -34048,15 +36554,15 @@ img src="%
\renewrobustcmd{\colonhyp}{:}
\renewrobustcmd{\hyp}{-}
-\appto\LWR@restoreorigformatting{
-\LetLtxMacro\textnhtt\LWRHYNAT@origtextnhtt
-\LetLtxMacro\nhttfamily\LWRHYNAT@orignhttfamily
-\LetLtxMacro\nohyphens\LWRHYNAT@orignohyphens
-\LetLtxMacro\bshyp\LWRHYNAT@origbshyp
-\LetLtxMacro\fshyp\LWRHYNAT@origfshyp
-\LetLtxMacro\dothyp\LWRHYNAT@origdothyp
-\LetLtxMacro\colonhyp\LWRHYNAT@origcolonhyp
-\LetLtxMacro\hyp\LWRHYNAT@orighyp
+\appto\LWR@restoreorigformatting{%
+\LetLtxMacro\textnhtt\LWRHYNAT@origtextnhtt%
+\LetLtxMacro\nhttfamily\LWRHYNAT@orignhttfamily%
+\LetLtxMacro\nohyphens\LWRHYNAT@orignohyphens%
+\LetLtxMacro\bshyp\LWRHYNAT@origbshyp%
+\LetLtxMacro\fshyp\LWRHYNAT@origfshyp%
+\LetLtxMacro\dothyp\LWRHYNAT@origdothyp%
+\LetLtxMacro\colonhyp\LWRHYNAT@origcolonhyp%
+\LetLtxMacro\hyp\LWRHYNAT@orighyp%
}
% \end{macrocode}
%
@@ -34818,11 +37324,23 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}%
% \begin{macrocode}
\renewcommand{\lst@Init}[1]{%
% \end{macrocode}
+%
% First, perform the \pkg{listings} initialization:
+%
+% \changes{v0.51}{2018/03/17}{\pkg{listings}: Forces cleared options.}
% \begin{macrocode}
\LWR@traceinfo{lst@Init}%
\renewcommand*{\@captype}{lstlisting}%
-\LWR@origlst@Init{#1}%
+\let\lst@aboveskip\z@\let\lst@belowskip\z@%
+\gdef\lst@boxpos{t}%
+\let\lst@frame\@empty
+ \let\lst@frametshape\@empty
+ \let\lst@framershape\@empty
+ \let\lst@framebshape\@empty
+ \let\lst@framelshape\@empty
+\lstframe@\lst@frameround ffff\relax%
+\lst@multicols\@empty%
+\LWR@origlst@Init{#1}\relax%
\LWR@traceinfo{finished origlst@Init}%
\lst@ifdisplaystyle%
% \end{macrocode}
@@ -34835,7 +37353,7 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}%
\LWR@traceinfo{About to create verbatim.}%
\let\lsthk@EveryPar\relax%
\LWR@forcenewpage
-\LWR@atbeginverbatim{programlisting}%
+\LWR@atbeginverbatim{2.5}{programlisting}%
\let\lsthk@EveryPar\LWR@origlsthkEveryPar%
\else%
@@ -35177,6 +37695,42 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}%
%
%
%
+%
+%
+% \iffalse
+%<*ltxgrid>
+% \fi
+%
+% \part{lwarp-ltxgrid.sty}
+%
+% \section{ltxgrid}
+%
+% \DescribePackage{ltxgrid}
+% \pkg{ltxgrid} is ignored.
+%
+% \changes{v0.51}{2018/03/08}{\pkg{ltxgrid}: Added.}
+%
+% \codehtml
+%
+% \begin{macrocode}
+\LWR@ProvidesPackageDrop{ltxgrid}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand*{\onecolumngrid}{}
+\newcommand*{\twocolumngrid}{}
+\newcommand*{\removestuff}{}
+\newcommand*{\addstuff}[2]{}
+\newcommand*{\replacestuff}[2]{}
+% \end{macrocode}
+%
+% \iffalse
+%</ltxgrid>
+% \fi
+%
+%
+%
+%
% \iffalse
%<*ltxtable>
% \fi
@@ -35356,7 +37910,7 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}%
\DeclareDocumentCommand{\todonotes@textmark@highlight}{m}{%
-\InlineClass[background:\#B3FFB3]{highlight}{#1}%
+\InlineClass[background:\LWR@origpound{}B3FFB3]{highlight}{#1}%
}
\fi% \if@todonotes@disabled
@@ -35634,7 +38188,7 @@ endinnercode={\LWR@stoppars},
% \begin{macrocode}
\newcommand*{\LWR@mdfprintcolor}[1]{%
\convertcolorspec{named}{\csuse{mdf@#1}}{HTML}\LWR@tempcolor%
-\#\LWR@tempcolor
+\LWR@origpound\LWR@tempcolor
}
% \end{macrocode}
% \end{noindmacro}
@@ -36195,6 +38749,154 @@ background:
%
%
%
+% \iffalse
+%<*mhchem>
+% \fi
+%
+% \part{lwarp-mhchem.sty}
+
+% \section{mhchem}
+% \label{sec:mhchem}
+%
+% \credits{Martin Hensel}
+%
+% \DescribePackage{mhchem}
+% \pkg{mhchem} is patched for use by \pkg{lwarp}.
+%
+% \pkg{mhchem} expressions are converted to \SVG\ math.
+% Inline expressions use hashed filenames to allow reuse,
+% and assume that any \pkg{mhchem} options are global.
+%
+% The \brand{MathJax} \pkg{mhchem} extension is not yet used.
+% \watchout[\brand{MathJax} and \pkg{mhchem}]
+% If \brand{MathJax} is used for math in the rest of the document,
+% \pkg{lwarp} converts standalone \pkg{mhchem}
+% expressions into \SVG\ math images, but expressions inside math
+% must be placed between \cs{displaymathother} and \cs{displaymathnormal}:
+% \begin{sourcedisplay}
+% \cs{displaymathother} \\
+% \cs{[} \cs{ce}\{ \dots\ \} \cs{]} \qquad \dots \qquad \$ \cs{ce} \{ \dots\ \} \$ \\
+% \cs{displaymathnormal}
+% \end{sourcedisplay}
+%
+% When producing \HTML\ output, \pkg{lwarp} does not support \watchout[nested math]
+% the use of nested dollar signs in \pkg{mhchem} expressions.
+% \index{mhchem>troubleshooting}
+% \index{array>and mhchem}
+% \index{math>and mhchem}
+%
+% For some examples from the \pkg{mhchem} manual, change as follows:
+% \begin{Verbatim}[gobble=2,frame=leftline, xleftmargin=.5in,obeytabs,tabsize=4]
+% $\ce{NaOH(aq,$\infty$)}$ % old
+% $\ce{NaOH(aq,\infty)}$ % new
+%
+% $\ce{Fe(CN)_{$\frac{6}{2}}$}$ % old
+% $\ce{Fe(CN)_{\frac{6}{2}}}$ % new
+%
+% $\ce{NO_$x$}$ % old
+% $\ce{NO_x}$ % new
+%
+% $\ce{NO_${x}$}$ % old
+% $\ce{NO_{x}}$ % new
+%
+% $\ce{$cis${-}[PtCl2(NH3)2]}$ % old
+% $\ce{\mathit{cis}{-}[PtCl2(NH3)2]}$ % new
+% \end{Verbatim}
+%
+% \changes{v0.51}{2018/03/04}{\pkg{mhchem}: Added.}
+%
+% \codehtml
+%
+% \begin{macrocode}
+\LWR@ProvidesPackagePass{mhchem}
+% \end{macrocode}
+
+% The original definition of \cs{ce}:
+% \begin{macrocode}
+\LetLtxMacro\LWR@mhchem@origce\ce
+% \end{macrocode}
+
+% The new definition, called from the new \cs{ce} after math shift is set.
+% The starred \env{lateximage} uses a hashed filename for the \SVG\ image.
+% The \attribute{alt} tag is set to the \pkg{mhchem} expression.
+% \begin{macrocode}
+\newcommand{\LWR@mhchem@HTML@ce}[1]{%
+\begin{lateximage}*[\textbackslash{}ce\{\LWR@HTMLsanitize{#1}\}]%
+\LWR@mhchem@origce{#1}%
+\end{lateximage}%
+\endgroup%
+\addtocounter{LWR@mhchem@cedepth}{-1}%
+}
+% \end{macrocode}
+
+% Only set math shift if outer depth:
+% \begin{macrocode}
+\newcounter{LWR@mhchem@cedepth}
+\setcounter{LWR@mhchem@cedepth}{0}
+% \end{macrocode}
+
+% The new \cs{ce}. Sets math shift then continues.
+% \begin{macrocode}
+\renewcommand{\ce}{%
+\begingroup%
+\ifnumequal{\value{LWR@mhchem@cedepth}}{0}{%
+ \catcode`\$=3% math shift
+}{}%
+\addtocounter{LWR@mhchem@cedepth}{1}%
+\LWR@mhchem@HTML@ce%
+}
+% \end{macrocode}
+
+% The original definition of \cs{cesplit}:
+% \begin{macrocode}
+\LetLtxMacro\LWR@mhchem@origcesplit\cesplit
+% \end{macrocode}
+
+% The new definition, called from the new \cs{cesplit} after math shift is set.
+% The starred \env{lateximage} uses a hashed filename for the \SVG\ image.
+% The \attribute{alt} tag is set to the \pkg{mhchem} expression.
+% \begin{macrocode}
+\newcommand*{\LWR@mhchem@HTML@cesplit}[2]
+{%
+\begin{lateximage}*[\textbackslash{}cesplit\{\LWR@HTMLsanitize{#2}\}]%
+\LWR@mhchem@origcesplit{#1}{#2}%
+\end{lateximage}%
+\endgroup%
+}
+% \end{macrocode}
+
+% Only set math shift if outer depth:
+% \begin{macrocode}
+\newcounter{LWR@mhchem@cesplitdepth}
+\setcounter{LWR@mhchem@cesplitdepth}{0}
+% \end{macrocode}
+
+% The new \cs{cesplit}. Sets math shift then continues.
+% \begin{macrocode}
+\renewcommand{\cesplit}{%
+\begingroup%
+\ifnumequal{\value{LWR@mhchem@cesplitdepth}}{0}{%
+ \catcode`\$=3% math shift
+}{}%
+\addtocounter{LWR@mhchem@cesplitdepth}{1}%
+\LWR@mhchem@HTML@cesplit%
+}
+% \end{macrocode}
+
+% Resore originals inside a \env{lateximage}:
+% \begin{macrocode}
+\appto\LWR@restoreorigformatting{%
+\LetLtxMacro\ce\LWR@mhchem@origce%
+\LetLtxMacro\cesplit\LWR@mhchem@origcesplit%
+}
+% \end{macrocode}
+
+% \iffalse
+%</mhchem>
+% \fi
+%
+%
+%
%
%
%
@@ -36383,7 +39085,7 @@ background:
% \begin{macrocode}
\BeforeBeginEnvironment{verbatimtab}{%
\LWR@forcenewpage
-\LWR@atbeginverbatim{Verbatim}\unskip\LWR@origvspace*{-\baselineskip}%
+\LWR@atbeginverbatim{3.5}{Verbatim}%
}
\AfterEndEnvironment{verbatimtab}{%
\LWR@afterendverbatim%
@@ -36394,14 +39096,14 @@ background:
\renewcommand{\@verbatimtabinput}[2][]{%
\LWR@forcenewpage
-\LWR@atbeginverbatim{Verbatim}\unskip\LWR@origvspace*{-\baselineskip}%
+\LWR@atbeginverbatim{3.5}{Verbatim}%
\LWRMV@orig@verbatimtabinput[#1]{#2}%
\LWR@afterendverbatim%
}
\BeforeBeginEnvironment{listing}{%
\LWR@forcenewpage
-\LWR@atbeginverbatim{programlisting}\unskip\LWR@origvspace*{-\baselineskip}%
+\LWR@atbeginverbatim{3.5}{programlisting}%
}
\AfterEndEnvironment{listing}{%
@@ -36411,7 +39113,7 @@ background:
\BeforeBeginEnvironment{listingcont}{%
\LWR@forcenewpage
-\LWR@atbeginverbatim{programlisting}\unskip\LWR@origvspace*{-\baselineskip}%
+\LWR@atbeginverbatim{3.5}{programlisting}%
}
\AfterEndEnvironment{listingcont}{%
@@ -36445,7 +39147,7 @@ background:
\renewcommand{\@listinginput}[3][]{
\LWR@forcenewpage
-\LWR@atbeginverbatim{programlisting}\unskip\LWR@origvspace*{-\baselineskip}%
+\LWR@atbeginverbatim{3.5}{programlisting}%
\LWRMV@@listinginput[#1]{#2}{#3}
\LWR@afterendverbatim%
}
@@ -36454,7 +39156,7 @@ background:
\renewenvironment*{boxedverbatim}
{
\LWR@forcenewpage
-\LWR@atbeginverbatim{boxedverbatim}\unskip\LWR@origvspace*{-2\baselineskip}%
+\LWR@atbeginverbatim{3.5}{boxedverbatim}%
\verbatim%
}
{
@@ -36785,7 +39487,7 @@ class="td%
%
%
% \begin{macrocode}
-\appto{\LWR@restoreorigformatting}{%
+\appto\LWR@restoreorigformatting{%
\LetLtxMacro\multirow\LWR@origmultirow%
\renewcommand{\multicolumnrow}{\LWR@origmulticolumnrow}%
}
@@ -38280,8 +40982,8 @@ class="td%
% \phfqit@bitstring{#1}%
}
-\appto{\LWR@restoreorigformatting}{
-\LetLtxMacro\bitstring\LWR@origbitstring
+\appto\LWR@restoreorigformatting{%
+\LetLtxMacro\bitstring\LWR@origbitstring%
}
% \end{macrocode}
@@ -38667,7 +41369,7 @@ class="td%
\LetLtxMacro\LWR@origtextsmaller\textsmaller
\let\LWR@textscale\textscale
-\appto{\LWR@restoreorigformatting}{%
+\appto\LWR@restoreorigformatting{%
\let\relsize\LWR@origrelsize%
\LetLtxMacro\larger\LWR@origlarger%
\LetLtxMacro\smaller\LWR@origsmaller%
@@ -40053,7 +42755,9 @@ class="td%
% \__siunitx_print:nn { number } { \ensuremath {#1} }
\LWR@subsingledollar{% lwarp
\textbackslash( \LWR@HTMLsanitize{#1} \textbackslash)% lwarp
- }{\__siunitx_print:nn { number } { #1 }}% lwarp
+ }{siunitx}{\__siunitx_print:nn { number } {
+ \LWR@origensuredmath{#1}
+ }}% lwarp
% \end{macrocode}
% \begin{macrocode}
\__siunitx_unit_output_print:
@@ -40278,7 +42982,7 @@ class="td%
{\LWR@HTMLtextstyle{#5}{#3}{#1}}%
{%
\convertcolorspec{named}{\csuse{#2}}{HTML}\LWR@tempcolor%
- \LWR@htmlspanclass[#5;#4:\#\LWR@tempcolor]{#3}{#1}%
+ \LWR@htmlspanclass[#5;#4:\LWR@origpound\LWR@tempcolor]{#3}{#1}%
}%
}
% \end{macrocode}
@@ -40297,7 +43001,7 @@ class="td%
\newcommand{\hl}[1]{
\LWR@soulcolor{#1}{LWR@soulhlcolor}{highlight}{background-color}%
- {background:\#F8E800}
+ {background:\LWR@origpound{}F8E800}
}
% \end{macrocode}
%
@@ -41313,7 +44017,7 @@ class="td%
%
% When a \env{lateximage} is begun:
% \begin{macrocode}
-\appto{\LWR@restoreorigformatting}{%
+\appto\LWR@restoreorigformatting{%
\let\textdegree\LWR@origtextdegree%
\let\textcelsius\LWR@origtextcelsius%
\let\textohm\LWR@origtextohm%
@@ -41789,6 +44493,8 @@ class="td%
% \DescribePackage{tikz}
% \pkg{tikz} is supported.
%
+% \limitstikz
+%
% \changes{v0.24}{2017/03/11}{\pkg{tikz}: For tikz v3.0.0 or later,
% auto-loads tikz babel library if necessary.}
%
@@ -41822,7 +44528,7 @@ class="td%
% \end{macrocode}
-% \begin{environment}{tikzpicture}
+% \begin{noindenvironment}{tikzpicture}
% |tikzpicture| environment is enclosed inside a \cs{lateximage}.
% May be used as-is, and its contents will be converted to an image.
%
@@ -41830,23 +44536,28 @@ class="td%
% \changes{v0.19}{2016/05/29}{Adapts to tikz version.}
% \changes{v0.24}{2017/03/13}{Fix for inline images.}
% \changes{v0.44}{2017/11/16}{\pkg{tikz}: Fix: Groups for lateximages.}
+% \changes{v0.51}{2018/03/06}{\pkg{tikz}: Fix for \cs{tikz} macro.}
+% \changes{v0.51}{2018/03/20}{\pkg{tikz}: Fix for \env{tikz} with optional argument.}
%
% \begin{macrocode}
-\BeforeBeginEnvironment{tikzpicture}{%
-\begin{lateximage}%
-\ifbool{LWR@tikzbabel}% Test for Tikz version v3.0.0
-{}%
-{\catcode`\$=3}% dollar sign is math shift
+\LetLtxMacro\LWR@origtikzpicture\tikzpicture
+
+\renewcommand*{\tikzpicture}[1][]{%
+ \begin{lateximage}%
+ \ifbool{LWR@tikzbabel}% Test for Tikz version v3.0.0
+ {}%
+ {\catcode`\$=3}% dollar sign is math shift
+ \LWR@origtikzpicture[#1]%
}
-\AfterEndEnvironment{tikzpicture}{%
-\end{lateximage}%
-\ifbool{LWR@tikzbabel}% Test for Tikz version v3.0.0
-{}%
-{\catcode`\$=\active}%
+\LetLtxMacro\LWR@origendtikzpicture\endtikzpicture
+
+\renewcommand*{\endtikzpicture}{%
+ \LWR@origendtikzpicture%
+ \end{lateximage}%
}
% \end{macrocode}
-% \end{environment}
+% \end{noindenvironment}
% \iffalse
%</tikz>
@@ -42579,6 +45290,18 @@ class="td%
% \end{macrocode}
% \end{macro}
%
+% \begin{noindmacro}{\thanksfootmark}
+% \changes{v0.51}{2018/03/05}{\pkg{titling}: Fix for \cs{thanks} mark.}
+% \begin{macrocode}
+\renewcommand{\thanksfootmark}{%
+% \hb@xt@\thanksmarkwidth{\hfil\normalfont%
+ \thanksscript{%
+ \thanksfootpre \tamark \thanksfootpost%
+ }%
+% }%
+}
+% \end{macrocode}
+% \end{noindmacro}
%
%\begin{macro}{\maketitle}
% \HTML\ mode.
@@ -43952,8 +46675,7 @@ class="td%
\setlength{\leftmargini}{\HTMLleftmargini}
}{}
\LWR@forcenewpage
-\LWR@atbeginverbatim{verse}
-\unskip\LWR@origvspace{-\baselineskip}
+\LWR@atbeginverbatim{3.5}{verse}%
}
% \end{macrocode}
% After the end of the \env{verse} environment, which places the \element{pre} tag at the
@@ -44108,7 +46830,7 @@ class="td%
\newcommand*{\LWR@vwcol@addrule}[1]{%
\appto{\LWR@vwcolstyle}{%
#1: %
- \LWR@printlength{\vwcol@rule} solid \#\LWR@vwcol@rulecolor ; %
+ \LWR@printlength{\vwcol@rule} solid \LWR@origpound\LWR@vwcol@rulecolor ; %
}%
}
% \end{macrocode}
@@ -44565,6 +47287,9 @@ class="td%
\LetLtxMacro\LWRprint@nopagecolor\nopagecolor
\LetLtxMacro\LWRprint@colorbox\colorbox
\LetLtxMacro\LWRprint@colorboxBlock\colorbox
+% \end{macrocode}
+% New print-mode versions of the following are also defined:
+% \begin{macrocode}
\LetLtxMacro\LWRorigprint@fcolorbox\fcolorbox
\LetLtxMacro\LWRorigprint@fcolorboxBlock\fcolorbox
\LetLtxMacro\LWRorigprint@boxframe\boxframe
@@ -44574,7 +47299,7 @@ class="td%
% Inside a \env{lateximage} the following gets restored to their print-mode actions:
% \margintag{\small\cs{LWR@restoreorigformatting}}
% \begin{macrocode}
-\appto{\LWR@restoreorigformatting}{%
+\appto\LWR@restoreorigformatting{%
\LetLtxMacro\textcolor\LWRprint@textcolor%
\LetLtxMacro\pagecolor\LWRprint@pagecolor%
\LetLtxMacro\nopagecolor\LWRprint@nopagecolor%
@@ -44587,19 +47312,11 @@ class="td%
%
% \subsection{HTML color style}
%
-% \begin{noindmacro}{\LWR@tempcolor}
-% The color converted to \HTML\ colorspace.
-% \begin{macrocode}
-\newcommand*{\LWR@tempcolor}{}
-\newcommand*{\LWR@tempcolortwo}{}
-% \end{macrocode}
-% \end{noindmacro}
-%
% \begin{noindmacro}{\LWR@findcurrenttextcolor}
-% \changes{v0.44}{2017/11/10}{\pkg{xcolor}: Added \cs{LWR@findcurrentcolor}.}
+% \changes{v0.44}{2017/11/10}{\pkg{xcolor}: Added \cs{LWR@findcurrenttextcolor}.}
% Sets \cs{LWR@tempcolor} to the current color.
% \begin{macrocode}
-\newcommand*{\LWR@findcurrenttextcolor}{%
+\renewcommand*{\LWR@findcurrenttextcolor}{%
\protect\colorlet{LWR@current@color}{.}%
\protect\convertcolorspec{named}{LWR@current@color}{HTML}\LWR@tempcolor%
}
@@ -44614,28 +47331,28 @@ class="td%
\LWR@findcurrenttextcolor%
\ifdefstring{\LWR@tempcolor}{000000}%
{}%
-{color: \#\LWR@tempcolor ; }%
+{color: \LWR@origpound\LWR@tempcolor ; }%
}
% \end{macrocode}
% \end{noindmacro}
%
%
-% \begin{noindmacro}{\LWR@textcurrentcolor} \marg{text}
+% \begin{macro}{\LWR@textcurrentcolor} \marg{text}
% Like \cs{textcolor} but uses the current \cs{color} instead.
% \changes{v0.44}{2017/11/10}{\pkg{xcolor}: Added \cs{LWR@textcurrentcolor}.}
% \begin{macrocode}
-\newcommand*{\LWR@textcurrentcolor}[1]{%
+\DeclareDocumentCommand{\LWR@textcurrentcolor}{m}{%
\begingroup%
\LWR@FBcancel%
\LWR@findcurrenttextcolor%
-\InlineClass[color:\#\LWR@tempcolor]{textcolor}{%
- \renewcommand*{\LWR@currenttextcolor}{\#\LWR@tempcolor}%
+\InlineClass[color:\LWR@origpound\LWR@tempcolor]{textcolor}{%
+ \renewcommand*{\LWR@currenttextcolor}{\LWR@origpound\LWR@tempcolor}%
#1%
}%
\endgroup%
}
% \end{macrocode}
-% \end{noindmacro}
+% \end{macro}
%
%
% \begin{noindmacro}{\LWR@colorstyle} \marg{2: model} \marg{3: color}
@@ -44656,7 +47373,7 @@ class="td%
% \end{macrocode}
% Print the converted color:
% \begin{macrocode}
-\#\LWR@tempcolor%
+\LWR@origpound\LWR@tempcolor%
\endgroup%
}
% \end{macrocode}
@@ -44701,29 +47418,41 @@ padding:\LWR@printlength{\fboxsep}%
%
% \subsection{High-level macros}
%
-% \DescribeMacro{\color}
-% \cs{color} appears in the \LaTeX{} \PDF\ output,
-% but is ignored by \prog{pdftotext} and thus is ignored in the \HTML\ file.
-% Text styling by local group is not yet supported.
-%
-%
-%
-% Each of the following macros is given a temporary name, and is \cs{let} to the final
-% name once the \HTML\ conversion starts.
-%
% \label{sec:textcolor}
% \begin{macro}{\textcolor}
% \oarg{model} \marg{color} \marg{text}
%
% Converted into an \HTML\ hex color span.
% \begin{macrocode}
-\RenewDocumentCommand{\textcolor}{O{named} m m}{%
+\RenewDocumentCommand{\textcolor}{o m m}{%
\begingroup%
+% \end{macrocode}
+% Set the \PDF\ color, to be picked up by \SVG\ math if possible.
+%
+% The print-mode \cs{color} command cannot accept the \optn{named}
+% option with color mixing, but it works with no option at all.
+%
+% \changes{v0.51}{2018/03/14}{Fix: SVG math color.}
+% \begin{macrocode}
+\IfValueTF{#1}{%
+ \color[#1]{#2}%
+}{%
+ \color{#2}%
+}%
+% \end{macrocode}
+% \begin{macrocode}
\LWR@FBcancel%
+\IfValueTF{#1}{%
\InlineClass[color:\LWR@colorstyle{#1}{#2}]{textcolor}{%
-\renewcommand*{\LWR@currenttextcolor}{\#\LWR@tempcolor}%
+\renewcommand*{\LWR@currenttextcolor}{\LWR@origpound\LWR@tempcolor}%
+#3%
+}%
+}{%
+\InlineClass[color:\LWR@colorstyle{named}{#2}]{textcolor}{%
+\renewcommand*{\LWR@currenttextcolor}{\LWR@origpound\LWR@tempcolor}%
#3%
}%
+}%
\endgroup%
}
% \end{macrocode}
@@ -44843,7 +47572,7 @@ padding:\LWR@printlength{\fboxsep}%
{% yes background color
\convertcolorspec{#3}{#4}{HTML}\LWR@tempcolortwo%
\begin{BlockClass}[%
- background:\#\LWR@tempcolortwo\ ; %
+ background:\LWR@origpound\LWR@tempcolortwo\ ; %
\LWR@borderpadding{#1}{#2}%
]{fcolorboxBlock}
#5
@@ -44894,7 +47623,7 @@ width:\LWR@printlength{\LWR@tempwidth}%
{\LWR@subfcolorminipage{#1}{#2}{}{#6}}%
{%
\convertcolorspec{#3}{#4}{HTML}\LWR@tempcolortwo%
- \LWR@subfcolorminipage{#1}{#2}{background:\#\LWR@tempcolortwo\ ; }{#6}%
+ \LWR@subfcolorminipage{#1}{#2}{background:\LWR@origpound\LWR@tempcolortwo\ ; }{#6}%
}%
}
{\end{BlockClass}}
@@ -45118,7 +47847,7 @@ height:\LWR@printlength{\LWR@tempheight}%
% Produce \HTML\ tags for a small superscript numerator and
% a small (non-subscript) denominator.
%
-% Scaling is turned off so that \cmds{pdftotext} correctly reads the result.
+% Scaling is turned off so that \prog{pdftotext} correctly reads the result.
%
% \changes{v0.16}{2016/04/07}{\pkg{xfrac}: Adjusted for the use of any font:}
% \changes{v0.48}{2018/02/13}{\pkg{xfrac}: Fix: Added groups around super/subscripts
@@ -45457,14 +48186,14 @@ scaling = false
% \begin{macrocode}
\AtBeginDocument{
-\preto{\xy}{\begin{lateximage}[xy image]}
+\preto{\xy}{\begin{lateximage}[(xy)]}
\appto{\endxy}{\end{lateximage}}
\@ifundefined{xymatrix}{}{
\LetLtxMacro\LWR@origxymatrix\xymatrix
\renewcommand{\xymatrix}[1]{%
-\begin{lateximage}[xymatrix]
+\begin{lateximage}[(xymatrix)]
\LWR@origxymatrix{#1}
\end{lateximage}
}
@@ -45474,7 +48203,7 @@ scaling = false
\LetLtxMacro\LWR@origxygraph\xygraph
\renewcommand{\xygraph}[1]{%
-\begin{lateximage}[xygraph]
+\begin{lateximage}[(xygraph)]
\LWR@origxygraph{#1}
\end{lateximage}
}
@@ -45566,7 +48295,7 @@ scaling = false
\def\UserRightMargin{1in}
\def\UserTopMargin{1in}
\def\UserBotMargin{1in}
-\def\thePageNumber{\#\,\arabic{page}}
+\def\thePageNumber{\LWR@origpound\,\arabic{page}}
\ifXeTeX
\def\ifcaseZWdriver{\ifcase2}
\else
@@ -47055,6 +49784,9 @@ scaling = false
% \part{Change History and Index}
% \label{sec:changehistory}
%
+% For the most recent changes and the start of the Index,
+% see page \pageref{sec:changesend}.
+%
% \pagestyle{plain}
%
% \Finale
diff --git a/Master/texmf-dist/source/latex/lwarp/lwarp.ins b/Master/texmf-dist/source/latex/lwarp/lwarp.ins
index fd46f2633c4..fb9d9c5ba27 100644
--- a/Master/texmf-dist/source/latex/lwarp/lwarp.ins
+++ b/Master/texmf-dist/source/latex/lwarp/lwarp.ins
@@ -73,6 +73,11 @@ version 2005/12/01 or later.
\file{lwarp-chngpage.sty}{\from{lwarp.dtx}{chngpage}}
\file{lwarp-chappg.sty}{\from{lwarp.dtx}{chappg}}
\file{lwarp-chapterbib.sty}{\from{lwarp.dtx}{chapterbib}}
+\file{lwarp-chemfig.sty}{\from{lwarp.dtx}{chemfig}}
+\file{lwarp-chemformula.sty}{\from{lwarp.dtx}{chemformula}}
+\file{lwarp-chemgreek.sty}{\from{lwarp.dtx}{chemgreek}}
+\file{lwarp-chemmacros.sty}{\from{lwarp.dtx}{chemmacros}}
+\file{lwarp-chemnum.sty}{\from{lwarp.dtx}{chemnum}}
\file{lwarp-cite.sty}{\from{lwarp.dtx}{cite}}
\file{lwarp-color.sty}{\from{lwarp.dtx}{color}}
\file{lwarp-colortbl.sty}{\from{lwarp.dtx}{colortbl}}
@@ -96,6 +101,7 @@ version 2005/12/01 or later.
\file{lwarp-enumitem.sty}{\from{lwarp.dtx}{enumitem}}
\file{lwarp-epigraph.sty}{\from{lwarp.dtx}{epigraph}}
\file{lwarp-epstopdf.sty}{\from{lwarp.dtx}{epstopdf}}
+\file{lwarp-epstopdf-base.sty}{\from{lwarp.dtx}{epstopdf-base}}
\file{lwarp-eso-pic.sty}{\from{lwarp.dtx}{eso-pic}}
\file{lwarp-everypage.sty}{\from{lwarp.dtx}{everypage}}
\file{lwarp-everyshi.sty}{\from{lwarp.dtx}{everyshi}}
@@ -136,6 +142,7 @@ version 2005/12/01 or later.
\file{lwarp-graphicx.sty}{\from{lwarp.dtx}{graphicx}}
\file{lwarp-graphics.sty}{\from{lwarp.dtx}{graphics}}
\file{lwarp-grffile.sty}{\from{lwarp.dtx}{grffile}}
+\file{lwarp-grid.sty}{\from{lwarp.dtx}{grid}}
\file{lwarp-hang.sty}{\from{lwarp.dtx}{hang}}
\file{lwarp-hanging.sty}{\from{lwarp.dtx}{hanging}}
\file{lwarp-hypcap.sty}{\from{lwarp.dtx}{hypcap}}
@@ -158,6 +165,7 @@ version 2005/12/01 or later.
\file{lwarp-longtable.sty}{\from{lwarp.dtx}{longtable}}
\file{lwarp-lscape.sty}{\from{lwarp.dtx}{lscape}}
\file{lwarp-ltcaption.sty}{\from{lwarp.dtx}{ltcaption}}
+\file{lwarp-ltxgrid.sty}{\from{lwarp.dtx}{ltxgrid}}
\file{lwarp-ltxtable.sty}{\from{lwarp.dtx}{ltxtable}}
\file{lwarp-luacolor.sty}{\from{lwarp.dtx}{luacolor}}
\file{lwarp-luatodonotes.sty}{\from{lwarp.dtx}{luatodonotes}}
@@ -168,6 +176,7 @@ version 2005/12/01 or later.
\file{lwarp-mdframed.sty}{\from{lwarp.dtx}{mdframed}}
\file{lwarp-memhfixc.sty}{\from{lwarp.dtx}{memhfixc}}
\file{lwarp-metalogo.sty}{\from{lwarp.dtx}{metalogo}}
+\file{lwarp-mhchem.sty}{\from{lwarp.dtx}{mhchem}}
\file{lwarp-microtype.sty}{\from{lwarp.dtx}{microtype}}
\file{lwarp-midfloat.sty}{\from{lwarp.dtx}{midfloat}}
\file{lwarp-midpage.sty}{\from{lwarp.dtx}{midpage}}