dotfiles/recipes/tex

59 lines
1.6 KiB
Bash

#!/bin/bash
# Description: Document typesetting
set -e
case "$(uname -s)" in
Darwin)
_recipe brew
_brew_cask mactex
;;
*)
_recipe _apt
# Install texlive if it isn't already available (e.g. a local or
# portable installation).
if ! command -v tlmgr >/dev/null; then
_ppa jonathonf/texlive
_apt texlive-full
else
echo "[tex] Texlive appears to already be installed, skipping."
fi
# xzdec is required by tlmgr
_apt xzdec
esac
tlmgr init-usertree 2>/dev/null || true
function _tex {
local pkg=$1
if ! tlmgr --usermode info --only-installed $pkg | grep -i '^installed:.*Yes$' >/dev/null 2>&1; then
_run "[tex] Install $pkg" tlmgr --usermode install $@
else
echo "[tex] $pkg is already installed, skipping."
fi
}
function _tex_git {
local pkg=$1
local repo=$2
local repo_path=$3
local clone_path="$(kpsewhich -var-value TEXMFHOME)/git/latex/${pkg}"
local install_path="$(kpsewhich -var-value TEXMFHOME)/tex/latex/${pkg}"
if [[ ! -d "${install_path}" ]]; then
_git $2 "$(kpsewhich -var-value TEXMFHOME)/git/latex/${pkg}"
_run "[tex] Install $pkg" ln -s "${clone_path}/${repo_path}" "${install_path}"
else
echo "[tex] $pkg is already installed, skipping."
fi
}
_tex labbook
_tex mdframed
_tex microtype
_tex minted
_tex moderncv
_tex soul
_tex tufte-latex
_recipe git
_tex_git dnd https://github.com/evanbergeron/DND-5e-LaTeX-Template.git
_tex_git trek https://github.com/lancelet/beamer-trek.git theme