From a05d11d6379cebacc60007562472f8a5a2aac8bd Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Fri, 8 Dec 2023 10:34:41 +0100 Subject: [PATCH] Switch to minted for listings --- .dir-locals.el | 3 ++- .gitignore | 1 + book.org | 2 +- build.el | 2 +- flake.nix | 8 ++++++-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el index 9cb2bf6..3baa4fa 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -5,10 +5,11 @@ ("\\section{%s}" . "\\addsec{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))) - (org-latex-src-block-backend . 'listings) + (org-latex-src-block-backend . minted) (org-latex-prefer-user-labels . t) (org-html-prefer-user-labels . t) (org-latex-toc-command . "\\frontmatter\n\\addchap{Table of Contents}\n\\label{chap:toc}\n\\listoftoc*{toc}\n\n") + (org-latex-pdf-process . ("latexmk -f -pdf -%latex -interaction=nonstopmode -shell-escape -output-directory=%o %f")) (fill-column . 200))) (org-mode . ((eval . (progn (visual-line-mode) (org-toggle-link-display) diff --git a/.gitignore b/.gitignore index 551a40b..0d87188 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ book.pdf book.tex diff.pdf +_minted-book diff --git a/book.org b/book.org index e49295e..32b341b 100644 --- a/book.org +++ b/book.org @@ -5,7 +5,7 @@ #+LATEX_CLASS_OPTIONS: [paper=240mm:170mm,parskip] #+LATEX_COMPILER: lualatex #+LATEX_HEADER: \usepackage[inline]{enumitem} -#+LATEX_HEADER: \usepackage{listings} +#+LATEX_HEADER: \usepackage{minted} #+LATEX_HEADER: \usepackage{color} #+LATEX_HEADER: \usepackage{url} #+LATEX_HEADER: \usepackage[type=report]{ugent2016-title} diff --git a/build.el b/build.el index 619143d..26962d0 100644 --- a/build.el +++ b/build.el @@ -14,7 +14,7 @@ ("\\section{%s}" . "\\addsec{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))) - org-latex-src-block-backend 'listings + org-latex-src-block-backend 'minted org-latex-prefer-user-labels t org-latex-toc-command "\\frontmatter\n\\addchap{Table of Contents}\n\\label{chap:toc}\n\\listoftoc*{toc}\n\n") diff --git a/flake.nix b/flake.nix index 7f0d446..74204f7 100644 --- a/flake.nix +++ b/flake.nix @@ -27,6 +27,9 @@ full-texlive = pkgs.texlive.combine { inherit (pkgs.texlive) scheme-full; inherit ugent2016; }; build-diffed = pkgs.writeShellScriptBin "build-diffed" '' set -E + + export PATH=${pkgs.python311Packages.pygments}/bin:$PATH + atexit() { git worktree remove -f .sent rm book.tex sent.tex diff.tex -f @@ -41,8 +44,8 @@ popd mkdir build ${full-texlive}/bin/latexdiff --math-markup=whole -t CFONT sent.tex book.tex > diff.tex - ${full-texlive}/bin/latexmk -f -pdf -lualatex -interaction=nonstopmode -output-directory=build book.tex - ${full-texlive}/bin/latexmk -f -pdf -lualatex -interaction=nonstopmode -output-directory=build diff.tex + ${full-texlive}/bin/latexmk -f -pdf -lualatex -shell-escape -interaction=nonstopmode -output-directory=build book.tex + ${full-texlive}/bin/latexmk -f -pdf -lualatex -shell-escape -interaction=nonstopmode -output-directory=build diff.tex mv build/book.pdf build/diff.pdf . ''; ugent2016 = pkgs.stdenvNoCC.mkDerivation (finalAttrs: { @@ -104,6 +107,7 @@ packages = [ full-texlive pkgs.nixpkgs-fmt + pkgs.python310Packages.pygments ]; commands = [ {