From ca0d86235767dcbcaee48722d2776c691d52cb95 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Sat, 16 Apr 2022 20:14:13 +0200 Subject: [PATCH] org article; update abstract block --- lisp/my/my-org-article.el | 56 +++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/lisp/my/my-org-article.el b/lisp/my/my-org-article.el index 9734f6bd..d5c6ef81 100644 --- a/lisp/my/my-org-article.el +++ b/lisp/my/my-org-article.el @@ -230,14 +230,20 @@ '("color" . "@@html:$2@@@@latex:\\textcolor[HTML]{$1}{$2}@@")) (add-to-list 'org-export-global-macros - '("highlight" . (eval (concat "@@html:" $1 "@@" - "@@latex:\\highlight[" - (unless (string-empty-p $2) (concat $2 ",")) - (unless (string-empty-p $3) (concat "draw=" $3)) - "]{" $1 "}@@"))) t) + '("highlight" . "(eval (concat \"@@html:\" $1 \"@@\" + \"@@latex:\\\\highlight[\" + (when $2 (concat $2 \",\")) + (when $3 (concat \"draw=\" $3)) + \"]{\" $1 \"}@@\"))") t) +(add-to-list 'org-export-global-macros + '("title-name" . "@@latex:\\mytitlename@@") t) +(add-to-list 'org-export-global-macros + '("keyword-name" . "@@latex:\\mykeywordname@@") t) +(add-to-list 'org-export-global-macros + '("description-name" . "@@latex:\\mydescriptionname@@") t) ;; QUOTATION ;;; quotation mark (auto language, html using main language) (add-to-list @@ -321,6 +327,7 @@ Currently only one i.e. A.x is possible." (defvar my-org-article-latex-default-class-options) (defvar my-org-article-latex-header) (defvar my-org-article-latex-header-extra) +(defvar my-org-article-latex-document-type) (defvar my-org-article-latex-opening) (defvar my-org-article-latex-closing) (defvar my-org-article-latex-draft) @@ -355,6 +362,7 @@ Currently only one i.e. A.x is possible." (:latex-hyperref-template nil nil my-org-article-latex-hyperref-template t) (:latex-compiler "LATEX_COMPILER" nil my-org-article-latex-compiler t) ;; custom + (:article-document-type "DOCUMENT_TYPE" nil my-org-article-latex-document-type t) (:article-closing "CLOSING" nil my-org-article-latex-closing newline) (:article-opening "OPENING" nil my-org-article-latex-opening newline) (:article-draft nil "draft" my-org-article-latex-draft t) ;; toogle (nil/t) to activate draft visuals, see :draft in `my-org-article-latex-template-plist' @@ -1507,6 +1515,8 @@ Text like <<...>>> will be replaced according to "\\emergencystretch=6pt" ;; fix overful hboxes automatically: 10pt if needed, standard 0, better than \tolerance ;; "\\setlength{\\overfullrule}{5pt}" ;; like draft, show a black box at the end of a overfull hbox +;;; Abstract + "\\renewenvironment{abstract}{\\par\\noindent\\sffamily\\textbf{\\Large\\abstractname}\\\\[-1em]\\begin{spacing}{1.0}}{\\end{spacing}\\par\\medskip}" ;;; running title ;; "%\\pagestyle{headings}" "\\usepackage{fancyhdr}" @@ -1949,6 +1959,7 @@ Text like <<...>>> will be replaced according to ;; e.g. in \\RedeclareSectionCommand[tocbeforeskip=2.25em plus 1pt, ...]{section} ;; ("" "tocbasic" nil) "\\KOMAoptions{sectionentrydots=true}" + "\\DeclareTOCStyleEntry[beforeskip=.5em]{section}{section}" ;; set spacing between section entries inside toc ("" "scrwfile" nil ("pdflatex")) ;; avoid trouble with the limited number of write handles ('No room for new \\write') ;;; - Section ToC (especially for appendix) "\\makeatletter" @@ -2023,6 +2034,11 @@ Text like <<...>>> will be replaced according to ;;;; Document +(defcustom my-org-article-latex-document-type + "Paper" + "Article opening." + :group 'my-org-export-article) + (defcustom my-org-article-latex-opening "" "Article opening." @@ -2173,6 +2189,30 @@ Uses also `my-org-article-latex-template-value' with (let ((template (plist-get info :latex-hyperref-template))) (and (stringp template) (format-spec template spec))) + ;; custom variables + (let* ((language (plist-get info :language)) + (document-type (if (string= + (plist-get info :article-document-type) + my-org-article-latex-document-type) + ;; maybe not specified therefore check language + (cond ((string= "de" language) "Arbeit") + ;; en version + (t my-org-article-latex-document-type)) + (plist-get info :article-document-type))) + (titlename (cond ((string= "de" language) + (concat "Thema der " document-type)) + ;; en version + (t (concat document-type " title")))) + (keywordname (cond ((string= "de" language) "Stichworte") + ;; en version + (t "Keywords"))) + (descriptionname + (cond ((string= "de" language) "Kurzzusammenfassung") + ;; en version + (t "Description")))) + (concat (format "\\def\\mytitlename{%s}\n" titlename) + (format "\\def\\mykeywordname{%s}\n" keywordname) + (format "\\def\\mydescriptionname{%s}\n" descriptionname))) ;; Document start. "\\begin{document}\n\n" ;; Title command.