latex3 / tagging-project

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

rotating package incompatibility #112

Open mbertucci47 opened 1 month ago

mbertucci47 commented 1 month ago

The rotating package is not yet fully compatible with the tagging code (expected, of course). Content in the sideways, turn, and rotate environments and \turnbox command does not show in the structure tree.

Also, the sidewaysfigure and sidewaystable environments are tagged differently than figure and table. I don't know enough to say if the tagging is correct.

Example that shows the issues:

\DocumentMetadata
  {
    lang=en-US,
    pdfversion=2.0,
    pdfstandard=ua-2,
    testphase={phase-III,math,title,table,firstaid}
  }
\documentclass{article}
\usepackage{rotating}

\title{rotating tagging test}

\begin{document}
Normal text

\begin{sideways}
sideways text
\end{sideways}

\begin{sidewaysfigure}
\centering
\includegraphics[alt={example image a}]{example-image-a}
\caption{Some caption text}
\end{sidewaysfigure}

\begin{figure}
\centering
\includegraphics[alt={example image b}]{example-image-b}
\caption{More caption text}
\end{figure}

\end{document}
u-fischer commented 1 month ago

Generally: when handling boxes then it can matter if you are inside a paragraph, and it can also matter if you use lualatex or pdflatex (the mysteries of attributes ...). As an example:

\DocumentMetadata
  {
    lang=en-US,
    pdfversion=2.0,
    pdfstandard=ua-2,
    testphase={phase-III,math,title,table,firstaid}
  }
\documentclass{article}
\usepackage{rotating}

\title{rotating tagging test}

\begin{document}
Normal text

\begin{sideways}
sideways text A
\end{sideways}

\leavevmode \begin{sideways}
sideways text B
\end{sideways}
\end{document}

pdflatex tagging

image

lualatex tagging

image

mbertucci47 commented 1 month ago

Thanks for the info. Is adding \leavevmode something that should be left to the user or handled by a future version of the package?

u-fischer commented 1 month ago

I'm not claiming that \leavevmode is the correct fix - probably sideways should also work in vmode. I only wanted to point out, that one has to look at both cases.

FrankMittelbach commented 1 month ago

probably sideways should also work in vmod

it is like other floats so it should work in the same way, i.e., in vmode (the usual) case, but also in hmode (by migrating out, which it might not do)

u-fischer commented 1 month ago

@FrankMittelbach

it is like other floats so it should work in the same way

sideways is not a float (that is sidewaysfigure), it is simply a turned hbox:

\def\sideways{%
  \Grot@setangle{90}%
  \setbox\z@\color@hbox\ignorespaces}
\def\endsideways{%
  \unskip\color@endbox
  \Grot@x\z@
  \Grot@y\z@
  \Grot@box
}

and internally \Grot@box issues a \leavevmode, so it probably wouldn't harm if that is added before the \setbox? @davidcarlisle

FrankMittelbach commented 1 month ago

Ah right my bad