Files
emacs/README.md
2024-03-05 10:35:22 +01:00

5.6 KiB
Raw Blame History

Table of Contents

  1. Installation
  2. External programs
  3. Usage
  4. Packages
  5. Information
  6. Errors
  7. TODOs

This is an ongoing evolution of Emacs configuration files, inspired by a bunch of online resources.

Installation

Different ways to install:

  • arch-linux: If emacs-conf is available in a custom pacman repository

    pacman -S emacs-conf
    ln /opt/emacs-conf/init ~/.config/emacs/
    ln /opt/emacs-conf/early-init.el ~/.config/emacs/
    
  • debian: If emacs-conf is available in a custom apt repository

    apt install emacs-conf
    ln /opt/emacs-conf/init ~/.config/emacs/
    ln /opt/emacs-conf/early-init.el ~/.config/emacs/
    
  • manual: Download or clone git repo and point the emacs init and early-init.el file to this configuration.

  • old: Run one of the following install script commands (using curl, wget or fetch).

    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)"
    

    Installation path is ~/.config/emacs. See details and other installed linux packages as requirements inside sripts/install.sh.

External programs

  • ripgrep (optional) used by counsel-rg (package counsel)
  • texlive-luatex for luainputenc.sty used by org latex export
  • texlive-xetex for realscripts.sty for KpRoman used by org latex export

Usage

See the emacs command my-help for some key-bindings and further commands and information.

  • Org Templates
    • Article: ?article[TAB] / YASnippet - org-mode - Article Templates - Article
    • Letter: ?letter[TAB] / YASnippet - org-mode - Letter Templates - Letter
  • Org Export
    • To Article HTML (extended version)
      • my-org-article-html-export-to-html / My - Org Export - Article HTML
      • my-org-article-html-export-to-html-notify-async (F5) / My - Org Export - Article HTML async
    • To Article PDF (LaTeX, extended version)
      • my-org-article-latex-export-to-pdf / My - Org Export - Article PDF
      • my-org-article-latex-export-to-pdf-notify-async (F6) / My - Org Export - Article PDF async
    • To Letter (LaTeX)
      • my-org-letter-latex-export-to-pdf (C-c C-e l t)

Packages

General key bindings and functions

  • C-r (query-replace-regexp) replace text
  • C-x RET f (set-buffer-file-coding-system) e.g. set to =utf-8
  • (decode-coding-region) e.g. decode to utf-8 (e.g. 晴天)
  • (diff-buffer-with-file) show a diff between buffer (current state) and file (saved state)

Information

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 Interlocking in the EmacsManual for details.

Errors

  • failed execution of bibtex2html
    • see bib2htmlxxxxxx.blg for errors, e.g.
      • I couldnt 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
      • <policy domain="delegate" rights="none" pattern="gs" />

TODOs

  • Org / global configuration
    • Page formatting
      • Modify HTML styling
        • Printed page layout, white styled figures
  • Figures
    • Gnuplot
      • plot transposed files/tables
  • 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]

        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\"]
            });
        });