Skip to content

Instantly share code, notes, and snippets.

@krrrr38
Created February 2, 2012 06:37
Show Gist options
  • Save krrrr38/1722025 to your computer and use it in GitHub Desktop.
Save krrrr38/1722025 to your computer and use it in GitHub Desktop.
usage: tex_pdf.sh tex_file
#!/bin/bash
CMDNAME=`basename $0`
if [ $# -ne 1 ]; then
echo "usage: CMDNAME: tex_file" 1>&2
exit 0
fi
tex_file=$1
file_name=${tex_file##*/}
file=${file_name%.*}
if [ ! -e ${file}'.tex' ]; then
echo "${file}.tex cannot be found" 1>&2
exit 0
fi
platex ${file}'.tex'
if [ ! -e ${file}'.dvi' ]; then
echo "${file}.tex cannot be found" 1>&2
exit 0
fi
xdvipdfmx ${file}'.dvi'
if [ ! -e ${file}'.pdf' ]; then
echo "${file}.pdf cannot be found" 1>&2
exit 0
fi
open ${file}'.pdf'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment