4

Let's say our system-wide default paper size is A4, and we have an old 15-pages-long document (prepared using llncs class) which we don't completely understand at this moment (neither content-wise nor LaTeX-wise). In the preamble we see \usepackage{pst-node}. With or without this line the document runs smoothly through latex; the log shows no errors, warnings or reports about undefined or missing stuff. Still, comparing the PDF files from the two runs (with/without pstricks) by diffpdf results in visual differences everywhere and word differences as well as character differences nowhere.

As a minimal example, let's run

\documentclass[letterpaper]{llncs}
\pagestyle{empty}
\usepackage{pstricks}
\begin{document}
test
\end{document}

through latex followed by dvipdf -dALLOWPSTRANSPARENCY. The visual comparison of the results when pstricks is vs. is not used by diffpdf results in this:

comparison results

The two red bars on the left mark the changes. As these red bars are everywhere, this leaves us with no information whatsoever concerning whether pstricks is actually needed by the document.

  1. Why does simply including a drawing package but not actually drawing anything incur such global changes? Who is the culprit?

  2. How to check whether pstricks is needed or used (and if so, where or how) without manually inspecting 15 pages and trying to understand commands and contents we have little idea of? (This could be an endeavor of several hours till a week: the paper is a typical computer-science paper.)

8
  • 2
    If you remove pstricks, compile the document, and get no "Undefined control sequence" errors, then it's highly unlikely that you were actually using pstricks. Commented Sep 6, 2022 at 4:53
  • instead of latex and dvipdf simply run lualatex, then there should be no difference
    – user187802
    Commented Sep 6, 2022 at 7:36
  • @user187802 lualatex would use different fonts (latin modern OpenType rather than Computer Modern Type1) Commented Sep 6, 2022 at 7:41
  • Sure, but this is not the problem here ...
    – user187802
    Commented Sep 6, 2022 at 7:44
  • @user187802 In fact, after running lualatex on both files, there is a difference. (If you get different results, then, probably, your system-wide default could be letter.) In fact, commenting out pstricks, running lualatex mwe.tex, and then pdfinfo mwe.pdf, we get Page size: 595.276 x 841.89 pts (A4). The class option [letterpaper] has seemingly no effect!!!
    – user224332
    Commented Sep 6, 2022 at 14:14

2 Answers 2

5

A document that gives no error if you comment out the \usepackage is highly unlikely to be using pstricks in any essential way but...

\documentclass[letterpaper]{llncs}
\pagestyle{empty}
\showoutput
%\usepackage{pstricks}
\begin{document}
test
\end{document}

If you run this with and without pstricks the \showoutput box logging (a visual representation of the dvi generated) shows the following diff

369,372d178
< ..\special{header=pstricks.pro}
< ..\special{header=pst-algparser.pro}
< ..\special{header=pst-tools.pro}
< ..\special{header=pst-dots.pro}
374d179
< ..\special{papersize=614.295pt,794.96999pt}
380d184
< ....\special{color push gray 0}
382d185
< ....\special{color pop}
387,393d189
< ...\special{color push gray 0}
< ...\special{ps: /pssetRGBcolor /setrgbcolor load def /pssetCMYKcolor /setcmykco
< lo\ETC.}
< ...\special{ps:tx@Dict begin  gsave STV CP T /ps@rot 0 def grestore  end}
< ...\special{ps:tx@Dict begin  gsave STV CP T /ps@refangle 0.  def grestore  end
< }
< ...\special{ps:0.8 setlinewidth 0 setgray}
408d203
< ...\special{color push gray 0}
410d204
< ...\special{color pop}

So the dvi has a bunch of additional (dvips syntax) \specials.

If you use a different dvi driver these specials may be ignored or interpreted depending on the dvi driver used.

The first four header specials are including PostScript source, these are almost certainly ignored if not using dvips

The papersize special is setting the media size and will affect the media box in generated pdf if the dvi driver used supports that

The ps: specials are dvips syntax to inject literal PostScript code, and are probably ignored by other drivers

The other specials are related to color and may or may not be ignored depending on the dvi driver used, but are just setting black, so would not have a visible effect

2
1

As for the minimal document in question:

  • Changing the [letterpaper] class option to [a4paper] temporarily for the purpose of comparison does the trick: after the change, running diffpdf on the two results from latex followed by dvipdf -dALLOWPSTRANSPARENCY yields no differences in any of the three modes (visual, character, words).

  • Alternatively, dvips -t letter -Ppdf -q -f infile.dvi | gs -q -P- -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=%stderr -sOutputFile=outfile.pdf -sPAPERSIZE=letter -dALLOWPSTRANSPARENCY - produces the PDF file with the [letterpaper] class option. Do it once for each infile.dvi (one generated with pstricks, another without) and compare the resulting PDF file.

As for the real, 15-page-long non-minimal document (which we have not provided the reader with), we still see differences everywhere regardless of whether we use the [a4paper] class option or try to generate the letter PDF file. (This is, however, beyond the scope of the question as it is stands now.) It turned out that \usepackage{color} was the culprit: this package turned out to be unnecessary for the document, and not including it made the differences in using vs. not using pstricks go away.

2
  • I can't see how this answer can be right, pstricks includes xcolor Commented Sep 6, 2022 at 17:43
  • @DavidCarlisle The observation is: we have \usepackage{color}\usepackage{pst-node} in the preamble of a non-minimal, 15-page-long document; dropping both packages yields a PDF file which diffpdf cannot distinguish from the original and from the output produced with \usepackage{pst-node} but without \usepackage{color}. I don't know why.
    – user224332
    Commented Sep 6, 2022 at 19:10

You must log in to answer this question.