aboutsummaryrefslogtreecommitdiffstats
path: root/bin/tex2pdf
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2015-02-15 18:21:22 +0100
committerDavid Runge <dave@sleepmap.de>2015-02-15 18:21:22 +0100
commitf39f859b92bcdbfe2d176ec4d0c367157cf7cf67 (patch)
tree566b7d364fb97eef2bcc2cc6c8c335d960e09425 /bin/tex2pdf
parent435095ba31a816fece797713396df98ac51dc2e9 (diff)
downloaddotfiles-f39f859b92bcdbfe2d176ec4d0c367157cf7cf67.tar.gz
dotfiles-f39f859b92bcdbfe2d176ec4d0c367157cf7cf67.tar.bz2
dotfiles-f39f859b92bcdbfe2d176ec4d0c367157cf7cf67.tar.xz
dotfiles-f39f859b92bcdbfe2d176ec4d0c367157cf7cf67.zip
tex2pdf: Choosing mupdf over evince.
Diffstat (limited to 'bin/tex2pdf')
-rwxr-xr-xbin/tex2pdf11
1 files changed, 9 insertions, 2 deletions
diff --git a/bin/tex2pdf b/bin/tex2pdf
index 6eaaef6..fd99224 100755
--- a/bin/tex2pdf
+++ b/bin/tex2pdf
@@ -1,5 +1,6 @@
#!/bin/bash
logdestination="$HOME/.log/tex2pdf.log"
+already_open=$(ps aux | grep "$1.pdf" | grep -v "grep")
rm -rf $logdestination
touch $logdestination
echo "tex2pdf called with $1.tex">>$logdestination
@@ -18,8 +19,14 @@ echo "################## pdflatex, run #3 #################">>$logdestination
echo "#####################################################">>$logdestination
pdflatex -interaction=nonstopmode $1.tex>>$logdestination
echo "#####################################################">>$logdestination
-echo "Launching evince with $1.pdf.">>$logdestination
-evince $1.pdf &
+echo "Launching mupdf with $1.pdf.">>$logdestination
+
+if [ -n "$already_open" ]; then
+ kill "$(echo $already_open | awk '{print $2}')"
+ echo "Killing pid $(echo $already_open | awk '{print $2}'), which has $1.pdf open already." >>$logdestination
+fi
+mupdf $1.pdf &
+
echo "#####################################################">>$logdestination
echo "Removing aux,bbl,blg,dvi,lof,log,lot,nav,out,snm,toc.">>$logdestination
echo "Current directory: $(pwd) and children of depth 1.">>$logdestination