80 lines
3.1 KiB
EmacsLisp
80 lines
3.1 KiB
EmacsLisp
;; Org-mode LaTeX export settings
|
|
(require 'ox-latex)
|
|
|
|
;; Add custom LaTeX packages
|
|
(setq org-latex-packages-alist '(("" "listings")
|
|
("" "booktabs")
|
|
("AUTO" "polyglossia" t ("xelatex" "lualatex"))
|
|
("" "grffile")
|
|
("" "unicode-math")
|
|
("" "xcolor")))
|
|
|
|
;; Define the process to convert Org to PDF using XeLaTeX
|
|
(setq org-latex-pdf-process '("latexmk -xelatex -shell-escape -quiet -f %f"))
|
|
|
|
;; Set the compiler to XeLaTeX
|
|
(setq org-latex-compiler "xelatex")
|
|
|
|
;; Enable listings and other table-related features
|
|
(setq org-latex-listings t)
|
|
(setq org-latex-tables-booktabs t)
|
|
(setq org-latex-images-centered t)
|
|
|
|
;; Customize the appearance of listings (source code blocks)
|
|
(setq org-latex-listings-options
|
|
'(("basicstyle" "\\ttfamily")
|
|
("showstringspaces" "false")
|
|
("keywordstyle" "\\color{blue}\\textbf")
|
|
("commentstyle" "\\color{gray}")
|
|
("stringstyle" "\\color{green!70!black}")
|
|
("stringstyle" "\\color{red}")
|
|
("frame" "single")
|
|
("numbers" "left")
|
|
("numberstyle" "\\ttfamily")
|
|
("columns" "fullflexible")))
|
|
|
|
;; Set the input encoding
|
|
(setq org-latex-inputenc-alist '((\"utf8\" . \"utf8x\")))
|
|
|
|
;; Define custom LaTeX class with specific formatting
|
|
(with-eval-after-load 'ox-latex
|
|
(add-to-list 'org-latex-classes
|
|
'("koma-general"
|
|
"\\documentclass[a4paper,10pt,captions=tableheading,twoside=false]{scrartcl}
|
|
\\linespread{1.25}
|
|
\\usepackage{fontspec}
|
|
\\defaultfontfeatures{Mapping=tex-text, RawFeature={+zero}}
|
|
\\setmainfont{Noto Sans}[BoldFont=*-Medium,ItalicFont=*-Italic]
|
|
\\setsansfont{Noto Sans}[BoldFont=*-Medium,ItalicFont=*-Italic]
|
|
\\setmonofont{Noto Sans Mono}[BoldFont=*-Medium,Scale=0.8]
|
|
\\usepackage{geometry}
|
|
\\geometry{a4paper,left=2cm,right=2cm,top=1.6cm,bottom=1.6cm}
|
|
\\usepackage{fancyhdr}
|
|
\\pagestyle{fancy}
|
|
\\fancyhf{}
|
|
\\fancyhead[L]{\\leftmark} % Left header
|
|
\\fancyhead[R]{\\thepage} % Right header"
|
|
("\\section{%s}" . "\\section*{%s}")
|
|
("\\subsection{%s}" . "\\subsection*{%s}")
|
|
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
|
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
|
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
|
|
|
|
;; Set default LaTeX class
|
|
(setq org-latex-default-class "koma-general")
|
|
|
|
;; Load KOMA letter support
|
|
(eval-after-load 'ox '(require 'ox-koma-letter))
|
|
|
|
;; TeX mode settings for editing .tex files
|
|
(use-package tex-mode
|
|
:ensure auctex
|
|
:mode ("\\.tex\\$" . latex-mode)
|
|
:custom
|
|
(TeX-auto-save t) ; Enable auto-save
|
|
(TeX-electric-math (cons "$" "$")) ; Shortcut for math mode
|
|
(TeX-view-program-selection '((output-pdf "Evince"))) ; PDF viewer
|
|
(TeX-source-correlate-start-server t) ; Enable source-correlate
|
|
(TeX-master nil) ; Default master file
|
|
(TeX-engine 'xetex) ; Set engine to XeTeX
|
|
(TeX-command-extra-options "-shell-escape")) ; Allow shell escape
|