| 1 |
% \subsubsection{Images} |
| 2 |
% \DescribeEnv{image}{Place images inside an |image| environment. On paper, this centers the image. On the web, this provides additional benefits.} |
| 3 |
% \begin{macrocode} |
| 4 |
%<*classXimera> |
| 5 |
%\newenvironment{image}[1][]{\begin{center}}{\end{center}} |
| 6 |
\NewEnviron{image}[1][3in]{% |
| 7 |
\begin{center}\resizebox{#1}{!}{\BODY}\end{center}% resize and center |
| 8 |
} |
| 9 |
%</classXimera> |
| 10 |
% \end{macrocode} |
| 11 |
% \DescribeMacro{\alt}{Inside an |image| environment, |\alt| provides alt-text for assistive technology like screenreaders.} |
| 12 |
% \begin{macrocode} |
| 13 |
%<*classXimera> |
| 14 |
\newcommand{\alt}[1]{} |
| 15 |
%</classXimera> |
| 16 |
% \end{macrocode} |
| 17 |
% The |image| environment doesn't actually work in tex4ht as defined |
| 18 |
% with NewEnviron; so this renewenvironment is needed. |
| 19 |
% image-environment also gets formatted in a well, and when the user |
| 20 |
% clicks on the image, it zooms in. |
| 21 |
% \begin{macrocode} |
| 22 |
%<*htXimera> |
| 23 |
\newcounter{imagealt} |
| 24 |
\setcounter{imagealt}{0} |
| 25 |
\renewenvironment{image}[1][]{\stepcounter{imagealt}% |
| 26 |
\ifvmode \IgnorePar\fi \EndP% |
| 27 |
\HCode{<div class="image-environment" role="img" aria-labelledby="image-alt-\arabic{imagealt}">}% |
| 28 |
}{\HCode{</div>}} |
| 29 |
\renewcommand{\alt}[1]{\HCode{<div style="display: none;" id="image-alt-\arabic{imagealt}">}#1\HCode{</div>}} |
| 30 |
%</htXimera> |
| 31 |
% \end{macrocode} |
| 32 |
% Although we accept many formats, SVG is preferred on the web. |
| 33 |
% Since we have a different mechanism for producing |alt| text, we |
| 34 |
% want to ignore tex4ht's own method fo producing alt text. |
| 35 |
% \begin{macrocode} |
| 36 |
%<*cfgXimera> |
| 37 |
\DeclareGraphicsExtensions{.jpg,.png,.gif,.svg} |
| 38 |
\Configure{graphics*} |
| 39 |
{svg}{ |
| 40 |
{\Configure{Needs}{File: \[email protected]}\Needs{}} |
| 41 |
\Picture[]{\csname Gin@base\endcsname.svg \csname a:Gin-dim\endcsname}% |
| 42 |
} |
| 43 |
%</cfgXimera> |
| 44 |
% \end{macrocode} |
| 45 |
% This is a hack to kill |includegraphics| commands in |
| 46 |
% |\documentclass{standalone}| files |
| 47 |
% \begin{macrocode} |
| 48 |
%<*cfgXimera> |
| 49 |
\ifcsname ifstandalone\endcsname |
| 50 |
\ifstandalone |
| 51 |
\renewcommand\includegraphics[2][]{} |
| 52 |
\fi |
| 53 |
%</cfgXimera> |
| 54 |
% \end{macrocode} |
| 55 |
% PGF sometimes causes trouble, but we simply don't care in tex4ht mode. |
| 56 |
% \begin{macrocode} |
| 57 |
%<*htXimera> |
| 58 |
\newcommand{\pgfsyspdfmark}[3]{} |
| 59 |
%</htXimera> |
| 60 |
% \end{macrocode} |