Skip to content

Instantly share code, notes, and snippets.

@leminhtr
Created November 8, 2022 19:09
Show Gist options
  • Save leminhtr/4bd79f6a1af1d684e9032a2f289a5cb4 to your computer and use it in GitHub Desktop.
Save leminhtr/4bd79f6a1af1d684e9032a2f289a5cb4 to your computer and use it in GitHub Desktop.
Helper functions to fetch latex package from CTAN with either wget or git clone then install them on Ubuntu
export LATEX_STY_INSTALL_PATH="/usr/share/texmf/tex/latex/"
function install_sty_wget_ctan_latex() {
mkdir -p /tmp/sty/ &&
cd /tmp/sty/ &&
wget "$1" &&
unzip $(basename "$1") &&
folder_name="$(ls -t | tail -1)"
echo "mv $folder_name $LATEX_STY_INSTALL_PATH" &&
sudo mv $folder_name $LATEX_STY_INSTALL_PATH &&
cd $LATEX_STY_INSTALL_PATH &&
sudo texhash folder_name;
echo "Installed sty list:";
ls
}
function install_sty_gitclone_ctan_latex() {
mkdir -p /tmp/sty/ &&
cd /tmp/sty/ &&
git clone "$1" &&
folder_name="$(ls -t | tail -1)"
echo "mv $folder_name $LATEX_STY_INSTALL_PATH" &&
sudo mv $folder_name $LATEX_STY_INSTALL_PATH &&
cd $LATEX_STY_INSTALL_PATH &&
sudo texhash folder_name;
echo "Installed sty list:"
ls;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment