Improve pandoc report skeleton

This commit is contained in:
2022-08-16 15:35:51 +02:00
parent 4bcc41ff84
commit bfd77210bc
4 changed files with 78 additions and 30 deletions

4
report/.envrc Normal file
View File

@@ -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`

View File

@@ -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

31
report/shell.nix Normal file
View File

@@ -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 <nixpkgs> {} }:
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
;})
];
}

View File

@@ -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
---
<!--
@@ -41,7 +46,9 @@ println!("Hello, {}", 42);
[This](https://www.ntnu.no) is a link.
[This][] is also a link. <!-- defined below -->
This[^this_is_a_unique_footnote_label] is a footnote.
This[^this_is_a_unique_footnote_label] is a footnote. <!-- defined below -->
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}
<!--
Above is a raw LaTeX statement.
@@ -74,9 +81,9 @@ Those are included when exporting to LaTeX or PDF, and ignored when exporting to
This is on the second page
i) Yo
i) Yo
i) Yo
i) Roman ordered list
i) Roman ordered list
i) Roman ordered list
This
: is a definition
@@ -84,13 +91,15 @@ This
> this is a
block quote
This is a paragraph with inline \LaTeX\ math: $\frac{1}{2}$.
Below is a math block:
This is a paragraph with _inline_ \LaTeX\ style math: $\frac{1}{2}$.
Below is a math _block_:
$$
\int_{a}^{b} f(x)dx
$$
| This | is | a | table |
| ---- | --- | --- | ----- |
| 1 | 2 | 3 | 4 |
@@ -98,13 +107,14 @@ $$
: This is a table caption
This is an inline image with set height:
This is an inline image with a fixed height:
![](images/logo.png){height=5em}
Below is a figure (i.e. an image with a caption).
Below is a _figure_ (i.e. an image with a caption).
It floats and may as a result move to a different page depending on the layout.
Use the `pandoc-crossref` filter to reference figures, tables and equations.
![
Image with caption
](images/logo.png)
Enable and use the `pandoc-crossref` filter to reference figures, tables and equations.