61 lines
2.4 KiB
Batchfile
61 lines
2.4 KiB
Batchfile
|
@rem ------------------------------------------------
|
||
|
@rem LaTeX Automated Compiler
|
||
|
@rem <By Huangrui Mo>
|
||
|
@rem Copyright (C) Huangrui Mo <huangrui.mo@gmail.com>
|
||
|
@rem This is free software: you can redistribute it
|
||
|
@rem and/or modify it under the terms of the GNU General
|
||
|
@rem Public License as published by the Free Software
|
||
|
@rem Foundation, either version 3 of the License, or
|
||
|
@rem (at your option) any later version.
|
||
|
@rem ------------------------------------------------
|
||
|
@echo off
|
||
|
@rem ------------------------------------------------
|
||
|
@rem ->> Set tex compiler
|
||
|
@rem ------------------------------------------------
|
||
|
set CompilerOrder="1"
|
||
|
@rem ------------------------------------------------
|
||
|
if %CompilerOrder% == "1" (
|
||
|
set CompileName="pdflatex"
|
||
|
) else (
|
||
|
set CompileName="xelatex"
|
||
|
)
|
||
|
@rem ------------------------------------------------
|
||
|
@rem ->> Get source filename
|
||
|
@rem ------------------------------------------------
|
||
|
for %%F in (*.tex) do (
|
||
|
set FileName=%%~nF
|
||
|
)
|
||
|
@rem ------------------------------------------------
|
||
|
@rem ->> Set directory
|
||
|
@rem ------------------------------------------------
|
||
|
if not exist "./out" (
|
||
|
md out
|
||
|
)
|
||
|
@rem ------------------------------------------------
|
||
|
@rem ->> Set environmental variables
|
||
|
@rem ------------------------------------------------
|
||
|
set TEXINPUTS=.//;%TEXINPUTS%
|
||
|
set BIBINPUTS=.//;%BIBINPUTS%
|
||
|
set BSTINPUTS=.//;%BSTINPUTS%
|
||
|
@rem ------------------------------------------------
|
||
|
@rem ->> Build textual content
|
||
|
@rem ------------------------------------------------
|
||
|
%CompileName% -file-line-error -no-shell-escape -interaction=nonstopmode -synctex=1 -output-directory=out %FileName%
|
||
|
|
||
|
@rem ------------------------------------------------
|
||
|
@rem ->> Build references and links
|
||
|
@rem ------------------------------------------------
|
||
|
@bibtex ./out/%FileName%
|
||
|
@%CompileName% -file-line-error -no-shell-escape -interaction=nonstopmode -synctex=1 -output-directory=out %FileName%
|
||
|
@%CompileName% -file-line-error -no-shell-escape -interaction=nonstopmode -synctex=1 -output-directory=out %FileName%
|
||
|
|
||
|
@rem ------------------------------------------------
|
||
|
@rem ->> View compiled file
|
||
|
@rem ------------------------------------------------
|
||
|
@rem start " " /max "./Tmp/%FileName%.pdf"
|
||
|
@rem echo ------------------------------------------------
|
||
|
@rem echo %CompileName% %FileName%.tex finished...
|
||
|
@rem echo ------------------------------------------------
|
||
|
|
||
|
path = C:\Users\Jason\AppData\Local\SumatraPDF
|
||
|
SumatraPDF.exe -reuse-instance ./out/%FileName%.pdf
|