2438 lines
96 KiB
EmacsLisp
2438 lines
96 KiB
EmacsLisp
;;; my-org-article.el --- Summary -*- lexical-binding: t -*-
|
||
|
||
;;; Commentary:
|
||
;; LaTeX and HTML export
|
||
|
||
;; EXAMPLE:
|
||
;; # -*- ispell-local-dictionary: "german" -*-
|
||
;; #+LANGUAGE: en
|
||
;; #+TITLE: Emacs
|
||
;; #+SUBTITLE:
|
||
;; #+AUTHOR: Daniel Weschke
|
||
;; #+EMAIL: daniel.weschke@directbox.de
|
||
;; #+DATE: 25. November 2019
|
||
;; #+KEYWORDS:
|
||
;; #+DESCRIPTION:
|
||
;; * Header :ignore:
|
||
|
||
;; article-latex is based on latex
|
||
;; article-html is based on tufte-html
|
||
|
||
;; KEYWORDS are set in (org-export-define-derived-backend ... :options-alist
|
||
|
||
;; internal
|
||
;; `translate-alist' defines Org export function with own function
|
||
|
||
;; TODO: org-ref cite version 3 not working, the tex file still has
|
||
;; the from cite:&... -> \cite{&...}
|
||
;; OR? org - oc-biblatex.el
|
||
;; using #+CITE_EXPORT:
|
||
|
||
;;; Code:
|
||
(require 'ob-latex)
|
||
(require 'ob-gnuplot)
|
||
(require 'ox-latex)
|
||
(require 'ox-tufte)
|
||
(require 'org)
|
||
(require 'org-ref) ;; `org-ref-acronyms-before-parsing' and to find `cite:...' in the org file.
|
||
|
||
;;; Function Declarations
|
||
(defvar my-org-article-latex-default-packages-alist)
|
||
(defvar my-org-article-latex-packages-alist)
|
||
(defvar my-org-article-latex-compiler)
|
||
(defvar my-org-article-latex-default-class)
|
||
(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-header-biblatex)
|
||
(defvar my-org-article-latex-opening)
|
||
(defvar my-org-article-latex-closing)
|
||
(defvar my-org-article-latex-fontsize)
|
||
(defvar my-org-article-latex-draft)
|
||
(defvar my-org-article-latex-references)
|
||
|
||
;; add to generel org variabels, so that it works also for babel latex src blocks
|
||
(add-to-list 'org-babel-latex-htlatex-packages "{pgfplots}" t)
|
||
|
||
;; add to general org variables, so that it works also for latex snippets, preview
|
||
(add-to-list 'org-latex-default-packages-alist "\\newcommand{\\ti}[1]{_\\mathrm{#1}} % tiefstellen, Index
|
||
\\newcommand{\\ho}[1]{^\\mathrm{#1}} % hochstellen
|
||
\\newcommand*{\\rom}[1]{\\mathrm{\\romannumeral #1}} % \\rom{2} -> ii
|
||
\\makeatletter\\newcommand*{\\Rom}[1]{\\mathrm{\\expandafter\\@slowromancap\\romannumeral #1@}}\\makeatother % \\Rom{2} -> II" t)
|
||
(add-to-list 'org-latex-default-packages-alist '("" "mathtools" t) t) ;; line underneath with text \\underbracket[1pt][0pt]{bla}_\\text{blo}
|
||
(add-to-list 'org-latex-default-packages-alist "\\newcommand\\Dfrac[2]{\\dfrac{\\displaystyle #1}{\\displaystyle #2}}
|
||
\\newcommand{\\slfrac}[2]{\\left.#1\\middle/#2\\right.}" t)
|
||
(add-to-list 'org-latex-default-packages-alist '("" "xfrac" t) t) ;; defines \sfrac[<instance>]{<num>}[<sep>]{<denum>}
|
||
(add-to-list 'org-latex-default-packages-alist '("" "nicefrac" t) t)
|
||
(add-to-list 'org-latex-default-packages-alist '("" "faktor" t) t)
|
||
(add-to-list 'org-latex-default-packages-alist "\\DeclareDocumentCommand{\\Faktor}{s m O{0.5} m O{-0.5}}{%
|
||
\\setbox0=\\hbox{\\scalebox{0.8}{\\ensuremath{#2\\vphantom{1}}}}%
|
||
\\setbox1=\\hbox{\\ensuremath{\\diagup}}%
|
||
\\setbox2=\\hbox{\\scalebox{0.8}{\\ensuremath{#4}}}%
|
||
\\raisebox{#3\\ht1}{\\usebox0}%
|
||
\\mkern-5mu\\ifthenelse{\\equal{#1}{\\BooleanTrue}}%
|
||
{\\diagup}%
|
||
{\\rotatebox{-44}{\\rule[#5\\ht2]{0.4pt}{-#5\\ht2+#3\\ht0+\\ht0}}}%
|
||
\\mkern-4mu%
|
||
\\raisebox{#5\\ht2}{\\usebox2}%
|
||
}" t) ;; http://tex.stackexchange.com/questions/27591/extending-the-faktor-package/27735#27735"
|
||
(add-to-list 'org-latex-default-packages-alist '("thinspace,thinqspace,squaren,Gray" "SIunits" t) t)
|
||
(add-to-list 'org-latex-default-packages-alist '("" "dsfont" t) t)
|
||
(add-to-list 'org-latex-default-packages-alist '("" "MnSymbol" t) t)
|
||
(add-to-list 'org-latex-default-packages-alist "\\newcommand{\\field}[1]{\\ensuremath{\\mathds{#1}}} % \\field{X} defined with mathds
|
||
\\newcommand{\\fA}{\\field{A}} % \\fA Affine field A
|
||
\\newcommand{\\fC}{\\field{C}} % \\fC Complex field C
|
||
\\newcommand{\\fFp}{\\ensuremath{\\field{F}_{\\!p}}} % \\fFp Finite field F_p
|
||
\\newcommand{\\fFq}{\\ensuremath{\\field{F}_{\\!q}}} % \\fFq Finite field F_q
|
||
\\newcommand{\\fGa}{\\ensuremath{\\field{G}_{a}}} % \\fGa Group scheme G_a
|
||
\\newcommand{\\fK}{\\field{K}} % \\fK Generic field K (Körper)
|
||
\\newcommand{\\fN}{\\field{N}} % \\fN Natural numbers N
|
||
\\newcommand{\\fPj}{\\field{P}} % \\fPj Projective field P
|
||
\\newcommand{\\fR}{\\field{R}} % \\fR Real numbers R
|
||
\\newcommand{\\fQ}{\\field{Q}} % \\fQ Rational numbers Q
|
||
\\newcommand{\\fI}{\\field{I}} % \\fI Irrational numbers I
|
||
\\newcommand{\\fZ}{\\field{Z}} % \\fZ Integers Z
|
||
\\newcommand{\\Def}{\\field{D}} % \\Def Domain of a function (Definitionsbereich)
|
||
\\newcommand{\\LM}{\\field{L}} % \\LM Solution set (Lösungsmenge)
|
||
\\newcommand{\\fdg}{\\;|\\;} % \\fdg 'für die gilt'
|
||
\\newcommand*{\\qed}{\\hfill\\ensuremath{\\blacksquare}} % \\qed Q.E.D. quod erat demonstrandum 'what was to be shown' -> 'which was to be demonstrated'
|
||
\\newcommand*\\euler{\\mathrm{e}} % \\euler e" t)
|
||
(add-to-list 'org-latex-default-packages-alist '("" "xspace" t) t) ;; for \deg
|
||
(add-to-list 'org-latex-default-packages-alist "\\renewcommand{\\deg}{\\ensuremath{^{\\circ}}\\xspace} % for text \\deg ° degree
|
||
\\newcommand\\degC{{\\,^{\\circ}\\mathrm{C}}} % \\degC °C
|
||
\\newcommand\\sins{{\\mathrm{s}}} % \\sins short sin: s
|
||
\\newcommand\\coss{{\\mathrm{c}}} % \\coss short cos: c
|
||
\\newcommand{\\T}{{\\mathrm{T}}\\!} % \\T Transpose operator
|
||
\\newcommand{\\TF}{{\\raisebox{-0.5ex}{$\\sim$}}} % \\TF sign for transfomed values: low tilde
|
||
\\newcommand{\\adj}{{\\mathrm{H}}} % \\adj Adjoint operator
|
||
\\newcommand*\\dif{\\mathop{}\\!\\mathrm{d}} % \\dif
|
||
\\newcommand*\\E{\\ensuremath{\\mathrm{E}}} % \\E
|
||
\\providecommand{\\norm}[1]{\\lVert #1 \\rVert} % \\norm{x} ||x||
|
||
\\providecommand{\\abs}[1]{\\lvert #1 \\rvert} % \\abs{x} |x|
|
||
\\providecommand{\\innerProd}[2]{\\langle #1, #2\\rangle} % \\innerProd{x}{y} <x,y>
|
||
\\DeclareMathOperator{\\Bild}{Bild} % \\Bild Map of a function (mapping, transformation)
|
||
\\DeclareMathOperator{\\rank}{rank} % \\rank Rank of a matrix
|
||
\\DeclareMathOperator{\\tr}{tr} % \\tr Matrix trace
|
||
\\DeclareMathOperator{\\dev}{dev} % \\dev Matrix deviation
|
||
\\DeclareMathOperator{\\var}{var} % \\var Variance
|
||
\\DeclareMathOperator{\\grad}{grad} % \\(\\grad u\\) = grad u
|
||
\\DeclareMathOperator{\\divergence}{div} % \\(\\div u\\) = div u
|
||
\\DeclareMathOperator{\\rot}{rot} % \\(\\rot u\\) = rot u
|
||
\\DeclareMathOperator{\\diag}{diag} % Diagonal matrix
|
||
\\DeclareMathOperator{\\adjugate}{adj} % Classical adjoint (adjugate)
|
||
\\newcommand*\\corresponds{\\mbox{\\kern0em\\raisebox{-.5ex}{\\Large\\^{}}\\kern-.55em\\raisebox{-.1ex}{=}}\\ }
|
||
\\newcommand*{\\dt}[1]{\\overset{\\mbox{\\large\\bfseries .}}{#1}}
|
||
\\newcommand*{\\ddt}[1]{\\overset{\\mbox{\\large\\bfseries .\\hspace{-0.1ex}.}}{#1}}
|
||
\\newcommand*{\\Eval}[3]{{\\left.#1\\phantom{\\Big|}\\!\\!\\right\\rvert_{#2}^{#3}}}" t)
|
||
(add-to-list 'org-latex-default-packages-alist '("" "accents" t) t) ;; tensors
|
||
(add-to-list 'org-latex-default-packages-alist '("" "ushort" t) t)
|
||
(add-to-list 'org-latex-default-packages-alist "\\newcommand{\\tensor}[1]{\\ensuremath{{\\boldsymbol{#1}}}}
|
||
\\newcommand{\\tensorI}[1]{\\ensuremath{\\ushort{{\\boldsymbol{#1}}}}}
|
||
\\newcommand{\\tensorII}[1]{\\ensuremath{\\ushortd{{\\boldsymbol{#1}}}}}
|
||
\\newcommand{\\tensorIII}[1]{\\ensuremath{\\underaccent{3}{\\underaccent{\\tilde}{{\\boldsymbol{#1}}}}}}
|
||
\\newcommand{\\tensorIV}[1]{\\ensuremath{\\underaccent{4}{\\underaccent{\\tilde}{{\\boldsymbol{#1}}}}}}" t)
|
||
(add-to-list 'org-latex-default-packages-alist '("" "tikz" t) t)
|
||
(add-to-list 'org-latex-default-packages-alist '("" "pgfplots" t) t)
|
||
(add-to-list 'org-latex-default-packages-alist "\\usepgflibrary{shapes.geometric}
|
||
\\usepgfplotslibrary{patchplots}
|
||
\\usetikzlibrary{arrows,backgrounds,calc,decorations.pathmorphing,mindmap,pgfplotsclickable,positioning,shadows,shadows.blur,shapes.multipart,tikzmark}
|
||
\\newcommand{\\tensori}[1]{
|
||
\\tikz[baseline, anchor=base,inner sep=0pt]{
|
||
\\node{\\ensuremath{\\phantom{#1\\vphantom{\\overrightharpoon{b}}}}};
|
||
\\node[overlay]{ \\ensuremath{ \\overrightharpoon{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } };
|
||
}
|
||
}
|
||
\\newcommand{\\tensorii}[1]{
|
||
\\tikz[baseline, anchor=base,inner sep=0pt]{
|
||
\\node{\\ensuremath{\\phantom{#1\\vphantom{\\overrightharpoon{b}}}}};
|
||
\\node[overlay]{ \\ensuremath{ \\overrightharpoon{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } };
|
||
\\node[overlay]{ \\reflectbox{ \\ensuremath{ \\overrightharpoon{ \\phantom{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } } } };
|
||
}
|
||
}
|
||
\\newcommand{\\tensoriii}[1]{
|
||
\\tikz[baseline, anchor=base,inner sep=0pt]{
|
||
\\node{\\ensuremath{\\phantom{#1\\vphantom{\\overrightharpoon{b}}}}};
|
||
\\node[overlay]{ \\ensuremath{ \\overrightarrow{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } };
|
||
\\node[overlay]{ \\reflectbox{ \\ensuremath{ \\overrightharpoon{ \\phantom{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } } } };
|
||
}
|
||
}
|
||
\\newcommand{\\tensoriv}[1]{
|
||
\\tikz[baseline, anchor=base,inner sep=0pt]{
|
||
\\node{\\ensuremath{\\phantom{#1\\vphantom{\\overrightharpoon{b}}}}};
|
||
\\node[overlay]{ \\ensuremath{ \\overrightarrow{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } };
|
||
\\node[overlay]{ \\reflectbox{ \\ensuremath{ \\overrightarrow{ \\phantom{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } } } };
|
||
}
|
||
}" t)
|
||
;; also added to `my-org-article-latex-default-packages-alist'
|
||
|
||
;; convert table #+name: glossary to \newglossaryentry to latex_header_extra
|
||
;; overwrite org-ref-glossary.el function `org-ref-glossary-before-parsing'
|
||
;; ** exporting with a glossary table
|
||
(defun my-org-article-ref-glossary-before-parsing (_backend)
|
||
"Function to preprocess a glossary table on export.
|
||
This assumes a table like
|
||
|
||
#+name: glossary
|
||
| label | name | description |
|
||
|-------+-------+---------------|
|
||
| tree | Tree | A woody plant |
|
||
| shrub | Shrub | A woody bush |
|
||
|
||
is in the org-buffer, and will add the relevant latex_header
|
||
items if there is. The table is deleted in a copy of the buffer
|
||
before the export, so you can put it where you want. The column
|
||
names are arbitrary, but three columns are expected, and the
|
||
hline is expected.
|
||
|
||
This is intended to be run in `org-export-before-parsing-hook'."
|
||
(let* (begin
|
||
end
|
||
(entries (save-excursion
|
||
(catch 'found
|
||
(org-element-map
|
||
(org-element-parse-buffer)
|
||
'table
|
||
(lambda (el)
|
||
(when (and (org-element-property :name el)
|
||
(stringp (org-element-property :name el))
|
||
(string= "glossary" (org-element-property :name el)))
|
||
(setq begin (org-element-property :begin el)
|
||
end (org-element-property :end el))
|
||
(goto-char (org-element-property :contents-begin el))
|
||
(throw 'found
|
||
(nthcdr 2 (org-babel-read-table))))))))))
|
||
;; Delete the table
|
||
(when entries
|
||
(setf (buffer-substring begin end) "")
|
||
|
||
(goto-char (point-min))
|
||
(cl-loop
|
||
for (label name description . rest) in entries
|
||
do
|
||
(cond
|
||
;; idea for a general approach
|
||
;; ((= (length rest) 1) ;; only a 4th column (type) is specified
|
||
;; (insert (format "#+latex_header_extra: \\newglossaryentry{%s}{name=%s,description={{%s}},type=%s}\n"
|
||
;; label name description (car rest))))
|
||
;; ((= (length rest) 2) ;; a 4th (type) and 5th column (symbol) is specified
|
||
;; (insert (format "#+latex_header_extra: \\newglossaryentry{%s}{name=%s,description={{%s}},type=%s,symbol=%s}\n"
|
||
;; label name description (car rest) (cadr rest))))
|
||
((= (length rest) 1) ;; if a 4th column (symbol) is specified
|
||
(insert (format "#+latex_header_extra: \\newglossaryentry{%s}{name=%s,description={{%s}},type=%s,symbol=%s}\n"
|
||
label name description (if (string-empty-p (car rest)) "main" "symbols") (car rest))))
|
||
(t
|
||
(insert (format "#+latex_header_extra: \\newglossaryentry{%s}{name=%s,description={{%s}}} %% rest: %s %s\n"
|
||
label name description rest (length rest)))))))))
|
||
(add-hook 'org-export-before-parsing-hook
|
||
'my-org-article-ref-glossary-before-parsing)
|
||
;; convert table #+name: acronyms to \newacronym to latex_header_extra
|
||
(add-hook 'org-export-before-parsing-hook
|
||
'org-ref-acronyms-before-parsing)
|
||
|
||
|
||
;; General
|
||
|
||
(defvar my-org-article-export-headline-levels)
|
||
(defvar my-org-article-export-with-sub-superscripts)
|
||
(defvar my-org-article-export-with-toc)
|
||
|
||
;;; User Configurable Variables
|
||
|
||
(defgroup my-org-export-article nil
|
||
"Options for exporting Org mode files."
|
||
:tag "Org Export"
|
||
:group 'org)
|
||
|
||
(defcustom my-org-article-export-headline-levels 5
|
||
"See `org-export-headline-levels'."
|
||
:group 'my-org-export-article
|
||
:type 'integer
|
||
:safe #'integerp)
|
||
|
||
(defcustom my-org-article-export-with-sub-superscripts '{}
|
||
"See `org-export-with-sub-superscripts'."
|
||
:group 'my-org-export-article
|
||
:version "24.4"
|
||
:package-version '(Org . "8.0")
|
||
:type '(choice
|
||
(const :tag "Interpret them" t)
|
||
(const :tag "Curly brackets only" {})
|
||
(const :tag "Do not interpret them" nil))
|
||
:safe (lambda (x) (memq x '(t nil {}))))
|
||
|
||
(defcustom my-org-article-export-with-toc nil
|
||
"See `org-export-with-toc'."
|
||
:group 'my-org-export-article
|
||
:type '(choice
|
||
(const :tag "No Table of Contents" nil)
|
||
(const :tag "Full Table of Contents" t)
|
||
(integer :tag "TOC to level"))
|
||
:safe (lambda (x)
|
||
(or (booleanp x)
|
||
(integerp x))))
|
||
|
||
;;;; Document
|
||
|
||
(defcustom my-org-article-latex-document-type
|
||
"Paper"
|
||
"Article opening."
|
||
:group 'my-org-export-article)
|
||
|
||
(defcustom my-org-article-latex-opening
|
||
""
|
||
"Article opening."
|
||
:group 'my-org-export-article)
|
||
|
||
(defcustom my-org-article-latex-closing
|
||
""
|
||
"Article closing."
|
||
:group 'my-org-export-article)
|
||
|
||
(defcustom my-org-article-latex-fontsize
|
||
"11pt"
|
||
"fontsize"
|
||
:group 'my-org-export-article)
|
||
|
||
(defcustom my-org-article-latex-draft
|
||
nil
|
||
"draft"
|
||
:group 'my-org-export-article)
|
||
|
||
|
||
;; LaTeX
|
||
|
||
;;(setq org-babel-latex-htlatex "htlualatex")
|
||
;;(setq org-babel-latex-htlatex "htlatex")
|
||
;; (executable-find org-babel-latex-htlatex)
|
||
|
||
|
||
;; Babel latex and gnuplot
|
||
;; PROPERTY src block header arguments https://orgmode.org/manual/Property-Syntax.html
|
||
;; https://orgmode.org/manual/Using-Header-Arguments.html
|
||
;; on src block C-c C-v I - org-babel-view-src-block-info this will eval as org backend
|
||
;; LaTeX
|
||
(setq org-babel-default-header-args:latex
|
||
`((:results . "latex")
|
||
(:exports . "results")
|
||
(:headers . (lambda ()
|
||
;; define latex preamble part if used with ctrl-c-ctrl-c for example (the else part)
|
||
(if (org-export-derived-backend-p org-export-current-backend 'latex)
|
||
""
|
||
"")))
|
||
(:packages . ""
|
||
)))
|
||
;; Gnuplot
|
||
(setq org-babel-default-header-args:gnuplot
|
||
`((:results . "file")
|
||
(:exports . "results")
|
||
(:session)
|
||
(:prologue . (lambda ()
|
||
(concat (by-backend
|
||
(latex gnuplot-init-light)
|
||
(article-latex gnuplot-init-light)
|
||
(t gnuplot-init-dark)))))))
|
||
|
||
;; MACRO https://orgmode.org/manual/Macro-Replacement.html
|
||
(add-to-list
|
||
'org-export-global-macros
|
||
'("kbd" . "@@html:<kbd>$1</kbd>@@@@latex:\\keys{$1}@@") t)
|
||
(add-to-list
|
||
'org-export-global-macros
|
||
'("color" . "@@html:<font color=\"#$1\">$2</font>@@@@latex:\\textcolor[HTML]{$1}{$2}@@"))
|
||
(add-to-list
|
||
'org-export-global-macros
|
||
'("highlight" . "(eval (concat \"@@html:<mark style=\\\"\"
|
||
(when $2 (concat \"background-color:\" $2 \";\"))
|
||
(when $3 (concat \"border:1px solid \" $3 \";\"))
|
||
\"\\\">\" $1 \"</mark>@@\"
|
||
\"@@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
|
||
'org-export-global-macros
|
||
'("enquote" . "@@html:“$1”@@@@latex:\enquote{$1}@@"))
|
||
;;; german quotation (glqq: german left quote quote, grqq ...)
|
||
(add-to-list
|
||
'org-export-global-macros
|
||
'("gq" . "@@html:„$1“@@@@latex:\\glqq{}$1\\grqq{}@@"))
|
||
;;; french quotation (flqq: french left quote quote, frqq ...)
|
||
(add-to-list
|
||
'org-export-global-macros
|
||
'("fq" . "@@html:«$1»@@@@latex:\flqq{}$1\frqq{}@@"))
|
||
;; FONT
|
||
(add-to-list
|
||
'org-export-global-macros
|
||
'("textsc" . "@@html:<span style=\"font-variant-caps: small-caps;\">$1</span>@@@@latex:\\textsc{$1}@@"))
|
||
(add-to-list
|
||
'org-export-global-macros
|
||
'("ruby" . "@@html:<ruby>$1<rp>(</rp><rt>$2</rt><rp>)</rp></ruby>@@@@latex:\\ruby{$1}{$2}@@"))
|
||
|
||
;; LaTeX
|
||
|
||
;; TODO: can be removed, replaced by my-string-insert-after-nth-newline
|
||
(defun my-string-insert-after-first-newline (text parasite)
|
||
"insert a PARASITE string (and a newline character) into TEXT after
|
||
first newline and returns the new text."
|
||
(let ((textarray (split-string text "\n" nil)))
|
||
(concat (car textarray) "\n"
|
||
parasite "\n"
|
||
(string-join (cdr textarray) "\n"))))
|
||
(defun my-split (list count)
|
||
"Slit list at (after) COUNT element and return list containing both
|
||
sub lists."
|
||
;; Example:
|
||
;; (split '(a b c d e f g h i k) 3) -> ((a b c) (d e f g h j k))
|
||
;; https://codereview.stackexchange.com/a/179682
|
||
(values (subseq list 0 count) (nthcdr count list)))
|
||
(defun my-string-insert-after-nth-newline (text parasite nth)
|
||
"insert a PARASITE string (and a newline character) into TEXT after
|
||
NTH newline and returns the new text."
|
||
(let* ((textarraysplit (my-split (split-string text "\n" nil) nth)))
|
||
(concat (string-join (car textarraysplit) "\n") "\n"
|
||
parasite "\n"
|
||
(string-join (cadr textarraysplit) "\n"))))
|
||
(defun my-org-article-latex-appendix (headline backend info)
|
||
"Insert a appendix before the heading if property appendix is non-nil.
|
||
Uses function `my-org-headline-string-element' and
|
||
`my-string-insert-after-nth-newline' with nth equal 2.
|
||
A 'normal' looks like:
|
||
\\section{Appendix}
|
||
\\label{sec:org0069643}
|
||
Currently only one i.e. A.x is possible."
|
||
;; headline will have all the content and children, so the string after is at the end of the section
|
||
(when (org-export-derived-backend-p backend 'latex)
|
||
(let ((elmnt (my-org-headline-string-element headline backend info)))
|
||
(when (and elmnt (org-element-property :APPENDIX elmnt))
|
||
(concat
|
||
(my-string-insert-after-nth-newline
|
||
headline
|
||
"\\markboth{\\nameappendix}{\\nameappendix}
|
||
\\begin{mtchideinmaintoc}[-1]
|
||
\\setcounter{section}{0}
|
||
\\renewcommand{\\thesection}{A}
|
||
\\setcounter{subsection}{0}
|
||
\\setcounter{figure}{0}
|
||
\\setcounter{table}{0}
|
||
\\sectiontoc" 2)
|
||
;; %\\renewcommand{\\thesection}{\\Alph{section}} % will be A.x but points to 1.x
|
||
;; %\\renewcommand{\\thesubsection}{A\\arabic{subsection}}
|
||
;; %\\renewcommand{\\thetable}{A\\arabic{table}}
|
||
"\\end{mtchideinmaintoc}\n")))))
|
||
(add-to-list 'org-export-filter-headline-functions
|
||
'my-org-article-latex-appendix)
|
||
|
||
(defcustom my-org-article-latex-references "" "")
|
||
|
||
;; see ox-latex function org-export-define-backend
|
||
(org-export-define-derived-backend 'article-latex 'latex
|
||
|
||
:menu-entry
|
||
'(?l ?a
|
||
(
|
||
;;(?A "As LaTeX buffer" my-org-article-latex-export-as-latex)
|
||
;;(?a "As LaTeX file" my-org-article-latex-export-to-latex)
|
||
(?a "As PDF-article file" my-org-article-latex-export-to-pdf)
|
||
(?A "As PDF-article and open"
|
||
(lambda (a s v b)
|
||
(if a (my-org-article-latex-export-to-pdf t s v b)
|
||
(org-open-file (my-org-article-latex-export-to-pdf nil s v b)))))))
|
||
|
||
:options-alist
|
||
'(;; (:PROPERTY-NAME KEYWORD OPTION DEFAULT BEHAVIOR) see `org-export-options-alist'
|
||
(:headline-levels nil "H" my-org-article-export-headline-levels)
|
||
(:with-sub-superscript nil "^" my-org-article-export-with-sub-superscripts)
|
||
(:with-toc nil "toc" my-org-article-export-with-toc)
|
||
;; ox-latex
|
||
(:latex-class "LATEX_CLASS" nil my-org-article-latex-default-class t)
|
||
(:latex-class-options "LATEX_CLASS_OPTIONS" nil my-org-article-latex-default-class-options t)
|
||
(:latex-header "LATEX_HEADER" nil my-org-article-latex-header newline)
|
||
(:latex-header-extra "LATEX_HEADER_EXTRA" nil my-org-article-latex-header-extra newline)
|
||
(: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-biblatex "BIBLATEX" nil my-org-article-latex-header-biblatex t)
|
||
(:article-closing "CLOSING" nil my-org-article-latex-closing newline)
|
||
(:article-opening "OPENING" nil my-org-article-latex-opening newline)
|
||
(:article-fontsize nil "fontsize" my-org-article-latex-fontsize t)
|
||
(: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'
|
||
(:article-references "REFERENCES" nil my-org-article-latex-references newline)) ;; TODO not installed yet, maybe using oc-biblatex?
|
||
|
||
:translate-alist
|
||
'((template . my-org-article-latex-template)))
|
||
|
||
|
||
;;;; Compilation
|
||
|
||
(defcustom my-org-article-latex-compiler "lualatex"
|
||
"See `org-latex-compiler'."
|
||
:group 'my-org-export-article
|
||
:type '(choice
|
||
(const :tag "pdfLaTeX" "pdflatex")
|
||
(const :tag "XeLaTeX" "xelatex")
|
||
(const :tag "LuaLaTeX" "lualatex")
|
||
(const :tag "Unset" ""))
|
||
:version "26.1"
|
||
:package-version '(Org . "9.0"))
|
||
|
||
;;;; Preamble
|
||
|
||
(defcustom my-org-article-latex-default-class "koma-article"
|
||
"The default LaTeX class."
|
||
:group 'my-org-export-article
|
||
:type '(string :tag "LaTeX class"))
|
||
|
||
(let ((default "
|
||
%\\usepackage[fixlanguage]{babelbib} % Mehrsprachige Literaturliste, nicht mit biblatex
|
||
%\\selectbiblanguage{german}
|
||
\\usepackage[
|
||
%bibstyle=chem-acs,
|
||
style=numeric-comp, % alphabetic, numeric-comp, authoryear-icomp, authortitle-icomp
|
||
sorting=none, % name, title, year, none
|
||
%abbreviate=false, % keine Abkürzungen
|
||
%sortcites=true, % sorted according to the global sorting order
|
||
%sortgiveninits=true, % sorting names will only use their initials
|
||
%block=nbpar, % none, space, par, nbpar, ragged
|
||
autocite=footnote, % citations as footnotes
|
||
uniquename=init, % set true if giveninits is set to true
|
||
giveninits=true, % all first and middle names will be rendered as initials
|
||
isbn=false,
|
||
maxnames=2,
|
||
backend=biber, % backend=bibtex8 by latin1, biber by utf8
|
||
safeinputenc, % erlaubt Zeichen aus dem tipa-Paket (Biber only)
|
||
]{biblatex}
|
||
|
||
% Erst Nachname, dann Vorname
|
||
\\DeclareNameAlias{default}{family-given}
|
||
|
||
% Autorennamen in Kapitälchen
|
||
\\renewcommand*{\\mkbibnamefamily}[1]{\\textsc{#1}}
|
||
|
||
% muss ich noch nachvollziehen, nur dick?
|
||
\\renewbibmacro*{author/editor+others/translator+others}{%
|
||
%\\mkbibbold{% ADDED
|
||
\\ifboolexpr{
|
||
test \\ifuseauthor%
|
||
and
|
||
not test {\\ifnameundef{author}}
|
||
}
|
||
{\\usebibmacro{author}}
|
||
{\\ifboolexpr{
|
||
test \\ifuseeditor%
|
||
and
|
||
not test {\\ifnameundef{editor}}
|
||
}
|
||
{\\usebibmacro{editor+others}}
|
||
{\\usebibmacro{translator+others}}}
|
||
%}% ADDED
|
||
}
|
||
|
||
% Trennen mit Semikolon, bei mehreren Autoren
|
||
\\renewcommand*{\\multinamedelim}{\\addsemicolon\\space}
|
||
\\renewcommand*{\\finalnamedelim}{\\addsemicolon\\space}
|
||
|
||
% : als Trennzeichen nach Titel
|
||
%\\DeclareFieldFormat{title}{\\mkbibemph{#1}~:\\addspace}
|
||
\\renewbibmacro*{title}{%
|
||
\\ifthenelse{\\iffieldundef{title}\\AND\\iffieldundef{subtitle}}
|
||
{}
|
||
{\\printtext[title]{%
|
||
\\printfield[titlecase]{title}}%
|
||
%\\setunit{\\subtitlepunct}% DELETE
|
||
\\setunit{~:\\addspace}%
|
||
% DELETE and close in title
|
||
%\\printfield[titlecase]{subtitle}}
|
||
% ADD
|
||
\\printfield{subtitle}
|
||
\\newunit}%
|
||
\\printfield{titleaddon}}
|
||
% Änderung des Subtitles
|
||
\\DeclareFieldFormat{subtitle}{\\mkbibemph{#1}}
|
||
|
||
% : als Trennzeichen zwischen Ort und Verlag
|
||
\\renewbibmacro*{publisher+location+date}{%
|
||
\\printlist{location}%
|
||
\\iflistundef{publisher}
|
||
{\\setunit*{\\addcomma\\space}}
|
||
% {\\setunit*{addcolon\\space}}% DELETED
|
||
{\\setunit*{~:\\space}}% ADDED
|
||
\\printlist{publisher}%
|
||
\\setunit*{\\addcomma\\space}%
|
||
\\usebibmacro{date}%
|
||
\\newunit}
|
||
|
||
\\DeclareFieldFormat{edition}{%
|
||
\\ifinteger{#1}
|
||
{\\mkbibordedition{#1}~\\bibstring{edition}}% DELETED
|
||
% {\\mkbibordedition{#1}\\bibstring{edition}}% ADDED
|
||
{#1\\isdot}}
|
||
|
||
%Doppelpunkt statt Komma vor der Seitenangabe in der Zitierung, z.B. «(Gaukeley 2005: S. 387)»
|
||
\\renewcommand{\\postnotedelim}{\\addcolon\\addspace}
|
||
|
||
%Kein einleitendes «S.» vor der Seitenangabe in der Zitierung, z.B. «(Gaukeley 2005: 387)»
|
||
\\DeclareFieldFormat{postnote}{#1}
|
||
|
||
% Doppelpunkt statt Punkt vor dem Titel in der Literaturliste,
|
||
% z.B. «Gaukeley, Gundel (2005): Das kleine Einmaleins der Hexerei. [...]»
|
||
\\renewcommand{\\labelnamepunct}{\\addcolon\\addspace}
|
||
|
||
% Allfällige Angabe von Serie und Nummer in der Literaturliste eingeklammert und mit Gleichheitszeichen versehen,
|
||
% z.B. «[...] (= Schriftenreihe des Entenhausener Pfadfinderverbandes 13).»
|
||
\\renewbibmacro*{series+number}{%
|
||
\\iffieldundef{series}
|
||
{}
|
||
{\\printtext[parens]{%
|
||
\\iffieldundef{number}
|
||
{}
|
||
{=\\addhpthinspace}%
|
||
\\printfield{series}%
|
||
\\setunit*{\\addspace}%
|
||
\\printfield{number}%
|
||
}}\\newunit}
|
||
|
||
% Allfälliges Datum der Erstausgabe in der Literaturliste,
|
||
% z.B. «Duck, Tick u. a. (1966/2004): Ordens- und Abzeichenkunde für Fieselschweiflinge. [...]»
|
||
%\\renewbibmacro*{date+extrayear}{
|
||
\\newbibmacro*{date+extrayear}{%
|
||
\\iffieldundef{year}
|
||
{}
|
||
{\\printtext[parens]{%
|
||
\\iffieldundef{origyear}
|
||
{}
|
||
{\\printfield{origyear}\\addslash}%
|
||
\\printdateextra}}}
|
||
|
||
% Allfälliges Datum der Erstausgabe in Zitierungen, z.B. «(Duck u. a. 1966/2004: 37 f.)»
|
||
%\\renewbibmacro*{cite:labelyear+extrayear}{%
|
||
\\newbibmacro*{cite:labelyear+extrayear}{%
|
||
\\iffieldundef{labelyear}
|
||
{}
|
||
{\\printtext[bibhyperref]{%
|
||
\\iffieldundef{origyear}
|
||
{}
|
||
{\\printfield{origyear}\\addslash}%
|
||
\\printfield{labelyear}%
|
||
\\printfield{extrayear}}}}
|
||
|
||
% Hat es mehrere Werke derselben Person(en), den Strich durch eine entsprechende Abkürzung ersetzen (wie ders./dies.)
|
||
\\renewcommand*{\\bibnamedash}{%
|
||
\\bibsentence\\bibstring{idem\\thefield{gender}}}
|
||
% Hat/haben die Person(en) eines der zusätzlichen Werke nur herausgegeben, vor der Abkürzung Komma und Leerschlag einfügen
|
||
% Erfordert Angabe des Geschlechts in .bib, gender={sf} sn, pp
|
||
%\\renewbibmacro*{bbx:editor}[1]{%
|
||
\\newbibmacro*{bbx:editor}[1]{%
|
||
\\ifboolexpr{
|
||
test \\ifuseeditor%
|
||
and
|
||
not test {\\ifnameundef{editor}}
|
||
}
|
||
{\\usebibmacro{bbx:dashcheck}
|
||
{\\bibnamedash%
|
||
\\setunit{\\addcomma\\space}}
|
||
{\\printnames{editor}%
|
||
\\setunit{\\addcomma\\space}%
|
||
\\usebibmacro{bbx:savehash}}%
|
||
\\usebibmacro{#1}%
|
||
\\clearname{editor}%
|
||
\\setunit{\\addspace}}%
|
||
{\\global\\undef\\bbx@lasthash
|
||
\\usebibmacro{labeltitle}%
|
||
\\setunit*{\\addspace}}%
|
||
\\usebibmacro{date+extrayear}}
|
||
|
||
\\addbibresource{references.bib}
|
||
"))
|
||
(defcustom my-org-article-latex-header-biblatex default
|
||
"The default LaTeX biblatex setup."
|
||
:group 'my-org-export-article
|
||
:type '(string :tag "LaTeX class"))
|
||
)
|
||
|
||
(defvar my-org-article-latex-template-plist
|
||
(list
|
||
;; :fontsize (symbol-value 'my-org-article-latex-fontsize)
|
||
:fontsize my-org-article-latex-fontsize
|
||
:draft "\\setlength{\\overfullrule}{5pt}"
|
||
;; LANG REPLACEMENTS
|
||
:documentclass-en "english"
|
||
:documentclass-de "ngerman"
|
||
;;; FONTS
|
||
:babel-en "\\usepackage[english]{babel}"
|
||
:babel-de "\\usepackage[ngerman]{babel}"
|
||
:fontspec-en ""
|
||
:fontspec-ja "\\usepackage{luatexja-fontspec} % add japanese support using lualatex compiler"
|
||
:ruby-en ""
|
||
:ruby-ja "\\usepackage[CJK,overlap]{ruby} % support for FURIGANA - japanese"
|
||
;;; REFERENCES
|
||
:csquotes-en "\\usepackage[autostyle]{csquotes}"
|
||
:csquotes-de "\\usepackage[autostyle,german=quotes]{csquotes}"
|
||
;;; APPENDIX
|
||
:mtcselectlanguage-en ""
|
||
:mtcselectlanguage-de "\\mtcselectlanguage{german}"
|
||
;;; LISTINGS lstlistingname for the caption of listings and lstlistlistingname for the table of listings
|
||
:lstlistingname-en "\\renewcommand{\\lstlistlistingname}{List of Listings}"
|
||
:lstlistingname-de "\\renewcommand{\\lstlistingname}{Programmausdruck}\\renewcommand{\\lstlistlistingname}{Programmausdrucke}"
|
||
)
|
||
"Replacements.
|
||
:documentclass-xx used in `my-org-article-latex-default-class-options'
|
||
as %<<documentclass>> all other in `my-org-article-latex-header'
|
||
template replacements in `my-org-article-latex-template-value' IMPORTANT
|
||
for lang vars an 'en' version must be defined as a fallback for language
|
||
replacements.")
|
||
|
||
(defcustom my-org-article-latex-default-class-options
|
||
;; DIV: Satzspiegel
|
||
;; BCOR: Bindungskorrektur
|
||
;; captions: correct spacing for captions ABOVE the table
|
||
;; bibliography: add to toc
|
||
;; %titlepage: first page, cover page (invoking \maketitle)
|
||
;; %draft: display a block at the end of a line, which is too long (bad line break)
|
||
;; dvipsnames: colors
|
||
;; listof=entryprefix: to have e.g. Fig. in front of every to entry
|
||
"\
|
||
[
|
||
paper=a4,
|
||
fontsize=<<fontsize>>,
|
||
DIV=12,
|
||
BCOR=10mm,
|
||
headsepline,
|
||
%<<documentclass>>,
|
||
captions=tableheading,
|
||
bibliography=totoc,
|
||
listof=totoc,
|
||
dvipsnames,
|
||
]"
|
||
"The default LaTeX class options.
|
||
|
||
Replaces %<<...>> with values defined in
|
||
`my-org-article-latex-template-plist'
|
||
|
||
<<fontsize>> with :options-alist :article-fontsize (default in
|
||
`my-org-article-latex-fontsize')
|
||
"
|
||
:group 'my-org-export-article
|
||
:type '(string :tag "LaTeX class"))
|
||
|
||
(add-to-list 'org-latex-classes
|
||
;; (numbered-section . unnumbered-section)
|
||
'("koma-article" "\\documentclass{scrartcl}"
|
||
("\\section{%s}\\thispagestyle{plain}" .
|
||
"\\def\\mysectionname{%s}\\phantomsection\\addcontentsline{toc}{section}{\\mysectionname}\\section*{\\mysectionname}\\thispagestyle{plain}")
|
||
("\\subsection{%s}" .
|
||
"\\def\\mysubsectionname{%s}\\phantomsection\\addcontentsline{toc}{subsection}{\\mysubsectionname}\\subsection*{\\mysubsectionname}")
|
||
("\\subsubsection{%s}" .
|
||
"\\def\\mysubsubsectionname{%s}\\phantomsection\\addcontentsline{toc}{subsubsection}{\\mysubsubsectionname}\\subsubsection*{\\mysubsubsectionname}")
|
||
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
||
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
|
||
|
||
(defcustom my-org-article-latex-header
|
||
;; see also `my-org-article-latex-default-packages-alist'
|
||
"\
|
||
%<<draft>>
|
||
%<<babel>>
|
||
%<<fontspec>>
|
||
%<<lstlistingname>>
|
||
\\def\\nameappendix{Appendix}
|
||
%<<csquotes>>
|
||
" "Preamble options.
|
||
Inserted after `my-org-article-latex-default-packages-alist'.
|
||
Text like <<...>>> will be replaced according to
|
||
`my-org-article-latex-template-plist'"
|
||
:group 'my-org-export-article)
|
||
|
||
(defcustom my-org-article-latex-header-extra ""
|
||
"Preamble extra options."
|
||
:group 'my-org-export-article)
|
||
|
||
(defcustom my-org-article-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...
|
||
;; %pdfpagelabels,
|
||
;; pdfstartview=FitH, %% fit document to window width, {XYZ null null 1}
|
||
;; pdfpagemode=UseNone, %% do not display thumbnails
|
||
;; colorlinks=true, %% use true to enable colors below:
|
||
;; pdfborder=0 0 0, %% PDF display of links, if colorlinks=false. 0 0 0: nothing. 0 0 1: default.
|
||
;; %frenchlinks=false, %% small caps instead of colors
|
||
;; plainpages=false, %% false for Roman and Arabian numbers
|
||
;; hypertexnames=true, %% true for Roman and Arabian numbers; without hypertexnames it's just counting upwards; bei 4 -> iv
|
||
"\
|
||
\\makeatletter
|
||
\\let\\@old@wrindex=\\@wrindex
|
||
\\@ifpackageloaded{hyperref}{
|
||
\\hypersetup{%%
|
||
pdfauthor={%a},
|
||
pdftitle={%t},
|
||
pdfkeywords={%k},
|
||
pdfsubject={%d},
|
||
pdfcreator={%c},
|
||
pdflang={%L},
|
||
pdfproducer={LaTeX},
|
||
pdfstartview=FitH,
|
||
pdfpagemode=UseNone,
|
||
bookmarksopen=true,
|
||
bookmarksnumbered=true,
|
||
colorlinks=true,
|
||
linkcolor=black,
|
||
filecolor=darkblue,
|
||
menucolor=darkblue,
|
||
urlcolor=darkblue,
|
||
citecolor=black,
|
||
pdfborder=0 0 0,
|
||
plainpages=false,
|
||
hypertexnames=true,
|
||
}
|
||
}{}
|
||
\\let\\@wrindex=\\@old@wrindex
|
||
\\makeatother
|
||
"
|
||
"see `org-latex-hyperref-template'"
|
||
:group 'my-org-export-article
|
||
:type '(choice (const :tag "No template" nil)
|
||
(string :tag "Format string")))
|
||
|
||
(defcustom my-org-article-latex-default-packages-alist
|
||
;; additionals in `my-org-article-latex-header' babel, fontspec
|
||
'(
|
||
;; cell is of the format
|
||
;; ("options" "package" SNIPPET-FLAG COMPILERS)
|
||
;;; Font
|
||
("AUTO" "inputenc" t ("pdflatex"))
|
||
("utf8" "luainputenc" t ("lualatex"))
|
||
("T1" "fontenc" t ("pdflatex" "lualatex")) ;; font encoding: T1: latin modern, for ö etc. as single glyph
|
||
("" "kpfonts" t) ;; for lualatex it also needs fontenc
|
||
;;; page spacing
|
||
"\\special{papersize=210mm,297mm}"
|
||
"\\setlength{\\parskip}{6pt}" ;; half of the font size 12pt
|
||
"\\setlength{\\parindent}{0pt}" ;; no paragraph indentation
|
||
"\\setlength{\\textheight}{22.5cm}"
|
||
"\\setlength{\\marginparwidth}{1.5cm}" ;; space for margin notes"
|
||
;;; line spacing !before hyperref!
|
||
("" "setspace" nil) ;; !before hyperref! -> env spacing e.g. used for the list of ... sections
|
||
"\\onehalfspacing" ;; set line spacing to 1.5
|
||
"\\KOMAoptions{DIV=last}\\recalctypearea" ;; after changing font family update DIV settings
|
||
;; overful hboxes
|
||
"\\clubpenalty=10000"
|
||
"\\widowpenalty=10000"
|
||
"\\displaywidowpenalty=10000" ;; no single paragraph on a single page (either top or bottom)
|
||
|
||
"\\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}"
|
||
"\\pagestyle{fancy}"
|
||
"\\fancyhead{}"
|
||
"\\fancyfoot{}"
|
||
;; "% for twoside option: LE,RO"
|
||
"\\fancyhead[RO]{\\slshape \\leftmark}%"
|
||
"\\fancyfoot[C]{--~\\thepage~--}"
|
||
;; "%\\fancyfoot[RO] {\\thepage}"
|
||
"\\renewcommand{\\headrulewidth}{0.4pt}"
|
||
"\\renewcommand{\\footrulewidth}{0pt}"
|
||
"\\newlength\\FHoffset%"
|
||
;; "% Offset des Headers 0: bündig mit text"
|
||
"\\setlength\\FHoffset{0cm}"
|
||
"\\addtolength\\headwidth{1\\FHoffset}"
|
||
"\\fancyheadoffset{\\FHoffset}"
|
||
;; "% these lengths will control the headrule trimming to the left and right"
|
||
"\\newlength\\FHleft%"
|
||
"\\newlength\\FHright%"
|
||
;; "% here the trimmings are controlled by the user"
|
||
"\\setlength\\FHleft{-1cm}"
|
||
"\\setlength\\FHright{-1cm}"
|
||
;; "% The new definition of headrule that will take into acount the trimming(s)"
|
||
"\\newbox\\FHline%"
|
||
"\\setbox\\FHline=\\hbox{\\hsize=\\paperwidth%"
|
||
" \\hspace*{\\FHleft}%"
|
||
" \\rule{\\dimexpr\\headwidth-\\FHleft-\\FHright\\relax}{\\headrulewidth}\\hspace*{\\FHright}%"
|
||
"}"
|
||
"\\renewcommand\\headrule{\\vskip-.7\\baselineskip\\copy\\FHline}"
|
||
""
|
||
;; "% keine Linien auf Bilderseiten!"
|
||
"\\renewcommand{\\headrulewidth}{\\iffloatpage{0pt}{0.4pt}}"
|
||
;; ""
|
||
"\\renewcommand{\\sectionmark}[1]{"
|
||
"\\markboth{\\thesection{} #1}{\\thesection{} #1}"
|
||
"}"
|
||
"\\renewcommand{\\subsectionmark}[1]{"
|
||
"\\markright{\\thesubsection{} #1}"
|
||
"}"
|
||
;; ""
|
||
"\\fancypagestyle{plain}{"
|
||
"\\fancyhead{}"
|
||
"\\fancyfoot{}"
|
||
"\\renewcommand{\\headrulewidth}{0.4pt}"
|
||
"\\fancyfoot[C]{--~\\thepage~--}"
|
||
;; "%\\fancyfoot[RO] {\\thepage}"
|
||
"}"
|
||
;;; Lists
|
||
;; ("" "enumerate" nil) ;; already loaded?
|
||
"\\renewcommand{\\labelitemi}{--}" ;; 1st level dash instead of dot
|
||
"\\renewcommand{\\labelitemii}{\\(\\boldsymbol\\cdot\\)}" ;; 2nd level dot instead of dash
|
||
("inline" "enumitem" nil) ;; itemize option noitemsep
|
||
"\\setlist{nosep}" ;; set noitemsep as default
|
||
"\\setlist[1]{labelindent=\\parindent}" ;; start bullets at left margins
|
||
"\\setlist[itemize]{parsep=0pt,itemsep=0pt,leftmargin=*}"
|
||
"\\setlist[enumerate]{parsep=0pt,itemsep=0pt,leftmargin=*}"
|
||
;;; Figures and Tables and Listings
|
||
("" "float" nil) ;; adds placement H
|
||
;; "\restylefloat{table}" ;; not needed is seems
|
||
("\n font=small,\n labelfont={bf,up,sf},\n justification=raggedright,\n singlelinecheck=false,\n"
|
||
;; %textfont={it,up}, %format=plain, %indention=0cm,
|
||
"caption"
|
||
nil)
|
||
"\\captionsetup[table]{skip=.5em}"
|
||
"\\captionsetup[figure]{skip=10pt}"
|
||
"\\counterwithin{figure}{section}" ;; section-wise numbering
|
||
;;; - Tables
|
||
"\\counterwithin{table}{section}" ;; section-wise numbering
|
||
("" "booktabs" nil) ;; \toprule, \midrule, bottomrule
|
||
("" "longtable" nil) ;; multi-page tables
|
||
;; custom column types https://tex.stackexchange.com/a/12712
|
||
;; \let\newline\\ is to allow the use of \newline for manual line breaks within a cell
|
||
;; \arraybackslash is needed for the last column so the \\ is again correctly interpreted, otherwise we get: ! Extra alignment tab has been changed to \cr.
|
||
;; \hspace{0pt} is to allow the first word to be hyphenated
|
||
;; TODO: maybe package ragged2e for a better hyphenation?
|
||
("" "array" nil)
|
||
"\\newcolumntype{L}[1]{>{\\raggedright\\let\\newline\\\\\\arraybackslash\\hspace{0pt}}p{#1}<{}}" ;; fixed width column type (p) but left-aligned: L{width}
|
||
"\\newcolumntype{C}[1]{>{\\centering\\let\\newline\\\\\\arraybackslash\\hspace{0pt}}p{#1}<{}}" ;; fixed width column type (p) but center-aligned: C{width}
|
||
"\\newcolumntype{R}[1]{>{\\raggedleft\\let\\newline\\\\\\arraybackslash\\hspace{0pt}}p{#1}<{}}" ;; fixed width column type (p) but right-aligned: R{width}
|
||
("autolanguage" "numprint" nil) ;; alignment of numbers using column type n (numbers in math) and N (numbers in text)
|
||
;;; - Figures
|
||
("" "svg" nil) ;; uses Inkscape
|
||
;;; - Tikz
|
||
("" "tikz" t)
|
||
("" "gnuplot-lua-tikz" nil)
|
||
("" "pgfplots" t) ;; ,pgfmath ;; for \\begin{axis} !needs by tikz (backgrounds)
|
||
"\\usepgflibrary{shapes.geometric}"
|
||
"\\usepgfplotslibrary{patchplots}"
|
||
"\\usetikzlibrary{"
|
||
" arrows," ;; for arrow heads"
|
||
" backgrounds," ;; need package pgfplots
|
||
" calc," ;; % for manimulation of coordinates
|
||
" decorations.pathmorphing,"
|
||
" mindmap,"
|
||
" pgfplotsclickable," ;; %after pgfplots, for /pgfplots/annot/js fillColor
|
||
" positioning,"
|
||
;; " %shadings,"
|
||
" shadows,"
|
||
" shadows.blur,"
|
||
" shapes.multipart,"
|
||
" tikzmark," ;; \tikzmark{<name>} to define marker in e.g. tables for overlays like \tikz[remember picture] draw[overlay] (0,0) -- (pic cs:<name>);
|
||
"}"
|
||
;; highligh text
|
||
("" "soul" nil) ;; "% based on soul
|
||
;; % \\highlight[tikz-opts]{...} like:
|
||
;; % \\highlight{text}
|
||
;; % \\highlight[red]{text}
|
||
;; % \\highlight[green, draw=blue]{text}
|
||
"\\makeatletter
|
||
\\newcommand{\\defhighlighter}[3][]{%
|
||
\\tikzset{every highlighter/.style={color=#2, fill opacity=#3, #1}}%
|
||
}
|
||
\\defhighlighter{yellow}{.5}
|
||
\\newcommand{\\highlight@DoHighlight}{
|
||
\\fill [ decoration = {random steps, amplitude=1pt, segment length=15pt}
|
||
, outer sep = -15pt, inner sep = 0pt, decorate
|
||
, every highlighter, this highlighter ]
|
||
($(begin highlight)+(0,8pt)$) rectangle ($(end highlight)+(0,-3pt)$) ;
|
||
}
|
||
\\newcommand{\\highlight@BeginHighlight}{
|
||
\\coordinate (begin highlight) at (0,0) ;
|
||
}
|
||
\\newcommand{\\highlight@EndHighlight}{
|
||
\\coordinate (end highlight) at (0,0) ;
|
||
}
|
||
\\newdimen\\highlight@previous%
|
||
\\newdimen\\highlight@current%
|
||
\\DeclareRobustCommand*\\highlight[1][]{%
|
||
\\tikzset{this highlighter/.style={#1}}%
|
||
\\SOUL@setup%
|
||
%
|
||
\\def\\SOUL@preamble{%
|
||
\\begin{tikzpicture}[overlay, remember picture]
|
||
\\highlight@BeginHighlight
|
||
\\highlight@EndHighlight
|
||
\\end{tikzpicture}%
|
||
}%
|
||
%
|
||
\\def\\SOUL@postamble{%
|
||
\\begin{tikzpicture}[overlay, remember picture]
|
||
\\highlight@EndHighlight
|
||
\\highlight@DoHighlight
|
||
\\end{tikzpicture}%
|
||
}%
|
||
%
|
||
\\def\\SOUL@everyhyphen{%
|
||
\\discretionary{%
|
||
\\SOUL@setkern\\SOUL@hyphkern%
|
||
\\SOUL@sethyphenchar%
|
||
\\tikz[overlay, remember picture] \\highlight@EndHighlight ;%
|
||
}{%
|
||
}{%
|
||
\\SOUL@setkern\\SOUL@charkern%
|
||
}%
|
||
}%
|
||
%
|
||
\\def\\SOUL@everyexhyphen##1{%
|
||
\\SOUL@setkern\\SOUL@hyphkern%
|
||
\\hbox{##1}%
|
||
\\discretionary{%
|
||
\\tikz[overlay, remember picture] \\highlight@EndHighlight ;%
|
||
}{%
|
||
}{%
|
||
\\SOUL@setkern\\SOUL@charkern%
|
||
}%
|
||
}%
|
||
%
|
||
\\def\\SOUL@everysyllable{%
|
||
\\begin{tikzpicture}[overlay, remember picture]
|
||
\\path let \\p0 = (begin highlight), \\p1 = (0,0) in \\pgfextra
|
||
\\global\\highlight@previous=\\y0
|
||
\\global\\highlight@current =\\y1
|
||
\\endpgfextra (0,0) ;
|
||
\\ifdim\\highlight@current < \\highlight@previous
|
||
\\highlight@DoHighlight
|
||
\\highlight@BeginHighlight
|
||
\\fi
|
||
\\end{tikzpicture}%
|
||
\\the\\SOUL@syllable%
|
||
\\tikz[overlay, remember picture] \\highlight@EndHighlight ;%
|
||
}%
|
||
\\SOUL@%
|
||
}
|
||
\\makeatother
|
||
"
|
||
;;; - Lisitings
|
||
("" "listingsutf8" nil)
|
||
"\\AtBeginDocument{\\numberwithin{lstlisting}{section}}" ;; section-wise numbering
|
||
;; replacement of <<lstlistingname>> in `my-org-article-latex-header'
|
||
"\\lstdefinelanguage{conf}{}"
|
||
"\\lstdefinelanguage{org}{"
|
||
" morekeywords={:results, :session, :var, :noweb, :exports},"
|
||
" sensitive=false,"
|
||
" morestring=[b]\","
|
||
" morecomment=[l]{\\#},"
|
||
"}"
|
||
"\\lstset{" ;; fallback style
|
||
" extendedchars=\\true,"
|
||
" inputencoding=utf8/latin1," ;; if package listingsutf8 is used
|
||
;; " style=custom,"
|
||
;; " language=Matlab,"
|
||
" basicstyle=\\small\\ttfamily," ;; small, footnotesize, scriptsize
|
||
" keywordstyle=\\color{blue}," ;; \\bfseries
|
||
" commentstyle=\\color{dkgreen}," ;; \\itshape
|
||
" stringstyle=\\color{mauve},"
|
||
" numberstyle=\\tiny\\color{gray}," ;; \\ttfamily
|
||
" numbers=left,"
|
||
" numbersep=5pt,"
|
||
" breaklines=true,"
|
||
" breakatwhitespace=true,"
|
||
" tabsize=2,"
|
||
" xleftmargin=2em," ;; 2\parskip
|
||
" captionpos=t,"
|
||
" escapeinside={\\%*}{*)},"
|
||
" firstnumber=auto," ;; auto: Listings with identical names (case sensitive!) share a line counter / or number
|
||
;; " %identifierstyle=\\color{blue},"
|
||
;; " %stepnumber=2,
|
||
;; " %backgroundcolor=\\color{white},
|
||
;; " %frame=single,%trblTRBL,none|leftline|topline|bottomline|lines|single|shadowbox
|
||
;; " %frameround=ffff, % tf|rf|rf|rf NE,SE,SW,NW
|
||
;; " %rulecolor=\\color{black},
|
||
;; " %showspaces=false,
|
||
;; " %showstringspaces=false,
|
||
;; " %showtabs=false,
|
||
;; " %float,
|
||
;; " %breakindent=20pt,
|
||
;; " %title=\\lstname,
|
||
;; " %captionpos=b, % b: bottom
|
||
;; " %belowcaptionskip=1\\baselineskip,
|
||
;; " %texcl=true, % not with inputencoding utf/latin1 LATEX comment lines, for äöü...
|
||
;; " %escapebegin=\\begin{arab},escapeend=\\end{arab},
|
||
;; " %morekeywords={*,...},
|
||
;; " %deletekeywords={...},
|
||
"}"
|
||
;;; Index
|
||
;; define an index with \index{text}
|
||
;; or if another index is specified \index[otherindex]{text}
|
||
("" "imakeidx" nil)
|
||
;; %\renewcommand{\indexname}{Stichwortverzeichnis}
|
||
("totoc" "idxlayout" nil) ;; % avoid LaTeX bug 3126 (\twocolumn interfering with \topskip)
|
||
"\\indexsetup{"
|
||
" level=\\section*," ;; \section* is default for article class
|
||
" toclevel=section,"
|
||
;;" noclearpage,"
|
||
;;" othercode=\\addcontentsline{toc}{section}{\\indexname}" ;; toclevel and or makeindex option intoc does not seem to work. solved; 'problem' was idxlayout and not setting option totoc
|
||
"}"
|
||
"\\makeindex[intoc]"
|
||
;; "\\makeindex[intoc,name=name,title={Index of names}]" ;; having another index
|
||
;; %firstpagestyle=plain, % disabled when the package fancyhdr is loaded
|
||
;; %headers={\indexname}{\indexname} % Don’t use these keys if you use fancyhdr
|
||
;;; Glossaries (with acronym)
|
||
"\\usepackage["
|
||
" automake=immediate,"
|
||
" acronym,"
|
||
;; " nonumberlist,"
|
||
" nogroupskip,"
|
||
" nopostdot,"
|
||
" section=section,"
|
||
" translate=true,"
|
||
" toc,"
|
||
;; " savewrites,"
|
||
"]{glossaries}"
|
||
;; automake, % will run makeindex to create .gls, .acr files,
|
||
;; (? automake or automake=true will execute at the end of the document, for lualatex we need it before the command \makeglossaries, for this using automake=immediate (https://tex.stackexchange.com/a/468877))
|
||
;; to create .glo and .acn with latexmk see latexmkrc file
|
||
;; %nowarn,
|
||
;; %nomain,
|
||
;; %toc=true, % entry in toc
|
||
;; %style=altlist, % altlist: description beginns in new line
|
||
;; nonumberlist, % display no page number
|
||
;; nogroupskip, % no extra space for change of letter
|
||
;; acronym=true, % create a list of ancronyms
|
||
;; section=section, % in toc appears on a section level (subsection ...)
|
||
;; %description, % n changes the definition of \\newacronym to allow a description
|
||
;; %makeindex,
|
||
;; %xindy={language=german-duden,codepage=utf8} % mit makeglossaries.exe ?
|
||
;; %hyperfirst=false, %
|
||
;; % define a new glossary type \newglossary[⟨log-ext⟩]{⟨name⟩}{⟨in-ext⟩}{⟨out-ext⟩}{⟨title⟩}[⟨counter⟩]
|
||
;; "\\newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols}"
|
||
"\\newglossary[los.glg]{symbols}{los.gls}{los.glo}{List of Symbols}" ;; define a \glssymbolsgroupname. if this glossary should be considered an acronym, then add the label to glossaries option acronymlist, like aronymlist={main,symbols} or use \DeclareAcronymList{<list>} to add or use \SetAcronymLists{<list>} to replace
|
||
;; "\\glsaddkey{unit}{\\glsentrytext{\\glslabel}}{\\glsentryunit}{\\GLsentryunit}{\\glsunit}{\\Glsunit}{\\GLSunit}" ;; now a unit can be defined inside \newglossaryentry. But for list of symbols we use the symbol key.
|
||
"\\newglossarystyle{mysymbols}{
|
||
\\setlength\\LTleft{0pt}
|
||
\\setglossarystyle{long3colheader}
|
||
\\renewenvironment{theglossary}
|
||
%{\\begin{longtable}{lp{2cm}p{\\glsdescwidth}}}
|
||
{\\begin{longtable}{@{}lll@{}}}
|
||
{\\end{longtable}}
|
||
% \\renewcommand*{\\glossaryheader}{
|
||
% % \\textbf{Symbol} & \\textbf{Unit} & \\textbf{Name}\\\\
|
||
% % \\midrule[1pt]
|
||
% % \\addlinespace[2ex]
|
||
% \\endhead
|
||
% % \\bottomrule[1pt]
|
||
% \\endfoot
|
||
% }
|
||
\\renewcommand*{\\glossaryheader}{}
|
||
\\renewcommand*{\\glossentry}[2]{%
|
||
% first column could be also \\textbf{\\glsentryitem{##1}\\glstarget{##1}{\\glossentryname{##1}}}
|
||
\\glossentryname{##1} & \\glossentrysymbol{##1} & \\glossentrydesc{##1} \\tabularnewline}%
|
||
}"
|
||
"\\makeglossaries%"
|
||
;; "\\makenoidxglossaries%" ;; using \printnoidxglosssaries
|
||
;;; Glyphs & More
|
||
"\\DeclareUnicodeCharacter{2009}{\\,}" ;; convert unicode to latex command, thin-space
|
||
("" "eurosym" t)
|
||
"\\DeclareUnicodeCharacter{20AC}{\\euro{}}" ;; convert unicode character to latex command
|
||
("os=win" "menukeys" nil) ;; see also defined macro kbd using \keys
|
||
;; in math mode
|
||
"\\newcommand{\\ti}[1]{_\\mathrm{#1}}" ;; 'tiefstellen' as text with better spacing, Index
|
||
"\\newcommand{\\ho}[1]{^\\mathrm{#1}}" ;; 'hochstellen' as text with better spacing
|
||
"\\newcommand*{\\rom}[1]{\\mathrm{\\romannumeral #1}}" ;; \rom{2} -> ii
|
||
"\\makeatletter\\newcommand*{\\Rom}[1]{\\mathrm{\\expandafter\\@slowromancap\\romannumeral #1@}}\\makeatother" ;; \Rom{2} -> II
|
||
;;; - COLORS
|
||
("" "xcolor" t)
|
||
"\\definecolor{darkblue}{rgb}{0,0.15,0.35}" ;; used in hyperref, url links
|
||
"\\definecolor{dkgreen}{rgb}{0,0.6,0}" ;; used in listings
|
||
"\\definecolor{mauve}{rgb}{0.58,0,0.82}" ;; used in listings
|
||
;;; MATH custom symbols, math, chemistry
|
||
;; bold font, e.g. $\\boldsymbol{\\pi}$
|
||
;; negativ space: \\!, \\negmedspace, \\negthickspace
|
||
;; positive space: \\, \\: \\; ~ or \\quad and \\qquad
|
||
;; multiline limits, \\substack{...\\\\...}
|
||
;; \\overset{}{} and \\underset{}{} sets formula elements over or under each other
|
||
;; \\underbrace{a+b}_\\text{step 1}
|
||
;; \\overbrace{e^2 - \\pi}^\\text{step 2}
|
||
"\\numberwithin{equation}{section}"
|
||
;; manual numbering, z. B. 1.2 a
|
||
;; \\begin{equation*} \\tag{} \\end{equation*}
|
||
;; \\allowdisplaybreaks % global and local usable, e.g. for underful vboxes
|
||
;; ("" "fourier" nil)
|
||
("" "mathtools" t) ;; line underneath with text \\underbracket[1pt][0pt]{bla}_\\text{blo}
|
||
"\\newcommand\\Dfrac[2]{\\dfrac{\\displaystyle #1}{\\displaystyle #2}}"
|
||
"\\newcommand{\\slfrac}[2]{\\left.#1\\middle/#2\\right.}"
|
||
("" "xfrac" t) ;; defines \sfrac[<instance>]{<num>}[<sep>]{<denum>}
|
||
("" "nicefrac" t)
|
||
("" "faktor" t)
|
||
;; "% http://tex.stackexchange.com/questions/27591/extending-the-faktor-package/27735#27735"
|
||
;; "% \\newfaktor[*]{#2}[#3]{#4}[#5] -> #2/#4"
|
||
"\\DeclareDocumentCommand{\\Faktor}{s m O{0.5} m O{-0.5}}{%"
|
||
;; " % Store numerator"
|
||
" \\setbox0=\\hbox{\\scalebox{0.8}{\\ensuremath{#2\\vphantom{1}}}}%"
|
||
;; " % Store slash /"
|
||
" \\setbox1=\\hbox{\\ensuremath{\\diagup}}%"
|
||
;; " % Store denominator"
|
||
" \\setbox2=\\hbox{\\scalebox{0.8}{\\ensuremath{#4}}}%"
|
||
;; " % Numerator"
|
||
" \\raisebox{#3\\ht1}{\\usebox0}%"
|
||
;; " % Slash /"
|
||
" \\mkern-5mu\\ifthenelse{\\equal{#1}{\\BooleanTrue}}%"
|
||
;; " % regular \\faktor slash"
|
||
" {\\diagup}%"
|
||
;; " % tilted rule as a slash"
|
||
" {\\rotatebox{-44}{\\rule[#5\\ht2]{0.4pt}{-#5\\ht2+#3\\ht0+\\ht0}}}%"
|
||
" \\mkern-4mu%"
|
||
;; " % Denominator"
|
||
" \\raisebox{#5\\ht2}{\\usebox2}%"
|
||
"}"
|
||
;; units
|
||
("thinspace,thinqspace,squaren,Gray" "SIunits" t) ;; cannot be used together with amssymb
|
||
;; thinspace,
|
||
;; thinqspace, % use of \, (thin math space) as spacing
|
||
;; %mediumqspace, % use of \: (medium math space) as spacing
|
||
;; %thickqspace, % use of \; (thick math space) as spacing
|
||
;; squaren, % defines a new command \squaren that can be used instead of the SIunits command \square, to prevent errors with the defined \square command of the amssymb package. Or use amssymb to redefine \sqare
|
||
;; Gray, % defines a new command \gray that can be used instead of the SIunits command \gray, to prevent errors with the defined \gray command of the amssymb package. Or use pstricks to redefine \gray
|
||
;; %textstyle,
|
||
;; ("" "siunitx" nil) ;; runs in: ! TeX capacity exceeded, sorry [input stack size=5000].
|
||
;;"\\DeclareSIUnit{\\EUR}{\\text{\\euro}}"
|
||
("" "dsfont" t) ;; use \mathds{A} alternative zu mathbb
|
||
("" "MnSymbol" t) ;; incompatible with the amssymb and amsfonts, automatically loads the amsmath and textcomp. used for tensors
|
||
;; symbols using dsfont MnSymbol
|
||
"\\newcommand{\\field}[1]{\\ensuremath{\\mathds{#1}}}" ;; \field{X} defined with mathds
|
||
"\\newcommand{\\fA}{\\field{A}}" ;; \fA Affine field A
|
||
"\\newcommand{\\fC}{\\field{C}}" ;; \fC Complex field C
|
||
"\\newcommand{\\fFp}{\\ensuremath{\\field{F}_{\\!p}}}" ;; \fFp Finite field F_p
|
||
"\\newcommand{\\fFq}{\\ensuremath{\\field{F}_{\\!q}}}" ;; \fFq Finite field F_q
|
||
"\\newcommand{\\fGa}{\\ensuremath{\\field{G}_{a}}}" ;; \fGa Group scheme G_a
|
||
"\\newcommand{\\fK}{\\field{K}}" ;; \fK Generic field K (Körper)
|
||
"\\newcommand{\\fN}{\\field{N}}" ;; \fN Natural numbers N
|
||
"\\newcommand{\\fPj}{\\field{P}}" ;; \fPj Projective field P
|
||
"\\newcommand{\\fR}{\\field{R}}" ;; \fR Real numbers R
|
||
"\\newcommand{\\fQ}{\\field{Q}}" ;; \fQ Rational numbers Q
|
||
"\\newcommand{\\fI}{\\field{I}}" ;; \fI Irrational numbers I
|
||
"\\newcommand{\\fZ}{\\field{Z}}" ;; \fZ Integers Z
|
||
"\\newcommand{\\Def}{\\field{D}}" ;; \Def Domain of a function (Definitionsbereich)
|
||
"\\newcommand{\\LM}{\\field{L}}" ;; \LM Solution set (Lösungsmenge)
|
||
"\\newcommand{\\fdg}{\\;|\\;}" ;; \fdg 'für die gilt'
|
||
"\\newcommand*{\\qed}{\\hfill\\ensuremath{\\blacksquare}}" ;; \qed Q.E.D. quod erat demonstrandum "what was to be shown" -> "which was to be demonstrated"
|
||
"\\newcommand*\\euler{\\mathrm{e}}" ;; \euler e
|
||
("" "xspace" t) ;; for \deg
|
||
"\\renewcommand{\\deg}{\\ensuremath{^{\\circ}}\\xspace}" ;; for text \deg ° degree
|
||
"\\newcommand\\degC{{\\,^{\\circ}\\mathrm{C}}}" ;; \degC °C
|
||
"\\newcommand\\sins{{\\mathrm{s}}}" ;; \sins short sin: s
|
||
"\\newcommand\\coss{{\\mathrm{c}}}" ;; \coss short cos: c
|
||
;; matrix
|
||
"\\newcommand{\\T}{{\\mathrm{T}}\\!}" ;; \T Transpose operator
|
||
"\\newcommand{\\TF}{{\\raisebox{-0.5ex}{$\\sim$}}}" ;; \TF sign for transfomed values: low tilde
|
||
"\\newcommand{\\adj}{{\\mathrm{H}}}" ;; \adj Adjoint operator
|
||
"\\newcommand*\\dif{\\mathop{}\\!\\mathrm{d}}" ;; \dif
|
||
"\\newcommand*\\E{\\ensuremath{\\mathrm{E}}}" ;; \E
|
||
"\\providecommand{\\norm}[1]{\\lVert #1 \\rVert}" ;; \norm{x} ||x||
|
||
"\\providecommand{\\abs}[1]{\\lvert #1 \\rvert}" ;; \abs{x} |x|
|
||
"\\providecommand{\\innerProd}[2]{\\langle #1, #2\\rangle}" ;; \innerProd{x}{y} <x,y>
|
||
;; Operators
|
||
"\\DeclareMathOperator{\\Bild}{Bild}" ;; \Bild Map of a function (mapping, transformation)
|
||
"\\DeclareMathOperator{\\rank}{rank}" ;; \rank Rank of a matrix
|
||
"\\DeclareMathOperator{\\tr}{tr}" ;; \tr Matrix trace
|
||
"\\DeclareMathOperator{\\dev}{dev}" ;; \dev Matrix deviation
|
||
"\\DeclareMathOperator{\\var}{var}" ;; \var Variance
|
||
"\\DeclareMathOperator{\\grad}{grad}" ;; \(\grad u\) = grad u
|
||
"\\DeclareMathOperator{\\divergence}{div}" ;; \(\divergence u\) = div u
|
||
"\\DeclareMathOperator{\\rot}{rot}" ;; \(\rot u\) = rot u
|
||
"\\DeclareMathOperator{\\diag}{diag}" ;; \diag Diagonal matrix
|
||
"\\DeclareMathOperator{\\adjugate}{adj}" ;; \adjugate Classical adjoint (adjugate)
|
||
;; others
|
||
;; % old \newcommand{\corresponds}{\ensuremath{\stackrel{\wedge}{=} \hat{=} \mathop{\hat{=}} \substack{\wedge\\=} \mathrel{\widehat{=}} } \^{=} }
|
||
"\\newcommand*\\corresponds{\\mbox{\\kern0em\\raisebox{-.5ex}{\\Large\\^{}}\\kern-.55em\\raisebox{-.1ex}{=}}\\ }"
|
||
"\\newcommand*{\\dt}[1]{\\overset{\\mbox{\\large\\bfseries .}}{#1}}"
|
||
"\\newcommand*{\\ddt}[1]{\\overset{\\mbox{\\large\\bfseries .\\hspace{-0.1ex}.}}{#1}}"
|
||
"\\newcommand*{\\Eval}[3]{{\\left.#1\\phantom{\\Big|}\\!\\!\\right\\rvert_{#2}^{#3}}}"
|
||
;; tensors
|
||
("" "accents" t)
|
||
("" "ushort" t)
|
||
;; ("" "ulem" nil) ;; % not for math mode, too much space below with uuline; for tensor
|
||
;; under-line version
|
||
"\\newcommand{\\tensor}[1]{\\ensuremath{{\\boldsymbol{#1}}}}"
|
||
"\\newcommand{\\tensorI}[1]{\\ensuremath{\\ushort{{\\boldsymbol{#1}}}}}"
|
||
"\\newcommand{\\tensorII}[1]{\\ensuremath{\\ushortd{{\\boldsymbol{#1}}}}}"
|
||
"\\newcommand{\\tensorIII}[1]{\\ensuremath{\\underaccent{3}{\\underaccent{\\tilde}{{\\boldsymbol{#1}}}}}}"
|
||
"\\newcommand{\\tensorIV}[1]{\\ensuremath{\\underaccent{4}{\\underaccent{\\tilde}{{\\boldsymbol{#1}}}}}}"
|
||
;; bm version
|
||
;; ("" "bm" nil) ;; % load bm after amsmath and after your font packages!; for tensor
|
||
;; "%\\newcommand{\\tensorI}[1]{\\ensuremath{\\uline{\\bm{#1}}}}"
|
||
;; "%\\newcommand{\\tensorII}[1]{\\ensuremath{\\uuline{\\bm{#1}}}}"
|
||
;; "%\\newcommand{\\tensorIII}[1]{\\ensuremath{\\underaccent{3}{\\underaccent{\\tilde}{\\bm{#1}}}}}"
|
||
;; "%\\newcommand{\\tensorIV}[1]{\\ensuremath{\\underaccent{4}{\\underaccent{\\tilde}{\\bm{#1}}}}}"
|
||
;; arrow version needs MnSymbol and tikz
|
||
"\\newcommand{\\tensori}[1]{
|
||
\\tikz[baseline, anchor=base,inner sep=0pt]{
|
||
\\node{\\ensuremath{\\phantom{#1\\vphantom{\\overrightharpoon{b}}}}};
|
||
\\node[overlay]{ \\ensuremath{ \\overrightharpoon{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } };
|
||
}
|
||
}"
|
||
"\\newcommand{\\tensorii}[1]{
|
||
\\tikz[baseline, anchor=base,inner sep=0pt]{
|
||
\\node{\\ensuremath{\\phantom{#1\\vphantom{\\overrightharpoon{b}}}}};
|
||
\\node[overlay]{ \\ensuremath{ \\overrightharpoon{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } };
|
||
\\node[overlay]{ \\reflectbox{ \\ensuremath{ \\overrightharpoon{ \\phantom{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } } } };
|
||
}
|
||
}"
|
||
"\\newcommand{\\tensoriii}[1]{
|
||
\\tikz[baseline, anchor=base,inner sep=0pt]{
|
||
\\node{\\ensuremath{\\phantom{#1\\vphantom{\\overrightharpoon{b}}}}};
|
||
\\node[overlay]{ \\ensuremath{ \\overrightarrow{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } };
|
||
\\node[overlay]{ \\reflectbox{ \\ensuremath{ \\overrightharpoon{ \\phantom{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } } } };
|
||
}
|
||
}"
|
||
"\\newcommand{\\tensoriv}[1]{
|
||
\\tikz[baseline, anchor=base,inner sep=0pt]{
|
||
\\node{\\ensuremath{\\phantom{#1\\vphantom{\\overrightharpoon{b}}}}};
|
||
\\node[overlay]{ \\ensuremath{ \\overrightarrow{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } };
|
||
\\node[overlay]{ \\reflectbox{ \\ensuremath{ \\overrightarrow{ \\phantom{ \\mbox{\\ensuremath{\\boldsymbol{#1}}\\vphantom{b}} } } } } };
|
||
}
|
||
}"
|
||
;;; ToC
|
||
;; !do not wrap toc in env spacing (package setspace), this will overwrite defined skips!
|
||
;; e.g. in \\RedeclareSectionCommand[tocbeforeskip=2.25em plus 1pt, ...]{section}
|
||
;; ("" "tocbasic" nil)
|
||
"\\KOMAoptions{sectionentrydots=true}"
|
||
"\\DeclareTOCStyleEntry[beforeskip=.7em]{section}{section}" ;; set spacing between section entries inside toc
|
||
"\\setkomafont{sectionentrypagenumber}{\\normalfont\\normalcolor}"
|
||
("" "scrwfile" nil ("pdflatex")) ;; avoid trouble with the limited number of write handles ('No room for new \\write')
|
||
;;; - Section ToC (especially for appendix)
|
||
"\\makeatletter"
|
||
"\\newif\\ifusesectiontoc%" ;; Switch to tell \\addtocentrydefault to not only make entries to the toc-file but also to the current section-toc-file
|
||
"\\newcommand*{\\sectiontoc}{%" ;; new command to generate and show a section toc
|
||
" \\usesectiontoctrue%" ;; switch on section-toc-entries
|
||
" \\edef\\ext@subtoc{toc\\thesection}%" ;; extension of the section-toc-file, e.g., toc1.1
|
||
" \\expandafter\\DeclareNewTOC\\expandafter{\\ext@subtoc}%" ;; declare a new toc file
|
||
" \\begin{minipage}{.9\\linewidth}"
|
||
" \\value{tocdepth}=\\subsectiontocdepth%" ;; we want entries down to subsection
|
||
" \\expandafter\\listoftoc\\expandafter*\\expandafter{\\ext@subtoc}%" ;; show the toc without any heading
|
||
" \\end{minipage}\\par"
|
||
" \\bigskip\\noindent%" ;; add some vertical space after the toc and do not indent the following text
|
||
"}"
|
||
("" "xpatch" nil)
|
||
"\\xapptocmd\\addtocentrydefault{%" ;; patch the KOMA-Script's generic toc entry generator
|
||
" \\ifusesectiontoc%" ;; if section toc entries should be generated
|
||
" \\expandafter\\tocbasic@addxcontentsline\\expandafter{\\ext@subtoc}{#1}{#2}{#3}%" ;; do it
|
||
" \\fi"
|
||
"}{}{}"
|
||
"\\xpretocmd\\section{\\usesectiontocfalse}{}{}%" ;; automatically switch of section toc entries at start of every \\section
|
||
"\\makeatother"
|
||
;;; - Appendix (main section unnumbered t and children unnumbered nil)
|
||
("" "minitoc" nil) ;; to hide toc elements in maon toc but have them in a section toc and keep them in hyperref
|
||
;; ("" "appendix" nil)
|
||
;; "\\PassOptionsToPackage{hyphens}{url}" ;; line break of long urls (url package with [hyphens] option, will be loaded by hyperref)
|
||
;;; pdf imports !before tocstyle/tocbasic!
|
||
("" "pdfpages" nil)
|
||
("" "pdflscape" nil)
|
||
;;; Other
|
||
("" "xurl" nil) ;; line break of long urls
|
||
("" "hyperref" nil)
|
||
;; ("" "graphicx" t)
|
||
;; ("" "grffile" t)
|
||
;; ("" "wrapfig" nil)
|
||
;; ("" "rotating" nil)
|
||
;; ("normalem" "ulem" t)
|
||
;; ("" "amsmath" t)
|
||
;; ("" "textcomp" t)
|
||
;; ("" "amssymb" t)
|
||
;; ("" "capt-of" nil)
|
||
)
|
||
"See `org-latex-default-packages-alist'."
|
||
:group 'my-org-export-article
|
||
;;:set 'org-set-packages-alist
|
||
;;:get 'org-get-packages-alist
|
||
:version "26.1"
|
||
:package-version '(Org . "8.3")
|
||
:type '(repeat
|
||
(choice
|
||
(list :tag "options/package pair"
|
||
(string :tag "options")
|
||
(string :tag "package")
|
||
(boolean :tag "Snippet")
|
||
(choice
|
||
(const :tag "For all compilers" nil)
|
||
(repeat :tag "Allowed compiler" string)))
|
||
(string :tag "A line of LaTeX"))))
|
||
|
||
(defcustom my-org-article-latex-packages-alist nil
|
||
"See `org-latex-packages-alist'."
|
||
:group 'my-org-export-article
|
||
;;:set 'org-set-packages-alist
|
||
;;:get 'org-get-packages-alist
|
||
:type '(repeat
|
||
(choice
|
||
(list :tag "options/package pair"
|
||
(string :tag "options")
|
||
(string :tag "package")
|
||
(boolean :tag "Snippet"))
|
||
(string :tag "A line of LaTeX"))))
|
||
|
||
|
||
;;; Template
|
||
(defun my-org-article-latex-template-value (property &optional suffix suffix-fallback)
|
||
"Return PROPERTY value defined in `my-org-article-latex-template-plist'.
|
||
|
||
If SUFFIX is a string and not empty (e.g. \"de\") it is concat to
|
||
property with - (i.e. \"-de\") and returned if found, otherwise if
|
||
SUFFIX is not found will return the -SUFFIX-FALLBACK version.
|
||
|
||
Example:
|
||
(my-org-article-latex-template-value :documentclass-en)
|
||
\"english\"
|
||
(my-org-article-latex-template-value :documentclass-de)
|
||
\"ngerman\"
|
||
(my-org-article-latex-template-value :documentclass \"de\")
|
||
\"ngerman\"
|
||
(my-org-article-latex-template-value :documentclass \"xx\" \"en\")
|
||
\"english\"
|
||
(my-org-article-latex-template-value :documentclass \"xx\" \"xx\")
|
||
\"nil\"
|
||
(my-org-article-latex-template-value :documentclass \"xx\")
|
||
\"nil\"
|
||
(my-org-article-latex-template-value xx)
|
||
\"nil\""
|
||
(if suffix
|
||
;; suffix (language) replacements
|
||
(let ((value (plist-get
|
||
my-org-article-latex-template-plist
|
||
(intern (concat (symbol-name property) "-" suffix))))
|
||
(suffix-fallback (or suffix-fallback "en")))
|
||
(if value
|
||
value
|
||
(plist-get
|
||
my-org-article-latex-template-plist
|
||
(intern (concat (symbol-name property) "-" suffix-fallback)))))
|
||
;; direct preplacements
|
||
(plist-get my-org-article-latex-template-plist property)))
|
||
|
||
;;;###autoload
|
||
(defun my-org-article-latex-make-preamble (info &optional template snippet?)
|
||
"See `org-latex-make-preamble'.
|
||
Uses also `my-org-article-latex-template-value' with
|
||
`my-org-article-latex-template-plist' to inserts placeholders."
|
||
(let* ((class (plist-get info :latex-class))
|
||
(lang (plist-get info :language))
|
||
(class-template
|
||
(or template
|
||
(let* (;; single replace
|
||
;; (class-options
|
||
;; (string-replace
|
||
;; "%<<documentclass>>"
|
||
;; (my-org-article-latex-template-value :documentclass lang \"en\")
|
||
;; (plist-get info :latex-class-options)))
|
||
;; multi replace
|
||
(class-options
|
||
(s-replace-all
|
||
(list
|
||
(cons "%<<documentclass>>"
|
||
(my-org-article-latex-template-value :documentclass lang "en"))
|
||
(cons "<<fontsize>>"
|
||
(plist-get info :article-fontsize)))
|
||
(plist-get info :latex-class-options)))
|
||
(header (nth 1 (assoc class (plist-get info :latex-classes)))))
|
||
(and (stringp header)
|
||
(if (not class-options) header
|
||
(replace-regexp-in-string
|
||
"^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
|
||
class-options header t nil 1))))
|
||
(user-error "Unknown LaTeX class `%s'" class))))
|
||
(org-latex-guess-polyglossia-language
|
||
(org-latex-guess-babel-language
|
||
(org-latex-guess-inputenc
|
||
(org-element-normalize-string
|
||
(org-splice-latex-header
|
||
class-template
|
||
(org-latex--remove-packages my-org-article-latex-default-packages-alist info)
|
||
(org-latex--remove-packages my-org-article-latex-packages-alist info)
|
||
snippet?
|
||
(mapconcat #'org-element-normalize-string
|
||
(list (s-replace-all
|
||
(list
|
||
;; if draft is set in keyword options then replace otherwise remove placeholder
|
||
(if (plist-get info :article-draft)
|
||
(cons "%<<draft>>"
|
||
(my-org-article-latex-template-value :draft))
|
||
(cons "%<<draft>>" ""))
|
||
(cons "%<<babel>>"
|
||
(my-org-article-latex-template-value :babel lang "en"))
|
||
(cons "%<<fontspec>>"
|
||
(my-org-article-latex-template-value :fontspec lang "en"))
|
||
(cons "%<<ruby>>"
|
||
(my-org-article-latex-template-value :ruby lang "en"))
|
||
(cons "%<<biblatex>>"
|
||
(my-org-article-latex-template-value :biblatex lang "en"))
|
||
(cons "%<<csquotes>>"
|
||
(my-org-article-latex-template-value :csquotes lang "en"))
|
||
(cons "%<<mtcselectlanguage>>"
|
||
(my-org-article-latex-template-value :mtcselectlanguage lang "en"))
|
||
(cons "%<<lstlistingname>>"
|
||
(my-org-article-latex-template-value :lstlistingname lang "en")))
|
||
(plist-get info :latex-header))
|
||
(and (not snippet?)
|
||
(plist-get info :latex-header-extra)))
|
||
""))))
|
||
info)
|
||
info)))
|
||
|
||
(defun my-org-article-latex-template (contents info)
|
||
"See `org-latex-template'"
|
||
(let ((title (org-export-data (plist-get info :title) info))
|
||
(spec (org-latex--format-spec info)))
|
||
(concat
|
||
;; Time-stamp.
|
||
(and (plist-get info :time-stamp-file)
|
||
(format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
|
||
;; LaTeX compiler.
|
||
(org-latex--insert-compiler info)
|
||
;; Document class and packages.
|
||
(my-org-article-latex-make-preamble info)
|
||
;; Possibly limit depth for headline numbering.
|
||
(let ((sec-num (plist-get info :section-numbers)))
|
||
(when (integerp sec-num)
|
||
(format "\\setcounter{secnumdepth}{%d}\n" sec-num)))
|
||
;; biblatex
|
||
(format "%s" (plist-get info :article-biblatex))
|
||
;; Author.
|
||
(let ((author (and (plist-get info :with-author)
|
||
(let ((auth (plist-get info :author)))
|
||
(and auth (org-export-data auth info)))))
|
||
(email (and (plist-get info :with-email)
|
||
(org-export-data (plist-get info :email) info))))
|
||
(cond ((and author email (not (string= "" email)))
|
||
(format "\\author{%s\\thanks{%s}}\n" author email))
|
||
((or author email) (format "\\author{%s}\n" (or author email)))))
|
||
;; Date.
|
||
(let ((date (and (plist-get info :with-date) (org-export-get-date info))))
|
||
(format "\\date{%s}\n" (org-export-data date info)))
|
||
;; Title and subtitle.
|
||
(let* ((subtitle (plist-get info :subtitle))
|
||
(formatted-subtitle
|
||
(when subtitle
|
||
(format (plist-get info :latex-subtitle-format)
|
||
(org-export-data subtitle info))))
|
||
(separate (plist-get info :latex-subtitle-separate)))
|
||
(concat
|
||
(format "\\title{%s%s}\n" title
|
||
(if separate "" (or formatted-subtitle "")))
|
||
(when (and separate subtitle)
|
||
(concat formatted-subtitle "\n"))))
|
||
;; Hyperref options.
|
||
(let ((template (plist-get info :latex-hyperref-template)))
|
||
(and (stringp template)
|
||
(format-spec template spec)))
|
||
;; custom variables
|
||
(let* ((title (car (plist-get info :title)))
|
||
(subtitle (car (plist-get info :subtitle)))
|
||
(author (car (plist-get info :author)))
|
||
(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)))
|
||
;; use 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\\mytitle{%s}\n" title)
|
||
(format "\\def\\mysubtitle{%s}\n" subtitle)
|
||
(format "\\def\\myauthor{%s}\n" author)
|
||
(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.
|
||
(let* ((title-command (plist-get info :latex-title-command))
|
||
(command (and (stringp title-command)
|
||
(format-spec title-command spec))))
|
||
(org-element-normalize-string
|
||
(cond ((not (plist-get info :with-title)) nil)
|
||
((string= "" title) nil)
|
||
((not (stringp command)) nil)
|
||
((string-match "\\(?:[^%]\\|^\\)%s" command)
|
||
(format command title))
|
||
(t command))))
|
||
;; Table of contents.
|
||
(let ((depth (plist-get info :with-toc)))
|
||
(when depth
|
||
(concat (when (integerp depth)
|
||
(format "\\setcounter{tocdepth}{%d}\n" depth))
|
||
(plist-get info :latex-toc-command))))
|
||
;; Document's body.
|
||
(concat (plist-get info :article-opening) "\n")
|
||
contents
|
||
(concat (plist-get info :article-closing) "\n")
|
||
;; references
|
||
;; Creator.
|
||
(and (plist-get info :with-creator)
|
||
(concat (plist-get info :creator) "\n"))
|
||
;; Document end.
|
||
"\\end{document}")))
|
||
|
||
;;;###autoload
|
||
(defun my-org-article-latex-export-to-latex
|
||
(&optional async subtreep visible-only body-only ext-plist)
|
||
"See `org-latex-export-to-latex'"
|
||
(interactive)
|
||
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
|
||
(org-export-to-file 'article-latex outfile
|
||
async subtreep visible-only body-only ext-plist)))
|
||
|
||
;;;###autoload
|
||
(defun my-org-article-latex-export-to-pdf
|
||
(&optional async subtreep visible-only body-only ext-plist)
|
||
"See `org-latex-export-to-pdf'"
|
||
(interactive)
|
||
(let ((outfile (org-export-output-file-name ".tex" subtreep)))
|
||
(org-export-to-file 'article-latex outfile
|
||
async subtreep visible-only body-only ext-plist
|
||
(lambda (file) (org-latex-compile file)))))
|
||
|
||
;;;###autoload
|
||
(defun my-org-article-latex-publish-to-latex (plist filename pub-dir)
|
||
"Publish an Org file to LaTeX.
|
||
|
||
FILENAME is the filename of the Org file to be published. PLIST
|
||
is the property list for the given project. PUB-DIR is the
|
||
publishing directory.
|
||
|
||
Return output file name."
|
||
(org-publish-org-to 'article-latex filename ".tex" plist pub-dir))
|
||
|
||
;;;###autoload
|
||
(defun my-org-article-latex-publish-to-pdf (plist filename pub-dir)
|
||
"Publish an Org file to PDF (via LaTeX).
|
||
|
||
FILENAME is the filename of the Org file to be published. PLIST
|
||
is the property list for the given project. PUB-DIR is the
|
||
publishing directory.
|
||
|
||
Return output file name."
|
||
;; Unlike to `org-latex-publish-to-latex', PDF file is generated
|
||
;; in working directory and then moved to publishing directory.
|
||
(org-publish-attachment
|
||
plist
|
||
;; Default directory could be anywhere when this function is
|
||
;; called. We ensure it is set to source file directory during
|
||
;; compilation so as to not break links to external documents.
|
||
(let ((default-directory (file-name-directory filename)))
|
||
(org-latex-compile
|
||
(org-publish-org-to
|
||
'article-latex filename ".tex" plist (file-name-directory filename))))
|
||
pub-dir))
|
||
|
||
|
||
;; HTML
|
||
(org-export-define-derived-backend 'article-html 'tufte-html
|
||
|
||
:menu-entry
|
||
'(?h ?a
|
||
((?a "To HTML-article file" my-org-article-html-export-to-html)
|
||
(?A "To HTML-article file and open"
|
||
(lambda (a s v b)
|
||
(if a (my-org-article-html-export-to-html t s v b)
|
||
(org-open-file (my-org-article-html-export-to-html nil s v b)))))))
|
||
|
||
:options-alist
|
||
'((:headline-levels nil "H" my-org-article-export-headline-levels)
|
||
(:with-sub-superscript nil "^" my-org-article-export-with-sub-superscripts)
|
||
(:with-toc nil "toc" my-org-article-export-with-toc)
|
||
(:html-doctype "HTML_DOCTYPE" nil my-org-article-html-doctype)
|
||
(:html-head "HTML_HEAD" nil my-org-article-html-head newline))
|
||
|
||
;;:translate-alist
|
||
;;'((template . my-org-article-html-template))
|
||
)
|
||
|
||
|
||
;;; User Configuration Variables
|
||
|
||
;;;; Template :: Generic
|
||
|
||
(defcustom my-org-article-html-doctype "html5"
|
||
"See `org-html-doctype'."
|
||
:group 'my-org-export-article
|
||
:version "24.4"
|
||
:package-version '(Org . "8.0")
|
||
:type (append
|
||
'(choice)
|
||
(mapcar (lambda (x) `(const ,(car x))) org-html-doctype-alist)
|
||
'((string :tag "Custom doctype" ))))
|
||
|
||
;;;; Template :: Styles
|
||
|
||
(defcustom my-org-article-html-head "
|
||
<style type=\"text/css\">
|
||
/*<![CDATA[*/
|
||
/*
|
||
/* HTML-STYLE modify org css
|
||
*/
|
||
#content {
|
||
max-width: unset;
|
||
}
|
||
pre {
|
||
background-color: unset;
|
||
}
|
||
|
||
/*
|
||
/* HTML-STYLE
|
||
*/
|
||
/* use calc with spaces! */
|
||
body { /* default pixel size: 19px */
|
||
background: #292b2e;
|
||
color: #b2b2b2;
|
||
padding-left: 12.5%;
|
||
counter-reset: sidenote-counter;
|
||
}
|
||
h1, h2, h3 {
|
||
font-weight: 400;
|
||
}
|
||
.title {
|
||
text-align: left;
|
||
}
|
||
#content p, #content dl, .org-src-container, div>.MathJax_Display, #postamble {
|
||
width: 55%;
|
||
}
|
||
pre.example {
|
||
width: calc(55% - 4.2em);
|
||
}
|
||
div>.org-ul { /* total width 55% */
|
||
padding-left: 2.5%;
|
||
width: 52.5%;
|
||
}
|
||
div>.org-ul ul { /* total width 100% (nasted) */
|
||
padding-left: 5%;
|
||
width: 95%;
|
||
}
|
||
div .org-ol { /* all list blocks */
|
||
list-style: inside decimal;
|
||
text-indent: -1em;
|
||
padding-left: 1em;
|
||
}
|
||
div>.org-ol { /* only 1st list block, total width 55% */
|
||
padding-left: 1em;
|
||
width: calc(55% - 1em);
|
||
}
|
||
a:link { /* unvisited link */
|
||
color: #2aa1ae;
|
||
}
|
||
a:visited { /* visited link */
|
||
color: #4f97d7;
|
||
}
|
||
a:hover { /* mouse over link */
|
||
color: #ce537a;
|
||
}
|
||
a:active { /* selected link */
|
||
color: #ECEFF1;
|
||
}
|
||
/* strong {
|
||
color: #bc6ec5;
|
||
} */
|
||
#table-of-contents ul {
|
||
list-style: none;
|
||
}
|
||
#table-of-contents>div>ul {
|
||
padding-left: 0;
|
||
}
|
||
#table-of-contents>div>ul>li>ul {
|
||
padding-left: 1em; /* 0.8em #. + 0.4em space */
|
||
}
|
||
#table-of-contents>div>ul>li>ul>li>ul {
|
||
padding-left: 2em; /* 2*0.8em #.#. + 0.4em space */
|
||
}
|
||
.figure>p, pre.src, .MathJax_Display {
|
||
overflow-x: auto;
|
||
overflow-y: hidden;
|
||
}
|
||
pre.src::before {
|
||
background-color: #292b2e;
|
||
border: 1px solid #b2b2b2;
|
||
top: -5px;
|
||
}
|
||
#postamble {
|
||
border-top: 1px solid #b2b2b2;
|
||
}
|
||
@media (max-width: 760px) {
|
||
body {
|
||
padding-left: 0;
|
||
}
|
||
div>.org-ul, div>.org-ul ul {
|
||
padding-left: 1em;
|
||
width: auto;
|
||
}
|
||
div>.org-ol {
|
||
width: auto;
|
||
}
|
||
}
|
||
@media print {
|
||
body {
|
||
padding-left: 0;
|
||
}
|
||
#content p, .org-src-container, pre.example, #postamble {
|
||
width: auto;
|
||
}
|
||
div>.org-ul, div>.org-ul ul {
|
||
padding-left: 1em;
|
||
width: auto;
|
||
}
|
||
div>.org-ol {
|
||
width: auto;
|
||
}
|
||
h1, h2, h3, h4, h5 {
|
||
page-break-after: avoid;
|
||
page-break-inside: avoid;
|
||
}
|
||
h2 {
|
||
page-break-before: always;
|
||
}
|
||
#table-of-contents>h2, #list-of-tables>h2, #list-of-listings>h2, #list-of-symbols {
|
||
page-break-before: auto;
|
||
}
|
||
h2+div>p, h3+div>p, h4+div>p {
|
||
page-break-before: avoid;
|
||
}
|
||
h2+div>p~p, h3+div>p~p, h4+div>p~p {
|
||
page-break-before: auto;
|
||
}
|
||
a {
|
||
page-break-inside: avoid;
|
||
}
|
||
a[href^=http]:after {
|
||
page-break-inside: avoid;
|
||
content: \" <\" attr(href) \"> \";
|
||
}
|
||
}
|
||
|
||
/*
|
||
/* HTML-STYLE-TUFTE
|
||
*/
|
||
@charset \"UTF-8\";
|
||
|
||
/* Import ET Book styles
|
||
adapted from https://github.com/edwardtufte/et-book/blob/gh-pages/et-book.css */
|
||
/*
|
||
@font-face {
|
||
font-family: \"et-book\";
|
||
src: url(\"et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot\");
|
||
src: url(\"et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot?#iefix\") format(\"embedded-opentype\"),
|
||
url(\"et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff\") format(\"woff\"),
|
||
url(\"et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf\") format(\"truetype\"),
|
||
url(\"et-book/et-book-roman-line-figures/et-book-roman-line-figures.svg#etbookromanosf\") format(\"svg\");
|
||
font-weight: normal;
|
||
font-style: normal; }
|
||
|
||
@font-face {
|
||
font-family: \"et-book\";
|
||
src: url(\"et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot\");
|
||
src: url(\"et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot?#iefix\") format(\"embedded-opentype\"),
|
||
url(\"et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff\") format(\"woff\"),
|
||
url(\"et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf\") format(\"truetype\"),
|
||
url(\"et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.svg#etbookromanosf\") format(\"svg\");
|
||
font-weight: normal;
|
||
font-style: italic; }
|
||
|
||
@font-face {
|
||
font-family: \"et-book\";
|
||
src: url(\"et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot\");
|
||
src: url(\"et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot?#iefix\") format(\"embedded-opentype\"),
|
||
url(\"et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff\") format(\"woff\"),
|
||
url(\"et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf\") format(\"truetype\"),
|
||
url(\"et-book/et-book-bold-line-figures/et-book-bold-line-figures.svg#etbookromanosf\") format(\"svg\");
|
||
font-weight: bold;
|
||
font-style: normal; }
|
||
|
||
@font-face {
|
||
font-family: \"et-book-roman-old-style\";
|
||
src: url(\"et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot\");
|
||
src: url(\"et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot?#iefix\") format(\"embedded-opentype\"),
|
||
url(\"et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff\") format(\"woff\"),
|
||
url(\"et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf\") format(\"truetype\"),
|
||
url(\"et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.svg#etbookromanosf\") format(\"svg\");
|
||
font-weight: normal;
|
||
font-style: normal; }
|
||
*/
|
||
|
||
/* Tufte CSS styles */
|
||
html { font-size: 15px; }
|
||
|
||
body { width: 87.5%;
|
||
margin-left: auto;
|
||
margin-right: auto;
|
||
padding-left: 12.5%;
|
||
font-family: et-book, Palatino, \"Palatino Linotype\", \"Palatino LT STD\", \"Book Antiqua\", Georgia, serif;
|
||
background-color: #fffff8;
|
||
color: #111;
|
||
max-width: 1400px;
|
||
counter-reset: sidenote-counter; }
|
||
|
||
h1 { font-weight: 400;
|
||
margin-top: 4rem;
|
||
margin-bottom: 1.5rem;
|
||
font-size: 3.2rem;
|
||
line-height: 1; }
|
||
|
||
h2 { font-style: italic;
|
||
font-weight: 400;
|
||
margin-top: 2.1rem;
|
||
margin-bottom: 1.4rem;
|
||
font-size: 2.2rem;
|
||
line-height: 1; }
|
||
|
||
h3 { font-style: italic;
|
||
font-weight: 400;
|
||
font-size: 1.7rem;
|
||
margin-top: 2rem;
|
||
margin-bottom: 1.4rem;
|
||
line-height: 1; }
|
||
|
||
hr { display: block;
|
||
height: 1px;
|
||
width: 55%;
|
||
border: 0;
|
||
border-top: 1px solid #ccc;
|
||
margin: 1em 0;
|
||
padding: 0; }
|
||
|
||
p.subtitle { font-style: italic;
|
||
margin-top: 1rem;
|
||
margin-bottom: 1rem;
|
||
font-size: 1.8rem;
|
||
display: block;
|
||
line-height: 1; }
|
||
|
||
.numeral { font-family: et-book-roman-old-style; }
|
||
|
||
.danger { color: red; }
|
||
|
||
article { position: relative;
|
||
padding: 5rem 0rem; }
|
||
|
||
section { padding-top: 1rem;
|
||
padding-bottom: 1rem; }
|
||
|
||
p, ol, ul { font-size: 1.4rem;
|
||
line-height: 2rem; }
|
||
|
||
p { margin-top: 1.4rem;
|
||
margin-bottom: 1.4rem;
|
||
padding-right: 0;
|
||
vertical-align: baseline; }
|
||
|
||
/* Chapter Epigraphs */
|
||
div.epigraph { margin: 5em 0; }
|
||
|
||
div.epigraph > blockquote { margin-top: 3em;
|
||
margin-bottom: 3em; }
|
||
|
||
div.epigraph > blockquote, div.epigraph > blockquote > p { font-style: italic; }
|
||
|
||
div.epigraph > blockquote > footer { font-style: normal; }
|
||
|
||
div.epigraph > blockquote > footer > cite { font-style: italic; }
|
||
/* end chapter epigraphs styles */
|
||
|
||
blockquote { font-size: 1.4rem; }
|
||
|
||
blockquote p { width: 55%;
|
||
margin-right: 40px; }
|
||
|
||
blockquote footer { width: 55%;
|
||
font-size: 1.1rem;
|
||
text-align: right; }
|
||
|
||
section > p, section > footer, section > table { width: 55%; }
|
||
|
||
/* 50 + 5 == 55, to be the same width as paragraph */
|
||
section > ol, section > ul { width: 50%;
|
||
-webkit-padding-start: 5%; }
|
||
|
||
li:not(:first-child) { margin-top: 0.25rem; }
|
||
|
||
figure { padding: 0;
|
||
border: 0;
|
||
font-size: 100%;
|
||
font: inherit;
|
||
vertical-align: baseline;
|
||
max-width: 55%;
|
||
-webkit-margin-start: 0;
|
||
-webkit-margin-end: 0;
|
||
margin: 0 0 3em 0; }
|
||
|
||
figcaption { float: right;
|
||
clear: right;
|
||
margin-top: 0;
|
||
margin-bottom: 0;
|
||
font-size: 1.1rem;
|
||
line-height: 1.6;
|
||
vertical-align: baseline;
|
||
position: relative;
|
||
max-width: 40%; }
|
||
|
||
figure.fullwidth figcaption { margin-right: 24%; }
|
||
|
||
/* Links: replicate underline that clears descenders */
|
||
a:link, a:visited { color: inherit; }
|
||
|
||
a:link { text-decoration: none;
|
||
background: -webkit-linear-gradient(#fffff8, #fffff8), -webkit-linear-gradient(#fffff8, #fffff8), -webkit-linear-gradient(#333, #333);
|
||
background: linear-gradient(#fffff8, #fffff8), linear-gradient(#fffff8, #fffff8), linear-gradient(#333, #333);
|
||
-webkit-background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
|
||
-moz-background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
|
||
background-size: 0.05em 1px, 0.05em 1px, 1px 1px;
|
||
background-repeat: no-repeat, no-repeat, repeat-x;
|
||
text-shadow: 0.03em 0 #fffff8, -0.03em 0 #fffff8,
|
||
0 0.03em #fffff8, 0 -0.03em #fffff8,
|
||
0.06em 0 #fffff8, -0.06em 0 #fffff8,
|
||
0.09em 0 #fffff8, -0.09em 0 #fffff8,
|
||
0.12em 0 #fffff8, -0.12em 0 #fffff8,
|
||
0.15em 0 #fffff8, -0.15em 0 #fffff8;
|
||
background-position: 0% 93%, 100% 93%, 0% 93%; }
|
||
|
||
@media screen and (-webkit-min-device-pixel-ratio: 0) { a:link { background-position-y: 87%, 87%, 87%; } }
|
||
|
||
a:link::selection { text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe,
|
||
0 0.03em #b4d5fe, 0 -0.03em #b4d5fe,
|
||
0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe,
|
||
0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe,
|
||
0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe,
|
||
0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe;
|
||
background: #b4d5fe; }
|
||
|
||
a:link::-moz-selection { text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe,
|
||
0 0.03em #b4d5fe, 0 -0.03em #b4d5fe,
|
||
0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe,
|
||
0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe,
|
||
0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe,
|
||
0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe;
|
||
background: #b4d5fe; }
|
||
|
||
/* Sidenotes, margin notes, figures, captions */
|
||
img { max-width: 100%; }
|
||
|
||
.sidenote, .marginnote { float: right;
|
||
clear: right;
|
||
margin-right: -60%;
|
||
width: 50%;
|
||
margin-top: 0;
|
||
margin-bottom: 0;
|
||
font-size: 1.1rem;
|
||
line-height: 1.3;
|
||
vertical-align: baseline;
|
||
position: relative; }
|
||
|
||
.sidenote-number { counter-increment: sidenote-counter; }
|
||
|
||
.sidenote-number:after, .sidenote:before { font-family: et-book-roman-old-style;
|
||
position: relative;
|
||
vertical-align: baseline; }
|
||
|
||
.sidenote-number:after { content: counter(sidenote-counter);
|
||
font-size: 1rem;
|
||
top: -0.5rem;
|
||
left: 0.1rem; }
|
||
|
||
.sidenote:before { content: counter(sidenote-counter) \" \";
|
||
font-size: 1rem;
|
||
top: -0.5rem; }
|
||
|
||
blockquote .sidenote, blockquote .marginnote { margin-right: -82%;
|
||
min-width: 59%;
|
||
text-align: left; }
|
||
|
||
div.fullwidth, table.fullwidth { width: 100%; }
|
||
|
||
div.table-wrapper { overflow-x: auto;
|
||
font-family: \"Trebuchet MS\", \"Gill Sans\", \"Gill Sans MT\", sans-serif; }
|
||
|
||
.sans { font-family: \"Gill Sans\", \"Gill Sans MT\", Calibri, sans-serif;
|
||
letter-spacing: .03em; }
|
||
|
||
code { font-family: Consolas, \"Liberation Mono\", Menlo, Courier, monospace;
|
||
font-size: 1.0rem;
|
||
line-height: 1.42; }
|
||
|
||
.sans > code { font-size: 1.2rem; }
|
||
|
||
h1 > code, h2 > code, h3 > code { font-size: 0.80em; }
|
||
|
||
.marginnote > code, .sidenote > code { font-size: 1rem; }
|
||
|
||
pre.code { font-size: 0.9rem;
|
||
width: 52.5%;
|
||
margin-left: 2.5%;
|
||
overflow-x: auto; }
|
||
|
||
pre.code.fullwidth { width: 90%; }
|
||
|
||
.fullwidth { max-width: 90%;
|
||
clear:both; }
|
||
|
||
span.newthought { font-variant: small-caps;
|
||
font-size: 1.2em; }
|
||
|
||
input.margin-toggle { display: none; }
|
||
|
||
label.sidenote-number { display: inline; }
|
||
|
||
label.margin-toggle:not(.sidenote-number) { display: none; }
|
||
|
||
.iframe-wrapper { position: relative;
|
||
padding-bottom: 56.25%; /* 16:9 */
|
||
padding-top: 25px;
|
||
height: 0; }
|
||
|
||
.iframe-wrapper iframe { position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%; }
|
||
|
||
@media (max-width: 760px) { body { width: 84%;
|
||
padding-left: 8%;
|
||
padding-right: 8%; }
|
||
hr, section > p, section > footer, section > table { width: 100%; }
|
||
pre.code { width: 97%; }
|
||
section > ol { width: 90%; }
|
||
section > ul { width: 90%; }
|
||
figure { max-width: 90%; }
|
||
figcaption, figure.fullwidth figcaption { margin-right: 0%;
|
||
max-width: none; }
|
||
blockquote { margin-left: 1.5em;
|
||
margin-right: 0em; }
|
||
blockquote p, blockquote footer { width: 100%; }
|
||
label.margin-toggle:not(.sidenote-number) { display: inline; }
|
||
.sidenote, .marginnote { display: none; }
|
||
.margin-toggle:checked + .sidenote,
|
||
.margin-toggle:checked + .marginnote { display: block;
|
||
float: left;
|
||
left: 1rem;
|
||
clear: both;
|
||
width: 95%;
|
||
margin: 1rem 2.5%;
|
||
vertical-align: baseline;
|
||
position: relative; }
|
||
label { cursor: pointer; }
|
||
div.table-wrapper, table { width: 85%; }
|
||
img { width: 100%; } }
|
||
|
||
/*
|
||
/* HTML-STYLE-MOD
|
||
*/
|
||
html {
|
||
font-size: 12px;
|
||
}
|
||
.subtitle {
|
||
text-align: left;
|
||
}
|
||
h4 {
|
||
font-style: italic;
|
||
font-weight: 400;
|
||
font-size: 1.45rem;
|
||
margin-top: 2rem;
|
||
margin-bottom: 1.4rem;
|
||
line-height: 1;
|
||
}
|
||
h5 {
|
||
font-style: italic;
|
||
font-weight: 400;
|
||
font-size: 1.2rem;
|
||
margin-top: 2rem;
|
||
margin-bottom: 1.4rem;
|
||
line-height: 1;
|
||
}
|
||
h6 {
|
||
font-style: italic;
|
||
font-weight: 400;
|
||
font-size: 1.1rem;
|
||
margin-top: 2rem;
|
||
margin-bottom: 1.4rem;
|
||
line-height: 1;
|
||
}
|
||
#content p {
|
||
text-align: justify;
|
||
word-break: break-word;
|
||
-webkit-hyphens: auto;
|
||
-moz-hyphens: auto;
|
||
-ms-hyphens: auto;
|
||
hyphens: auto;
|
||
}
|
||
#content table {
|
||
margin-bottom: 1.2rem;
|
||
}
|
||
#content table, dl, div>.MathJax_Display {
|
||
font-size: 1.4rem;
|
||
}
|
||
#content table colgroup {
|
||
border-top-width: 2px;
|
||
border-top-style: outset;
|
||
border-bottom-width: 2px;
|
||
border-bottom-style: inset;
|
||
}
|
||
#content table colgroup {
|
||
border-right-width: 1px;
|
||
border-right-style: inset;
|
||
}
|
||
#content table colgroup:last-of-type {
|
||
border-right-width: 0px;
|
||
border-right-style: unset;
|
||
}
|
||
#content thead {
|
||
border-bottom-width: 1px;
|
||
border-bottom-style: solid;
|
||
}
|
||
#content tbody:not(:last-child) {
|
||
border-bottom-width: 1px;
|
||
border-bottom-style: solid;
|
||
}
|
||
#content td {
|
||
padding-top: 0.1rem;
|
||
padding-bottom: 0.1rem;
|
||
}
|
||
#content td, #content th {
|
||
padding-right: 0.5rem;
|
||
}
|
||
#content td:last-child, #content th:last-child {
|
||
padding-right: 0;
|
||
}
|
||
#content table th {
|
||
vertical-align: text-bottom;
|
||
}
|
||
#content ul, #content ol {
|
||
line-height: 1.8rem;
|
||
}
|
||
#content li p {
|
||
width: unset;
|
||
}
|
||
caption.t-above, .figure p:nth-child(2), .org-src-name {
|
||
font-size: 1.1rem;
|
||
}
|
||
.table-number, .figure-number, .listing-number {
|
||
font-weight: bold;
|
||
}
|
||
#table-of-contents ul, #list-of-tables ul, #list-of-listings ul {
|
||
line-height: normal;
|
||
}
|
||
#content figure {
|
||
display: inline-table;
|
||
vertical-align: top;
|
||
max-width: unset;
|
||
margin: 0 0 2rem 0;
|
||
}
|
||
#content figcaption {
|
||
float: unset;
|
||
clear: unset;
|
||
max-width: unset;
|
||
display: table-caption;
|
||
caption-side: bottom;
|
||
}
|
||
.org-svg {
|
||
width: auto;
|
||
}
|
||
#text-list-of-tables .table-number {
|
||
display: none;
|
||
}
|
||
#text-list-of-tables ul {
|
||
list-style: decimal;
|
||
padding-left: 2rem;
|
||
}
|
||
#text-list-of-listings .listing-number {
|
||
display: none;
|
||
}
|
||
#text-list-of-listings ul {
|
||
list-style: decimal;
|
||
padding-left: 2rem;
|
||
}
|
||
#text-list-of-symbols table colgroup {
|
||
border: none;
|
||
}
|
||
.org-src-container {
|
||
margin: 1.2rem;
|
||
}
|
||
.org-src-container {
|
||
width: calc(55% - 2.4rem);
|
||
}
|
||
pre.src {
|
||
margin: 0;
|
||
}
|
||
div.epigraph {
|
||
margin: unset;
|
||
}
|
||
div.epigraph>blockquote {
|
||
margin-top: 1em;
|
||
margin-bottom: 1em;
|
||
}
|
||
.todo, .done {
|
||
font-size: 80%;
|
||
font-style: normal;
|
||
}
|
||
.tag {
|
||
float: right;
|
||
background-color: unset;
|
||
font-size: .7em;
|
||
font-style: normal;
|
||
line-height: 1;
|
||
}
|
||
.tag span {
|
||
background-color: #333;
|
||
border: 1px solid #bbb;
|
||
border-radius: 3px;
|
||
background-clip: padding-box;
|
||
padding: .2em;
|
||
margin-right: .5em;
|
||
}
|
||
#postamble p {
|
||
line-height: 1;
|
||
}
|
||
#bibliography {
|
||
margin-bottom: 1.4rem;
|
||
width: 55%;
|
||
}
|
||
/*
|
||
.org-ref-reference {
|
||
vertical-align: super;
|
||
font-size: .83em;
|
||
}
|
||
*/
|
||
.org-ref-reference::before {
|
||
content: \"[\";
|
||
}
|
||
.org-ref-reference::after {
|
||
content: \"]\";
|
||
}
|
||
|
||
@media (max-width: 760px) {
|
||
body {
|
||
padding-left: 0;
|
||
padding-right: 0;
|
||
width: 94%;
|
||
}
|
||
#content p, .org-src-container, pre.example, pre.code, #postamble {
|
||
width: auto;
|
||
}
|
||
#content table {
|
||
display: block;
|
||
overflow-x: auto;
|
||
}
|
||
.figure {
|
||
padding-left: 0;
|
||
padding-right: 0;
|
||
}
|
||
#content figure {
|
||
display: inline-block;
|
||
overflow-x: auto;
|
||
}
|
||
#content figcaption {
|
||
display: unset;
|
||
}
|
||
div.table-wrapper, table, #content dl {
|
||
width: auto;
|
||
}
|
||
div>.MathJax_Display {
|
||
width: auto;
|
||
}
|
||
#bibliography {
|
||
width: auto;
|
||
}
|
||
}
|
||
|
||
/* colors */
|
||
html {
|
||
background-color: #293b3e;
|
||
background-image: linear-gradient(to right, #292b2e, #293b3e);
|
||
background-repeat: repeat-y;
|
||
}
|
||
body {
|
||
/* background-color: #293b3e; */
|
||
/* background-image: linear-gradient(to right, #292b2e, #293b3e); */
|
||
/* background-repeat: no-repeat; */
|
||
background-color: transparent;
|
||
color: #b2b2b2;
|
||
}
|
||
.outline-2 a, #bibliography a, #table-of-contents a, #list-of-tables a, #list-of-listings a {
|
||
color: #5799b9;
|
||
}
|
||
a:link {
|
||
background: -webkit-linear-gradient(#292b2e, #292b2e), -webkit-linear-gradient(#292b2e, #292b2e), -webkit-linear-gradient(#333, #333);
|
||
background: linear-gradient(#292b2e, #292b2e), linear-gradient(#292b2e, #292b2e), linear-gradient(#333, #333);
|
||
/* delete the other to background entries? */
|
||
background: transparent;
|
||
text-shadow: 0.03em 0 #292b2e, -0.03em 0 #292b2e,
|
||
0 0.03em #292b2e, 0 -0.03em #292b2e,
|
||
0.06em 0 #292b2e, -0.06em 0 #292b2e,
|
||
0.09em 0 #292b2e, -0.09em 0 #292b2e,
|
||
0.12em 0 #292b2e, -0.12em 0 #292b2e,
|
||
0.15em 0 #292b2e, -0.15em 0 #292b2e;
|
||
}
|
||
a:link::selection, a:link::-moz-selection {
|
||
text-shadow: 0.03em 0 #b4d5fe, -0.03em 0 #b4d5fe,
|
||
0 0.03em #b4d5fe, 0 -0.03em #b4d5fe,
|
||
0.06em 0 #b4d5fe, -0.06em 0 #b4d5fe,
|
||
0.09em 0 #b4d5fe, -0.09em 0 #b4d5fe,
|
||
0.12em 0 #b4d5fe, -0.12em 0 #b4d5fe,
|
||
0.15em 0 #b4d5fe, -0.15em 0 #b4d5fe;
|
||
background: #b4d5fe;
|
||
}
|
||
/*]]>*/
|
||
</style>
|
||
"
|
||
"See `org-html-head'."
|
||
:group 'my-org-export-article
|
||
:version "24.4"
|
||
:package-version '(Org . "8.0")
|
||
:type 'string)
|
||
;;;###autoload
|
||
(put 'org-html-head 'safe-local-variable 'stringp)
|
||
|
||
|
||
;;; Export functions
|
||
|
||
;;;###autoload
|
||
(defun my-org-article-html-export-to-html (&optional async subtreep visible-only body-only ext-plist)
|
||
"See `org-tufte-export-to-file' and `org-html-export-to-html'."
|
||
(interactive)
|
||
(let* ((extension (concat
|
||
(when (> (length org-html-extension) 0) ".")
|
||
(or (plist-get ext-plist :html-extension)
|
||
org-html-extension
|
||
"html")))
|
||
(file (org-export-output-file-name extension subtreep))
|
||
;; need to bind this because tufte treats footnotes specially, so we
|
||
;; don't want to display them at the bottom
|
||
(org-html-footnotes-section (if org-tufte-include-footnotes-at-bottom
|
||
org-html-footnotes-section
|
||
"<!-- %s --><!-- %s -->")))
|
||
(org-export-to-file 'article-html file async subtreep
|
||
visible-only body-only ext-plist)))
|
||
|
||
(defun my-org-article-help ()
|
||
"Open the `my-org-article' manual."
|
||
(interactive)
|
||
(find-file (expand-file-name
|
||
"my-org-article.org"
|
||
(file-name-directory
|
||
(find-library-name "my-org-article")))))
|
||
|
||
(provide 'my-org-article)
|
||
;;; my-org-article.el ends here
|