2018-02-22 16:27:37 +00:00
|
|
|
#!/bin/bash
|
2018-04-12 18:07:33 +00:00
|
|
|
# Description: Document typesetting
|
2018-02-27 05:15:14 +00:00
|
|
|
set -e
|
2018-02-22 16:27:37 +00:00
|
|
|
|
2023-05-02 15:20:16 +00:00
|
|
|
__tex_init="tlmgr init-usertree"
|
2021-02-05 00:05:51 +00:00
|
|
|
__tex_info="tlmgr --usermode info --only-installed"
|
|
|
|
__tex_install="tlmgr --usermode install"
|
|
|
|
|
|
|
|
case "$_PLATFORM" in
|
|
|
|
darwin)
|
2018-02-22 16:27:37 +00:00
|
|
|
_recipe brew
|
2018-02-23 15:19:52 +00:00
|
|
|
_brew_cask mactex
|
2018-02-22 16:27:37 +00:00
|
|
|
;;
|
2021-02-05 00:05:51 +00:00
|
|
|
arch)
|
2023-05-02 15:19:58 +00:00
|
|
|
# Install texlive if it isn't already available (e.g. a local or
|
|
|
|
# portable installation).
|
|
|
|
if ! command -v tlmgr >/dev/null; then
|
|
|
|
_recipe _arch
|
|
|
|
_pacman texlive-bibtexextra
|
|
|
|
_pacman texlive-core
|
|
|
|
_pacman texlive-fontsextra
|
|
|
|
_pacman texlive-formatsextra
|
|
|
|
_pacman texlive-games
|
|
|
|
_pacman texlive-humanities
|
|
|
|
_pacman texlive-latexextra
|
|
|
|
_pacman texlive-music
|
|
|
|
_pacman texlive-pictures
|
|
|
|
_pacman texlive-pstricks
|
|
|
|
_pacman texlive-publishers
|
|
|
|
_pacman texlive-science
|
|
|
|
_yay tllocalmgr-git
|
|
|
|
__tex_init=""
|
|
|
|
__tex_info="tllocalmgr info --localsearch"
|
|
|
|
__tex_install="yes | tllocalmgr install"
|
|
|
|
else
|
|
|
|
echo "[tex] Texlive appears to already be installed, skipping."
|
|
|
|
fi
|
2021-02-05 00:05:51 +00:00
|
|
|
;;
|
|
|
|
debian)
|
2018-02-22 16:27:37 +00:00
|
|
|
_recipe _apt
|
2020-06-24 23:51:04 +00:00
|
|
|
# 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
|
2020-06-25 01:31:32 +00:00
|
|
|
else
|
|
|
|
echo "[tex] Texlive appears to already be installed, skipping."
|
2020-06-24 23:51:04 +00:00
|
|
|
fi
|
2018-08-14 02:11:18 +00:00
|
|
|
# xzdec is required by tlmgr
|
|
|
|
_apt xzdec
|
2018-02-22 16:27:37 +00:00
|
|
|
esac
|
2018-05-02 21:23:12 +00:00
|
|
|
|
2023-05-02 15:20:16 +00:00
|
|
|
$__tex_init 2>/dev/null || /bin/true
|
2018-05-02 21:23:12 +00:00
|
|
|
|
|
|
|
function _tex {
|
|
|
|
local pkg=$1
|
2021-02-05 00:05:51 +00:00
|
|
|
if ! $__tex_info $pkg | grep -i '^installed:.*Yes$' >/dev/null 2>&1; then
|
|
|
|
_run "[tex] Install $pkg" bash -c "$__tex_install $@"
|
2018-05-02 21:23:12 +00:00
|
|
|
else
|
|
|
|
echo "[tex] $pkg is already installed, skipping."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-05-30 13:45:49 +00:00
|
|
|
function _tex_git {
|
|
|
|
local pkg=$1
|
|
|
|
local repo=$2
|
2018-10-01 20:38:28 +00:00
|
|
|
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}"
|
2021-02-05 00:05:51 +00:00
|
|
|
_run "[tex] Install $pkg" mkdir -p "${install_path}" && ln -s "${clone_path}/${repo_path}" "${install_path}"
|
2018-10-01 20:38:28 +00:00
|
|
|
else
|
|
|
|
echo "[tex] $pkg is already installed, skipping."
|
|
|
|
fi
|
2018-05-30 13:45:49 +00:00
|
|
|
}
|
|
|
|
|
2018-05-02 21:23:12 +00:00
|
|
|
_tex labbook
|
|
|
|
_tex mdframed
|
|
|
|
_tex microtype
|
|
|
|
_tex minted
|
|
|
|
_tex moderncv
|
|
|
|
_tex soul
|
|
|
|
_tex tufte-latex
|
2018-05-30 13:45:49 +00:00
|
|
|
|
|
|
|
_recipe git
|
|
|
|
_tex_git dnd https://github.com/evanbergeron/DND-5e-LaTeX-Template.git
|
2018-10-01 20:38:28 +00:00
|
|
|
_tex_git trek https://github.com/lancelet/beamer-trek.git theme
|