latex3 / tagging-project

Issues related to the tagging project
https://latex3.github.io/tagging-project/
LaTeX Project Public License v1.3c
31 stars 13 forks source link

Beamer is incompatible with Tagging #710

Open meneguzzi opened 4 days ago

meneguzzi commented 4 days ago

Please read the rest of the thread before using the blurb below (as it just seem to work, but does not generate tagging).

Hi everyone,

I've been regularly checking this repo, keen to get my slides to pass accessibility checks in my university. And I do manage to get my beamer slides (with plenty of weird other packages). Bearing in mind some limitations, I do get my slides to compile using the following preamble:

\DocumentMetadata{
    lang=en,
    testphase={phase-I,title,firstaid},
    pdfversion=1.9,
    pdfstandard=a-4,
}

This won't work with the pdfpc package. That does not affect me in a critical way, as I can compile my slides without them for public distribution, and recompile with my presentation notes before I go to deliver my lectures.

I'm still struggling to get headings to work, but everything else seems to work decently.

So, in summary, I think partially compatible would be a better characterisation of beamer wrt tagging.

u-fischer commented 4 days ago

The package status list starts with phase-III is generally needed and with that beamer directly errors.

You are using only phase-I. That merely loads the tagpdf package, activates is and adds a Document tag, it but doesn't do any tagging of its own. (Unrelated but pdf 1.9 doesn't exist, use either 1.7 and a-3 or lower, or 2.0 with a-4).

phase-I is not enough: If you try the following example and upload it to ngpdf.com you will only see a complete empty html representation:

image

\DocumentMetadata{testphase={phase-I}}
\documentclass{beamer}
\begin{document}
\begin{frame}
some text
\end{frame}
\begin{frame}
some text
\end{frame}
\end{document}
meneguzzi commented 4 days ago

I see, my bad, and thanks for explaining this to me. Is there any forum or issue where I could follow up the progress with tagging and beamer? Perhaps even contribute?

meneguzzi commented 3 days ago

Anyway, since this is the first "issue" on beamer, I realised there is a discussion going on, which might be worthy to link to this issue, if this issue remains. Just in case someone else goes down this same rabbit hole.

josephwright commented 3 days ago

I am planning to write something for my blog - I was to talk with the rest of the team before I do, so it will likely be next month

meneguzzi commented 3 days ago

Thanks for all the work on this. I can see you work for a British University (like me), so we are increasingly required to add accessibility to our materials, and every beginning of term I go back and spend a long time seeing if there is a (hacky or otherwise) way to coax my Beamer slides to comply with the requirements. Having a centralised place to check progress here would be indeed very helpful. Now I know who to follow.

FrankMittelbach commented 3 days ago

This issue unfortunately starts out with you writing what you did (which doesn't work as Ulrike explained), so I prefer to close it with "user error" because in all likelyhood there will be people reading only your first part :-). Instead we should have an explicit issue staing that beamer is currently incompatible (if we don#t have that yet).

meneguzzi commented 3 days ago

We can always edit the issue, can we not? And change the initial part too :-D.

meneguzzi commented 3 days ago

If you think this is more appropriate, I can go on and edit the issue title.

u-fischer commented 3 days ago

Well to give a bit of and impression about the problem.

beamer errors because it redefines a footnote command and the patching in the tagging code no longer works. We can get around that with a trick and then footnotes more or less seem to work (but no longer use only beamer code so perhaps look different).

The tagging code redefines lists to be tagging aware. This breaks the overlay code of beamer and also the item labels are missing (we can provide them).

The columns environment is basically a primitive \hbox and that confuses the tagging of minipages (I have no idea how to detect that one is in a \hbox). To get around that problem one has to redefine the environment to insert a \leavevmode.

\frametitle doesn't error, but due to the way beamer process stuff it is in the structure after the text of the frame, so one would have to redefine that.

And naturally a frame should produce some structure too.

I didn't dare to test with some complicated theme ...

\DocumentMetadata{uncompress,pdfversion=2.0,testphase={phase-III,math,table}}

\documentclass{beamer}

\makeatletter
\let\footmisc@hang@makefntext\@makefntext
\newcommand\labelitemi{\textbullet}
\newcommand\labelenumi{\arabic{enumi}}
\renewenvironment<>{columns}[1][]{%
  \begin{actionenv}#2%
  \ifbeamer@onlytextwidth
    \def\beamer@colentrycode{\hbox to\textwidth\bgroup\ignorespaces}%
    \def\beamer@colexitcode{\unskip\egroup}
  \else%
    \def\beamer@colentrycode{%
      \leavevmode\hbox to\textwidth\bgroup%%<--- \leavevmode
      \leavevmode%
      \hskip-\beamer@leftmargin%
      \nobreak%
      \beamer@tempdim=\textwidth%
      \advance\beamer@tempdim by\beamer@leftmargin%
      \advance\beamer@tempdim by\beamer@rightmargin%
      \hbox to\beamer@tempdim\bgroup%
      \hbox{}\hfill\ignorespaces}%
    \def\beamer@colexitcode{\egroup%
      \nobreak%
      \hskip-\beamer@rightmargin\egroup}%
  \fi%
  \ifbeamer@centered\setkeys{beamer@col}{c}\else\setkeys{beamer@col}{t}\fi%
  \setkeys{beamer@col}{#1}%
  \par%
  \beamer@colentrycode%
  \def\beamer@colclose{}\ignorespaces}%
  {\beamer@colclose\def\beamer@colclose{}\beamer@colexitcode\end{actionenv}}
\makeatother  
\begin{document}
\begin{frame}
abc

\begin{itemize} %no overlays anymore! 
\item blub
\item blub
\item blub 
\end{itemize}

\end{frame}
\begin{frame}
abc\footnote{bla}

\begin{enumerate} %no overlays anymore! 
\item blub
\item blub
\item blub 
\end{enumerate}
\end{frame}
\begin{frame}
\begin{columns}
\begin{column}{0.4\textwidth}
left column
\end{column}
\begin{column}{0.4\textwidth}
\includegraphics[width=\linewidth,alt=duck]{example-image-duck}
\end{column}
\end{columns}
\end{frame}
\end{document}

image

meneguzzi commented 3 days ago

I've renamed the issue and added a bold warning at the beginning. This way, when people come here through some search they can see where we are at. The moment I have some time to do what I call "productive procrastination" (i.e., can't focus on what I really need to do), I will try messing with the beamer files to see how far I can get with some basic slides.

But following up on the comment above. Would it not work as partial solution to force all slides with overlays to go to the last "step" of the overlay and use that as the page for tagging?

I agree that it is a non-trivial thing to automatically decide on the semantics of an animation for a screen reader, but if we consider the slides as handouts (as it seems to be a point raised in the other discussion), then just taking the slide in the final step of the overlay would give something with structure. At least 90% (bar table statistic) of the way I see overlays being used are to add (bullet) points as you talk. The semantics of reading the bullet points one by one would match that use case.

josephwright commented 3 days ago

But following up on the comment above. Would it not work as partial solution to force all slides with overlays to go to the last "step" of the overlay and use that as the page for tagging?

Well that's more-or-less the argument that slides don't work with tagging, but handouts should - a 'flattened' version that can be tagged. But that is non-trivial as what makes a 'slide' is complex.

There are various technical issues and the problem that 'we can tag simple slides' runs into that what 'simple' means is a moveable feast.

At the moment, my feeling is that for lecture material, there is discussion to be had about workflows as a whole before trying to tag a subset of slides. But that isn't something that's happening in the next few weeks. On the other hand, with my day job hat on, I'd like to have something workable by the start of 2025-26 (I simply didn't have time for this AY, which for me starts on Monday). So this is very much on the agenda, but not right now - there are wider challenges we need to tackle that impact all documents.

meneguzzi commented 3 days ago

Indeed. My AY starts on Monday as well, and the next term will be tough on me too. But whenever there is progress on this, I'm keen to help with testing if that is helpful. BTW, the "patch" you provided above works for most of my slides. With the only change needed (so far) to be to include a command for bullets in deeper itemizations.:

\makeatletter
\let\footmisc@hang@makefntext\@makefntext
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\textbullet}
\newcommand\labelenumi{\arabic{enumi}}
\renewenvironment<>{columns}[1][]{%
  \begin{actionenv}#2%
  \ifbeamer@onlytextwidth
    \def\beamer@colentrycode{\hbox to\textwidth\bgroup\ignorespaces}%
    \def\beamer@colexitcode{\unskip\egroup}
  \else%
    \def\beamer@colentrycode{%
      \leavevmode\hbox to\textwidth\bgroup%%<--- \leavevmode
      \leavevmode%
      \hskip-\beamer@leftmargin%
      \nobreak%
      \beamer@tempdim=\textwidth%
      \advance\beamer@tempdim by\beamer@leftmargin%
      \advance\beamer@tempdim by\beamer@rightmargin%
      \hbox to\beamer@tempdim\bgroup%
      \hbox{}\hfill\ignorespaces}%
    \def\beamer@colexitcode{\egroup%
      \nobreak%
      \hskip-\beamer@rightmargin\egroup}%
  \fi%
  \ifbeamer@centered\setkeys{beamer@col}{c}\else\setkeys{beamer@col}{t}\fi%
  \setkeys{beamer@col}{#1}%
  \par%
  \beamer@colentrycode%
  \def\beamer@colclose{}\ignorespaces}%
  {\beamer@colclose\def\beamer@colclose{}\beamer@colexitcode\end{actionenv}}
\makeatother  
u-fischer commented 3 days ago

Would it not work as partial solution to force all slides with overlays to go to the last "step" of the overlay and use that as the page for tagging?

I think you didn't quite get my point. The problem is not so much to decide about a more or less sensible structure. The problem is to implement that. beamer redefines basically everything. Above I tested a few standard elements in a very basic setup and found problems in everyone. I added some work arounds but while they allow to compile they are clearly not perfect and destroy various beamer features. Resolving that requires lots of time.

The moment I have some time to do what I call "productive procrastination" (i.e., can't focus on what I really need to do), I will try messing with the beamer files to see how far I can get with some basic slides.

It would help a lot if we had a large amount of simple beamer files testing various elements together with tagging and which document where tagging goes wrong (check the tags in ngpdf or pdfxchange or acrobat), or where beamer features are lost, or which errors, or which have tagging warnings in the log etc. Any test file that I do not have to write and check gives me more time to ponder about solutions.