Hi all,

To reproduce (with emacs -Q, latest AUCTeX), open this document:

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{bookmark}
\begin{document}
Let \(x\).
\end{document}
--8<---------------cut here---------------end--------------->8---

Disable TeX-PDF-mode, then run M-x preview-buffer.  The preview fails to
generate; in the output buffer, we see:

  dvips: Could not find figure file _region_.out.ps; continuing.

The issue seems to be that bookmark's bkm-dvips.def emits
\special{PSfile=\jobname.out.ps}, but because prauctex.def uses
\nofiles, that file is never created.  The attached patch suppresses
that \special{...} while preview is active.  Any feedback welcome.

Thanks, best,

Paul

>From cba5f2a35ad29f160ac603fc9bdc3e902b5da11b Mon Sep 17 00:00:00 2001
From: Paul Nelson <[email protected]>
Date: Fri, 29 May 2026 14:15:07 +0200
Subject: [PATCH] Fix DVI preview with bookmark package

* latex/preview.dtx (auctex): Suppress bookmark's missing
PostScript file reference under preview.
---
 latex/preview.dtx | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/latex/preview.dtx b/latex/preview.dtx
index cafb0363..9d639c27 100644
--- a/latex/preview.dtx
+++ b/latex/preview.dtx
@@ -1357,6 +1357,13 @@ Please complain to your document class author}%
 %    \begin{macrocode}
 %<auctex>\ifPreview\else\expandafter\endinput\fi
 %<auctex>\nofiles
+%    \end{macrocode}
+% The |bkm-dvips.def| file loaded by the |bookmark| package emits
+% |\special{PSfile=\jobname.out.ps}|, but preview's |\nofiles| prevents
+% that file from being written.  We suppress the missing file reference:
+%    \begin{macrocode}
+%<auctex>\@ifundefined{BKM@PSHeaderFile}{}{%
+%<auctex>  \let\BKM@PSHeaderFile\@gobble}
 %<auctex>\preview@delay{\nonstopmode}
 %    \end{macrocode}
 % Ok, here comes creative error message formatting.  It turns out a
-- 
2.50.1 (Apple Git-155)

_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to