diff options
author | David Runge <dave@sleepmap.de> | 2022-12-09 23:04:33 +0100 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2022-12-09 23:04:33 +0100 |
commit | e279192d6d79061c16812f2acc5880af291cbe23 (patch) | |
tree | a3b1f9a0d23d92fc3c69801c1c78aa2738cb671d | |
parent | 2d158826b2448f9ef0a07f49fc6e265d26d81737 (diff) | |
download | dotfiles-e279192d6d79061c16812f2acc5880af291cbe23.tar.gz dotfiles-e279192d6d79061c16812f2acc5880af291cbe23.tar.bz2 dotfiles-e279192d6d79061c16812f2acc5880af291cbe23.tar.xz dotfiles-e279192d6d79061c16812f2acc5880af291cbe23.zip |
Use xelatex in tex2pdf and cleanup script
bin/tex2pdf:
Use xelatex in tex2pdf and cleanup script
-rwxr-xr-x | bin/tex2pdf | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/bin/tex2pdf b/bin/tex2pdf index 6d13513..d3b6270 100755 --- a/bin/tex2pdf +++ b/bin/tex2pdf @@ -1,16 +1,17 @@ -#!/usr/bin/env bash +#!/usr/bin/bash + set -eu initial_pwd=$(pwd) filename="" dirname="" -mupdf_pid="0" input_suffix=".tex" probe_suffix="tex" output_suffix=".pdf" get_filename() { - local base="$(basename "${1}")" + local base + base="$(basename "${1}")" filename="${base%.*}" } @@ -28,38 +29,28 @@ probe_extension() { } probe_tools() { - if [ ! -x /usr/bin/pdflatex ]; then - echo "/usr/bin/pdflatex not available. Exiting..." - exit 1 - fi - if [ ! -x /usr/bin/bibtex ]; then - echo "/usr/bin/bibtex not available. Exiting..." - exit 1 - fi - if [ ! -x /usr/bin/mupdf ]; then - echo "/usr/bin/mupdf not available. Exiting..." - exit 1 - fi + local tools=( + pdflatex + bibtex + mupdf + ) + local tool + + for tool in "${tools[@]}"; do + if ! command -v "$tool" > /dev/null; then + printf "%s not available. Exiting...\n" "$tool" + exit 1 + fi + done + return 0 } create_pdf() { cd "${dirname}" set +e - pdflatex \ - -interaction=nonstopmode \ - -shell-escape \ - "${filename}${input_suffix}" > /dev/null - bibtex "${filename}.aux" - makeglossaries "${filename}" - pdflatex \ - -interaction=nonstopmode \ - -shell-escape \ - "${filename}${input_suffix}" > /dev/null - pdflatex \ - -interaction=nonstopmode \ - -shell-escape \ - "${filename}${input_suffix}" + xelatex -interaction=nonstopmode "${filename}${input_suffix}" + xelatex -interaction=nonstopmode "${filename}${input_suffix}" set -e cd "${initial_pwd}" return 0 @@ -73,10 +64,10 @@ show_pdf() { } cleanup() { - rm -f "${dirname}/"*.{acn,acr,alg,aux,bbl,bcf,blg,dvi,glg,glo,gls,glsdefs,idx,ist,lof,log,lol,lot,nav,out,run.xml,snm,toc,upa,upb,vrb,xdy} \ - "${dirname}/"*/*.{acn,acr,alg,aux,bbl,bcf,blg,dvi,glg,glo,gls,glsdefs,idx,ist,lof,log,lol,lot,nav,out,run.xml,snm,toc,upa,upb,vrb,xdy} \ - ./*.{acn,acr,alg,aux,bbl,bcf,blg,dvi,glg,glo,gls,glsdefs,idx,ist,lof,log,lol,lot,nav,out,run.xml,snm,toc,upa,upb,vrb,xdy} \ - ./*/*.{acn,acr,alg,aux,bbl,bcf,blg,dvi,glg,glo,gls,glsdefs,idx,ist,lof,log,lot,nav,out,run.xml,snm,toc,upa,upb,vrb,xdy} + rm -f "${dirname}/"*.{acn,acr,alg,aux,bbl,bcf,blg,dvi,glg,glo,gls,glsdefs,idx,ist,lof,lol,lot,nav,out,run.xml,snm,toc,upa,upb,vrb,xdy} \ + "${dirname}/"*/*.{acn,acr,alg,aux,bbl,bcf,blg,dvi,glg,glo,gls,glsdefs,idx,ist,lof,lol,lot,nav,out,run.xml,snm,toc,upa,upb,vrb,xdy} \ + ./*.{acn,acr,alg,aux,bbl,bcf,blg,dvi,glg,glo,gls,glsdefs,idx,ist,lof,lol,lot,nav,out,run.xml,snm,toc,upa,upb,vrb,xdy} \ + ./*/*.{acn,acr,alg,aux,bbl,bcf,blg,dvi,glg,glo,gls,glsdefs,idx,ist,lof,lot,nav,out,run.xml,snm,toc,upa,upb,vrb,xdy} } render_diags() { |