latex3 / tagpdf

Tagging support code for LaTeX
59 stars 7 forks source link

Ignored leftmargin by verbatim contents after first line if nested in a list item #79

Closed jfbu closed 8 months ago

jfbu commented 1 year ago
\DocumentMetadata{testphase={phase-III}}
\documentclass{article}
\begin{document}
\begin{itemize}
\item
\begin{verbatim}
    \MTactiveasterisk
    \MTprimedoesskip
\end{verbatim}
\item Test
\begin{verbatim}
    \MTactiveasterisk
    \MTprimedoesskip
\end{verbatim}
\end{itemize}
OK if out of list item:
\begin{verbatim}
    \MTactiveasterisk
    \MTprimedoesskip
\end{verbatim}
\end{document}

produces

Capture d’écran 2023-05-16 à 11 08 14

test_tagging_verbatim2.log

jfbu commented 1 year ago

Sorry my initial title was wrong as one shows with output without activated tagging: Capture d’écran 2023-05-16 à 11 07 11

Update: perhaps my title is off the mark as it may rather be list leftmargin which is not obeyed rather than spaces from source. I did not look more closely.

jfbu commented 1 year ago

I edited the title to better match the problem:

\DocumentMetadata{testphase={phase-III}}
\documentclass{article}
\begin{document}
\begin{itemize}
\item
\begin{verbatim}
    \MTactiveasterisk
    \MTprimedoesskip
\end{verbatim}
\item Text
\begin{verbatim}
    \MTactiveasterisk
    \MTprimedoesskip
\end{verbatim}
\item Some sub list
  \begin{itemize}
  \item Some text before verbatim
\begin{verbatim}
\MTactiveasterisk
\MTprimedoesskip
  \MTprimedoesskip
    \MTprimedoesskip
\end{verbatim}
  \end{itemize}
\end{itemize}
OK if out of list item:
\begin{verbatim}
    \MTactiveasterisk
    \MTprimedoesskip
\end{verbatim}
\end{document}
% https://github.com/u-fischer/tagpdf/issues/79

Capture d’écran 2023-05-16 à 11 25 42

FrankMittelbach commented 1 year ago

LaTeX2e used a trivlist for verbatim and inside changed \leftskip to mimic the outer indentation. We now do not used a list anymore but this means that we need to preserve any \parshape setting from an outer list (which the code failed to do). This has been corrected in latex-lab.

jfbu commented 1 year ago

Will vertical spacing relative to surrounding context be faithfully obeyed by the new code not using a list?

FrankMittelbach commented 1 year ago

Will vertical spacing relative to surrounding context be faithfully obeyed by the new code not using a list?

define faithfully :-) yes it should that was the plan. It is implemented as a displayblock template which handles the vertical spacing to be (by default) th same as in other display blocks, eg lists or quote etc. By using its own instance, however, a class file can decide to use special spacing around the verbatim different from, say, quote or lists which gives more choices than with the 2e implementation, but by default it should come out as before.

jfbu commented 1 year ago

ok since I discovered latex2e/required/latex-lab and the magic incantation l3build doc so I have some reading to do...