AndyClifton / accessibility

A CTAN-compliant version of the LaTeX `accessibility` package
37 stars 6 forks source link

Vertical alignment issue with tubular 'p' columns #44

Open rjw62 opened 4 years ago

rjw62 commented 4 years ago

When using accessibility.sty v.2.0.3 with the tagged option, there appears to be a problem with the vertical alignment of p columns in the tabular environment. The text in such columns is displaced downwards by about a line, relative to where is should be. MWE:

\documentclass{article}
\usepackage[tagged]{accessibility}

\begin{document}

\begin{tabular}{lp{15em}l}
Left Column & Paragraph Column & Left Column
\end{tabular}

\end{document}

In this example, the text "Left Column", "Paragraph Column" and "Left Column" should all share the same baseline. In reality though "Paragraph Column" is displaced downwards by about a line height. This issue does not arise if you remove the "tagged" option, or comment out the accessibility package line altogether.

I've had a play with commenting things out of the accessibility.sty file, and it seems that the ultimate cause is the \pdfliteral command within the start of the PDFMarkContent environment, which is called from \PDFTableCell, which in turn is executed after every ampersand inside tabular. Presumably there's something about the way that p columns are implemented that means \pdfliteral is upsetting the baseline of the row that the column sees.

AndyClifton commented 4 years ago

Thanks, @rjw62 . That’s an interesting one!

Could you give me the line number in accessibility.sty of the \pdfliteral call that you commented out?

rjw62 commented 4 years ago

It's the first one in the definition of PDFMarkContent, currently at line 424: https://github.com/AndyClifton/accessibility/blob/master/source/v2x/accessibility.sty#L424