From 466ee0c0a668f6727da95fa0c205e0b77a57e28d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 22:56:10 +0000 Subject: CTAN sync 201909022256 --- macros/latex/contrib/lwarp/README.txt | 2 +- macros/latex/contrib/lwarp/lwarp.dtx | 1436 ++++++++++++++++++++++++++------ macros/latex/contrib/lwarp/lwarp.pdf | Bin 2456196 -> 2486872 bytes macros/latex/contrib/lwarp/lwarpmk.lua | 51 +- 4 files changed, 1211 insertions(+), 278 deletions(-) (limited to 'macros/latex/contrib/lwarp') diff --git a/macros/latex/contrib/lwarp/README.txt b/macros/latex/contrib/lwarp/README.txt index 8096e91183..f688b4b655 100644 --- a/macros/latex/contrib/lwarp/README.txt +++ b/macros/latex/contrib/lwarp/README.txt @@ -1,5 +1,5 @@ -LaTeX lwarp package v0.73 README.txt +LaTeX lwarp package v0.74 README.txt Files included are: diff --git a/macros/latex/contrib/lwarp/lwarp.dtx b/macros/latex/contrib/lwarp/lwarp.dtx index 1fb0b0536c..cb3c21b5ac 100644 --- a/macros/latex/contrib/lwarp/lwarp.dtx +++ b/macros/latex/contrib/lwarp/lwarp.dtx @@ -16,7 +16,7 @@ % \iffalse %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{lwarp} -% [2019/07/11 v0.73 Allows LaTeX to directly produce HTML5 output.] +% [2019/09/02 v0.74 Allows LaTeX to directly produce HTML5 output.] % %<*driver> \documentclass{ltxdoc} @@ -383,23 +383,50 @@ code apply to the generation of \HTML, print, or both forms of output. } -\newcommand{\describemathimagename}{% -When creating an \SVG\ math image, its \attribute{alt} tag may be set +\newcommand{\describeImageAltText}{% +\cs{includegraphics} and other images are assigned an \HTML\ \attribute{alt} tag +according to \cs{ImageAltText} along with \cs{AltTextOpen} and \cs{AltTextClose}. +This text is visible in the browser if images are not loaded, +and appears when the text is copied and pasted. +The default is ``\optn{image}'', and it may be changed +according to the document's language. +This may be set in the preamble, or changed as necessary inside the document, +where it will affect the following \cs{includegraphics} and other images. +} + +\newcommand{\describeThisAltText}{% +\cs{ThisAltText} can be used to assign an \HTML\ \attribute{alt} text attribute +to the next image generated by a \env{lateximage}, \env{picture}, \env{tikzpicture}, +or any other similar environment which generates an image, +or the next \SVG\ math expression. This tag is cleared after use. +The tag is also cleared after each \brand{MathJax} expression, in case the user +changes between \SVG\ math and \brand{MathJax}. + +\cs{ThisAltText} also may be used to add an \HTML\ \attribute{title} to +a reference or hyperlink, such as a \cs{ref}, \cs{cref}, \cs{href}, +\cs{url}, \cs{hyperref}, or \cs{hyperlink}. In each case, the alternative text +is cleared after use. +} + +\newcommand{\describeMathImageAltText}{% +When creating an \SVG\ math image, its \HTML\ \attribute{alt} tag may be set to the math expression, which may be hashed for image reuse. In the case of \cs{ensuremath} or after \cs{inlinemathother}, where the contents require a unique image for each instance of the same expression, -the \attribute{alt} tag is set to \cs{mathimagename}, and the image is not reused. +the \attribute{alt} tag is set to \cs{MathImageAltText}, +along with \cs{AltTextOpen} and \cs{AltTextClose}, and the image is not reused. -This expression is visible in the browser if images are not loaded, +This \attribute{alt} expression is visible in the browser if images are not loaded, and appears when the text is copied and pasted. -The default is ``math image'', and it may be changed according to the document's language. +The default is ``\optn{math image}'', and it may be changed +according to the document's language. This may be set in the preamble, or changed as necessary inside the document, where it will affect the following \SVG\ math images. } -\newcommand{\describepackagediagramname}{% +\newcommand{\describePackageDiagramAltText}{% For many packages, the output is placed inside a \env{lateximage} with an -\HTML\ \attribute{alt} tag set to the package name followed by \cs{packagediagramname}. +\HTML\ \attribute{alt} tag set to the package name followed by \cs{PackageDiagramAltText}. For example: \begin{sourcedisplay} (-xy- diagram) @@ -408,7 +435,12 @@ This expression is visible in the browser if images are not loaded, and appears when the text is copied and pasted. The default is ``diagram'', and may it be changed according to the document's language. This may be set in the preamble, or changed as necessary inside the document, -where it will affect the following \env{lateximage}s. +where it will affect the following package diagrams. +} + +\newcommand{\describeAltTextOpenClose}{% +\HTML\ \attribute{alt} text is enclosed by the macros \cs{AltTextOpen} and +\cs{AltTextClose}, which default to an opening and closing parenthesis. } \newcommand{\limitscpageref}{% @@ -1331,7 +1363,7 @@ Or, use a short name for the \TOC\ entry without the math, or use \cs{texorpdfst If using \cs{polymerdelim} to add delimiters to a \cs{chemfig}, wrap both inside a single \env{lateximage}: \begin{sourcedisplay} -\cs{begin}\{lateximage\}[(-chemfig-\textasciitilde\cs{packagediagramname})] \\ +\cs{begin}\{lateximage\}[-chemfig-\textasciitilde\cs{PackageDiagramAltText}] \\ \cs{chemfig}\{\dots\} \\ \cs{polymerdelim}[\dots]\{\dots\} \\ \cs{end}\{lateximage\} @@ -1378,7 +1410,8 @@ It is recommended to use \pkg{cleveref} instead of \pkg{ntheorem}'s \limitsincludegraphicsscale For \cs{includegraphics} with \filenm{.pdf} or \filenm{.eps} files, -\gindex{graphics>formats} +\gindex{graphics>file formats} +\gindex{image>file formats} \gindex{includegraphics=\cs{includegraphics}>using} \gindex{PDF image>using} \gindex{EPS image>using} @@ -1481,7 +1514,7 @@ The class is ignored for print output. Likewise, the \cs{includegraphics} \optn{alt} key adds an \HTML\ \attribute{alt} tag to \margintag{\HTML\ \attribute{alt} tags} an image, and is ignored for print output. If not assigned, each -image is given an \attribute{alt} tag of ``\optn{(image)}''. +image is given an \attribute{alt} tag according to \cs{ImageAltText}. \cs{rotatebox} accepts the optional \optn{origin} key. \margintag{\cs{rotatebox}} @@ -2125,7 +2158,7 @@ A line break will occur in the text where the \cs{marginBlock} occurs. \newcommand{\limitssaveboxes}{% \trouble{boxes} -\trouble{HTML>corrupted} +\trouble[\HTML\ corrupted]{HTML>corrupted} \trouble{savebox=\cs{savebox}} \trouble{sbox=\cs{sbox}} \trouble{lrbox=\env{lrbox}} @@ -2646,7 +2679,7 @@ This boolean may be tested by the user for later use. %<*package> % \fi % -% \CheckSum{33109} +% \CheckSum{33339} % % \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 @@ -2762,6 +2795,7 @@ This boolean may be tested by the user for later use. % \changes{v0.71}{2019/04/29}{\ 2019/04/29} % \changes{v0.72}{2019/06/08}{\ 2019/06/08} % \changes{v0.73}{2019/07/11}{\ 2019/07/11} +% \changes{v0.74}{2019/09/02}{\ 2019/09/02} @@ -2982,6 +3016,52 @@ This boolean may be tested by the user for later use. % % \begin{description} % \needspace{2\baselineskip} +% \item[v0.74:] Docs, \SVG\ math, \prog{lwarpmk}, \HTML\ \attribute{alt} and \attribute{title} text, \pkg{lyluatex} +% \begin{itemize} +% \item Added to the tutorial the section \nameref{sec:whatnext}. +% \margintag{docs} +% See \cref{sec:whatnext}. +% \item Added documentation about localization options. +% See \cref{sec:localization}. +% \item Added documentation about accessibility options. +% See \cref{sec:accessibility}. +% \item Renamed and updated \HTML\ \attribute{alt} text macros: +% \margintag{\HTML\ \attribute{alt} text} +% \watchout[changed names] +% \begin{center} +% \begin{tabular}{cc} +% Old & New \\ +% \cmidrule(r){1-1}\cmidrule(l){2-2} +% (hard coded as ``image'') & \cs{ImageAltText} \\ +% \cs{mathimagename} & \cs{MathImageAltText} \\ +% \cs{pacakgediagramname} & \cs{PackageDiagramAltText} \\ +% \end{tabular} +% \end{center} +% \item Added \cs{ImageAltText} for the default \HTML\ \attribute{alt} text for +% an image. See \cref{sec:ImageAltText}. +% \item Added \cs{ThisAltText}, which may be used to assign a one-time +% \HTML\ \attribute{alt} tag to the very next image generated by \pkg{lwarp}, +% such as a \env{lateximage}, \env{picture}, \env{tikzpicture}, +% an image generated by various chemistry or engineering packages, or +% an \SVG\ math image. +% This macro also adds a \attribute{title} tag to a reference or hyperlink. +% See \cref{sec:ThisAltText}. +% \item Adjusted \cs{LateximageFontScale} default from .75 to 1. +% \margintag{\SVG\ math} +% \item Fix: Font control for \SVG\ math. +% \item Fix: Ignores negative \cs{hspace}. +% \margintag{misc} +% \item Warning if \ctr{SideTOCDepth} < \ctr{FileDepth}. +% \item \prog{lwarpmk}: \cmds{lwarpmk clean} removes additional files. +% \margintag{\prog{lwarpmk}} +% \item \prog{lwarpmk}: \cmds{lwarpmk epstopdf} and \cmds{lwarpmk pdftosvg} +% now honor directories. +% \item \pkg{lyluatex}: Split images by \optn{system} or per \optn{fullpage}, +% \margintag{packages} +% improved margins and scaling. +% \item Tested to work as-is with \pkg{mathspec}, \pkg{unicode-math}. +% \end{itemize} +% \needspace{2\baselineskip} % \item[v0.73:] \cs{include}, \pkg{memoir}, \pkg{koma-script}, \pkg{caption}, % \pkg{xy}, \pkg{datatool}, music scores. % \begin{itemize} @@ -3208,7 +3288,7 @@ This boolean may be tested by the user for later use. % \item Improved page layout \CSS. % \item \pkg{graphicx} \cs{includegraphics}: Added the \optn{alt} key % \margintag{image \attribute{alt} tags} -% to assign an \attribute{alt} tag to an image. Default is ``\optn{(image)}'', +% to assign an \attribute{alt} tag to an image. Default is ``\optn{image}'', % assigned to pass validation. % \item Detects and causes an error % \margintag{duplicate \HTML\ files} @@ -3323,7 +3403,7 @@ This boolean may be tested by the user for later use. % \needspace{2\baselineskip} % \item[v0.61:] Custom compilation, \EPS-related packages, documentation, indexes. % \begin{itemize} -% \item Split index into multiple indexes. See \cpageref{sec:indexmeta}. +% \item Split index into multiple indexes. % \margintag{docs} % \item Improved documentation regarding font selection. See \cref{sec:fonts}. % \item Added documentation regarding debugging options. @@ -3481,13 +3561,13 @@ This boolean may be tested by the user for later use. % \item Improved localization for \env{lateximage} \HTML\ \attribute{alt} tags. % \margintag{\env{lateximage} \attribute{alt} tags} % For \SVG\ math images, the \attribute{alt} tag under some conditions -% will be set to \cs{mathimagename}, which defaults to ``math image''. +% will be set to \cs{MathImageAltText}, which defaults to \optn{math image}. % For packages, the \attribute{alt} tag is set using the package name followed by -% \cs{packagediagramname}, which defaults to ``diagram''. Ex: +% \cs{PackageDiagramAltText}, which defaults to \optn{diagram}. Ex: % \begin{sourcedisplay} % (-xy- diagram) % \end{sourcedisplay} -% See \cref{sec:packagediagramname}. +% See \cref{sec:PackageDiagramAltText}. % \item Fix: Improved print/\HTML\ macro selection. % \item Fix: \cs{href} text catcodes. % \margintag{misc. fixes} @@ -4740,8 +4820,8 @@ This boolean may be tested by the user for later use. % Additional math: & Math fonts via \SVG\ images, % \spkg{amscd}, \ipkg{autonum}, \mpkg{backnaur}, \spkg{bm}, \spkg{braket}, % \mpkg{breqn}, \mpkg{cases}, \spkg{delarray}, \spkg{guass}, \spkg{jkmath}, -% \mpkg{mathtools}, \spkg{nicematrix}, \spkg{pb-diagram}, \ipkg{resizegather}, -% \mpkg{xfakebold}, \mpkg{xy}. +% \spkg{mathspec}, \mpkg{mathtools}, \spkg{nicematrix}, \spkg{pb-diagram}, +% \ipkg{resizegather}, \spkg{unicode-math}, \mpkg{xfakebold}, \mpkg{xy}. % Many others work as-is. \\ % % Display math with \cs{displaymathother}: & % @@ -6045,7 +6125,7 @@ This boolean may be tested by the user for later use. % \subsection{Cleaning auxiliary files} % % To remove the auxiliary files |.aux|, |.toc|, |.lof|, |.lot|, |.idx|, |.ind|, |.log|, -% and |.gl*|: +% and |.gl*|, and a few others: % \userentry{lwarpmk clean} % % @@ -6121,6 +6201,33 @@ This boolean may be tested by the user for later use. % tags (|project_html.pdf|), then \prog{lwarpmk} may be used to % convert each target to \HTML\ files. % +% \subsection{What next?} +% \label{sec:whatnext} +% +% \begin{description} +% \item [How do I do something?] See the \nameref{sec:indexgen}. +% \item [Something do not work!] See the \nameref{sec:indextrb} +% or \cref{sec:troubleshooting}: \nameref{sec:troubleshooting}. +% \item [Package options:] See \cref{sec:packageoptions}, \nameref{sec:packageoptions}. +% \item [\HTML\ and filename settings:] See \cref{sec:htmlsettings}, +% \nameref{sec:htmlsettings}. +% \item [Footnote placement:] See \cref{sec:htmlsettings}, +% \nameref{sec:htmlsettings}. +% \item [Title page, indexing, glossaries:] See \cref{sec:frontbackmatter}, +% \nameref{sec:frontbackmatter}. +% \item [Shell escape:] See \cref{sec:shellescape}, \nameref{sec:shellescape}. +% \item [\CSS\ customization:] See \cref{sec:csscustomization}, +% \nameref{sec:csscustomization}. +% \item [Localization:] (languages) --- See \cref{sec:localization}, +% \nameref{sec:localization}. +% \item [Accessibility:] (\attribute{alt} and \attribute{title} tags) --- +% See \cref{sec:accessibility}, \nameref{sec:accessibility}. +% \item [Converting an existing document:] See \cref{sec:convertexisting}, +% \nameref{sec:convertexisting}. +% \item [\EPUB\ conversion:] See \cref{sec:epub}, \nameref{sec:epub}. +% \item [Word processor conversion:] See \cref{sec:wordprocessorconversion}, +% \nameref{sec:wordprocessorconversion}. +% \end{description} % % \clearpage % @@ -6183,6 +6290,130 @@ This boolean may be tested by the user for later use. % \section{Additional details} % % +% \subsection{Localization} +% \label{sec:localization} +% \gindex{localization} +% \gindex{language>localization} +% \gindex{sideTOC=side\TOC>name} +% \gindex{settings>language} +% +% Regional localization is supported by \pkg{lwarp} via the following package options +% and macros: +% +% \begin{description} +% \item [Object names:] \LaTeX\ provides redefinable names for various objects, +% and \pkg{lwarp} adds a few more. Use \cs{renewcommand} to change these. +% \begin{description} +% \item [\cs{abstractname}:] This macro is honored by \pkg{lwarp}. +% \item [\cs{linkhomename}:] Displayed by the link to the homepage. +% \item [\cs{sidetocname}:] Displayed at the head of the side\TOC. +% \end{description} +% \item [\HTML\ settings:] See \cref{tab:htmlsettings} and +% \cref{sec:htmlsettings} for details. +% \begin{description}[style=unboxed] +% \item [\cs{HTMLLanguage}:] The language to declare for each web page. +% \item [\cs{ImageAltText}, \cs{MathImageAltText}, \cs{PackageDiagramAltText}, +% \cs{AltTextOpen}, \cs{AltTextClose}:] The defaults used for \HTML\ +% \attribute{alt} text for images. See \cref{sec:accessibility}. +% \item [\cs{CSSFilename}:] The name of the \CSS\ file to use. +% \item [\cs{MathJaxFilename}:] The name of the \brand{MathJax} script to use. +% \end{description} +% \item [Package options:] \ +% \begin{description} +% \item [\optn{ImagesName} and \optn{ImagesDirectory}:] These options control +% the filenames used by \pkg{lwarp} when it automatically generates images. +% See \cref{tab:options} and \cref{sec:loading}. +% \item [\optn{xindyStyle}, \optn{xindyLanguage}, \optn{xindyCodepage}:] +% When using \prog{xindy}, these options may be set according to +% local use. See \cref{sec:modifyxindy}. +% \item [\optn{pdftotextEnc}:] To adjust the encoding of \prog{pdftotext}. +% \end{description} +% \end{description} +% +% +% \subsection{Accessibility} +% \label{sec:accessibility} +% +% \gindex{accessibility} +% \gindex{alt text=\attribute{alt} text} +% \gindex{HTML>alt text=\attribute{alt} text} +% \gindex{image>alt text=\attribute{alt} text} +% \gindex{math>alt text=\attribute{alt} text} +% \gindex{MathJax=\brand{MathJax}>accessibility} +% \gindex{link>title=\attribute{title} text} +% \gindex{hyperref=\pkg{hyperref}>title=\attribute{title} text} +% \gindex{settings>accessibility} +% +% \pkg{lwarp} provides several methods for improving access to +% the document using tools such as text-only browsers, copy \Slash paste, +% text-to-speech readers, or Braille readers. +% \HTML\ provides the \attribute{alt} text attribute for images, +% which is used by \pkg{lwarp} as describe below. +% \HTML\ also provides the \attribute{title} attribute, which usually +% generates a pop-up text. \pkg{lwarp} can add this to a reference or hyperlink. +% \brand{MathJax} also has provisions for improved accessibility +% as well. +% +% \begin{description} +% \item [\cs{ImageAltText}:] The default \HTML\ \attribute{alt} text +% for \cs{includegraphics} and \env{lateximage}s. +% Set with \cs{renewcommand}. +% +% \item [\cs{includegraphics} \optn{alt} key:] +% For \cs{includegraphics}, \pkg{lwarp} adds the \attribute{alt} key \Slash value. +% For example: +% \begin{sourceverb} +% \includegraphics[alt={Some text.}]{filename} +% \end{sourceverb} +% +% \item [\SVG\ math:] +% For simple \SVG\ math, \pkg{lwarp} places the \LaTeX\ math expression in the +% \attribute{alt} text, so that the \LaTeX\ expression may be copied and pasted to +% another document as plain text. +% +% \item [\cs{MathImageAltText}:] +% For complicated \SVG\ math, such as enclosed in +% \cs{InlineMathOther} \Slash \cs{InlineMathNormal}, or +% \cs{DisplayMathOther} \Slash \cs{DisplayMathNormal}, +% the \HTML\ \attribute{alt} text will be set to \cs{MathImageAltText}. +% Set with \cs{renewcommand}. +% +% \item [\brand{MathJax}:] +% For \brand{MathJax}, the accessibility tools provided by \brand{MathJax} are +% enabled by default by \pkg{lwarp}'s \brand{MathJax} scripts. +% +% \item [\cs{PackageDiagramAltText}:] +% Various packages create diagrams which \pkg{lwarp} converts into \SVG\ images. +% These are given \attribute{alt} text set to \cs{PackageDiagramAltText}. +% Set with \cs{renewcommand}. +% +% \item [\cs{ThisAltText}:] +% The \HTML\ \attribute{alt} text of the next image may be set with: +% \margintag{custom \attribute{alt} text} +% \begin{sourceverb} +% \ThisAltText{Custom text about the image.} +% +% \end{sourceverb} +% The next single image will be generated with the given text, +% and the following images will revert to back to their defaults. +% +% \cs{ThisAltText} may also be used to assign an \HTML\ \attribute{title} to +% \margintag{references and links} +% the next reference or hyperlink. +% \begin{sourceverb} +% \ThisAltText{Custom text about the link.} +% Text ... \ref{label_name} ... text. +% \end{sourceverb} +% See \cref{sec:ThisAltText}. +% +% \item [\cs{AltTextOpen} and \cs{AltTextClose}:] +% By default, \HTML\ \attribute{alt} text is enclosed by parentheses. +% This may be changed by redefining \cs{AltTextOpen} and \cs{AltTextClose}. +% Set with \cs{renewcommand}. +% \end{description} +% +% +% % \subsection{Shell escape} % \label{sec:shellescape} % \gindex{shell escape} @@ -6230,12 +6461,13 @@ This boolean may be tested by the user for later use. % While using \DVI\ \prog{latex} or \PDF\ \prog{pdflatex}, % \margintag{vector fonts} % if no font-related package is specified then the default -% Computer Modern font is used, which may be a ``type 3'' bit-mapped font which may not -% convert well to plain text. A ``type 1'' vector font is required. +% \brand{Computer Modern} font is used, % \margintag{Computer Modern}% % \gindex{font>Computer Modern}\gindex{Computer Modern}% % \watchout[\prog{pdflatex}]% % \watchout[DVI \prog{latex}]% +% which may be a ``type 3'' bit-mapped font which may not +% convert well to plain text. A ``type 1'' vector font is required. % % \DescribePackage{cm-super} % To use the updated \pkg{cm-super}'s type 1 fonts instead of Computer Modern, @@ -6397,6 +6629,8 @@ This boolean may be tested by the user for later use. % dvipdfmx & Use \prog{dvipdfmx} to convert \DVI\ documents. \\ % HomeHTMLFilename & The filename of the home page. \\ % HTMLFilename & A prefix for the filenames of the remaining web pages. \\ +% ImagesName & A prefix for the filenames of generated images. \\ +% ImagesDirectory & The directory used to hold generated images. \\ % PrintLatexCmd & The shell commands for \cmds{lwarpmk print}. \\ % HTMLLatexCmd & The shell commands for \cmds{lwarpmk html}. \\ % \midrule @@ -6449,7 +6683,7 @@ This boolean may be tested by the user for later use. % \gindex{lwarp=\pkg{lwarp}>options} % \pkg{lwarp} package options are as follows: % -% \begin{description} +% \begin{description}[itemsep=1\baselineskip] % % \item[\optn{mathsvg}, \optn{mathjax}:] % \DescribeOption{mathsvg} @@ -6496,6 +6730,23 @@ This boolean may be tested by the user for later use. % See \cref{sec:htmlsettings}. % % +% \item[\optn{ImagesName}:] +% \DescribeOption{ImagesName} +% \DescribeDefault{image-} +% The prefix for the images automatically generated by \pkg{lwarp} +% for objects such as \SVG\ math and \env{lateximage}s. +% +% +% \item[\optn{ImagesDirectory}:] +% \DescribeOption{ImagesDirectory} +% \DescribeDefault{\cs{jobname}-images} +% The directory for the images automatically generated by \pkg{lwarp} +% for objects such as \SVG\ math and \env{lateximage}s. +% By default, these images will appear in a directory named +% \filenm{-images}, and the images will be named and numbered +% \filenm{image-}. +% +% % \item[\optn{PrintLatexCmd}:] % \DescribeOption{PrintLatexCmd} % \DescribeDefault{} Sets the shell commands executed by \cmds{lwarpmk print}. @@ -6531,27 +6782,27 @@ This boolean may be tested by the user for later use. % \DescribeOption{makeindexStyle} % \DescribeDefault{lwarp.ist} % If you wish to use a custom |.ist| file for -% index generation, see \cref{sec:handlingpackageoptions}. +% index generation, see \cref{sec:packageoptions}. % % % \item[\optn{xindyStyle}:] % \DescribeOption{xindyStyle} % \DescribeDefault{lwarp.xdy} % If you wish to use a custom |.xdy| file for -% index generation, see \cref{sec:handlingpackageoptions}. +% index generation, see \cref{sec:packageoptions}. % % % \item[\optn{xindyLanguage}:] % \DescribeOption{xindyLanguage} % \DescribeDefault{english} If using an index or glossary, -% see \cref{sec:handlingpackageoptions}. +% see \cref{sec:packageoptions}. % % % \item[\optn{xindyCodepage}:] % \DescribeOption{xindyCodepage} % \DescribeDefault{utf8} If using an index, % ^^A or glossary, -% see \cref{sec:handlingpackageoptions}. +% see \cref{sec:packageoptions}. % % % \item[\optn{PrintIndexCmd}:] @@ -6684,7 +6935,7 @@ This boolean may be tested by the user for later use. % \DescribeOption{lwarpmk} If you wish to have \pkg{lwarp} generate a local % copy of \filenm{lwarpmk.lua} for archival or local-installation purposes, % compile the print version with the \optn{lwarpmk} option set. -% See \cref{sec:handlingpackageoptions}. +% See \cref{sec:packageoptions}. % % \begin{quote} % \hrule @@ -6715,7 +6966,7 @@ This boolean may be tested by the user for later use. % \DescribeDefault{\cs{jobname}} Not intended for the user. % Used internally by \pkg{lwarp} when % creating the |*_html.tex| file used to compile the \HTML\ version. -% See \cref{sec:handlingpackageoptions}. +% See \cref{sec:packageoptions}. % % \end{description} % @@ -6725,6 +6976,8 @@ This boolean may be tested by the user for later use. % \label{sec:htmlsettings} % \gindex{settings>HTML conversion} % \gindex{HTML>conversion settings} +% \gindex{sidetoc=side\TOC>depth} +% \gindex{settings>filenames} % % \changes{v0.43}{2017/11/04}{Docs: \HTML\ settings table.} % \changes{v0.43}{2017/11/06}{Docs: Reorganized \HTML\ customization.} @@ -6748,8 +7001,13 @@ This boolean may be tested by the user for later use. % FootnoteDepth & Sectioning depth of footnotes. \\ % \midrule % \cs{abstractname} & The name of the abstract. \\ -% \cs{mathimagename} & The \SVG\ math image \env{lateximage} \attribute{alt} tag. \\ -% \cs{packagediagramname} & The suffix for a package's \env{lateximage} \attribute{alt} tags. \\ +% \cs{ImageAltText} & \cs{includegraphics} and other images' \attribute{alt} tag. \\ +% \cs{ThisAltText} \marg{text} & Assigns an \attribute{alt} \Slash \attribute{title} +% tag for the next image or link. \\ +% \cs{MathImageAltText} & The \SVG\ math image \env{lateximage} \attribute{alt} tag. \\ +% \cs{PackageDiagramAltText} & The suffix for a package's \env{lateximage} \attribute{alt} tags. \\ +% \cs{AltTextOpen} & Start an \HTML\ \attribute{alt} tag. \\ +% \cs{AltTextClose} & End an \HTML\ \attribute{alt} tag. \\ % \midrule % \cs{CSSFilename} & The \CSS\ for the following files. \\ % \cs{MathJaxFilename} & The MathJax script for the following files. \\ @@ -6859,10 +7117,10 @@ This boolean may be tested by the user for later use. % Each subpage of the website has its own small table of contents % \margintag{side\TOC} % on the side (the ``side\TOC''). Its depth is set by |SideTOCDepth|. -% This side\TOC\ is only shown if the web page is wide enough. +% This side\TOC\ is only shown if the browser display is wide enough. % When using a narrow web browser window, % ``responsive web design'' is used to show the side\TOC\ at the top of the -% page and a link back to \UI{Home} at the bottom. +% page, as well as a link back to \UI{Home} at the top and bottom. % % \label{sec:filedepth} % It is recommended to set: @@ -7096,15 +7354,31 @@ This boolean may be tested by the user for later use. % % \begin{description} % -% \ItemDescribeMacro{\mathimagename} \DescribeDefault{math image} -% \label{sec:mathimagename} +% \ItemDescribeMacro{\ImageAltText} \DescribeDefault{image} +% \label{sec:ImageAltText} +% Redefine with \cs{renewcommand}. +% \describeImageAltText +% +% \ItemDescribeMacro{\ThisAltText} \marg{text} +% \label{sec:ThisAltText} +% \describeThisAltText +% +% \ItemDescribeMacro{\MathImageAltText} \DescribeDefault{math image} +% \label{sec:MathImageAltText} +% Redefine with \cs{renewcommand}. +% \describeMathImageAltText +% +% \ItemDescribeMacro{\PackageDiagramAltText} \DescribeDefault{diagram} +% \label{sec:PackageDiagramAltText} +% Redefine with \cs{renewcommand}. +% \describePackageDiagramAltText +% +% \ItemDescribeMacro{\AltTextOpen} \DescribeDefault{(} % Redefine with \cs{renewcommand}. -% \describemathimagename % -% \ItemDescribeMacro{\packagediagramname} \DescribeDefault{diagram} -% \label{sec:packagediagramname} +% \ItemDescribeMacro{\AltTextClose} \DescribeDefault{)} % Redefine with \cs{renewcommand}. -% \describepackagediagramname +% \describeAltTextOpenClose % % \ItemDescribeEnv{warpprint} An environment which is only used % while generating print output. Place inside anything which does not @@ -7381,9 +7655,9 @@ This boolean may be tested by the user for later use. % \DescribeMacro{\title} \marg{title} % % Avoid newlines in the \cs{title}; these will interfere with the +% \trouble[\HTML\ corrupted]{HTML>corrupted} % file break and \CSS\ detection. % \trouble[newlines]{title>newlines} -% \trouble{HTML>corrupted} % Use a \cs{subtitle} command instead (\cref{sec:publishedsubtitle}). % The title will appear in the document \cs{maketitle} as a heading \element{h1}. % The \HTML\ meta |title| tag will also have this title, unless \cs{HTMLTitle} @@ -7478,6 +7752,7 @@ This boolean may be tested by the user for later use. % % % +% % \section{Special cases and limitations} % \label{sec:limitations} % @@ -9276,7 +9551,7 @@ This boolean may be tested by the user for later use. % % \clearpage % -% \section{EPUB conversion} +% \section{\EPUB\ conversion} % \label{sec:epub} % % \pkg{lwarp} does not produce \EPUB\ documents, @@ -10099,11 +10374,15 @@ This boolean may be tested by the user for later use. % \subsubsection{Compiling} % % \begin{description} +% \item[\ctr{SideTOCDepth} < \ctr{FileDepth}:] A warning is displayed if these +% counters are set such that the side\TOC\ will not be able to access all pages +% of the website. % \item[Duplicate filenames:] \pkg{lwarp} may generate file names from section names. % While doing so, the filenames are simplified and special characters are removed. % If this process generates a duplicate filename, and error is generated, % describing the filename and which section name generated it. % \item[Multirow:] When \cs{multirow} or \cs{multicolrow} are used, +% \trouble[\HTML\ corrupted]{HTML>corrupted} % \cs{mrowcell} or \cs{mcolrowcell} must be placed in the appropriate cells to % avoid corrupted \HTML\ output. % \item[(width,height) missing a comma:] \cs{makebox} and \cs{framebox} can accept @@ -10115,8 +10394,7 @@ This boolean may be tested by the user for later use. % \item[``It is recommended to use \texttt{[width=xx\cs{linewidth}]} % instead of % \texttt{[scale=yy]} -% '':] Browser support of \optn{scale} is not -% the same effect as \LaTeX. +% '':] Browser support of \optn{scale} does not have the same effect as in \LaTeX. % \end{description} % % @@ -10137,7 +10415,7 @@ This boolean may be tested by the user for later use. % \begin{description} % % \item [Text is not converting correctly / corrupted \HTML\ tags:] ~ -% \trouble{HTML>corrupted} +% \trouble[\HTML\ corrupted]{HTML>corrupted} % \begin{itemize} % \item Font-related UTF-8 information must be embedded in the \PDF\ file. % See \cref{sec:fonts} regarding bitmapped vs. vector fonts. @@ -10267,7 +10545,7 @@ This boolean may be tested by the user for later use. % \needspace{3\baselineskip} % \item [Incorrect \brand{MathJax}:] Some objects do not convert to \brand{Mathjax}. % \trouble[\brand{MathJax}]{MathJax=\brand{MathJax}>errors} -% \trouble[\brand{MathJax}]{MathJax=\brand{MathJax}>unsupported packages} +% \trouble{MathJax=\brand{MathJax}>unsupported packages} % Use \cs{displaymathother} before these objects, then \cs{displaymathnormal} to return % to ``normal'' display math. % See \cref{sec:displaymathother}. @@ -10287,7 +10565,7 @@ This boolean may be tested by the user for later use. % See \optn{FileSectionNames} at \cref{sec:htmlsettings}. % \end{itemize} % -% \item [Missing / incorrect cross-references:] ~ +% \item [Missing / incorrect cross-references:] \ % \trouble{reference>missing or incorrect} % \trouble{cross reference>missing} % \begin{itemize} @@ -10342,7 +10620,7 @@ This boolean may be tested by the user for later use. % \end{itemize} % % \item [Broken fragments of HTML:] ~ -% \trouble{HTML>corrupted} +% \trouble[\HTML\ corrupted]{HTML>corrupted} % \begin{itemize} % \item Check the \PDF\ file used to create \HTML\ % to see if the tags overflowed the margin. @@ -11968,7 +12246,7 @@ This boolean may be tested by the user for later use. % % \section{Package options} -% \label{sec:handlingpackageoptions} +% \label{sec:packageoptions} % % @@ -12797,35 +13075,130 @@ This boolean may be tested by the user for later use. % \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.} +% \changes{v0.74}{2019/08/13}{Remembers user's geometry.} % % \codehtml % \begin{macrocode} \begin{warpHTML} % \end{macrocode} % +% If \pkg{geometry} has not yet been loaded, +% use the preexising page and text sizes to be preserved for +% later reuse. +% These will be replaced by \pkg{lwarp} \cs{AtBeginDocument} +% with a very large page size to reduce \HTML\ tag overflow off the page. % \begin{macrocode} -\RequirePackage{geometry} -% \end{macrocode} -% -% Avoid class and option conflict by changing settings after package load: +\@ifpackageloaded{geometry} +{}{ + \RequirePackage[ + reset, + paperwidth=\paperwidth, + paperheight=\paperheight, + textwidth=\textwidth, + textheight=\textheight, + left=\oddsidemargin, + top=\topmargin, + marginparsep=\marginparsep, + marginparwidth=\marginparwidth, + ]{geometry} +} +% \end{macrocode} +% +% Remember the original definitions for later reuse. +% If the \pkg{geometry} package is loaded by the user, +% \pkg{lwarp-geometry} will nullify the user-level originals. +% \begin{macrocode} +\LetLtxMacro\LWR@origgeometry\geometry +\LetLtxMacro\LWR@orignewgeometry\newgeometry +\LetLtxMacro\LWR@origrestoregeometry\restoregeometry +\LetLtxMacro\LWR@origsavegeometry\savegeometry +\LetLtxMacro\LWR@origloadgeometry\loadgeometry +% \end{macrocode} +% +% +% \DescribeBoolean{LWR@allowanothergeometry} +% \pkg{geometry} may be loaded by the user before \pkg{lwarp}, +% after \pkg{lwarp}, or not at all. +% If before \pkg{lwarp}, it will have already been loaded by now +% and its page layout has already been saved. +% If \pkg{geometry} is loaded after \pkg{lwarp}, +% its layout will be set at that time and the user macros nullified. +% \cs{AtEndPreamble} this layout will be saved. +% If the user never loads \pkg{geometry}, +% \pkg{lwarp-geometry} will be loaded \cs{AtBeginDocument}, +% but it should not change the page layout set here. +% This is controlled by the boolean \bool{LWR@allowanothergeometry}. +% Geometry may be adjusted throughout the preamble until +% \cs{AtEndPreamble}, when this boolean is set \optn{false}. +% \begin{macrocode} +\newbool{LWR@allowanothergeometry} +\booltrue{LWR@allowanothergeometry} +% \end{macrocode} +% +% Use \cs{AtEndPreamble} to avoid class and option conflict by +% changing settings after other packages load, +% instead of using \pkg{geometry} package options: % \changes{v0.63}{2018/11/24}{\pkg{geometry}: Fix for \pkg{bxjs*} classes.} % \changes{v0.65}{2018/12/21}{\pkg{geometry}: Fix for \pkg{bxjs*} classes.} % \begin{macrocode} -\geometry{ - paperheight=190in,% - paperwidth=20in,% - left=2in,right=6in,% - top=1in,bottom=1in,% +\AtEndPreamble{ +% \end{macrocode} +% +% Whatever geometry choices the user has made in the preamble, +% either before or after \pkg{lwarp} was loaded, +% are now saved for possible temporary reuse, such as by \pkg{lyluatex}. +% +% See the \pkg{lwarp-geometry} section for what happens if \pkg{geometry} +% is loaded after \pkg{lwarp}. +% \begin{macrocode} +\LWR@origsavegeometry{LWR@usergeometry} +% \end{macrocode} +% +% The user's paper size is saved for later reuse, +% such as by the \pkg{pdfpages} package. +% \begin{macrocode} +\newlength{\LWR@userspaperwidth} +\setlength{\LWR@userspaperwidth}{\paperwidth} + +\newlength{\LWR@userspaperheight} +\setlength{\LWR@userspaperheight}{\paperheight} +% \end{macrocode} +% +% For \pkg{lwarp}, use a very large page and margins +% to help avoid letting \HTML\ tags run off the edge: +% \begin{macrocode} +\LWR@origgeometry{ + reset, + paperheight=190in, + paperwidth=20in, + left=2in, + right=6in, + top=1in, + bottom=1in, + heightrounded,% } % \end{macrocode} % -% \pkg{ltjtarticle} and other classes may require these to be reset by \pkg{lwarp}: +% The \pkg{lwarp} page geometry is saved for future restore: +% \begin{macrocode} +\LWR@origsavegeometry{LWR@lwarpgeometry} +% \end{macrocode} +% +% No longer adjust the page layout when \pkg{lwarp-geometry} is +% loaded \cs{AtBeginDocument}: +% \begin{macrocode} +\boolfalse{LWR@allowanothergeometry}% +% \end{macrocode} +% +% \pkg{ltjsbook} and other classes can print vertically, +% and require these to be reset by \pkg{lwarp}: % \begin{macrocode} \setlength{\textheight}{0.8\paperheight} \setlength{\textwidth}{0.7\paperwidth} \@twosidefalse \@mparswitchfalse +}% \AtEndPreamble \end{warpHTML} % \end{macrocode} @@ -13385,29 +13758,32 @@ This boolean may be tested by the user for later use. % \end{macro} -% \begin{macro}{\LWR@ProvidesPackageDrop} \marg{pkgname} \oarg{version} +% \begin{macro}{\LWR@ProvidesPackageDropA} \marg{name} \marg{date or -NoValue-} +% +% Declares the package. Factored for reuse. % -% Ignores the original package and uses lwarp's version instead. -% Drops/discards all options. -% \begin{macrocode} -\NewDocumentCommand{\LWR@ProvidesPackageDrop}{m o}{ -\PackageInfo{lwarp}{% - Replacing package `#1' with the lwarp version,\MessageBreak - and discarding options,% -}% -\IfValueTF{#2} -{\ProvidesPackage{lwarp-#1}[#2]} -{\ProvidesPackage{lwarp-#1}} -% \end{macrocode} -% Ignore all options. % \begin{macrocode} -\DeclareOption*{} +\newcommand*{\LWR@ProvidesPackageDropA}[2]{% + \PackageInfo{lwarp}{% + Replacing package `#1' with the lwarp version,\MessageBreak + and discarding options,% + }% + \IfValueTF{#2} + {\ProvidesPackage{lwarp-#1}[#2]} + {\ProvidesPackage{lwarp-#1}} +} % \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\LWR@ProvidesPackageDropB} % Nullifies then processes the options. +% % Seems to be required when options contain curly braces, which were causing % ``|Missing \begin{document}|''. % \changes{v0.48}{2018/02/04}{Fix: Options with braces.} % \begin{macrocode} +\newcommand*{\LWR@ProvidesPackageDropB}{% % \ProcessOptions\relax% original LaTeX code \let\ds@\@empty% from the original \ProcessOptions \edef\@curroptions{}% lwarp modification to \ProcessOptions @@ -13415,6 +13791,30 @@ This boolean may be tested by the user for later use. } % \end{macrocode} % \end{macro} +% +% +% \begin{macro}{\LWR@ProvidesPackageDrop} \marg{pkgname} \oarg{version} +% +% Ignores the original package and uses lwarp's version instead. +% Drops/discards all options. +% +% \begin{macrocode} +\NewDocumentCommand{\LWR@ProvidesPackageDrop}{m o}{ +% \end{macrocode} +% Declare the package: +% \begin{macrocode} +\LWR@ProvidesPackageDropA{#1}{#2} +% \end{macrocode} +% Ignore all options: +% \begin{macrocode} +\DeclareOption*{} +% \end{macrocode} +% Process the options: +% \begin{macrocode} +\LWR@ProvidesPackageDropB +} +% \end{macrocode} +% \end{macro} % \begin{macrocode} \end{warpHTML} @@ -14201,6 +14601,7 @@ This boolean may be tested by the user for later use. \LetLtxMacro\LWR@origttfamily\ttfamily \LetLtxMacro\LWR@origem\em + \LetLtxMacro\LWR@orignormalfont\normalfont \let\LWR@origonecolumn\onecolumn @@ -14889,7 +15290,8 @@ This boolean may be tested by the user for later use. % \changes{v0.72}{2019/05/24}{\filenm{lwarp.css}: Added \pkg{backnaur}.} % \changes{v0.72}{2019/05/26}{\filenm{lwarp.css}: Removed unneeded support for \cs{sishape}, \cs{textsi}.} % \changes{v0.73}{2019/06/21}{\filenm{lwarp.css}: Added \cs{book} for \pkg{memoir}.} -% \changes{v0.73}{2019/06/30}{\filenm{lwarp_.css}: Improved pkg{tocdata} formatting.} +% \changes{v0.73}{2019/06/30}{\filenm{lwarp.css}: Improved pkg{tocdata} formatting.} +% \changes{v0.74}{2019/08/04}{\filenm{lwarp.css}: Added \pkg{lyluatex}.} % % ^^A *lwarp.css % @@ -15981,6 +16383,18 @@ div.cellcolor { } +/* for lyluatex */ +span.lyluatex { + display: inline-block ; +} + +div.lyluatex p span.lateximagesource img { + display: block ; + margin-top: 3ex ; + margin-bottom: 3ex ; +} + + /* for bigdelim */ .ldelim, .rdelim { font-size: 200% } @@ -17428,6 +17842,8 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX- % \changes{v0.71}{2019/04/11}{\prog{lwarpmk}: If wrong \filenm{lwarpmk.conf} version, % or wrong OS, % displays the print command to recompile.}% +% \changes{v0.74}{2019/08/05}{\prog{lwarpmk}: \cmds{lwarpmk clean} removes add'l files.}% +% \changes{v0.74}{2019/08/14}{\prog{lwarpmk}: \cmds{lwarpmk epstopdf} and \cmds{pdftosvg} honor directories.}% % % The following is only generated if the \optn{lwarpmk} option % was given to \pkg{lwarp}. @@ -17443,7 +17859,7 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX- -- Copyright 2016-2019 Brian Dunn -printversion = "v0.73" +printversion = "v0.74" requiredconfversion = "2" -- also at *lwarpmk.conf function printhelp () @@ -17474,7 +17890,8 @@ lwarpmk pdftohtml [-p project]: lwarpmk pdftosvg : Converts each PDF file to SVG. lwarpmk epstopdf : Converts each EPS file to PDF. lwarpmk clean [-p project]: Remove *.aux, *.toc, *.lof/t, - *.idx, *.ind, *.log, *_html_inc.*, .gl* + *.idx, *.ind, *.log, *_html_inc.*, .gl*, + *_html.pdf, *_html.html, *_html.sidetoc lwarpmk cleanall [-p project]: Remove auxiliary files, project.pdf, *.html lwarpmk cleanlimages: Removes all images from the "lateximages" directory. lwarpmk -h: Print this help message. @@ -17485,6 +17902,24 @@ lwarpmk --help: Print this help message. end +function splitfilename ( pathandfilename ) +-- +-- Separates out the path and extension from a filename. +-- Returns path, filename with extension, and extension. +-- Ex: thispath, thisfilename, thisextension = splitfilename ("path/to/filename.ext") +-- +-- https://www.fhug.org.uk/wiki/wiki/doku.php?id=plugins:code_snippets: +-- split_filename_in_to_path_filename_and_extension +-- + if lfs.attributes(pathandfilename,"mode") == "directory" then + local strPath = pathandfilename:gsub("[\\/]$","") -- $ (syntax highlighting) + return strPath.."\\","","" + end + pathandfilename = pathandfilename.."." + return pathandfilename:match("^(.-)([^\\/]-)%.([^\\/%.]-)%.?$") +end + + function splitfile (destfile,sourcefile) -- -- Split one large sourcefile into a number of files, @@ -17815,6 +18250,8 @@ function removeaux () -- -- Remove auxiliary files: -- All .aux files are removed since there may be many bbl*.aux files. +-- Also removes sourcename_html.pdf, sourcename_html.html, +-- and sourcename_html.sidetoc. -- os.execute ( rmname .. " *.aux " .. sourcename ..".toc " .. sourcename .. "_html.toc " .. @@ -17825,6 +18262,9 @@ os.execute ( rmname .. " *.aux " .. sourcename ..".ps " .. sourcename .."_html.ps " .. sourcename ..".log " .. sourcename .. "_html.log " .. sourcename ..".gl* " .. sourcename .. "_html.gl* " .. + sourcename .. "_html.pdf " .. + sourcename .. "_html.html " .. + sourcename .. "_html.sidetoc " .. " *_html_inc.* " ) end @@ -18074,7 +18514,7 @@ function convertepstopdf () -- -- Converts EPS files to PDF files. -- The filenames are arg[argindex] and up. --- arg[1] is the command "pdftosvg". +-- arg[1] is the command "epstopdf". -- ignoreconf () for i = argindex , #arg do @@ -18082,7 +18522,16 @@ for i = argindex , #arg do print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.") else print ("lwarpmk: Converting \"" .. arg[i] .. "\"") - os.execute ( "epstopdf " .. arg[i] ) + thispath, thisfilename, thisextension = splitfilename(arg[i]) + if ( thispath == nil ) then + os.execute ( "epstopdf " .. arg[i] ) + else + os.execute ( + "epstopdf " .. + thispath .. thisfilename .. "." .. thisextension .. " " .. + thispath .. thisfilename .. ".pdf" + ) + end end -- if end -- do end --function @@ -18100,7 +18549,16 @@ for i = argindex , #arg do print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.") else print ("lwarpmk: Converting \"" .. arg[i] .. "\"") - os.execute ( "pdftocairo -svg " .. arg[i] ) + thispath, thisfilename, thisextension = splitfilename(arg[i]) + if ( thispath == nil ) then + os.execute ( "pdftocairo -svg " .. arg[i] ) + else + os.execute ( + "pdftocairo -svg " .. + thispath .. thisfilename .. "." .. thisextension .. " " .. + thispath .. thisfilename .. ".svg" + ) + end end -- if end -- do end --function @@ -21498,6 +21956,8 @@ end -- not --version % \begin{macro}{\LWR@customizeMathJax} +% Prints MathJax commands to the \HTML\ output. +% % \changes{v0.51}{2018/03/18}{MathJax: Nullifies \cs{ensuremath}.} % \changes{v0.57}{2018/05/24}{MathJax: Supports \cs{footnote}, \cs{footnotemark}.} % \begin{macrocode} @@ -29154,6 +29614,20 @@ rowspan="#2" % % \subsection{References} % \label{sec:references} + +% \begin{macro}{\LWR@addlinktitle} +% \changes{v0.74}{2019/08/25}{Added.} +% \begin{macrocode} +\newcommand*{\LWR@addlinktitle}{% + \ifdefvoid{\LWR@ThisAltText}{}{ % space + title="\LWR@ThisAltText" % space + \gdef\LWR@ThisAltText{}% + }% +} +% \end{macrocode} +% \end{macro} + + % \begin{macro}{\LWR@startref} \marg{label} \quad % (Common code for \cs{ref} and \cs{nameref}.) % @@ -29214,7 +29688,12 @@ rowspan="#2" % % \end{macrocode} % Closing quote: % \begin{macrocode} -"}% +"% +% \end{macrocode} +% Maybe add a title: +% \begin{macrocode} +\LWR@addlinktitle% +}% \LWR@traceinfo{LWR@startref F}% } % \end{macrocode} @@ -29373,6 +29852,7 @@ autopage-\theLWR@currentautosec% \LWR@sanitize{#1}% \LWR@htmltag{% a href="\LWR@sanitized" % space + \LWR@addlinktitle % space target="\_{}blank" % space }% } @@ -29405,6 +29885,7 @@ autopage-\theLWR@currentautosec% a % space href="\begingroup\@sanitize#1\endgroup" % space class="#3" % space + \LWR@addlinktitle % space }\LWR@orignewline% #2\LWR@orignewline% \LWR@htmltag{/a}% @@ -29504,30 +29985,33 @@ autopage-\theLWR@currentautosec% % \end{macro} -% \begin{macro}{\LWR@subinlineimage} \oarg{alttag} \marg{class} -% \marg{filename} \marg{extension} \marg{style} +% \begin{macro}{\LWR@subinlineimage} \marg{\element{alt} tag} \marg{class} +% \marg{filename} \marg{extension} \marg{CSS style} +% +% Factored from \env{lateximage}. % % \changes{v0.18}{2016/05/18}{Suppress extra space.} % \changes{v0.66}{2019/02/02}{Improved \HTML\ formatting.} +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} % \begin{macrocode} -\newcommand*{\LWR@subinlineimage}[5][]{% -\ifblank{#1}% -{% - \LWR@htmltag{img \LWR@indentHTML - src="#3.#4" \LWR@indentHTML - alt="#3" \LWR@indentHTML - style="#5" \LWR@indentHTML - class="#2" \LWR@orignewline +\newcommand*{\LWR@subinlineimage}[5]{% + \ifblank{#1}% + {% + \LWR@htmltag{img \LWR@indentHTML + src="#3.#4" \LWR@indentHTML + alt="#3" \LWR@indentHTML + style="#5" \LWR@indentHTML + class="#2" \LWR@orignewline + }% }% -}% -{% - \LWR@htmltag{img \LWR@indentHTML - src="#3.#4" \LWR@indentHTML - alt="#1" \LWR@indentHTML - style="#5" \LWR@indentHTML - class="#2" \LWR@orignewline + {% + \LWR@htmltag{img \LWR@indentHTML + src="#3.#4" \LWR@indentHTML + alt="#1" \LWR@indentHTML + style="#5" \LWR@indentHTML + class="#2" \LWR@orignewline + }% }% -}% } % \end{macrocode} % \end{macro} @@ -30331,10 +30815,20 @@ autopage-\theLWR@currentautosec% % \DescribeCounter{SideTOCDepth} % Controls how deep the side-TOC gets. Use a standard \LaTeX{} section level -% similar to |tocdepth|. +% similar to |tocdepth|. Warn if parts of the website may be inaccessible. % \begin{macrocode} \newcounter{SideTOCDepth} \setcounter{SideTOCDepth}{1} + +\AtBeginDocument{% + \ifnumcomp{\value{SideTOCDepth}}{<}{\value{FileDepth}}{ + \PackageWarningNoLine{lwarp} + {% + SideTOCDepth is less than FileDepth,\MessageBreak + so some website pages may be inaccessible% + } + }{} +} % \end{macrocode} % \begin{macro}{\sidetocname} @@ -31099,21 +31593,81 @@ autopage-\theLWR@currentautosec% \begin{warpall} % \end{macrocode} -% \begin{macro}{\mathimagename} The \HTML\ \attribute{alt} tag for + +% \begin{macro}{\AltTextOpen} The opening part of \HTML\ \attribute{alt} tag for +% an image. The default is a left parenthesis. +% \DescribeDefault{(} +% \changes{v0.74}{2019/08/20}{Added.} +% \begin{macrocode} +\newcommand*{\AltTextOpen}{(} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\AltTextClose} The closing part of \HTML\ \attribute{alt} tag for +% an image. The default is a right parenthesis. +% \DescribeDefault{(} +% \changes{v0.74}{2019/08/20}{Added.} +% \begin{macrocode} +\newcommand*{\AltTextClose}{)} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\ImageAltText} The \HTML\ \attribute{alt} tag for +% an image. \\ +% \DescribeDefault{image} +% \changes{v0.74}{2019/08/07}{Added.} +% \begin{macrocode} +\newcommand*{\ImageAltText}{image} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\MathImageAltText} The \HTML\ \attribute{alt} tag for % an \SVG\ math image. \\ % \DescribeDefault{``math image''} % \changes{v0.57}{2018/05/22}{Added.} +% \changes{v0.74}{2019/08/07}{Renamed from \cs{mathimage}.} +% \begin{macrocode} +\newcommand*{\MathImageAltText}{math image} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\LWR@ThisAltText} The \HTML\ \attribute{alt} tag for +% the next image. +% Cleared after use, and also after each \env{lateximage}, +% \cs{LWR@subsingledollar}, and each use of \brand{MathJax}. +% +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} % \begin{macrocode} -\newcommand*{\mathimagename}{math image} +\newcommand*{\LWR@ThisAltText}{} % \end{macrocode} % \end{macro} -% \begin{macro}{\packagediagramname} Appended to the \env{lateximage} +% \begin{macro}{\ThisAltText} \marg{text} +% +% Assigns the \HTML\ \attribute{alt} tag for the next image +% generated by \pkg{lwarp}, such as a \env{lateximage}, +% \env{picture}, or \SVG\ math. +% +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} +\newcommand*{\ThisAltText}[1]{% + \renewcommand{\LWR@ThisAltText}{#1}% +} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\PackageDiagramAltText} Appended to the \env{lateximage} % \HTML\ \attribute{alt} tag for the images generated by many packages. % \DescribeDefault{``diagram''} % \changes{v0.57}{2018/05/22}{Added.} +% \changes{v0.74}{2019/08/07}{Renamed from \cs{packagediagramname}.} % \begin{macrocode} -\newcommand*{\packagediagramname}{diagram} +\newcommand*{\PackageDiagramAltText}{diagram} % \end{macrocode} % \end{macro} @@ -31176,6 +31730,32 @@ autopage-\theLWR@currentautosec% % \end{macro} + + +% \begin{macro}{\LWR@setcurrentfont} +% Sets the actual \LaTeX\ font to that which was selected for +% \HTML\ output. +% Ex: In \HTML\ mode, \cs{bfseries} sets \cs{LWR@f@series} to ``|bf|''. +% This sets the \PDF\ output here for use inside a \env{lateximage}. +% \changes{v0.74}{2019/09/01}{Factored.} +% \begin{macrocode} +\newcommand*{\LWR@setcurrentfont}{% + \LWR@traceinfo{Using font family \LWR@f@family}% + \@nameuse{LWR@print@\LWR@f@family family}% + \LWR@traceinfo{Using font series \LWR@f@series}% + \@nameuse{LWR@print@\LWR@f@series series}% + \LWR@traceinfo{Using font shape \LWR@f@shape}% + \@nameuse{LWR@print@\LWR@f@shape shape}% + \LWR@traceinfo{Using font caps shape \LWR@f@shapecaps}% + \@nameuse{LWR@print@\LWR@f@shapecaps shape}% +} +% \end{macrocode} +% \end{macro} + + + + + % \DescribeMacro{\$} % Plain dollar signs appearing in the \HTML\ output may be interpreted % by \brand{MathJax} to be math shifts. @@ -31260,7 +31840,8 @@ autopage-\theLWR@currentautosec% } } }{% lwarp_baseline_marker.png or .eps is not present - \PackageWarningNoLine{lwarp}{File \LWR@baselinename\space is not installed\MessageBreak + \PackageWarningNoLine{lwarp}{% + File \LWR@baselinename\space is not installed\MessageBreak alongside the lwarp-*.sty files,\MessageBreak so SVG math baselines may not be accurate} \newcommand*{\LWR@addbaselinemarker}{} @@ -31312,7 +31893,7 @@ autopage-\theLWR@currentautosec% % 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)|'', as -% translated according to \cs{mathimagename}. +% translated according to \cs{MathImageAltText}. % If this is the case, force the use of a \env{lateximage} even if MathJax. % Likewise for \pkg{siunitx} if |parse-numbers=false|. % @@ -31326,7 +31907,11 @@ autopage-\theLWR@currentautosec% bool{mathjax} or ( bool{FormatWP} and bool{WPMarkMath} ) ) and - ( not test { \ifstrequal {#2} {(\mathimagename)} } ) and % from \ensuredmath + ( not test { + \ifstrequal {#2} + {\AltTextOpen\MathImageAltText\AltTextClose} % from \ensuredmath + } + ) and ( not bool{LWR@dynamicmath} ) }% % \end{macrocode} @@ -31352,20 +31937,14 @@ autopage-\theLWR@currentautosec% % Temporarily disable formatting while measuring the image parameters: % \begin{macrocode} \LWR@restoreorigformatting% - \RenewDocumentEnvironment{lateximage}{s o o o}{}{}% inside group + \RenewDocumentEnvironment{lateximage}{s o s o o}{}{}% inside group \LWR@print@normalsize% % \end{macrocode} % Temporarily set font for the \HTML\ \PDF\ output: % \changes{v0.51}{2018/03/14}{Fix: Honors text font around \SVG\ math.} +% \changes{v0.74}{2019/09/01}{Fix: Font control.} % \begin{macrocode} - \LWR@traceinfo{Using font family \LWR@f@family}% - \@nameuse{LWR@orig\LWR@f@family family}% - \LWR@traceinfo{Using font series \LWR@f@series}% - \@nameuse{LWR@orig\LWR@f@series series}% - \LWR@traceinfo{Using font shape \LWR@f@shape}% - \@nameuse{LWR@orig\LWR@f@shape shape}% - \LWR@traceinfo{Using font caps shape \LWR@f@shapecaps}% - \@nameuse{LWR@orig\LWR@f@shapecaps shape}% + \LWR@setcurrentfont% % \end{macrocode} % |lateximagedepth| must be nested to avoid generating paragraph tags. % \AmS\ math modifies the \cs{text} macro such that \cs{addtocounter} does not @@ -31511,11 +32090,12 @@ autopage-\theLWR@currentautosec% % When hashing, also include the current font and color in the hash. % \changes{v0.50}{2018/02/22}{MD5 hash avoids duplicate \SVG\ math.} % \changes{v0.57}{2018/05/23}{Fix: Dynamic inline math expressions.} +% \changes{v0.74}{2019/08/20}{Adds star argument for \env{lateximage}.} % \begin{macrocode} \ifbool{LWR@dynamicmath}{% \LWR@traceinfo{subsingledollar: dynamic}% \begin{lateximage}% no hashing - [(\mathimagename)]% alt tag + [\MathImageAltText]% alt tag []% no add'l hashing [\LWR@singledollarstyle \LWR@singledollardepthstyle]% CSS }{% @@ -31533,6 +32113,7 @@ autopage-\theLWR@currentautosec% % \begin{macrocode} \begin{lateximage}*% use hashing [#2]% alt + *% do not add open/closing braces [% addl' hashing #3% FM\LWR@f@family% @@ -31582,6 +32163,11 @@ autopage-\theLWR@currentautosec% }% not mathjax \endgroup% }% not in a lateximage +% \end{macrocode} +% Clear the single-use \attribute{alt} text: +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} +\gdef\LWR@ThisAltText{}% \LWR@traceinfo{LWR@subsingledollar: done}% } % \end{macrocode} @@ -31657,6 +32243,7 @@ autopage-\theLWR@currentautosec% \LWR@HTMLsanitize{#1} % extra space \textbackslash{]}% ]% + *% do not add open/closing braces % \end{macrocode} % Support for \pkg{xfakebold}: % \changes{v0.67}{2019/02/17}{\pkg{xfakebold}: Added support.} @@ -31668,6 +32255,11 @@ autopage-\theLWR@currentautosec% \end{lateximage}% \end{BlockClass}% }% not mathjax +% \end{macrocode} +% Clear the single-use \attribute{alt} text: +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} +\gdef\LWR@ThisAltText{}% }% % \end{macrocode} % \end{macro} @@ -31696,6 +32288,11 @@ autopage-\theLWR@currentautosec% {singledollar}% add'l hashing {\LWR@origensuredmath{#1}}% contents }% not mathjax +% \end{macrocode} +% Clear the single-use \attribute{alt} text: +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} +\gdef\LWR@ThisAltText{}% } % \end{macrocode} % \end{macro} @@ -31740,7 +32337,7 @@ autopage-\theLWR@currentautosec% \renewcommand{\@ensuredmath}[1]{% \ifbool{mathjax}{% - \LWR@subsingledollar*{(\mathimagename)}{% + \LWR@subsingledollar*{\AltTextOpen\MathImageAltText\AltTextClose}{% \protect\LWR@HTMLsanitize{\detokenize\expandafter{#1}}% }{\relax% \LWR@origensuredmath{#1}% @@ -31759,7 +32356,7 @@ autopage-\theLWR@currentautosec% \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% {\LWR@origensuredmath{#1}}% {% - \LWR@subsingledollar*{(\mathimagename)}{% + \LWR@subsingledollar*{\AltTextOpen\MathImageAltText\AltTextClose}{% \protect\LWR@HTMLsanitize{\detokenize\expandafter{#1}}% }{% \LWR@origensuredmath{#1}% @@ -31767,6 +32364,11 @@ autopage-\theLWR@currentautosec% }% \fi% }% +% \end{macrocode} +% Clear the single-use \attribute{alt} text: +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} +\gdef\LWR@ThisAltText{}% } % \end{macrocode} % \end{macro} @@ -31810,6 +32412,7 @@ autopage-\theLWR@currentautosec% % 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.} +% \changes{v0.74}{2019/08/07}{Uses \cs{MathImageAltText}.} % \begin{macrocode} \newenvironment{LWR@displaymathother} {% @@ -31817,7 +32420,7 @@ autopage-\theLWR@currentautosec% \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% \begin{lateximage}% - [(display math)]% + [\MathImageAltText]% \LWR@origdollar\LWR@origdollar% } {% @@ -31833,14 +32436,14 @@ autopage-\theLWR@currentautosec% % 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.} +% \changes{v0.74}{2019/08/07}{Uses \cs{MathImageAltText}.} % \begin{macrocode} \newenvironment{LWR@equationother} {% \begin{BlockClass}{displaymathnumbered}% \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}% - [(display math)]% + \begin{lateximage}[\MathImageAltText]% \LWR@origequation% } {% @@ -32065,7 +32668,7 @@ autopage-\theLWR@currentautosec% \textbackslash{begin\{#2\}} % extra space \LWR@HTMLsanitizeexpand{\detokenize\expandafter{#1}} % extra space \textbackslash{end\{#2\}}% - ]% alt tag + ]*% alt tag % \end{macrocode} % Support for \pkg{xfakebold}: % \changes{v0.67}{2019/02/17}{\pkg{xfakebold}: Added support.} @@ -32081,6 +32684,11 @@ autopage-\theLWR@currentautosec% \end{lateximage}% \end{BlockClass}% }% not mathjax +% \end{macrocode} +% Clear the single-use \attribute{alt} text: +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} +\gdef\LWR@ThisAltText{}% } % \end{macrocode} % @@ -32094,6 +32702,11 @@ autopage-\theLWR@currentautosec% \LWR@addmathjax{#1}{\BODY}% }{}% +% \end{macrocode} +% Clear the single-use \attribute{alt} text: +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} +\gdef\LWR@ThisAltText{}% } % \end{macrocode} % \end{macro} @@ -32421,7 +33034,7 @@ autopage-\theLWR@currentautosec% \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% \begin{lateximage}[(\LWR@startingequationtag--\LWR@equationtag) - \LWR@addmathjax{eqnarray}{\BODY}] + \LWR@addmathjax{eqnarray}{\BODY}]* % \end{macrocode} % Support for \pkg{xfakebold}: % \changes{v0.67}{2019/02/17}{\pkg{xfakebold}: Added support.} @@ -32445,7 +33058,7 @@ autopage-\theLWR@currentautosec% \begin{BlockClass}{displaymath} \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}[\LWR@addmathjax{eqnarray*}{\BODY}] + \begin{lateximage}[\LWR@addmathjax{eqnarray*}{\BODY}]* % \end{macrocode} % Support for \pkg{xfakebold}: % \changes{v0.67}{2019/02/17}{\pkg{xfakebold}: Added support.} @@ -32466,6 +33079,11 @@ autopage-\theLWR@currentautosec% % Default to number equations in the future: % \begin{macrocode} \booltrue{LWR@numbereqnarray} +% \end{macrocode} +% Clear the single-use \attribute{alt} text: +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} +\gdef\LWR@ThisAltText{}% } % \end{macrocode} % @@ -32531,9 +33149,9 @@ autopage-\theLWR@currentautosec% % for text copy/paste. In some other cases, the \attribute{alt} tag is set % according to the package name. % -% \describemathimagename +% \describeMathImageAltText % -% \describepackagediagramname +% \describePackageDiagramAltText % % \limitslateximagefontsize % @@ -32603,13 +33221,14 @@ autopage-\theLWR@currentautosec% % \begin{macro}{\LateximageFontScale} % \changes{v0.52}{2018/03/24}{Added user-adjustable \SVG\ math font scaling.} +% \changes{v0.74}{2019/09/02}{Adjusted \SVG\ math font scaling default to 1.} % 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 +% The default is 1, but it may be redefined as needed depending on the % \HTML\ font. % % \begin{macrocode} -\newcommand*{\LateximageFontScale}{.75} +\newcommand*{\LateximageFontScale}{1} % \end{macrocode} % \end{macro} @@ -32850,11 +33469,60 @@ autopage-\theLWR@currentautosec% % \subsection{\env{lateximage} environment} -% \begin{environment}{lateximage} * \oarg{2: \element{alt} tag} -% \oarg{3: add'l hashing} \oarg{4: \CSS\ style} + +% \begin{macro}{\LWR@lateximage@oneimageb} \marg{1: alt text} \marg{2: filename} +% \marg{3: CSS style} +% Creates the image for the \env{lateximage}. +% +% \changes{v0.74}{2019/08/26}{Factored from \env{lateximage}.} +% \begin{macrocode} +\newcommand{\LWR@lateximage@oneimageb}[3]{% + \LWR@subinlineimage{#1}{lateximage}% + {% + \LWR@print@mbox{% + \LWR@ImagesDirectory\OSPathSymbol% + #2% + }% + }{svg}{#3}% +} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\LWR@lateximage@oneimage} \marg{1: alt text} \marg{2: filename} +% \marg{3: \CSS\ style} \marg{4: delimit?} +% +% Creates an image for the \env{lateximage}, +% whose \attribute{alt} text depends on the circumstances. +% +% \changes{v0.74}{2019/08/26}{Factored from \env{lateximage}.} +% \begin{macrocode} +\newcommand{\LWR@lateximage@oneimage}[4]{% + \ifdefvoid{\LWR@ThisAltText}{% + \IfBooleanTF{#4}{% + \LWR@lateximage@oneimageb{#1}{#2}{#3}% + }{% + \LWR@lateximage@oneimageb% + {\AltTextOpen#1\AltTextClose}% + {#2}{#3}% + }% + }{% + \LWR@lateximage@oneimageb% + {\AltTextOpen\LWR@ThisAltText\AltTextClose}% + {#2}{#3}% + }% +} +% \end{macrocode} +% \end{macro} + + +% \begin{environment}{lateximage} * \oarg{2: \element{alt} tag} * +% \oarg{4: add'l hashing} \oarg{5: \CSS\ style} % % Typesets the contents and then renders the result as an \SVG\ file. -% Star causes the image to be hashed for reuse. +% Star \#1 causes the image to be hashed for reuse. +% Star \#3 causes the \attribute{alt} tag to not include \cs{AltTextOpen} and +% \cs{AltTextClose}, for use with math expressions. % % The optional \element{alt} tag is included in the \HTML\ code for use with copy/paste. % @@ -32889,12 +33557,13 @@ autopage-\theLWR@currentautosec% % 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.} -% \changes{v0.66}{2019/01/27}{Adds \cs{BaseJobname} for multiple projects.} +% \changes{v0.66}{2019/01/27}{Added \cs{BaseJobname} for multiple projects.} +% \changes{v0.74}{2019/08/20}{Added second starred argument.} % % \begin{macrocode} \catcode`\$=\active% -\NewDocumentEnvironment{lateximage}{s O{(image)} O{} O{}} +\NewDocumentEnvironment{lateximage}{s O{\ImageAltText} s O{} O{}} {% \LWR@traceinfo{lateximage: starting on \jobname.pdf page \arabic{page}}% \LWR@traceinfo{lateximage: entering depth is \arabic{LWR@lateximagedepth}}% @@ -32973,14 +33642,25 @@ autopage-\theLWR@currentautosec% \LWR@traceinfo{lateximage: about to write to \BaseJobname-images.txt}% \IfBooleanTF{#1}% starred {% hash - \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.} +% \changes{v0.74}{2019/09/01}{Improved \attribute{alt} text.} % \begin{macrocode} - \edef\LWR@hashedname{% - \LWR@mdfive{\detokenize\expandafter{#2}-!-#3}% + \ifdefvoid{\LWR@ThisAltText}{% + \IfBooleanTF{#3}{% + \edef\LWR@hashedname{% + \LWR@mdfive{\detokenize\expandafter{#2}-!-#4}% + }% + }{% + \edef\LWR@hashedname{% + \LWR@mdfive{\detokenize\expandafter{\AltTextOpen#2\AltTextClose}-!-#4}% + }% + }% + }{% + \edef\LWR@hashedname{% + \LWR@mdfive{\detokenize\expandafter{\AltTextOpen\LWR@ThisAltText\AltTextClose}-!-#4}% + }% }% \LWR@traceinfo{lateximage: hash is \LWR@hashedname}% % \end{macrocode} @@ -33114,21 +33794,14 @@ autopage-\theLWR@currentautosec% % Create a link to the lateximage, allowing its natural height: % \changes{v0.47}{2018/01/26}{Fix: Line wrap at \HTML\ hyphen.} % \changes{v0.50}{2018/02/22}{MD5 hash avoids duplicate \SVG\ math.} +% \changes{v0.74}{2019/08/20}{New syntax for \cs{LWR@subinlineimage}.} % \begin{macrocode} \IfBooleanTF{#1}% starred {% hash - \LWR@subinlineimage[#2]{lateximage}% - {% - \LWR@ImagesDirectory\OSPathSymbol% - \LWR@print@mbox{\LWR@hashedname}% - }{svg}{#4}% + \LWR@lateximage@oneimage{#2}{\LWR@hashedname}{#5}{#3}% }% hash {% no hash - \LWR@subinlineimage[#2]{lateximage}% - {% - \LWR@ImagesDirectory\OSPathSymbol% - \LWR@print@mbox{\LWR@ImagesName\theLWR@externalfilecnt}% - }{svg}{#4}% + \LWR@lateximage@oneimage{#2}{\LWR@ImagesName\theLWR@externalfilecnt}{#5}{#3}% }% no hash % \end{macrocode} % Be sure that are doing a paragraph: @@ -33146,6 +33819,11 @@ autopage-\theLWR@currentautosec% % This is not inside an \AmS\ \cs{text}, so regular \cs{addtocounter} may be used here. % \begin{macrocode} \addtocounter{LWR@lateximagedepth}{-1}% +% \end{macrocode} +% Clear the single-use \attribute{alt} text: +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} + \gdef\LWR@ThisAltText{}% }% end of outer-most lateximage \LWR@traceinfo{lateximage: exiting depth is \arabic{LWR@lateximagedepth}}% \LWR@traceinfo{lateximage: done}% @@ -33160,13 +33838,15 @@ autopage-\theLWR@currentautosec% \begin{warpprint} % \end{macrocode} -% \begin{environment}{lateximage} \oarg{\element{alt} tag} \oarg{\CSS\ style} +% \begin{environment}{lateximage} * \oarg{\element{alt} tag} * +% \oarg{add'l hashing} \oarg{\CSS\ style} % % \env{varwidth} is used to create a box of the natural width of its contents. % % \changes{v0.48}{2018/02/02}{Print mode boxed to natural width.} +% \changes{v0.74}{2019/08/20}{Added second starred argument.} % \begin{macrocode} -\NewDocumentEnvironment{lateximage}{s o o o} +\NewDocumentEnvironment{lateximage}{s o s o o} {\begin{varwidth}[b]{\linewidth}} {\end{varwidth}} % \end{macrocode} @@ -33975,7 +34655,7 @@ autopage-\theLWR@currentautosec% % \changes{v0.44}{2017/11/16}{\pkg{overpic}: Fix: Groups for lateximages.} % \changes{v0.59}{2018/09/05}{Added an \attribute{alt} tag.} % \begin{macrocode} -\BeforeBeginEnvironment{picture}{\begin{lateximage}[(picture)]} +\BeforeBeginEnvironment{picture}{\begin{lateximage}[picture]} \AfterEndEnvironment{picture}{\end{lateximage}} % \end{macrocode} @@ -35138,7 +35818,7 @@ color:\LWR@origpound\LWR@tempcolor% % \end{macrocode} % \changes{v0.73}{2019/06/24}{Fix: \cs{hspace} in sectioning file name.} % \begin{macrocode} -\RenewDocumentCommand{\hspace}{s m}{} +\RenewDocumentCommand{\hspace}{s m}{}% % \end{macrocode} % \begin{macrocode} \RenewDocumentCommand{\LWR@htmlspanclass}{o m +m}{##3}% @@ -35816,6 +36496,7 @@ color:\LWR@origpound\LWR@tempcolor% % \changes{v0.19}{2016/05/29}{Fix: \cs{hspace} length computations.} % \changes{v0.20}{2016/08/22}{Add: Supports \HTML\ thin breakable space.} % \changes{v0.24}{2017/03/14}{Add: \cs{hspace} \cs{fill} converts to 2em} +% \changes{v0.74}{2019/08/04}{Ignore negative space.} % % Prints a span of a given width. Ignores the optional star. % @@ -35831,9 +36512,9 @@ color:\LWR@origpound\LWR@tempcolor% \setlength{\LWR@tempwidth}{2em}% \fi% % \end{macrocode} -% Only if the width is not zero: +% Only if the width is greater than zero: % \begin{macrocode} -\ifdimcomp{\LWR@tempwidth}{=}{0pt}{}{% +\ifdimcomp{\LWR@tempwidth}{>}{0pt}{% % \end{macrocode} % If had a minipage this paragraph, try to inline the % white space without generating paragraph tags: @@ -35882,7 +36563,7 @@ color:\LWR@origpound\LWR@tempcolor% % white space without generating paragraph tags: % \begin{macrocode} \LWR@minipagestartpars% -}% width not 0 +}{}% width greater than 0 }% } % \end{macrocode} @@ -36996,7 +37677,7 @@ color:\LWR@origpound\LWR@tempcolor% \let\LWR@academicons@orig@AI\AI \newcommand*{\LWR@academicons@symbol}[1]{% - \begin{lateximage}*[(academicon)][academicons#1]% + \begin{lateximage}*[academicon][academicons#1]% \begingroup% \LWR@academicons@orig@AI% \LWR@orig@symbol{#1}% @@ -37010,7 +37691,7 @@ color:\LWR@origpound\LWR@tempcolor% \renewcommand*{\aiicon}[1] {% - \begin{lateximage}*[(#1 icon)][academicons#1]% + \begin{lateximage}*[#1 icon][academicons#1]% \AI\csname aiicon@#1\endcsname% \end{lateximage}% } @@ -37810,7 +38491,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \begin{BlockClass}{displaymathnumbered} \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}[\LWR@amsmathbodynumbered{#1}] + \begin{lateximage}[\LWR@amsmathbodynumbered{#1}]* \LWR@applyxfakebold% } % \end{macrocode} @@ -37867,6 +38548,11 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \LWR@addmathjax{#1}{\the\@envbody} } {\LWR@amsmathenv@@after} +% \end{macrocode} +% Clear the single-use \attribute{alt} text: +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} +\gdef\LWR@ThisAltText{}% } % \end{macrocode} % \end{noindmacro} @@ -38676,12 +39362,14 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \end{macrocode} % % \begin{macrocode} -\BeforeBeginEnvironment{asy}{\begin{lateximage}[(-asymptote-~\packagediagramname)]} +\BeforeBeginEnvironment{asy}{% + \begin{lateximage}[-asymptote-~\PackageDiagramAltText]% +} \AfterEndEnvironment{asy}{\end{lateximage}} \xpatchcmd{\asyinclude} {\begingroup} - {\begin{lateximage}[(-asymptote-~\packagediagramname)]} + {\begin{lateximage}[-asymptote-~\PackageDiagramAltText]} {} {\LWR@patcherror{asymptote}{asyinclude-begingroup}} @@ -39145,7 +39833,9 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \end{macrocode} % \begin{macrocode} -\BeforeBeginEnvironment{axopicture}{\begin{lateximage}[(-axopicture-~\packagediagramname)]} +\BeforeBeginEnvironment{axopicture}{% + \begin{lateximage}[-axopicture-~\PackageDiagramAltText]% +} \AfterEndEnvironment{axopicture}{\end{lateximage}} % \end{macrocode} @@ -39849,7 +40539,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \begin{macrocode} \xpatchcmd{\bitpattern} {\begingroup} - {\begin{lateximage}[(-bitpattern-~\packagediagramname)]} + {\begin{lateximage}[-bitpattern-~\PackageDiagramAltText]} {} {\LWR@patcherror{bitpattern}{bitpattern}} @@ -40279,7 +40969,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \begin{BlockClass}{displaymathnumbered} \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}[-breqn dmath- \mathimagename] + \begin{lateximage}[-breqn dmath- \MathImageAltText] } \AfterEndEnvironment{dmath}{ @@ -40290,7 +40980,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \begin{BlockClass}{displaymath} \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}[-breqn dmath*- \mathimagename] + \begin{lateximage}[-breqn dmath*- \MathImageAltText] } \AfterEndEnvironment{dmath*}{ @@ -40301,7 +40991,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \begin{BlockClass}{displaymathnumbered} \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}[-breqn dseries- \mathimagename] + \begin{lateximage}[-breqn dseries- \MathImageAltText] } \AfterEndEnvironment{dseries}{ @@ -40312,7 +41002,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \begin{BlockClass}{displaymath} \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}[-breqn dseries*- \mathimagename] + \begin{lateximage}[-breqn dseries*- \MathImageAltText] } \AfterEndEnvironment{dseries*}{ @@ -40323,7 +41013,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \begin{BlockClass}{displaymath} \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}[-breqn dgroup- \mathimagename] + \begin{lateximage}[-breqn dgroup- \MathImageAltText] } \AfterEndEnvironment{dgroup}{ @@ -40334,7 +41024,7 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% \begin{BlockClass}{displaymath} \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}[-breqn dgroup*- \mathimagename] + \begin{lateximage}[-breqn dgroup*- \MathImageAltText] } \AfterEndEnvironment{dgroup*}{ @@ -40427,7 +41117,9 @@ span style="width:\LWR@printlength{\ALG@thistlm}; display:inline-block;"% % \end{macrocode} % \begin{macrocode} -\BeforeBeginEnvironment{bytefield}{\begin{lateximage}[(-bytefield-~\packagediagramname)]} +\BeforeBeginEnvironment{bytefield}{% + \begin{lateximage}[-bytefield-~\PackageDiagramAltText]% +} \AfterEndEnvironment{bytefield}{\end{lateximage}} % \end{macrocode} @@ -40792,7 +41484,7 @@ s% \begin{BlockClass}{displaymathnumbered} \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}[-cases- \mathimagename] + \begin{lateximage}[-cases- \MathImageAltText] } \AfterEndEnvironment{numcases}{ @@ -40803,7 +41495,7 @@ s% \begin{BlockClass}{displaymathnumbered} \LWR@newautoidanchor% \booltrue{LWR@indisplaymathimage}% - \begin{lateximage}[-cases- \mathimagename] + \begin{lateximage}[-cases- \MathImageAltText] } \AfterEndEnvironment{subnumcases}{ @@ -41214,19 +41906,21 @@ s% \LetLtxMacro\LWR@chemfig@origchemfig\chemfig \renewcommand*{\chemfig}[2][]{% - \begin{lateximage}[(-chemfig-~\packagediagramname)]% + \begin{lateximage}[-chemfig-~\PackageDiagramAltText]% \LWR@chemfig@origchemfig[#1]{#2}% \end{lateximage}% } \GlobalLetLtxMacro\LWR@chemfig@origCF_lewisc\CF_lewisc \gdef\CF_lewisc#1,#2\_nil{% - \begin{lateximage}[(-chemfig-~\packagediagramname)]% + \begin{lateximage}[-chemfig-~\PackageDiagramAltText]% \LWR@chemfig@origCF_lewisc#1,#2\_nil \end{lateximage} } - \gpreto{\schemestart}{\begin{lateximage}[(-chemfig-~\packagediagramname)]} + \gpreto{\schemestart}{% + \begin{lateximage}[-chemfig-~\PackageDiagramAltText]% + } \gappto{\CF_schemestop}{\end{lateximage}} }% 2019/04/18 or newer @@ -41235,7 +41929,7 @@ s% \LetLtxMacro\LWR@chemfig@origchemfig\chemfig \DeclareDocumentCommand\chemfig{s O{} O{} m}{% - \begin{lateximage}[(-chemfig-~\packagediagramname)]% + \begin{lateximage}[-chemfig-~\PackageDiagramAltText]% \IfBooleanTF{#1}{% \LWR@chemfig@origchemfig*[#2][#3]{#4}% }{% @@ -41247,12 +41941,14 @@ s% \LetLtxMacro\LWR@chemfig@origCF@lewis@b\CF@lewis@b \def\CF@lewis@b#1#2{% - \begin{lateximage}[(-chemfig-~\packagediagramname)]% + \begin{lateximage}[-chemfig-~\PackageDiagramAltText]% \LWR@chemfig@origCF@lewis@b{#1}{#2}% \end{lateximage}% } - \preto{\schemestart}{\begin{lateximage}[(-chemfig-~\packagediagramname)]} + \preto{\schemestart}{% + \begin{lateximage}[-chemfig-~\PackageDiagramAltText]% + } \appto{\CF@schemestop}{\end{lateximage}} }% older than 2019/04/18 @@ -41264,7 +41960,7 @@ s% \LetLtxMacro\LWR@chemfig@origchemleft\chemleft \def\chemleft#1#2\chemright#3{% -\begin{lateximage}[(-chemfig-~\packagediagramname)]% +\begin{lateximage}[-chemfig-~\PackageDiagramAltText]% \LWR@chemfig@origchemleft#1#2\chemright#3% \end{lateximage}% } @@ -41272,7 +41968,7 @@ s% \LetLtxMacro\LWR@chemfig@origchemup\chemup \def\chemup#1#2\chemdown#3{% -\begin{lateximage}[(-chemfig-~\packagediagramname)]% +\begin{lateximage}[-chemfig-~\PackageDiagramAltText]% \LWR@chemfig@origchemup#1#2\chemdown#3% \end{lateximage}% } @@ -41393,7 +42089,7 @@ s% % \begin{macrocode} \RenewDocumentCommand \charrow { mO{}O{} } { - \begin{lateximage}[(-chemformula- charrow)] + \begin{lateximage}[-chemformula- charrow] \group_begin: \__chemformula_draw_arrow:nnn {#1} {#2} {#3} \group_end: @@ -41409,7 +42105,7 @@ s% { \begin{lateximage}*[% \textbackslash{}chname(\LWR@HTMLsanitize{#1})(\LWR@HTMLsanitize{#2}) - ]% + ]*% \chemformula_chwritebelow:nn {#1} {#2} \end{lateximage} } @@ -41729,7 +42425,7 @@ s% % \begin{noindenvironment}{polymerdelims} % \begin{macrocode} \DeclareDocumentEnvironment{polymerdelims}{} -{\begin{lateximage}[(-chemmacros- polymer)]} +{\begin{lateximage}[-chemmacros- polymer]} {\end{lateximage}} % \end{macrocode} % \end{noindenvironment} @@ -41741,7 +42437,7 @@ s% % For the print output version, see \cref{sec:chemmacrosprintenvs}. % \begin{macrocode} \DeclareDocumentEnvironment{redoxreaction}{m m} -{\begin{lateximage}[(-chemmacros- redoxreaction)]} +{\begin{lateximage}[-chemmacros- redoxreaction]} {\end{lateximage}} % \end{macrocode} % \end{noindenvironment} @@ -41942,13 +42638,13 @@ s% % % \begin{macrocode} \RenewDocumentCommand \Sconf { O{S} } { -\begin{lateximage}[\textbackslash{}Sconf{[}#1{]}] +\begin{lateximage}[\textbackslash{}Sconf{[}#1{]}]* \chemmacros_sconf:n {#1} \end{lateximage} } \RenewDocumentCommand \Rconf { O{R} } { -\begin{lateximage}[\textbackslash{}Rconf{[}#1{]}] +\begin{lateximage}[\textbackslash{}Rconf{[}#1{]}]* \chemmacros_rconf:n {#1} \end{lateximage} } @@ -42210,8 +42906,8 @@ s% \RenewDocumentCommand \newman {od()m}% { \IfValueTF{#2} - {\begin{lateximage}[\textbackslash{}newman(#2)\{#3\}]} - {\begin{lateximage}[\textbackslash{}newman\{#3\}]} + {\begin{lateximage}[\textbackslash{}newman(#2)\{#3\}]*} + {\begin{lateximage}[\textbackslash{}newman\{#3\}]*} \group_begin: \IfNoValueF {#1} { \chemmacros_set_keys:nn {newman} {#1} } \IfNoValueTF {#2} @@ -42238,12 +42934,12 @@ s% { \begin{lateximage}[% \textbackslash{}orbital{[}\LWR@HTMLsanitize{#1}{]}\{#2\}% - ][][margin-left: 1em ; margin-right: 1em] + ]*[][margin-left: 1em ; margin-right: 1em] } { \begin{lateximage}[% \textbackslash{}orbital\{#2\}% - ][][margin-left: 1em ; margin-right: 1em] + ]*[][margin-left: 1em ; margin-right: 1em] } \group_begin: \chemmacros_set_keys:nn {orbital/type} {#2} @@ -42272,13 +42968,17 @@ s% { \exp_args:Nnx \DeclareDocumentEnvironment {#1} { O{} \prg_replicate:nn {#3+0} {m} } { - \boolfalse{mathjax}% lwarp + \boolfalse{mathjax}% lwarp + \ifdefvoid{\LWR@ThisAltText}{% lwarp + \ThisAltText{-chemmacros-~reaction}% lwarp + }{}% lwarp \chemmacros_add_reaction_description:n {##1} \__chemmacros_begin_reaction: \chemmacros_reaction_read:nnw {#2} {#4} } { \__chemmacros_end_reaction: + \gdef\LWR@ThisAltText{}% lwarp } } \cs_generate_variant:Nn \chemmacros_declare_reaction_env:nnnn {nnnV} @@ -47192,7 +47892,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space \newfontfamily{\LWR@orig@FA}{FontAwesome} \newcommand*{\LWR@fontawesome@xelatex@symbol}[1]{% -\begin{lateximage}*[(icon)][fontawesomexetex#1]% +\begin{lateximage}*[icon][fontawesomexetex#1]% \begingroup% \LWR@orig@FA% \LWR@orig@symbol{#1}% @@ -47207,7 +47907,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space \else \newcommand*{\LWR@fontawesome@symbolone}[1]{% -\begin{lateximage}*[(icon #1)][fontawesomeone#1]% +\begin{lateximage}*[icon #1][fontawesomeone#1]% \begingroup% \fontencoding{U}\fontfamily{fontawesomeone}\selectfont% \LWR@orig@symbol{#1}% @@ -47216,7 +47916,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space } \newcommand*{\LWR@fontawesome@symboltwo}[1]{% -\begin{lateximage}*[(icon #1)][fontawesometwo#1]% +\begin{lateximage}*[icon #1][fontawesometwo#1]% \begingroup% \fontencoding{U}\fontfamily{fontawesometwo}\selectfont% \LWR@orig@symbol{#1}% @@ -47225,7 +47925,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space } \newcommand*{\LWR@fontawesome@symbolthree}[1]{% -\begin{lateximage}*[(icon #1)][fontawesomethree#1]% +\begin{lateximage}*[icon #1][fontawesomethree#1]% \begingroup% \fontencoding{U}\fontfamily{fontawesomeonethree}\selectfont% \LWR@orig@symbol{#1}% @@ -47284,7 +47984,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space \ExplSyntaxOn \cs_set:Nn\fontawesome_use_icon:nn{ \cs_if_exist:cTF{c__fontawesome_slot_#2_tl}{ - \begin{lateximage}*[(#2)][#1] + \begin{lateximage}*[#2][#1] \exp_last_unbraced:Nv \__fontawesome_icon_at:nnnn {c__fontawesome_slot_#2_tl} @@ -47708,6 +48408,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space % global results of the starred \cs{Forest*} are lost. % % \changes{v0.54}{2018/04/14}{\pkg{forest}: Added.} +% \changes{v0.74}{2019/09/01}{\pkg{forest}: \attribute{alt} text.} % % \codehtml % @@ -47728,7 +48429,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space {Lwarp uses an environment for images, but \Forest* cannot work in an environment.}% \let\forest@next\forest@env% }{\let\forest@next\forest@group@env}% - \begin{lateximage}[forest]% lwarp + \begin{lateximage}[-forest-~\PackageDiagramAltText]% lwarp \forest@next{#3}% \end{lateximage}% lwarp } @@ -48138,14 +48839,48 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space % as seen by the user's source code. % % \changes{v0.22}{2017/03/01}{\pkg{geometry}: Nullified commands.} +% \changes{v0.74}{2019/08/13}{\pkg{geometry}: Remembers user's geometry.} % % \codehtml % % Discard all options for \pkg{lwarp-geometry}: % \begin{macrocode} -\LWR@ProvidesPackageDrop{geometry}[2018/04/16] +\LWR@ProvidesPackageDropA{geometry}{2018/04/16} +% \end{macrocode} +% +% If \pkg{geometry} is never loaded by the user, +% it will be loaded by \pkg{lwarp} \cs{AtBeginDocument}. +% If this is the case, the page layout should not be changed +% but the user macros should still be nullified. +% \begin{macrocode} +\ifbool{LWR@allowanothergeometry}{% % \end{macrocode} % +% Gather all options: +% \begin{macrocode} +\newcommand*{\LWR@newgeometryoptions}{reset,} + +\DeclareOption*{% + \edef\LWR@newgeometryoptions{\LWR@newgeometryoptions\CurrentOption,}% +} +% \end{macrocode} +% +% Process the options: +% \begin{macrocode} +\ProcessOptions\relax +% \end{macrocode} +% +% Assign and set the selected geometry. +% \cs{AtEndPreamble} \pkg{lwarp} will save this, then set its own geometry. +% \begin{macrocode} +\ifdefvoid{\LWR@newgeometryoptions}{}{ + \expandafter\LWR@origgeometry\expandafter{\LWR@newgeometryoptions} +} + +}{}% LWR@allowanothergeometry +% \end{macrocode} +% +% The user-level commands are nullified: % \begin{macrocode} \renewcommand*{\geometry}[1]{} \renewcommand*{\newgeometry}[1]{} @@ -48415,7 +49150,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space % \end{macrocode} % \changes{v0.65}{2018/12/19}{\pkg{graphics}: Added \cs{includegraphics} \attribute{alt} key.} % \begin{macrocode} -\newcommand*{\LWR@igalt}{(image)} +\newcommand*{\LWR@igalt}{\ImageAltText} % \end{macrocode} % Set the actions of each of the key/value combinations for @@ -48482,7 +49217,7 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space % \end{macrocode} % % -% Handle origin key: +% Handle \optn{origin} key: % \changes{v0.52}{2018/03/27}{pkg{graphics}: Added defaults.} % \begin{macrocode} \define@key{igraph}{origin}[c]{% @@ -48491,19 +49226,20 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space % \end{macrocode} % % -% Handle angle key: +% Handle \optn{angle} key: % \begin{macrocode} \define@key{igraph}{angle}{\renewcommand*{\LWR@igangle}{#1}} % \end{macrocode} % % -% Handle class key: +% Handle \optn{class} key: % \begin{macrocode} \define@key{igraph}{class}{\renewcommand*{\LWR@igclass}{#1}} % \end{macrocode} % -% Handle alt key: +% Handle \optn{alt} key: % \changes{v0.65}{2018/12/19}{\pkg{graphics}: Added \cs{includegraphics} \attribute{alt} key.} +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} % \begin{macrocode} \define@key{igraph}{alt}{\renewcommand*{\LWR@igalt}{#1}} % \end{macrocode} @@ -48736,8 +49472,13 @@ solid {\FancyVerbRuleColor{\LWR@origpound\LWR@tempcolor}} ; % space \renewcommand*{\LWR@igclass}{inlineimage}% % \end{macrocode} % \changes{v0.65}{2018/12/19}{\pkg{graphics}: Added \cs{includegraphics} \attribute{alt} key.} +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} % \begin{macrocode} -\renewcommand*{\LWR@igalt}{(image)}% +\ifdefvoid{\LWR@ThisAltText}{% + \renewcommand*{\LWR@igalt}{\ImageAltText}% +}{% + \renewcommand*{\LWR@igalt}{\LWR@ThisAltText}% +}% % \end{macrocode} % % If |#3| is empty, only one optional argument was given, thus \pkg{graphicx} syntax: @@ -48897,7 +49638,7 @@ src="% % \changes{v0.65}{2018/12/19}{\pkg{graphics}: Added \cs{includegraphics} \attribute{alt} key.} % \begin{macrocode} class="\LWR@igclass"\LWR@indentHTML% -alt="\LWR@igalt" \LWR@orignewline% +alt="\AltTextOpen\LWR@igalt\AltTextClose" \LWR@orignewline% }% end of image tags }% end of href % \end{macrocode} @@ -48905,6 +49646,11 @@ alt="\LWR@igalt" \LWR@orignewline% % \changes{v0.48}{2018/02/11}{Fix: Virtual page size limited to a group.} % \begin{macrocode} \endgroup +% \end{macrocode} +% Clear the single-use \attribute{alt} text: +% \changes{v0.74}{2019/08/20}{Add \cs{ThisAltText}.} +% \begin{macrocode} +\gdef\LWR@ThisAltText{}% \LWR@traceinfo{LWR@includegraphicsb done}% } % \end{macrocode} @@ -48978,7 +49724,7 @@ alt="\LWR@igalt" \LWR@orignewline% % \end{macro} % % -% Handle the origin key for \cs{rotatebox}: +% Handle the \optn{origin} key for \cs{rotatebox}: % \begin{macrocode} \define@key{krotbox}{origin}{% \renewcommand*{\LWR@rotboxorigin}{#1}% @@ -49722,6 +50468,7 @@ do not attempt to patch lwarp's version of `hyperref'.)\MessageBreak} \detokenize\expandafter{#1}\LWR@hashmark% \detokenize\expandafter{#2}.\detokenize\expandafter{#3}% "% + \LWR@addlinktitle% }% \endgroup% \LWR@hyperreffinish% @@ -52759,53 +53506,152 @@ do not attempt to patch lwarp's version of `hyperref'.)\MessageBreak} % \DescribePackage{lyluatex} % \pkg{lyluatex} is patched for use by \pkg{lwarp}. % -% % For the first compile, to set \prog{lwarpmk}'s configuration, use: % \begin{sourceverb} % lualatex --shell-escape % \end{sourceverb} % -% Avoid using the \optn{insert=fullpage} option, or use it -% inside \cs{warpprintonly} or the \env{warpprint} environment. +% After compiling the document with \cmds{lwarpmk html}, +% \watchout[images] +% use \cmds{lwarpmk limages} to convert the Lilypond images for \HTML. +% +% The option \optn{insert=systems} results in an image per system. +% Each music image ``system'' is placed inside a +% \margintag{\CSS} +% \element{span} of class \attribute{lyluatex}, +% which defaults to |display: inline-block|. +% +% The option \optn{insert=fullpage} results in a single image per +% \watchout[\optn{insert=fullpage}] +% page of printed output. +% Each music ``fullpage'' image is placed inside a +% \margintag{\CSS} +% \element{div} of class \attribute{lyluatex}. +% To match the number of measures per line with the printed version, +% use the \pkg{geometry} package to select the page geometry, or +% use the \pkg{lyluatex} options for page and staff sizes. +% +% To use \cs{linewidth} or \cs{textwidth} inside the package options for +% \watchout[options] +% \pkg{lyluatex}, use the \pkg{kvoptions-patch} package first: +% \begin{sourceverb} +% \usepackage{kvoptions-patch} +% \usepackage[...,line-width-0.8\linewidth,...]{lyluatex} +% \end{sourceverb} +% +% If using \optn{raw-pdf}, the resulting \PDF\ images must be converted +% \watchout[\optn{raw-pdf}] +% to \SVG: +% \userentry{lwarpmk pdftosvg tmp-ly/*.pdf} % % \changes{v0.73}{2019/06/10}{\pkg{lyluatex}: Added.} % % \codehtml % % \begin{macrocode} +\LWR@origRequirePackage{luacode} + \LWR@ProvidesPackagePass{lyluatex}[2019/05/27] % \end{macrocode} % % User-redefinable \attribute{ALT} tag: +% \changes{v0.74}{2019/08/25}{\pkg{lyluatex}: Renamef \cs{lyluateximagename}.} % \begin{macrocode} -\newcommand*{\lyluateximagename}{(-lilypond-~\packagediagramname)} +\newcommand*{\LyluatexImageAltText}{-lilypond-~\PackageDiagramAltText} % \end{macrocode} % +% \begin{noindmacro}{\ly@compilescore} \marg{\prog{Lilypond} object} +% \changes{v0.74}{2019/08/04}{\pkg{lyluatex}: Split system images, assign class.} % \begin{macrocode} \LetLtxMacro\LWR@orig@ly@compilescore\ly@compilescore \renewcommand*{\ly@compilescore}[1]{% - \begin{lateximage}[\lyluateximagename]% - \LWR@orig@ly@compilescore{#1}% - \end{lateximage}% -} - -\AtBeginDocument{ - \lysetoption{paperwidth}{6in} - \lysetoption{paperheight}{9in} - \lysetoption{line-width}{5.5in} - \lysetoption{twoside}{false} - \lysetoption{fullpagestyle}{empty} - \lysetoption{fullpagealign}{crop} - \lysetoption{print-page-number}{false} - \lysetoption{insert}{systems} - \lysetoption{extra-top-margin}{0} - \lysetoption{extra-bottom-margin}{0} - \lysetoption{valign}{center} - \lysetoption{staffsize}{20} - \lysetoption{inline-staffsize}{14} +% \end{macrocode} +% +% A local group holds a number of changes: +% \begin{macrocode} + \begingroup% +% \end{macrocode} +% +% The user's original geometry and font size are restored to match the print version. +% This allows for correct spacing in the musical score. +% \changes{v0.74}{2019/08/13}{\pkg{lyluatex}: Adapts to user's geometry.} +% \begin{macrocode} + \LWR@orignewpage% + \LWR@origloadgeometry{LWR@usergeometry}% + \LWR@print@normalsize% +% \end{macrocode} +% +% A local group holds a redefined \cs{includegraphics} which +% is used by \prog{lyluatex.lua} to insert the \prog{Lilypond} score +% if \optn{insert=systems} is used. +% This is now placed inside a \env{lateximage}, which itself is placed +% inside a \element{span} of class \attribute{lyluatex}. +% +% \cs{LWR@addbaselinemarker} preserves the left margins. +% \changes{v0.74}{2019/08/05}{\pkg{lyluatex}: Preserves left margin.} +% \begin{macrocode} + \renewcommand{\includegraphics}[2][]{% + \InlineClass{lyluatex}{% + \begin{lateximage}[\LyluatexImageAltText]% + \LWR@addbaselinemarker% + \LWR@origincludegraphics{##2}% + \end{lateximage}% + }% + }% +% \end{macrocode} +% +% From the original: +% \begin{macrocode} + \ly@setunits% + \directlua{ + ly_opts:set_option('currfiledir', [[\currfiledir]]) + ly_opts:set_option('twoside', '\ly@istwosided') + #1 + }% + \ly@resetunits% + \ly@currentfonts% +% \end{macrocode} +% The fullpage version is set inside an \HTML\ \element{div}: +% \begin{macrocode} + \directlua{ + if (ly.score.insert == 'fullpage') then + tex.print{[[\string\begin{BlockClass}{lyluatex}]]} + end + }% +% \end{macrocode} +% Generate the score: +% \begin{macrocode} + \directlua{ly.score:process()}% +% \end{macrocode} +% Close the \element{div}: +% \begin{macrocode} + \directlua{ + if (ly.score.insert == 'fullpage') then + tex.print{[[\string\end{BlockClass}]]} + end + }% +% \end{macrocode} +% Move to a new page and renew the regular page geometry: +% \begin{macrocode} + \LWR@orignewpage% + \LWR@origrestoregeometry% +% \end{macrocode} +% End of the local group. +% \begin{macrocode} + \endgroup% } % \end{macrocode} +% \end{noindmacro} +% +% In \HTML\ the following generates an error, so is removed: +% \begin{macrocode} +\xpatchcmd{\endly@bufferenv} + {\hspace{0pt}\\} + {} + {} + {\LWR@patcherror{lyluatex}{endly@bufferenv}} +% \end{macrocode} % % \iffalse % @@ -53187,7 +54033,7 @@ do not attempt to patch lwarp's version of `hyperref'.)\MessageBreak} % % \begin{macrocode} \renewcommand{\mvchr}[1]{% - \begin{lateximage}*[(symbol #1)][marvosym #1]% + \begin{lateximage}*[symbol #1][marvosym #1]% \mvs\char#1% \end{lateximage}% } @@ -54200,6 +55046,7 @@ background: % \end{Verbatim} % % \changes{v0.51}{2018/03/04}{\pkg{mhchem}: Added.} +% \changes{v0.74}{2019/08/26}{\pkg{mhchem}: Modified for new \env{lateximage}.} % % \codehtml % @@ -54217,7 +55064,20 @@ background: % 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@findcurrenttextcolor% sets \LWR@tempcolor +\ifbool{LWR@xfakebold}% + {\def\LWR@tempone{Y}}% + {\def\LWR@tempone{N}}% +\begin{lateximage}*[\textbackslash{}ce\{\LWR@HTMLsanitize{#1}\}]*% + [% + FM\LWR@f@family% + SR\LWR@f@series% + SH\LWR@f@shape% + SHC\LWR@f@shapecaps% + CL\LWR@tempcolor% + FB\LWR@tempone% xfakebold + ]% +\LWR@setcurrentfont% \LWR@mhchem@origce{#1}% \end{lateximage}% \endgroup% @@ -54254,7 +55114,20 @@ background: % \begin{macrocode} \newcommand*{\LWR@mhchem@HTML@cesplit}[2] {% -\begin{lateximage}*[\textbackslash{}cesplit\{\LWR@HTMLsanitize{#2}\}]% +\LWR@findcurrenttextcolor% sets \LWR@tempcolor +\ifbool{LWR@xfakebold}% + {\def\LWR@tempone{Y}}% + {\def\LWR@tempone{N}}% +\begin{lateximage}*[\textbackslash{}cesplit\{\LWR@HTMLsanitize{#2}\}]*% + [% + FM\LWR@f@family% + SR\LWR@f@series% + SH\LWR@f@shape% + SHC\LWR@f@shapecaps% + CL\LWR@tempcolor% + FB\LWR@tempone% xfakebold + ]% +\LWR@setcurrentfont% \LWR@mhchem@origcesplit{#1}{#2}% \end{lateximage}% \endgroup% @@ -55259,7 +56132,7 @@ class="td% \LWR@formatted{musDottedNote} \NewDocumentCommand{\LWR@HTML@musMeter}{ m m }{% -\begin{lateximage}*[#1/#2][#1#2]% +\begin{lateximage}*[#1/#2][#1#2]*% \musStack{#1 #2}\kern0.05em% \end{lateximage}% } @@ -55267,7 +56140,7 @@ class="td% \LWR@formatted{musMeter} \NewDocumentCommand{\LWR@HTML@meterCplus}{ m }{% -\begin{lateximage}*[C#1]% +\begin{lateximage}*[C#1]*% \meterC{}\kern-0.7pt#1% \end{lateximage}% } @@ -55275,7 +56148,7 @@ class="td% \LWR@formatted{meterCplus} \NewDocumentCommand{\LWR@HTML@meterC}{}{% -\begin{lateximage}*[C]% +\begin{lateximage}*[C]*% \musSymbolMeter{\symbol{83}}% \end{lateximage}% } @@ -55283,7 +56156,7 @@ class="td% \LWR@formatted{meterC} \NewDocumentCommand{\LWR@HTML@meterCutC}{}{% -\begin{lateximage}*[C|]% +\begin{lateximage}*[C|]*% \musSymbolMeter{\symbol{82}}% \end{lateximage}% } @@ -55291,7 +56164,7 @@ class="td% \LWR@formatted{meterCutC} \NewDocumentCommand{\LWR@HTML@meterCThreeTwo}{}{% -\begin{lateximage}*[C3/2]% +\begin{lateximage}*[C3/2]*% \meterCplus{\musStack{3 2}}% \end{lateximage}% } @@ -55313,9 +56186,9 @@ class="td% \LetLtxMacro\musFlat\LWR@HTML@musFlat% \LetLtxMacro\musDoubleFlat\LWR@HTML@musDoubleFlat% \LetLtxMacro\musNatural\LWR@HTML@musNatural% - ({#1})% braces here because \noFig uses [] + {#1}% braces here because \noFig uses [] }% -]% +]*% \musStack[\musFigFont]{#1}% \end{lateximage}% } @@ -57891,7 +58764,7 @@ do not attempt to patch lwarp's version of `nameref'.)\MessageBreak {% % \end{macrocode} % -% If the \optn{link} option was specified, add a hyper taraget: +% If the \optn{link} option was specified, add a hyper target: % \begin{macrocode} \ifAM@link% \hypertarget{\AM@linkname.\AM@page}{}% @@ -57935,12 +58808,13 @@ do not attempt to patch lwarp's version of `nameref'.)\MessageBreak % \end{macrocode} % \end{noindmacro} % -% \begin{noindmacro}{\includepdf} Patched to set a reasonable paper size. +% \begin{noindmacro}{\includepdf} Patched to set the user's paper size. +% \changes{v0.74}{2019/08/16}{\pkg{pdfpages}: Adjust to user's paper size.} % \begin{macrocode} \xpretocmd{\includepdf}{% \begingroup% - \setlength{\paperwidth}{8in}% - \setlength{\paperheight}{10.5in}% + \setlength{\paperwidth}{\LWR@userspaperwidth}% + \setlength{\paperheight}{\LWR@userspaperheight}% }{}{} \xapptocmd{\includepdf}{% @@ -57949,12 +58823,13 @@ do not attempt to patch lwarp's version of `nameref'.)\MessageBreak % \end{macrocode} % \end{noindmacro} -% \begin{noindmacro}{\includepdfmerge} Patched to set a reasonable paper size. +% \begin{noindmacro}{\includepdfmerge} Patched to set the user's paper size. +% \changes{v0.74}{2019/08/16}{\pkg{pdfpages}: Adjust to user's paper size.} % \begin{macrocode} \xpretocmd{\includepdfmerge}{% \begingroup% - \setlength{\paperwidth}{8in}% - \setlength{\paperheight}{10.5in}% + \setlength{\paperwidth}{\LWR@userspaperwidth}% + \setlength{\paperheight}{\LWR@userspaperheight}% }{}{} \xapptocmd{\includepdfmerge}{% @@ -58326,7 +59201,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % % \begin{macrocode} \renewcommand{\Pisymbol}[2]{% - \begin{lateximage}*[(Pisymbol)][pisymbol#1#2]% + \begin{lateximage}*[Pisymbol][pisymbol#1#2]% {\Pifont{#1}\char#2}% \end{lateximage}% } @@ -58677,7 +59552,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % A \env{lateximage} captures the modified image from the document. % \begin{macrocode} \BeforeBeginEnvironment{psfrags}{% - \begin{lateximage}[(-psfrags-~\packagediagramname)]% + \begin{lateximage}[-psfrags-~\PackageDiagramAltText]% } \AfterEndEnvironment{psfrags}{\end{lateximage}} @@ -58715,13 +59590,13 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % A \env{lateximage} captures the modified image from the document. % \begin{macrocode} \def\pfx@includegraphicx#1#2{% - \begin{lateximage}[(-psfragx-~\packagediagramname)]% + \begin{lateximage}[-psfragx-~\PackageDiagramAltText]% \mbox{\pfx@overpix{#1}{#2}\endpfx@overpix}% \end{lateximage}% } \def\@@@overpix[#1]<#2>[#3]#4{% - \begin{lateximage}[(-psfragx-~\packagediagramname)]% + \begin{lateximage}[-psfragx-~\PackageDiagramAltText]% \pfx@overpix{#1,ovpfgd={#2},ovpbgd={#3}}{#4}% } @@ -58797,7 +59672,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % % \begin{macrocode} \renewcommand\pstool@alwaysprocess[3][]{% - \begin{lateximage}[(-pstool-~\packagediagramname)]% + \begin{lateximage}[-pstool-~\PackageDiagramAltText]% \includegraphics{#2.pdf}% \end{lateximage}% } @@ -58805,7 +59680,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \LetLtxMacro\pstool@maybeprocess\pstool@alwaysprocess \renewcommand\pstool@@psfragfig[4]{% - \begin{lateximage}[(-pstool-~\packagediagramname)]% + \begin{lateximage}[-pstool-~\PackageDiagramAltText]% \includegraphics{#2.pdf}% \end{lateximage}% } @@ -58841,7 +59716,9 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \end{macrocode} % % \begin{macrocode} -\BeforeBeginEnvironment{pspicture}{\begin{lateximage}[(pspicture)]} +\BeforeBeginEnvironment{pspicture}{% + \begin{lateximage}[pspicture]% +} \AfterEndEnvironment{pspicture}{\end{lateximage}} % \end{macrocode} % @@ -59290,7 +60167,10 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \begin{macrocode} \xpatchcmd{\register} {\centering} - {\begin{center}\begin{lateximage}[(-register-~\packagediagramname)]} + {% + \begin{center}% + \begin{lateximage}[-register-~\PackageDiagramAltText]% + } {} {\LWR@patcherror{register}{register}} @@ -59304,7 +60184,10 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', {\LWR@patcherror{register}{endregister}} \expandafter\xapptocmd\csname register*\endcsname - {\begin{center}\begin{lateximage}[(-register-~\packagediagramname)]} + {% + \begin{center}% + \begin{lateximage}[-register-~\PackageDiagramAltText]% + } {} {\LWR@patcherror{register}{register*}} @@ -61005,8 +61888,8 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % and adds the \attribute{alt} tag containing the \LaTeX\ code, allowing for % copy/paste. When units are used outside of the \cs{unit} macro, % each unit macro will have its own \env{lateximage}, -% and each will have the \attribute{alt} tag set to ``|(|<\cs{mathimagename}>|)|'', -% which defaults to ``|(math image)|''. +% and each will have the \attribute{alt} tag set according to \cs{MathImageAltText}, +% which defaults to \optn{(math image)}. % % \changes{v0.59}{2018/07/11}{\pkg{SIunits}: Added.} % @@ -61806,6 +62689,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \pkg{stackengine} is patched for use by \pkg{lwarp}. % % \changes{v0.73}{2019/06/11}{\pkg{stackengine}: Added.} +% \changes{v0.74}{2019/09/01}{\pkg{stackengine}: \attribute{alt} tags.} % % \codehtml % @@ -61822,8 +62706,8 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \begin{macrocode} \renewcommand*{\stackengine}[8]{% \ifstrequal{#4}{O}% - {\begin{lateximage}}% - {\begin{lateximage}[][][vertical-align:top]}% + {\begin{lateximage}[\ImageAltText]}% + {\begin{lateximage}[\ImageAltText][][vertical-align:top]}% \LWR@orig@stackengine{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% \end{lateximage}% } @@ -61839,8 +62723,8 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \renewcommand*{\@stack}[4]{% \ifstrequal{#3}{O}% - {\begin{lateximage}}% - {\begin{lateximage}[][][vertical-align:top]}% + {\begin{lateximage}[\ImageAltText]}% + {\begin{lateximage}[\ImageAltText][][vertical-align:top]}% \LWR@orig@@stack{#1}{#2}{#3}{#4}% \end{lateximage}% } @@ -61865,7 +62749,8 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', {} {\LWR@patcherror{stackengine}{stackanchor patch 2}} -\xpretocmd{\stackanchor}{\begin{lateximage}[][][vertical-align:middle]} +\xpretocmd{\stackanchor} + {\begin{lateximage}[\ImageAltText][][vertical-align:middle]} {} {\LWR@patcherror{stackengine}{stackanchor pre}} @@ -61876,7 +62761,8 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % % \cs{Centerstack} is simply placed inside a \env{lateximage} with a vertical alignment: % \begin{macrocode} -\xpretocmd{\Centerstack}{\begin{lateximage}[][][vertical-align:middle]} +\xpretocmd{\Centerstack} + {\begin{lateximage}[\ImageAltText][][vertical-align:middle]} {} {\LWR@patcherror{stackengine}{Centerstack pre}} @@ -61895,7 +62781,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', }{}% \begingroup% lwarp \LWR@restoreorigformatting% lwarp - \RenewDocumentEnvironment{lateximage}{s o o o}{}{}% lwarp: inside group + \RenewDocumentEnvironment{lateximage}{s o s o o}{}{}% lwarp: inside group \expandafter\LWR@gsavebox\csname\sv@name content\endcsname{#2}% \expandafter\gdef\expandafter#1\expandafter{% \expandafter\begin\expandafter{lateximage\expandafter}% lwarp @@ -61975,6 +62861,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \pkg{struktex} is patched for use by \pkg{lwarp}. % % \changes{v0.67}{2019/02/17}{\pkg{struktex}: Added.} +% \changes{v0.74}{2019/09/01}{\pkg{struktex}: \attribute{alt} text.} % % \codehtml % @@ -61983,7 +62870,9 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \end{macrocode} % % \begin{macrocode} -\BeforeBeginEnvironment{struktogramm}{\begin{lateximage}[(struktogramm)]} +\BeforeBeginEnvironment{struktogramm}{% + \begin{lateximage}[-struktex-~\PackageDiagramAltText]% +} \AfterEndEnvironment{struktogramm}{\end{lateximage}} \newenvironment{LWR@HTML@centernss}{\begin{center}}{\end{center}} @@ -63781,6 +64670,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \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.} % \changes{v0.54}{2018/04/16}{\pkg{tikz}: Fixes for \cs{pgfpicture}, minipages, fit, align, font.} +% \changes{v0.74}{2019/08/09}{\pkg{tikz}: Added \attribute{alt} text.} % % \begin{noindenvironment}{pgfpicture} % The \cs{pgfpicture} environment is enclosed inside a \cs{lateximage}. @@ -63789,7 +64679,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % % \begin{macrocode} \preto\pgfpicture{% - \begin{lateximage}% + \begin{lateximage}[-tikz-~\PackageDiagramAltText]% \ifbool{LWR@tikzbabel}% Test for Tikz version v3.0.0 {}% {\catcode`\$=3}% dollar sign is math shift @@ -66050,7 +66940,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \let\LWR@orig@typicon@TI\TI \newcommand*{\LWR@typicon@symbol}[1]{% - \begin{lateximage}*[(typicon)][typicon#1]% + \begin{lateximage}*[typicon][typicon#1]% \begingroup% \LWR@orig@typicon@TI% \LWR@orig@symbol{#1}% @@ -66064,7 +66954,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', \renewcommand*{\ticon}[1] {% - \begin{lateximage}*[(#1 icon)][typicon#1]% + \begin{lateximage}*[#1 icon][typicon#1]% \TI\csname ticon@#1\endcsname% \end{lateximage}% } @@ -66755,7 +67645,7 @@ remember to convert PDF images to SVG using 'lwarpmk pdftosvg *-fig.pdf', % \begin{macrocode} \renewenvironment{vowel}[1][] {% - \begin{lateximage}[(-vowel-~\packagediagramname)]% + \begin{lateximage}[-vowel-~\PackageDiagramAltText]% \@vowel[#1]% } {% @@ -68395,7 +69285,9 @@ height:\LWR@printlength{\LWR@tempheight}% \NewDocumentCommand{\LWR@HTML@keyboard}{ O{}m } { \begin{lateximage}* - [(-xpiano-~\packagediagramname{}: \detokenize\expandafter{#2})] + [% + -xpiano-~\PackageDiagramAltText{}: \detokenize\expandafter{#2}% + ] [\detokenize\expandafter{#1}] \xpiano_keyboard:nn { #1 } { #2 } \end{lateximage} @@ -68785,7 +69677,7 @@ height:\LWR@printlength{\LWR@tempheight}% \renewcommand*{\xy}{% \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}% {\addtocounter{LWR@lateximagedepth}{1}}% - {\begin{lateximage}[(-xy-~\packagediagramname)]}% + {\begin{lateximage}[-xy-~\PackageDiagramAltText]}% \LWR@orig@xy% } @@ -68812,7 +69704,7 @@ height:\LWR@printlength{\LWR@tempheight}% \LetLtxMacro\LWR@origxygraph\xygraph \renewcommand{\xygraph}[1]{% - \begin{lateximage}[(-xy- xygraph \packagediagramname)] + \begin{lateximage}[-xy- xygraph \PackageDiagramAltText] \LWR@origxygraph{#1} \end{lateximage} } diff --git a/macros/latex/contrib/lwarp/lwarp.pdf b/macros/latex/contrib/lwarp/lwarp.pdf index be96e39d95..74a1de6861 100644 Binary files a/macros/latex/contrib/lwarp/lwarp.pdf and b/macros/latex/contrib/lwarp/lwarp.pdf differ diff --git a/macros/latex/contrib/lwarp/lwarpmk.lua b/macros/latex/contrib/lwarp/lwarpmk.lua index 3b4bb8564b..659a017446 100755 --- a/macros/latex/contrib/lwarp/lwarpmk.lua +++ b/macros/latex/contrib/lwarp/lwarpmk.lua @@ -2,7 +2,7 @@ -- Copyright 2016-2019 Brian Dunn -printversion = "v0.73" +printversion = "v0.74" requiredconfversion = "2" -- also at *lwarpmk.conf function printhelp () @@ -32,7 +32,8 @@ lwarpmk pdftohtml [-p project]: lwarpmk pdftosvg : Converts each PDF file to SVG. lwarpmk epstopdf : Converts each EPS file to PDF. lwarpmk clean [-p project]: Remove *.aux, *.toc, *.lof/t, - *.idx, *.ind, *.log, *_html_inc.*, .gl* + *.idx, *.ind, *.log, *_html_inc.*, .gl*, + *_html.pdf, *_html.html, *_html.sidetoc lwarpmk cleanall [-p project]: Remove auxiliary files, project.pdf, *.html lwarpmk cleanlimages: Removes all images from the "lateximages" directory. lwarpmk -h: Print this help message. @@ -42,6 +43,23 @@ lwarpmk --help: Print this help message. -- printconf () end +function splitfilename ( pathandfilename ) +-- +-- Separates out the path and extension from a filename. +-- Returns path, filename with extension, and extension. +-- Ex: thispath, thisfilename, thisextension = splitfilename ("path/to/filename.ext") +-- +-- https://www.fhug.org.uk/wiki/wiki/doku.php?id=plugins:code_snippets: +-- split_filename_in_to_path_filename_and_extension +-- + if lfs.attributes(pathandfilename,"mode") == "directory" then + local strPath = pathandfilename:gsub("[\\/]$","") -- $ (syntax highlighting) + return strPath.."\\","","" + end + pathandfilename = pathandfilename.."." + return pathandfilename:match("^(.-)([^\\/]-)%.([^\\/%.]-)%.?$") +end + function splitfile (destfile,sourcefile) -- -- Split one large sourcefile into a number of files, @@ -358,6 +376,8 @@ function removeaux () -- -- Remove auxiliary files: -- All .aux files are removed since there may be many bbl*.aux files. +-- Also removes sourcename_html.pdf, sourcename_html.html, +-- and sourcename_html.sidetoc. -- os.execute ( rmname .. " *.aux " .. sourcename ..".toc " .. sourcename .. "_html.toc " .. @@ -368,6 +388,9 @@ os.execute ( rmname .. " *.aux " .. sourcename ..".ps " .. sourcename .."_html.ps " .. sourcename ..".log " .. sourcename .. "_html.log " .. sourcename ..".gl* " .. sourcename .. "_html.gl* " .. + sourcename .. "_html.pdf " .. + sourcename .. "_html.html " .. + sourcename .. "_html.sidetoc " .. " *_html_inc.* " ) end @@ -609,7 +632,7 @@ function convertepstopdf () -- -- Converts EPS files to PDF files. -- The filenames are arg[argindex] and up. --- arg[1] is the command "pdftosvg". +-- arg[1] is the command "epstopdf". -- ignoreconf () for i = argindex , #arg do @@ -617,7 +640,16 @@ for i = argindex , #arg do print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.") else print ("lwarpmk: Converting \"" .. arg[i] .. "\"") - os.execute ( "epstopdf " .. arg[i] ) + thispath, thisfilename, thisextension = splitfilename(arg[i]) + if ( thispath == nil ) then + os.execute ( "epstopdf " .. arg[i] ) + else + os.execute ( + "epstopdf " .. + thispath .. thisfilename .. "." .. thisextension .. " " .. + thispath .. thisfilename .. ".pdf" + ) + end end -- if end -- do end --function @@ -634,7 +666,16 @@ for i = argindex , #arg do print ("lwarpmk: File \"" .. arg[i] .. "\" does not exist.") else print ("lwarpmk: Converting \"" .. arg[i] .. "\"") - os.execute ( "pdftocairo -svg " .. arg[i] ) + thispath, thisfilename, thisextension = splitfilename(arg[i]) + if ( thispath == nil ) then + os.execute ( "pdftocairo -svg " .. arg[i] ) + else + os.execute ( + "pdftocairo -svg " .. + thispath .. thisfilename .. "." .. thisextension .. " " .. + thispath .. thisfilename .. ".svg" + ) + end end -- if end -- do end --function -- cgit v1.2.3