When hitting C-c C-a to display a PDF, the buffer opens automatically below the TeX source code. How can I force it to open on the right side?

I am currently using shackle to manually control the location of buffers, but the line below does not work (this shackle setup has been tested with other buffers):

(use-package shackle
  :ensure t
  (shackle-rules '(("^.*\\.pdf$" :regexp t :align 'right :size 0.25 :select t)
  (shackle-default-rule nil)

(shackle-mode 1)

Surprisingly, I am able to control the relative size of the buffer (:size) as long as I specify :align `below (which also indicates the regular expression is being correctly matched).

Is this perhaps related to the TeX-view function?

  • if you are using latex-preview-pane-mode, the window is split verticaly.
    – gigiair
    Apr 24, 2022 at 6:44

1 Answer 1


I ended up finding the answer to my own question.

The package shackle fiddles with pop-buffer, which in turn is used by TeX-pdf-tools-sync-view, one of the functions being called when running AucTex's TeX-command-run-all (bind to C-c C-a). By avoiding shackle altogether for *.pdf buffers one can modify the standard splitting behaviour of pop-buffer as follows (as described here):

   split-width-threshold 80
   split-height-threshold nil)

To further control the width of the output buffer one can extend TeX-command-run-all (inspired by this):

(defun reduce-this-window-width ()
  "Reduce current window based on the the width of the other window."
  (shrink-window-horizontally (/ (window-width (next-window)) 5)))

(defun my-TeX-command-run-all (arg)
  (interactive "P")
  (TeX-command-run-all arg)

(add-hook 'LaTeX-mode-hook
          (lambda () (local-set-key (kbd "C-c C-a") #'my-TeX-command-run-all)))

where pdf-view-auto-slice-minor-mode and pdf-view-fit-width-to-window can be used to, respectively, slice the margins and fit the *.pdf to the buffer width. The value 5 can be tuned according to personal preference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.