From ea842bb955b6d4a35b3f68c5ae8455e414eef516 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Tue, 16 Feb 2021 14:36:31 +0100 Subject: [PATCH 1/5] add more information about packages --- README.md | 269 ++++++++++++++++++++++++++++++++++------------------- README.org | 171 ++++++++++++++++++++++++++-------- 2 files changed, 309 insertions(+), 131 deletions(-) diff --git a/README.md b/README.md index 70c41e79..ca394ca6 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,40 @@ # Table of Contents -1. [Requirements](#orgcb9390d) -2. [Installation](#orgf9a7dd2) -3. [Key bindings and functions](#org4741345) -4. [Packages](#org62b82b1) -5. [Information](#orgc744d51) -6. [Errors](#org27051a8) - 1. [failed execution of bibtex2html](#orga0059df) +1. [Requirements](#requirements) +2. [Installation](#installation) +3. [Packages](#packages) + 1. [Org](#org) + 2. [Multiple cursors](#multiple-cursors) + 3. [Other packages](#other-packages) +4. [Information](#information) +5. [Errors](#errors) +6. [TODOs](#todos) This is an ongoing evolution of Emacs configuration files, inspired by a bunch of online resources. - + # Requirements external packages: - # flyspell-buffer - yay -S aspell hunspell - # org-mode latex-mode - yay -S biber bibtex2html + # fonts (opensans in latex article preamble) + yay -S ttf-inconsolata ttf-opensans + # spelling flyspell-buffer + yay -S aspell aspell-de aspell-en \ + hunspell hunspell-de hunspell-en_US \ + languagetool + # org-mode latex-mode ox-latex + yay -S biber bibtex2html texlive-bibtexextra texlive-core \ + texlive-fontsextra texlive-formatsextra texlive-langgreek \ + texlive-langjapanese texlive-latexextra texlive-pgf-pie \ + texlive-pgfopts texlive-pictures texlive-pstricks \ + texlive-publishers texlive-science texlive-slashbox # ledger-mode yay -S ledger - # langtool - yay -S languagetool # python-mode yay -S python-pylint # emacs-application-famework EAF @@ -34,11 +42,13 @@ external packages: python-pyqt5 python-pyqt5-sip python-pyqtwebengine python-qrcode \ python-feedparser python-dbus python-pyinotify python-markdown \ python-grip filebrowser-bin python-epc + # other + yay -S ditaa plantuml r Optional package for EAF see in Installation. - + # Installation @@ -52,7 +62,8 @@ or copy all files of this directory into your ~/.config/emacs directory - `ln -s ~/.config/emacs/init ~/.emacs` (or `~/.emacs.el`, `~/.emacs.d/init.el`) -copy/merge the texmf directory into your home directory +LaTeX sytling files: copy/merge the `texmf` directory into your home +directory `~/texmf` optional for EAF @@ -66,12 +77,12 @@ edit `PGKBUILD` file for `python-pymupdf` to: } - + -# Key bindings and functions +# Packages - +@@ -142,11 +153,79 @@ edit `PGKBUILD` file for `python-pymupdf` to: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Table 1: GeneralTable 1: General key bindings and functions
counsel-describe-funtion help text of function
C-rquery-replace-regexpreplace text. (former isearch-backward)
C-x C-bibufferlist buffers (former list-buffers)
C-x |toggle-window-splittoggle horizontal/vertical 2 window split
M-upmove-line-upmove current line up
M-downmove-line-downmove current line down
mouse-6 scroll right
mouse-7 scroll left
mouse-8previous-buffer 
mouse-9next-buffer 
+ + + +## Org + - +@@ -252,79 +331,18 @@ edit `PGKBUILD` file for `python-pymupdf` to: - -
Table 2: OrgTable 2: Org key bindings and functions
org-babel-tangle create a file with the content of the block, use in header: :tangle filename
- - - - --- -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -344,8 +362,28 @@ edit `PGKBUILD` file for `python-pymupdf` to:
Table 3: Custom and changed keys
C-rquery-replace-regexpreplace text. (former isearch-backward)
C-x C-bibufferlist buffers (former list-buffers)
C-x |toggle-window-splittoggle horizontal/vertical 2 window split
M-upmove-line-upmove current line up
M-downmove-line-downmove current line down
mouse-6  scroll right
mouse-7  scroll left
mouse-8previous-buffer  
mouse-9next-bufferOrg export   
+**Important** + +- For **Gnuplot** source blocks: Do not use `%` inside Gnuplot source + block but `\%` or in format command `\%%` + - % starts a comment in LaTeX and therefore stops further + interpretations like a closing bracket `}` etc. + - Gnuplot graphics are imported as .tex (text, axis, legend) and + .eps (figure) files. + - `\%` `\%%` can also be used for HTML SVG export + +Links + +- +- + + + + +## Multiple cursors + - +@@ -385,16 +423,16 @@ edit `PGKBUILD` file for `python-pymupdf` to:
Table 4: Multiple cursorsTable 3: Multiple cursors key bindings and functions
- + -# Packages +## Other packages - **rainbow-mode.el:** rainbow-mode is a minor mode for Emacs which displays strings representing colors with the color they represent as background. - + # Information @@ -404,18 +442,61 @@ but interlocks to prevent the simultaneous editing of the same file. See [Interlocking](https://www.emacswiki.org/info-ref?find=Interlocking) in the [EmacsManual](https://www.emacswiki.org/emacs/EmacsManual) for details. - + # Errors +- failed execution of bibtex2html + - see bib2htmlxxxxxx.blg for errors, e.g. + - I couldn’t open style file acmu.bst + - copy/merge the texmf directory into your home directory. +- when using this in an Org mode buffer: + `#+HEADER: :fit yes :imagemagick yes :iminoptions -density 300` + - can leads to: + - convert: attempt to perform an operation not allowed by the security policy \`gs’ @ error/delegate.c/ExternalDelegateCommand/378. + - convert: no images defined \`DESYlogotikz.png’ @ error/convert.c/ConvertImageCommand/3282. + - edit `/etc/ImageMagick-7/policy.xml` and comment out + - `` - -## failed execution of bibtex2html + -see bib2htmlxxxxxx.blg for errors, e.g. +# TODOs -- I couldn’t open style file acmu.bst - -copy/merge the texmf directory into your home directory. +- Org / global configuration + - Page formatting + - Modify HTML styling + - Printed page layout, white styled figures + - Custom export function for HTML and \(\LaTeX\), with; + - `Shift` - ``, `Shift` - `` with open file + - delete temp. generated export files +- Figures + - Gnuplot + - plot transposed files/tables + - preamble in function and call this function for every gnuplot block either + manually or automatically with a hook?! +- Tables + - Wrap Table in div element. For smartphone scrolling. +- Table of contents + - \(\LaTeX\); currently headers with no-number property means not included in TOC + - HTML; currently generated list, like lot and lol, are not included in toc + but own headers without numbers are. +- Equation cancel/strike out with color line + - hcancel[color]{} + - Example: `\(\hcancel[red]{f_{X_2}(x_2)}}\)` + - Definition: + - Preamle: `#+LATEX_HEADER: \usepackage{cancel}` + `#+LATEX_HEADER: \newcommand\hcancel[2][black]{\setbox0=\hbox{$#2$}%` + `#+LATEX_HEADER: \rlap{\raisebox{.45\ht0}{\textcolor{#1}{\rule{\wd0}{1pt}}}}#2}` + - `hcancel: [\"{\\\\setbox0=\\\\hbox{$#2$}\\\\rlap{\\\\raisebox{.45\\\\ht0}{\\\\textcolor{#1}{\\\\rule{\\\\wd0}{1pt}}}}#2}\",2]` + + MathJax.Ajax.config.path[\"Contrib\"] = \"https://cdn.mathjax.org/mathjax/contrib\"; + MathJax.Hub.Register.StartupHook(\"TeX Jax Ready\",function () { + MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{ + cancel: [\"Extension\",\"cancel\"], + bcancel: [\"Extension\",\"cancel\"], + xcancel: [\"Extension\",\"cancel\"], + cancelto: [\"Extension\",\"cancel\"] + }); + }); diff --git a/README.org b/README.org index 962854a6..397fd8f4 100644 --- a/README.org +++ b/README.org @@ -6,16 +6,25 @@ This is an ongoing evolution of Emacs configuration files, inspired by a bunch of online resources. * Requirements + :PROPERTIES: + :CUSTOM_ID: requirements + :END: external packages: #+begin_src shell - # flyspell-buffer - yay -S aspell hunspell - # org-mode latex-mode - yay -S biber bibtex2html + # fonts (opensans in latex article preamble) + yay -S ttf-inconsolata ttf-opensans + # spelling flyspell-buffer + yay -S aspell aspell-de aspell-en \ + hunspell hunspell-de hunspell-en_US \ + languagetool + # org-mode latex-mode ox-latex + yay -S biber bibtex2html texlive-bibtexextra texlive-core \ + texlive-fontsextra texlive-formatsextra texlive-langgreek \ + texlive-langjapanese texlive-latexextra texlive-pgf-pie \ + texlive-pgfopts texlive-pictures texlive-pstricks \ + texlive-publishers texlive-science texlive-slashbox # ledger-mode yay -S ledger - # langtool - yay -S languagetool # python-mode yay -S python-pylint # emacs-application-famework EAF @@ -23,10 +32,15 @@ a bunch of online resources. python-pyqt5 python-pyqt5-sip python-pyqtwebengine python-qrcode \ python-feedparser python-dbus python-pyinotify python-markdown \ python-grip filebrowser-bin python-epc + # other + yay -S ditaa plantuml r #+end_src Optional package for EAF see in Installation. * Installation + :PROPERTIES: + :CUSTOM_ID: installation + :END: Install into =~/.config/emacs= (must be empty) #+begin_src sh git clone http://gogs.weseng.de/daniel/emacs.git ~/.config/emacs @@ -39,7 +53,8 @@ a bunch of online resources. - =ln -s ~/.config/emacs/init ~/.emacs= (or =~/.emacs.el=, =~/.emacs.d/init.el=) - copy/merge the texmf directory into your home directory + LaTeX sytling files: copy/merge the =texmf= directory into your home + directory =~/texmf= optional for EAF #+begin_src shell @@ -54,19 +69,35 @@ a bunch of online resources. } #+end_example -* Key bindings and functions -#+caption: General -| M-> | end-of-buffer | | -| M-< | beginning-of-buffer | | -| C-x h | mark-whole-buffer | mark the whole buffer | -| C-x TAB | indent-rigidly | indent selected region | -| C-x RET f | set-buffer-file-coding-system | e. g. set to utf-8 | -| | decode-coding-region | e. g. decode to utf-8 (郭富城Aaron Kwok) | -| | diff-buffer-with-file | show a diff between buffer and file | -| C-h v | counsel-describe-variable | help text of variable | -| C-h f | counsel-describe-funtion | help text of function | +* Packages + :PROPERTIES: + :CUSTOM_ID: packages + :END: +#+caption: General key bindings and functions +| M-> | end-of-buffer | | +| M-< | beginning-of-buffer | | +| C-x h | mark-whole-buffer | mark the whole buffer | +| C-x TAB | indent-rigidly | indent selected region | +| C-x RET f | set-buffer-file-coding-system | e. g. set to utf-8 | +| | decode-coding-region | e. g. decode to utf-8 (郭富城Aaron Kwok) | +| | diff-buffer-with-file | show a diff between buffer and file | +| C-h v | counsel-describe-variable | help text of variable | +| C-h f | counsel-describe-funtion | help text of function | +| C-r | query-replace-regexp | replace text. (former isearch-backward) | +| C-x C-b | ibuffer | list buffers (former list-buffers) | +| C-x \vert | toggle-window-split | toggle horizontal/vertical 2 window split | +| M-up | move-line-up | move current line up | +| M-down | move-line-down | move current line down | +| mouse-6 | | scroll right | +| mouse-7 | | scroll left | +| mouse-8 | previous-buffer | | +| mouse-9 | next-buffer | | -#+caption: Org +** Org + :PROPERTIES: + :CUSTOM_ID: org + :END: +#+caption: Org key bindings and functions | C-c \vert | org-table-create-or-convert-from-region | convert seperator 1. TAB, 2. comma, 3. space | | C-u C-c \vert | org-table-create-or-convert-from-region | convert using comma (CSV) seperator | | C-u C-u C-c \vert | org-table-create-or-convert-from-region | convert using TAB | @@ -81,39 +112,105 @@ a bunch of online resources. | | | | | Org src block | | | | C-c C-v t | org-babel-tangle | create a file with the content of the block, use in header: :tangle filename | +| | | | +| Org export | | | +| f5 | | in org export to html | +| f6 | | in org export to LaTeX | -#+caption: Custom and changed keys -| C-r | query-replace-regexp | replace text. (former isearch-backward) | -| C-x C-b | ibuffer | list buffers (former list-buffers) | -| C-x \vert | toggle-window-split | toggle horizontal/vertical 2 window split | -| M-up | move-line-up | move current line up | -| M-down | move-line-down | move current line down | -| mouse-6 | | scroll right | -| mouse-7 | | scroll left | -| mouse-8 | previous-buffer | | -| mouse-9 | next-buffer | | -| f5 | | in org export to html | -| f6 | | in org export to LaTeX | +*Important* +- For *Gnuplot* source blocks: Do not use =%= inside Gnuplot source + block but =\%= or in format command =\%%= + - % starts a comment in LaTeX and therefore stops further + interpretations like a closing bracket =}= etc. + - Gnuplot graphics are imported as .tex (text, axis, legend) and + .eps (figure) files. + - =\%= =\%%= can also be used for HTML SVG export -#+caption: Multiple cursors +Links +- https://tex.stackexchange.com/questions/167583/include-custom-file-into-header-with-org-mode/201674 +- https://orgmode.org/manual/LaTeX-specific-export-settings.html + +** Multiple cursors + :PROPERTIES: + :CUSTOM_ID: multiple-cursors + :END: +#+caption: Multiple cursors key bindings and functions | M-m s m a | mc/mark-all-dwim | try to mark all at point | | C-v | | jump to next cursor | | M-v | | jump to previous cursor | | C-' | | hide/unhide lines without a cursor | -* Packages +** Other packages + :PROPERTIES: + :CUSTOM_ID: other-packages + :END: - rainbow-mode.el :: https://elpa.gnu.org/packages/rainbow-mode.html rainbow-mode is a minor mode for Emacs which displays strings representing colors with the color they represent as background. * Information + :PROPERTIES: + :CUSTOM_ID: information + :END: Interlock symlinks and auto-save files. Be aware that symbolic links of the form “.#*” are not auto-save files but interlocks to prevent the simultaneous editing of the same file. See [[https://www.emacswiki.org/info-ref?find=Interlocking][Interlocking]] in the [[https://www.emacswiki.org/emacs/EmacsManual][EmacsManual]] for details. * Errors -** failed execution of bibtex2html -see bib2htmlxxxxxx.blg for errors, e.g. -- I couldn't open style file acmu.bst -copy/merge the texmf directory into your home directory. + :PROPERTIES: + :CUSTOM_ID: errors + :END: +- failed execution of bibtex2html + - see bib2htmlxxxxxx.blg for errors, e.g. + - I couldn't open style file acmu.bst + - copy/merge the texmf directory into your home directory. +- when using this in an Org mode buffer: + =#+HEADER: :fit yes :imagemagick yes :iminoptions -density 300= + - can leads to: + - convert: attempt to perform an operation not allowed by the security policy `gs' @ error/delegate.c/ExternalDelegateCommand/378. + - convert: no images defined `DESY_logo_tikz.png' @ error/convert.c/ConvertImageCommand/3282. + - edit =/etc/ImageMagick-7/policy.xml= and comment out + - ~~ + +* TODOs + :PROPERTIES: + :CUSTOM_ID: todos + :END: +- Org / global configuration + - Page formatting + - Modify HTML styling + - Printed page layout, white styled figures + - Custom export function for HTML and \(\LaTeX\), with; + - =Shift= - ==, =Shift= - == with open file + - delete temp. generated export files +- Figures + - Gnuplot + - plot transposed files/tables + - preamble in function and call this function for every gnuplot block either + manually or automatically with a hook?! +- Tables + - Wrap Table in div element. For smartphone scrolling. +- Table of contents + - \(\LaTeX\); currently headers with no-number property means not included in TOC + - HTML; currently generated list, like lot and lol, are not included in toc + but own headers without numbers are. +- Equation cancel/strike out with color line + - hcancel[color]{} + - Example: ~\(\hcancel[red]{f_{X_2}(x_2)}}\)~ + - Definition: + - Preamle: ~#+LATEX_HEADER: \usepackage{cancel}~ \\ + ~#+LATEX_HEADER: \newcommand\hcancel[2][black]{\setbox0=\hbox{$#2$}%~ \\ + ~#+LATEX_HEADER: \rlap{\raisebox{.45\ht0}{\textcolor{#1}{\rule{\wd0}{1pt}}}}#2}~ \\ + - ~hcancel: [\"{\\\\setbox0=\\\\hbox{$#2$}\\\\rlap{\\\\raisebox{.45\\\\ht0}{\\\\textcolor{#1}{\\\\rule{\\\\wd0}{1pt}}}}#2}\",2]~ + #+Begin_example +MathJax.Ajax.config.path[\"Contrib\"] = \"https://cdn.mathjax.org/mathjax/contrib\"; +MathJax.Hub.Register.StartupHook(\"TeX Jax Ready\",function () { + MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{ + cancel: [\"Extension\",\"cancel\"], + bcancel: [\"Extension\",\"cancel\"], + xcancel: [\"Extension\",\"cancel\"], + cancelto: [\"Extension\",\"cancel\"] + }); +}); + #+End_example From 0e987ba7777b45e9f758c89cb745525b31b87461 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Tue, 16 Feb 2021 16:10:13 +0100 Subject: [PATCH 2/5] start to implement org export of custom article --- README.md | 4 +- README.org | 4 +- lisp/my/my-org-article.el | 357 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 361 insertions(+), 4 deletions(-) create mode 100644 lisp/my/my-org-article.el diff --git a/README.md b/README.md index ca394ca6..9021ef1f 100644 --- a/README.md +++ b/README.md @@ -453,8 +453,8 @@ file. See [Interlocking](https://www.emacswiki.org/info-ref?find=Interlocking) i - when using this in an Org mode buffer: `#+HEADER: :fit yes :imagemagick yes :iminoptions -density 300` - can leads to: - - convert: attempt to perform an operation not allowed by the security policy \`gs’ @ error/delegate.c/ExternalDelegateCommand/378. - - convert: no images defined \`DESYlogotikz.png’ @ error/convert.c/ConvertImageCommand/3282. + - ``convert: attempt to perform an operation not allowed by the security policy `gs' @ error/delegate.c/ExternalDelegateCommand/378.`` + - ``convert: no images defined `DESY_logo_tikz.png' @ error/convert.c/ConvertImageCommand/3282.`` - edit `/etc/ImageMagick-7/policy.xml` and comment out - `` diff --git a/README.org b/README.org index 397fd8f4..1fa61134 100644 --- a/README.org +++ b/README.org @@ -168,8 +168,8 @@ file. See [[https://www.emacswiki.org/info-ref?find=Interlocking][Interlocking]] - when using this in an Org mode buffer: =#+HEADER: :fit yes :imagemagick yes :iminoptions -density 300= - can leads to: - - convert: attempt to perform an operation not allowed by the security policy `gs' @ error/delegate.c/ExternalDelegateCommand/378. - - convert: no images defined `DESY_logo_tikz.png' @ error/convert.c/ConvertImageCommand/3282. + - =convert: attempt to perform an operation not allowed by the security policy `gs' @ error/delegate.c/ExternalDelegateCommand/378.= + - =convert: no images defined `DESY_logo_tikz.png' @ error/convert.c/ConvertImageCommand/3282.= - edit =/etc/ImageMagick-7/policy.xml= and comment out - ~~ diff --git a/lisp/my/my-org-article.el b/lisp/my/my-org-article.el new file mode 100644 index 00000000..674b2c33 --- /dev/null +++ b/lisp/my/my-org-article.el @@ -0,0 +1,357 @@ +;;; my-org-article.el --- Summary -*- lexical-binding: t -*- + +;;; Commentary: + +;; EXAMPLE: +;; # -*- ispell-local-dictionary: "german" -*- + +;;; Code: +(require 'ox-latex) + +;;; Function Declarations +(defvar my-org-article-export-with-toc) +(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) + +(org-export-define-derived-backend 'article-latex 'latex + + :menu-entry + '(?A "Export to LaTeX (Article)" + ((?L "As LaTeX buffer" my-org-article-latex-export-as-latex) + (?l "As LaTeX file" my-org-article-latex-export-to-latex) + (?p "As PDF file" my-org-article-latex-export-to-pdf) + (?o "As PDF file 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 + '((:with-toc nil "toc" my-org-article-export-with-toc) + (: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-compiler "LATEX_COMPILER" nil my-org-article-latex-compiler t)) + + :translate-alist + '((template . my-org-article-latex-template)) + ) + + +;;; 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-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)))) + +;;;; Compilation + +(defcustom my-org-articel-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-class "koma-letter" + "The default LaTeX class." + :group 'my-org-export-article + :type '(string :tag "LaTeX class")) + +(defcustom my-org-article-latex-default-class-options "[enlargefirstpage]" + "The default LaTeX class options." + :group 'my-org-export-article + :type '(string :tag "LaTeX class")) + +(add-to-list 'org-latex-classes + '("koma-letter" "\\documentclass{scrlttr2}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) + +(defcustom my-org-article-latex-header + "\\setlength{\\parskip}{6pt} +\\setlength{\\parindent}{0pt} +\\setlength{\\textheight}{22.5cm} + +\\newcommand{\\fromassociation}{<>} +\\newcommand{\\fromname}{<>} +\\setkomavar{fromname}{\\fromname} +\\newcommand{\\fromstreet}{<>} +\\newcommand{\\fromplace}{<>} +\\setkomavar{fromaddress}{\\fromstreet, \\fromplace} +\\setkomavar{fromphone}{<>} +\\setkomavar{fromurl}{<>} +\\setkomavar{fromemail}{<>} +\\setkomavar{place}{<>} +\\newcommand\\toassociation{<>} +\\newcommand\\toname{<>} +\\newcommand\\tostreet{<>} +\\newcommand\\toplace{<>} +\\newcommand\\subject{<>} +\\newcommand\\subjectextra{<>} + +% adjust some spacings +\\makeatletter +\\@setplength{toaddrwidth}{10cm} +\\makeatother +" + "Preamble options." + :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-default-packages-alist + '(("AUTO" "inputenc" t ("pdflatex")) + ("T1" "fontenc" t ("pdflatex")) + ("" "graphicx" t) + ("" "grffile" t) + ("" "longtable" nil) + ("" "wrapfig" nil) + ("" "rotating" nil) + ("normalem" "ulem" t) + ("" "amsmath" t) + ("" "textcomp" t) + ("" "amssymb" t) + ("" "capt-of" nil) + ("" "hyperref" nil) + ;; + ("ngerman" "babel" nil) + ("utf8" "inputenc" nil) + ("" "scrlayer-scrpage" 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")))) + +;;;; Document + +(defcustom my-org-letter-latex-opening + "\\firsthead{ + \\begin{flushright}\\textsf{\\begin{tabular}{l} + \\fromassociation \\\\ \\usekomavar{fromname} \\\\ \\fromstreet \\\\ + \\fromplace\\\\[3mm] \\usekomavar{fromphone} \\\\ \\usekomavar{fromemail} + \\end{tabular}}\\end{flushright} +} +% Kopf und Fußzeile der Folgeseiten +\\defpagestyle{nextpage}{{} {} {\\textsf{\\parbox{\\hsize}{\\usekomavar{fromname}\\today\\ \\hrulefill\\ \\pagename~\\thepage}}}} + {{} {} {}} +\\pagestyle{nextpage} + +\\begin{letter}{Empfänger} % den Wert Empfänger nicht verändern +\\setkomavar{toname}{\\toassociation \\\\ \\toname} +\\setkomavar{toaddress}{\\tostreet \\\\ \\toplace} + +\\setkomavar{subject}{\\subject \\\\ {\\normalfont \\subjectextra}} + +\\opening{Sehr geehrter \\toname,}" + "Letter opening." + :group 'my-org-export-article) + +(defcustom my-org-letter-latex-closing + "\\closing{Freundliche Grüße,}" + "Letter closing." + :group 'my-org-export-article) + + +;;; Template + +;;;###autoload +(defun my-org-article-latex-make-preamble (info &optional template snippet?) + "See `org-latex-make-preamble'" + (let* ((class (plist-get info :latex-class)) + (class-template + (or template + (let* ((class-options (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-letter-latex-default-packages-alist info) + (org-latex--remove-packages my-org-letter-latex-packages-alist info) + snippet? + (mapconcat #'org-element-normalize-string + (list (s-replace-all + (list (cons "<>" (plist-get info :letter-from-association)) + (cons "<>" (plist-get info :letter-from-name)) + (cons "<>" (plist-get info :letter-from-street)) + (cons "<>" (plist-get info :letter-from-place)) + (cons "<>" (plist-get info :letter-from-phone)) + (cons "<>" (plist-get info :letter-from-url)) + (cons "<>" (plist-get info :letter-from-email)) + (cons "<>" (plist-get info :letter-to-association)) + (cons "<>" (plist-get info :letter-to-name)) + (cons "<>" (plist-get info :letter-to-street)) + (cons "<>" (plist-get info :letter-to-place)) + (cons "<>" (plist-get info :letter-place)) + (cons "<>" (plist-get info :date)) + (cons "<>" (string-replace "\n" "\\\\" (plist-get info :letter-subject))) + (cons "<>" (string-replace "\n" "\\\\" (plist-get info :letter-subject-extra)))) + (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-letter-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))) + ;; 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))) + ;; 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 :letter-opening) "\n") + contents + (concat (plist-get info :letter-closing) "\n") + ;; attachments + (let ((attachments (plist-get info :letter-attachment))) + (unless (string-equal attachments "") + (concat "\\vspace*{\\fill}\n" + "\\encl{" (string-replace "\n" "\\\\" attachments) "}\n"))) + "\\end{letter}\n" + ;; 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))))) + +(provide 'my-org-article) +;;; my-org-article.el ends here From 64234286f0b8bad30e685734f045a12c96e2baaa Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Thu, 18 Feb 2021 14:36:47 +0100 Subject: [PATCH 3/5] add function to determine windows wsl and a function to open links in Windows web browser if wsl is used --- settings/general-settings.el | 20 +++++++++++++------- settings/pre-settings.el | 8 ++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/settings/general-settings.el b/settings/general-settings.el index 263fcfa5..55127521 100644 --- a/settings/general-settings.el +++ b/settings/general-settings.el @@ -152,18 +152,14 @@ but it's REALLY SLOW when you have buffers that are visiting remote files. And despite its documentation, it does NOT ignore those files, if you're using windows, and the file name begins -with a drive letter and a colon.") - ) - (setq global-auto-revert-non-file-buffers t) - ) - ) +with a drive letter and a colon.")) + (setq global-auto-revert-non-file-buffers t))) (setq revert-without-query '(".*")) (use-package uniquify :defer t :config - (setq uniquify-buffer-name-style 'forward) ;; forward: bar/mumble/name insead of post-forward-angle-brackets: name - ) + (setq uniquify-buffer-name-style 'forward)) ;; forward: bar/mumble/name insead of post-forward-angle-brackets: name ;; overwrite selected text (delete-selection-mode t) @@ -217,6 +213,16 @@ with a drive letter and a colon.") ;; gravatars from magit use this to store their cache (setq url-configuration-directory (concat user-cache-directory "url/")) +;; https://adam.kruszewski.name/2017/09/emacs-in-wsl-and-opening-links/ +;; For WSL open links in Windows web browser of choice +(when running-on-windows-wsl + (let ((cmd-exe "/mnt/c/Windows/System32/cmd.exe") + (cmd-args '("/c" "start"))) + (when (file-exists-p cmd-exe) + (setq browse-url-generic-program cmd-exe + browse-url-generic-args cmd-args + browse-url-browser-function 'browse-url-generic)))) + (setq bookmark-default-file (concat user-cache-directory "bookmarks")) (use-package transient diff --git a/settings/pre-settings.el b/settings/pre-settings.el index 5033a60f..c1042d44 100644 --- a/settings/pre-settings.el +++ b/settings/pre-settings.el @@ -41,6 +41,14 @@ (memq system-type '(windows-nt cygwin32 cygwin)) "Non-nil if and only if we're running on Windows. Both Win32 and Cygwin count.") +;; https://stackoverflow.com/questions/60922620/shell-script-to-check-if-running-in-windows-when-using-wsl +(defvar running-on-windows-wsl + (string-equal + (replace-regexp-in-string + "[ \n]+$" "" + (shell-command-to-string + "uname -a | sed -n 's/.*\\( *Microsoft *\\).*/\\1/ip'")) + "Microsoft")) (setq user-emacs-directory "~/.config/emacs/") (defconst user-cache-directory (file-name-as-directory (concat user-emacs-directory ".cache")) From 660677e9bbd509a69df1aeb7c452e60a28b6cb27 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Tue, 2 Mar 2021 20:52:40 +0100 Subject: [PATCH 4/5] deactivate hook of iscroll --- settings/gui-settings.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/settings/gui-settings.el b/settings/gui-settings.el index 99a47864..b2205caa 100644 --- a/settings/gui-settings.el +++ b/settings/gui-settings.el @@ -449,7 +449,9 @@ See also `dashboard-insert-section'." :custom-face (focus-unfocused ((t :inherit shadow)))) (use-package iscroll - :hook ((special-mode text-mode) . iscroll-mode)) + :commands iscroll-mode + ;; :hook ((special-mode text-mode) . iscroll-mode) + ) (use-package virtual-auto-fill :delight (virtual-auto-fill-mode "Ⓥf") From e46e3678ddaedce526eace48e990c9d0c270390a Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Thu, 4 Mar 2021 00:03:54 +0100 Subject: [PATCH 5/5] add preamble into latex article export --- lisp/my/my-org-article.el | 1933 +++++++++++++++++++++++++++++++++++-- lisp/my/my-org-letter.el | 12 +- settings/my-settings.el | 4 + settings/org-settings.el | 4 + 4 files changed, 1860 insertions(+), 93 deletions(-) diff --git a/lisp/my/my-org-article.el b/lisp/my/my-org-article.el index 674b2c33..530278c9 100644 --- a/lisp/my/my-org-article.el +++ b/lisp/my/my-org-article.el @@ -1,14 +1,79 @@ ;;; 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: ;;; Code: (require 'ox-latex) + +;; PROPERTY src block header arguments +;; LaTeX +(add-to-list + 'org-global-properties + '("header-args:latex" . + ":headers (if (org-export-derived-backend-p org-export-current-backend 'latex) nil '(\"\\usepackage{xcolor}\\definecolor{color0}{HTML}{ffffff}\\definecolor{color1}{HTML}{0071bc} \\usepackage{pgfplots} \\tikzset{every path/.style={color=white}} \\usetikzlibrary{arrows.meta,calc}\\makeatletter\\tikzset{clip/.code={\\let\\tikz@mode=\\pgfutil@empty\\let\\tikz@preactions=\\pgfutil@empty\\let\\tikz@postactions=\\pgfutil@empty\\let\\tikz@options=\\pgfutil@empty\\tikz@addmode{\\tikz@mode@cliptrue}},}\\makeatother\") )")) +(add-to-list + 'org-global-properties + '("header-args:latex+" . + ":packages '(\"\\usepackage{xcolor}\\definecolor{color0}{HTML}{ffffff}\\definecolor{color1}{HTML}{0071bc} \\usepackage{svg} \\usepackage{tikz} \\usepackage{pgfplots} \\pgfplotsset{compat=newest, axis line style={white}, every axis label/.append style ={white}, every tick label/.append style={white},color0/.style={color=white}}\")")) +;; Gnuplot +(add-to-list + 'org-global-properties + '("header-args:gnuplot" . + ":prologue (by-backend (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:$1@@")) +(add-to-list + 'org-export-global-macros + '("color" . "@@html:$2@@@@latex:\\textcolor[HTML]{$1}{$2}@@")) +;; ACRONYM +(add-to-list + 'org-export-global-macros + '("ac" . "@@html:$1@@@@latex:\ac{$1}@@")) +(add-to-list + 'org-export-global-macros + '("acf" . "@@html:$1@@@@latex:\acf{$1}@@")) +;; 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:$1@@@@latex:\\textsc{$1}@@")) +(add-to-list + 'org-export-global-macros + '("ruby" . "@@html:$1($2)@@@@latex:\\ruby{$1}{$2}@@")) + +;; LaTeX ;;; Function Declarations +(defvar my-org-article-export-headline-levels) +(defvar my-org-article-export-with-sub-superscripts) (defvar my-org-article-export-with-toc) (defvar my-org-article-latex-default-packages-alist) (defvar my-org-article-latex-packages-alist) @@ -17,25 +82,37 @@ (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-opening) +(defvar my-org-article-latex-closing) +(defvar my-org-article-latex-references) + +(defcustom my-org-article-latex-references "" "") (org-export-define-derived-backend 'article-latex 'latex :menu-entry - '(?A "Export to LaTeX (Article)" - ((?L "As LaTeX buffer" my-org-article-latex-export-as-latex) - (?l "As LaTeX file" my-org-article-latex-export-to-latex) - (?p "As PDF file" my-org-article-latex-export-to-pdf) - (?o "As PDF file and open" + '(?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 - '((:with-toc nil "toc" my-org-article-export-with-toc) + '((: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) (: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-compiler "LATEX_COMPILER" nil my-org-article-latex-compiler t)) + (:latex-compiler "LATEX_COMPILER" nil my-org-article-latex-compiler t) + (:article-closing "CLOSING" nil my-org-article-latex-closing newline) + (:article-opening "OPENING" nil my-org-article-latex-opening newline) + (:article-references "REFERENCES" nil my-org-article-latex-references newline)) :translate-alist '((template . my-org-article-latex-template)) @@ -49,6 +126,23 @@ :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 @@ -62,7 +156,7 @@ ;;;; Compilation -(defcustom my-org-articel-latex-compiler "lualatex" +(defcustom my-org-article-latex-compiler "lualatex" "See `org-latex-compiler'." :group 'my-org-export-article :type '(choice @@ -75,18 +169,215 @@ ;;;; Preamble -(defcustom my-org-article-latex-class "koma-letter" +(defcustom my-org-article-latex-default-class "koma-article" "The default LaTeX class." :group 'my-org-export-article :type '(string :tag "LaTeX class")) -(defcustom my-org-article-latex-default-class-options "[enlargefirstpage]" - "The default LaTeX class options." +(defvar my-org-article-latex-header-biblatex + " +%\\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*{\\mkbibnamelast}[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 Fieselschweif‌linge. [...]» +%\\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} +" + "Used in `my-org-article-latex-lang-template-plist' +points to references.bib") + +(defvar my-org-article-latex-lang-template-plist + (list + :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 + :biblatex-en my-org-article-latex-header-biblatex + :biblatex-de-rott "" + :csquotes-en "\\usepackage[autostyle]{csquotes}" + :csquotes-de "\\usepackage[autostyle,german=quotes]{csquotes}" + ;; APPENDIX + :mtcselectlanguage-en "" + :mtcselectlanguage-de "\\mtcselectlanguage{german}" + ;; LISTINGS + :lstlistingname-en "" + :lstlistingname-de "\\renewcommand{\\lstlistingname}{Programmausdruck}" + ) + " +:documentclass-xx used in `my-org-article-latex-default-class-options' +all other in `my-org-article-latex-header' +template replacements in `my-org-article-latex-lang-template-value' +IMPORTANT en version must be defined") + +(defcustom my-org-article-latex-default-class-options + "[paper=a4,fontsize=11pt,DIV=12,BCOR=10mm,headsepline,<>,captions=tableheading,version=first,bibliography=totoc,dvipsnames]" + "The default LaTeX class options. + +`my-org-article-latex-lang-template-plist'" :group 'my-org-export-article :type '(string :tag "LaTeX class")) (add-to-list 'org-latex-classes - '("koma-letter" "\\documentclass{scrlttr2}" + '("koma-article" "\\documentclass{scrartcl}" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") @@ -94,33 +385,1510 @@ ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) (defcustom my-org-article-latex-header - "\\setlength{\\parskip}{6pt} + " +%%% +%%% ARTICLE +%%% +% provides \\isempty test +\\usepackage{xifthen} +%\\newcommand{\\optarg}[1][]{% +% \\ifthenelse{\\isempty{#1}}% +% {}% if #1 is empty +% {(((#1)))}% if #1 is not empty +%} +\\makeatletter +\\newcommand{\\@scrartcl@loaded}{0} +\\AtBeginDocument{\\@ifpackageloaded{scrartcl} + {\\renewcommand{\\@scrartcl@loaded}{1}} + {\\renewcommand{\\@scrartcl@loaded}{0}} +} +\\makeatother + +%%% +%%% COLORS +%%% +\\usepackage{xcolor} +\\usepackage{colortbl} +\\xdefinecolor{navyblue}{rgb}{0,0.35,0.62} +% links, \\everydisplay: +\\definecolor{darkblue}{rgb}{0,0.15,0.35} +\\definecolor{darkred}{rgb}{0.88,0.16,0.17} +\\definecolor{dkgreen}{rgb}{0,0.6,0} +\\definecolor{gray}{rgb}{0.5,0.5,0.5} +% listings: +\\definecolor{mauve}{rgb}{0.58,0,0.82} +\\definecolor{orange}{rgb}{0.8 0.4 0.2} +\\definecolor{dkorange}{rgb}{0.68 0.25 0.07} +\\definecolor{rouge}{rgb}{0.79 0.0 0.1} +\\definecolor{matlab1}{HTML}{0071BC} +\\definecolor{matlab2}{HTML}{D85218} +\\definecolor{matlab3}{HTML}{ECB01F} +\\definecolor{matlab4}{HTML}{7D2E8D} +\\definecolor{matlab5}{HTML}{76AB2F} +\\definecolor{matlab6}{HTML}{4CBDED} +\\definecolor{matlab7}{HTML}{A1132E} + +%%% +%%% PAGE +%%% +\\newif\\iftwocol% +%\\twocoltrue +\\twocolfalse% + +\\special{papersize=210mm,297mm} + +% ----------------------------------------- +% Allgemeine Seiten-Abstände und Einstellungen +% ----------------------------------------- +% Hälfte der Schriftgröße 12pt +\\setlength{\\parskip}{6pt} +% kein einrücken \\setlength{\\parindent}{0pt} \\setlength{\\textheight}{22.5cm} +%\\usepackage[a4paper, top=3cm, left=3.5cm, right=2.8cm]{geometry} +%\\setlength{\\marginparwidth}{1.5cm} % Raum für Randnotiz +% Raum für Randnotiz +\\setlength{\\marginparwidth}{0pt} -\\newcommand{\\fromassociation}{<>} -\\newcommand{\\fromname}{<>} -\\setkomavar{fromname}{\\fromname} -\\newcommand{\\fromstreet}{<>} -\\newcommand{\\fromplace}{<>} -\\setkomavar{fromaddress}{\\fromstreet, \\fromplace} -\\setkomavar{fromphone}{<>} -\\setkomavar{fromurl}{<>} -\\setkomavar{fromemail}{<>} -\\setkomavar{place}{<>} -\\newcommand\\toassociation{<>} -\\newcommand\\toname{<>} -\\newcommand\\tostreet{<>} -\\newcommand\\toplace{<>} -\\newcommand\\subject{<>} -\\newcommand\\subjectextra{<>} +% muss vor hyperref +\\usepackage{setspace} +% Zeilenabstand, \\doublespacing, \\singlespacing +\\onehalfspacing% -% adjust some spacings +\\KOMAoptions{DIV=last} +% Nach ändern der Schriftart von KOMA-Script ganz bequem den Satzspiegel neu berechnen lassen. +\\recalctypearea% + +%keine einzelnen Seiten eines Absatzes oben oder unten auf einer Seite +\\clubpenalty=10000 +\\widowpenalty=10000 +\\displaywidowpenalty=10000 + +% Fix overful hboxes automatically: +% allg., Stand. 200, defensiver 2000 +%\\tolerance=2000 +%10pt% im Fall, Stand. 0, besser als \\tolerance +\\emergencystretch=6pt +%\\hbadness=1000 % Warnungsausgabe, Stand. 1000 +\\setlength{\\overfullrule}{5pt} + +% global oder lokal Silbentrennung verbieten +%\\pretolerance=10000 % or/the same result? \\hyphenpenalty=10000 + +% Befehle: +%\\newline +%\\linebreak + +% muss vor tocstyl +\\usepackage{pdfpages} +\\usepackage{pdflscape} + +% Verzeichnis +% package tocstyle obsolete, possible supported packages like tocbasic or scrwfile +% https://tex.stackexchange.com/questions/565279/missing-tocstyle-sty-file +%\\usepackage{tocstyle} % Obsolete, tocstyle +\\usepackage{tocbasic} +\\usepackage{scrwfile} +\\iftwocol% + \\usepackage[toc]{multitoc} + \\renewcommand*{\\multicolumntoc}{2} + \\setlength{\\columnseprule}{0.5pt} +\\fi +%\\usetocstyle{allwithdot} % Obsolete, tocstyle +\\usepackage{tocloft} +\\setlength{\\cftbeforefigskip}{0ex} +% first: pnumwidth, second: margin, default: 1.55em and 2.55em +\\cftlocalchange{toc}{2em}{2.55em} + +%\\usepackage{bigfoot} % footnote + + +% debug the box warnings +\\showboxdepth=\\maxdimen% +\\showboxbreadth=\\maxdimen% + + +% \\pdfminorversion=5 % to allow compression ## LuaLatex does not understand this +% \\pdfobjcompresslevel=2 ## LuaLatex does not understand this + + +\\usepackage{afterpage} \\makeatletter -\\@setplength{toaddrwidth}{10cm} +\\def\\mynobreakpar{\\par\\nobreak\\@afterheading} +\\def\\mynobreakline{\\par\\nobreak\\vspace{-\\parskip}\\@afterheading\\noindent} \\makeatother +\\newenvironment{absolutelynopagebreak} + {\\par\\nobreak\\vfil\\penalty0\\vfilneg% + \\vtop\\bgroup} + {\\par\\xdef\\tpd{\\the\\prevdepth}\\egroup% + \\prevdepth=\\tpd} +%\\begin{absolutelynopagebreak} +%\\lipsum[1-3]\\lipsum*[4] +%\\end{absolutelynopagebreak} + +%%% +%%% FONTS +%%% +% ----------------------------------------- +% Schrift +% ----------------------------------------- +% Schöneres Schriftpacket für LateX +\\usepackage{lmodern} +% Dominanz hinten +<> +% \\usepackage[utf8]{inputenc} % latin1, utf8, ansinew, latin2 +\\usepackage[utf8]{luainputenc} +\\usepackage[T1]{fontenc} +<> + +\\DeclareUnicodeCharacter{2009}{\\,} % convert unicode to latex command, thin-space + +% bessere Schrifte +% sfmath, % sans-serif slanted fonts +% slantedGreeks, % Uppercase greeks are slanted +% do not load textcomp again +\\usepackage[notextcomp]{kpfonts} +\\usepackage[scale=0.95]{opensans} + +% hyphenatable letterspacing, underlining and some derivatives such as overstriking and highlighting, soul +\\usepackage{soulutf8} +% \\so{letterspacing} l e t t e r s p a c i n g +% \\caps{CAPITALS, Small Capitals} like \\textsc{} +% \\ul{underlining} +% \\st{overstriking} +% \\hl{highlighting} + +% Damit ich mir nicht immer neuen Text ausdenken muss +\\usepackage{blindtext} + +% use: \\ce IMPORTANT: mhchem must be load before sparse and/or xpatch: l3str: \\c_backslash_str +\\usepackage[version=3]{mhchem} +\\usepackage{xparse} + +% Befehle: +% change family of the font. If possible other aspects – like the series or the shape – are preserved. +% \\textrm (\\rmfamily) Normal font (default). +% \\textsf (\\sffamily) Sans serif. +% \\texttt (\\ttfamily) Typewriter. +% \\emph Emphasis (toggles between \\textit and \\textrm) + +% \\textmd (\\mdseries) Medium weight (default). The opposite of boldface. +% \\textbf (\\bfseries, \\bf) Bold weight. + +% \\textup (\\upshape) Upright (default). The opposite of slanted. +% \\textit (\\itshape) Italic. +% \\textsl (\\slshape) Slanted. +% \\textsc (\\scshape) Small caps. + +% \\textnormal (\\normalfont) Main document font. + +% \\tiny \\scriptsize \\footnotesize \\small +% \\normalsize (default) +% \\large \\Large \\LARGE \\huge \\Huge + +%\\usepackage[normalem]{ulem} +% \\uline{...} Underlined text, breaks over multiple lines +% \\uuline{...} double-underlined text +% \\uwave{...} wave-underlined text +% \\sout{...} ------------ +% \\xout{...} //////////// + +% remap ulem command to soul: underline +%\\renewcommand{\\uline}[1]{\\ul{#1}} +% remap ulem command to soul: overstriking +% TODO uncomment? +\\renewcommand{\\sout}[1]{\\st{#1}} +<> + +%%% +%%% RUNNINGTITLE +%%% +% ----------------------------------------- +% Seitenstil für lebende Kolumnentitel +% ----------------------------------------- +%\\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} +} + +% must be set between an header and text, direct before the first paragraph, and must be compiled at least twice +\\newcommand{\\sectionheader}{% + \\thispagestyle{plain}% + \\begin{tikzpicture}[remember picture, overlay]% + \\node[shift={(0 cm,-2.8cm)}] at (current page.north west){% + \\begin{tikzpicture}[remember picture, overlay]% + \\node[shift={(2.8,0)},right] {\\TITLE\\ -- \\SUBTITLE};% + \\end{tikzpicture}% + };% + \\node[shift={(0 cm,-2.8cm)}] at (current page.north east){% + \\begin{tikzpicture}[remember picture, overlay]% + \\node[shift={(-2.8,0)},left] {\\AUTHOR};% + \\end{tikzpicture}% + };% + % Draw a page border + % \\draw (current page.north west) rectangle (current page.south east);% + \\end{tikzpicture}% +} + +%%% +%%% REFERENCES +%%% +% ----------------------------------------- +% Literatur +% ----------------------------------------- +<> + +%babel, % 'babel' depreciated - autostyle +<> + +\\expandafter\\def\\expandafter\\quote\\expandafter{\\quote\\small} % Schriftverkleinerung in quote-Umgebung + +% cite, key, page numbers +\\newcommand{\\zitat}[3]{ + \\begin{quote}\\small + #1 + % \\psq: no suffixes/prefix + \\hfill\\autocite[#3\\psq]{#2} + \\end{quote} +} + +%%% +%%% ACRONYMS +%%% +% ----------------------------------------- +% Listen: Aufzählende, Acronyms +% ----------------------------------------- +\\setlength{\\leftmargini}{2\\parskip} % Listeneinzug +% how to use acronyms: +% \\ac = use acronym, first time write both, full name and acronym +% \\acf = use full name (text + acronym) +% \\acs = only use acronym +% \\acl = only use long text +% \\acp, acfp, acsp, aclp = use plural form for acronym (append 's') +% \\acsu, aclu = write + mark as used +% \\acfi = write full name in italics and acronym in normal style +% \\acused = mark acronym as used +% \\acfip = full, emphasized, plural, used +% \\iac and \\Iac = indefinite articles +\\usepackage[ + %footnote, % die Langform als Fußnote ausgeben + %nohyperlinks, % wenn hyperref geladen ist, wird die Verlinkung unterbunden + %printonlyused, % nur Abkürzungen auflisten, die tatsächlich verwendet werden. + %withpage, + %smaller, % Text soll kleiner erscheinen, das Paket relsize wird vorausgesetzt + %dua, % es wird immer die Langform ausgegeben + %nolist, % es wird keine Liste mit allen Abkürzungen ausgegeben +]{acronym} + +\\renewcommand\\acsfont{\\normalfont} +\\makeatletter +\\def\\uplabel#1{{\\normalfont{\\textsf{#1}}\\hfill}} +\\renewenvironment{acronym}[1][1]{% + \\singlespacing% + \\setstretch{0.8} + \\providecommand*{\\acro}{\\AC@acro}% + \\providecommand*{\\acroplural}{\\AC@acroplural}% + \\long\\def\\acroextra##1{##1}% + \\def\\@tempa{1}\\def\\@tempb{#1}% + \\ifx\\@tempa\\@tempb% + \\global\\expandafter\\let\\csname ac@des@mark\\endcsname\\AC@used% + \\ifAC@nolist% + \\else% + \\begin{list}{}% +% change according to your needs , 4.45 + {\\settowidth{\\labelwidth}{\\normalfont{\\textsf{#1}}\\hspace*{3.5em}}% + \\setlength{\\leftmargin}{\\labelwidth+\\parskip}% + \\addtolength{\\leftmargin}{\\labelsep}% + \\renewcommand{\\makelabel}{\\uplabel}} + \\fi% + \\else% + \\begin{AC@deflist}{#1}% + \\fi% + }% + {% + \\ifx\\AC@populated\\AC@used\\else% + \\ifAC@nolist% + \\else% + \\item[]\\relax% + \\fi% + \\fi% + \\expandafter\\ifx\\csname ac@des@mark\\endcsname\\AC@used% + \\ifAC@nolist% + \\else% + \\end{list}% + \\fi% + \\else% + \\end{AC@deflist}% + \\fi}% +\\renewenvironment{AC@deflist}[1]% + {\\ifAC@nolist% + \\else% + \\raggedright\\begin{list}{}% +% change according to your needs , 4.45 + {\\settowidth{\\labelwidth}{\\normalfont{\\textsf{#1}}\\hspace*{3.5em}}% + \\setlength{\\leftmargin}{\\labelwidth}% + \\addtolength{\\leftmargin}{\\labelsep}% + \\renewcommand{\\makelabel}{\\uplabel}}% + \\fi}% + {\\ifAC@nolist% + \\else% + \\end{list}% + \\fi}% + \\makeatother + +%%% +%%% APPENDIX +%%% +% ----------------------------------------- +% Abschnittsverzeichnisse (Anhang) +% ----------------------------------------- +\\usepackage{appendix} +\\setcounter{tocdepth}{3} +\\setcounter{secnumdepth}{3} + +% hyperref must be loaded before minitoc +\\makeatletter +\\ifthenelse{\\@scrartcl@loaded=1}{ + \\usepackage[insection,nohints]{minitoc} + \\mtcsetdepth{secttoc}{3} + %\\setlength{\\stcindent}{-16.5pt} + \\setlength{\\stcindent}{0pt} + \\mtcsetformat{secttoc}{pagenumwidth}{2em} % more space for page numbers + %\\renewcommand{\\stctitle}{} % Leer: Keine Überschrift + \\renewcommand{\\stcfont}{\\normalfont\\rmfamily\\upshape\\mdseries} +}{ + \\usepackage[nohints]{minitoc} +} +\\makeatother + +\\makeatletter +\\def\\mtc@CkFile#1{% + \\@mtc@LItrue\\@mtc@FEtrue% + \\if@mtc@checkfiles% + \\IfFileExists{#1}{% + \\immediate\\openin\\@inputcheck #1\\relax + \\mtc@While{}{\\if@mtc@LI\\relax}{\\mtc@Body}\\mtc@EndWhile% + % + }% + {\\@mtc@FEtrue}% + \\else + \\@mtc@FEfalse% + \\fi + %moved in the definition + \\closein\\@inputcheck\\relax}% +\\makeatother + +<> +% \\sffamily +\\mtcsetfont{secttoc}{subsection}{\\normalfont\\rmfamily\\upshape\\mdseries} +\\mtcsetfont{secttoc}{subsubsection}{\\normalfont\\rmfamily\\upshape\\mdseries} +% local use: \\nostcrule +\\mtcsetrules{*}{off} +%\\mtcsetpagenumbers{mini-table|*}{on|off} + +\\newcommand{\\pdfsection}[1]{ + \\addtocounter{section}{1} + \\phantomsection\\addcontentsline{toc}{section} + {\\protect\\numberline{\\thesection}#1} +} +\\newcommand{\\pdfsubsection}[1]{ + \\addtocounter{subsection}{1} + \\phantomsection\\addcontentsline{toc}{subsection} + {\\protect\\numberline{\\thesubsection}#1} +} +\\newcommand{\\pdfsubsubsection}[1]{ + \\addtocounter{subsubsection}{1} + \\phantomsection\\addcontentsline{toc}{subsubsection} + {\\protect\\numberline{\\thesubsubsection}#1} +} + +\\newcommand{\\pdfsectiona}[1]{ +% Den folgenden Inhalt nicht im großen Inhaltsverzeichnis zeigen + \\begin{mtchideinmaintoc}[-1] + \\addtocounter{section}{1} + \\phantomsection\\addcontentsline{toc}{section} + {\\protect\\numberline{\\thesection}#1} + \\end{mtchideinmaintoc} +} +\\newcommand{\\pdfsubsectiona}[1]{ +% Den folgenden Inhalt nicht im großen Inhaltsverzeichnis zeigen + \\begin{mtchideinmaintoc}[-1] + \\addtocounter{subsection}{1} + \\phantomsection\\addcontentsline{toc}{subsection} + {\\protect\\numberline{\\thesubsection}#1} + \\end{mtchideinmaintoc} +} +\\newcommand{\\pdfsubsubsectiona}[1]{ +% Den folgenden Inhalt nicht im großen Inhaltsverzeichnis zeigen + \\begin{mtchideinmaintoc}[-1] + \\addtocounter{subsubsection}{1} + \\phantomsection\\addcontentsline{toc}{subsubsection} + {\\protect\\numberline{\\thesubsubsection}#1} + \\end{mtchideinmaintoc} +} + +%%% +%%% INDEX +%%% +\\usepackage{imakeidx} +%\\usepackage{splitidx} +\\newcommand{\\Index}[1]{#1\\index{#1}} +% Formatiere Seitennummern im Index: +\\newcommand{\\indexpageno}[1]{% + {\\bfseries\\hyperpage{#1}}% +} +\\makeindex +%\\makeindex[% + %name=persons, + %title=Index of names, + %columns=3 +%] + +\\usepackage{idxlayout} % avoid LaTeX bug 3126 (\twocolumn interfering with \topskip) +\\usepackage{ragged2e} % avoid the automatic loading of the ragged2e package failure + +%\\index[persons]{Einstein, Albert} +\\indexsetup{% + level=\\section*, + toclevel=section, + noclearpage, + %firstpagestyle=plain, % disabled when the package fancyhdr is loaded + %headers={\\indexname}{\\indexname} % Don’t use these keys if you use fancyhdr +} +%save as .mst: +%headings_flag 1 +%heading_prefix \"{\\\\bf ---~\" +%heading_suffix \"~---}\" +%delim_0 \"\\\\dotfill\\\\indexpageno{\" +%delim_1 \"\\\\dotfill\\\\indexpageno{\" +%delim_2 \"\\\\dotfill\\\\indexpageno{\" +%delim_t \"}\" +%delim_n \"}, \\\\indexpageno{\" +%delim_r \"} -- \\\\indexpageno{\" +%suffix_2p \"}f.{\" +%suffix_3p \"}ff.{\" +%symhead_negative \"Symbole\" +%symhead_positive \"Symbole\" +%numhead_negative \"Zahlen\" +%numhead_positive \"Zahlen\" +%quote '+' +%line_max 255 + +%%% +%%% GLOSSARIES +%%% +\\usepackage[% + %nowarn, + %nomain, + %toc=true, % Eintrag im Inhaltsverzeichnis + %style=altlist, % altlist: Beschreibung beginnt in neuer Zeile + nonumberlist, % keine Seitenzahlen anzeigen + nogroupskip, % keine extra Abstand bei Buchstabenwechsel + %acronym=true, % ein Abkürzungsverzeichnis erstellen + section=section, % im Inhaltsverzeichnis auf section-Ebene erscheinen, subsection ... + %description, % n changes the definition of \\newacronym to allow a description + %makeindex, + %xindy={language=german-duden,codepage=utf8} % mit makeglossaries.exe ? + %hyperfirst=false, % +]{glossaries} + +\\usepackage[nonumberlist, nogroupskip, section=section,]{glossaries} + +%Den Punkt am Ende jeder Beschreibung deaktivieren +\\renewcommand*{\\glspostdescription}{} +% to refer \\ref{glo:...} +\\renewcommand*{\\glsautoprefix}{glo:} +%Allgemeine definition +%\\newglossary[⟨log-ext⟩]{⟨name⟩}{⟨in-ext⟩}{⟨out-ext⟩}{⟨title⟩}[⟨counter⟩] +\\newcommand{\\dictentry}[2]{% + \\newglossaryentry{#1}{name=#1,description={#2}}% + \\glslink{#1}{}% +} + +%\\input{Glossary.tex} +%\\makeglossaries% + +%%% +%%% FIGURES +%%% +% ----------------------------------------- +% Abbildungen & Tabellen +% ----------------------------------------- +\\usepackage{float} +\\usepackage{floatflt} +\\usepackage[ + font=small, % footnotesize, small + labelfont={bf,up,sf}, + %textfont={it,up}, + justification=raggedright, % justified + singlelinecheck=false, + %format=plain, + %indention=0cm, +]{caption} +%\\addtokomafont{caption}{\\small} % Bildunterschrift Größe \"small\" +%\\setkomafont{captionlabel}{\\sffamily\\bfseries} % das Label wird serifenlos und fett +\\usepackage{subcaption} +\\usepackage{tablefootnote} + +%%%%%% THIS PASSAGE MAKES THE TABLE AND FIGURE COUNT TO 1.1 or 4.1 INSTEAD OF 1,2,3,4... +%\\usepackage{chngcntr} +%\\counterwithin{figure}{section} +\\counterwithin{table}{section} + + +% ----------------------------------------- +% Abbildungen +% ----------------------------------------- +\\usepackage[% + %draft, + %dvips, % or dvipdfm, pdftex +]{graphicx} +%\\graphicspath{{path_to_images/}} +%\\graphicspath{{the/first/path/}{the/second/path/}} +\\graphicspath{{./figures/}} +% Grafik abschneiden (links unten rechts oben): +% \\includegraphics[trim=0 0 2cm 0,clip,width=\\textwidth]{Bild} +% with px units, where is the resolution of the image: +% \\pdfpxdimen=\\dimexpr 1 in/\\relax +% \\includegraphics[trim=0 0 20px 0,clip,width=\\textwidth]{Bild} +% or use defined dpi option: +\\makeatletter + \\define@key{Gin}{dpi}{% + \\pdfpxdimen=\\dimexpr 1in/(#1)\\relax } +\\makeatother +% \\includegraphics[dpi=600,clip,trim=0 100px 200px 100px]{Figure-a} % 600 dpi + + % um eps-Dateien einzubinden (\\epsfig{file=...}) +%\\usepackage{epsfig} + +\\makeatletter +\\renewcommand*\\l@figure{\\@dottedtocline{1}{0em}{2.8em}} +\\renewcommand*\\l@table{\\@dottedtocline{1}{0em}{2.3em}} +\\makeatother + + +%############## +% SVG Einbinden +%############## +\\usepackage{svg} +\\newcommand{\\executeiffilenewer}[3]{% + \\ifnum\\pdfstrcmp{\\pdffilemoddate{#1}}% + {\\pdffilemoddate{#2}}>0% + {\\immediate\\write18{#3}}\\fi% +} +% set inkscape binary path according to operating-system +\\IfFileExists{/dev/null}{% + \\newcommand{\\Inkscape}{inkscape}% + }{% + %\\newcommand{\\Inkscape}{\"/usr/bin/inkscape\" }% + \\newcommand{\\Inkscape}{inkscape}% +} +% includesvg[scale]{file} command +%\\newcommand{\\includesvg}[2][1]{% +% \\executeiffilenewer{#2.svg}{#2.pdf}{% +% \\Inkscape -z -D --file=\"#2.svg\" --export-pdf=\"#2.pdf\" --export-latex }% +% \\scalebox{#1}{\\input{#2.pdf_tex}}% +%} + +% usage example: +% \\begin{center} +% \\includesvg[2]{filename} +% \\end{center} + +% the following eps function is unsure - copy from web !!! +%\\usepackage{epstopdf} +%\\newcommand{\\includeps}[2][\\undefined]{% +% \\immediate\\write18{inkscape2tex.py -i #2 -m latex-eps}% +% \\ifx#1\\undefined% +% \\global\\let\\svgwidth\\undefined% +% \\else% +% \\def\\svgwidth{#1}% +% \\fi% +% \\IfFileExists{#2.eps_tex}{% +% \\input{#2.eps_tex}% +% }{% +% {\\color{red} FILE #2.eps_tex NOT FOUND.}% +% }% +%}% + + +% Diagramme +\\usepackage[all]{xy} + +% ----------------------------------------- +% Tabellen +% ----------------------------------------- +%\\usepackage{rotating} % rotated text, vertical: \\begin{sideways} ... \\end{sideways} +% fuer Tabellen ueber mehrere Seiten +\\usepackage{longtable} +% fuer mehrspaltigen Text auf einer Seite +\\usepackage{multicol} +% fuer mehrreihigen Text auf einer Seite +\\usepackage{multirow} +\\usepackage{booktabs} +\\usepackage{array} +\\usepackage{eqnarray} +\\newcolumntype{P}[1]{>{\\raggedright\\arraybackslash}p{#1}} +\\newcolumntype{C}[1]{>{\\centering}p{#1}<{}} +%\\newcolumntype{L}[1]{>{\\raisebox{\\heightof{\\rule{0pt}{1cm}}}{}}p{#1}} +% Anzahl Zeilen, Weite, Inhalt +\\newcommand{\\multirowr}[3]{\\multirow{#1}{*}{\\parbox{#2}{\\raggedright #3}}} + +%\\usepackage{fancybox} % besondere Rahmen, Schatten + +%\\begin{center} +%\\resizebox{0.95\\textwidth}{!}{% +%\\begin{tabular} +%... +%\\end{tabular}} +%\\end{center} +% Zahlenformatierung +\\usepackage[autolanguage]{numprint} +% Rechenmöglichkeit in Tabellen +\\usepackage{spreadtab} + +%%% +%%% LISTS +%%% +% ----------------------------------------- +% Aufzählungen +% ----------------------------------------- +\\makeatletter +\\newcommand*{\\rom}[1]{\\mathrm{\\romannumeral #1}} +\\newcommand*{\\Rom}[1]{\\mathrm{\\expandafter\\@slowromancap\\romannumeral #1@}} +\\makeatother + +\\renewcommand{\\labelitemi}{--} +% \\times +\\renewcommand{\\labelitemii}{\\(\\boldsymbol\\cdot\\)} + +% Verbesserte Enumerate-Umgebung +\\usepackage{enumerate} + +\\usepackage{enumitem} +% noitemsep +\\setlist{nosep} +% Usually a good idea +\\setlist[1]{labelindent=\\parindent} +\\setlist[itemize]{parsep=0pt,itemsep=0pt,leftmargin=*} +\\setlist[enumerate]{parsep=0pt,itemsep=0pt,leftmargin=*} + +%%% +%%% LISTINGS +%%% +\\usepackage{listingsutf8} +%\\begin{lstlisting}[numbersep=0pt,resetmargins=true] +<> +\\lstdefinestyle{custom}{ + %xleftmargin=2em, +} +\\lstdefinelanguage{example}{ +} +\\lstdefinelanguage{org}{ +} +\\lstdefinelanguage{calc}{ +} +\\lstdefinelanguage{shell}{ +} + +% BEFORE loading tikz!? +\\lstdefinestyle{tex}{ + language=[LaTeX]tex, + tabsize=4, + breaklines=true, + breakindent=0pt, + columns=fullflexible, +% otherwise copy-and-paste won’t work + basicstyle=\\ttfamily +} +\\lstset{literate=% +{Ö}{{\\\"O}}1 +{Ä}{{\\\"A}}1 +{Ü}{{\\\"U}}1 +{ß}{{\\ss}}1 +{ü}{{\\\"u}}1 +{ä}{{\\\"a}}1 +{ö}{{\\\"o}}1 +} +\\lstset{ + extendedchars=\\true, + inputencoding=utf8/latin1, + style=custom, + language=Matlab, + % small, footnotesize + basicstyle=\\small\\ttfamily, + % \\bfseries + keywordstyle=\\color{blue}, + % \\itshape + commentstyle=\\color{dkgreen}, + %identifierstyle=\\color{blue}, + stringstyle=\\color{mauve}, + % \\ttfamily + numberstyle=\\tiny\\color{gray}, + numbers=left, + numbersep=5pt, + %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, + breaklines=true, + breakatwhitespace=true, + %breakindent=20pt, + tabsize=2, + % 2\\parskip + xleftmargin=2em, + %title=\\lstname, + %captionpos=b, % b: bottom + captionpos=t, + %belowcaptionskip=1\\baselineskip, + %texcl=true, % not with inputencoding utf/latin1 LATEX comment lines, for äöü... + %escapebegin=\\begin{arab},escapeend=\\end{arab}, + escapeinside={\\%*}{*)}, + %morekeywords={*,...}, + %deletekeywords={...}, +% auto: Listings with identical names (case sensitive!) share a line counter / or number + firstnumber=auto, +} +\\newcommand{\\includecode}[2][c]{ + \\lstinputlisting[ + caption=#2, + escapechar=, + style=#1, + %label=DescriptiveLabel, +]{#2}} +% \\includecode{sched.c} +% \\includecode[asm]{sched.s} +% \\lstlistoflistings + +%%% +%%% MATH +%%% +% ----------------------------------------- +% Zusatzzeichen, Mathematik, Chemie +% ----------------------------------------- +% fette Schrift, z.B. $\\boldsymbol{\\pi}$ +% Zusammenrücken: \\!, \\negmedspace, \\negthickspace +% Platz einfügen: \\, \\: \\; ~ oder \\quad und \\qquad +% mehrzeilige Grenzen, \\substack{...\\\\...} +% \\overset{}{} und \\underset{}{} setzte Formelbestandteile über- oder untereinander +% \\underbrace{a+b}_\\text{Schritt 1} +% \\overbrace{e^2 - \\pi}^\\text{Schritt 2} +\\numberwithin{equation}{section} +% Manuelle Nummerierung, z. B. 1.2 a +%\\begin{equation*} \\tag{} \\end{equation*} +%\\allowdisplaybreaks % global und lokal Anwendbar, z. B. bei underful vboxes + +%\\usepackage{fourier} +\\usepackage{mathtools} +% linie unterhalb mit text \\underbracket[1pt][0pt]{bla}_\\text{blo} + +\\newcommand\\Dfrac[2]{\\dfrac{\\displaystyle #1}{\\displaystyle #2}} +\\newcommand{\\slfrac}[2]{\\left.#1\\middle/#2\\right.} +\\usepackage{xfrac} +\\usepackage{nicefrac} +\\usepackage{faktor} +% +% 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}% +} + +% another slanted fration below at tikz + +\\usepackage{eurosym} % fuer das Eurosymbol +\\DeclareUnicodeCharacter{20AC}{\\euro{}} % convert unicode character to latex command + +% \\usepackage[ % kann nicht mit amssymb zusammenlaufen +% 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, +% ]{SIunits} + +% siunitx is written by Joseph Wright who did, for a time, maintain SIunits. siunitx replaces SIunits and another package called SIstyle. It is a complete reimplementation of the basic idea. +\\usepackage[]{siunitx} +\\DeclareSIUnit{\\EUR}{\\text{\\euro}} +%obsolete \\usepackage[thinspace, thinqspace, squaren, Gray,]{SIunits} + +% tiefstellen, Index +\\newcommand{\\ti}[1]{_\\mathrm{#1}} +% hochstellen +\\newcommand{\\ho}[1]{^\\mathrm{#1}} +%\\usepackage{mathrsfs} % use \\mathscr, Ralph Smith’s Formal Script Font +%\\usepackage{ziffer} + +%Mathematische Schrifterweiterungen +% use \\mathds{A} alternative zu mathbb +\\usepackage{dsfont} +% for tensori; incompatible with the amssymb and amsfonts, automatically loads the amsmath and textcomp +\\usepackage{MnSymbol} + +% Mengensymbole +% Grundkörper in mathds +\\newcommand{\\field}[1]{\\ensuremath{\\mathds{#1}} } +% Affines A +\\newcommand{\\fA}{\\field{A}} +% Complexes C +\\newcommand{\\fC}{\\field{C}} +% Endlicher Koerper +\\newcommand{\\fFp}{\\ensuremath{\\field{F}_{\\!p}} } +% Endlicher Koerper +\\newcommand{\\fFq}{\\ensuremath{\\field{F}_{\\!q}} } +% Add Gruppenschema +\\newcommand{\\fGa}{\\ensuremath{\\field{G}_{a}} } +% Generischer Koerper +\\newcommand{\\fK}{\\field{K}} +% Nat Zahlen +\\newcommand{\\fN}{\\field{N}} +% Projektives P +\\newcommand{\\fPj}{\\field{P}} +% Reelle Zahlen +\\newcommand{\\fR}{\\field{R}} +% Rationale Zahlen +\\newcommand{\\fQ}{\\field{Q}} +% Irrationale Zahlen I=R\\Q +\\newcommand{\\fI}{\\field{I}} +% Ganze Zahlen +\\newcommand{\\fZ}{\\field{Z}} +% fuer die gilt +\\newcommand{\\fdg}{\\;|\\;} +% Definitionsbereich +\\newcommand{\\Def}{\\field{D}} +% Lösungsmenge +\\newcommand{\\LM}{\\field{L}} +\\newcommand*{\\qed}{\\hfill\\ensuremath{\\blacksquare}} +\\newcommand*\\euler{\\mathrm{e}} +\\renewcommand{\\deg}{\\ensuremath{^{\\circ}}\\xspace} +\\newcommand\\degC{{\\,^{\\circ}\\mathrm{C}}} +% short sin: s +\\newcommand\\sins{{\\mathrm{s}}} +% short cos: c +\\newcommand\\coss{{\\mathrm{c}}} + +% Transpose operator +\\newcommand{\\T}{{\\mathrm{T}}\\!} +% sign for transfomed values: low tilde +\\newcommand{\\TF}{{\\raisebox{-0.5ex}{$\\sim$}}} +% Adjoint operator +\\newcommand{\\adj}{{\\mathrm{H}}} +\\newcommand*\\dif{\\mathop{}\\!\\mathrm{d}} +\\newcommand*\\E{\\ensuremath{\\mathrm{E}}} + +% ||x|| +\\providecommand{\\norm}[1]{\\lVert #1 \\rVert} +% |x| +\\providecommand{\\abs}[1]{\\lvert #1 \\rvert} +% +\\providecommand{\\innerProd}[2]{\\langle #1, #2\\rangle} + +% Bild einer Funktion +\\DeclareMathOperator{\\Bild}{Bild} +% Rank of a matrix +\\DeclareMathOperator{\\rank}{rank} +% Matrix trace +\\DeclareMathOperator{\\tr}{tr} +% Matrix deviation +\\DeclareMathOperator{\\dev}{dev} +% Variance +\\DeclareMathOperator{\\var}{var} +% $\\grad u$ = grad u +\\DeclareMathOperator{\\grad}{grad} +% $\\div u$ = div u +\\DeclareMathOperator{\\divergence}{div} +% $\\rot u$ = rot u +\\DeclareMathOperator{\\rot}{rot} +% Diagonal matrix +\\DeclareMathOperator{\\diag}{diag} +% Classical adjoint (adjugate) +\\DeclareMathOperator{\\adjugate}{adj} + +%\\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}}} + +% both for tensor +\\usepackage{accents} +\\usepackage{ushort} +%\\usepackage{ulem} % not for math mode, too much space below with uuline; for tensor + +\\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 variant +%\\usepackage{bm} % 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} } } } } + +%needs MnSymbol +\\newcommand{\\tensori}[1]{ + \\tikz[baseline, anchor=base,inner sep=0pt]{ + \\node{\\ensuremath{\\phantom{#1\\vphantom{\\overrightharpoon{b}}}}}; + \\node[overlay]{ \\ensuremath{ \\overrightharpoon{ \\mbox{\\ensuremath{#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{#1}\\vphantom{b}} } } }; + \\node[overlay]{ \\reflectbox{ \\ensuremath{ \\overrightharpoon{ \\phantom{ \\mbox{\\ensuremath{#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{#1}\\vphantom{b}} } } }; + \\node[overlay]{ \\reflectbox{ \\ensuremath{ \\overrightharpoon{ \\phantom{ \\mbox{\\ensuremath{#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{#1}\\vphantom{b}} } } }; + \\node[overlay]{ \\reflectbox{ \\ensuremath{ \\overrightarrow{ \\phantom{ \\mbox{\\ensuremath{#1}\\vphantom{b}} } } } } }; + } +} + +\\usepackage{amsthm} +\\theoremstyle{definition} +% nummeriert +\\newtheorem{tDef}{Def} +\\newtheorem{tBsp}{Bsp} +% unnummeriert +\\newtheorem*{tDef*}{Def} +\\newtheorem*{tBsp*}{Bsp} + +\\newcommand{\\undertab}[1]{\\clap{% + \\scriptsize\\begin{tabular}{@{}c@{}}#1\\end{tabular}}} +% underbrace, centered, space corrected +\\newcommand{\\ubspace}[2]{% Correct \\underbrace spacing + \\mathrlap{\\underbrace{\\phantom{\\scalebox{0.95}{$#1$}\\strut}}_{\\undertab{#2}}}#1} +% underbrace, left aligned, space corrected +\\newcommand{\\ubspacel}[2]{% Correct \\underbrace spacing + \\mathrlap{\\underbracket[0pt][0pt]{\\phantom{\\scalebox{0.95}{$#1$}\\strut}}_{\\vphantom{\\big\\mid}\\text{#2}}}\\underbrace{#1}} +% underbrace line, left aligned, space corrected +\\newcommand{\\ubspacell}[2]{ + \\mathrlap{\\underbracket[0pt][0pt]{\\phantom{#1\\strut}}_{\\text{#2}}}\\underbracket[0.5pt][0pt]{#1}} + +\\usepackage{cancel} + + +%\\begin{pmatrix}[1.5] -> \\arraystretch{1.5} +\\makeatletter +\\renewcommand*\\env@matrix[1][\\arraystretch]{% + \\edef\\arraystretch{0.8}% + \\edef\\arraystretch{#1}% + \\edef\\arraycolsep{2pt}% + \\hskip -\\arraycolsep% + \\let\\@ifnextchar\\new@ifnextchar% + \\array{*\\c@MaxMatrixCols c}} +\\makeatother + +\\newenvironment{Array}[1]{ + \\begingroup + \\arraycolsep=1pt\\def\\arraystretch{1} + \\begin{array}{@{}#1@{}} +}{\\end{array}\\endgroup} + + +% ----------------------------------------- +% Eigene Befehle +% ----------------------------------------- + % öffnende Winkelklammer \"\" +\\newcommand{\\<}{\\(\\langle\\)} +% schliessende Winkelklammer \"\" +\\renewcommand{\\>}{\\(\\rangle\\)} + +\\newcommand{\\bsufont}{\\normalfont\\sffamily\\upshape\\bfseries} + +\\newcommand\\TikZ{Ti\\textit kZ} +\\newcommand\\PGF{\\textsc{pgf}} + +% Technische Zeichen +\\newcommand{\\bohrtiefe}{\\scalebox{1}[0.75]{\\rotatebox[origin=ct]{-90}{\\hspace{0.2ex}$\\mapsto$}}} + +%%% +%%% TIKZ +%%% +% ----------------------------------------- +% Zeichnungen +% ----------------------------------------- +\\usepackage{tikz} +\\usepackage{gnuplot-lua-tikz} +% ,pgfmath +\\usepackage{pgfplots} +\\usepgflibrary{shapes.geometric} +\\usepackage{tabularx} +\\usetikzlibrary{ + % for arrow heads + arrows, + % for manimulation of coordinates + calc, + positioning, + shapes.multipart, + %shadings, + decorations.pathmorphing, + % need package pgfplots + backgrounds, + %after pgfplots + pgfplotsclickable, + shadows, + shadows.blur, + mindmap, +} + +% based on soul +% \\highlight[tikz-opts]{...} like: +% \\highlight{} +% \\highlight[red]{} +% \\highlight[green, draw=blue]{} +\\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 + + +\\pgfplotsset{ + % or newest, + compat=1.17, + % Komma statt Punkt als Dezimaltrennzeichen + x tick label style={/pgf/number format/use comma}, + y tick label style={/pgf/number format/use comma}, + every node near coord/.style={/pgf/number format/use comma}, + /pgfplots/annot/js fillColor={[\"RGB\",1,1,1]}, + every semilogy axis/.append style={/pgfplots/annot/point format={(\\%.1f,\\%.1e)}}, + every semilogx axis/.append style={/pgfplots/annot/point format={(\\%.1e,\\%.1f)}}, + every loglog axis/.append style={/pgfplots/annot/point format={(\\%.1e,\\%.1e)}} +} +\\usepackage{pgfplotstable} + \\colorlet{darkgreen}{green!50!black} + \\colorlet{lightgreen}{green!80!black} + \\colorlet{darkred}{red!50!black} + \\colorlet{lightred}{red!80!black} + +% this must be under the configuration of x tick label +% legend position outer south +\\makeatletter +\\pgfplotsset{ + every axis x label/.append style={ + alias=current axis xlabel + }, + legend pos/outer south/.style={ + /pgfplots/legend style={ + at={% + (% + \\@ifundefined{pgf@sh@ns@current axis xlabel}% + {xticklabel cs:0.5}% + {current axis xlabel.south}% + )% + }, + anchor=north + } + } +} +\\makeatother + + +% !!!! in tikzset sind keine Leerzeilen erlaubt !!!! +\\tikzset{ + %scale a tikzpicture including texts + global scale/.style={ + scale=#1, + every node/.style={scale=#1} + }, + %Define standard arrow tip + >=stealth', + %Define standard node + %every text node part/.style={align=left}, + % Colors +} +% Funktionsstruktur +\\tikzset{ + %Define style for boxes + punkt/.style={ + rectangle, + %rounded corners, +%very thick, + draw=black, +% gray + left color=navyblue!0, + right color=navyblue!30, + text width=6em, + minimum height=4em, + text centered}, + dummyPunkt/.style={ + rectangle, + text width=6em, + minimum height=4em}, + dummy/.style={ + rectangle, + text width=0.1em, + minimum height=4em}, + % + %Define style for node + aboveOf/.style={ + above=0.75cm of #1}, + belowOf/.style={ + below=0.75cm of #1}, +% node input + ni/.style={ + above right, + xshift=2mm}, +% node output + no/.style={ + above left, + xshift=-2mm}, + % + % Define arrow style + trans/.style={ + ->, + thick, + shorten >=0pt, + shorten <=0pt, + >=stealth}, + classical/.style={ + ->, +% semithick + thick, + double distance=1pt, + shorten >=0pt, + shorten <=0pt, + >=stealth}, + virtual/.style={ + ->, + thick, + densely dashed, + >=stealth}, +} +% Linien +\\tikzset{ + line1/.style={ + line width = 3, + line cap=round, + NavyBlue}, + line2/.style={ + line width = 3, + line cap=round, + loosely dashed, + red}, + axis/.style={thick, ->, >=stealth'}, + graph1/.style={ + thick, + line cap=round, + NavyBlue}, +} +% Graphen +\\tikzset{ + draw0/.style={ + gray}, + draw1/.style={ + very thick, + NavyBlue}, + draw2/.style={ + very thick, + red}, + draw3/.style={ + very thick, + dkgreen}, + draw4/.style={ + very thick, + orange}, + draw10/.style={ + very thick, + black}, + fill0/.style={ + fill=gray!100, + draw=none, + very nearly transparent}, + fill1/.style={ + fill=MidnightBlue!20, + draw=none}, + fill2/.style={ + fill=red!20, + draw=none}, +} +\\tikzset{ + every pin/.style={fill=white,rectangle,rounded corners=3pt,font=\\small}, + small dot/.style={fill=black,circle,scale=0.3}, +} +\\tikzset{color0/.style={color=black}} + +\\newcommand{\\FB}[7]{% + \\begin{tikzpicture}[auto, node distance=2cm,>=latex'] + \\setstretch{0.8} + \\begin{scope}[xscale=1, yscale=1, xshift=7.8cm]\\small + \\ifthenelse{\\isempty{#2}}% +% if #2 is empty + {}% +% if #2 is not empty + {\\draw[trans] (0,0.85) node[above right,yshift=-1mm,text width=2.5cm] {#2\\(_{}\\)} --(2.5,0.85) ;}% + \\ifthenelse{\\isempty{#4}} {} + {\\draw[classical] (0,0) node[above right,yshift=-1mm,text width=2.5cm] {#4\\(_{}\\)}--(2.5,0);} + \\ifthenelse{\\isempty{#6}} {} + {\\draw[virtual] (0,-0.85) node[above right,yshift=-1mm,text width=2.5cm] {#6\\(_{}\\)}--(2.5,-0.85);} + + \\ifthenelse{\\isempty{#3}} {} + {\\draw[trans] (6.25,0.85) node[above right,xshift=1mm,yshift=-1mm,text width=2.5cm] {#3\\(_{}\\)}--(8.75,0.85);} + \\ifthenelse{\\isempty{#5}} {} + {\\draw[classical] (6.25,0) node[above right,xshift=1mm,yshift=-1mm,text width=2.5cm] {#5\\(_{}\\)}--(8.75,0);} + \\ifthenelse{\\isempty{#7}} {} + {\\draw[virtual] (6.25,-0.85)node[above right,xshift=1mm,yshift=-1mm,text width=2.5cm] {#7\\(_{}\\)}--(8.75,-0.85) ;} + + \\ifthenelse{\\isempty{#1}} {} + % gray!30 + {\\node[draw=black,left color=navyblue!0,right color=navyblue!30,text width=3.5cm,minimum height=2.5cm,text centered,right=2.5cm] (f){\\normalsize#1};} + \\end{scope} + \\end{tikzpicture} +} +%% +% x axis and y axis in first quadrant +% x 0...1, 1 = 100% +% y 0...1, 1 = 100% +% \\tikzAxesQ1{x}{y}{labelX}{labelY} +\\newcommand{\\tikzAxesQi}[4]{ + \\draw[axis] (-0.1,0) -- ($(#1+.1,0)$) node(xline)[right] + {$#3$}; + \\draw[axis] (0,-0.1) -- ($(0,#2+.1)$) node(yline)[above] {$#4$}; +} +%% +% x axis and y axis +% x 0...1, 1 = 100% +% y 0...1, 1 = 100% +% \\tikzAxes{x}{y}{labelX}{labelY} +\\newcommand{\\tikzAxes}[4]{ + \\draw[axis] ($(-#1-.2,0)$) -- ($(#1+.2,0)$) node(xline)[below] + {$#3$}; + \\draw[axis] ($(0,-#2-.2)$) -- ($(0,#2+.2)$) node(yline)[left] {$#4$}; +} +%% +% x axis and y axis +% x 0...1, 1 = 100% +% y 0...1, 1 = 100% +% \\tikzAxes{x}{y}{delta x,y}{labelX}{labelY} +\\newcommand{\\tikzAxesD}[5]{ + \\draw[axis] ($(-#1-#3,0)$) -- ($(#1+#3,0)$) node(xline)[below] + {$#4$}; + \\draw[axis] ($(0,-#2-#3)$) -- ($(0,#2+#3)$) node(yline)[left] {$#5$}; +} +%% +% at given position 'x,y' an x marker with a label 'text' in math mode +% \\tikzMarkerX{x,y}{text} +\\newcommand{\\tikzMarkerX}[2]{ + \\draw($(#1)-(0,.025)$) node[below]{$#2$\\vphantom{b}} -- ($(#1)+(0,.025)$); +} +%% +% multiple x markers with labels +% \\tikzMarkersX{coordinate1/text1,coordinate2/text2,...} +\\newcommand{\\tikzMarkersX}[1]{ + \\foreach \\pos/\\text in {#1} { + \\tikzMarkerX{\\pos}{\\text} + } +} +%% +% at given position 'x,y' an y marker with a label 'text' in math mode +% \\tikzMarkerY{x,y}{text} +\\newcommand{\\tikzMarkerY}[2]{ + \\draw($(#1)-(.025,0)$) node[left]{$#2$\\vphantom{b}} -- ($(#1)+(.025,0)$); +} +%% +% multiple y markers with labels +% \\tikzMarkersY{coordinate1/text1,coordinate2/text2,...} +\\newcommand{\\tikzMarkersY}[1]{ + \\foreach \\pos/\\text in {#1} { + \\tikzMarkerX{\\pos}{\\text} + } +} +%% +% point marker at given position +% \\tikzPoint{x,y} +\\newcommand{\\tikzPoint}[1]{ + \\fill[red] (#1) circle (.4pt); +} +%% +% point markers at given positions +% \\tikzPoint{coordinate1,coordinate2,...} +\\newcommand{\\tikzPoints}[1]{ + \\foreach \\pos in {#1} { + \\tikzPoint{\\pos} + } +} + +\\def\\tikzoverlay{% + \\tikz[baseline,overlay]\\node[every overlay node] +}% +% usage: +%\\tikzoverlay[text width=6cm] at (9.3cm,5cm) {... content ...} + +%%% +%%% HYPHENATION +%%% +% ----------------------------------------- +% Silbentrennung +% ----------------------------------------- +\\hyphenation{} +% wird nach \\selectlanguage{ngerman} zurückgesetzt +% \\allowhyphens setzen reicht? +% und \\allowbreak nach einem hyphen? + " - "Preamble options." + "Preamble options. +`my-org-article-latex-lang-template-plist'" :group 'my-org-export-article) (defcustom my-org-article-latex-header-extra "" @@ -140,12 +1908,7 @@ ("" "textcomp" t) ("" "amssymb" t) ("" "capt-of" nil) - ("" "hyperref" nil) - ;; - ("ngerman" "babel" nil) - ("utf8" "inputenc" nil) - ("" "scrlayer-scrpage" nil) - ) + ("" "hyperref" nil)) "See `org-latex-default-packages-alist'." :group 'my-org-export-article ;;:set 'org-set-packages-alist @@ -178,43 +1941,43 @@ ;;;; Document -(defcustom my-org-letter-latex-opening - "\\firsthead{ - \\begin{flushright}\\textsf{\\begin{tabular}{l} - \\fromassociation \\\\ \\usekomavar{fromname} \\\\ \\fromstreet \\\\ - \\fromplace\\\\[3mm] \\usekomavar{fromphone} \\\\ \\usekomavar{fromemail} - \\end{tabular}}\\end{flushright} -} -% Kopf und Fußzeile der Folgeseiten -\\defpagestyle{nextpage}{{} {} {\\textsf{\\parbox{\\hsize}{\\usekomavar{fromname}\\today\\ \\hrulefill\\ \\pagename~\\thepage}}}} - {{} {} {}} -\\pagestyle{nextpage} - -\\begin{letter}{Empfänger} % den Wert Empfänger nicht verändern -\\setkomavar{toname}{\\toassociation \\\\ \\toname} -\\setkomavar{toaddress}{\\tostreet \\\\ \\toplace} - -\\setkomavar{subject}{\\subject \\\\ {\\normalfont \\subjectextra}} - -\\opening{Sehr geehrter \\toname,}" - "Letter opening." +(defcustom my-org-article-latex-opening + "" + "Article opening." :group 'my-org-export-article) -(defcustom my-org-letter-latex-closing - "\\closing{Freundliche Grüße,}" - "Letter closing." +(defcustom my-org-article-latex-closing + "" + "Article closing." :group 'my-org-export-article) ;;; Template +(defun my-org-article-latex-lang-template-value (property lang) + "Return lang version of property if in +`my-org-article-latex-lang-template-plist' defined, else use en as +default." + (let ((value (plist-get + my-org-article-latex-lang-template-plist + (intern (concat (symbol-name property) "-" lang))))) + (if value + value + (plist-get + my-org-article-latex-lang-template-plist + (intern (concat (symbol-name property) "-en")))))) ;;;###autoload (defun my-org-article-latex-make-preamble (info &optional template snippet?) "See `org-latex-make-preamble'" (let* ((class (plist-get info :latex-class)) + (lang (plist-get info :language)) (class-template (or template - (let* ((class-options (plist-get info :latex-class-options)) + (let* ((class-options + (string-replace + "<>" + (my-org-article-latex-lang-template-value :documentclass lang) + (plist-get info :latex-class-options))) (header (nth 1 (assoc class (plist-get info :latex-classes))))) (and (stringp header) (if (not class-options) header @@ -228,26 +1991,25 @@ (org-element-normalize-string (org-splice-latex-header class-template - (org-latex--remove-packages my-org-letter-latex-default-packages-alist info) - (org-latex--remove-packages my-org-letter-latex-packages-alist info) + (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 (cons "<>" (plist-get info :letter-from-association)) - (cons "<>" (plist-get info :letter-from-name)) - (cons "<>" (plist-get info :letter-from-street)) - (cons "<>" (plist-get info :letter-from-place)) - (cons "<>" (plist-get info :letter-from-phone)) - (cons "<>" (plist-get info :letter-from-url)) - (cons "<>" (plist-get info :letter-from-email)) - (cons "<>" (plist-get info :letter-to-association)) - (cons "<>" (plist-get info :letter-to-name)) - (cons "<>" (plist-get info :letter-to-street)) - (cons "<>" (plist-get info :letter-to-place)) - (cons "<>" (plist-get info :letter-place)) - (cons "<>" (plist-get info :date)) - (cons "<>" (string-replace "\n" "\\\\" (plist-get info :letter-subject))) - (cons "<>" (string-replace "\n" "\\\\" (plist-get info :letter-subject-extra)))) + (list (cons "<>" + (my-org-article-latex-lang-template-value :babel lang)) + (cons "<>" + (my-org-article-latex-lang-template-value :fontspec lang)) + (cons "<>" + (my-org-article-latex-lang-template-value :ruby lang)) + (cons "<>" + (my-org-article-latex-lang-template-value :biblatex lang)) + (cons "<>" + (my-org-article-latex-lang-template-value :csquotes lang)) + (cons "<>" + (my-org-article-latex-lang-template-value :mtcselectlanguage lang)) + (cons "<>" + (my-org-article-latex-lang-template-value :lstlistingname lang))) (plist-get info :latex-header)) (and (not snippet?) (plist-get info :latex-header-extra))) @@ -266,7 +2028,7 @@ ;; LaTeX compiler. (org-latex--insert-compiler info) ;; Document class and packages. - (my-org-letter-latex-make-preamble info) + (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) @@ -319,15 +2081,10 @@ (format "\\setcounter{tocdepth}{%d}\n" depth)) (plist-get info :latex-toc-command)))) ;; Document's body. - (concat (plist-get info :letter-opening) "\n") + (concat (plist-get info :article-opening) "\n") contents - (concat (plist-get info :letter-closing) "\n") - ;; attachments - (let ((attachments (plist-get info :letter-attachment))) - (unless (string-equal attachments "") - (concat "\\vspace*{\\fill}\n" - "\\encl{" (string-replace "\n" "\\\\" attachments) "}\n"))) - "\\end{letter}\n" + (concat (plist-get info :article-closing) "\n") + ;; references ;; Creator. (and (plist-get info :with-creator) (concat (plist-get info :creator) "\n")) diff --git a/lisp/my/my-org-letter.el b/lisp/my/my-org-letter.el index 61c34022..b7c76a5b 100644 --- a/lisp/my/my-org-letter.el +++ b/lisp/my/my-org-letter.el @@ -86,14 +86,16 @@ (org-export-define-derived-backend 'letter-latex 'latex :menu-entry - '(?L "Export to LaTeX (Letter)" - ((?L "As LaTeX buffer" my-org-letter-latex-export-as-latex) - (?l "As LaTeX file" my-org-letter-latex-export-to-latex) - (?p "As PDF file" my-org-letter-latex-export-to-pdf) - (?o "As PDF file and open" + '(?l ?l + ( + ;;(?T "As LaTeX buffer" my-org-letter-latex-export-as-latex) + ;;(?t "As LaTeX file" my-org-letter-latex-export-to-latex) + (?t "As PDF-letter file" my-org-letter-latex-export-to-pdf) + (?T "As PDF-letter file and open" (lambda (a s v b) (if a (my-org-letter-latex-export-to-pdf t s v b) (org-open-file (my-org-letter-latex-export-to-pdf nil s v b))))))) + :options-alist '((:with-toc nil "toc" my-org-letter-export-with-toc) (:latex-class "LATEX_CLASS" nil my-org-letter-latex-default-class t) diff --git a/settings/my-settings.el b/settings/my-settings.el index 5bf8ccf5..4940a7a8 100644 --- a/settings/my-settings.el +++ b/settings/my-settings.el @@ -8,6 +8,10 @@ (add-hook 'org-mode-hook 'my-org-link-color-hook) (add-hook 'org-ctrl-c-ctrl-c-hook 'my-org-table-cell-color-attr))) +(use-package my-org-article + :load-path "lisp/my" + :after (org)) + (use-package my-org-letter :load-path "lisp/my" :after (org)) diff --git a/settings/org-settings.el b/settings/org-settings.el index 6fedf705..71ef1a98 100644 --- a/settings/org-settings.el +++ b/settings/org-settings.el @@ -9,6 +9,8 @@ ;; https://tex.stackexchange.com/questions/282448/why-does-emacs-or-auctex-turns-into ;;; Commentary: +;; `org-export-default-language' +;; `org-options-keywords' ;; * Overview of modes and commands ;; -------------------------------- @@ -240,8 +242,10 @@ Example defines :init (setq org-export-backends '(ascii html icalendar latex md odt reveal tufte)) :config + (setq org-startup-folded nil) ;; nil = showall = #+STARTUP: showall (setq org-startup-with-inline-images t) ;; #+STARTUP: inlineimages|noinlineimages, show inline images when loading a new Org file (setq org-image-actual-width '(600)) ;; image width displayed in org + (setq org-tag-persistent-alist '(("ignore" . "i") ("noexport" . "n"))) ;; todo see also org-todo-keyword-faces and org-superstar-todo-bullet-alist (setq org-todo-keywords ;; (x!) record a time stamp, (x@) add a note (with time), (y/z) entering the state / leaving the state '((sequence "TODO(t)" "WAIT(w)" "|" "DONE(d)" "CANC(c)")))