From 02f5ede7a0025ba1494f2cd2eefdcfbb09d082d6 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Thu, 16 Apr 2020 13:22:00 +0200 Subject: [PATCH] Add an emacs snippet file --- dotfiles/doom.org | 531 ----------------------------------- dotfiles/emacs-snippets.org | 544 ++++++++++++++++++++++++++++++++++++ 2 files changed, 544 insertions(+), 531 deletions(-) create mode 100644 dotfiles/emacs-snippets.org diff --git a/dotfiles/doom.org b/dotfiles/doom.org index ef28e3f..528c4cb 100644 --- a/dotfiles/doom.org +++ b/dotfiles/doom.org @@ -99,9 +99,6 @@ Documentation: #+end_src #+begin_src emacs-lisp - ;; There are two ways to load a theme. Both assume the theme is installed and - ;; available. You can either set `doom-theme' or manually load a theme with the - ;; `load-theme' function. These are the defaults. (setq doom-theme 'doom-gruvbox) #+end_src @@ -2679,531 +2676,3 @@ Choose account label to feed msmtp -a option based on From header in Message buf (package! org-fancy-priorities) #+end_src -* Snippets -:PROPERTIES: -:header-args:conf+: :comments none -:header-args:conf+: :mkdirp yes -:END: -** LaTeX -*** Coordinate -#+begin_src conf :tangle ~/.config/doom/snippets/latex/coordinate -#contributor : Thomas Dehaeze -#name :coordinate -# -- -\coordinate[${1:->}] (${2:name}) at (${3:pointcoordinate}); -$0 -#+end_src - -*** Draw -#+begin_src conf :tangle ~/.config/doom/snippets/latex/draw -#contributor : Thomas Dehaeze -#name :draw -# -- -\draw[${1:->}] (${2:point1}) -- (${3:point2}); -$0 -#+end_src - -*** Node -#+begin_src conf :tangle ~/.config/doom/snippets/latex/node -#contributor : Thomas Dehaeze -#name :node -# -- -node[${1:below right}] (${2:name}) {${3:label}}; -$0 -#+end_src - -*** Path -#+begin_src conf :tangle ~/.config/doom/snippets/latex/path -#contributor : Thomas Dehaeze -#name :path -# -- -\path[${1}] (${2:point1}) -- (${3:point2}); -$0 -#+end_src - -** Matlab -*** Clear -#+begin_src conf :tangle ~/.config/doom/snippets/matlab/clear -#contributor : Thomas Dehaeze -#name :clear and close all -# -- -clear; close all; clc; -$0 -#+end_src - -*** Function -#+begin_src conf :tangle ~/.config/doom/snippets/matlab/function -#contributor : Thomas Dehaeze -#name :function -# -- -function [${4:outputs}] = ${1:functionName}(${2:inputs}, ${3:opts_param}) -% $1 - Description -% -% Syntax: $1($2, $3) -% -% Inputs: -% - $2 - -% - $3 - Optionals parameters: structure with the following fields: -% - -% -% Outputs: -% - $4 - - -%% Default value for opts -opts = struct(... - '${5:outputs}', ${6:default_value} ... -); - -if exist('opts_param','var') - for opt = fieldnames($3)' - if sum(strcmp(fieldnames(opts), opt{1})) == 1 - opts.(opt{1}) = $3.(opt{1}); - else - warning(sprintf('%s is not a valid option.', opt{1})); - end - end -end - -$0 -#+end_src - -** Org Mode -*** Begin -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/begin -#contributor : Thomas Dehaeze -#name :LaTeX Environment -# -- -\begin{${1:equation}} - $0 -\end{$1} -#+end_src - -*** Block -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/block -#contributor : Thomas Dehaeze -#name :Org-Mode Block -#key: block -# -- -,#+begin_${1:$$(let ((type (yas-choose-value '("src" "example" "quote" "verse" "center" "latex" "html" "ascii")))) - (if type (concat type (if (equal type "src") - (concat " " (yas-choose-value '("emacs-lisp" "latex" "python" "sh" "matlab")))))))} -$0 -#+end_${1:$(car (split-string yas-text))} -#+end_src - -*** Custom Box -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/cbox -#contributor : Thomas Dehaeze -#name :Custom Box -# -- -#+attr_latex: :options [$1]{${2:blue}}{${3:ams nodisplayskip}} -#+begin_cbox -$0 -#+end_cbox -#+end_src - -*** Latex Class -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/latex-class -#name: latex-class -#key: lc -#expand-env: ((classes (mapcar 'car org-latex-classes))) -# -- -#+latex_class: ${1:$$(yas-choose-value classes)} -$0 -#+end_src - -*** Name Caption Figure -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/name-caption-figure -#name: name-caption-figure -#key: ncf -# -- -#+name: fig:${1:name} -#+caption: ${2:Caption} -[[${3:`(read-file-name "File: ")`}]] - -$0 -#+end_src - -*** Bibliography with completion -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/bib -#name: bibliography with completion -#key: bib -# -- -bibliography:${1:$$(yas-choose-value (org-ref-find-bibliography))} -#+end_src - -*** Cite -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/cite -#name: org-ref cite link -#key: cite -# -- -cite:${1:$$(completing-read - "bibtex key: " - (let ((bibtex-files (org-ref-find-bibliography)))(bibtex-global-key-alist)))} -#+end_src - -*** Ref -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/ref -#name: org-ref ref link with completion -#key: ref -# -- -ref:${1:$$(completing-read "label: " (org-ref-get-labels))} -#+end_src - -*** Beamer - CBOX -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/bcbox -#contributor : Thomas Dehaeze -#name :Beamer Custom Box -# -- -,*** ${1:@@latex:@@} :B_cbox: -,:PROPERTIES: -:BEAMER_env: cbox -:BEAMER_opt: {${2:blue}}{${3:ams nodisplayskip}} -:END: - -$0 -#+end_src - -*** Code -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/code -#contributor : Thomas Dehaeze -#name :Code -# -- -#+caption: ${1:Listing Caption} -#+label: lst:${2:listing_name} -,#+begin_src ${3:listing_language} -$0 -,#+end_src -#+end_src - -*** Equation -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/equation -#contributor : Thomas Dehaeze -#name :Equation -# -- -#+name: eq:${1:equation_name} -\begin{equation} -$0 -\end{equation} -#+end_src - -*** Figure -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/figure -#contributor : Thomas Dehaeze -#name :Figure -# -- -#+name: fig:${1:figure_name} -#+caption: ${2:Figure caption} -#+attr_latex: :${3:scale 1} -[[file:${4:figs/}$1.${5:pdf}]] -$0 -#+end_src - -*** Frac -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/frac -#contributor : Thomas Dehaeze -#name :LaTeX Fraction -# -- -\frac{$1}{$2} $0 -#+end_src - -*** Left -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/left -#contributor : Thomas Dehaeze -#name :Left Right mathematical delimitations -# -- -\left$1 $0 \right$2 -#+end_src - -*** Mconfig -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mconfig -#contributor : Thomas Dehaeze -#name :Matlab-Configuration-Header -# -- -#+PROPERTY: header-args:matlab :session *MATLAB* -#+PROPERTY: header-args:matlab+ :tangle ${1:filename}.m -#+PROPERTY: header-args:matlab+ :comments org -#+PROPERTY: header-args:matlab+ :exports both -#+PROPERTY: header-args:matlab+ :results none -#+PROPERTY: header-args:matlab+ :eval no-export -#+PROPERTY: header-args:matlab+ :noweb yes -#+PROPERTY: header-args:matlab+ :mkdirp yes -#+PROPERTY: header-args:matlab+ :output-dir ${2:figs} -$0 -#+end_src - -*** Mdescription -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mdescription -#contributor : Thomas Dehaeze -#name :Measurement-Description -# -- -,* Measurement description -,** Setup :ignore: -*Setup*: - -,** Goal :ignore: -*Goal*: - -,** Measurements :ignore: -*Measurements*: - -Three measurements are done: -| Measurement File | Description | -|-------------------------+------------------------------| -| =mat/data_${1:001}.mat= | $2 | - -Each of the measurement =mat= file contains one =data= array with 3 columns: -| Column number | Description | -|---------------+-------------------| -| 1 | $3 | -| 2 | $4 | -| 3 | Time | - -$0 -#+end_src - -*** Mfigure -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mfigure -#contributor : Thomas Dehaeze -#name :Matlab-Figure -# -- -,#+begin_src matlab :tangle no :exports results :results file replace - exportFig('figs/${1:filename}.pdf', 'width', '${2:full}', 'height', '${3:full}') -,#+end_src - -,#+name: fig:$1 -,#+caption: $0 -,#+RESULTS: -[[file:figs/$1.png]] -#+end_src - -*** Mfunction -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mfunction -#contributor : Thomas Dehaeze -#name :Matlab-Function -# -- -,* ${1:Function Name} -:PROPERTIES: -:header-args:matlab+: :tangle src/${2:matlab_file_name}.m -:header-args:matlab+: :comments none :mkdirp yes :eval no -:END: -<> - -This Matlab function is accessible [[file:src/$2.m][here]]. - -,#+begin_src matlab - function [${4:in_data}] = $2(${3:in_data}) - % $2 - $0 - % - % Syntax: [$4] = $2($3) - % - % Inputs: - % - $3 - - % - % Outputs: - % - $4 - - - end -,#+end_src -#+end_src - -*** Mheader -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mheader -#contributor : Thomas Dehaeze -#name :Matlab-Header -# -- -,* ${1:Heading Name} -:PROPERTIES: -:header-args:matlab+: :tangle matlab/${2:matlab_file_name}.m -:header-args:matlab+: :comments org :mkdirp yes -:END: -<> - -,** ZIP file containing the data and matlab files :ignore: -,#+begin_src bash :exports none :results none - if [ matlab/$2.m -nt data/$2.zip ]; then - cp matlab/$2.m $2.m; - zip data/$2 \ - mat/data.mat \ - $2.m - rm $2.m; - fi -,#+end_src - -,#+begin_note - All the files (data and Matlab scripts) are accessible [[file:data/$2.zip][here]]. -,#+end_note - -$0 -#+end_src - -*** Minipage -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/minipage -#contributor : Thomas Dehaeze -#name :minipage -# -- -#+BEGIN_EXPORT latex -\begin{figure}[htbp] -\centering -\begin{minipage}[t]{0.49\linewidth} -#+END_EXPORT -#+attr_latex: :float nil :width 0.95\linewidth -$0 -#+BEGIN_EXPORT latex -\end{minipage}% -\hfill% -\begin{minipage}[t]{0.49\linewidth} -#+END_EXPORT -#+attr_latex: :float nil :width 0.95\linewidth - -#+BEGIN_EXPORT latex -\end{minipage} -\end{figure} -#+END_EXPORT -#+end_src - -*** Minit -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/minit -#contributor : Thomas Dehaeze -#name :Matlab-Init -# -- -,** Matlab Init :noexport:ignore: -,#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) - <> -,#+end_src - -,#+begin_src matlab :exports none :results silent :noweb yes - <> -,#+end_src - -$0 -#+end_src - -*** Mtable -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mtable -#contributor : Thomas Dehaeze -#name :Matlab-Table -# -- -,#+begin_src matlab :exports results :results value table replace :tangle no :post addhdr(*this*) - data2orgtable(${1:data}, {${2:'rowlabel'}}, {${3:'collabel'}}, ' %.1f '); -,#+end_src -$0 -#+end_src - -*** Multicolumn -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/multicolumn -#contributor : Thomas Dehaeze -#name :Multcolumn -# -- -#+attr_latex: :float multicolumn -$0 -#+end_src - -*** Subfigure -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/subfigure -#contributor : Thomas Dehaeze -#name :Subfigure -# -- -#+name: fig:${1:figure_name} -#+caption: ${2:figure caption} -#+attr_latex: :environment subfigure :width 0.49\linewidth :align c -| file:${3:sub_fig_name}.${4:pdf} | file:${5:sub_fig_name}.${6:pdf} | -| <> ${7:sub figure caption} | <> ${8:sub figure caption} | -$0 -#+end_src - -*** Table -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/table -#contributor : Thomas Dehaeze -#name :Table -# -- -#+name: tab:${1:table_name} -#+caption: ${2:Table caption} -#+attr_latex: :environment tabularx :width ${3:\linewidth} :align ${4:lXX} -#+attr_latex: :center t :booktabs t :float t -| $0 | | | -|---+---+---| -| | | | -#+end_src - -*** Tikz -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/tikz -#contributor : Thomas Dehaeze -#name :Tikz figure -# -- -,#+begin_src latex :file ${1:figure_name}.pdf :post pdf2svg(file=*this*, ext="png") :exports both - \begin{tikzpicture} - $0 - \end{tikzpicture} -,#+end_src -#+end_src - -*** Tikzfig -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/tikzfig -#contributor : Thomas Dehaeze -#name :Tikz Figure -# -- -#+NAME: fig:${1:figure_name} -#+HEADER: :headers '("\\\\usepackage{tikz}" "\\\\usepackage{import}" "\\\\import{$HOME/Cloud/thesis/LaTeX/}{config.tex}") -#+HEADER: :imagemagick t :fit yes :iminoptions -scale 100% -density 150 :imoutoptions -quality 100 -#+HEADER: :results raw replace :buffer no :eval no-export :exports both :mkdirp yes -#+HEADER: :output-dir ${2:figs} -,#+begin_src latex :file $1.pdf :post pdf2svg(file=*this*, ext="png") :exports both - \begin{tikzpicture} - $0 - \end{tikzpicture} -,#+end_src - -#+NAME: fig:$1 -#+CAPTION: ${3:Caption} -#+RESULTS: fig:$1 -#+end_src - -*** Tikzheader -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/tikzheader -#contributor : Thomas Dehaeze -#name :Tikz Header -# -- -,* ${1:Title/Description of the figure} -,#+begin_src latex :file ${2:figure_name}.pdf :tangle figs/$2.tex :exports ${3:both} - \begin{tikzpicture} - $0 - \end{tikzpicture} -,#+end_src - -#+name: fig:$2 -#+caption: $1 ([[./figs/$2.png][png]], [[./figs/$2.pdf][pdf]], [[./figs/$2.tex][tex]]). -#+RESULTS: -[[file:./figs/$2.png]] -#+end_src - -*** User-config -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/user-config -# -*- mode: snippet -*- -# name: user-config -# key: uc -# -- -,#+begin_src emacs-lisp :tangle user-config.el -$1 -,#+end_src -#+end_src - -*** User-init -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/user-init -# -*- mode: snippet -*- -# name: user-init -# key: ui -# -- -,#+begin_src emacs-lisp :tangle user-init.el -$1 -,#+end_src -#+end_src - -*** Wrap -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/wrap -#contributor : Thomas Dehaeze -#name :Wrap -# -- -#+attr_latex: :float wrap -$0 -#+end_src diff --git a/dotfiles/emacs-snippets.org b/dotfiles/emacs-snippets.org new file mode 100644 index 0000000..a68eee1 --- /dev/null +++ b/dotfiles/emacs-snippets.org @@ -0,0 +1,544 @@ +#+TITLE: Doom Emacs Configuration +:DRAWER: +#+STARTUP: overview + +#+LANGUAGE: en +#+EMAIL: dehaeze.thomas@gmail.com +#+AUTHOR: Dehaeze Thomas + +#+HTML_LINK_HOME: ./index.html +#+HTML_LINK_UP: ./index.html + +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: + +#+PROPERTY: header-args :comments none :eval no :mkdir yes :results none :padline no +:END: + +* LaTeX +** Coordinate +#+begin_src conf :tangle ~/.config/doom/snippets/latex/coordinate +#contributor : Thomas Dehaeze +#name :coordinate +# -- +\coordinate[${1:->}] (${2:name}) at (${3:pointcoordinate}); +$0 +#+end_src + +** Draw +#+begin_src conf :tangle ~/.config/doom/snippets/latex/draw +#contributor : Thomas Dehaeze +#name :draw +# -- +\draw[${1:->}] (${2:point1}) -- (${3:point2}); +$0 +#+end_src + +** Node +#+begin_src conf :tangle ~/.config/doom/snippets/latex/node +#contributor : Thomas Dehaeze +#name :node +# -- +node[${1:below right}] (${2:name}) {${3:label}}; +$0 +#+end_src + +** Path +#+begin_src conf :tangle ~/.config/doom/snippets/latex/path +#contributor : Thomas Dehaeze +#name :path +# -- +\path[${1}] (${2:point1}) -- (${3:point2}); +$0 +#+end_src + +* Matlab +** Clear +#+begin_src conf :tangle ~/.config/doom/snippets/matlab/clear +#contributor : Thomas Dehaeze +#name :clear and close all +# -- +clear; close all; clc; +$0 +#+end_src + +** Function +#+begin_src conf :tangle ~/.config/doom/snippets/matlab/function +#contributor : Thomas Dehaeze +#name :function +# -- +function [${4:outputs}] = ${1:functionName}(${2:inputs}, ${3:opts_param}) +% $1 - Description +% +% Syntax: $1($2, $3) +% +% Inputs: +% - $2 - +% - $3 - Optionals parameters: structure with the following fields: +% - +% +% Outputs: +% - $4 - + +%% Default value for opts +opts = struct(... + '${5:outputs}', ${6:default_value} ... +); + +if exist('opts_param','var') + for opt = fieldnames($3)' + if sum(strcmp(fieldnames(opts), opt{1})) == 1 + opts.(opt{1}) = $3.(opt{1}); + else + warning(sprintf('%s is not a valid option.', opt{1})); + end + end +end + +$0 +#+end_src + +* Org Mode +** Begin +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/begin +#contributor : Thomas Dehaeze +#name :LaTeX Environment +# -- +\begin{${1:equation}} + $0 +\end{$1} +#+end_src + +** Block +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/block +#contributor : Thomas Dehaeze +#name :Org-Mode Block +#key: block +# -- +#+begin_${1:$$(let ((type (yas-choose-value '("src" "example" "quote" "verse" "center" "latex" "html" "ascii")))) + (if type (concat type (if (equal type "src") + (concat " " (yas-choose-value '("emacs-lisp" "latex" "python" "sh" "matlab")))))))} +$0 +#+end_${1:$(car (split-string yas-text))} +#+end_src + +** Custom Box +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/cbox +#contributor : Thomas Dehaeze +#name :Custom Box +# -- +#+attr_latex: :options [$1]{${2:blue}}{${3:ams nodisplayskip}} +#+begin_cbox +$0 +#+end_cbox +#+end_src + +** Latex Class +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/latex-class +#name: latex-class +#key: lc +#expand-env: ((classes (mapcar 'car org-latex-classes))) +# -- +#+latex_class: ${1:$$(yas-choose-value classes)} +$0 +#+end_src + +** TODO Name Caption Figure +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/name-caption-figure +#name: name-caption-figure +#key: ncf +# -- +#+name: fig:${1:name} +#+caption: ${2:Caption} +[[${3:`(read-file-name "File: ")`}]] + +$0 +#+end_src + +** Bibliography with completion +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/bib +#name: bibliography with completion +#key: bib +# -- +bibliography:${1:$$(yas-choose-value (org-ref-find-bibliography))} +#+end_src + +** Cite +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/cite +#name: org-ref cite link +#key: cite +# -- +cite:${1:$$(completing-read + "bibtex key: " + (let ((bibtex-files (org-ref-find-bibliography)))(bibtex-global-key-alist)))} +#+end_src + +** TODO Ref +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/ref +#name: org-ref ref link with completion +#key: ref +# -- +ref:${1:$$(completing-read "label: " (org-ref-get-labels))} +#+end_src + +** Beamer - CBOX +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/bcbox +#contributor : Thomas Dehaeze +#name :Beamer Custom Box +# -- +,*** ${1:@@latex:@@} :B_cbox: +,:PROPERTIES: +:BEAMER_env: cbox +:BEAMER_opt: {${2:blue}}{${3:ams nodisplayskip}} +:END: + +$0 +#+end_src + +** Code +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/code +#contributor : Thomas Dehaeze +#name :Code +# -- +#+caption: ${1:Listing Caption} +#+label: lst:${2:listing_name} +,#+begin_src ${3:listing_language} +$0 +,#+end_src +#+end_src + +** Equation +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/equation +#contributor : Thomas Dehaeze +#name :Equation +# -- +#+name: eq:${1:equation_name} +\begin{equation} +$0 +\end{equation} +#+end_src + +** Figure +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/figure +#contributor : Thomas Dehaeze +#name :Figure +# -- +#+name: fig:${1:figure_name} +#+caption: ${2:Figure caption} +#+attr_latex: :${3:scale 1} +[[file:${4:figs/}$1.${5:pdf}]] +$0 +#+end_src + +** Frac +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/frac +#contributor : Thomas Dehaeze +#name :LaTeX Fraction +# -- +\frac{$1}{$2} $0 +#+end_src + +** Left +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/left +#contributor : Thomas Dehaeze +#name :Left Right mathematical delimitations +# -- +\left$1 $0 \right$2 +#+end_src + +** Mconfig +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mconfig +#contributor : Thomas Dehaeze +#name :Matlab-Configuration-Header +# -- +#+PROPERTY: header-args:matlab :session *MATLAB* +#+PROPERTY: header-args:matlab+ :tangle ${1:filename}.m +#+PROPERTY: header-args:matlab+ :comments org +#+PROPERTY: header-args:matlab+ :exports both +#+PROPERTY: header-args:matlab+ :results none +#+PROPERTY: header-args:matlab+ :eval no-export +#+PROPERTY: header-args:matlab+ :noweb yes +#+PROPERTY: header-args:matlab+ :mkdirp yes +#+PROPERTY: header-args:matlab+ :output-dir ${2:figs} +$0 +#+end_src + +** Mdescription +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mdescription +#contributor : Thomas Dehaeze +#name :Measurement-Description +# -- +,* Measurement description +,** Setup :ignore: +*Setup*: + +,** Goal :ignore: +*Goal*: + +,** Measurements :ignore: +*Measurements*: + +Three measurements are done: +| Measurement File | Description | +|-------------------------+------------------------------| +| =mat/data_${1:001}.mat= | $2 | + +Each of the measurement =mat= file contains one =data= array with 3 columns: +| Column number | Description | +|---------------+-------------------| +| 1 | $3 | +| 2 | $4 | +| 3 | Time | + +$0 +#+end_src + +** Mfigure +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mfigure +#contributor : Thomas Dehaeze +#name :Matlab-Figure +# -- +,#+begin_src matlab :tangle no :exports results :results file replace + exportFig('figs/${1:filename}.pdf', 'width', '${2:full}', 'height', '${3:full}') +,#+end_src + +,#+name: fig:$1 +,#+caption: $0 +,#+RESULTS: +[[file:figs/$1.png]] +#+end_src + +** Mfunction +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mfunction +#contributor : Thomas Dehaeze +#name :Matlab-Function +# -- +,* ${1:Function Name} +:PROPERTIES: +:header-args:matlab+: :tangle src/${2:matlab_file_name}.m +:header-args:matlab+: :comments none :mkdirp yes :eval no +:END: +<> + +This Matlab function is accessible [[file:src/$2.m][here]]. + +,#+begin_src matlab + function [${4:in_data}] = $2(${3:in_data}) + % $2 - $0 + % + % Syntax: [$4] = $2($3) + % + % Inputs: + % - $3 - + % + % Outputs: + % - $4 - + + end +,#+end_src +#+end_src + +** Mheader +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mheader +#contributor : Thomas Dehaeze +#name :Matlab-Header +# -- +,* ${1:Heading Name} +:PROPERTIES: +:header-args:matlab+: :tangle matlab/${2:matlab_file_name}.m +:header-args:matlab+: :comments org :mkdirp yes +:END: +<> + +,** ZIP file containing the data and matlab files :ignore: +,#+begin_src bash :exports none :results none + if [ matlab/$2.m -nt data/$2.zip ]; then + cp matlab/$2.m $2.m; + zip data/$2 \ + mat/data.mat \ + $2.m + rm $2.m; + fi +,#+end_src + +,#+begin_note + All the files (data and Matlab scripts) are accessible [[file:data/$2.zip][here]]. +,#+end_note + +$0 +#+end_src + +** Minipage +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/minipage +#contributor : Thomas Dehaeze +#name :minipage +# -- +#+BEGIN_EXPORT latex +\begin{figure}[htbp] +\centering +\begin{minipage}[t]{0.49\linewidth} +#+END_EXPORT +#+attr_latex: :float nil :width 0.95\linewidth +$0 +#+BEGIN_EXPORT latex +\end{minipage}% +\hfill% +\begin{minipage}[t]{0.49\linewidth} +#+END_EXPORT +#+attr_latex: :float nil :width 0.95\linewidth + +#+BEGIN_EXPORT latex +\end{minipage} +\end{figure} +#+END_EXPORT +#+end_src + +** Minit +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/minit +#contributor : Thomas Dehaeze +#name :Matlab-Init +# -- +,** Matlab Init :noexport:ignore: +,#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) + <> +,#+end_src + +,#+begin_src matlab :exports none :results silent :noweb yes + <> +,#+end_src + +$0 +#+end_src + +** Mtable +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mtable +#contributor : Thomas Dehaeze +#name :Matlab-Table +# -- +,#+begin_src matlab :exports results :results value table replace :tangle no :post addhdr(*this*) + data2orgtable(${1:data}, {${2:'rowlabel'}}, {${3:'collabel'}}, ' %.1f '); +,#+end_src +$0 +#+end_src + +** Multicolumn +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/multicolumn +#contributor : Thomas Dehaeze +#name :Multcolumn +# -- +#+attr_latex: :float multicolumn +$0 +#+end_src + +** Subfigure +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/subfigure +#contributor : Thomas Dehaeze +#name :Subfigure +# -- +#+name: fig:${1:figure_name} +#+caption: ${2:figure caption} +#+attr_latex: :environment subfigure :width 0.49\linewidth :align c +| file:${3:sub_fig_name}.${4:pdf} | file:${5:sub_fig_name}.${6:pdf} | +| <> ${7:sub figure caption} | <> ${8:sub figure caption} | +$0 +#+end_src + +** Table +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/table +#contributor : Thomas Dehaeze +#name :Table +# -- +#+name: tab:${1:table_name} +#+caption: ${2:Table caption} +#+attr_latex: :environment tabularx :width ${3:\linewidth} :align ${4:lXX} +#+attr_latex: :center t :booktabs t :float t +| $0 | | | +|---+---+---| +| | | | +#+end_src + +** Tikz +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/tikz +#contributor : Thomas Dehaeze +#name :Tikz figure +# -- +,#+begin_src latex :file ${1:figure_name}.pdf :post pdf2svg(file=*this*, ext="png") :exports both + \begin{tikzpicture} + $0 + \end{tikzpicture} +,#+end_src +#+end_src + +** Tikzfig +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/tikzfig +#contributor : Thomas Dehaeze +#name :Tikz Figure +# -- +#+NAME: fig:${1:figure_name} +#+HEADER: :headers '("\\\\usepackage{tikz}" "\\\\usepackage{import}" "\\\\import{$HOME/Cloud/thesis/LaTeX/}{config.tex}") +#+HEADER: :imagemagick t :fit yes :iminoptions -scale 100% -density 150 :imoutoptions -quality 100 +#+HEADER: :results raw replace :buffer no :eval no-export :exports both :mkdirp yes +#+HEADER: :output-dir ${2:figs} +,#+begin_src latex :file $1.pdf :post pdf2svg(file=*this*, ext="png") :exports both + \begin{tikzpicture} + $0 + \end{tikzpicture} +,#+end_src + +#+NAME: fig:$1 +#+CAPTION: ${3:Caption} +#+RESULTS: fig:$1 +#+end_src + +** Tikzheader +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/tikzheader +#contributor : Thomas Dehaeze +#name :Tikz Header +# -- +,* ${1:Title/Description of the figure} +,#+begin_src latex :file ${2:figure_name}.pdf :tangle figs/$2.tex :exports ${3:both} + \begin{tikzpicture} + $0 + \end{tikzpicture} +,#+end_src + +#+name: fig:$2 +#+caption: $1 ([[./figs/$2.png][png]], [[./figs/$2.pdf][pdf]], [[./figs/$2.tex][tex]]). +#+RESULTS: +[[file:./figs/$2.png]] +#+end_src + +** User-config +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/user-config +# -*- mode: snippet -*- +# name: user-config +# key: uc +# -- +,#+begin_src emacs-lisp :tangle user-config.el +$1 +,#+end_src +#+end_src + +** User-init +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/user-init +# -*- mode: snippet -*- +# name: user-init +# key: ui +# -- +,#+begin_src emacs-lisp :tangle user-init.el +$1 +,#+end_src +#+end_src + +** Wrap +#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/wrap +#contributor : Thomas Dehaeze +#name :Wrap +# -- +#+attr_latex: :float wrap +$0 +#+end_src