TransWikia.com

auto-pst-pdf and pdfpages became incompatible?

TeX - LaTeX Asked on August 8, 2021

As I’m obviously ignorant with regard to some well-intended advices, I ran into a compilation error after updating my MiKTeX distribution after two or three months. I was able to track the error down to the following MNWE:

documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}

usepackage{auto-pst-pdf}
usepackage{pdfpages}

begin{document}

includepdf{example-image-a.pdf}

begin{figure}
    includegraphics{example-image-b.eps}
end{figure}

end{document}

Compiling using pdflatex --shell-escape mwe.tex will show compilation errors during the auto-pst-pdf stage. mwe-autopp.log reads somewhat like:

[...]
File: example-image-b.eps Graphic file (type eps)
<example-image-b.eps>
Preview: Tightpage -39321600 -39321600 39321600 39321600
! You can't use `prevdepth' in horizontal mode.
nointerlineskip ->prevdepth 
                              -@m p@ 
l.13    includegraphics{example-image-b.eps}
                                           
Sorry, but I'm not programmed to handle this case;
I'll just pretend that you didn't ask for it.
If you're in the wrong mode, you might be able to
return to the right one by typing `I}' or `I$' or `Ipar'.

! Missing $ inserted.
<inserted text> 
                $
l.13    includegraphics{example-image-b.eps}
[...]

Compilation will run fine when either the includepdf line or the figure environment are commented out, respectively. Could you please advice me on how to fix this one…? Thanks a lot!

/edit
In response to comments by @Marijn and @Ulrike Fischer:

You are right, my MNWE was not chosen very cleverly! As a matter of fact, I also need the chemnum package in my real-world example to replace strings within the eps file. This method does need the auto-pst-pdf package and the --shell-escape option for pdflatex as far as I know. Let me slightly expand the example from above:

documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{lmodern}

usepackage{auto-pst-pdf}
usepackage{pdfpages}

usepackage{chemnum}

begin{document}

includepdf{example-image-a.pdf}

begin{figure}
    replacecmpd[tag=benzene]{benzene}
    includegraphics{benzene.eps}
end{figure}

end{document}

I’ve put the contents of benzene.eps to Pastebin: click.

One Answer

miktex hasn't the newest eso-pic yet, it still use eso-pic 2020/09/27 v2.0i eso-pic.

The problem with this version is that it adds material starting with nointerlineskip in the shipout/before hook, and due to the changes in the shipout routine in LaTeX this gets into the preview code in horizontal mode and harms there.

__hook shipout/before ->nointerlineskip AtBeginShipoutUpperLeft {put (0,Le
nToUnit {ESO@yoffsetI }){ESO@HookIIIBG ESO@HookIBG ESO@HookIIBG global le
t ESO@HookIIBG @empty }}AtBeginShipoutUpperLeftForeground {put (0,LenToUni
t {ESO@yoffsetI }){ESO@HookIFG ESO@HookIIFG ESO@HookIIIFG global let ESO
@HookIIFG @empty }}PLS@AtBeginShipout __hook_next shipout/before 

nointerlineskip ->prevdepth -@m p@ 
! You can't use `prevdepth' in horizontal mode.

With a newer eso-pic the document compiles for me.

I opened an issue at the miktex issue tracker: https://github.com/MiKTeX/miktex-packaging/issues/211.

But be aware that preview and pst-pdf do some low-level shipout manipulations, and the changes in LaTeX affects them. For example preview is currently not compatible with hyperref: https://lists.gnu.org/archive/html/bug-auctex/2020-11/msg00000.html.

Correct answer by Ulrike Fischer on August 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP