forked from dennisstritzke/ostfalia-thesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bat
60 lines (51 loc) · 1.68 KB
/
build.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@echo off
set ROOT_DIR=%~dp0
set SOURCE_DIR=%ROOT_DIR%src
set BUILD_DIR=%ROOT_DIR%build
set LATEX_RUN=pdflatex -interaction=nonstopmode -file-line-error -synctex=1 -output-directory=%BUILD_DIR% main.tex
set BIBTEX_RUN=bibtex main.aux
if exist %BUILD_DIR% dir /a-d "%BUILD_DIR%" >nul 2>nul && (
@rem If there are cached files from previous compilations, reuse those.
echo.
echo *** Recompiling ***
cd "%SOURCE_DIR%"
%LATEX_RUN% >nul
findstr /c:"LaTeX Warning" /c:"LaTeX Error" "%BUILD_DIR%\main.log" > "%BUILD_DIR%\main.log.tmp" && (
type "%BUILD_DIR%\main.log.tmp"
) || (
echo Finished without warnings or errors.
)
goto end
)
mkdir "%BUILD_DIR%"
@rem Compile for the first time and generate AUX files for BibTeX.
echo.
echo *** Compiling for the first time ***
cd "%SOURCE_DIR%"
%LATEX_RUN% >nul
findstr /c:"LaTeX Warning" /c:"LaTeX Error" "%BUILD_DIR%\main.log" > "%BUILD_DIR%\main.log.tmp" && (
type "%BUILD_DIR%\main.log.tmp"
) || (
echo Finished without warnings or errors.
)
@rem Generate bibliography from the generated AUX file.
echo.
echo *** Generating bibliography ***
cd "%BUILD_DIR%"
copy "%SOURCE_DIR%\sources.bib" . >nul 2>nul
%BIBTEX_RUN%
@rem Compile three times. First to include the generated BBL file, second to take the included bibliography into account
@rem (page numbers, ...) and a third time to get possibly changed labels and cross-references right.
echo.
echo *** Compiling for the second time ***
cd "%SOURCE_DIR%"
%LATEX_RUN% >nul
%LATEX_RUN% >nul
%LATEX_RUN% >nul
findstr /c:"LaTeX Warning" /c:"LaTeX Error" "%BUILD_DIR%\main.log" > "%BUILD_DIR%\main.log.tmp" && (
type "%BUILD_DIR%\main.log.tmp"
) || (
echo Finished without warnings or errors.
)
:end
cd %ROOT_DIR%