latex3 / tagpdf

Tagging support code for LaTeX
60 stars 7 forks source link

add extra mc elements in structure element in lua mode #21

Closed AlexandrKozlovskiy closed 4 years ago

AlexandrKozlovskiy commented 4 years ago

This issue about problem,about which i wrote to you in one of the last e-mails to you. I want to do automatic tagging of paragraphs and formulas. For paragraphs i use \everypar command. In document,which you will find in attachment to this issue,we have structure tree: root  Document   P    mcid 0    mcid 2   P    mcid 1   P    mcid 3 But i expected and have in pdflatex: root Document P mcid 0 P mcid 1 P mcid 2 Ok,it want,what i have mcid 3,but i understand,that i will have only three mc elements,because for text at the same line before or after formula not called \everypar command. As i wrote,Problem happends only in lua mode and only in equation of amsmath package and,may be,equation environment,and only if before and/or after this environment we have some text at the same line. Using debug i understood,that all mc nodes,including strange nodes,inserted when script get page (file tagpdf.lua line 363). Yes,may be it should work with struct and mc elements outsite equation environment,but in my opinion this bug should be fixed,if it possible to do it. Thanks.

issue_of_tagpdf_package_in_lua_mode.txt

u-fischer commented 4 years ago

An equation doesn't start a new paragraph and the end of the equation neither. test, the equation and the next test is one paragraph from the point of TeX. If you want a new paragraph after the equation you will have to insert an empty line or call \par.

AlexandrKozlovskiy commented 4 years ago

I simplified my test,to show problem. When we override some environments,for example equation,we must close paragraph,if it was opened,for example if we using \everypar command,so in my test i close mc and structure tag inside equation,to model situation,if paragraph was opened. If i compile document in lua mode,i get structure tree: root Document P mcid 0 mcid 2 P mcid 1 But i expect to get structure tree: root Document P mcid 0 P mcid 1 I get this structure tree,if i compile my document in pdflatex or in generic mode with lualatex. Yes,usualy people not close opened mc or structures inside some environments,but i want to override some environments,so i need in closing of mc and structure elements only inside environments,which i want override. Thanks. issue_mc.txt

u-fischer commented 4 years ago

I don't know which structure you actually want to produce, but you must at least start a new mc after the equation:

      \end{equation*}\tagmcbegin{tag=P}Text after equation.

For pdflatex (which needs then also a \tagmcend) this is needed to get them marked at all.

For luatex this is needed to get the order right: if you don't start a new mc, the text will be part of the mc started before the equation (this is not a bug, it is documentated that the attributes set in luatex obey tex groups and this can have a side effect on the order).

AlexandrKozlovskiy commented 4 years ago

no_issue_mc.txt I not understood,why if i dont start new mc the text will be part of the mc started before the equation,because i closed mc after equation. Why in my structure tree in lua mode automatic create aditional mc with id 2? If i close previous mc and structure and at first open structure and mc and use \begin{equation,i haven't this problem even if i haven't some text (file no_issue.txt),but if i close previous structure in equation environment,i have this problem.