From ac8d62d1767ddaee38fb7d8d0afc5ae70233f806 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 1 Apr 2018 22:24:04 +0000 Subject: lwarp (2apr18) git-svn-id: svn://tug.org/texlive/trunk@47225 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/lwarp/lwarp.dtx | 1337 +++++++++++++++++++----- Master/texmf-dist/source/latex/lwarp/lwarp.ins | 2 + 2 files changed, 1051 insertions(+), 288 deletions(-) (limited to 'Master/texmf-dist/source/latex/lwarp') diff --git a/Master/texmf-dist/source/latex/lwarp/lwarp.dtx b/Master/texmf-dist/source/latex/lwarp/lwarp.dtx index 7ca53bf2b44..9e314321fcf 100644 --- a/Master/texmf-dist/source/latex/lwarp/lwarp.dtx +++ b/Master/texmf-dist/source/latex/lwarp/lwarp.dtx @@ -16,7 +16,7 @@ % \iffalse %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{lwarp} -% [2018/03/24 v0.51 Allows LaTeX to directly produce HTML5 output.] +% [2018/04/01 v0.52 Allows LaTeX to directly produce HTML5 output.] % %<*driver> \documentclass{ltxdoc} @@ -361,19 +361,24 @@ Keywords={LaTeX, HTML, conversion}% } {\smallskip\hrule\endminipage\hspace*{\fill}\bigskip} -% \makeatletter -% \newcommand{\watchout}[1][]{% -% \@bsphack% -% \marginpar{\raggedleft\textcolor{blue!70!black}{#1} \quad \includegraphics[height=3ex]{symbol_warning.pdf}} -% \@esphack% -% } -% \makeatother - \newcommand{\pdflatexonly}{ \textcolor{red}{Only pre-loaded if \prog{pdflatex} is being used.} \marginpar{\raggedleft\textcolor{blue!70!black}{\prog{pdflatex} only:}} } +% From package dtxdescribe: +% \makeatletter +% \renewcommand{\watchout}[1][]{% +% \@ifundefined{@captype}{% not float? +% % \@bsphack% +% \marginpar{\raggedleft% +% \textcolor{red!50!black}{\warningsign\normalsize\quad#1}}% +% % \@esphack% +% \ignorespaces% +% }{}% not float? +% } +% \makeatother + % \newcommand{\margintag}[1]{% % \marginpar{\raggedleft\textcolor{blue!70!black}{#1}}% % } @@ -456,6 +461,10 @@ to redefine the message which is printed for page number references. \pkg{lwarp} emulates \pkg{hyperref}, including the creation of active hyperlinks, but does not require that \pkg{hyperref} be loaded by the document. +Do not place a \texttt{\%} character between arguments for \cs{hyperref}, etc., +\watchout[comment character \%] +as this is one of the characters which is neutralized for inclusion in \HTML\ \acro{URL}s. + \pkg{lwarp} can also load \pkg{url}, but \pkg{url} should not be used at the same time as \pkg{hyperref}, since they both define the \cs{url} command. \pkg{lwarp} does not (yet) attempt to convert \pkg{url} links into hyperlinks @@ -736,9 +745,42 @@ as \HTML\ has no concept of page numbers. \newcommand{\limitsfootnotes}{ \pkg{lwarp} uses native \LaTeX\ footnote code, although with its own -\cs{box} to avoid the \LaTeX\ output routine. The usual functions work as-is. +\cs{box} to avoid the \LaTeX\ output routine. The usual functions mostly work as-is. + +The \pkg{footmisc} \optn{stable} option is emulated by \pkg{lwarp}. + +When using footnotes in sectioning commands, \watchout[sectioning commands] +to generate consistent results between print and \HTML, use +the \pkg{footmisc} package with the \optn{stable} option, +provide a short \TOC\ entry, and \cs{protect} the \cs{footnote}: +\begin{sourcedisplay} +\cs{usepackage}[\textcolor{red}{stable}]\{footmisc\}\\ +\dots\\ +\cs{subsection}\textcolor{red}{[Subsection Name]}\\ +\hspace*{2em}\{Subsection Name\textcolor{red}{\cs{protect}}\cs{footnote}\{A footnote.\}\} +\end{sourcedisplay} -\limitspfnote +Do not use a starred sectioning command. As an alternative, it may be possible to +adjust \cs{secnumdepth} instead. +% Attempting to use \cs{footnotemark} instead +% of \cs{footnote} may result in misnumbered footnotes in the print document. +} + +\newcommand{\limitsverbatimfootnotes}{% +If using \pkg{fancybox} or \pkg{fancyvrb} with \cs{VerbatimFootnotes}, +\watchout[\cs{VerbatimFootnotes}] +and using footnotes in a sectioning command or display math, +\watchout[sectioning or displaymath] +use \cs{footnotemark} and \cs{footnotetext}: +\begin{sourcedisplay} +\cs{subsection}[Subsection Name]\\ +\hspace*{2em}\{Subsection Name\cs{protect}\textcolor{red}{\cs{footnotemark}}\} \\ +\textcolor{red}{\cs{footnotetext}}\{A footnote with \cs{verb}+verbtim+.\} \\ +\end{sourcedisplay} +and likewise for equations or display math. + +At present there is a bug such that paragraph closing tags are not present in +footnotes when \cs{VerbatimFootnotes} are selected. The browser usually compensates. } \newcommand{\limitskomascript}{ @@ -839,8 +881,17 @@ in the \SVG\ image may be adjusted \index{font>size --- math, SVG}% \index{math>font size --- SVG}% \index{lateximages>font size}% -by setting \cs{LateximageFontSizeName} to a font size name --- \emph{without the backslash}, for ex: \\ -\hspace*{.5in}\texttt{\cs{renewcommand}\{\cs{LateximageFontSizeName}\}\{\textcolor{red}{large}\}} +by setting \cs{LateximageFontSizeName} to a font size name --- \emph{without the backslash}, +which defaults to: +\begin{sourcedisplay} +\cs{renewcommand}\{\cs{LateximageFontSizeName}\}\{\textcolor{red}{large}\} +\end{sourcedisplay} + +For inline \SVG\ math, font size is instead controlled by \cs{LateximageFontScale}, +which defaults to: +\begin{sourcedisplay} +\cs{newcommand}*\{\cs{LateximageFontScale}\}\{\textcolor{red}{.75}\} +\end{sourcedisplay} } @@ -867,6 +918,25 @@ so complicated objects such as \tikz\ pictures are more likely to compile succes } +\newcommand{\limitscustomizemathjax}{% +\brand{MathJax} does not have preexisting support every possible math function. +Additional \brand{MathJax} function definitions may be +defined. These will be declared at the start of each \HTML\ page, +and thus will have a global effect. + +Examples: +\begin{sourcedisplay} +\cs{CustomizeMathJax}\{ \\ + \hspace*{2em}\cs{newcommand}\{\cs{expval}\}[1]\{\cs{langle}\#1\cs{rangle}\} \\ + \hspace*{2em}\cs{newcommand}\{\cs{abs}\}[1]\{\cs{lvert}\#1\cs{rvert}\} \\ +\} \\ +\cs{CustomizeMathJax}\{\cs{newcommand}\{\cs{arsinh}\}\{\cs{text}\{arsinh\}\}\} \\ +\cs{CustomizeMathJax}\{\cs{newcommand}\{\cs{arcosh}\}\{\cs{text}\{arcosh\}\}\} +\cs{CustomizeMathJax}\{\cs{newcommand}\{\cs{NN}\}\{\cs{mathbb}\{N\}\}\} +\end{sourcedisplay} +} + + \newcommand{\limitsmath}{% \subsubsection{Rendering tradeoffs} @@ -950,6 +1020,12 @@ and the \brand{MathJax} cross-referencing system is ignored in favor of the \LaT seamlessly integrating with the rest of the \LaTeX\ code. \end{enumerate} +\subsubsection{Customizing \brand{MathJax}} +\index{MathJax>custom functions} +\index{math>MathJax custom functions} +\limitscustomizemathjax + +\subsubsection{\brand{MathJax} limitations} Limitations when using \brand{MathJax} include: \margintag{\brand{MathJax} limitations} \DescribeProgram{MathJax} @@ -999,26 +1075,6 @@ Limitations when using \brand{MathJax} include: \watchout[other macros and packages] including \cs{ensuremath}, \pkg{bigdelim}, \pkg{units}, and \pkg{nicefrac}, along with occasionally-used macros such as \cs{footnote} and \cs{relax}. - -\item \brand{MathJax} does not automatically support custom \LaTeX{} macros, - \margintag{custom MathJax macros} - \index{MathJax>custom macros} - but they may be created by the user inside a math expression: - \begin{sourcedisplay} - \cs{begin}\{document\}\\ - \textrm{(\dots)} \\ - \cs{begin}\{warpHTML\} \% Only for HTML output, \\ - \cs{ifbool}\{mathjax\} \% and only for MathJax output: \\ - \{ \\ - \hspace*{2em}\% New macros for MathJax are \\ - \hspace*{2em}\% placed inside a math expression: \\ - \hspace*{2em}\cs{(} \\ - \hspace*{4em}\cs{newcommand}\{\cs{expval}\}[1]\{\cs{langle}\#1\cs{rangle}\} \\ - \hspace*{4em}\cs{newcommand}\{\cs{abs}\}[1]\{\cs{lvert}\#1\cs{rvert}\} \\ - \hspace*{2em}\cs{)} \\ - \}\{\} \\ - \cs{end}\{warpHTML\} \\ - \end{sourcedisplay} \end{itemize} } @@ -1257,6 +1313,11 @@ environments. \newcommand{\limitstabbing}{% The \env{tabbing} environment works, except that \SVG\ math and \env{lateximage}s do not yet work inside the environment. + +If math is used inside \env{tabbing}, \margintag{math in \env{tabbing}} +place \env{tabbing} inside +a \env{lateximage} environment, which will render the entire environment as +a single \SVG\ image. } \newcommand{\limitstabular}{% @@ -1845,7 +1906,7 @@ of this extension is created first.} } \newcommand{\limitsnicefrac}{% -\pkg{units} and \pkg{nicefrac} work as-is with \pkg{lwarp}, but +\pkg{units} and \pkg{nicefrac} work with \pkg{lwarp}, but \brand{MathJax} does not have an extension for \pkg{units} or \pkg{nicefrac}. These packages do work with \pkg{lwarp}'s option \optn{svgmath}. } @@ -2001,7 +2062,7 @@ This boolean may be tested by the user for later use. %<*package> % \fi % -% \CheckSum{22904} +% \CheckSum{23333} % % \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 @@ -2094,6 +2155,7 @@ This boolean may be tested by the user for later use. % \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} +% \changes{v0.52}{2018/04/01}{\ 2018/04/01} @@ -2286,9 +2348,50 @@ This boolean may be tested by the user for later use. % see the end of the Change History on page \pageref{sec:changesend}. % % \begin{description} +% \needspace{2\baselineskip} +% \item[v0.52:] \ +% \begin{itemize} +% \item Improved install instructions regarding \filenm{lwarp\_baseline\_marker.png}. +% \margintag{documentation} +% \item Added documentation regarding footnotes in section headings, +% and footnotes with \cs{VerbatimFootnotes} +% from \pkg{fancybox}, \pkg{fancyvrb}. See \cref{sec:limitsfootnotes}. +% \item Added documentation regarding font selection when using +% \XeLaTeX\ or \LuaLaTeX\ with \pkg{fontspec} and traditional font packages. +% See \cref{sec:fonts}. +% \item Fix: Limit the number of background tasks +% \margintag{SVG math} +% when generating \env{lateximage}s. +% \item Added user-adjustable \SVG\ math font scaling. See \cref{sec:mathfontscale}. +% \item Added warnings if \filenm{lwarp\_baseline\_marker.png} is not present, or +% if \pkg{graphicx} or \pkg{graphics} is not loaded. +% \item Improved \cs{ensuremath} hashing expansion. +% \item Fix: \env{equation*} with \env{split}. +% \item \env{tabbing} now works inside a \env{lateximage}. Use for math in \env{tabbing}. +% \item Fix: MathJax script was not executing in some conditions. +% \margintag{MathJax} +% \item Added \cs{CustomizeMathJax} to add custom functions. +% See \cref{sec:limitsmath}. +% \item Fix: Footnote numbering when using \progcode{HTMLDebugComments}. +% \margintag{footnotes} +% \item Fix: Footnote paragraph tags. +% \item Fix: \progcode{FootnoteDepth} defaults to \cs{subsubsection}. +% \item Fix: \cs{kill} in a \env{lateximage}. \margintag{misc. fixes} +% \item Fix: \cs{FileDepth}, misc. others, when input encoding is not \optn{utf8}. +% \item Fix: \cs{texorpdfstring} in a section name. +% \item \pkg{hyperref} emulation: Fix for \progcode{\#}, \progcode{\%}, \margintag{packages} +% \progcode{\&}, \progcode{\~}, \progcode{\_} characters in \acro{URL}s. +% \item \pkg{fancybox}, \pkg{fancyvrb}: Initial support for \cs{VerbatimFootnotes}. +% \item \pkg{nicefrac}: Added with fix for \cs{ensuremath}. +% \item \pkg{graphicx}: Fix for option defaults. Added v1.1a/b options. +% \item \pkg{endfloat}: Updated for v2.6. +% \item \pkg{url}: Fixes for active characters. +% \end{itemize} +% \needspace{2\baselineskip} % \item[v0.51:] \ % \begin{itemize} % \item Docs: Added \nameref{sec:thingstoavoid}. +% \margintag{documentation} % \item Docs: Added to \nameref{sec:convertexisting}. % \item Docs: Multiple authors and affiliations with custom classes. % See \cref{sec:authorsaffils}. @@ -2311,6 +2414,7 @@ This boolean may be tested by the user for later use. % \pkg{chemfig}, \pkg{chemformula}, \pkg{chemmacros}, \pkg{chemnum}, \pkg{chemgreek}, % \pkg{epstopdf-base}, \pkg{grid}, \pkg{ltxgrid}. % \end{itemize} +% \needspace{2\baselineskip} % \item[v0.50:] \ % \begin{itemize} % \item \SVG\ math and other \env{lateximage}s now are @@ -2342,6 +2446,7 @@ This boolean may be tested by the user for later use. % \pkg{schemata}, % \pkg{dblfloatfix}, \pkg{nonfloat}, \pkg{morefloats}. % \end{itemize} +% \needspace{2\baselineskip} % \item[v0.49:] \ % \begin{itemize} % \item Added \pkg{xcolor} \cs{rowcolors}.\margintag{tabular} @@ -2358,7 +2463,7 @@ This boolean may be tested by the user for later use. % \item[v0.48:] \ % \begin{itemize} % \item Added some documentation -% \margintag{docs} +% \margintag{documentation} % regarding converting an existing document. See \cref{sec:convertexisting}. % \item Updated compatibility for new \pkg{cleveref} v0.21.\margintag{\pkg{cleveref}} % \item Fix: Ignores optional tabular column arguments.\margintag{tabular} @@ -2409,7 +2514,8 @@ This boolean may be tested by the user for later use. % \needspace{2\baselineskip} % \item[v0.45:] \ % \begin{itemize} -% \item Improved \prog{MikTeX} install instructions.\margintag{docs} +% \item Improved \prog{MikTeX} install instructions. +% \margintag{documentation} % \item Improved graphics and \pkg{epstopdf} instructions. % \item Updates to the \nameref{sec:introduction}. % \item Added \pkg{memoir}, \pkg{memhfixc}. @@ -2468,7 +2574,7 @@ This boolean may be tested by the user for later use. % \begin{itemize} % \item Docs: Reorganized \HTML\ customization, added an \HTML\ settings table. % See \cref{sec:htmlsettings}. -% \item Added |FootnoteDepth| to control the placement +% \item Added \progcode{FootnoteDepth} to control the placement % \margintag{footnotes} % of pending footnotes before section breaks. % By default, pending footnotes are printed before @@ -3073,10 +3179,11 @@ This boolean may be tested by the user for later use. % an uncounted number more work as-is. % % Packages have been selected according to several criteria: perceived importance, -% popularity lists, recent CTAN updates, CTAN topics, mention in other packages, support by other -% \HTML\ conversion methods, -% and from sample documents taken from public archives\footnote{An amazing number of -% decades-old packages are still in use today.}. +% popularity lists, recent CTAN updates, CTAN topics, mention in other packages, +% support by other \HTML\ conversion methods, +% and from sample documents taken from public archives. +% These include some ``obsolete'' packages as well.\footnote{An amazing number of +% decades-old packages are still in use today.} % % \rulebreak % @@ -3255,8 +3362,9 @@ This boolean may be tested by the user for later use. % Theorems: & Native \LaTeX\ theorems, % \pkg{theorem}, \pkg{amsthm}, \pkg{ntheorem}. \\ % -% Additional math: & Math fonts via \SVG\ images, \pkg{resizegather}. -% As-is: \pkg{delarray}, \pkg{bm}, \pkg{braket}, \pkg{tikz-cd}, etc. \\ +% Additional math: & Math fonts via \SVG\ images, \pkg{resizegather}, \pkg{xy}. +% As-is: \pkg{delarray}, \pkg{bm}, \pkg{braket}, +% \pkg{amscd}, \pkg{pb-diagram}, \pkg{tikz-cd}, etc. \\ % % Display math with \cs{displaymathother}: & % % Complicated math objects in display math, such as \pkg{tikz-cd}, etc. \\ @@ -3268,10 +3376,10 @@ This boolean may be tested by the user for later use. % Science and engineering: & % \pkg{listings}, \pkg{algorithmicx}, \pkg{bytefield}, \pkg{axodraw2}, % \pkg{phfqit}, \pkg{mhchem}, -% \pkg{chemfig}, \pkg{chemformula}, \pkg{chemmacros}, \pkg{chemnum}. \pkg{chemgreek}, +% \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}, \pkg{elements}, etc. +% \pkg{simpler-wick}, \pkg{linop}, \pkg{blochsphere}, \pkg{bohr}, \pkg{elements}, etc. % \emph{(Math-mode packages generally work as-is with \SVG\ math.)} \\ % % \midrule @@ -3715,14 +3823,14 @@ This boolean may be tested by the user for later use. % \end{enumerate} % % \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 +% is |.dtx| and |.ins| source files. These files are used to create % the documentation and |.sty| files. % % \begin{enumerate} % \item See \url{http://ctan.org/pkg/lwarp} for the \pkg{lwarp} package. -% \item Download the zip archive |lwarp.zip| into your own |lwarp| directory. -% \item Unpack |lwarp.zip|. -% \item Locate the contents |lwarp.dtx| and |lwarp.ins| +% \item Download the zip archive \filenm{lwarp.zip} into your own \filenm{lwarp} directory. +% \item Unpack \filenm{lwarp.zip}. +% \item Locate the contents \filenm{lwarp.dtx} and \filenm{lwarp.ins} % \item Create the documentation: \userentry{pdflatex lwarp.dtx} (several times) % \item Create the |.sty| files: \userentry{pdflatex lwarp.ins} % \item Copy the |.sty| files somewhere such as the \TeX\ Live local tree @@ -3730,7 +3838,10 @@ This boolean may be tested by the user for later use. % \begin{sourcedisplay} % |/tex/latex/local/lwarp| % \end{sourcedisplay} -% \item Copy the documentation |lwarp.pdf| to a |source| directory in the local tree, +% \item Copy \filenm{lwarp\_baseline\_marker.png} to the same place +% as the \filenm{.sty} files. +% \changes{v0.52}{2018/03/24}{Docs: Improved install instructions.} +% \item Copy the documentation \filenm{lwarp.pdf} to a \filenm{source} directory in the local tree, % such as: % \begin{sourcedisplay} % |/doc/local/lwarp| @@ -3751,7 +3862,10 @@ This boolean may be tested by the user for later use. % directory, then compiled right there, alongside the % 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 +% as the document source. +% The file \filenm{lwarp\_baseline\_marker.png} must also be copied as well. +% \changes{v0.52}{2018/03/24}{Docs: Improved install instructions.} +% This approach is especially useful if % you would like to temporarily test\margintag{Just testing!}\ % \pkg{lwarp} before deciding whether to permanently install it. % \end{description} @@ -4564,10 +4678,9 @@ This boolean may be tested by the user for later use. % % While using \prog{pdflatex}, % \margintag{pdflatex, T1, UTF8} -% \pkg{fontenc} is automatically loaded with T1 encoding, -% and \pkg{inputenc} is automatically loaded with UTF8 encoding, each of which -% is required for the conversion process. +% \pkg{fontenc} is automatically loaded with T1 encoding. % \pkg{fontenc} may be loaded with an additional encoding after \pkg{lwarp}. +% \pkg{inputenc} is automatically loaded with UTF8 encoding if if has not yet been loaded. % % While using \prog{pdflatex}, if no font-related package is specified, the default % \margintag{vector fonts} @@ -4596,7 +4709,9 @@ This boolean may be tested by the user for later use. % Do NOT use \pkg{fontenc}! % % Place \pkg{fontspec} or \pkg{fontenc} and other font and UTF-8 related commands -% after the \cs{documentclass} command and before |\usepackage{lwarp}|: +% after the \cs{documentclass} command and before |\usepackage{lwarp}|. +% In some cases, a package conflict may require that a font package be loaded +% after \pkg{lwarp}, which should work as well. % % \begin{enumerate} % \item |documentclass{article/book/report}| goes here, followed by any of: @@ -4653,6 +4768,14 @@ This boolean may be tested by the user for later use. % \item |\usepackage{newtxmath}| or other math-related font packages. % Many of these load \pkg{amsmath}, which must be loaded after \pkg{lwarp}, % so they must also be loaded after \pkg{lwarp}. +% \item |\setmonofont{TeX Gyre Cursor}| or similar may be required if using +% \watchout[\pkg{fontspec} with traditional font packages] +% \XeLaTeX\ or \LuaLaTeX\ and \pkg{fontspec} along with +% traditional font packages such as \pkg{txfonts}, \pkg{newtxtext}, etc. +% This is required to turn off the monospaced font's ligatures +% with \pkg{fontspec} after loading the traditional font packages. +% Monospaced output ligatures must be turned off +% to produce the correct \HTML\ characters. % \item \ldots{} the rest of the preamble and the main document. % \end{enumerate} % @@ -4951,9 +5074,9 @@ This boolean may be tested by the user for later use. % so the rest of the filename must be sufficiently unique to avoid name collisions. % \index{file>unique names} % -% \ItemDescribeCounter{FootnoteDepth} \DescribeDefault{5} +% \ItemDescribeCounter{FootnoteDepth} \DescribeDefault{3} % Determines where to place pending footnotes. -% |5| places footnotes before each break down to the \cs{subparagraph} level. +% |3| places footnotes before each break down to the \cs{subsubsection} level. % |1| places footnotes before each \cs{section} break. % Any pending footnotes are also placed at the bottom of each page % before each file break. @@ -5685,9 +5808,22 @@ This boolean may be tested by the user for later use. % % % \subsubsection{Footnotes and page notes} +% \label{sec:limitsfootnotes} +% +% \index{footnotes>misnumbered} +% \index{footnotes>in sectioning commands} % % \limitsfootnotes % +% \index{footnotes>verbatim} +% \index{verbatim>footnotes} +% \index{footnotes>in sectioning commands} +% \index{footnotes>in math} +% \index{math>footnotes} +% \limitsverbatimfootnotes +% +% \limitspfnote +% % % % \subsection{Front and back matter} @@ -5828,7 +5964,7 @@ This boolean may be tested by the user for later use. % \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{math>\tikz}\index{equation>with \tikz} % \index{MathJax>errors}\index{HTML>alt tags}\index{alt tags} % % \describedisplaymathother @@ -5836,8 +5972,8 @@ This boolean may be tested by the user for later use. % \subsubsection{\pkg{chemformula} package} % \limitschemformula % \index{chemformula>troubleshooting} -% \index{array>and chemformula} -% \index{math>and chemformula} +% \index{array>\pkg{chemformula}} +% \index{math>\pkg{chemformula}} % % \subsubsection{\pkg{mhchem} package} % @@ -5917,6 +6053,8 @@ This boolean may be tested by the user for later use. % % \subsection{Tabbing} % \limitstabbing +% \index{tabbing>and math} +% \index{math>\env{tabbing}} % % % \subsection{Tabular} @@ -6774,12 +6912,11 @@ This boolean may be tested by the user for later use. % See \cref{sec:displaymathother}. % % \needspace{3\baselineskip} -% \item [Missing sections:] ~ -% \begin{itemize} -% \item See \cref{sec:filedepth} regarding the +% \item [Missing sections:] See \cref{sec:filedepth} regarding the % |FileDepth| and |SideTOCDepth| counters, % and the use of \cs{tableofcontents} in the home page. -% \end{itemize} +% +% \item [Misnumbered footnotes from section headings:] See \cref{sec:limitsfootnotes}. % % \item [Missing HTML files:] \ % \begin{itemize} @@ -6798,6 +6935,11 @@ This boolean may be tested by the user for later use. % \item \limitscpageref % \end{itemize} % +% \item [Malformed URLs:] Do not use the \texttt{\%} character between +% \index{hyperref>incorrect links} +% arguments of \cs{hyperref}, etc., as this character is among those which +% is neutralized for inclusion in \HTML\ \acro{URL}s. +% % \item [Em-dashes or En-dashes in listing captions and titles:] \ % % Use \XeLaTeX\ or \LuaLaTeX. @@ -7098,14 +7240,20 @@ This boolean may be tested by the user for later use. % % When using pdf\LaTeX, \pkg{lwarp} required T1 and UTF8 encoding. % +% If some other input encoding is already defined, try to use it instead, and +% hope for the best. +% % \XeLaTeX\ and Lua\LaTeX\ are both UTF8 by nature. % % \changes{v0.44}{2017/11/16}{If pdfLaTeX, require T1 and UTF8 encoding.} +% \changes{v0.52}{2018/03/26}{If pdfLaTeX, allow other input encoding.} % % \begin{macrocode} \ifPDFTeX \RequirePackage[T1]{fontenc} +\@ifpackageloaded{inputenc}{}{ \RequirePackage[utf8]{inputenc} +} \fi % \end{macrocode} % @@ -7890,6 +8038,7 @@ For a possible alternative, see package(s) #2.} \LWR@loadafter{newtxmath} % newunicodechar must be loaded before lwarp \LWR@notmemoirloadafter{nextpage} +\LWR@loadafter{nicefrac} \LWR@loadafter{nonfloat} \LWR@loadafter{nonumonpart} \LWR@loadafter{nopageno} @@ -7975,6 +8124,7 @@ For a possible alternative, see package(s) #2.} % \LWR@loadafter{typearea}% preloaded by koma-script classes \LWR@loadafter{ulem} \LWR@loadafter{upref} +\LWR@loadafter{url} \LWR@loadafter{varioref}% no lwarp package provided \LWR@notmemoirloadafter{verse} \LWR@loadafter{vertbars} @@ -7996,7 +8146,7 @@ For a possible alternative, see package(s) #2.} - +% ^^A *required % \section{Required packages} % \label{sec:requiredpackages} % \index{package>required} @@ -8185,12 +8335,13 @@ For a possible alternative, see package(s) #2.} % \changes{v0.20}{2017/01/12}{Page geometry set to 6in wide with large margins.} % \changes{v0.27}{2017/04/04}{Page geometry modified to reduce line overflow.} % \changes{v0.28}{2017/04/13}{Forced oneside to maintain large right margin.} +% \changes{v0.52}{2018/03/31}{Fix: MathJax script line wraps. Reduced right margin.} % % \codehtml % \begin{macrocode} \begin{warpHTML} \RequirePackage[paperheight=190in,paperwidth=20in,% -left=2in,right=12in,% +left=2in,right=6in,% top=1in,bottom=1in,% ]{geometry} \@twosidefalse @@ -8312,8 +8463,6 @@ top=1in,bottom=1in,% } % \end{macrocode} - - % \begin{macrocode} \end{warpall} % \end{macrocode} @@ -8337,7 +8486,7 @@ top=1in,bottom=1in,% % \end{macrocode} -% \DescribePackage{xstring} +% \DescribePackage{verbatim} % \begin{macrocode} \RequirePackage{verbatim} % \end{macrocode} @@ -10532,7 +10681,11 @@ div.programlisting pre.verbatim span.callout{ font-size: .85em ; } - +span.verbatim { + font-family: "DejaVu Mono", "Bitstream Vera Mono", "Lucida Console", + "Nimbus Mono L", "Liberation Mono", "FreeMono", "Andale Mono", + "Courier New", monospace; +} @@ -11640,13 +11793,26 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX- % \subsection{lwarpmk option} -% The following is only generated if the \optn{lwarpmk} option -% was given to \pkg{lwarp}. -% \begin{macrocode} -\begin{LWR@createlwarpmk} -% \end{macrocode} - -% \DescribeProgram{lwarpmk} Creates a local copy of \prog{lwarpmk}: +% \DescribeOption{lwarpmk} Creates a local copy of \prog{lwarpmk}. +% +% \DescribeProgram{lwarpmk} Command-line utility to process \pkg{lwarp} files and images. +% +% \env{lateximage}s and \SVG\ math images are generated using +% \margintag{parallel processing} +% \index{images>processing} +% \index{lateximages>processing} +% \index{SVG>image processing} +% multiple processes in parallel. +% For \brand{Unix} and \brand{Linux}, every 32 images the |wait| command is +% issued to wait for the previous batch of images to finish processing before +% starting a new batch. +% For \brand{Windows}, every 32 images one task is dispatched with +% \begin{sourcedisplay} +% START /B /WAIT /BELOWNORMAL +% \end{sourcedisplay} +% which causes the operating system to wait until this lesser-priority tasks finishes, +% hopefully also waiting for the normal priority tasks which were already in +% progress to also complete. Afterwards, the next batch of images is started. % % \changes{v0.21}{2017/02/11}{\prog{lwarpmk}: Fix: \cmds{lwarpmk again} for \brand{Windows}.} % \changes{v0.21}{2017/02/22}{\prog{lwarpmk}: Fix: \cmds{lwarpmk limages} for \brand{Windows}.} @@ -11670,6 +11836,14 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX- % \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.} +% \changes{v0.52}{2018/03/31}{\prog{lwarpmk}: Fix: Memory overflow when spawning tasks.} +% \changes{v0.52}{2018/04/01}{\prog{lwarpmk}: Fix: Skip image generation if from page 0.} +% +% The following is only generated if the \optn{lwarpmk} option +% was given to \pkg{lwarp}. +% \begin{macrocode} +\begin{LWR@createlwarpmk} +% \end{macrocode} % % ^^A *lwarpmk.lua % \begin{macrocode} @@ -11680,7 +11854,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.51" +printversion = "v0.52" function printhelp () print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ; @@ -11772,7 +11946,7 @@ function loadconf () -- Default configuration filename: local conffile = "lwarpmk.conf" -- Optional configuration filename: -if arg[2] ~= nil then conffile = arg[2]..".lwarpmkconf" end +if ( arg[2] ~= nil ) then conffile = arg[2]..".lwarpmkconf" end -- Default language: language = "english" -- Default xdyfile: @@ -11782,7 +11956,9 @@ if (lfs.attributes(conffile,"mode")==nil) then -- file not exists print ("lwarpmk: ===") print ("lwarpmk: " .. conffile .." does not exist.") - print ("lwarpmk: " .. arg[2] .. " does not appear to be a project name.\n") + if ( arg[2] ~= nil ) then + print ("lwarpmk: " .. arg[2] .. " does not appear to be a project name.\n") + end print ("lwarpmk: ===") printhelp () ; os.exit(1) -- exit the entire lwarpmk script @@ -11969,10 +12145,9 @@ end -- Remove auxiliary files: - +-- All aux files are removed since there may be many bbl*.aux files. function removeaux () -os.execute ( rmname .. " " .. - sourcename ..".aux " .. sourcename .. "_html.aux " .. +os.execute ( rmname .. " *.aux " .. sourcename ..".toc " .. sourcename .. "_html.toc " .. sourcename ..".lof " .. sourcename .. "_html.lof " .. sourcename ..".lot " .. sourcename .. "_html.lot " .. @@ -11980,7 +12155,7 @@ os.execute ( rmname .. " " .. sourcename ..".ind " .. sourcename .. "_html.ind " .. sourcename ..".log " .. sourcename .. "_html.log " .. sourcename ..".gl* " .. sourcename .. "_html.gl* " .. - "*_html_inc.*" + " *_html_inc.* " ) end @@ -12015,6 +12190,8 @@ if opsystem=="Windows" then os.exit(1) ; end end -- create lwarp_one_limage.cmd +-- Track the number of parallel processes +numimageprocesses = 0 -- Scan lateximages.txt for line in limagesfile:lines() do -- lwimgpage is the page number in the PDF which has the image @@ -12023,6 +12200,8 @@ for line in limagesfile:lines() do i,j,lwimgpage,lwimghash,lwimgname = string.find (line,"|(.*)|(.*)|(.*)|") -- For each entry: if ( (i~=nil) ) then +-- Skip if the page number is 0: +if ( lwimgpage ~= "0" ) then -- Skip is this image is hashed and already exists: local lwimgfullname = "lateximages" .. dirslash .. lwimgname .. ".svg" if ( @@ -12044,7 +12223,6 @@ end if opsystem=="Unix" then -- For Unix / Linux / Mac OS: err = os.execute( --- print ( cmdgroupopenname .. "pdfseparate -f " .. lwimgpage .. " -l " .. lwimgpage .. " " .. sourcename .."_html.pdf " .. @@ -12063,10 +12241,29 @@ rmname .. " lateximages" .. dirslash .. lwimgname .. ".pdf" .. seqname .. rmname .. " lateximages" .. dirslash .. "lateximagetemp-" .. lwimgpage .. ".pdf" .. cmdgroupclosename .. " >/dev/null " .. bgname ) +-- Every 32 images, wait for completion at below normal priority, +-- allowing other image tasks to catch up. +numimageprocesses = numimageprocesses + 1 +if ( numimageprocesses > 32 ) then + numimageprocesses = 0 + print ( "lwarpmk: waiting" ) + err = os.execute ( "wait" ) +end elseif opsystem=="Windows" then -- For Windows +-- Every 32 images, wait for completion at below normal priority, +-- allowing other image tasks to catch up. +numimageprocesses = numimageprocesses + 1 +if ( numimageprocesses > 32 ) then + numimageprocesses = 0 + thiswaitcommand = "/WAIT /BELOWNORMAL" + print ( "lwarpmk: waiting" ) +else + thiswaitcommand = "" +end +-- Execute the image generation command err = os.execute ( - "start /b \"\" lwarp_one_limage " .. + "start /B " .. thiswaitcommand .. " \"\" lwarp_one_limage " .. lwimgpage .. " " .. lwimghash .. " " .. lwimgname .. " " .. @@ -12080,6 +12277,7 @@ if ( err ~= 0 ) then os.exit(1) end end -- not hashed or not exists +end -- not page 0 end -- not nil end -- do io.close(limagesfile) @@ -12261,16 +12459,12 @@ print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.") print ("lwarpmk: Done.") -- lwarpmk limages: --- Scan the lateximages.txt file to create lateximages, --- then touch the source to trigger a recompile. +-- Scan the lateximages.txt file to create lateximages. elseif arg[1] == "limages" then loadconf () print ("lwarpmk: Processing images.") createlateximages () -print ("lwarpmk: Forcing an update of " .. sourcename ..".tex.") -refreshdate () -print ("lwarpmk: " .. sourcename ..".tex is ready to be recompiled.") print ("lwarpmk: Done.") -- lwarpmk again: @@ -13186,7 +13380,6 @@ end -- not --version % \cs{protect} is in case the tag appears in TOC, LOF, LOT. % \begin{macrocode} \newcommand*{\LWR@htmltagc}[1]{% -{% \LWR@traceinfo{LWR@htmltagc !\detokenize{#1}!}% \begingroup% \LWR@FBcancel% @@ -13195,8 +13388,7 @@ end -- not --version #1% \protect\LWR@origtextgreater% \endgroup% -\LWR@traceinfo{LWR@htmltagc: done}% -}% +% \LWR@traceinfo{LWR@htmltagc: done}% } % \end{macrocode} % \end{macro} @@ -13799,7 +13991,7 @@ end -- not --version % \begin{macrocode} \newcommand*{\LWR@closeparagraph} {% -\LWR@traceinfo{LWR@closeparagraph}% +% \LWR@traceinfo{LWR@closeparagraph}% % \end{macrocode} % See if paragraph handling is enabled: % \begin{macrocode} @@ -13908,7 +14100,7 @@ end -- not --version % \begin{macrocode} \newcommand*{\LWR@startpars}% {% -\LWR@traceinfo{LWR@startpars}% +% \LWR@traceinfo{LWR@startpars}% % \end{macrocode} % Ignore if inside a span: % \begin{macrocode} @@ -13947,7 +14139,7 @@ end -- not --version % \begin{macrocode} \global\boolfalse{LWR@doingapar}% }% nestspan -\LWR@traceinfo{LWR@startpars: done}% +% \LWR@traceinfo{LWR@startpars: done}% } % \end{macrocode} % \end{macro} @@ -14254,7 +14446,8 @@ end -- not --version % % \subsection{Regular page footnotes} % In \HTML\ documents, footnotes are placed at the -% bottom of the web page using the \LaTeX\ box \cs{LWR@footnotes}. +% bottom of the web page or the section, depending on \progcode{FootnoteDepth}, +% using the \LaTeX\ box \cs{LWR@footnotes}. % Using this instead of the original \cs{footins} box % avoids having footnotes be printed by the output routine, % since footnotes should be printed per \HTML\ page @@ -14279,14 +14472,15 @@ end -- not --version \begin{warpall} % \end{macrocode} -% \DescribeCounter{FootnoteDepth} \DescribeDefault{5} Determines how deeply +% \DescribeCounter{FootnoteDepth} \DescribeDefault{3} Determines how deeply % to place footnotes in the \HTML\ files, similar to |tocdepth|. -% The default of |5| places footnotes before each \cs{subparagraph} or higher. +% The default of |3| places footnotes before each \cs{subsubsection} or higher. % See \cref{tab:depthsheadings} for a table of \LaTeX\ section headings. % \changes{v0.43}{2017/11/08}{Added \progcode{FootnoteDepth}.} +% \changes{v0.52}{2018/03/28}{Changed \progcode{FootnoteDepth} default to \cs{subsbusection}.} % \begin{macrocode} \newcounter{FootnoteDepth} -\setcounter{FootnoteDepth}{5} +\setcounter{FootnoteDepth}{3} % \end{macrocode} % \begin{macrocode} @@ -14319,7 +14513,9 @@ end -- not --version % % \begin{macro}{\@makefnmark} % \begin{macrocode} -\def\@makefnmark{\hbox{\textsuperscript{\@thefnmark}}} +\def\@makefnmark{% + \textsuperscript{\@thefnmark}% +} % \end{macrocode} % \end{macro} % @@ -14361,7 +14557,7 @@ end -- not --version % \begin{macrocode} \color@begingroup% % \end{macrocode} -% Use \HTML\ superscripts even inside a \env{lateximage}: +% Use \HTML\ superscripts in the footnote even inside a \env{lateximage}: % \changes{v0.50}{2018/02/20}{Robustify macros.} % \begin{macrocode} \renewrobustcmd{\textsuperscript}[1]{\LWR@htmlspan{sup}{##1}}% @@ -14395,13 +14591,18 @@ end -- not --version % \begin{macrocode} \color@endgroup% }% vbox +% \end{macrocode} +% Paragraph handling: +% \changes{v0.52}{2018/03/28}{Fix: Paragraph handling.} +% \begin{macrocode} +\LWR@ensuredoingapar% }% % \end{macrocode} % \end{macro} % \begin{macro}{\@footnotetext} \marg{text} % \begin{macrocode} -\let\@footnotetext\LWR@footnotetext +\LetLtxMacro\@footnotetext\LWR@footnotetext % \end{macrocode} % \end{macro} % @@ -14423,13 +14624,13 @@ end -- not --version \long\def\@mpfootnotetext#1{% \LWR@traceinfo{@mpfootnotetext}% \global\setbox\LWR@mpfootnotes\vbox{% - \unvbox\LWR@mpfootnotes - \reset@font\footnotesize - \hsize\columnwidth - \@parboxrestore - \protected@edef\@currentlabel - {\csname p@mpfootnote\endcsname\@thefnmark}% - \color@begingroup + \unvbox\LWR@mpfootnotes% + \reset@font\footnotesize% + \hsize\columnwidth% + \@parboxrestore% + \protected@edef\@currentlabel% + {\csname p@mpfootnote\endcsname\@thefnmark}% + \color@begingroup% % \end{macrocode} % Use paragraph tags if in a tabular data cell or a \env{lateximage}: % \begin{macrocode} @@ -14455,6 +14656,11 @@ end -- not --version }% \color@endgroup% }% vbox +% \end{macrocode} +% Paragraph handling: +% \changes{v0.52}{2018/03/28}{Fix: Paragraph handling.} +% \begin{macrocode} +\LWR@ensuredoingapar% \LWR@traceinfo{@mpfootnotetext: done}% } % \end{macrocode} @@ -14720,7 +14926,6 @@ end -- not --version % % Replaces common symbols and short words with hyphens: % \begin{macrocode} -% \LWR@traceinfo{LWR@filenamenoblanks \#1: !#1!}% \edef\LWR@thisnewfilename{#1}% \LWR@traceinfo{LWR@filenamenoblanks edef: !\LWR@thisnewfilename!}% \fullexpandarg% @@ -14799,12 +15004,27 @@ end -- not --version \StrSubstitute{\LWR@thisnewfilename}{----}{-}[\LWR@thisnewfilename] \StrSubstitute{\LWR@thisnewfilename}{---}{-}[\LWR@thisnewfilename] \StrSubstitute{\LWR@thisnewfilename}{--}{-}[\LWR@thisnewfilename] +% \end{macrocode} +% If pdf\LaTeX\ and not \optn{utf8} encoding, don't try to convert emdash, endash: +% \changes{v0.52}{2018/04/01}{Fix: \cs{FileDepth} with non-utf8 encoding.} +% \begin{macrocode} +\ifPDFTeX% +\ifdefstring{\inputencodingname}{utf8}{% \StrSubstitute{\LWR@thisnewfilename}{—}{-}[\LWR@thisnewfilename] % emdash \StrSubstitute{\LWR@thisnewfilename}{–}{-}[\LWR@thisnewfilename] % endash +}{}% +\else% not PDFTeX +\StrSubstitute{\LWR@thisnewfilename}{—}{-}[\LWR@thisnewfilename] +\StrSubstitute{\LWR@thisnewfilename}{–}{-}[\LWR@thisnewfilename] +\fi% +% \end{macrocode} +% Return the result: +% \begin{macrocode} \global\let\LWR@thisfilename\LWR@thisnewfilename% return a global result -\endgroup +\endgroup% +\LWR@traceinfo{LWR@filenamenoblanks: result is \LWR@thisfilename}% } % \end{macrocode} % \end{macro} @@ -14833,23 +15053,75 @@ end -- not --version % \end{macro} -% \begin{macro}{\LWR@nullifymathjaxensuremath} +% \begin{macro}{\LWR@customizedMathJax} +% Additional \brand{MathJax} definitions to be added to the start of each \HTML\ page. +% \changes{v0.52}{2018/03/31}{Added.} +% \begin{macrocode} +\newcommand*{\LWR@customizedMathJax}{} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\CustomizeMathJax} +% +% \limitscustomizemathjax +% +% \changes{v0.52}{2018/03/31}{Added.} +% \begin{macrocode} +\newcommand*{\CustomizeMathJax}[1]{% + \appto{\LWR@customizedMathJax}{% + \(#1\)\par + }% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\LWR@customizeMathJax} % \changes{v0.51}{2018/03/18}{MathJax: Nullifies \cs{ensuremath}.} % \begin{macrocode} -\newcommand{\LWR@nullifymathjaxensuremath}{% +\newcommand{\LWR@customizeMathJax}{% \ifbool{mathjax}{ \LWR@stoppars \LWR@htmlcomment{Nullify \textbackslash{}ensuremath for MathJax:} -\( -\newcommand\ensuremath[1]{##1} -\) +\(\newcommand\ensuremath[1]{##1}\) + +\LWR@htmlcomment{Additional customizations for MathJax:} + +\LWR@customizedMathJax + \LWR@startpars }{} } % \end{macrocode} % \end{macro} +% \begin{macrocode} +\end{warpHTML} +% \end{macrocode} + + +% \codeprint +% \begin{macrocode} +\begin{warpprint} +% \end{macrocode} + +% \begin{macro}{\CustomizeMathJax} +% The print-mode version: +% \begin{macrocode} +\newcommand*{\CustomizeMathJax}[1]{} +% \end{macrocode} +% \end{macro} + +% \begin{macrocode} +\end{warpprint} +% \end{macrocode} + + + +% \codehtml +% \begin{macrocode} +\begin{warpHTML} +% \end{macrocode} % \begin{macro}{\LWR@newhtmlfile} \marg{section name} % \changes{v0.18}{2016/04/23}{side\TOC\ after title, improving responsive design.} @@ -14942,9 +15214,18 @@ end -- not --version % \end{macrocode} % -% +% If pdf\LaTeX\ and not \optn{utf8} encoding, use a hyphen instead of an emdash: +% \changes{v0.52}{2018/04/01}{Fix: \cs{FileDepth} with non-utf8 encoding.} % \begin{macrocode} +\ifPDFTeX% +\ifdefstring{\inputencodingname}{utf8}{% \LWR@filestart{ — #1}% there is an EMdash in front of the #1 +}{ +\LWR@filestart{ - #1}% hyphen +} +\else% +\LWR@filestart{ — #1}% there is an EMdash in front of the #1 +\fi% % \end{macrocode} % @@ -15007,10 +15288,10 @@ end -- not --version % \end{macrocode} % % If using MathJax, disable \cs{ensuremath} by printing a nullified -% definition at the start of each file: +% definition at the start of each file, and add further customizations: % \changes{v0.51}{2018/03/18}{MathJax: Nullifies \cs{ensuremath}.} % \begin{macrocode} -\LWR@nullifymathjaxensuremath +\LWR@customizeMathJax % \end{macrocode} % % \begin{macrocode} @@ -15373,13 +15654,25 @@ end -- not --version % \end{macrocode} % Print an opening comment with the level and the name; % ex: ``section'' ``Introduction'' +% Footnotes may be used in section names, which would also appear in the +% \HTML\ section opening comments, so the short \TOC\ entry is used if possible, +% and a limited opening comment is made if the sectional unit is starred. % \changes{v0.43}{2017/10/31}{Fix: Nullify fonts inside HTML comment.} +% \changes{v0.52}{2018/03/28}{Fix: Footnote numbering: Limited \HTML\ comment if starred.} +% \changes{v0.52}{2018/03/28}{Fix: Footnote numbering: Use short TOC entry +% for HTMLDebug comments.} % \begin{macrocode} \ifbool{HTMLDebugComments}{% \begingroup% \LWR@nullfonts% - \LWR@htmlcomment{Opening #4 ``#3''{}}% + \IfBooleanTF{#1}% starred + {\LWR@htmlcomment{Opening #4*}}% + {% + \IfNoValueTF{#2}% short TOC + {\LWR@htmlcomment{Opening #4 ``#3''}}% + {\LWR@htmlcomment{Opening #4 ``#2''}}% + } \endgroup% }{}% @@ -15745,7 +16038,7 @@ end -- not --version % % \begin{macrocode} \newcommand*{\LWR@filestart}[1]{ -\LWR@traceinfo{LWR@filestart} +\LWR@traceinfo{LWR@filestart !#1!} % \end{macrocode} % Locally temporarily disable direct-formatting commands: % \begin{macrocode} @@ -16034,10 +16327,10 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \end{macrocode} % % If using MathJax, disable \cs{ensuremath} by printing a nullified -% definition at the start of each file: +% definition at the start of each file, and add further customizations: % \changes{v0.51}{2018/03/18}{MathJax: Nullifies \cs{ensuremath}.} % \begin{macrocode} -\LWR@nullifymathjaxensuremath +\LWR@customizeMathJax % \end{macrocode} % % \begin{macrocode} @@ -16869,15 +17162,29 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \subsection{Citations and attributions} % \begin{macro}{\attribution} -% for use inside quote, quotation, verse: - -% ex: |\attribution{author name} --- \citetitle{book name}| - +% For use inside quote, quotation, verse: +% +% Fx: |\attribution{author name} --- \citetitle{book name}| +% +% \changes{v0.52}{2018/04/01}{Fix: Non-utf8 encoding.} % \codehtml % \begin{macrocode} \begin{warpHTML} +\ifPDFTeX% +\ifdefstring{\inputencodingname}{utf8}{% \newcommand{\attribution}[1]{% -\InlineClass{attribution}{—\,#1}}% emdash + \InlineClass{attribution}{—\,#1}% emdash +} +}{ +\newcommand{\attribution}[1]{% + \InlineClass{attribution}{---\,#1}% +} +} +\else% +\newcommand{\attribution}[1]{% + \InlineClass{attribution}{—\,#1}% emdash +} +\fi% \end{warpHTML} % \end{macrocode} % \codeprint @@ -16891,11 +17198,25 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \begin{macro}{\citetitle} % for use inside quote, quotation, verse: % +% \changes{v0.52}{2018/04/01}{Fix: Non-utf8 encoding.} % \codehtml % \begin{macrocode} \begin{warpHTML} +\ifPDFTeX% +\ifdefstring{\inputencodingname}{utf8}{% +\newcommand{\citetitle}[1]{% + \InlineClass{citetitle}{—\,#1}% +}% +}{ \newcommand{\citetitle}[1]{% -\InlineClass{citetitle}{—\,#1}}% emdash + \InlineClass{citetitle}{---\,#1}% +}% +} +\else% +\newcommand{\citetitle}[1]{% + \InlineClass{citetitle}{—\,#1}% +}% +\fi% \end{warpHTML} % \end{macrocode} % @@ -17139,22 +17460,35 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \limitstabbing % % \changes{v0.42}{2017/10/13}{Added.} +% \changes{v0.52}{2018/03/27}{Fix to allow inside \env{lateximage}.} % % \begin{macrocode} -\AfterEndPreamble{ -\LWR@traceinfo{Patching tabbing.} -\AtBeginEnvironment{tabbing}{% -\LWR@forcenewpage +\LetLtxMacro\LWR@origtabbing\tabbing +\LetLtxMacro\LWR@origendtabbing\endtabbing + +\renewcommand*{\tabbing}{% +\LWR@forcenewpage% \LWR@atbeginverbatim{3.5}{tabbing}% +\LWR@origtabbing% } -\AfterEndEnvironment{tabbing}{% + +\renewcommand*{\endtabbing}{% + \LWR@origendtabbing% \unskip\LWR@origvspace*{-\baselineskip}\LWR@afterendverbatim% } +% \end{macrocode} +% +% \cs{AtBeginDocument} because \cs{LWR@restoreorigformatting} has not yet been defined: +% \begin{macrocode} +\AtBeginDocument{ +\appto\LWR@restoreorigformatting{% +\LetLtxMacro\tabbing\LWR@origtabbing% +\LetLtxMacro\endtabbing\LWR@origendtabbing% +} } % \end{macrocode} % \end{environment} - % \begin{macrocode} \end{warpHTML} % \end{macrocode} @@ -21476,9 +21810,6 @@ autopage-\theLWR@currentautosec% \LWR@sanitize{#1}% \LWR@htmltag{% a href="\LWR@sanitized" % -% a href="% -% \begingroup\@sanitize#1\endgroup% -% " % target="\_{}blank"\LWR@orignewline% }% #2% @@ -21493,9 +21824,7 @@ autopage-\theLWR@currentautosec% % \changes{v0.45}{2017/12/29}{Improved URLs with underscores.} % \begin{macrocode} \NewDocumentCommand{\LWR@subhyperrefclass}{m +m m}{% -% \LWR@sanitize{#1}% \LWR@htmltag{% -% a href="\LWR@sanitized" a href="% \begingroup\@sanitize#1\endgroup% " % @@ -21516,10 +21845,22 @@ autopage-\theLWR@currentautosec% % % \changes{v0.43}{2017/10/31}{Made robust.} % \changes{v0.49}{2018/02/18}{Fix: Adapt to classes.} +% \changes{v0.52}{2018/03/26}{Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} % \begin{macrocode} -\DeclareDocumentCommand{\href}{O{} m +m}{% +\DeclareDocumentCommand{\LWR@hrefb}{O{} m +m}{% \LWR@ensuredoingapar% \LWR@subhyperref{#2}{#3}% +\endgroup% +} + +\newrobustcmd*{\href}{% +\begingroup% +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=12 +\catcode`\~=12 +\catcode`\_=12 +\LWR@hrefb% } % \end{macrocode} % \end{macro} @@ -21528,13 +21869,25 @@ autopage-\theLWR@currentautosec% % % Print the name of the link without creating the link: % \changes{v0.43}{2017/10/31}{Made robust.} -% \changes{v0.45}{2017/12/29}{Improved URLs with underscores.} +% \changes{v0.45}{2017/12/29}{Fix: Underscore in \acro{URL}.} +% \changes{v0.52}{2018/03/26}{Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} % \begin{macrocode} -\newcommand*{\nolinkurl}[1]{% +\newcommand*{\LWR@nolinkurlb}[1]{% \LWR@ensuredoingapar% \def\LWR@templink{#1}% \@onelevel@sanitize\LWR@templink% \LWR@templink% +\endgroup% +} + +\newrobustcmd*{\nolinkurl}{% +\begingroup% +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=12 +\catcode`\~=12 +\catcode`\_=12 +\LWR@nolinkurlb% } % \end{macrocode} % \end{macro} @@ -21543,18 +21896,31 @@ autopage-\theLWR@currentautosec% % \begin{macro}{\url} \marg{URL} % % Create a link whose text name is the address of the link. +% % The \pkg{url} package may redefine \cs{url}, so it is \cs{let} to \cs{LWR@urla}here % and also redefined by \pkg{lwarp-url}. % % \changes{v0.43}{2017/10/31}{Made robust.} % \changes{v0.45}{2017/12/29}{Improved URLs with underscores.} % \changes{v0.49}{2018/02/18}{Fix: Adapt to classes.} +% \changes{v0.52}{2018/03/26}{Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} % \begin{macrocode} -\DeclareDocumentCommand{\url}{m}{% +\DeclareDocumentCommand{\LWR@urlb}{m}{% \LWR@ensuredoingapar% \def\LWR@templink{#1}% \@onelevel@sanitize\LWR@templink% \href{\LWR@templink}{\LWR@templink}% +\endgroup% +} + +\newrobustcmd*{\url}{% +\begingroup% +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=12 +\catcode`\~=12 +\catcode`\_=12 +\LWR@urlb% } % \end{macrocode} % \end{macro} @@ -22719,6 +23085,7 @@ autopage-\theLWR@currentautosec% \fi % \@input@{\jobname.bbl}% original \@input@{\BaseJobname.bbl}% lwarp + \DeclareDocumentCommand{\etalchar}{m}{\textsuperscript{#1}}% lwarp } % \end{macrocode} % \end{macro} @@ -22736,18 +23103,19 @@ autopage-\theLWR@currentautosec% % % % \begin{environment}{thebibliography} -% \changes{v0.45}{2018/01/13}{Patched to emphasize titles.} -% % To emphasize document titles in the bibliography, % the following redefines \cs{em} inside \env{thebibliography} % to gather everything until the next closing brace, % then display these tokens with \cs{textit}. % % { -% \footnotesize\itshape -% Adapted from |embracedef.sty|, which is by \textup{\textsc{Takayuki YATO}}: \\ +% \footnotesize +% \textit{Adapted from |embracedef.sty|, which is by \textup{\textsc{Takayuki YATO}}:} \\ % \hspace*{2em}\url{https://gist.github.com/zr-tex8r/b72555e3e7ad2f0a37f1} % } +% +% \changes{v0.45}{2018/01/13}{Patched to emphasize titles.} +% % \begin{macrocode} \AtBeginDocument{ \AtBeginEnvironment{thebibliography}{ @@ -22765,7 +23133,15 @@ autopage-\theLWR@currentautosec% \endgroup \LWR@em@after\egroup } +\DeclareDocumentCommand{\etalchar}{m}{\textsuperscript{#1}} }% \AtBeginEnvironment{thebibliography} +% \end{macrocode} +% Patch for \pkg{babelbib}: +% \changes{v0.52}{2018/03/30}{Fix for \pkg{babelbib} \cs{etalchar}.} +% \begin{macrocode} +\BeforeBeginEnvironment{thebibliography}{% +\DeclareDocumentCommand{\etalchar}{m}{\textsuperscript{#1}} +}% \BeforeBeginEnvironment }% \AtBeginDocument % \end{macrocode} % \end{environment} @@ -23040,25 +23416,38 @@ autopage-\theLWR@currentautosec% % image. % If neither is loaded, no marker is used. % \changes{v0.51}{2018/03/16}{Improved \SVG\ math baseline.} +% \changes{v0.52}{2018/03/24}{Warnings if \filenm{lwarp\_baseline\_marker.png} is not present +% or if graphicx/s not loaded.} % \begin{macrocode} \AtBeginDocument{ -\@ifpackageloaded{graphicx}{ - \newcommand*{\LWR@addbaselinemarker}{% - \LWR@origincludegraphics[% - width=10sp,height=10sp% - ]{lwarp_baseline_marker.png}% - } -}{ - \@ifpackageloaded{graphics}{ +\IfFileExists{lwarp_baseline_marker.png}% +{ + \@ifpackageloaded{graphicx}{ \newcommand*{\LWR@addbaselinemarker}{% - \LWR@origincludegraphics{lwarp_baseline_marker.png}% + \LWR@origincludegraphics[% + width=10sp,height=10sp% + ]{lwarp_baseline_marker.png}% } }{ - \newcommand*{\LWR@addbaselinemarker}{% - \hspace*{10sp}% + \@ifpackageloaded{graphics}{ + \newcommand*{\LWR@addbaselinemarker}{% + \LWR@origincludegraphics{lwarp_baseline_marker.png}% + } + }{ + \PackageWarning{lwarp}{Load graphicx or graphics + for improved SVG math baselines,} + \newcommand*{\LWR@addbaselinemarker}{% + \hspace*{10sp}% + } } } +}{% lwarp_baseline_marker.png not present + \PackageWarning{lwarp}{File lwarp_baseline_marker.png is not installed alongside + the lwarp-*.sty files, so SVG math baselines may not be accurate,} + \newcommand*{\LWR@addbaselinemarker}{% + \hspace*{10sp}% + } } }% AtBeginDocument @@ -23088,10 +23477,12 @@ autopage-\theLWR@currentautosec% \newsavebox{\LWR@singledollarbox} \NewDocumentCommand{\LWR@subsingledollar}{s m m m}{% +\LWR@traceinfo{LWR@subsingledollar}% % \end{macrocode} % \begin{macrocode} \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% {% +\LWR@traceinfo{LWR@subsingledollar: already in a lateximage}% #4% contents }% {% not in a lateximage @@ -23126,6 +23517,7 @@ autopage-\theLWR@currentautosec% % and a \CSS\ style to control the baseline adjustment. % \begin{macrocode} {% not mathjax +\LWR@traceinfo{LWR@subsingledollar: 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}.} @@ -23141,8 +23533,11 @@ autopage-\theLWR@currentautosec% % Temporarily set font for the \HTML\ \PDF\ output: % \changes{v0.51}{2018/03/14}{Fix: Honors text font around \SVG\ math.} % \begin{macrocode} + \LWR@traceinfo{Using font family \LWR@f@family}% \csuse{LWR@orig\LWR@f@family family}% + \LWR@traceinfo{Using font series \LWR@f@series}% \csuse{LWR@orig\LWR@f@series series}% + \LWR@traceinfo{Using font shape \LWR@f@shape}% \csuse{LWR@orig\LWR@f@shape shape}% % \end{macrocode} % |lateximagedepth| must be nested to avoid generating paragraph tags. @@ -23178,8 +23573,11 @@ autopage-\theLWR@currentautosec% \global\advance\c@LWR@lateximagedepth -1\relax% Due to AmS \text macro. % \end{macrocode} % Measure the depth: +% \changes{v0.52}{2018/03/24}{Added user-adjustable \SVG\ math font scaling.} % \begin{macrocode} - \setlength{\LWR@singledollardepth}{.70\dp\LWR@singledollarbox}% + \setlength{\LWR@singledollardepth}{% + \LateximageFontScale\dp\LWR@singledollarbox% + }% % \end{macrocode} % Make the length a global change: % \begin{macrocode} @@ -23187,13 +23585,19 @@ autopage-\theLWR@currentautosec% % \end{macrocode} % Likewise for width: % \begin{macrocode} - \setlength{\LWR@singledollarwidth}{.70\wd\LWR@singledollarbox}% + \setlength{\LWR@singledollarwidth}{% + \LateximageFontScale\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}% + \setlength{\LWR@singledollarheight}{% + \LateximageFontScale\ht\LWR@singledollarbox% + }% + \addtolength{\LWR@singledollarheight}{% + \LateximageFontScale\dp\LWR@singledollarbox% + }% \global\LWR@singledollarheight=\LWR@singledollarheight% % \end{macrocode} % \begin{macrocode} @@ -23303,6 +23707,7 @@ autopage-\theLWR@currentautosec% }% not mathjax \endgroup% }% not in a lateximage +\LWR@traceinfo{LWR@subsingledollar: done}% } % \end{macrocode} % \end{macro} @@ -23391,7 +23796,7 @@ autopage-\theLWR@currentautosec% % \begin{macrocode} \protected\gdef\LWR@singledollar#1${% \ifbool{mathjax}{% -\LWR@subsingledollar*% + \LWR@subsingledollar*% {% alt tag \textbackslash( % \LWR@HTMLsanitize{#1} % extra space @@ -23400,7 +23805,7 @@ autopage-\theLWR@currentautosec% {singledollar}% add'l hashing {#1}% contents }{% not mathjax -\LWR@subsingledollar*% + \LWR@subsingledollar*% {% alt tag \textbackslash( % \LWR@HTMLsanitize{#1} % extra space @@ -23432,22 +23837,24 @@ autopage-\theLWR@currentautosec% % \begin{macro}{\@ensuredmath} \marg{expression} % +% 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}.} % \changes{v0.42}{2017/10/16}{Improved \cs{ensuremath}.} % \changes{v0.50}{2018/02/23}{Fix: Use \env{lateximage} even if MathJax.} % \changes{v0.50}{2018/02/24}{Improved \SVG\ math \attribute{alt} tags.} +% \changes{v0.52}{2018/03/25}{Improved hashing expansion.} % \begin{macrocode} \LetLtxMacro\LWR@origensuredmath\@ensuredmath \renewcommand{\@ensuredmath}[1]{% \ifbool{mathjax}{% -% \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} - \LWR@subsingledollar*{(math image)}{\LWR@HTMLsanitize{#1}}{\relax% + \LWR@subsingledollar*{(math image)}{% + \protect\LWR@HTMLsanitize{\detokenize\expandafter{#1}}% + }{\relax% \LWR@origensuredmath{#1}% }% }{% SVG math @@ -23464,7 +23871,9 @@ autopage-\theLWR@currentautosec% \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% {\LWR@origensuredmath{#1}}% {% - \LWR@subsingledollar*{(math image)}{\LWR@HTMLsanitize{#1}}{% + \LWR@subsingledollar*{(math image)}{% + \protect\LWR@HTMLsanitize{\detokenize\expandafter{#1}}% + }{% \LWR@origensuredmath{#1}% }% }% @@ -23690,21 +24099,14 @@ autopage-\theLWR@currentautosec% % \begin{macrocode} \let\LWR@origequation\equation \let\LWR@origendequation\endequation +\csletcs{LWR@origequation*}{equation*} +\csletcs{LWR@origendequation*}{endequation*} % \end{macrocode} % -% Remove existing \env{equation} environment: -% \begin{macrocode} -\let\equation\relax -\let\endequation\relax -% \end{macrocode} - - -% \begin{environment}{equation} +% +% \begin{macro}{\LWR@doequation} % \changes{v0.19}{2016/05/25}{\brand{MathJax} support.} -% The new \env{equation} environment is created with -% \cs{NewEnviron} (from the \pkg{environ} package), -% which stores the contents of its environment in a -% macro called \cs{BODY}. +% \changes{v0.52}{2018/03/28}{Fix: \env{equation*} with \env{split}.} % % For \SVG\ math output, % the contents are typeset using the original \env{equation} @@ -23718,7 +24120,7 @@ autopage-\theLWR@currentautosec% % The contents are also printed to the \HTML\ output % for processing by the \brand{MathJax} script. % \begin{macrocode} -\NewEnviron{equation}{% +\newcommand*{\LWR@doequation}[2]{% % \end{macrocode} % If |mathjax| or |FormatWP|, print the \LaTeX\ expression: @@ -23737,7 +24139,7 @@ autopage-\theLWR@currentautosec% % \end{macrocode} % Print the \LaTeX\ math inside an \HTML\ comment: % \begin{macrocode} - \LWR@hidelatexequation{equation}{\BODY} + \LWR@hidelatexequation{#2}{#1} } % \end{macrocode} % SVG output: @@ -23750,37 +24152,77 @@ autopage-\theLWR@currentautosec% % 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.} +% \changes{v0.52}{2018/03/31}{Fix: \env{equation*} now based on \env{equation} instead of \env{displaymath}.} % \begin{macrocode} - \begin{BlockClass}{displaymathnumbered} + \ifstrequal{#2}{equation*}{% + \begin{BlockClass}{displaymath}% + }{% + \begin{BlockClass}{displaymathnumbered}% + }% \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% \begin{lateximage}[% - (\LWR@equationtag) \textbackslash{begin\{equation\}} % extra space - \LWR@HTMLsanitizeexpand{\detokenize\expandafter{\BODY}} % extra space - \textbackslash{end\{equation\}}% + \ifstrequal{#2}{equation*}{% + \ifdefequal{\LWR@equationtag}{\theequation}{% +% no tag was given + }{% + (\LWR@equationtag) % tag was given + }% + }{% + (\LWR@equationtag) % automatic numbering + }% + \textbackslash{begin\{#2\}} % extra space + \LWR@HTMLsanitizeexpand{\detokenize\expandafter{#1}} % extra space + \textbackslash{end\{#2\}}% ]% alt tag % \end{macrocode} % Create the actual \LaTeX-formatted equation inside % the |lateximage| using the contents of the environment. % \begin{macrocode} - \LWR@origequation - \BODY% contents collected by NewEnviron - \LWR@origendequation + \csuse{LWR@orig#2} + #1% contents collected by \collect@body + \csuse{LWR@origend#2} \end{lateximage}% \end{BlockClass} }% not mathjax - +} % \end{macrocode} +% +% % After the environment, if \brand{MathJax}, print the math to the \HTML\ output % for \brand{MathJax} processing: % \begin{macrocode} -}[% +\newcommand*{\LWR@doendequation}[1]{% \ifboolexpr{bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) }% {% - \LWR@addmathjax{equation}{\BODY}% + \LWR@addmathjax{#1}{\BODY}% }{}% -] +} +% \end{macrocode} +% \end{macro} + + +% Remove existing \env{equation} environment: +% \begin{macrocode} +\let\equation\relax +\let\endequation\relax +\csletcs{equation*}{relax} +\csletcs{endequation*}{relax} +% \end{macrocode} + + +% \begin{environment}{equation} +% The new \env{equation} environment is created with +% \cs{NewEnviron} (from the \pkg{environ} package), +% which stores the contents of its environment in a +% macro called \cs{BODY}. +% \begin{macrocode} +\NewEnviron{equation} +{ +\LWR@doequation{\BODY}{equation} +} +[\LWR@doendequation{equation}] \LetLtxMacro\LWR@equationnormal\equation \LetLtxMacro\LWR@endequationnormal\endequation @@ -23790,12 +24232,9 @@ autopage-\theLWR@currentautosec% % \begin{environment}{equation*} % \begin{macrocode} -\csletcs{LWR@origequationstar}{equation*} -\csletcs{LWR@origendequationstar}{endequation*} - -\renewenvironment*{equation*} -{\displaymath} -{\enddisplaymath} +\NewEnviron{equation*} +{\LWR@doequation{\BODY}{equation*}} +[\LWR@doendequation{equation*}] \csletcs{LWR@equationnormalstar}{equation*} \csletcs{LWR@endequationnormalstar}{endequation*} @@ -24545,7 +24984,8 @@ autopage-\theLWR@currentautosec% % \subsection{Font size} - +% \label{sec:mathfontscale} +% % \codeall % \begin{macrocode} \begin{warpall} @@ -24553,7 +24993,7 @@ autopage-\theLWR@currentautosec% % \begin{macro}{\LateximageFontSizeName} % \changes{v0.19}{2016/05/29}{Add: User-adjustable math/lateximage font size.} -% Declares how large to write text in the \cs{lateximage}. The |.svg| file text size +% Declares how large to write text in \cs{lateximage}s. The |.svg| file text size % should blend well with the surrounding \HTML\ text size. % % \emph{Do not include the leading backslash in the name.} @@ -24564,6 +25004,18 @@ autopage-\theLWR@currentautosec% % \end{macrocode} % \end{macro} +% \begin{macro}{\LateximageFontScale} +% \changes{v0.52}{2018/03/24}{Added user-adjustable \SVG\ math font scaling.} +% Declares how large to scale inline \SVG\ math images. The |.svg| file text size +% should blend well with the surrounding \HTML\ text size. +% The default is .75, but it may be redefined as needed depending on the +% \HTML\ font. +% +% \begin{macrocode} +\newcommand*{\LateximageFontScale}{.75} +% \end{macrocode} +% \end{macro} + % \begin{macrocode} \end{warpall} % \end{macrocode} @@ -24719,8 +25171,11 @@ autopage-\theLWR@currentautosec% % \begin{macro}{\LWR@equationtag} \quad % Prints the ending equation number or tag. +% +% This is reset by \env{lateximage}, +% may be temporarily overwritten by \cs{tag} calling \cs{LWR@remembertag}. % \begin{macrocode} -\let\LWR@equationtag\theequation +\newcommand*{\LWR@equationtag}{} % \end{macrocode} % \end{macro} @@ -24747,8 +25202,7 @@ autopage-\theLWR@currentautosec% {% \global\boolfalse{LWR@isstartingequation}% \xdef\LWR@startingequationtag{#1}% -}% -{}% +}{}% \xdef\LWR@equationtag{#1}% }% % \end{macrocode} @@ -24870,6 +25324,9 @@ autopage-\theLWR@currentautosec% \addtocounter{LWR@startingequation}{1}% \booltrue{LWR@isstartingequation}% \let\LWR@startingequationtag\theLWR@startingequation% +% \end{macrocode} +% The default equation tag, unless overwritten by \cs{tag}: +% \begin{macrocode} \let\LWR@equationtag\theequation% % \end{macrocode} % Starting a new lateximage: @@ -24909,16 +25366,28 @@ autopage-\theLWR@currentautosec% \LWR@traceinfo{lateximage: about to write to lateximages.txt}% \IfBooleanTF{#1}% starred {% hash - \LWR@traceinfo{lateximage: hash true, adding !#2!#3!}% + \LWR@traceinfo{lateximage: hash true, adding % + !\detokenize\expandafter{#2}!\detokenize\expandafter{#3}!}% +% \end{macrocode} +% Compute and save the hashed file name for later use: +% \changes{v0.52}{2018/03/25}{Fix for hash expansion.} +% \begin{macrocode} \edef\LWR@hashedname{% \LWR@mdfive{\detokenize\expandafter{#2}-!-#3}% +% \LWR@mdfive{\detokenize\expandafter{#2}-!-\detokenize\expandafter{#3}}% }% \LWR@traceinfo{lateximage: hash is \LWR@hashedname}% +% \end{macrocode} +% Write the page, hashing, and hashed name: +% \begin{macrocode} \immediate\write\LWR@lateximagesfile{% |\arabic{LWR@LIpage}|true|\LWR@hashedname|% }% }% hash {% no hash +% \end{macrocode} +% No hash, so write the page, no hashing, and the image number: +% \begin{macrocode} \LWR@traceinfo{lateximage: hash false}% \immediate\write\LWR@lateximagesfile{% |\arabic{LWR@LIpage}|false|lateximage-\arabic{LWR@externalfilecnt}|% @@ -24960,7 +25429,7 @@ autopage-\theLWR@currentautosec% % \begin{macrocode} \def\@mpfn{footnote}% \def\thempfn{\thefootnote}% - \let\@footnotetext\LWR@footnotetext% + \LetLtxMacro\@footnotetext\LWR@footnotetext% % \end{macrocode} % Create the |LWRlateximage| label: % \begin{macrocode} @@ -24984,8 +25453,8 @@ autopage-\theLWR@currentautosec% \LetLtxMacro\]\LWR@origclosebracket% \let\equation\LWR@origequation% \let\endequation\LWR@origendequation% - \csletcs{equation*}{LWR@origequationstar}% - \csletcs{endequation*}{LWR@origendequationstar}% + \csletcs{equation*}{LWR@origequation*}% + \csletcs{endequation*}{LWR@origendequation*}% }% not in display math % \end{macrocode} % For \pkg{chemformula}: @@ -26669,6 +27138,12 @@ width:\LWR@printlength{\LWR@tempwidth}% \def\(##1\){}% \def\[##1\]{}% \RenewDocumentCommand{\LWR@subsingledollar}{s m m m}{} +% \end{macrocode} +% Use the simpler form with \cs{texorpdfstring}: +% \changes{v0.52}{2018/03/31}{Fix: \cs{texorpdfstring} in section names.} +% \begin{macrocode} +\let\texorpdfstring\relax% +\newcommand{\texorpdfstring}[2]{##2}% } % \end{macrocode} % \end{macro} @@ -29326,7 +29801,8 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \pkg{breakurl} is emulated. % % \changes{v0.43}{2017/10/31}{\pkg{breakurl}: Added.} -% \changes{v0.45}{2017/12/29}{Improved URLs with underscores.} +% \changes{v0.45}{2017/12/29}{\pkg{breakurl}: Fix: Underscore in \acro{URL}.} +% \changes{v0.52}{2018/03/26}{\pkg{breakurl}: Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} % % \codehtml % @@ -29337,7 +29813,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \begin{macrocode} \LetLtxMacro\burl\url -\NewDocumentCommand{\burlalt}{O{} +m m}{% +\NewDocumentCommand{\LWR@burlaltb}{O{} +m m}{% \LWR@ensuredoingapar% \def\LWR@templink{#2}% \@onelevel@sanitize\LWR@templink% @@ -29345,6 +29821,17 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \@onelevel@sanitize\LWR@templinktwo% \LWR@subhyperref{\LWR@templink}{\LWR@templinktwo}% \LWR@ensuredoingapar% +\endgroup% +} + +\newrobustcmd*{\burlalt}{% +\begingroup% +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=12 +\catcode`\~=12 +\catcode`\_=12 +\LWR@burlaltb% } \LetLtxMacro\urlalt\burlalt @@ -30016,7 +30503,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \LWR@subsingledollar*{% lwarp \textbackslash{}ch\{\LWR@HTMLsanitize{#2}\}% alt text }{% - \LWR@HTMLsanitize{#1}% add'l hashing + \protect\LWR@HTMLsanitize{\detokenize\expandafter{#1}}% add'l hashing }% {% \chemformula_ch:nn {#1} {#2}% original @@ -30037,7 +30524,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \LWR@subsingledollar*{% lwarp \textbackslash{}chcpd\{\LWR@HTMLsanitize{#2}\}% }{% - \LWR@HTMLsanitize{#1}% + \protect\LWR@HTMLsanitize{\detokenize\expandafter{#1}}% }{% original \group_begin: \tl_if_blank:nF {#2} @@ -30095,7 +30582,10 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% { \begingroup% \boolfalse{mathjax}% - \LWR@subsingledollar*{\textbackslash{}chlewis\{#2\}\{#3\}}{#1}{ + \LWR@subsingledollar*{\textbackslash{}chlewis\{#2\}\{#3\}}% + { + \protect\LWR@HTMLsanitize{\detokenize\expandafter{#1}}% + }{ \chemformula_lewis:nnn {#1} {#2} {#3} } \endgroup% @@ -30292,9 +30782,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \begin{macrocode} \ExplSyntaxOn -\cs_undefine:N \chemgreek_text:n - -\cs_new_protected:Npn \chemgreek_text:n #1 +\cs_gset_protected:Npn \chemgreek_text:n #1 { { \text {#1} } } \appto\LWR@restoreorigformatting{% @@ -30431,7 +30919,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \LWR@subsingledollar*{ \textbackslash{}p\{\LWR@HTMLsanitize{#1}\} }{ - chemmacrosp\LWR@HTMLsanitize{#1} + chemmacrosp\protect\LWR@HTMLsanitize{\detokenize\expandafter{#1}}% }{ \group_begin: \mbox @@ -30982,7 +31470,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \LWR@subsingledollar*{% yes hash \textbackslash{}ox*\{\LWR@HTMLsanitize{#3}\}% alt }{% - star \LWR@HTMLsanitize{#2}% addl' hashing with star + star \protect\LWR@HTMLsanitize{\detokenize\expandafter{#2}}% }{% \LWR@chemmacros@ox* {#2} {#3}% contents }% @@ -30991,7 +31479,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \LWR@subsingledollar*{% yes hash \textbackslash{}ox*\{\LWR@HTMLsanitize{#3}\}% alt }{% - \LWR@HTMLsanitize{#2}% addl' hashing without star + \protect\LWR@HTMLsanitize{\detokenize\expandafter{#2}}% }{% \LWR@chemmacros@ox {#2} {#3}% contents }% @@ -31386,8 +31874,7 @@ name = \chemmacros_translate:n {scheme-name} % \begin{macrocode} \ExplSyntaxOn -\cs_undefine:N \chemnum_compound_write:n -\cs_new_protected:Npn \chemnum_compound_write:n #1 +\cs_gset_protected:Npn \chemnum_compound_write:n #1 { \chemnum_get_compound_property:nn {#1} {pre-main-label-code} \group_begin: @@ -31403,8 +31890,7 @@ name = \chemmacros_translate:n {scheme-name} \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 +\cs_gset_protected:Npn \chemnum_subcompound_write:nn #1#2 { \group_begin: \bool_if:NTF \l__chemnum_compound_local_bool @@ -32213,6 +32699,7 @@ name = \chemmacros_translate:n {scheme-name} % \pkg{endfloat} is ignored. % % \changes{v0.45}{2017/12/19}{\pkg{endfloat}: Added.} +% \changes{v0.52}{2018/03/26}{\pkg{endfloat}: Updated for v2.6.} % % \codehtml % @@ -32233,6 +32720,10 @@ name = \chemmacros_translate:n {scheme-name} \newcommand{\AtBeginDelayedFloats}[1]{} \newcommand*{\processdelayedfloats}{} \newcommand*{\efloatseparator}{} +\def\efloattype{} +\providecommand\efloatheading[1]{} +\providecommand\efloatpreamble{} +\providecommand\efloatpostamble{} % \end{macrocode} % % \iffalse @@ -32783,19 +33274,78 @@ name = \chemmacros_translate:n {scheme-name} % % \limitsfancybox % +% \limitsverbatimfootnotes % % \changes{v0.34}{2017/07/27}{\pkg{fancybox}: Added.} % \changes{v0.42}{2017/10/27}{\pkg{fancybox}: If \progcode{FormatWP} add HTML styles.} +% \changes{v0.52}{2018/03/29}{\pkg{fancyvrb}: Initial support for \cs{VerbatimFootnotes}.} % -% \codehtml % \begin{macrocode} -\begin{warpHTML} +\LWR@ProvidesPackagePass{fancybox} % \end{macrocode} % +% After the preamble is loaded, after any patches to \env{Verbatim}: % \begin{macrocode} -\LWR@ProvidesPackagePass{fancybox} +\AfterEndPreamble{ +\LWR@traceinfo{Patching fancybox.} +% \end{macrocode} +% +% \begin{noindmacro}{\VerbatimFootnotes} +% Patched to use the new version. +% \begin{macrocode} +\def\VerbatimFootnotes{% +\let\@footnotetext\V@footnotetext% +\let\LWR@footnotetext\V@footnotetext% lwarp +} +% \end{macrocode} +% \end{noindmacro} +% +% \begin{noindmacro}{\V@@footnotetext} +% Patches in a subset of \pkg{lwarp}'s \cs{LWR@footnotetext} to the +% \pkg{fancyvrb} version of \cs{V@@footnotetext}. +% \begin{macrocode} +\def\V@@footnotetext{% +\LWR@traceinfo{V@footnotetext}% +\global\setbox\LWR@footnotes=\vbox\bgroup% +% \end{macrocode} +% Add to any current footnotes: +% \begin{macrocode} + \unvbox\LWR@footnotes% +% \end{macrocode} +% Remember the footnote number for \cs{ref}: +% \begin{macrocode} + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark% + }% @currentlabel +% \end{macrocode} +% Use \HTML\ superscripts in the footnote even inside a \env{lateximage}: +% \begin{macrocode} + \renewrobustcmd{\textsuperscript}[1]{\LWR@htmlspan{sup}{##1}}% +% \end{macrocode} +% Use paragraph tags if in a tabular data cell or a \env{lateximage}: +% \begin{macrocode} + \ifthenelse{% + \boolean{LWR@doingstartpars} \AND% + \cnttest{\value{LWR@lateximagedepth}}{=}{0}% + }% + {}% + {\LWR@htmltagc{\LWR@tagregularparagraph}}% +% \end{macrocode} +% Append the footnote to the list: +% \begin{macrocode} + \@makefntext{}% +% \end{macrocode} +% \begin{macrocode} + \bgroup% + \aftergroup{\V@@@footnotetext}% + \ignorespaces% +}% % \end{macrocode} +% \end{noindmacro} % +% \begin{macrocode} +}% AfterEndPreamble +% \end{macrocode} % % % \begin{macrocode} @@ -32970,10 +33520,6 @@ name = \chemmacros_translate:n {scheme-name} } % \end{macrocode} % -% \begin{macrocode} -\end{warpHTML} -% \end{macrocode} -% % \iffalse % % \fi @@ -33143,43 +33689,84 @@ name = \chemmacros_translate:n {scheme-name} % \DescribePackage{fancyvrb} % \pkg{fancyvrb} is supported with some patches. % +% \limitsverbatimfootnotes % % \changes{v0.34}{2017/07/27}{\pkg{fancyvrb}: Added, no longer required.} % \changes{v0.45}{2018/01/07}{\pkg{fancyvrb}: Improvements.} +% \changes{v0.52}{2018/03/29}{\pkg{fancyvrb}: Initial support for \cs{VerbatimFootnotes}.} +% % -% \codehtml % \begin{macrocode} \RequirePackage{xcolor}% for \convertcolorspec \LWR@ProvidesPackagePass{fancyvrb} % \end{macrocode} % -% \codehtml +% Initial default patch for fancyvrb: % \begin{macrocode} -\begin{warpHTML} +\fvset{frame=none}% % \end{macrocode} % - -% Initial default patch for fancyvrb: +% After the preamble is loaded, after any patches to \env{Verbatim}: % \begin{macrocode} -\fvset{frame=none}% +\AfterEndPreamble{ +\LWR@traceinfo{Patching fancyvrb.} % \end{macrocode} - -% For \cs{VerbatimFootnotes}: +% +% +% \begin{noindmacro}{\VerbatimFootnotes} +% Patched to use the new version. % \begin{macrocode} -\renewcommand{\VerbatimFootnotes}{ -\PackageError{lwarp} -{Verbatim footnotes are not yet supported by lwarp.} -{This may be improved some day.} +\def\VerbatimFootnotes{% +\let\@footnotetext\V@footnotetext% +\let\footnote\V@footnote% +\let\LWR@footnotetext\V@footnotetext% lwarp } % \end{macrocode} - - -% After the preamble is loaded, after any patches to \env{Verbatim}: +% \end{noindmacro} +% +% \begin{noindmacro}{\V@@footnotetext} +% Patches in a subset of \pkg{lwarp}'s \cs{LWR@footnotetext} to the +% \pkg{fancyvrb} version of \cs{V@@footnotetext}. % \begin{macrocode} -\AfterEndPreamble{ -\LWR@traceinfo{Patching Verbatim.} +\def\V@@footnotetext{% +\LWR@traceinfo{V@footnotetext}% +\global\setbox\LWR@footnotes=\vbox\bgroup% % \end{macrocode} +% Add to any current footnotes: +% \begin{macrocode} + \unvbox\LWR@footnotes% +% \end{macrocode} +% Remember the footnote number for \cs{ref}: +% \begin{macrocode} + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark% + }% @currentlabel +% \end{macrocode} +% Use \HTML\ superscripts in the footnote even inside a \env{lateximage}: +% \begin{macrocode} + \renewrobustcmd{\textsuperscript}[1]{\LWR@htmlspan{sup}{##1}}% +% \end{macrocode} +% Use paragraph tags if in a tabular data cell or a \env{lateximage}: +% \begin{macrocode} + \ifthenelse{% + \boolean{LWR@doingstartpars} \AND% + \cnttest{\value{LWR@lateximagedepth}}{=}{0}% + }% + {}% + {\LWR@htmltagc{\LWR@tagregularparagraph}}% +% \end{macrocode} +% Append the footnote to the list: +% \begin{macrocode} + \@makefntext{}% +% \end{macrocode} +% \begin{macrocode} + \bgroup% + \aftergroup{\V@@@footnotetext}% + \ignorespaces% +}% +% \end{macrocode} +% \end{noindmacro} % % % \changes{v0.45}{2018/01/07}{\pkg{fancyvrb}: Improvements.} @@ -33435,10 +34022,6 @@ solid \LWR@origpound\LWR@tempcolor ; % } % \AfterEndPreamble % \end{macrocode} -% \begin{macrocode} -\end{warpHTML} -% \end{macrocode} -% % \iffalse % % \fi @@ -34535,6 +35118,8 @@ solid \LWR@origpound\LWR@tempcolor ; % % \DescribePackage{footmisc} % \pkg{footmisc} is emulated. % +% \pkg{lwarp} incidentally happens to emulate the \optn{stable} option. +% % \begin{macrocode} \LWR@ProvidesPackageDrop{footmisc} % \end{macrocode} @@ -34568,19 +35153,19 @@ solid \LWR@origpound\LWR@tempcolor ; % % \begin{macrocode} \newcommand\mpfootnotemark{% \@ifnextchar[% - \@xmpfootnotemark + \@xmpfootnotemark% {% - \stepcounter\@mpfn + \stepcounter\@mpfn% \protected@xdef\@thefnmark{\thempfn}% - \@footnotemark + \@footnotemark% }% } \def\@xmpfootnotemark[#1]{% - \begingroup - \csname c@\@mpfn\endcsname #1\relax + \begingroup% + \csname c@\@mpfn\endcsname #1\relax% \unrestored@protected@xdef\@thefnmark{\thempfn}% - \endgroup - \@footnotemark + \endgroup% + \@footnotemark% } % \end{macrocode} % @@ -35253,8 +35838,9 @@ solid \LWR@origpound\LWR@tempcolor ; % % % % Handle origin key: +% \changes{v0.52}{2018/03/27}{pkg{graphics}: Added defaults.} % \begin{macrocode} -\define@key{igraph}{origin}{% +\define@key{igraph}{origin}[c]{% \renewcommand*{\LWR@igorigin}{#1}% } % \end{macrocode} @@ -35282,6 +35868,7 @@ solid \LWR@origpound\LWR@tempcolor ; % % \end{macrocode} % % Numerous ignored keys: +% \changes{v0.52}{2018/03/27}{pkg{graphics}: Added defaults.} % \begin{macrocode} \define@key{igraph}{bb}{} \define@key{igraph}{bbllx}{} @@ -35290,18 +35877,31 @@ solid \LWR@origpound\LWR@tempcolor ; % \define@key{igraph}{bbury}{} \define@key{igraph}{natwidth}{} \define@key{igraph}{natheight}{} -\define@key{igraph}{hiresbb}{} +\define@key{igraph}{hiresbb}[true]{} \define@key{igraph}{viewport}{} \define@key{igraph}{trim}{} \define@key{igraph}{totalheight}{} -\define@key{igraph}{keepaspectratio}{} -\define@key{igraph}{clip}{} -\define@key{igraph}{draft}{} +\define@key{igraph}{keepaspectratio}[true]{} +\define@key{igraph}{clip}[true]{} +\define@key{igraph}{draft}[true]{} \define@key{igraph}{type}{} \define@key{igraph}{ext}{} \define@key{igraph}{read}{} \define@key{igraph}{command}{} % \end{macrocode} +% New in v1.1a: +% \changes{v0.52}{2018/03/27}{pkg{graphicx}: Updated for v1.1a.} +% \begin{macrocode} +\define@key{igraph}{quite}{} +\define@key{igraph}{page}{} +\define@key{igraph}{pagebox}{} +\define@key{igraph}{interpolate}[true]{} +% \end{macrocode} +% New in v1.1b: +% \changes{v0.52}{2018/03/27}{pkg{graphicx}: Updated for v1.1b.} +% \begin{macrocode} +\define@key{igraph}{decodearray}{} +% \end{macrocode} % \subsection{Printing HTML styles} @@ -36137,7 +36737,7 @@ img src="% % \codehtml % \begin{macrocode} % \LWR@ProvidesPackageDrop{hyperref} -\typeout{Using the lwarp html version of package `hyperref' — discarding options.} +\typeout{Using the lwarp html version of package `hyperref', discarding options.} \typeout{ Are not using ProvidesPackage, so that other packages} \typeout{ do not attempt to patch lwarp's version of `hyperref'.} % \ProvidesPackage{lwarp-#1-#2} @@ -36152,20 +36752,33 @@ img src="% -% \begin{noindmacro}{\hyperimage} \marg{url} \marg{alt text} +% \begin{noindmacro}{\hyperimage} \marg{URL} \marg{alt text} % % Insert an image with alt text: % % \changes{v0.43}{2017/10/31}{\pkg{hyperref}: Made robust.} -% \changes{v0.45}{2017/12/29}{Improved filenames with underscores.} +% \changes{v0.45}{2017/12/29}{\pkg{hyperref}: Fix: Underscore in \acro{URL}.} +% \changes{v0.52}{2018/03/26}{\pkg{hyperref}: Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} % \begin{macrocode} -\NewDocumentCommand{\hyperimage}{m +m}{% +\NewDocumentCommand{\LWR@hyperimageb}{m +m}{% \LWR@ensuredoingapar% \def\LWR@templink{#1}% \@onelevel@sanitize\LWR@templink% \LWR@htmltag{img src="\LWR@templink" alt="#2" class="hyperimage"}% \LWR@ensuredoingapar% +\endgroup% +} + +\newrobustcmd*{\hyperimage}{% +\begingroup% +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=12 +\catcode`\~=12 +\catcode`\_=12 +\LWR@hyperimageb% } + % \end{macrocode} % \end{noindmacro} % @@ -36175,23 +36788,38 @@ img src="% % % Creates an \HTML\ anchor to |category.name| with the given text. % +% \changes{v0.52}{2018/03/26}{\pkg{hyperref}: Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} % \begin{macrocode} -\NewDocumentCommand{\hyperdef}{m m +m}{% +\NewDocumentCommand{\LWR@hyperdefb}{m m +m}{% \LWR@ensuredoingapar% \LWR@sublabel{#1.#2}% #3% +\endgroup% +} + +\newcommand*{\hyperdef}{% +\begingroup% +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=12 +\catcode`\~=12 +\catcode`\_=12 +\LWR@hyperdefb% } + % \end{macrocode} % \end{noindmacro} % % % \begin{noindmacro}{\LWR@hyperrefb} \marg{1: URL} \marg{2: category} % \marg{3: name} \marg{4: text} -% \changes{v0.45}{2018/01/02}{\pkg{hyperref}: Fix for underscores in \cs{hyperref}.} +% \changes{v0.45}{2018/01/02}{\pkg{hyperref}: Fix: Underscore in \acro{URL}.} +% \changes{v0.52}{2018/03/26}{\pkg{hyperref}: Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} % % Creates an \HTML\ link to |URL#category.name| with the given text. % \begin{macrocode} -\NewDocumentCommand{\LWR@hyperrefb}{m m m +m}{% +% \NewDocumentCommand{\LWR@hyperrefb}{m m m +m}{% +\NewDocumentCommand{\LWR@hyperrefbb}{m m m +m}{% \def\LWR@templink{#1}% \@onelevel@sanitize\LWR@templink% \def\LWR@templinktwo{#2}% @@ -36203,6 +36831,17 @@ img src="% }% #4% \LWR@htmltag{/a}% +\endgroup% +} + +\newrobustcmd*{\LWR@hyperrefb}{% +\begingroup% +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=12 +\catcode`\~=12 +\catcode`\_=12 +\LWR@hyperrefbb% } % \end{macrocode} % \end{noindmacro} @@ -36211,10 +36850,21 @@ img src="% % % Creates text as an \HTML\ link to the \LaTeX\ label. % \begin{macrocode} -\NewDocumentCommand{\LWR@hyperrefc}{O{label} +m}{ +\NewDocumentCommand{\LWR@hyperrefcb}{O{label} +m}{ \LWR@startref{#1}% #2% \LWR@htmltag{/a}% +\endgroup% +} + +\newcommand*{\LWR@hyperrefc}{% +\begingroup% +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=12 +\catcode`\~=12 +\catcode`\_=12 +\LWR@hyperrefcb% } % \end{macrocode} % \end{noindmacro} @@ -36238,10 +36888,22 @@ img src="% % % Creates an anchor to |name| with the given text. % +% \changes{v0.52}{2018/03/26}{\pkg{hyperref}: Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} % \begin{macrocode} -\NewDocumentCommand{\hypertarget}{m +m}{% +\NewDocumentCommand{\LWR@hypertargetb}{m +m}{% \label{#1}% #2% +\endgroup% +} + +\newcommand*{\hypertarget}{% +\begingroup% +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=12 +\catcode`\~=12 +\catcode`\_=12 +\LWR@hypertargetb% } % \end{macrocode} % \end{noindmacro} @@ -36253,9 +36915,22 @@ img src="% % with the given link text. % % Declared because also defined by \pkg{memoir}. +% +% \changes{v0.52}{2018/03/26}{\pkg{hyperref}: Fix: \progcode{\#}, \progcode{\%}, \progcode{\&}, \progcode{\~}, \progcode{\_} in \acro{URL}.} % \begin{macrocode} -\DeclareDocumentCommand{\hyperlink}{m +m}{% +\DeclareDocumentCommand{\LWR@hyperlinkb}{m +m}{% \hyperref[#1]{#2}% +\endgroup% +} + +\newcommand*{\hyperlink}{% +\begingroup% +\catcode`\#=12 +\catcode`\%=12 +\catcode`\&=12 +\catcode`\~=12 +\catcode`\_=12 +\LWR@hyperlinkb% } % \end{macrocode} % \end{noindmacro} @@ -37607,8 +38282,13 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \newlength{\LTcapwidth} % \end{macrocode} % +% \changes{v0.52}{2018/03/27}{Restore \cs{kill} in a \env{lateximage}.} % \begin{macrocode} +\LetLtxMacro\LWR@origkill\kill \renewcommand*{\kill}{\LWR@tabularendofline} +\appto\LWR@restoreorigformatting{% +\LetLtxMacro\kill\LWR@origkill% +} % \end{macrocode} % \iffalse @@ -38782,8 +39462,8 @@ background: % 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} +% \index{array>\pkg{mhchem}} +% \index{math>\pkg{mhchem}} % % For some examples from the \pkg{mhchem} manual, change as follows: % \begin{Verbatim}[gobble=2,frame=leftline, xleftmargin=.5in,obeytabs,tabsize=4] @@ -39551,7 +40231,7 @@ class="td% % % Discard all options for \pkg{lwarp-nameref}: % \begin{macrocode} -\typeout{Using the lwarp html version of package `nameref' — discarding options.} +\typeout{Using the lwarp html version of package `nameref', discarding options.} \typeout{ Are not using ProvidesPackage, so that other packages} \typeout{ do not attempt to patch lwarp's version of `nameref'.} \DeclareOption*{} @@ -39759,6 +40439,45 @@ class="td% % % % +% \iffalse +%<*nicefrac> +% \fi +% +% \part{lwarp-nicefrac.sty} + +% \section{nicefrac} +% +% \credits{Axel Reichert} +% +% \DescribePackage{nicefrac} +% \pkg{nicefrac} is patched for use by \pkg{lwarp}. +% +% \changes{v0.52}{2018/03/25}{\pkg{nicefrac}: Added.} +% +% \codehtml +% +% \begin{macrocode} +\LWR@ProvidesPackagePass{nicefrac} +% \end{macrocode} +% +% \pkg{nicefrac} uses \TeX\ boxes, so \cs{@ensuredmath} must be restored temporarily: +% \begin{macrocode} +\LetLtxMacro\LWR@origUnitsNiceFrac\@UnitsNiceFrac + +\DeclareRobustCommand*{\@UnitsNiceFrac}[3][]{% +\begingroup% +\LetLtxMacro\@ensuredmath\LWR@origensuredmath% +\LWR@origUnitsNiceFrac[#1]{#2}{#3}% +\endgroup% +} +% \end{macrocode} + +% \iffalse +% +% \fi +% +% +% % % \iffalse %<*nonfloat> @@ -42755,9 +43474,11 @@ class="td% % \__siunitx_print:nn { number } { \ensuremath {#1} } \LWR@subsingledollar{% lwarp \textbackslash( \LWR@HTMLsanitize{#1} \textbackslash)% lwarp - }{siunitx}{\__siunitx_print:nn { number } { - \LWR@origensuredmath{#1} - }}% lwarp + }{siunitx}{% + \__siunitx_print:nn { number } {% + \LWR@origensuredmath{#1}% + }% + }% lwarp % \end{macrocode} % \begin{macrocode} \__siunitx_unit_output_print: @@ -46618,6 +47339,46 @@ class="td% % % % +% \iffalse +%<*url> +% \fi +% +% \part{lwarp-url.sty} + +% \section{url} +% +% \credits{Donald Arseneau} +% +% \DescribePackage{url} +% \pkg{url} is patched for use by \pkg{lwarp}. +% +% \changes{v0.52}{2018/03/29}{\pkg{url}: Added.} +% +% \codehtml +% +% \begin{macrocode} +\LWR@ProvidesPackagePass{url} +% \end{macrocode} + +% \pkg{url} uses math mode to print its string inside a group, so the original meaning +% of math is restored first. +% \begin{macrocode} +\LetLtxMacro\LWR@url@origUrl@FormatString\Url@FormatString + +\renewcommand*{\Url@FormatString}{% + \InlineClass{verbatim}{% + \LWR@restoreorigformatting% + \LWR@url@origUrl@FormatString% + }% +} +% \end{macrocode} + +% \iffalse +% +% \fi +% +% +% % % \iffalse %<*verse> diff --git a/Master/texmf-dist/source/latex/lwarp/lwarp.ins b/Master/texmf-dist/source/latex/lwarp/lwarp.ins index fb9d9c5ba27..cf57ecd3dc1 100644 --- a/Master/texmf-dist/source/latex/lwarp/lwarp.ins +++ b/Master/texmf-dist/source/latex/lwarp/lwarp.ins @@ -193,6 +193,7 @@ version 2005/12/01 or later. \file{lwarp-newclude.sty}{\from{lwarp.dtx}{newclude}} \file{lwarp-newunicodechar.sty}{\from{lwarp.dtx}{newunicodechar}} \file{lwarp-nextpage.sty}{\from{lwarp.dtx}{nextpage}} +\file{lwarp-nicefrac.sty}{\from{lwarp.dtx}{nicefrac}} \file{lwarp-nonfloat.sty}{\from{lwarp.dtx}{nonfloat}} \file{lwarp-nonumonpart.sty}{\from{lwarp.dtx}{nonumonpart}} \file{lwarp-nopageno.sty}{\from{lwarp.dtx}{nopageno}} @@ -277,6 +278,7 @@ version 2005/12/01 or later. \file{lwarp-typearea.sty}{\from{lwarp.dtx}{typearea}} \file{lwarp-ulem.sty}{\from{lwarp.dtx}{ulem}} \file{lwarp-upref.sty}{\from{lwarp.dtx}{upref}} +\file{lwarp-url.sty}{\from{lwarp.dtx}{url}} \file{lwarp-verse.sty}{\from{lwarp.dtx}{verse}} \file{lwarp-vertbars.sty}{\from{lwarp.dtx}{vertbars}} \file{lwarp-vmargin.sty}{\from{lwarp.dtx}{vmargin}} -- cgit v1.2.3