website

Personal website
git clone https://github.com/michaelneuper/website.git
README | Files | Log | Refs

commit af83be7c81bde93279b3c954f8e2a919f0207de8
parent 44ff8bf13ff16ee1a7fa632d80c11abe2e6b2add
Author: Michael Neuper <michael@michaelneuper.com>
Date:   Thu, 16 Nov 2023 21:21:18 +0200

Merge pull request #16 from michaelneuper/dev

Dev
Diffstat:
Acontent/posts/efficient-latex-editing-with-emacs/abbreviations.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/abbreviations.webm | 0
Acontent/posts/efficient-latex-editing-with-emacs/accents.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/accents.webm | 0
Acontent/posts/efficient-latex-editing-with-emacs/evil-tex.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/evil-tex.webm | 0
Acontent/posts/efficient-latex-editing-with-emacs/gnu-calc.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/gnu-calc.webm | 0
Acontent/posts/efficient-latex-editing-with-emacs/index.md | 262+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontent/posts/efficient-latex-editing-with-emacs/latexmk.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/latexmk.webm | 0
Acontent/posts/efficient-latex-editing-with-emacs/math-symbols.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/math-symbols.webm | 0
Acontent/posts/efficient-latex-editing-with-emacs/preview.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/preview.webm | 0
Acontent/posts/efficient-latex-editing-with-emacs/snippets.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/snippets.webm | 0
Acontent/posts/efficient-latex-editing-with-emacs/symbols.png | 0
Acontent/posts/efficient-latex-editing-with-emacs/tex-folding.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/tex-folding.webm | 0
Acontent/posts/efficient-latex-editing-with-emacs/xenops-paste.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/xenops-paste.webm | 0
Acontent/posts/efficient-latex-editing-with-emacs/xenops-render.mp4 | 0
Acontent/posts/efficient-latex-editing-with-emacs/xenops-render.webm | 0
Mcontent/posts/enable-monitor-mode-on-tp-link.md | 2+-
Mcontent/posts/how-to-create-your-own-website.md | 2+-
Mcontent/posts/modelling-population-growth-in-python/index.md | 2+-
Mgo.mod | 2+-
Mgo.sum | 2++
29 files changed, 268 insertions(+), 4 deletions(-)

diff --git a/content/posts/efficient-latex-editing-with-emacs/abbreviations.mp4 b/content/posts/efficient-latex-editing-with-emacs/abbreviations.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/abbreviations.webm b/content/posts/efficient-latex-editing-with-emacs/abbreviations.webm Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/accents.mp4 b/content/posts/efficient-latex-editing-with-emacs/accents.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/accents.webm b/content/posts/efficient-latex-editing-with-emacs/accents.webm Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/evil-tex.mp4 b/content/posts/efficient-latex-editing-with-emacs/evil-tex.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/evil-tex.webm b/content/posts/efficient-latex-editing-with-emacs/evil-tex.webm Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/gnu-calc.mp4 b/content/posts/efficient-latex-editing-with-emacs/gnu-calc.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/gnu-calc.webm b/content/posts/efficient-latex-editing-with-emacs/gnu-calc.webm Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/index.md b/content/posts/efficient-latex-editing-with-emacs/index.md @@ -0,0 +1,262 @@ +--- +title: "Efficient LaTeX Editing With Emacs" +date: 2023-11-15T13:26:32+02:00 +description: Generic description +categories: ["Guides"] +tags: ["Emacs", "LaTeX"] +toc: true +math: false +draft: false +--- + +The aim of this post is to show my customised LaTeX setup with Emacs and the packages I used to achieve it. +The configurations I'll be showing will be tailored to [Doom Emacs](https://github.com/doomemacs/doomemacs), as that's what I'm using. +However, all of this is possible in vanilla Emacs. +This guide assumes basic knowledge of both Emacs and LaTeX. +<!--more--> + +## AUCTeX + +[AUCTeX](https://www.gnu.org/software/auctex/) can be enabled by enabling `:lang latex` in your `doom` block. + +It has a lot of features, however, many of these features are replaced by other packages mentioned later in this guide. +Here are some of the notable features that I use: + +### Live Preview + +You can enable the live preview by typing <kbd>C-c C-c</kbd> and then selecting the `View` option. +This will open the file in your preferred pdf-viewer and automatically update when you recompile your document (more on compiling later in the guide). + +Since I prefer to stay inside emacs, I set my pdf viewer to `pdf-tools` by adding the following to my `config.org`: + +```emacs-lisp +(setq +latex-viewers '(pdf-tools)) +``` + +Here's what it looks like: + +<video autoplay loop muted playsinline width="100%"> + <source src="preview.webm" type="video/webm"> + <source src="preview.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +### Pretty Symbols + +This is a minor mode that displays text like `\gamma` with their unicode equivalents (γ) in math mode. +The underlying text does not change, only the way they are displayed in the editor changes to make equations more readable. +It is enabled by default in Doom Emacs, otherwise you can run `M-x prettify-symbols-mode`. + +Here's what it looks like: + +![Symbols](symbols.png) + +You'll notice that the superscripts and subscripts are also displayed as such in the editor, this is also done by _AUCTeX_. +_AUCTeX_ can also automatically insert braces when you type `^` or `_`, this is done by setting the `TeX-electric-sub-and-superscript` variable, it is set to `t` by default in Doom Emacs. + +### Text Folding + +You can remove some of the visual noise in a LaTeX buffer by enabling `TeX-fold-mode`. +This is also enabled by default in Doom Emacs. + +This is easier to show than to explain: + +<video autoplay loop muted playsinline width="100%"> + <source src="tex-folding.webm" type="video/webm"> + <source src="tex-folding.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +## CDLaTeX + +[CDLaTeX](https://github.com/cdominik/cdlatex) is a minor mode supporting fast insertion of environment templates and math stuff in LaTeX.[^1] + +[^1]: <https://github.com/cdominik/cdlatex/blob/master/README> + +You can enable this by adding the `+cdlatex` flag to the latex section of your `doom` block, like: + +```emacs-lisp +(latex +cdlatex) +``` + +_CDLaTeX_ also has a ton of features, but here are the ones I use the most: + +### Abbreviations + +Abbreviation expansion is triggered with <kbd>TAB</kbd>, for example: + +<video autoplay loop muted playsinline width="100%"> + <source src="abbreviations.webm" type="video/webm"> + <source src="abbreviations.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +Use `M-x cdlatex-command-help` to see a full list of abbreviations. + +### Mathematical Symbols + +Backquote followed by any character inserts a LaTeX math macro into the buffer. +If necessary, a pair of `\(` is inserted to switch to math mode. +For example, typing `` `a`` inserts `\(\alpha\)`. + +You can wait a second after pressing `` ` `` and a list of all the available macros will pop up. +The macros can also be customised with the `cdlatex-math-symbol-alist` variable. + +<video autoplay loop muted playsinline width="100%"> + <source src="math-symbols.webm" type="video/webm"> + <source src="math-symbols.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +### Accents and Fonts + +Putting accents on mathematical characters and/or changing the font of a character uses key combinations with the quote character `'` as a prefix. +The accent or font change is applied to the character or LaTeX macro **before** point. + +<video autoplay loop muted playsinline width="100%"> + <source src="accents.webm" type="video/webm"> + <source src="accents.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +## LatexMk + +[Latexmk](https://ctan.org/pkg/latexmk) automates the process of compiling a LaTeX document. +Essentially, it is like a specialized relative of the general make utility, but one which determines dependencies automatically and has +some other very useful features.[^2] + +[^2]: https://mirror.ufs.ac.za/ctan/support/latexmk/latexmk.pdf + +You can enable it by adding the `+latexmk` flag to `latex` in your `doom` block. +So it should look something like this if you're using [cdlatex](#cdlatex) as well: + +```emacs-lisp +(latex +cdlatex +latexmk) +``` + +<!--TODO ass continuous build--> + +When you build your LaTeX project for the first time using _LatexMk_, press <kbd>C-c C-c</kbd> and select the `LatexMk` option. +After that, you can build it with `C-c C-a`. + +<video autoplay loop muted playsinline width="100%"> + <source src="latexmk.webm" type="video/webm"> + <source src="latexmk.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +## LSP + +[LSP](https://github.com/Microsoft/language-server-protocol/ "Language Server Protocol") is a communication protocol used between an integrated development environment (IDE) or code editor and a language server that provides language-specific analysis, autocompletion, diagnostics, and other language-related features for programming. + +You can enable [lsp-mode](https://github.com/emacs-lsp/lsp-mode/) for Doom Emacs by enabling the `:tools lsp` module in your `doom` block. + +You can view a list of useful _lsp-mode_ features **[here](https://emacs-lsp.github.io/lsp-mode/tutorials/how-to-turn-off/)**. + +To enable lsp-mode for LaTeX, add the `+lsp` flag to `latex` in your `doom` block. +Your `doom` block will look like this by now: + +```emacs-lisp +(latex +cdlatex +latexmk +lsp) +``` + +Additionally, you'll also need a language server for LaTeX installed. +The two most popular ones are [TexLab](https://github.com/latex-lsp/texlab) and [Digestif](https://github.com/astoff/digestif). +The choice between the two ultimately comes down to personal preference, and you'll have to look at their features and decide for yourself which one you prefer. +I prefer _TexLab_, but it you want to use _Digestif_ instead, you can add the following line to your `config.el`: + +```emacs-lisp +(setq lsp-tex-server 'digestif) +``` + +## Xenops + +[Xenops](https://github.com/dandavison/xenops) is a LaTeX editing environment for mathematical documents in Emacs. + +You can install it by adding `(package! xenops)` to your `packages.el`. +To enable it in a `LaTeX` buffer, run `M-x xenops-mode`. +If you would like to enable it automatically in `LaTeX` buffers, add the following line to your `config.el`: + +```emacs-lisp +(add-hook LaTeX-mode-hook #'xenops-mode) +``` + +Here are some the notable features of Xenops: + +### Render Maths, Tables and TikZ Diagrams + +_Xenops_ replaces the `preview-latex` functionality in _AUCTeX_, which does not seem to support rendering images as SVGs. + +<video autoplay loop muted playsinline width="100%"> + <source src="xenops-render.webm" type="video/webm"> + <source src="xenops-render.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +### Paste Images from the Clipboard + +Simply run `M-x xenops-image-handle-paste` to paste an image from the clipboard into your document. + +<video autoplay loop muted playsinline width="100%"> + <source src="xenops-paste.webm" type="video/webm"> + <source src="xenops-paste.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +## YASnippet + +[YASnippet](https://github.com/joaotavora/yasnippet) is a template system for Emacs. +It allows you to type an abbreviation and automatically expand it into function templates when pressing <kbd>TAB</kbd>. + +You can install _YASnippet_ by enabling `:editor snippets` in your `doom` block. + +Some useful snippets can be found [here](https://github.com/doomemacs/snippets). + +<video autoplay loop muted playsinline width="100%"> + <source src="snippets.webm" type="video/webm"> + <source src="snippets.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +Note that _[CDLaTeX](#cdlatex)_ also has snippet functionaly for LaTeX. +If the same snippet is defined in both _CDLaTeX_ and _YASnippet_, you'll probably want to use the _CDLaTeX_ snippet, so add the following line to your `config.el`: + +```emacs-lisp +(map! :map cdlatex-mode-map + :i "TAB" #'cdlatex-tab) +``` + +## GNU Calc + +[Calc](https://www.gnu.org/savannah-checkouts/gnu/emacs/manual/html_node/calc/index.html#SEC_Contents) is a calculator that's part of Emacs. +It can do symbolic differentiation, linear algebra, taylor series expansions, among many other things. + +You can start calc in embedded mode by running `M-x calc-embedded` and perform operations on LaTeX equations. +Here's an example of me finding the taylor series expansion of _e<sup>x</sup>_ to 6 terms: + +<video autoplay loop muted playsinline width="100%"> + <source src="gnu-calc.webm" type="video/webm"> + <source src="gnu-calc.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +## evil-tex + +[evil-tex](https://github.com/iyefrat/evil-tex) provides a number of useful features for [evil](https://github.com/emacs-evil/evil) users. +This should also be installed by default in Doom Emacs. + +Here's an example of me using it: + +<video autoplay loop muted playsinline width="100%"> + <source src="evil-tex.webm" type="video/webm"> + <source src="evil-tex.mp4" type="video/mp4"> + Your browser does not support the video tag or the file format of this video. +</video> + +## Ackowledgement + +Thanks to these articles for inspiring this post: + +- <https://castel.dev/post/lecture-notes-1/> +- <https://karthinks.com/software/latex-input-for-impatient-scholars/> +- <https://ejenner.com/post/latex-emacs/> diff --git a/content/posts/efficient-latex-editing-with-emacs/latexmk.mp4 b/content/posts/efficient-latex-editing-with-emacs/latexmk.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/latexmk.webm b/content/posts/efficient-latex-editing-with-emacs/latexmk.webm Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/math-symbols.mp4 b/content/posts/efficient-latex-editing-with-emacs/math-symbols.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/math-symbols.webm b/content/posts/efficient-latex-editing-with-emacs/math-symbols.webm Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/preview.mp4 b/content/posts/efficient-latex-editing-with-emacs/preview.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/preview.webm b/content/posts/efficient-latex-editing-with-emacs/preview.webm Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/snippets.mp4 b/content/posts/efficient-latex-editing-with-emacs/snippets.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/snippets.webm b/content/posts/efficient-latex-editing-with-emacs/snippets.webm Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/symbols.png b/content/posts/efficient-latex-editing-with-emacs/symbols.png Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/tex-folding.mp4 b/content/posts/efficient-latex-editing-with-emacs/tex-folding.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/tex-folding.webm b/content/posts/efficient-latex-editing-with-emacs/tex-folding.webm Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/xenops-paste.mp4 b/content/posts/efficient-latex-editing-with-emacs/xenops-paste.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/xenops-paste.webm b/content/posts/efficient-latex-editing-with-emacs/xenops-paste.webm Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/xenops-render.mp4 b/content/posts/efficient-latex-editing-with-emacs/xenops-render.mp4 Binary files differ. diff --git a/content/posts/efficient-latex-editing-with-emacs/xenops-render.webm b/content/posts/efficient-latex-editing-with-emacs/xenops-render.webm Binary files differ. diff --git a/content/posts/enable-monitor-mode-on-tp-link.md b/content/posts/enable-monitor-mode-on-tp-link.md @@ -2,7 +2,7 @@ title: "Enable Monitor Mode on TP-Link TL-WN722N" date: 2022-12-16T13:07:05+02:00 categories: ['Tutorials'] -tags: ['Networking', 'Hardware'] +tags: ['Networking', 'Hardware', 'Linux'] draft: false --- diff --git a/content/posts/how-to-create-your-own-website.md b/content/posts/how-to-create-your-own-website.md @@ -2,7 +2,7 @@ title: "How to Create Your Own Static Website in Under an Hour" date: 2022-12-03T19:39:46+02:00 categories: ['Tutorials'] -tags: ['Web Development'] +tags: ['Software'] draft: false --- diff --git a/content/posts/modelling-population-growth-in-python/index.md b/content/posts/modelling-population-growth-in-python/index.md @@ -3,7 +3,7 @@ title: "Modelling Population Growth in Python" date: 2023-11-12T13:25:23+02:00 description: Generic description categories: ["Tutorials"] -tags: ["Mathematics", "Software"] +tags: ["Mathematics", "Programming"] toc: true math: true draft: false diff --git a/go.mod b/go.mod @@ -2,4 +2,4 @@ module github.com/michaelneuper/website go 1.20 -require github.com/michaelneuper/hugo-texify3 v0.0.0-20231111211613-1b2ea6c0315b // indirect +require github.com/michaelneuper/hugo-texify3 v0.0.0-20231116180805-f3085dd19adf // indirect diff --git a/go.sum b/go.sum @@ -14,3 +14,5 @@ github.com/michaelneuper/hugo-texify3 v0.0.0-20231111210813-726bb6ce6eed h1:rLQ1 github.com/michaelneuper/hugo-texify3 v0.0.0-20231111210813-726bb6ce6eed/go.mod h1:OLgVlYkX7N8YT/Qx//nu6Yemst3vx3jDUNTBTrIJIZE= github.com/michaelneuper/hugo-texify3 v0.0.0-20231111211613-1b2ea6c0315b h1:gxaW2ZfBlC2vWJs3kc9hLGNkYnxzVTkMC0TtacPIcCI= github.com/michaelneuper/hugo-texify3 v0.0.0-20231111211613-1b2ea6c0315b/go.mod h1:OLgVlYkX7N8YT/Qx//nu6Yemst3vx3jDUNTBTrIJIZE= +github.com/michaelneuper/hugo-texify3 v0.0.0-20231116180805-f3085dd19adf h1:G4lbqz+MisgEL7jEeSCgLwrZ8TdlEw2IJkgLaqH38+o= +github.com/michaelneuper/hugo-texify3 v0.0.0-20231116180805-f3085dd19adf/go.mod h1:OLgVlYkX7N8YT/Qx//nu6Yemst3vx3jDUNTBTrIJIZE=