Skip to content

Instantly share code, notes, and snippets.

@zhou-chao
Last active August 29, 2015 14:07
Show Gist options
  • Save zhou-chao/6fe66a43ea8981e7303a to your computer and use it in GitHub Desktop.
Save zhou-chao/6fe66a43ea8981e7303a to your computer and use it in GitHub Desktop.
Update .pdf file whenever the .tex is modified.
#!/bin/sh
#########################################
# created by
# Zhou Chao
# at
# 2014.11
# args
# $1: tex file name to be edited
#########################################
# get file name without extension
FILE_NAME=`echo $1 | cut -d'.' -f 1`
echo $FILE_NAME
# get pdf file name
PDF_NAME="$FILE_NAME.pdf"
echo $PDF_NAME
# open pdf viewer
gnome-open $PDF_NAME
# open vim editor
gnome-terminal -e "bash -c \"vim $1\""
# watch on tex file changes
while inotifywait -e delete_self $1;
do pdflatex $1;
done
@zhou-chao
Copy link
Author

  • Platform: Linux.
  • Dependencies: inotify.
  • Usage: ./realTimeTex.sh some.tex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment