Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tagging order issue when using sidewaystable environment #751

Open
pskumaresh06 opened this issue Nov 1, 2024 · 3 comments
Open

Tagging order issue when using sidewaystable environment #751

pskumaresh06 opened this issue Nov 1, 2024 · 3 comments
Labels
area: floats and captions currently incompatible package or class package or class that doesn't work with current version of tagging code

Comments

@pskumaresh06
Copy link

I'm encountering an issue with the tagpdf package when using the sidewaystable environment. In my case, the tag order for table content follows the LaTeX input sequence rather than reflecting the table’s actual placement in the PDF output. This causes accessibility tools to read the content out of the intended sequence, affecting logical flow and usability.

Attached is a minimal working example (MWE) and the resulting PDF.

sample.pdf
sample.txt

Could you please advise if there is a way to modify the tag order to follow the visual layout in the PDF?

Thank you very much for your support and for all the work on this valuable package.

@mbertucci47
Copy link
Contributor

Relevant: #112

@u-fischer
Copy link
Member

u-fischer commented Nov 1, 2024

You can try this for now to move the content into the float again (but probably the minipage should not produce structure elements):

\DocumentMetadata{
 lang=en,
 testphase={phase-III,table,title},
 pdfversion=2.0,
 pdfstandard=ua-2,
 pdfstandard=a-4f,
 uncompress
}

\documentclass{article}
\usepackage{rotating}
\makeatletter
\def\@xrotfloat#1[#2]{%
  \@float{#1}[#2]%
  \begin{lrbox}\rot@float@box
  \tagpdfparaOff
  \begin{minipage}\textheight
 }
\makeatother 
\begin{document}

\section{test}
\begin{sidewaystable}
\caption{bla}
\begin{tabular}{ll}
a & b
\end{tabular}
\end{sidewaystable}

\end{document}

@u-fischer
Copy link
Member

u-fischer commented Nov 1, 2024

I think it is better to suspend the tagging for the minipage:

But this code won't work ;-(. Edit: it works if one doesn't forget the \par at the end.

\DocumentMetadata{
 lang=en,
 testphase={phase-III,table,title},
 pdfversion=2.0,
 pdfstandard=ua-2,
 pdfstandard=a-4f,
 uncompress
}

\documentclass{article}
\usepackage{rotating}
\makeatletter
\def\@xrotfloat#1[#2]{%
  \@float{#1}[#2]%
  \begin{lrbox}\rot@float@box
  \SuspendTagging{\minipage}%
  \begin{minipage}\textheight
  \ResumeTagging{\minipage}%
  \UseTaggingSocket{para/restore}% not sure if needed
 }
\def\end@rotfloat{%
   \par %close paragraph for tagging.
   \SuspendTagging{\minipage}% 
   \end{minipage}%
   \ResumeTagging{\minipage}%
   \end{lrbox}%
   \stepcounter{r@tfl@t}%
   \rot@label{RF\ther@tfl@t}%
   \rot@pageref{RF\ther@tfl@t}{\R@@page}%
   \edef\@tempa{Adding sideways \@captype\space on page \R@@page\space}
   \rot@mess@toks\expandafter{\@tempa}
   \wd\rot@float@box\z@
   \ht\rot@float@box\z@
   \dp\rot@float@box\z@
   \vbox to \textheight{%
    \setkeys{Grot}{units=360}%
    \if@rot@twoside
    \else
      \let\R@@page\rot@LR
    \fi
    \ifthenelse{\isodd{\R@@page}}{%
      \if@rot@twoside
        \rot@mess@toks\expandafter{\the\rot@mess@toks (right hand page)}%
      \fi
      \vfill
      \@@line{%
        \hskip\rotFPtop
        \rotatebox{90}{\box\rot@float@box}%
        \hskip\rotFPbot
      }%
    }{%
      \if@rot@twoside
        \rot@mess@toks\expandafter{\the\rot@mess@toks (left hand page)}%
      \fi
      \@@line{%
        \hskip\rotFPbot
        \rotatebox{-90}{\box\rot@float@box}%
        \hskip\rotFPtop
      }%
      \vfill
    }%
    \rot@message{\the\rot@mess@toks}
  }%
  \end@float
} 
\makeatother 
\begin{document}

\section{test}
\begin{sidewaystable}
\caption{bla}
\begin{tabular}{ll}
a & b
\end{tabular}
\end{sidewaystable}

\end{document}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: floats and captions currently incompatible package or class package or class that doesn't work with current version of tagging code
Projects
None yet
Development

No branches or pull requests

4 participants