Problem description:
I am working on a small notebook and often find myself reading pdf's on half the screen, which is even smaller. Sometimes I would like to be able to zoom into a pdf a tiny bit more, which I can, but then the pdf gets left aligned and the text to the right is cut off. With a more common pdf reader I would simply scroll a little to the right. The whole text would be visible and everyting would be fine. For some reason scrolling to the right/left does not work for me in emacs. Please look at the image to understand my predicament more clearly:
I looked at the pdfview wiki and found that the key bindings:
C-f
C-b
or
C-x >
C-x <
should both do the trick. For some reason they do not scroll the pdf for me. I cross referenced the respective functions bound to the keys in emacs and found that they seem to be correctly bound to the keys. The functions are:
image-forward-hscroll
image-backward-hscroll
or
scroll-right
scroll-left
The key-bindings are part of the pdfview-mode-map, the image-mode-map and the doc-view-mode-map. I seem to be able to use the other bindings from the pdfview-mode-map.
I tried to fit the pdf to the buffer width with W (fit pdf to width) as a work around but this solution still does not zoom enough as it respects the white space beside the text.
Can someone give me a hint how to get the scrolling functions working?
Possibly helpful information:
I am on gnu Emacs 28.1.
The part of my config with pdf-tools:
;;////////////////////////PDF\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
(use-package pdf-tools
:pin manual ;; manually update
:config
;; initialise
(pdf-tools-install)
;; open pdfs scaled to fit page
(setq-default pdf-view-display-size 'fit-page)
;; automatically annotate highlights
(setq pdf-annot-activate-created-annotations t)
;; use normal isearch
(define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
;; turn off cua so copy works
(add-hook 'pdf-view-mode-hook (lambda () (cua-mode 0)))
;; more fine-grained zooming
(setq pdf-view-resize-factor 1.1)
;; keyboard shortcuts
(define-key pdf-view-mode-map (kbd "h") 'pdf-annot-add-highlight-markup-annotation)
(define-key pdf-view-mode-map (kbd "t") 'pdf-annot-add-text-annotation)
(define-key pdf-view-mode-map (kbd "D") 'pdf-annot-delete))
(use-package org-noter
:config
;; Your org-noter config ........
(require 'org-noter-pdftools))
(use-package org-pdftools
:hook (org-mode . org-pdftools-setup-link))
(use-package org-noter-pdftools
:after org-noter
:config
;; Add a function to ensure precise note is inserted
(defun org-noter-pdftools-insert-precise-note (&optional toggle-no-questions)
(interactive "P")
(org-noter--with-valid-session
(let ((org-noter-insert-note-no-questions (if toggle-no-questions
(not org-noter-insert-note-no-questions)
org-noter-insert-note-no-questions))
(org-pdftools-use-isearch-link t)
(org-pdftools-use-freestyle-annot t))
(org-noter-insert-note (org-noter--get-precise-info)))))
;; Set key for quick access to working environments
(global-set-key (kbd "C-d") 'desktop-change-dir)
;; fix https://github.com/weirdNox/org-noter/pull/93/commits/f8349ae7575e599f375de1be6be2d0d5de4e6cbf
(defun org-noter-set-start-location (&optional arg)
"When opening a session with this document, go to the current location.
With a prefix ARG, remove start location."
(interactive "P")
(org-noter--with-valid-session
(let ((inhibit-read-only t)
(ast (org-noter--parse-root))
(location (org-noter--doc-approx-location (when (called-interactively-p 'any) 'interactive))))
(with-current-buffer (org-noter--session-notes-buffer session)
(org-with-wide-buffer
(goto-char (org-element-property :begin ast))
(if arg
(org-entry-delete nil org-noter-property-note-location)
(org-entry-put nil org-noter-property-note-location
(org-noter--pretty-print-location location))))))))
(with-eval-after-load 'pdf-annot
(add-hook 'pdf-annot-activate-handler-functions #'org-noter-pdftools-jump-to-note)))
;; I installed pdf-tools, org-pdf-tools and org-noter manually
;; makes org-mode open pdf-links with pdfview
(add-to-list 'org-file-apps
'("\\.pdf\\'" . pdfview))
M-x
image-forward-hscroll
within the pdf-view buffer, it might also inform you about the actual keybinding. Otherwise, you could also doM-x
toggle-horizontal-scroll-bar
to scroll via the scroll-bar.