add latex/compile script

This commit is contained in:
Max Hohlfeld 2022-12-22 15:19:12 +01:00
parent aa33b73377
commit d3b2d0f9e6
4 changed files with 72 additions and 4 deletions

View File

@ -1,4 +1,4 @@
allTags := "nvim,xmonad,git" allTags := "nvim,xmonad,git,scripts"
default: default:
just --list just --list

View File

@ -0,0 +1,33 @@
#!/usr/bin/env sh
# takes a file and compiles it into a pdf file, if possible
# inspiration from https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/compiler
file=$(readlink -f "$1")
dir=${file%/*}
base="${file%.*}"
ext="${file##*.}"
cd "$dir" || exit 1
compile_tex() { \
if [ -e "$dir/Tectonic.toml"]; then
tectonic -X build
else
params=""
( grep -q minted $file) && params="$params -Z shell-escape"
tectonic -X compile "$params" $file
fi
}
case "$ext" in
md) pandoc -t pdf \
--pdf-engine tectonic \
-f gfm \
-V linkcolor:blue \
-V geometry:a4paper \
-V geometry:margin=2cm \
-V mainfont="Liberation Sans" \
-V monofont="Liberation Mono" \
-o "$base".pdf "$file" ;;
tex) textype "$file" ;;
esac

View File

@ -0,0 +1,25 @@
---
- name: Install packages required by scripts
ansible.builtin.package:
name:
- tectonic
- pandoc
- ttf-liberation
state: present
tags: pc
- name: Create a local bin directory if it doesn't exist
ansible.builtin.file:
path: ~/.local/bin
state: directory
mode: '0755'
tags: pc
- name: Copy over all scripts
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: '0755'
with_items:
- { src: compiledoc, dest: ~/.local/bin/compiledoc }
tags: pc

View File

@ -3,12 +3,22 @@
connection: local connection: local
hosts: localhost hosts: localhost
tasks: tasks:
- ansible.builtin.include_role: - name: Nvim role
ansible.builtin.include_role:
name: nvim name: nvim
tags: nvim tags: nvim
- ansible.builtin.include_role:
- name: Xmonad role
ansible.builtin.include_role:
name: xmonad name: xmonad
tags: xmonad tags: xmonad
- ansible.builtin.include_role:
- name: Git role
ansible.builtin.include_role:
name: git name: git
tags: git tags: git
- name: Scripts role
ansible.builtin.include_role:
name: scripts
tags: scripts