summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/disser/include/latex.fig.nmk.cmd
blob: 2c8c8fbc2828f98ad59405f71193919157742d07 (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
@echo off

rem nomake script for EPS figures
rem Author: Stanislav Kruchinin <stanislav.kruchinin@gmail.com>

if "%CMDEXTVERSION%"=="" (
	echo This script requires command interpreter from Windows 2000 or above.
	goto :eof
)

setlocal enabledelayedexpansion

if "%bmtoeps%"==""  set bmtoeps=sam2p
if "%e2e%"==""      set e2e=eps2eps
if "%epstool%"==""  set epstool=epstool
if "%epstopdf%"=="" set epstopdf=epstopdf
if "%gs%"==""       set gs=gswin32c

if "%e2eflags%"=="" set e2eflags=-dSAFER -dNOCACHE
if "%etflags%"==""  set etflags=--quiet --copy --bbox
if "%res%"==""      set res=600

if "%bmtoepsfiles%"=="" set bmtoepsfiles==*.jpg *.png *.tif
if "%e2pfiles%"==""     set e2pfiles=*.eps
if "%fbbfiles%"==""     set fbbfiles=*.eps
if "%figclfiles%"==""   set figclfiles=*.pdf *.jpg *.png *.tif
if "%optfiles%"==""     set optfiles=*.eps
if "%pdf2pngfiles%"=="" set pdf2pngfiles=*.pdf
if "%pdf2tiffiles%"=="" set pdf2tiffiles=*.pdf
if "%prefix%"==""       set prefix=~


if "%1"=="" (
	call :help
) else (
	for %%f in (%*) do call :%%f
)

exit /b

:help
	echo   bmtoeps      convert bitmap images to EPS format
	echo   clean        remove output files
	echo   epstoeps     alias for optimize target
	echo   epstopdf     convert EPS to PDF
	echo   fixbb        fix BoundingBox of EPS files
	echo   help         show description of targets
	echo   optimize     optimize EPS files ^(implies fixbb^)
	echo   pdftopng256  convert PDF to PNG ^(256-color^)
	echo   pdftotiffg4  convert PDF to TIFF ^(b/w CCITT Group 4^)
goto :eof

:bmtoeps
	for %%f in (!bmtoepsfiles!) do (
		if not exist "%%~nf.eps" (
			%bmtoeps% %bmtoepsflags% "%%f" "%%~nf.eps" > nul 2>&1
			echo bmtoeps: %%f
		)
	)
goto :eof

:clean
	del /s !figclfiles!
goto :eof

:epstoeps
	call :optimize
goto :eof

:epstopdf
	for %%f in (!e2pfiles!) do (
		call :cmptimes %%~nf.pdf %%f
		if !_ctres!==1 (
			%epstopdf% "%%f"
			echo epstopdf: %%f
		)
	)
goto :eof

:fixbb
	for %%f in (!fbbfiles!) do (
		%epstool% %etflags% "%%f" "%prefix%%%f"
		move "%prefix%%%f" "%%f" > nul
		echo fixbb: %%f
	)
goto :eof

:optimize
	for %%f in (!optfiles!) do (
		%e2e% %e2eflags% "%%f" "%prefix%%%f"
		%epstool% %etflags% "%prefix%%%f" "%prefix%1%%f"
		move "%prefix%1%%f" "%prefix%%%f" > nul
		call :cmpsizes "%%f" "%prefix%%%f"
		if !_csres!==1 (
			move "%prefix%%%f" "%%f" > nul
			echo optimize: %%f
		) else (
			del /q "%prefix%%%f"
			echo optimize: %%f does not need optimization
		)
	)
goto :eof

:pdftopng256
	for %%f in (!pdf2pngfiles!) do (
		call :cmptimes "%%~nf.png" "%%f"
		if !_ctres!==1 (
			%gs% -sDEVICE=png256 -r%res% -q -sOutputFile=%%~nf.png -dNOPAUSE ^
				-dBATCH -dSAFER "%%f"
			echo pdftopng256: %%f
		)
	)
goto :eof

:pdftotiffg4
	for %%f in (!pdf2tiffiles!) do (
		call :cmptimes "%%~nf.tif" "%%f"
		if !_ctres!==1 (
			%gs% -sDEVICE=tiffg4 -r%res% -q -sOutputFile=%%~nf.tif -dNOPAUSE ^
				-dBATCH -dSAFER "%%f"
			echo pdftotiffg4: %%f
		)
	)
goto :eof

:cmptimes
	set _ctfiles=%*
	set _ctoutf=%~1
	if not exist %_ctoutf% (
		set _ctres=1
		goto :eof
	)
	for /f "usebackq" %%f in (`dir /b /t:w /o:-d %_ctfiles%`) do (
		set _ctnewest=%%f
		goto :_ctbreak
	)
	:_ctbreak

	if "%_ctoutf%"=="%_ctnewest%" (
		set _ctres=0
	) else (
		set _ctres=1
	)
goto :eof

:cmpsizes
	if %~z1 GTR %~z2 (
		set _csres=1
	) else (
		set _csres=0
	)
goto :eof