From 0292bed034f591707bde40d43fde302ab6d89f33 Mon Sep 17 00:00:00 2001 From: David Carlisle Date: Thu, 2 Jan 2025 02:12:53 +0000 Subject: [PATCH] actualtext and artifact for #1552 (#1600) * actualtext and artifact fo #1552 * typo fixes from review --- base/doc/ltnews41.tex | 10 +++++++- required/graphics/changes.txt | 5 ++++ required/graphics/graphicx.dtx | 28 ++++++++++++++++++--- required/graphics/grfguide.tex | 10 +++++++- required/graphics/testfiles/github-1552.lvt | 10 ++++++++ required/graphics/testfiles/github-1552.tlg | 2 ++ 6 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 required/graphics/testfiles/github-1552.lvt create mode 100644 required/graphics/testfiles/github-1552.tlg diff --git a/base/doc/ltnews41.tex b/base/doc/ltnews41.tex index 93c5ab933..58e035c53 100644 --- a/base/doc/ltnews41.tex +++ b/base/doc/ltnews41.tex @@ -408,7 +408,15 @@ \subsection{Prevent \texttt{cmd} hook from defining an undefined command} %\section{Changes to packages in the \pkg{amsmath} category} -%\section{Changes to packages in the \pkg{graphics} category} +\section{Changes to packages in the \pkg{graphics} category} + +\subsection{More accessibility keys in \pkg{graphicx}} +The \cs{includegraphics} command now accepts \verb|actualtext| and +\verb|artifact| keys, which by default do nothing but are used by the +tagging code to provide an ActualText string and a boolean flag that the +graphic is an artifact. +% +\githubissue{1552} \section{Changes to packages in the \pkg{tools} category} diff --git a/required/graphics/changes.txt b/required/graphics/changes.txt index d43735807..43256e96c 100644 --- a/required/graphics/changes.txt +++ b/required/graphics/changes.txt @@ -8,6 +8,11 @@ are not part of the distribution. All changes above are only part of the development branch for the next release. ================================================================================ +2024-12-31 David Carlisle + + * grfguide.tex: + Add actualtext and artifact keys for gh/1552 + ######################### # 2024-11-01 Release ######################### diff --git a/required/graphics/graphicx.dtx b/required/graphics/graphicx.dtx index 30d5cb43e..0dc0bfe19 100644 --- a/required/graphics/graphicx.dtx +++ b/required/graphics/graphicx.dtx @@ -19,7 +19,7 @@ % \ProvidesFile{graphicx.drv} % \fi % \ProvidesFile{graphicx.dtx} - [2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)] + [2024/12/31 v1.2e Enhanced LaTeX Graphics (DPC,SPQR)] % % \iffalse %<*driver> @@ -170,7 +170,10 @@ % \item[page] The page of a multi-page PDF graphic to be used. % \item[interpolate] Enables interpolation of bitmap images by viewers. % \item[pagebox] Specifies which PDF box should be used for the natural image size, one of -% mediabox, cropbox, bleedbox, trimbox, artbox. The default is driver-specific. +% mediabox, cropbox, bleedbox, trimbox, artbox. The default is driver-specific. +% \item[alt] Alternative text in accessibility uses. +% \item[actualtext] ActualText text in accessibility uses. +% \item[artifact] Boolean to mark graphics as an artifact in accessibility uses. % \end{description} % % The arguments are interpreted left to right. |clip|, |draft|, |bb|,, @@ -566,7 +569,7 @@ % \end{key} % % \begin{key}{Gin}{alt} -% \changes{v1.2d}{2021/09/16 }{alt key gh/651} +% \changes{v1.2d}{2021/09/16}{alt key gh/651} % By default the |alt| key does nothing but may be used % for alternative text for accessibility uses in extensions. % \begin{macrocode} @@ -574,6 +577,25 @@ % \end{macrocode} % \end{key} % +% \begin{key}{Gin}{actualtext} +% \changes{v1.2e}{2024/12/31}{actualtext key gh/1552} +% By default the |actualtext| key does nothing but may be used +% for ActualText text for accessibility uses in extensions. +% \begin{macrocode} +\define@key{Gin}{actualtext}{} +% \end{macrocode} +% \end{key} +% +% \begin{key}{Gin}{artifact} +% \changes{v1.2e}{2024/12/31}{artifact key gh/1552} +% By default the |artifact| key does nothing but may be used +% to mark graphicas as an artifact for accessibility uses in extensions. +% \begin{macrocode} +\define@key{Gin}{artifact}[true]{% + \lowercase{\Gin@boolkey{#1}}{artifact}} +% \end{macrocode} +% \end{key} +% % \begin{macro}{\Gin@boolkey} % Helper function for defining boolean valued functions. The order of % arguments allows |\lowercase| to only act on the user-supplied diff --git a/required/graphics/grfguide.tex b/required/graphics/grfguide.tex index 959486c05..4dfdb4ca8 100644 --- a/required/graphics/grfguide.tex +++ b/required/graphics/grfguide.tex @@ -63,7 +63,7 @@ \title{Packages in the `graphics' bundle} \author{D. P. Carlisle \and The \LaTeX\ Project} -\date{2024-05-22} +\date{2024-12-31} \maketitle @@ -633,6 +633,14 @@ \subsection{Including Graphics Files} Alternative text for accessibility uses. By default this key is not used but users are encouraged to add descriptive text here that may be used in tagged PDF or as the |alt| attribute in conversions to HTML. +\item[actualtext]\NEWfeature{2024/12/31} + ActualText text for accessibility uses. By default this key is not used + but users are encouraged to add text here that may be used in + tagged PDF or as the text to use in formats that do not use the image. +\item[artifact]\NEWfeature{2024/12/31} + Boolean to mark the graphic as an artifact for accessibility uses. By default this key is not used + but users are encouraged to flag decorative or other non structural images as an artifact for + tagged PDF. \end{description} For the keys specifying the original size (i.e., the bounding box, diff --git a/required/graphics/testfiles/github-1552.lvt b/required/graphics/testfiles/github-1552.lvt new file mode 100644 index 000000000..25993cd3d --- /dev/null +++ b/required/graphics/testfiles/github-1552.lvt @@ -0,0 +1,10 @@ +\documentclass{article} +\usepackage[demo]{graphicx} +\input{test2e} +\begin{document} + +\START +% this should not error +\includegraphics[artifact,actualtext=test image showing an A and lines]{a} + +\END diff --git a/required/graphics/testfiles/github-1552.tlg b/required/graphics/testfiles/github-1552.tlg new file mode 100644 index 000000000..1d0c69753 --- /dev/null +++ b/required/graphics/testfiles/github-1552.tlg @@ -0,0 +1,2 @@ +This is a generated file for the LaTeX2e validation system. +Don't change this file in any respect.