3

The concurrent use of amsmath and pdfx results

enter image description here

On the other hand, if I comment out either pdfx or amsmath, the dot is positioned correctly:

enter image description here

What causes this glitch? The document class and the compiler have no effect on it.

MWE:

\documentclass{report}

\usepackage[a-1b]{pdfx} % generate PDF/A-compliant document
\usepackage{amsmath}

\begin{document}

\begin{equation}
   \dot{A} \geq 0
\end{equation}

\end{document}

PS: I know that amsmath is not needed for the equation environment; that was just an example, in my real document, I use the align environment.

  • This is basically a shot in the dark, although I've looked at the source code for amsmath. amsmath does different things with \dot depending on whether or not it is defined. Try inserting this before \usepackage{amsmath}: \let\dot\undefined. Not tested and not guaranteed. – barbara beeton Sep 25 '19 at 16:26
  • This returns errors from amsmath.sty, e.g. Paragraph ended before \@tempb was complete. \noindent\ignorespaces##1\par and Too many }'s. }. – Zoltán Csáti Sep 26 '19 at 8:25
2

Try the patch given here and let me know how well it works. I'll be adding it to the coding for pdfx v1.6.4 .

| improve this answer | |
  • Thanks, it gives visually identical results both with amsmath enabled and disabled. – Zoltán Csáti Sep 26 '19 at 8:46
  • Unfortunately, if you do \showoutput as below, then you will find that the letter A is included twice: once before and once after the accent character. Thus text-extraction gets it twice too. I've come to the conclusion that this kind of patch just isn't good enough. So we must use an /ActualText replacement instead. – Ross Moore Sep 28 '19 at 0:26
3

If I add \showoutput, the relevant part for \dot{A} is

....\hbox(9.20636+0.0)x7.50002, shifted 168.75, display
.....\OML/cmm/m/it/10 A
.....\hbox(0.0+0.0)x-7.50002
......\kern -7.50002
.....\vbox(9.20636+0.0)x7.50002
......\hbox(6.67859+0.0)x0.0, shifted 2.36111
.......\OT1/cmr/m/n/10 _
......\kern-4.30554
......\hbox(6.83331+0.0)x7.50002
....\penalty 0

Without pdfx, I get

...\hbox(9.20636+0.0)x7.50002, shifted 168.75, display
....\vbox(9.20636+0.0)x7.50002
.....\hbox(6.67859+0.0)x0.0, shifted 3.75005
......\OT1/cmr/m/n/10 _
.....\kern-4.30554
.....\hbox(6.83331+0.0)x7.50002
......\OML/cmm/m/it/10 A
...\penalty 0

The macro \dot is defined in terms of \mathaccentV, which is

> \mathaccentV=macro:
#1#2#3#4#5->\ifmmode \gdef \macc@tmp {\macc@depth \@ne }\setbox \z@ \hbox {\let
 \mathaccentV \macc@test \let \use@mathgroup \@gobbletwo \let \select@group \@g
obblethree \frozen@everymath {}$#5$}\macc@tmp \ifnum \macc@depth =\@ne \global 
\let \macc@nucleus \@empty \mathaccent "\accentclass@ \else \@xp \macc@nested \
fi #2#3#4{#5}\macc@nucleus \else \@xp \nonmatherr@ \csname #1\endcsname \fi .

The package pdfx changes it to

> \mathaccentV=macro:
#1#2#3#4#5->#5{\mathsurround =\z@ \relax \everymath {}\mathchoice {\setbox \z@ 
\hbox {$\displaystyle #5$}\kern -\wd \z@ }{\setbox \z@ \hbox {$\textstyle #5$}\
kern -\wd \z@ }{\setbox \z@ \hbox {$\scriptstyle #5$}\kern -\wd \z@ }{\setbox \
z@ \hbox {$\scriptscriptstyle #5$}\kern -\wd \z@ }}\AMS@mathaccentV {#1}{#2}{#3
}{#4}{\phantom {#5}}.

This explains the difference in the outputs shown above: normally, the accent is typeset first and uses the \mathaccent features, which include looking at the \skewchar of the font, for properly placing the accent on slanted letters. With pdfx the accentee is typeset in a box and later the accent is placed above it; this loses all information about correct placement and TeX centers the accent over the box.

Why is pdfx doing so I don't know. But there's no workaround except resetting \mathaccentV to the default, which might result in a noncompliant PDF.

| improve this answer | |
  • Text extraction, using Unicode combining accents, requires the accent character to come after the base. You cannot satisfy sensible Accessibility or Archivability requirements without this. – Ross Moore Sep 25 '19 at 23:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.