1

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 `I\par'.

! 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.

6
  • Remove \usepackage{auto-pst-pdf}, the conversion of eps to pdf is automatic (shell-escape is also not needed).
    – Marijn
    Dec 1, 2020 at 20:46
  • (note that this wouldn't work with example-image-b.eps because that is located in a system folder where a converted pdf cannot be written, but it should work with a normal eps located in the folder of your .tex document)
    – Marijn
    Dec 1, 2020 at 20:48
  • while I quite agree that auto-pst-pdf is not needed here, did you update everything? The prevdepth error could indicate older files somewhere. Dec 1, 2020 at 20:56
  • Thank you for your comments, Marijn and Ulrike Fischer! I think I need auto-pst-pdf and --shell-escape as my real world example also requires the chemnum package. I've updated the initial question to better reflect this situation. I also made sure that MiKTeX is up-to-date both within user and administrator mode.
    – tstone-1
    Dec 1, 2020 at 21:06
  • Sorry, I do not get any error message with your second example. (My TeX installation might not be the most recent one, but at least chemnum, auto-pst-pdf and pdfpages are up-to-date.) Dec 2, 2020 at 0:03

1 Answer 1

3

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.

3
  • My biggest thanks, @Ulrike Fischer! Could you please just briefly comment on where preview is invoked? After the MiKTeX repository will be updated to deliver the newer eso-pic version: If I get you right, I will also need to apply some code from bug#44578 to fix another incompatibility between preview and hyperref, right? The way I need to compile my ~ 400 pages document lead to compilation errors every few months when I updated my distribution. It's a pity one can't install 'MiKTeX as of 09/20' to get a functioning distribution... Consistency across machines is also hard to achieve.
    – tstone-1
    Dec 2, 2020 at 13:50
  • 1
    auto-pst-pdf loads pst-pdf which loads preview (and does itself some changes). And if you use hyperref you probably will need the code I suggest in the bug report. (But I don't know if it fix everything, it is quite possible that more problems are lurking somewhere. preview/pst-pdf is quite complicated). Dec 2, 2020 at 13:54
  • For reasons unrelated to this question, I reinstalled Windows 10 and set up my MiKTeX. The package manager now lists eso-pic 3.0a as installed. However, when running pdflatex --shell-escape mwe.tex on my example which includes benzene.eps, I still get errors in mwe-autopp.log, see here (somewhere around line 465). hyperref is not involved in this case, so I guess there is another incompatibility somewhere? Do you have another suggestion, shall I open another question regarding this one? Thank you.
    – tstone-1
    Dec 6, 2020 at 18:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .