Updated LaTeX section to include org mode export.

Also this includes a new LaTeX class to org mode.
This commit is contained in:
Lars Tveito 2015-04-07 21:18:31 +02:00
parent 346179b49b
commit d28a3a9e61
2 changed files with 68 additions and 18 deletions

40
init.el
View File

@ -883,13 +883,17 @@ given, the duplicated region will be commented out."
(add-hook 'asm-mode-hook 'asm-setup) (add-hook 'asm-mode-hook 'asm-setup)
;; LaTeX ;; LaTeX and org-mode LaTeX export
;; =.tex=-files should be associated with =latex-mode= instead of ;; =.tex=-files should be associated with =latex-mode= instead of
;; =tex-mode=. ;; =tex-mode=.
(add-to-list 'auto-mode-alist '("\\.tex\\'" . latex-mode)) (add-to-list 'auto-mode-alist '("\\.tex\\'" . latex-mode))
;; Use ~biblatex~ for bibliography.
(setq-default bibtex-dialect 'biblatex)
;; I like using the [[https://code.google.com/p/minted/][Minted]] package for source blocks in LaTeX. To make org ;; 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. ;; use this we add the following snippet.
@ -903,17 +907,35 @@ given, the duplicated region will be commented out."
;; Tex- and LaTeX-mode, we can add the flag with a rather dirty statement ;; 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). ;; (if anyone finds a nicer way to do this, please let me know).
(eval-after-load 'ox-latex
'(setq org-latex-pdf-process
(mapcar
(lambda (str)
(concat "pdflatex -shell-escape "
(substring str (string-match "-" str))))
org-latex-pdf-process)))
(eval-after-load 'tex-mode (eval-after-load 'tex-mode
'(setcar (cdr (cddaar tex-compile-commands)) " -shell-escape ")) '(setcar (cdr (cddaar tex-compile-commands)) " -shell-escape "))
;; When exporting from Org to LaTeX, use ~latexmk~ for compilation.
(eval-after-load 'ox-latex
'(setq org-latex-pdf-process
'("latexmk -pdflatex='pdflatex -shell-escape -interaction nonstopmode' -pdf -f %f")))
;; For my thesis, I need to use our university's LaTeX class, this snippet
;; makes that class available.
(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}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(custom-set-variables '(org-export-allow-bind-keywords t))))
;; Markdown ;; Markdown
;; I sometimes use a specialized markdown format, where inline math-blocks ;; I sometimes use a specialized markdown format, where inline math-blocks

View File

@ -1106,7 +1106,7 @@
(add-hook 'asm-mode-hook 'asm-setup) (add-hook 'asm-mode-hook 'asm-setup)
#+END_SRC #+END_SRC
** LaTeX ** LaTeX and org-mode LaTeX export
=.tex=-files should be associated with =latex-mode= instead of =.tex=-files should be associated with =latex-mode= instead of
=tex-mode=. =tex-mode=.
@ -1115,6 +1115,12 @@
(add-to-list 'auto-mode-alist '("\\.tex\\'" . latex-mode)) (add-to-list 'auto-mode-alist '("\\.tex\\'" . latex-mode))
#+END_SRC #+END_SRC
Use ~biblatex~ for bibliography.
#+BEGIN_SRC emacs-lisp
(setq-default bibtex-dialect 'biblatex)
#+END_SRC
I like using the [[https://code.google.com/p/minted/][Minted]] package for source blocks in LaTeX. To make org 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. use this we add the following snippet.
@ -1131,18 +1137,40 @@
(if anyone finds a nicer way to do this, please let me know). (if anyone finds a nicer way to do this, please let me know).
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(eval-after-load 'ox-latex
'(setq org-latex-pdf-process
(mapcar
(lambda (str)
(concat "pdflatex -shell-escape "
(substring str (string-match "-" str))))
org-latex-pdf-process)))
(eval-after-load 'tex-mode (eval-after-load 'tex-mode
'(setcar (cdr (cddaar tex-compile-commands)) " -shell-escape ")) '(setcar (cdr (cddaar tex-compile-commands)) " -shell-escape "))
#+END_SRC #+END_SRC
When exporting from Org to LaTeX, use ~latexmk~ for compilation.
#+BEGIN_SRC emacs-lisp
(eval-after-load 'ox-latex
'(setq org-latex-pdf-process
'("latexmk -pdflatex='pdflatex -shell-escape -interaction nonstopmode' -pdf -f %f")))
#+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}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(custom-set-variables '(org-export-allow-bind-keywords t))))
#+END_SRC
** Markdown ** Markdown
I sometimes use a specialized markdown format, where inline math-blocks I sometimes use a specialized markdown format, where inline math-blocks