Subject: 11.88.6; Preview fails on nested \include{} using \documentclass{sigplanconf}

From: Alex Rozenshteyn <[email-masked]>
Date: Mon, 8 Jun 2015 16:45:13 -0400

Attempting to run `preview-document` on a file using
\documentclass{sigplanconf} (found here:
http://www.sigplan.org/sites/default/files/sigplanconf.cls)
led me to discover the following unpleasant behavior:

Imagine the document structure is as follows:

---     main.tex ---

\documentclass{sigplanconf}
\begin{document}
\input{formalism}
\end{document}

--- end main.tex ---

---     formalism.tex ---

\input{formalism_atranslation}

--- end formalism.tex ---

---     formalism_atranslation.tex ---

\section{A-Normal Form}

--- end formalism_atranslation.tex ---

When I run `preview-document` in "main.tex" (or in others if `TeX-master`
is set correctly.) I get one of two errors. On occasion, Preview-PDF2DSC
fails:

-----------------
TeX Output exited as expected with code 1 at Mon Jun  8 16:09:46
Running `Preview-PDF2DSC' with ``pdf2dsc main.pdf
main.prv/tmp3331NDl/preview.dsc''
Error: /undefinedfilename in --file--
Operand stack:
   PDFfile   (main.pdf)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--
--nostringval--   2   %stopped_push   --nostringval--
--nostringval--   --nostringval--   false   1   %stopped_push   1910
1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3
%oparray_pop   1787   1   3   %oparray_pop   --nostringval--
%errorexec_pop   .runexec2   --nostringval--   --nostringval--
--nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1170/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 1822
GPL Ghostscript 9.06: Unrecoverable error, exit code 1

Preview-PDF2DSC exited abnormally with code 1 at Mon Jun  8 16:09:46
PDF2DSC sentinel: Opening input file: no such file or directory,
/tmp/baz/main.prv/tmp3331NDl/preview.dsc
---------------------

but more often, ghostscript fails with

--------------------
Preview-PDF2DSC finished at Mon Jun  8 16:10:16
Running `Preview-Ghostscript' with ``/usr/bin/gs
-dOutputFile\=\(main.prv/tmp3331aNr/pr1-\%d.png\) -q -dDELAYSAFER
-dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4
-dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r104.616x104.588''
Ghostscript filter: No bounding box
--------------------

I tried to replicate this with other filenames, but have not had success
using "foo.tex" and "bar.tex", so I decided to send the actual
filenames.
------------------------------------------------------------------------

Emacs  : GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2015-03-07 on trouble, modified by Debian
Package: 11.88.6

current state:
==============
(setq
 AUCTeX-date "2015-05-08"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex"
"/home/alex/.emacs.d/elpa/auctex-11.88.6/style"
                  "/home/alex/.emacs.d/auctex/auto"
"/home/alex/.emacs.d/auctex/style" "auto"
                  "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master "main"
 TeX-command-list '(("Rubber" "rubber -d %t" TeX-run-TeX nil (latex-mode))
                    ("TeX"
                     "%(PDF)%(tex) %(file-line-error) %(extraopts)
%`%S%(PDFout)%(mode)%' %t"
                     TeX-run-TeX nil (plain-tex-mode texinfo-mode
ams-tex-mode) :help
                     "Run plain TeX")
                    ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil
(latex-mode doctex-mode) :help
                     "Run LaTeX")
                    ("Makeinfo" "makeinfo %(extraopts) %t"
TeX-run-compile nil (texinfo-mode)
                     :help "Run Makeinfo with Info output")
                    ("Makeinfo HTML" "makeinfo %(extraopts) --html %t"
TeX-run-compile nil
                     (texinfo-mode) :help "Run Makeinfo with HTML output")
                    ("AmSTeX" "%(PDF)amstex %(extraopts)
%`%S%(PDFout)%(mode)%' %t" TeX-run-TeX
                     nil (ams-tex-mode) :help "Run AMSTeX")
                    ("ConTeXt" "texexec --once --texutil %(extraopts)
%(execopts)%t" TeX-run-TeX
                     nil (context-mode) :help "Run ConTeXt once")
                    ("ConTeXt Full" "texexec %(extraopts)
%(execopts)%t" TeX-run-TeX nil
                     (context-mode) :help "Run ConTeXt until completion")
                    ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help
"Run BibTeX")
                    ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
                    ("View" "%V" TeX-run-discard-or-function t t :help
"Run Viewer")
                    ("Print" "%p" TeX-run-command t t :help "Print the file")
                    ("Queue" "%q" TeX-run-background nil t :help "View
the printer queue"
                     :visible TeX-queue-command)
                    ("File" "%(o?)dvips %d -o %f " TeX-run-command t t :help
                     "Generate PostScript file")
                    ("Index" "makeindex %s" TeX-run-command nil t
:help "Create index file")
                    ("Xindy" "texindy %s" TeX-run-command nil t :help
                     "Run xindy to create index file")
                    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help
                     "Check LaTeX file for correctness")
                    ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil
(latex-mode) :help
                     "Check LaTeX file for common mistakes")
                    ("Spell" "(TeX-ispell-document \"\")"
TeX-run-function nil t :help
                     "Spell-check the document")
                    ("Clean" "TeX-clean" TeX-run-function nil t :help
                     "Delete generated intermediate files")
                    ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help
                     "Delete generated intermediate and output files")
                    ("Other" "" TeX-run-command t t :help "Run an
arbitrary command"))
 )