Skip to content

M-x pdf-sync-forward-search misplaces arrow. #341

@YueRen

Description

@YueRen

I believe this may be a bug with pdf-tools, but feel free to close the issue if it is not.

Describe the bug
When using auctex in conjunction with pdf-tools, the command M-x pdf-sync-forward-search (used in M-x TeX-view bound to C-c C-v) places an arrow indicating in the pdf buffer the position where the point is in the tex buffer.

In the past, if the pdf is larger than the window, the arrow is still placed within the pdf buffer (or on the border, cannot remember clearly sry). Since a few days ago, the placement of the arrow starting ignoring the window boundaries. Instead, the arrow seems to be placed where the correct position would be, if the window boundaries would not exist, even if this is in the middle of another window.

Here a screenshot showing the arrow placement when the pdf fits the window:

Image

Here a screenshot showing the arrow placement when the pdf extends beyond the window:

Image

Here is the init.el used in the screenshots above:

(require 'package)
(setq package-archives '(("elpa" . "https://elpa.gnu.org/packages/")
                         ("melpa" . "https://melpa.org/packages/")
                         ("org" . "https://orgmode.org/elpa/")))
(package-initialize)
(unless package-archive-contents (package-refresh-contents))
(require 'use-package-ensure)
(setopt use-package-always-ensure t)

(use-package pdf-tools
  :mode "\\.pdf\\'"
  :init
  (pdf-loader-install))

(use-package tex
  :ensure auctex
  :mode
  ("\\.tex\\'" . latex-mode)
  :custom
  (TeX-view-program-selection '((output-pdf "PDF Tools")))
  (TeX-view-program-list '(("PDF Tools" TeX-pdf-tools-sync-view)))
  (TeX-source-correlate-mode t)
  (TeX-source-correlate-start-server t)
  :init
  (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer))

Here is mwe.tex:

\documentclass{article}
\usepackage{lipsum} % Provides the \lipsum command

\begin{document}

\section{Introduction}
\lipsum[1] % Generates the 1st paragraph of Lorem ipsum

\section{Main Content}
\lipsum[2-4] % Generates paragraphs 2 through 4

\end{document}

%%% Local Variables:
%%% mode: LaTeX
%%% TeX-master: t
%%% End:

Steps to Reproduce the behaviour

  1. Open mwe.tex
  2. Compile mwe.tex using C-c C-c (repeat if necessary)
  3. Run TeX-view via C-c C-v

Desktop
My laptop uses Ubuntu 25.10 and have Emacs installed via snap

GNU Emacs 30.2
Development version ff7d3f02b943 on master branch; build date 2025-12-17.
Copyright (C) 2025 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Your pdf-tools install
This is my pdf-tools version:

     Status: Installed in ‘pdf-tools-20260102.1101/’ (unsigned).
    Version: 20260102.1101
     Commit: e4b7f1f37cf59ddf025d609ffcdabe732a6e99ba
    Summary: Support library for PDF documents.
   Requires: emacs-26.3, tablist-1.0, let-alist-1.0.4
Required by: org-pdftools-20250714.1631
    Website: http://github.com/vedang/pdf-tools/
   Keywords: files multimedia 
     Author: Andreas Politz <mail@andreas-politz.de>
Other versions: 20260102.1101 (melpa).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions