summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cquthesis/makewin.bat
blob: 9b8b41fa10f1fe3a28db2a21036cdb8dd66018f9 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@echo off


rem 避免在管理员身份下的路径问题
cd /d "%~dp0" 

title CQUThesis自动化编译程序

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 CQUThesis自动化编译程序(Windows)
  echo 重庆大学毕业设计LaTeX模板: https://github.com/nanmu42/CQUThesis
  echo (C) 2016-2017 李振楠 依据LPPL 1.3协议开源
  echo 本程序的灵感来源:Github:Liam0205/sduthesis,在此致谢。
  echo *************************************************************
  echo *
  echo 命令用法:
  echo        makewin [参数]
  echo 参数:
  echo   help      展示本帮助信息
  echo   thesis    通过latexmk智能,快速地编译论文(双击或无参数时默认运行)
  echo   thesisx   进行一次完整的论文编译(如果你的系统上没安装latexmk就用这一项,否则推荐用上面的)
  echo   doc       编译CQUThesis用户文档
  echo   clean     清理所有.aux文件
  echo   cleanpdf  清理所有.pdf文件
  echo   cleanall  清理所有.aux文件以及.pdf文件
  echo   extract   从.dtx文件中提取模板
  echo   all       thesis + doc
  echo   build     extract + thesis
  echo   buildx    extract + thesis + doc
  echo *
  echo ***********************Happy TeXing**************************
  echo ************************写作愉快!***************************
goto :EOF

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

:thesis
  call:checkfiles
  echo 请确认您的系统已正确配置latexmk...
  echo 使用latexmk智能编译论文中...
  latexmk -xelatex main.tex
  echo *                                       *
  echo *********太棒了!论文编译完成!**********
  echo *                                       *
  goto pauseIfDoubleClicked

:thesisx
  call:checkfiles
  echo 论文编译中......
  xelatex main.tex
  bibtex main.tex
  xelatex main.tex
  xelatex main.tex
  xelatex main.tex
  echo *                                                    *
  echo ***************太棒了!论文编译完成!*****************
  echo 提示:本方案速度较慢,推荐使用makewin thesis进行编译。
  echo *                                                    *
goto :EOF

:cleanaux
  echo 清理所有.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 .aux文件清理完成。
goto :EOF

:cleanpdf
  echo 清理所有.pdf文件中...
  for %%i in (*.pdf) do (
    del %%i
  )
  echo .pdf文件清理完成。
goto :EOF

:clean_all
  call:cleanaux
  call:cleanpdf
goto :EOF

:extract
  echo 正在提取CQUThesis模板文件...
  latex cquthesis.ins
  echo *                             *
  echo *******模板文件提取完成********
  echo *                             *
goto :EOF

:document
  echo 编译CQUThesis用户文档中...
  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
  echo *                             *
  echo *******用户文档编译完成********
  echo *                             *
goto :EOF

:pauseIfDoubleClicked
  setlocal enabledelayedexpansion
  set testl=%cmdcmdline:"=%
  set testr=!testl:%~nx0=!
  if not "%testl%" == "%testr%" pause                           *
goto :EOF