Created
February 16, 2017 13:36
-
-
Save yassu/7fe6cbf71214bc0898ea87dc6911789a to your computer and use it in GitHub Desktop.
simple file for tex project by pyinvoke
This file contains hidden or 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
from invoke import task | |
AUTHOR = 'yassu' | |
MAIN_BASENAME = 'main' | |
LATEX = 'platex' | |
DVIP = 'dvipdfmx' | |
VIEW_PDF = 'evince' | |
@task | |
def compile(ctx): | |
""" コンパイルする """ | |
ctx.run('{} {}'.format(LATEX, MAIN_BASENAME + '.tex')) | |
ctx.run('{} {}'.format(DVIP, MAIN_BASENAME + '.dvi')) | |
@task | |
def comp(ctx): | |
""" コンパイルする """ | |
compile(ctx) | |
@task(compile) | |
def view(ctx): | |
""" コンパイルして pdfファイルを開く """ | |
ctx.run('{} {}'.format(VIEW_PDF, MAIN_BASENAME + '.pdf')) | |
def get_junk_filenames(): | |
yield 'x.log' | |
for filename in (MAIN_BASENAME + ext for ext in ( | |
'.aux', '.dvi', '.log', '.pdf')): | |
yield filename | |
@task | |
def clean(ctx): | |
""" コンパイル時にできたファイルを削除する """ | |
for filename in get_junk_filenames(): | |
ctx.run('rm {}'.format(filename)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment