Org Mode LaTeX Live Preview Major Improvements
This commit is contained in:
parent
3fd2c3cc68
commit
67b7eb0ab7
43
config.org
43
config.org
|
|
@ -7,19 +7,25 @@ Welcome to my Emacs configuration!
|
||||||
[[./dashboard.png]]
|
[[./dashboard.png]]
|
||||||
|
|
||||||
This configuration is inspired by :
|
This configuration is inspired by :
|
||||||
https://github.com/munen/emacs.d
|
|
||||||
|
`https://github.com/munen/emacs.d`
|
||||||
|
|
||||||
And also loosely inspired by :
|
And also loosely inspired by :
|
||||||
|
|
||||||
https://github.com/daedreth/UncleDavesEmacs/blob/master/config.org
|
`https://github.com/daedreth/UncleDavesEmacs/blob/master/config.org`
|
||||||
|
|
||||||
With help from his fantastic Emacs tutorial series :
|
With help from his fantastic Emacs tutorial series :
|
||||||
|
|
||||||
https://www.youtube.com/playlist?list=PLX2044Ew-UVVv31a0-Qn3dA6Sd_-NyA1n
|
`https://www.youtube.com/playlist?list=PLX2044Ew-UVVv31a0-Qn3dA6Sd_-NyA1n`
|
||||||
|
|
||||||
This configuration is much more barebones and suited for someone just doing some writing or editing, which is exactly my use case. It does however copy over the useful functionalities (In my personal preference)
|
This configuration is much more barebones and suited for someone just
|
||||||
As this is a simple literate configuration, not a large actively maintained distribution like Spacemacs or Doom Emacs, feel free to do whatever you want with the configuration.
|
doing some writing or editing, which is exactly my use case. It does
|
||||||
I've tried to document what every package does, what the code does briefly for beginners to Emacs or literate configurations.
|
however copy over the useful functionalities (In my personal
|
||||||
|
preference) As this is a simple literate configuration, not a large
|
||||||
|
actively maintained distribution like Spacemacs or Doom Emacs, feel
|
||||||
|
free to do whatever you want with the configuration. I've tried to
|
||||||
|
document what every package does, what the code does briefly for
|
||||||
|
beginners to Emacs or literate configurations.
|
||||||
|
|
||||||
* Config
|
* Config
|
||||||
** Appearance
|
** Appearance
|
||||||
|
|
@ -255,29 +261,42 @@ Set Minor Mode as Global :
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** Org Mode
|
** Org Mode
|
||||||
*** Simple Org Mode Preview
|
*** Simple Org Mode Preview
|
||||||
These are a simple set of functions that will automatically refresh the other buffer, which presumably has the Org Mode PDF open.
|
These are a simple set of functions that will automatically refresh
|
||||||
This workflow expects you to have 2 window panes open, which can be in any orientation. The Org Mode File you are editing, and the PDF Document to view the changes you are making.
|
the other buffer, which presumably has the Org Mode PDF open. Once
|
||||||
Define functions and set keybindings:
|
using the keybindings to quickly export the file, another window will
|
||||||
|
pop up as a live preview (Which is just an automatically opened
|
||||||
|
preview of the exported PDF). Define functions and set keybindings:
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun open-pdf ()
|
||||||
|
(split-window-right)
|
||||||
|
(other-window 1)
|
||||||
|
(find-file (concat "/" (substring buffer-file-name 1 (- (length buffer-file-name) 4)) ".pdf"))
|
||||||
|
(revert-buffer nil t)
|
||||||
|
(other-window -1))
|
||||||
|
|
||||||
(defun update-other-buffer ()
|
(defun update-other-buffer ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(other-window 1)
|
(other-window 1)
|
||||||
(revert-buffer nil t)
|
(revert-buffer nil t)
|
||||||
(other-window -1))
|
(other-window -1))
|
||||||
|
|
||||||
|
(defun check-if-pdf-is-open ()
|
||||||
|
(setq openwindows (length (delete-dups (mapcar #'window-buffer (window-list)))))
|
||||||
|
(if (>= openwindows 2) (update-other-buffer) (open-pdf)))
|
||||||
|
|
||||||
(defun org-compile-beamer-and-update-other-buffer ()
|
(defun org-compile-beamer-and-update-other-buffer ()
|
||||||
"Has as a premise that it's run from an org-mode buffer and the
|
"Has as a premise that it's run from an org-mode buffer and the
|
||||||
other buffer already has the PDF open"
|
other buffer already has the PDF open"
|
||||||
(interactive)
|
(interactive)
|
||||||
(org-beamer-export-to-pdf)
|
(org-beamer-export-to-pdf)
|
||||||
(update-other-buffer))
|
(check-if-pdf-is-open))
|
||||||
|
|
||||||
(defun org-compile-latex-and-update-other-buffer ()
|
(defun org-compile-latex-and-update-other-buffer ()
|
||||||
"Has as a premise that it's run from an org-mode buffer and the
|
"Has as a premise that it's run from an org-mode buffer and the
|
||||||
other buffer already has the PDF open"
|
other buffer already has the PDF open"
|
||||||
(interactive)
|
(interactive)
|
||||||
(org-latex-export-to-pdf)
|
(org-latex-export-to-pdf)
|
||||||
(update-other-buffer))
|
(check-if-pdf-is-open))
|
||||||
|
|
||||||
(define-key org-mode-map (kbd "C-c rl") 'org-compile-latex-and-update-other-buffer)
|
(define-key org-mode-map (kbd "C-c rl") 'org-compile-latex-and-update-other-buffer)
|
||||||
(define-key org-mode-map (kbd "C-c rb") 'org-compile-beamer-and-update-other-buffer)
|
(define-key org-mode-map (kbd "C-c rb") 'org-compile-beamer-and-update-other-buffer)
|
||||||
|
|
@ -398,7 +417,7 @@ Install the package, enable it and ensure that it always is installed, and then
|
||||||
(use-package company
|
(use-package company
|
||||||
:ensure t
|
:ensure t
|
||||||
:init
|
:init
|
||||||
(company-mode))
|
(global-company-mode))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
***** Configuration
|
***** Configuration
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue