adsphd icon indicating copy to clipboard operation
adsphd copied to clipboard

Incompatibility with pstool

Open mkatliar opened this issue 6 years ago • 1 comments

The adsphd document class and pstool package are incompatible with each other. Example:

% Change the following line to \documentclass{article} to make it work
\documentclass[faculty=firw,department=cws,phddegree=cws]{adsphd}

\usepackage{siunitx}
\usepackage{pstool}

\begin{document}
	\begin{figure}
		\psfragfig[width=0.95\textwidth]{test-pstool-fig}
		\caption{Created with \texttt{pstool}.}
	\end{figure} 
\end{document}

test-pstool.zip

The pstool documentation says:

Processing pdfLATEX documents with pstool requires the ‘shell escape’ feature
of pdfTEX to be activated.
...
On the command line, use the -shell-escape switch. Otherwise, you’re on your own.

Compile the example above with the following command

pdflatex -shell-escape test-pstool.tex

This results in the following .pdf output: result-adsphs.pdf

Instead of a figure, a box with the following text in red appears: image

An error occured processing graphic:
‘./test-pstool-fig.eps’
Check the log file for compilation errors:
‘./test-pstool-fig-pstool.log’

Here is the .log file: test-pstool-fig-pstool.log. I don't see any errors in it.

If the document class is changed to article, a correct output is produced: image result-article.pdf

Compiling without the -shell-escape option produces an output with incorrect text labels: image result-adsphd-no-shell-escape.pdf

NOTE: To consistently reproduce the results above, clean intermediate files after each build!

mkatliar avatar May 24 '19 18:05 mkatliar

Commenting out this line makes the issue disappear. I cannot understand however, how a line of an else-branch which doesn't get executed can affect the result. With the following code

\ifpdf
  \typeout{Using pdf: yes}
  % Load the crop package
  \ifadsphd@epub\else
  \RequirePackage[center,pdftex]{crop}
  \fi
  \RequirePackage[pdftex]{graphicx}
  \DeclareGraphicsExtensions{.pdf, .jpg, .tif, .png}
  % Use utf-8 encoding for foreign characters
    \ifPDFTeX
      \RequirePackage[utf8]{inputenc}
    \fi
\else
  \typeout{Using pdf: no}
  % Load the crop package
  % Commenting out the following line fixes the issue.
  % However I cannot understand, how a line in an if-branch which is not executed can affect the compilation result.
  % \RequirePackage[center,dvips]{crop} % Option [a3] already passed
  \RequirePackage[dvips]{graphicx}
  \DeclareGraphicsExtensions{.eps, .ps}
\fi

the result changes depending on whether the \RequirePackage[center,dvips]{crop} line is commented or not. However, "Using pdf: yes" is printed and "Using pdf: no" is never printed.

Command line:

pdflatex -shell-escape -file-line-error test-pstool | grep "Using pdf"

mkatliar avatar May 25 '19 12:05 mkatliar