For auctex with pdftools it is convenient for me (eyesight problems) to have the emacs latex frame on my laptop close to my eyes, and the corresponding pdf (in pdftools) on a separate frame on the dual monitor. How can this be implemented? i.e., emacs latex source in one frame and corresponding pdftools pdf in a separate frame. (Typically latex and pdftools exist in the same frame with two different buffers e.g. with C-x 2; but I want two different frames so that I can drag these frames independently to different monitors)
1 Answer
This is a variation of the question about preview the pdf in a split buffer beside the source.
You can use the following Elisp code in your init file.
If you do not have already two frames. The pdf view will open in a window beside the window with the LaTeX source. Select that window and type C-x 5 2 for make-frame-command
. There will be a new frame showing the pdf. You can delete the original window showing the pdf now. If you call TeX-View
the window in the other frame is used.
(defun framesMenus-display-buffer-use-some-frame (fun &rest args)
"Use `display-buffer-use-some-frame' as `display-buffer-overriding-action'.
Then run FUN with ARGS."
(let ((display-buffer-overriding-action '(display-buffer-use-some-frame)))
(apply fun args)))
(advice-add 'TeX-pdf-tools-sync-view :around #'framesMenus-display-buffer-use-some-frame)
(advice-add 'pdf-sync-backward-search-mouse :around #'framesMenus-display-buffer-use-some-frame)
-
Thanks. Forward search works fine: latex frame points to new pdf frame. But reverse search, splits the pdf frame into two buffers and shows the latex source in the same frame as the pdf. More generally: Is it possible to split latex source frame into two buffers and pdf frame into 2 buffers; where top latex buffer talks to top pdf buffer in separate frame, and bottom latex buffer talks to bottom pdf buffer in separate frame. I know you answered related question for 4 buffers in 1 frame; but because of eyesight problems I need separate frames.– VikramFeb 10, 2020 at 16:20
-
Also inverse search should work now. The splitting into two windows per buffer is another question. Maybe, putting the LaTeX-buffer of tex document 1 together with the pdf view of tex document 2 into one frame and document 2 together with pdf view of document 1 into another frame works.– TobiasFeb 10, 2020 at 20:41
-
@Vikram Maybe, the setup I described in my last comment is not appropriate for you since the second monitor is further away than your laptop display. ... As I already mentioned. That problem is a separate question.– TobiasFeb 10, 2020 at 21:14
-
Thanks Tobias - it now works perfectly! I'll put the related question (two latex buffers in one frame and two pdf buffers in another frame) as a separate question.– VikramFeb 10, 2020 at 21:59