clean up latex article preamble

This commit is contained in:
2022-04-14 21:06:17 +02:00
parent 4ca87469a6
commit 146f6b1d2b
3 changed files with 602 additions and 574 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -27,6 +27,7 @@
:load-path (lambda() (concat config-dir "lisp/citeproc"))
:defer t) ;; used by org-ref
;; !in a org document run org-ref to test the installation
(use-package org-ref ;; used with some preamble defs and \printbibliography (biblatex/biber, no html export), see also ox-bibtex
:load-path (lambda() (concat config-dir "lisp/org-ref"))
:after (org)
@@ -35,7 +36,13 @@
;; specify completion backends
(defvar org-ref-completion-library 'org-ref-ivy-cite) ;; requires ivy-bibtex, must be set before requiring org-ref otherwise helm will be loaded
:config
(setq bibtex-dialect 'biblatex)) ;; biblatex also for biber
;; TODO: version 3 not working (with article-latex), the tex file still has the from cite:&... -> \cite{&...}
(setq org-ref-cite-insert-version 2) ;; org-ref-citation-links.el
(setq bibtex-dialect 'biblatex) ;; biblatex also for biber
(setq org-latex-prefer-user-labels t)) ;; reference to headings ref:section-name
(use-package org-ref-ivy
:after (org-ref))
(use-package ox-bibtex ;; used with #+BIBLIOGRAPHY: ... (bibtex, with html export), see also org-ref
:after (org)

View File

@@ -257,7 +257,7 @@ Example defines
(setq org-startup-folded nil) ;; nil = showall = #+STARTUP: showall
(setq org-startup-with-inline-images t) ;; #+STARTUP: inlineimages|noinlineimages, show inline images when loading a new Org file
(setq org-use-sub-superscripts '{}) ;; braces are *required* in order to trigger interpretations as sub/superscript, see also `org-export-with-sub-superscripts'. C-c C-x \ (`org-toggle-pretty-entities')
(setq org-pretty-entities t) ;; see also `org-appear' and [C-c C-x \] (`org-toggle-pretty-entities')
(setq org-pretty-entities nil) ;; so much trouble in an article, see also `org-appear' and [C-c C-x \] (`org-toggle-pretty-entities')
(setq org-pretty-entities-include-sub-superscripts t) ;; if `org-pretty-entities' is active include also sub-superscripts.
(setq org-image-actual-width '(600)) ;; image width displayed in org
(setq org-startup-with-latex-preview t) ;; #+STARTUP: latexpreview|nolatexpreview
@@ -792,12 +792,13 @@ usage: #+HEADER: :prologue (mpl-prologue)
;; http://permalink.gmane.org/gmane.emacs.orgmode/93971
;; https://emacs.stackexchange.com/questions/30575/adding-latex-newpage-before-a-heading/30892
(defun my-org-headline-string-element (headline backend info)
(defun my-org-headline-string-element (headline backend info)
"Return the org element representation of an element. Won't work on ~verb~/=code=-only headers"
(let ((prop-point (next-property-change 0 headline)))
(if prop-point (plist-get (text-properties-at prop-point headline) :parent))))
(defun my-org-latex-ensure-clearpage (headline backend info)
"Insert a clearpage before the heading if property clearpage is non-nil."
"Insert a clearpage before the heading if property clearpage is non-nil.
Uses function `my-org-headline-string-element'"
(when (org-export-derived-backend-p backend 'latex)
(let ((elmnt (my-org-headline-string-element headline backend info)))
(when (and elmnt (org-element-property :CLEARPAGE elmnt))
@@ -909,78 +910,38 @@ usage: #+HEADER: :prologue (mpl-prologue)
:config
(setq org-latex-compiler "lualatex") ;; %latex in org-latex-pdf-process
(setq org-latex-bib-compiler "biber") ;; %bib in org-latex-pdf-process
;; pdflatex
;; (setq org-latex-pdf-process
;; '("%latex -shell-escape -interaction nonstopmode -output-directory %o %f"
;; "%bib %b"
;; "%latex -shell-escape -interaction nonstopmode -output-directory %o %f"
;; "%latex -shell-escape -interaction nonstopmode -output-directory %o %f"))
(setq org-latex-pdf-process
'("lualatex --interaction=nonstopmode --output-directory=%o %f"
"biber %b"
"lualatex --interaction=nonstopmode --output-directory=%o %f"
"lualatex --interaction=nonstopmode --output-directory=%o %f"))
(if (executable-find "latexmk")
'("latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f")
(cond ((string-equal org-latex-compiler "lualatex")
'("lualatex --interaction=nonstopmode --output-directory=%o %f"
"biber %b"
"lualatex --interaction=nonstopmode --output-directory=%o %f"
"lualatex --interaction=nonstopmode --output-directory=%o %f"))
((string-equal org-latex-compiler "pdflatex")
'("%latex -shell-escape -interaction nonstopmode -output-directory %o %f"
"%bib %b"
"%latex -shell-escape -interaction nonstopmode -output-directory %o %f"
"%latex -shell-escape -interaction nonstopmode -output-directory %o %f"))
(t '("%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f")))))
(setq org-latex-listings t)
(setq org-latex-listings-options
'(("numbers" "left")
;; ("captionpos" "t") ;; not working, see org-latex-caption-above
))
(setq org-latex-caption-above '(table src-block))
(setq org-latex-hyperref-template "
%% DON't let hyperref overload the format of index and glossary.
%% I want to do that on my own in the stylefiles for makeindex...
\\makeatletter
\\let\\@old@wrindex=\\@wrindex
\\makeatother
\\hypersetup{%%
pdfauthor={%a},
pdftitle={%t},
pdfkeywords={%k},
pdfsubject={%d},
pdfcreator={%c},
pdflang={%L},
pdfproducer={LaTeX},
%%pdfpagelabels,
%% Dokument an Fensterbreite anpassen, {XYZ null null 1}
pdfstartview=FitH,
%% Miniaturansicht nicht anzeigen
pdfpagemode=UseNone,
bookmarksopen=true,
bookmarksnumbered=true,
%% use true to enable colors below:
colorlinks=true,
linkcolor=black,
filecolor=darkblue,
menucolor=darkblue,
urlcolor=darkblue,
citecolor=black,
%% PDF link-darstellung, falls colorlinks=false. 0 0 0: nix. 0 0 1: default.
pdfborder=0 0 0,
%%frenchlinks=false, %% small caps instead of colors
%% false bei römisch und arabischen Zahlen
plainpages=false,
%% true bei römisch und arabischen Zahlen; Without hypertexnames it's just counting upwards; bei 4 -> iv
hypertexnames=true,
}
\\makeatletter
\\let\\@wrindex=\\@old@wrindex
\\makeatother
")
(add-to-list 'org-latex-classes
'("koma-article" "\\documentclass{scrartcl}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(defun my-org-latex-export-to-pdf
(&optional async subtreep visible-only body-only ext-plist)
"Like `org-latex-export-to-pdf' but with additional notification."
"Like `org-latex-export-to-pdf' but with additional notification.
And using the rewritten design for an article
`my-org-article-latex-export-to-pdf' (article-latex instead of
latex)."
(interactive)
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
(org-export-to-file 'latex outfile
(org-export-to-file 'article-latex outfile
async subtreep visible-only body-only ext-plist
(lambda (file) ;; is called with FILE and has to return a file name.
(let ((output (org-latex-compile file)))
@@ -1002,6 +963,9 @@ usage: #+HEADER: :prologue (mpl-prologue)
(my-org-latex-export-to-pdf async))
(defun my-org-export-pdf-async ()
"For async a new emacs session starts using
`org-export-async-init-file'."
;; TODO: define org-export-async-init-file
(interactive)
(my-org-export-pdf t))