#+TITLE: Emacs Configuration
#+HTML_DOCTYPE: xhtml
# xhtml for gogs needed, bug showing table in the footer, bc/ html5 creates
instead of
This is an ongoing evolution of Emacs configuration files, inspired by
a bunch of online resources.
* Installation
:PROPERTIES:
:CUSTOM_ID: installation
:END:
Download repo and point the emacs =init= (and =early-init.el=) file to
this configuration.
Or run one of the following install script commands (using curl, wget or fetch).
#+begin_src sh
sh -c "$(curl -fsSL http://gitea.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
sh -c "$(wget -O- http://gitea.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
sh -c "$(fetch -o - http://gitea.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
#+end_src
Installation path is =~/.config/emacs=. See details and other
installed linux packages as requirements inside =sripts/install.sh=.
* Packages
:PROPERTIES:
:CUSTOM_ID: packages
:END:
General key bindings and functions
- =C-x |= (=toggle-window-split=) toggle horizontal/vertical of 2 window split
- =C-x TAB= (=indent-rigidly=) indent lines in the region
- =C-r= (=query-replace-regexp=) replace text
- =M-= (=move-line-up=)
- =M-= (=move-line-down=)
- =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 (current state) and file (saved state)
Spelling (flyspell ispell) bindings and functions
- (=flyspell-mode=) toggle spelling
- (=flyspell-buffer=)
- =C-;= (=flyspell-correct-wrapper=)
** Org
:PROPERTIES:
:CUSTOM_ID: org
:END:
Org export
- == (=my-org-export-html=)
- == (=my-org-export-pdf=)
- =C-= (=my-org-export-html-async=)
- =C-= (=my-org-export-pdf-async=)
*** Template for an article export (HTML and LaTeX)
:PROPERTIES:
:CUSTOM_ID: export-article
:END:
Template for an article
#+begin_src org
# -*- ispell-local-dictionary: "english" -*-
,#+LANGUAGE: en
,#+TITLE: My article
,#+SUBTITLE:
,#+AUTHOR: Daniel
,#+EMAIL: name@example.org
,#+DATE: May 12, 2021
,#+KEYWORDS:
,#+DESCRIPTION:
,* Abstract :ignore:noexport:
,#+BEGIN_ABSTRACT
,*Abstract*\\
This is the abstract of the article.
,#+END_ABSTRACT
,* List of contents & figures & tables & listings :ignore:
:PROPERTIES:
:VISIBILITY: folded
:CLEARPAGE: t
:END:
,#+LATEX: \begin{spacing}{1.25}\begingroup\renewcommand*{\addvspace}[1]{}
,#+LATEX: \clearpage
# #+LATEX: \tableofcontents
,#+TOC: headlines
,#+LATEX: \clearpage
,#+LATEX: \listoffigures
# #+LATEX: \phantomsection\addcontentsline{toc}{section}{Abbildungsverzeichnis}\listoffigures
# #+TOC: figures is not implemented yet in the HTML backend. And not working with LaTeX, see listing
# #+TOC: figures
# #+LATEX: \listoftables
# #+LATEX: \phantomsection\addcontentsline{toc}{section}{Tabellenverzeichnis}
,#+TOC: tables
# for latex listing is figures
# #+LATEX: \phantomsection\addcontentsline{toc}{section}{Programmausdrucke}
,#+TOC: listings
,#+LATEX: \endgroup\end{spacing}
,* List of Symbols :ignore:
:PROPERTIES:
:CUSTOM_ID: list-of-symbols
:UNNUMBERED: t
:END:
,#+LATEX: \pagenumbering{arabic}\setcounter{page}{1}
#+end_src
Examples for an article
#+begin_src org
# -*- ispell-local-dictionary: "german" -*-
,#+LANGUAGE: de
,* Header not listed in toc :ignore:
bla bla bla
,* Section not exported :noexport:
bla bla bla, this will not be exported
,* Header listed unnumbered
:PROPERTIES:
:UNNUMBERED: t
:END:
bla bla bla
,* Section will start on a clear page (LaTeX)
:PROPERTIES:
:CLEARPAGE: t
:END:
bla bla bla
# For PDF/LaTeX export we do not want to use org-ref ox-bibtex, as its output is
# already defined in the preamble. The output for 'bibliography:references.bib'
# is something like '\bibliography{references}'
# reftex version
# bibliography:references.bib
# ox-bibtex version
# #+BIBLIOGRAPHY: references mbunsrtdin option:-a option:-unicode option:-nobibsource limit:t
,* References-en :ignore:
:PROPERTIES:
:VISIBILITY: folded
:END:
,#+LATEX: \newpage\thispagestyle{plain}
,#+LATEX: \sloppy\printbibliography
,#+LATEX: \begin{comment}
,#+BIBLIOGRAPHY: references acmu option:-a option:-unicode option:-nobibsource limit:t
,#+LATEX: \end{comment}
,* References-de :ignore:
:PROPERTIES:
:VISIBILITY: folded
:END:
,#+LATEX: \newpage\thispagestyle{plain}
,#+LATEX: \sloppy\printbibliography
,#+LATEX: \begin{comment}
,#+BIBLIOGRAPHY: references mbunsrtdin option:-a option:-unicode option:-nobibsource limit:t
,#+LATEX: \end{comment}
,* References-rott :ignore:
:PROPERTIES:
:VISIBILITY: folded
:END:
,#+LATEX: \newpage\thispagestyle{plain}
# all references from the bib
,#+LATEX: \nocite{*}
,#+BIBLIOGRAPHY: references rottbibsty option:-a option:-unicode option:-nobibsource
#+end_src
*** Template for a letter export (LaTex)
:PROPERTIES:
:CUSTOM_ID: export-letter
:END:
#+begin_src org
# -*- ispell-local-dictionary: "german" -*-
:FORM:
,#+LANGUAGE: de
,#+FROM_ASSOCIATION: XYZ AG
,#+FROM_NAME: Max Mustermann
,#+FROM_STREET: Regenbogenstrasse 7
,#+FROM_PLACE: 12345 Hamburg
,#+FROM_PHONE: 0123456789
,#+FROM_URL: www.beispiel.de
,#+FROM_EMAIL: mail@example.de
,#+TO_ASSOCIATION: Firma AG
,#+TO_NAME: Karl Marx
,#+TO_STREET: Firmstrasse 13
,#+TO_PLACE: Berlin
,#+PLACE: Hamburg
,#+DATE: \today
# #+DATE: 3. Januar 2020
:END:
,#+SUBJECT: Abrechnung
,#+SUBJECT: 2020
,#+SUBJECT_EXTRA: Kontonummer
,#+SUBJECT_EXTRA: März
,#+OPENING: Sehr geehte Frau \toname,
hiermit sende ich Ihnen die angeforderten Unterlagen zu und ...
,#+CLOSING: MfG,
,#+ATTACHMENT: analage 1
,#+ATTACHMENT: anlage 2
,#+ATTACHMENT: analage 3
,#+ATTACHMENT: analage 6
#+end_src
** 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
: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
- 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:
- Preamble: ~#+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