From bfd77210bcd006a7a189004b0f47ebaba71e9d93 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 16 Aug 2022 15:35:51 +0200 Subject: [PATCH] Improve pandoc report skeleton --- report/.envrc | 4 ++++ report/Makefile | 29 ++++++++++++++++------------- report/shell.nix | 31 +++++++++++++++++++++++++++++++ report/template.md | 44 +++++++++++++++++++++++++++----------------- 4 files changed, 78 insertions(+), 30 deletions(-) create mode 100644 report/.envrc create mode 100644 report/shell.nix diff --git a/report/.envrc b/report/.envrc new file mode 100644 index 0000000..d5b5c07 --- /dev/null +++ b/report/.envrc @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# this file is automatically loaded by `direnv`, if installed + +use nix # this will load the file `shell.nix` diff --git a/report/Makefile b/report/Makefile index 168701f..142691e 100644 --- a/report/Makefile +++ b/report/Makefile @@ -1,11 +1,14 @@ -PDVARS += --verbose -PDVARS += --highlight-style=pygments # the default theme +PANDOC_ARGS += --verbose +PANDOC_ARGS += --highlight-style=pygments # the default theme -# Optional filters, must be installed to use: -#PDVARS += --filter pandoc-include -#PDVARS += --filter pandoc-codeblock-include -#PDVARS += --filter pandoc-imagine -#PDVARS += --filter pandoc-crossref +# Optional filters, needs be installed seperately: + +#PANDOC_ARGS += --filter pandoc-include +#PANDOC_ARGS += --filter pandoc-include-code +#PANDOC_ARGS += --filter pandoc-imagine +#PANDOC_ARGS += --filter pandoc-crossref +#PANDOC_ARGS += --filter include-files.lua # this only works in the nix environment +#PANDOC_ARGS += --filter include-code-files.lua # this only works in the nix environment .PHONY: help help: @@ -18,11 +21,11 @@ has-%: false; \ ) >&2 -%.pdf: %.md Makefile has-pandoc - pandoc -i $< ${PDVARS} -o $@ #--pdf-engine=pdflatex +%.pdf: %.md Makefile | has-pandoc + pandoc -i $< ${PANDOC_ARGS} -o $@ #--pdf-engine=pdflatex -%.tex: %.md Makefile has-pandoc - pandoc -i $< ${PDVARS} -o $@ --standalone +%.tex: %.md Makefile | has-pandoc + pandoc -i $< ${PANDOC_ARGS} -o $@ --standalone -%.html: %.md Makefile has-pandoc - pandoc -i $< ${PDVARS} -o $@ --katex --standalone --self-contained +%.html: %.md Makefile | has-pandoc + pandoc -i $< ${PANDOC_ARGS} -o $@ --katex --standalone --self-contained diff --git a/report/shell.nix b/report/shell.nix new file mode 100644 index 0000000..d4c6b31 --- /dev/null +++ b/report/shell.nix @@ -0,0 +1,31 @@ +# This virtual environment may be loaded with the command `nix-shell` +# it require that you have nix installed, and nixpkgs configured as the a channel +{ pkgs ? import {} }: + +pkgs.mkShell { + buildInputs = with pkgs; [ + + # pandoc and pandoc-lua-filters + + (pkgs.writeShellScriptBin "pandoc" '' + export XDG_DATA_HOME=${pandoc-lua-filters}/share + exec ${pkgs.pandoc}/bin/pandoc "$@" + '') + + # optional pandoc filters: + + #pandoc-include + #pandoc-imagine + #haskellPackages.pandoc-crossref + #haskellPackages.pandoc-include-code + + # latex environment + + (texlive.combine { inherit (texlive) + scheme-small + fontaxes + atkinson + ;}) + + ]; +} diff --git a/report/template.md b/report/template.md index aabbcbe..d8fb367 100644 --- a/report/template.md +++ b/report/template.md @@ -1,7 +1,8 @@ --- -# These are meta-variables defined with YAML syntax, change them as you wish. -# see https://pandoc.org/MANUAL.html#variables -title: TDT4195 Assignment X +# This is a YAML preamble, defining pandoc meta-variables. +# Reference: https://pandoc.org/MANUAL.html#variables +# Change them as you see fit. +title: TDT4195 Excercise X author: - Gyrd Bannamule Gyrdsson - Gjavleik Britonis Podebusk @@ -10,12 +11,16 @@ lang: en-US papersize: a4 geometry: margin=4cm toc: false -toc-title: "List of Contents" +toc-title: "Table of Contents" toc-depth: 2 numbersections: true +header-includes: +# The `atkinson` font, requires 'texlive-fontsextra' on arch or the 'atkinson' CTAN package +# Uncomment this line to enable: +#- '`\usepackage[sfdefault]{atkinson}`{=latex}' colorlinks: true links-as-notes: true -# The document is following the break written using Markdown syntax +# The document is following this break is written using "Markdown" syntax --- -This[^this_is_a_unique_footnote_label] is a footnote. +This[^this_is_a_unique_footnote_label] is a footnote. +This^[Footnotes can also be written inline] is also a footnote. + [This]: https://www.uio.no [^this_is_a_unique_footnote_label]: In footnotes you can write anything tangentially related. @@ -49,13 +56,13 @@ This[^this_is_a_unique_footnote_label] is a footnote. * This * is * a -* bullet +* unordered * list 1. This 1. is 1. a -1. numbered +1. ordered 1. list a. with a. sub @@ -65,7 +72,7 @@ This[^this_is_a_unique_footnote_label] is a footnote. This is still on the first page -\clearpage +`\clearpage`{=latex}