chirun-ncl / chirun

A Python package providing the command line interface for building flexible and accessible content with Chirun.
https://chirun.org.uk/
Other
29 stars 4 forks source link

\alttext for TikZ images requires \usepackage{graphicx} #44

Closed prowlett closed 3 years ago

prowlett commented 3 years ago

When I run this

\documentclass{article}
\usepackage{tikz}
\usepackage{makecourse}

\begin{document}
    \begin{tikzpicture}
        \draw[fill=blue] (0,0) rectangle (1,2);
    \end{tikzpicture}
    \alttext{A blue box.}
\end{document}

I get an image of a blue box with its alt text the TikZ code that generated it, with the words "A blue box." written under, rendered as:

             <div class="tikzcd" id="a0000000312">
<img alt="\begin{tikzpicture} 
        \draw[fill=blue] (0,0) rectangle (1,2);
    \end{tikzpicture}" src="../../testing_stuff/testing_tikz_image/images/img-0001.svg"/>
</div> A blue box. 

If I add the line \usepackage{graphicx} to the preamble, despite not using the command \includegraphics, I get the image of a blue box with alt text "A blue box.", rendered as:

             <div class="tikzcd" id="a0000000312">
<img alt="A blue box." src="../../testing_stuff/testing_tikz_image/images/img-0001.svg"/>
</div>
georgestagg commented 3 years ago

The \alttext macro has been moved in cd3e164342cbd702c864ffc00f97bf6625346f49 so that it should now always be available in plasTeX, without needing to import graphicx.

LaTeX will still require the makecourse package to see it.