use-package auctex

This commit is contained in:
larstvei 2023-06-11 21:48:42 +02:00
parent 9521ff0240
commit 89426bfbe5

139
init.org
View File

@ -206,8 +206,7 @@
(let* ((package--builtins nil) (let* ((package--builtins nil)
(packages (packages
'(auctex ; Integrated environment for *TeX* '(chatgpt-shell ; Interaction mode for ChatGPT
chatgpt-shell ; Interaction mode for ChatGPT
cider ; Clojure Interactive Development Environment cider ; Clojure Interactive Development Environment
clj-refactor ; Commands for refactoring Clojure code clj-refactor ; Commands for refactoring Clojure code
company ; Modular text completion framework company ; Modular text completion framework
@ -1287,97 +1286,75 @@
#+end_src #+end_src
** LaTeX and org-mode LaTeX export ** LaTeX
=.tex=-files should be associated with =latex-mode= instead of =tex-mode=.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-to-list 'auto-mode-alist '("\\.tex\\'" . latex-mode)) ;; Integrated environment for *TeX*
(use-package auctex
:ensure t
:defer t)
#+end_src #+end_src
Use [[http://mg.readthedocs.io/latexmk.html][latexmk]] for compilation by default. * Org-mode LaTeX export
#+begin_src emacs-lisp I like using the [[https://code.google.com/p/minted/][Minted]] package for source blocks in LaTeX. To make org use
this we add the following snippet.
(add-hook 'LaTeX-mode-hook #+begin_src emacs-lisp
(lambda ()
(add-hook 'hack-local-variables-hook
(lambda ()
(setq-local compile-command
(concat "latexmk -pdf -pvc "
(if (eq TeX-master t)
(file-name-base (buffer-name))
TeX-master))))
t t)))
#+end_src (eval-after-load 'org
'(add-to-list 'org-latex-packages-alist '("" "minted")))
(setq org-latex-listings 'minted)
Use ~biblatex~ for bibliography. #+end_src
#+begin_src emacs-lisp Because [[https://code.google.com/p/minted/][Minted]] uses [[http://pygments.org][Pygments]] (an external process), we must add the
=-shell-escape= option to the =org-latex-pdf-process= commands. The
=tex-compile-commands= variable controls the default compile command for Tex-
and LaTeX-mode, we can add the flag with a rather dirty statement (if anyone
finds a nicer way to do this, please let me know).
(setq-default bibtex-dialect 'biblatex) #+begin_src emacs-lisp
#+end_src (eval-after-load 'tex-mode
'(setcar (cdr (cddaar tex-compile-commands)) " -shell-escape "))
I like using the [[https://code.google.com/p/minted/][Minted]] package for source blocks in LaTeX. To make org use #+end_src
this we add the following snippet.
#+begin_src emacs-lisp When exporting from Org to LaTeX, use ~latexmk~ for compilation.
(eval-after-load 'org #+begin_src emacs-lisp
'(add-to-list 'org-latex-packages-alist '("" "minted")))
(setq org-latex-listings 'minted)
#+end_src (eval-after-load 'ox-latex
'(setq org-latex-pdf-process
'("latexmk -pdflatex='xelatex -shell-escape -interaction nonstopmode' -pdf -f %f")))
Because [[https://code.google.com/p/minted/][Minted]] uses [[http://pygments.org][Pygments]] (an external process), we must add the #+end_src
=-shell-escape= option to the =org-latex-pdf-process= commands. The
=tex-compile-commands= variable controls the default compile command for
Tex- and LaTeX-mode, we can add the flag with a rather dirty statement (if
anyone finds a nicer way to do this, please let me know).
#+begin_src emacs-lisp For my thesis, I need to use our university's LaTeX class, this snippet makes
that class available.
(eval-after-load 'tex-mode #+begin_src emacs-lisp
'(setcar (cdr (cddaar tex-compile-commands)) " -shell-escape "))
#+end_src (eval-after-load "ox-latex"
'(progn
When exporting from Org to LaTeX, use ~latexmk~ for compilation. (add-to-list 'org-latex-classes
'("ifimaster"
#+begin_src emacs-lisp "\\documentclass{ifimaster}
[DEFAULT-PACKAGES]
(eval-after-load 'ox-latex [PACKAGES]
'(setq org-latex-pdf-process [EXTRA]
'("latexmk -pdflatex='xelatex -shell-escape -interaction nonstopmode' -pdf -f %f"))) \\usepackage{babel,csquotes,ifimasterforside,url,varioref}"
#+end_src
For my thesis, I need to use our university's LaTeX class, this snippet
makes that class available.
#+begin_src emacs-lisp
(eval-after-load "ox-latex"
'(progn
(add-to-list 'org-latex-classes
'("ifimaster"
"\\documentclass{ifimaster}
[DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]
\\usepackage{babel,csquotes,ifimasterforside,url,varioref}"
("\\chapter{%s}" . "\\chapter*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}") ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(add-to-list 'org-latex-classes (add-to-list 'org-latex-classes
'("easychair" "\\documentclass{easychair}" '("easychair" "\\documentclass{easychair}"
("\\section{%s}" . "\\section*{%s}") ("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
@ -1385,28 +1362,28 @@
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(custom-set-variables '(org-export-allow-bind-keywords t)))) (custom-set-variables '(org-export-allow-bind-keywords t))))
#+end_src #+end_src
Use Emacs for opening the PDF file, when invoking ~C-c C-e l o~. Use Emacs for opening the PDF file, when invoking ~C-c C-e l o~.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require 'org) (require 'org)
(add-to-list 'org-file-apps '("\\.pdf\\'" . emacs)) (add-to-list 'org-file-apps '("\\.pdf\\'" . emacs))
(setq org-adapt-indentation t) (setq org-adapt-indentation t)
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq org-babel-python-command "python3") (setq org-babel-python-command "python3")
(org-babel-do-load-languages (org-babel-do-load-languages
'org-babel-load-languages 'org-babel-load-languages
'((emacs-lisp . t) '((emacs-lisp . t)
(python . t) (python . t)
(clojure . t))) (clojure . t)))
#+end_src #+end_src
** Haskell ** Haskell