summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/disser/templates/candidate/nomake.cmd
blob: 8ed500ecaa62b1cb1889c646c33e6e7b3c1d07f4 (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
166
@echo off

set target=thesis

rem Checking for version of cmd.exe
if %CMDEXTVERSION%/==/ (
	echo Error: This script requieres command interpreter from Windows 2000 or above.
	goto :eof
)

rem Trying to autodetect MiKTeX installation directory
if %texmf%/==/ call :getdir HKCU\Software\MiK\MiKTeX\CurrentVersion\MiKTeX "Install Root" texmf
if %texmf%/==/ call :getdir HKLM\Software\MiK\MiKTeX\CurrentVersion\MiKTeX "Install Root" texmf

if %texmf%/==/ (
	echo Error: Unable to find MiKTeX installation directory
	echo You must set texmf value manually
	goto :eof
)

rem Name of thesis class
set clsname=disser
set clssrc=%texmf%\tex\latex\%clsname%
set clsdir=.\%clsname%

rem Name of BibTeX style
set bstsrc=%texmf%\bibtex\bst\%clsname%
set bstfile=%clsname%.bst

rem Cmdline tools
set arc=rar
set arcflags=a -r -x%target%.pdf -x%target%.prj

set tex=%texmf%\miktex\bin\latex
set texflags=-src-specials

set bibtex=%texmf%\miktex\bin\bibtex8
set bibtexflags=-B -c cp1251

set epstool=%programfiles%\bin\eps\epstool
set epstopdf=%texmf%\miktex\bin\epstopdf

set pdftodjvu=pdftodjvu
set pdftodjvuflags=--dpi=600 --threshold-level=80 --fg-quality=conservative --bg-subsample=3 --quality=65 --convert-links --fg-colors=256 --fg-image-colors=256

set djvuocr=djvubundle
set djvuocrflags=--ocr=lang=(Russian,English)

set mktexlsr=%texmf%\miktex\bin\mktexlsr.exe

set srcfiles=*.*
set clfiles=*.bbl *.bak *.aux *.blg *.out *.toc *.log *.dvi *.tmp *.pdf %target%.%arc%
set suffix=$$

if %1/==/ (
:make
	%tex% %target%.tex
	%bibtex% %bibtexflags% %target%
	%tex% %target%.tex
	%tex% %texflags% %target%.tex
goto :eof
)
:start
if %1/==/ goto :eof

if %1/==pdf/ (
:pdf
	set tex=pdflatex
	call :make
)

if %1/==srcdist/ (
:srcdist
	echo Making source distribution...
	if not exist %clsdir% mkdir %clsdir%
	xcopy %clssrc% %clsdir% /S
	xcopy %bstsrc%\%bstfile% . /S
	call :clean
	%arc% %arcflags% %target%.%arc% %srcfiles%
	del /s /q %clsdir%
	rmdir /s /q %clsdir%
	del /q %bstfile%
goto :end
)

if %1/==clean/ (
:clean
	del /s %clfiles% 2> nul
	if exist %target%.rar del %target%.rar
goto :end
)

if %1/==cleansvn/ (
:cleansvn
	del /s .svn 2>nul
goto :end
)

if %1/==fixbb/ (
:fixbb
	echo Fixing bounding boxes of EPS files...
	for /f "usebackq" %%n in (`dir *.eps /s /b`) do call :fix %%n
goto :end
:fix
	echo %1
	%epstool% --copy --quiet --bbox %1 %1.%suffix%
	move %1.%suffix% %1
goto :eof	
)

if %1/==epstopdf/ (
:epstopdf
	echo Converting EPS to PDF...
	for /f "usebackq" %%n in (`dir *.eps /s /b`) do call :conv %%n
	goto :end
:conv
	echo %1
	%epstopdf% "%1"
goto :eof	
)
rem Installs requiered packages
if %1/==install/ (
:install
	if not exist %clssrc% md %clssrc%
	xcopy %clsdir%\ %clssrc%\ /Y
	rmdir %clsdir%
	if not exist %bstsrc% md %bstsrc%
	move %bstfile% %bstsrc%
	%mktexlsr%
goto :end
)
rem Start default DVI-viewer
if %1/==preview/ (
:preview
	if not exist %target%.dvi call :make
	start %target%.dvi
goto :end
)
rem Convert PDF to DjVu using LizardTech DocumentExpress Enterprise
if %1/==djvu/ (
:djvu
	if not exist %target%.pdf call :pdf
	%pdftodjvu% %pdftodjvuflags% %target%.pdf
goto :end
)
rem Create OCRed DjVu file
if %1/==ocr/ (
:ocr
	if not exist %target%.djvu call :djvu
	%djvuocr% %djvuocrflags% %target%.djvu %target%-ocr.djvu
goto :end	
)
rem Create backup
if %1/==backup/ (
:backup
	call :srcdist
	for /f "usebackq" %%n in (`date`) do move %target%.rar %%n.rar
goto :end
)

:end
shift & goto :start

:getdir
	for /f "usebackq tokens=4 skip=2" %%i in (`reg query %1 /v %2`) do set %3=%%i
goto :eof