Add yasnippet snippets for org-mode
This commit is contained in:
parent
27401f8c4b
commit
8bc7f7a7da
105
etc/yasnippet/snippets/org-mode/latex-header-block
Normal file
105
etc/yasnippet/snippets/org-mode/latex-header-block
Normal file
@ -0,0 +1,105 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# name: latex-header-block
|
||||
# key: lhb
|
||||
# expand-env: ((yas-indent-line 'fixed))
|
||||
# --
|
||||
#+begin_src latex :noweb yes :results raw
|
||||
,#+latex_header: <<${1:latex}-header>>
|
||||
#+end_src
|
||||
|
||||
#+name: $1-header
|
||||
#+begin_src latex :exports none
|
||||
% LaTeX PREAMBLE:
|
||||
% See: https://list.orgmode.org/87o807r7fr.fsf@posteo.net/
|
||||
% From: "Juan Manuel Macías" <maciaschain@posteo.net>
|
||||
% To: orgmode <emacs-orgmode@gnu.org>
|
||||
% Subject: [tip] Insert arbitrary LaTeX code at the beginning of any float environment
|
||||
% Date: Sun, 08 May 2022 22:22:16 +0000
|
||||
% Message-ID: <87o807r7fr.fsf@posteo.net>
|
||||
% LANGUAGE:
|
||||
\usepackage{babel}
|
||||
\usepackage{fvextra}
|
||||
\usepackage{csquotes}
|
||||
% LISTS:
|
||||
\usepackage{enumitem}
|
||||
\setlist{noitemsep}
|
||||
% CAPTIONS, LISTINGS, and SUBCAPTIONS
|
||||
% Section 2.6 of caption-eng.pdf (texdoc caption) explains that the sign
|
||||
% of "skip" depends on the assumption "position=above" or "position=below".
|
||||
% The assumption should match the real caption position in the LaTeX code.
|
||||
% Use the "DejaVu Sans Mono" as typewriter font for engrave-faces listings.
|
||||
\usepackage{caption}
|
||||
\captionsetup[listing]{position=below,skip=0em}
|
||||
\setmonofont{DejaVu Sans Mono}[Scale=MatchLowercase]
|
||||
\usepackage{subcaption}
|
||||
% TABLES:
|
||||
% https://tex.stackexchange.com/a/341254 answers:
|
||||
% "How differ the environments tabular, tabular*, and tabularx?"
|
||||
% https://emacs.stackexchange.com/a/28903 answers:
|
||||
% "How to tweak org-mode table colors for latex export only?"
|
||||
% https://tex.stackexchange.com/a/468596 answers:
|
||||
% "How to format LaTeX using siunitx?"
|
||||
% https://tex.stackexchange.com/a/355396 answers:
|
||||
% "How to load colortbl and xcolor for maximal interoperability?"
|
||||
\usepackage{booktabs}
|
||||
\usepackage[table]{xcolor}
|
||||
\usepackage{tabularx} % DANGER: beware of Org table :width and :align options!
|
||||
% STANDALONE FIGURES AND TABLES:
|
||||
% https://xuc.me/blog/reuse-tikz-figures-in-articles-and-slides/ explains that
|
||||
% making fake beamer commands for standalone pictures is less error-prone than
|
||||
% using beamerarticle.
|
||||
\usepackage{standalone}
|
||||
\usepackage{xparse}
|
||||
\NewDocumentCommand{\onslide}{s t+ d<>}{}
|
||||
\NewDocumentCommand{\only}{d<>}{}
|
||||
\NewDocumentCommand{\uncover}{d<>}{}
|
||||
\NewDocumentCommand{\visible}{d<>}{}
|
||||
\NewDocumentCommand{\invisible}{d<>}{}
|
||||
% PAGE LAYOUT:
|
||||
\usepackage[headheight=20mm,top=40mm,bottom=20mm,left=0.1\paperwidth,right=0.1\paperwidth,heightrounded,verbose]{geometry}
|
||||
% SI UNITS:
|
||||
\usepackage[load-configurations=abbreviations]{siunitx}
|
||||
\sisetup{
|
||||
range-phrase = \ensuremath{\text{\,\textendash\,}},
|
||||
range-units = brackets,
|
||||
separate-uncertainty,
|
||||
}
|
||||
\DeclareSIUnit\dollar{\$}
|
||||
\DeclareSIUnit\euro{€}
|
||||
\DeclareSIUnit\mK{\milli\kelvin}
|
||||
\DeclareSIUnit\mbar{\milli\bar}
|
||||
\DeclareSIUnit\micron{\micro\meter}
|
||||
\DeclareSIUnit\nW{\nano\watt}
|
||||
% TIKZ AND PGFPLOTS:
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{3d,arrows,backgrounds,calc,plotmarks}
|
||||
\usepackage{pgfplots}
|
||||
\pgfplotsset{compat=newest}
|
||||
\def\axisdefaultwidth{90mm}
|
||||
\def\axisdefaultheight{75mm}
|
||||
% SYMBOLS FOR FLUID MECHANICS
|
||||
\newcommand{\Knudsen}{\mbox{\textit{Kn}}}
|
||||
\newcommand{\Nusselt}{\mbox{\textit{Nu}}}
|
||||
\newcommand{\Reynolds}{\mbox{\textit{Re}}}
|
||||
% FLOAT BARRIERS:
|
||||
% https://tex.stackexchange.com/a/118667 answers:
|
||||
% "How to make float barriers for subsections as placeins does for sections?"
|
||||
% 1. Make section an implicit float barrier:
|
||||
\usepackage[section]{placeins}
|
||||
% 2. Make subsection an implicit float barrier:
|
||||
\makeatletter
|
||||
\AtBeginDocument{%
|
||||
\expandafter\renewcommand\expandafter\subsection\expandafter{%
|
||||
\expandafter\@fb@secFB\subsection
|
||||
}%
|
||||
}
|
||||
\makeatother
|
||||
% 3. Make subsubsection an implicit float barrier:
|
||||
\makeatletter
|
||||
\AtBeginDocument{%
|
||||
\expandafter\renewcommand\expandafter\subsubsection\expandafter{%
|
||||
\expandafter\@fb@secFB\subsubsection
|
||||
}%
|
||||
}
|
||||
\makeatother
|
||||
#+end_src
|
26
etc/yasnippet/snippets/org-mode/org-mode-article
Normal file
26
etc/yasnippet/snippets/org-mode/org-mode-article
Normal file
@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# name: org-mode-article
|
||||
# key: oma
|
||||
# expand-env: ((yas-indent-line 'fixed))
|
||||
# --
|
||||
#+options: ^:{} d:nil date:t num:t tags:nil title:t toc:t
|
||||
#+title: ${1:Catchy Title}
|
||||
#+author: ${2:Gerard Vermeulen}
|
||||
#+babel: :cache no
|
||||
#+property: header-args:python :eval no-export
|
||||
#+property: header-args:python+ :tangle ${3:`(file-name-sans-extension (file-name-nondirectory (buffer-file-name)))`}.py
|
||||
#+startup: showeverything
|
||||
#+cite_export: biblatex phys,biblabel=brackets,doi=true
|
||||
#+latex_class: article
|
||||
#+latex_class_options: [10pt,english,svgnames,table]
|
||||
$0
|
||||
|
||||
* Local variables :noexport:
|
||||
|
||||
# Emacs looks for "Local variables:" after the last "newline-formfeed".
|
||||
|
||||
# Local Variables:
|
||||
# compile-command: "latexmk -interaction=nonstopmode -lualatex -pvc $3.tex"
|
||||
# eval: (org-eval-emacs-lisp-setup-blocks)
|
||||
# fill-column: 80
|
||||
# End:
|
14
etc/yasnippet/snippets/org-mode/smart-latex-engrave
Normal file
14
etc/yasnippet/snippets/org-mode/smart-latex-engrave
Normal file
@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# name: smart-latex-engrave
|
||||
# key: sle
|
||||
# expand-env: ((yas-indent-line 'fixed))
|
||||
# --
|
||||
#+name: lst:smart-latex-engrave-emacs-lisp-setup
|
||||
#+begin_src emacs-lisp :exports none :results silent
|
||||
(with-eval-after-load 'ox-latex
|
||||
(make-variable-buffer-local 'org-export-filter-src-block-functions)
|
||||
(add-to-list 'org-export-filter-src-block-functions
|
||||
'org-latex-engraved-source-block-filter)
|
||||
(when (fboundp 'smart-latex-engrave-org-source-blocks)
|
||||
(smart-latex-engrave-org-source-blocks)))
|
||||
#+end_src
|
Loading…
Reference in New Issue
Block a user