# Using scrartcl with auto-pst-pdf, scrlayer-scrpage, chemnum and hyperref results in error

I'm trying to write a protocol for my Masters (similar to a Bachelors Thesis) which includes chemical formulae which I am attempting to number. My originally tried MWE was this one, it doesn't matter if the image is commented or not, it won't compile either way. I am using TeXMaker, and for compilation I currently use the quickbuild option "LaTeX + dvips + ps2pdf"

\documentclass[12pt,twoside,a4paper]{scrartcl}

\usepackage[dvipdfm]{graphicx}
\usepackage[crop=off,runs=2]{auto-pst-pdf}
\usepackage{psfrag}
\usepackage{chemnum}
\usepackage{hyperref}

\begin{document}
Hello World
%\begin{figure}
%\includegraphics[width=\textwidth]{PG01.eps}
%\replacecmpd[PG01]{Alkin-1}
%\replacecmpd[PG02]{Alkin-2}
%\end{figure}
\end{document}


Now it does work if I either

1. Comment out the hypperref package or
2. Change the Document-Type to "article" while still having hyperref enabled

Now the replacement of tags doesn't work either way, but I haven't really attempted to solve that yet, I at first would like my document to work before I tackle that problem.

Since I had other problems (Which I solved on Reddit)regarding the Koma-Scripts, I am using version 3.35, manually installed to MiKTex, but other than that, I am at a loss. Before starting to write I didn't really think about it and updated all my packages, before that my basic template ran without errors. The Error I get is the following:

Process started

' TeX output 2021.11.18:0829' -> MWE 2.ps

<C:/Users/User/AppData/Roaming/MiKTeX/2.9/dvips/base/tex.pro>

<C:/Users/User/AppData/Roaming/MiKTeX/2.9/dvips/psfrag/psfrag.pro>

<C:/Users/User/AppData/Roaming/MiKTeX/2.9/dvips/l3backend/l3backend-dvips.pro>

<C:/Users/User/AppData/Roaming/MiKTeX/2.9/dvips/base/texps.pro>

<C:/Users/User/AppData/Roaming/MiKTeX/2.9/dvips/base/special.pro>.

<C:/Users/User/AppData/Roaming/MiKTeX/2.9/fonts/type1/public/amsfonts/cm/cmr12.pfb>

[1<./PG01.eps>

dvips: Could not find figure file MWE 2; continuing. ]

Process exited with error(s)


And I simply don't know what to do anymore. I don't even know why it is trying to figure "MWE 2" which is the name of my file, and not the name of the Image (which would be PG01).

• Unrelated but you shouldn't use dvipdfm as driver option if you actually compile with dvips. Beside this: the preview package used by auto-pst-pdf is currently not compatible with a current latex. This has been reported but it is unclear if and when it will be fixed. Until then one has to remove various code from the hooks, e.g. for your document this should work (without the beamer specific code): tex.stackexchange.com/a/617267/2388. See also github.com/latex3/hyperref/issues/213. Nov 18 '21 at 8:10
• And you then should use pdflatex --shell-escape or auto-pst-pdf wouldn't make much sense. Nov 18 '21 at 8:14
• Thank you for the informations. I should have mentioned that I have --shell-escape enabled both for pdfLaTeX and LaTeX. I have inserted the code like this Pasebin but still get the same error. Have I done something wrong there? Nov 18 '21 at 8:30
• if you really simply use latex + dvips, then you don't need auto-pst-pdf and the preview patches and can remove both. Nov 18 '21 at 9:21
• that is psfrag. auto-pst-pdf is there to allow you to use pdflatex (and so e.g. to include also png or pdf graphics) instead of latex+dvips Nov 18 '21 at 9:25