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

math content in `picture` environment is lost #661

Open mbertucci47 opened 3 weeks ago

mbertucci47 commented 3 weeks ago

With math tagging loaded, any math content in a picture environment is lost.

\DocumentMetadata
  {
    lang=en-US,
    pdfversion=2.0,
    pdfstandard=ua-2,
    testphase={phase-III,title,math,table,firstaid}
  }
\documentclass{article}
\begin{document}
\begin{picture}[alt=a test picture](5,5)
text$x$
\end{picture}
\end{document}

I first noticed this in the feynmf/feynmp example in #659.

davidcarlisle commented 3 weeks ago

The input should probably be \put(0,0){text$x$} (although the math still vanishes) text at the top level in a picture mode doesn't generate an error for historical reasons, but doesn't really do anything sensible)

mbertucci47 commented 3 weeks ago

@davidcarlisle You're right, I was just trying to make the example as minimal as possible

davidcarlisle commented 3 weeks ago

@mbertucci47 sure no problem but then I wondered if that was part of the issue (but it isn't) (@josephwright will have a look...)

josephwright commented 3 weeks ago

Ah, tagging is not active inside pictures: likely one for @u-fischer

josephwright commented 3 weeks ago
~....\tag_socket_use:nn #1#2->\bool_if:NT \l__tag_active_socket_bool {\UseSocke
t {tagsupport/#1}{#2}}
#1<-math/inline/formula/begin
#2<-x

~.....\bool_if:NT #1->\if_bool:N #1\__prg_T_true:w \fi: \use_none:n 
#1<-\l__tag_active_socket_bool 
{\ifodd: (level 1) entered on line 11}
{false}
{\fi: \ifodd (level 1) entered on line 11}

~......\use_none:n #1->
#1<-\UseSocket {tagsupport/math/inline/formula/begin}{x}
{math shift character $}
josephwright commented 3 weeks ago

I guess we need to reset tagging status at the start of any boxes in picture mode.

u-fischer commented 3 weeks ago

it is not only picture mode. Math disappears always if tagging is suspended:

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

xxx \SuspendTagging{test} $a=b$ \ResumeTagging{test} aaaa

\end{document}

image

davidcarlisle commented 3 weeks ago

@josephwright

I guess we need to reset tagging status at the start of any boxes in picture mode.

That's not clear: the outer picture env has [alt=a test picture] so I thought from a tagging perspective it ends there and is just a black box after that with the alt text filling in.

Don't we need to revert the math grabbing to normal if tagging is suspended?

josephwright commented 3 weeks ago

Don't we need to revert the math grabbing to normal if tagging is suspended?

We need to use the 'measuring/fake math/empty math' path at the end of grabbing - @u-fischer is on it :)

u-fischer commented 3 weeks ago

@josephwright but before I work on it I have to listen to an interesting talk

car222222 commented 3 weeks ago

Are there not some larger questions here?

Concerning the tagging of the content of diagrams (as opposed to "pictures" in the non-technical sense: e.g. photos or paintings); Because such diagrams typically consist of many structural components, including for example: "text" of various types; very specific, often named, substructures (that are part of the semantics of the diagram); Noting that the semantic relationships between these substructures are distinct from, and more important than, any visual relationships.

At some stage, these will be coded by largely semantic markup (plus possibly some essential visual/layout hints).