summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cquthesis/makewin-en.bat
blob: 5feedc19dc9d3f2e7b76b11cac745b94f73e5ef7 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
@echo off


cd /d "%~dp0" 

title CQUThesis Build Helper

set flag=%1
if %flag%x == x (
  set flag=thesis
)

if %flag%x == thesisx (
  call:thesis
  goto :EOF
)
if %flag%x == thesisxx (
  call:thesisx
  goto :EOF
)
if %flag%x == docx (
  call:extract
  call:document
  goto :EOF
)
if %flag%x == cleanx (
  call:cleanaux
  goto :EOF
)
if %flag%x == cleanpdfx (
  call:cleanpdf
  goto :EOF
)
if %flag%x == cleanallx (
  call:cleanaux
  call:cleanpdf
  goto :EOF
)
if %flag%x == extractx (
  call:extract
  goto :EOF
)
if %flag%x == allx (
  call:thesis
  call:document
  goto :EOF
)
if %flag%x == buildx (
  call:extract
  call:thesis
  goto :EOF
)
if %flag%x == buildxx (
  call:extract
  call:thesis
  call:document
  goto :EOF
)

:help
  echo *************************************************************
  echo This is the Makefile script for CQUThesis on Windows.
  echo For CQUThesis: https://github.com/nanmu42/CQUThesis
  echo by Zhennan Li (C) 2016 under LPPL 1.3
  echo The idea comes from Github Liam0205/sduthesis, Many thanks!
  echo *************************************************************
  echo *
  echo USAGE:
  echo        makewin [param]
  echo param:
  echo   help      Display this help text
  echo   thesis    (default)Compile the thesis via latexmk
  echo   thesisx   Compile the thesis via XeLaTeX(only if latexmk is not installed.)
  echo   doc       Compile the documentation of CQUThesis
  echo   clean     Clean all aux files
  echo   cleanpdf  Clean all PDFs
  echo   cleanall  Clean all aux files and all PDFs
  echo   extract   Extract the Thesis Template from .dtx files.
  echo   all       thesis + doc
  echo   build     extract + thesis
  echo   buildx    extract + thesis + doc
  echo *
  echo ***********************Happy TeXing**************************
goto :EOF

:checkfiles
  IF NOT EXIST cquthesis.cls call:extract
  IF NOT EXIST cquthesis.cfg call:extract
goto :EOF

:thesis
  call:checkfiles
  latexmk -xelatex main.tex
goto :EOF

:thesisx
  call:checkfiles
  xelatex main.tex
  bibtex main.tex
  xelatex main.tex
  xelatex main.tex
  xelatex main.tex
goto :EOF

:cleanaux
  echo cleaning aux...
  for %%i in (*.aux *.bbl *.equ *.glo *.gls *.hd *.idx *.ilg *.ind *.lof *.lot *.out *.blg *.log *.thm *.toc *.synctex.gz *.lofEN *.lotEN *.equEN) do (
    del %%i
  )
  echo Done.
goto :EOF

:cleanpdf
  echo cleaning pdf...
  for %%i in (*.pdf) do (
    del %%i
  )
  echo Done.
goto :EOF

:clean_all
  call:cleanaux
  call:cleanpdf
goto :EOF

:extract
  echo extracting...
  latex cquthesis.ins
  echo *******CQUThesis has been extracted.********
goto :EOF

:document
  echo building documents...
  set cmode=-interaction=batchmode
  xelatex cquthesis.dtx
  makeindex -s gind.ist -o cquthesis.ind cquthesis.idx
  makeindex -s gglo.ist -o cquthesis.gls cquthesis.glo
  xelatex cquthesis.dtx
  xelatex cquthesis.dtx
  xelatex cquthesis.dtx
goto :EOF