-
-
Save hoto17296/7356466 to your computer and use it in GitHub Desktop.
texコンパイルしてpdf作って開く一連の動作をまとめた
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
error(){ echo "Error: $1" 1>&2 && exit 1; } | |
if [ $# -eq 0 ]; then error 'Too few arguments.'; fi | |
if [ $# -gt 2 ]; then error 'Too many arguments.'; fi | |
clean() | |
{ | |
echo 'Clean:' | |
if [ $# -eq 0 ] | |
then rm -fv ./*.log ./*.aux ./*.dvi ./*.toc | |
else rm -fv ./$1.log ./$1.aux ./$1.dvi ./$1.toc | |
fi | |
} | |
if [ $1 = clean ]; then clean && exit; fi | |
if [ ! -r $1.tex ]; then error "Can't find $1.tex"; fi | |
if [ $# -eq 2 ]; then | |
i=$2 | |
while [ $i -gt 1 ]; do | |
platex $1.tex || exit 1 | |
i=$((i-1)) | |
done | |
fi | |
platex $1.tex && \ | |
dvipdfmx $1.dvi && \ | |
open $1.pdf && \ | |
clean $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
texc
Usage
Compile
hoge.tex
and create pdfCompile 3 times
Remove *.log *.aux *.dvi *.toc files