From 6df26c02303da93ae592b58c06e18adb646f47db Mon Sep 17 00:00:00 2001 From: Blendoit Date: Sat, 12 Sep 2020 12:34:41 -0700 Subject: Minted---colored source blocks in Org LaTeX exports. --- blendoit/.gitignore | 3 ++ blendoit/blendoit-init.org | 100 ++++++++++++++++++++------------------------- blendoit/blendoit-init.pdf | Bin 248467 -> 118502 bytes blendoit/secrets.org | 4 -- blendoit/test.el | 1 - blendoit/test.org | 7 ---- 6 files changed, 47 insertions(+), 68 deletions(-) delete mode 100644 blendoit/secrets.org delete mode 100644 blendoit/test.el delete mode 100644 blendoit/test.org (limited to 'blendoit') diff --git a/blendoit/.gitignore b/blendoit/.gitignore index 0233e75..dff4699 100644 --- a/blendoit/.gitignore +++ b/blendoit/.gitignore @@ -1,2 +1,5 @@ # blendoit/.gitignore +_minted-blendoit-init/ +secrets.org +secrets.el \ No newline at end of file diff --git a/blendoit/blendoit-init.org b/blendoit/blendoit-init.org index 833a4ee..8422964 100644 --- a/blendoit/blendoit-init.org +++ b/blendoit/blendoit-init.org @@ -8,7 +8,7 @@ #+LATEX: \begin{abstract} GNU Emacs is most often used as a text editor. -The utmost level of customisation is afforded by enabling the user +The utmost level of customization is afforded by enabling the user to rewrite \textit{any} part of the source code and observe the editor's modified behaviour in real time. Since its inception in 1984, GNU Emacs has grown to be much more than a full-featured, high-productivity @@ -24,7 +24,7 @@ this is the endgame of \textit{literate programming}. * Introduction The following sections were laid out very deliberately. When we start Emacs, -Emacs Lisp source blocks contained in this document are evaluated +Emacs Lisp source code blocks contained in this document are evaluated sequentially---our editing environment is constructed in real time as we execute the blocks in order. For instance, we only begin loading packages once we ensured ~use-package~ is working properly. @@ -73,7 +73,7 @@ On my MS Windows machine, I add the path to Portable Git.[fn::Download from https://git-scm.com/download/win] #+BEGIN_SRC emacs-lisp -(if (string-equal system-type "windows-nt") + (when (string-equal system-type "windows-nt") (add-to-list 'exec-path "C:/Users/marius.peter/PortableGit/bin/")) #+END_SRC @@ -186,11 +186,16 @@ GNU/Linux. Frame transparency increases when focus is lost. ** Secrets -#+INCLUDE: ./secrets.org +The code contained in the =secrets.org= file is loaded by Emacs, but not +rendered in this PDF for the sake of privacy. It contains individually +identifying information such as names and e-mail addresses, which are used to +populate Org templates (Section [[~org-mode~]]). + +You need to create this =secrets.org= file, as it is ignored by =git= by +default. #+BEGIN_SRC emacs-lisp - (setq user-full-name "Marius Peter" - user-mail-address "blendoit@gmail.com") + (org-babel-load-file "~/.emacs.d/blendoit/secrets.org") #+END_SRC * Global key bindings @@ -385,62 +390,45 @@ format: *** LaTeX export -The following makes =TODO= items appear red and =CLOSED= items appear green in -Org's LaTeX exports. Very stylish, much flair! +We customize the format for org time stamps to make them pop in our exported +LaTeX documents. #+BEGIN_SRC emacs-lisp (setq org-latex-active-timestamp-format - "\\textcolor{SteelBlue}{\\texttt{%s}}") + "\\texttt{%s}") (setq org-latex-inactive-timestamp-format - "\\textcolor{ForestGreen}{\\texttt{%s}}") -#+END_SRC - -*** Publish - -In the following /alist/ (association list), we describe the projects publishable -via =org-publish=. We separate the publishing of =.org= files and attachments, -because an online tutorial recommended we do so. - -#+BEGIN_SRC emacs-lisp -(require 'ox-publish) -(setq org-publish-project-alist - '( - ("Safran-VIP-html" - :base-directory "~/org/WORK/Safran/programs/B787/VIP/doc/org/" - :base-extension "org" - :publishing-directory "~/org/WORK/Safran/programs/B787/VIP/doc/wiki/" - :recursive t - :publishing-function org-html-publish-to-html - :auto-preamble t - :auto-sitemap t - :sitemap-title "" ) - ("Safran-VIP-static" - :base-directory "~/org/WORK/Safran/programs/B787/VIP/doc/org/" - :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|mp4\\|ogg\\|swf" - :publishing-directory "~/org/WORK/Safran/programs/B787/VIP/doc/wiki/" - :recursive t - :publishing-function org-publish-attachment ) - ("Safran-VIP-all" - :components ("Safran-VIP-html" "Safran-VIP-static")) - ("Safran-MA700-html" - :base-directory "~/org/WORK/Safran/programs/MA700/doc/org/" - :base-extension "org" - :publishing-directory "~/org/WORK/Safran/programs/MA700/doc/wiki/" - :recursive t - :publishing-function org-html-publish-to-html - :auto-preamble t - :auto-sitemap t - :sitemap-title "" ) - ("Safran-MA700-static" - :base-directory "~/org/WORK/Safran/programs/MA700/doc/org/" - :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|mp4\\|ogg\\|swf" - :publishing-directory "~/org/WORK/Safran/programs/MA700/doc/wiki/" - :recursive t - :publishing-function org-publish-attachment ) - ("Safran-MA700-all" - :components ("Safran-MA700-html" "Safran-MA700-static")))) + "\\texttt{%s}") +#+END_SRC + +The following packages are loaded for every LaTeX export + +#+BEGIN_SRC emacs-lisp + (setq org-latex-packages-alist + '(("AUTO" "polyglossia" t + ("xelatex" "lualatex")) + ("AUTO" "babel" t + ("pdflatex")) + ("AUTO" "booktabs" t + ("pdflatex")) + ("table,svgnames" "xcolor" t + ("pdflatex")))) #+END_SRC +Little bonus for GNU/Linux users: syntax highlighting for source code blocks in +LaTeX exports. + +#+BEGIN_SRC emacs-lisp + (when (string-equal system-type "gnu/linux") + (add-to-list 'org-latex-packages-alist '("AUTO" "minted" t + ("pdflatex" "lualatex"))) + (setq org-latex-listings 'minted) + (setq org-latex-minted-options + '(("style" "friendly") ()))) +#+END_SRC + +The following makes =TODO= items appear red and =CLOSED= items appear green in +Org's LaTeX exports. Very stylish, much flair! + *** Export This creates a shorter binding for the most common Org export: Org \rightarrow diff --git a/blendoit/blendoit-init.pdf b/blendoit/blendoit-init.pdf index bd0f983..1f28bb5 100644 Binary files a/blendoit/blendoit-init.pdf and b/blendoit/blendoit-init.pdf differ diff --git a/blendoit/secrets.org b/blendoit/secrets.org deleted file mode 100644 index a6ca895..0000000 --- a/blendoit/secrets.org +++ /dev/null @@ -1,4 +0,0 @@ -#+BEGIN_SRC emacs-lisp - (setq user-full-name "Marius Peter" - user-mail-address "blendoit@gmail.com") -#+END_SRC diff --git a/blendoit/test.el b/blendoit/test.el deleted file mode 100644 index ca95879..0000000 --- a/blendoit/test.el +++ /dev/null @@ -1 +0,0 @@ -(when window-system (add-hook 'prog-mode-hook 'hl-line-mode)) diff --git a/blendoit/test.org b/blendoit/test.org deleted file mode 100644 index d4492b8..0000000 --- a/blendoit/test.org +++ /dev/null @@ -1,7 +0,0 @@ -** hl-line - -Highlight line at point. - -#+BEGIN_SRC emacs-lisp -(when window-system (add-hook 'prog-mode-hook 'hl-line-mode)) -#+END_SRC -- cgit v1.2.3