├── shell.nix ├── image.png ├── output.pdf ├── preview-0.png ├── preview-1.png ├── preview-2.png ├── preview-3.png ├── preview-4.png ├── wallpaper.png ├── wallpaper2.png ├── install.nix ├── nix ├── nixpkgs-pinned │ ├── nixpkgs.json │ └── default.nix └── scripts │ └── generate-nixpkgs-json.nix ├── README.md ├── default.nix ├── Makefile └── source.md /shell.nix: -------------------------------------------------------------------------------- 1 | (import ./default.nix).slides 2 | -------------------------------------------------------------------------------- /image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinwoo/easy-markdown-beamer-pandoc/HEAD/image.png -------------------------------------------------------------------------------- /output.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinwoo/easy-markdown-beamer-pandoc/HEAD/output.pdf -------------------------------------------------------------------------------- /preview-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinwoo/easy-markdown-beamer-pandoc/HEAD/preview-0.png -------------------------------------------------------------------------------- /preview-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinwoo/easy-markdown-beamer-pandoc/HEAD/preview-1.png -------------------------------------------------------------------------------- /preview-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinwoo/easy-markdown-beamer-pandoc/HEAD/preview-2.png -------------------------------------------------------------------------------- /preview-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinwoo/easy-markdown-beamer-pandoc/HEAD/preview-3.png -------------------------------------------------------------------------------- /preview-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinwoo/easy-markdown-beamer-pandoc/HEAD/preview-4.png -------------------------------------------------------------------------------- /wallpaper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinwoo/easy-markdown-beamer-pandoc/HEAD/wallpaper.png -------------------------------------------------------------------------------- /wallpaper2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justinwoo/easy-markdown-beamer-pandoc/HEAD/wallpaper2.png -------------------------------------------------------------------------------- /install.nix: -------------------------------------------------------------------------------- 1 | let 2 | default = import ./default.nix; 3 | in { 4 | inherit (default) 5 | texlive; 6 | inherit (default.pkgs) 7 | pandoc 8 | watchexec; 9 | } 10 | -------------------------------------------------------------------------------- /nix/nixpkgs-pinned/nixpkgs.json: -------------------------------------------------------------------------------- 1 | { 2 | "url": "https://github.com/NixOS/nixpkgs/archive/7df10f388dabe9af3320fe91dd715fc84f4c7e8a.tar.gz", 3 | "rev": "7df10f388dabe9af3320fe91dd715fc84f4c7e8a", 4 | "owner": "NixOS", 5 | "repo": "nixpkgs", 6 | "sha256": "14n9nwdmd1jvvic1rnyw4023fm97b0xn4nq801l29vpnfzyab04w" 7 | } 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Easy Markdown to Beamer with Pandoc 2 | 3 | Simple things nobody tells you how to do. See the slides: [./output.pdf](./output.pdf) 4 | 5 | Short blog post about this: 6 | 7 | Image preview: 8 | 9 | ![](./preview-0.png) 10 | ![](./preview-1.png) 11 | ![](./preview-2.png) 12 | ![](./preview-3.png) 13 | ![](./preview-4.png) 14 | -------------------------------------------------------------------------------- /nix/nixpkgs-pinned/default.nix: -------------------------------------------------------------------------------- 1 | { config ? {} 2 | , overlays ? [] 3 | }: 4 | 5 | let 6 | nixpkgs-args = builtins.fromJSON (builtins.readFile ./nixpkgs.json); 7 | 8 | nixpkgs = with nixpkgs-args; builtins.fetchTarball { 9 | url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; 10 | inherit sha256; 11 | }; 12 | 13 | pkgs = import nixpkgs { inherit config overlays; }; 14 | in 15 | pkgs 16 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | let 2 | pkgs = import ./nix/nixpkgs-pinned {}; 3 | 4 | texlive = pkgs.texlive.combine { 5 | inherit (pkgs.texlive) 6 | scheme-small 7 | noto 8 | mweights 9 | cm-super 10 | cmbright 11 | fontaxes 12 | beamer; 13 | }; 14 | in { 15 | inherit pkgs; 16 | inherit texlive; 17 | 18 | slides = pkgs.stdenv.mkDerivation { 19 | name = "slides"; 20 | phases = []; 21 | buildInputs = [ 22 | texlive 23 | pkgs.pandoc 24 | pkgs.watchexec 25 | ]; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build update-nixpkgs 2 | build: 3 | nix-shell --pure --run 'make slides' 4 | slides: 5 | pandoc -t beamer source.md -o output.pdf 6 | watch: 7 | nix-shell --pure --run 'watchexec -e md make slides' 8 | repl: 9 | nix repl nix/nixpkgs-pinned 10 | 11 | NIXPKGS_OWNER?=NixOS 12 | NIXPKGS_REPO?=nixpkgs 13 | NIXPKGS_REV?=7df10f388dabe9af3320fe91dd715fc84f4c7e8a 14 | update-nixpkgs: 15 | nix-shell --pure nix/scripts/generate-nixpkgs-json.nix \ 16 | --argstr owner $(NIXPKGS_OWNER) \ 17 | --argstr repo $(NIXPKGS_REPO) \ 18 | --argstr rev $(NIXPKGS_REV) 19 | -------------------------------------------------------------------------------- /nix/scripts/generate-nixpkgs-json.nix: -------------------------------------------------------------------------------- 1 | { owner, repo, rev }: 2 | 3 | let 4 | pkgs = import {}; 5 | 6 | url="https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; 7 | 8 | file = builtins.fetchTarball { url = url; }; 9 | 10 | json = builtins.toFile "data.json" '' 11 | { "url": "${url}" 12 | , "rev": "${rev}" 13 | , "owner": "${owner}" 14 | , "repo": "${repo}" 15 | } 16 | ''; 17 | 18 | out-filename = builtins.toString ../nixpkgs-pinned/nixpkgs.json; 19 | 20 | sha256calc = "nix-hash --type sha256 --base32 ${file}"; 21 | in 22 | 23 | 24 | pkgs.stdenv.mkDerivation rec { 25 | name = "generate-nixpkgs-json"; 26 | 27 | buildInputs = [ 28 | pkgs.jq 29 | pkgs.nix 30 | ]; 31 | 32 | shellHook = '' 33 | set -eu 34 | sha256=$(${sha256calc}) 35 | jq .+="{\"sha256\":\"$sha256\"}" ${json} > ${out-filename} 36 | exit 37 | ''; 38 | } 39 | -------------------------------------------------------------------------------- /source.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Easy Markdown to Beamer with Pandoc 3 | subtitle: Simple things nobody tells you how to do 4 | author: Justin Woo 5 | date: 2018 onwards 6 | theme: Madrid 7 | colortheme: dolphin 8 | fontfamily: noto-sans 9 | aspectratio: 169 10 | header-includes: 11 | - \usepackage{cmbright} 12 | - \usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{wallpaper2.png}} 13 | fontsize: 10pt 14 | --- 15 | 16 | # Code demo 17 | 18 | Here's some code: 19 | 20 | ```hs 21 | data Maybe a = Just a | Nothing 22 | ``` 23 | 24 | Here's a centered image of a ratio of textwidth: 25 | 26 | \begin{center} 27 | \includegraphics[width=0.3\textwidth]{./image.png} 28 | \end{center} 29 | 30 | # Installation 31 | 32 | I use nix because I couldn't get a consistent installation of all the tools required otherwise. Get nix here: 33 | 34 | See the contents of `default.nix`, and if you need more packages, try finding by running `nix repl nix/nixpkgs-pinned` (note that it's `nix repl`, not `nix-repl`.): 35 | 36 | \small 37 | ``` 38 | > nix repl nix/nixpkgs-pinned 39 | 40 | Welcome to Nix version 2.0.4. Type :? for help. 41 | 42 | Loading 'nix/nixpkgs-pinned'... 43 | Added 9438 variables. 44 | 45 | nix-repl> texlive.coll 46 | texlive.collcell texlive.collection-langitalian 47 | texlive.collectbox texlive.collection-langjapanese 48 | texlive.collection-basic texlive.collection-langkorean 49 | texlive.collection-bibtexextra texlive.collection-langother 50 | texlive.collection-binextra texlive.collection-langpolish 51 | ``` 52 | 53 | # Build 54 | 55 | Run `make`, or `make watch` if you want to watch on file changes. Note that I use `nix-shell --run` for these, since I don't really want to bother having to start up a nix-shell session myself. 56 | 57 | ``` 58 | > make watch 59 | 60 | nix-shell --run 'watchexec -e md make slides' 61 | make[1]: Entering directory '/home/justin/Code/easy-markdown-beamer-pandoc' 62 | pandoc -t beamer source.md -o slides.pdf 63 | make[1]: Leaving directory '/home/justin/Code/easy-markdown-beamer-pandoc' 64 | ``` 65 | 66 | # Acknowledgements 67 | 68 | ## John Children 69 | 70 | Showed me his setup to get started 71 | 72 | ## Domen Kozar 73 | 74 | Linked me to some existing Nix+texlive docs that led to me finding other things 75 | 76 | ## Chris Martin 77 | 78 | Suggested an option for setting fonts that led to what I needed here 79 | 80 | ## Et al 81 | 82 | People who I forgot to include here 83 | --------------------------------------------------------------------------------