File: src2tex2ps

package info (click to toggle)
src2tex 2.12h-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,136 kB
  • sloc: ansic: 5,679; sh: 405; makefile: 95; lisp: 46; sed: 39
file content (222 lines) | stat: -rwxr-xr-x 5,047 bytes parent folder | download | duplicates (5)
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#! /bin/sh

#{\hrulefill\ {\tt\#}
#	\vskip 1ex
#	\input ../fonts.tex % define fonts
#	\input ../title.tex % title and authors
#	\vskip 1ex
# \noindent{\tt\#}\ \hrulefill\ {\tt\#}}


#{\hrulefill\ src2tex2ps\ \hrulefill\ {\tt\#}
# \par\vskip 1ex
# \centerline{\tt src2latex2ps [-twocolumns {\it or\/} -fourcolumns {\it or\/} -sixcolumns] [-pagelength <n>] {\sl filenames}}
# \par\vskip 1ex
# It is necessary for {\sl src2tex2ps\/}
# that the following softwares are installed properly:
# \par
# {\sl\qquad nkf\ ,\ \ src2tex\ ,\ \ jtex\ ,\ \ dvi2ps\ ,\ \ psnup\ .}
# \par
# \noindent {\sl Src2tex2ps\/} is just written
# by \ K. Amano \ for his private use.
# Here Kanji converter {\sl nkf\/} would be unnecessary
# if you are not Japanese.
# If you are
# a L\kern-.35em\raise.33ex\hbox{\eightcmr A}\kern-.2em\hbox{\TeX}\ user,
# you have to replace ``{\tt tex}`` with ``{\tt latex}``.
# If {\tt jtex} and {\tt jlatex} are not installed at your site
# and if you are a Japanese install them
# else replace them with {\tt tex} and {\tt latex} respectively.
# \par
# \noindent{\tt\#}\ \hrulefill\ {\tt\#}}


#{\hrulefill\ Preliminaries\ \hrulefill\ {\tt\#}
# \par
# Though {\sl src2tex\/} accepts only one single filename,
# {\sl src2tex2ps} allows to input multiple filenames
# by virtue of the first \ `` {\tt for $\cdots$} '' \ statement.
# There are three options related to column style
# \par
# {\tt -twocolumns}\quad or\quad {\tt -fourcolumns}
# \par\noindent
# and number of lines printed in each logical page
# \par
# {\tt -pagelength}\ \ $n$
# \par\noindent
# Here we also make a carbon copy of tilde file
# \ {\sl filename}{\~\ }
# which is created by Emacs, Mule or something like that.
# \par
# \noindent{\tt\#}\ \hrulefill\ {\tt\#}}

if
	test $# = 0
then
	echo -n "Usage: src2tex2ps [-twocolumns] [-fourcolumns]"
	echo " [-pagelength <n>] filenames"
fi

src2tex_option=""
psnup_option=""
if
	test "$1" = "-twocolumns" -o "$1" = "-twocolumn" -o "$1" = "-2"
then
	psnup_option="-2"
	shift
fi
if
	test "$1" = "-fourcolumns" -o "$1" = "-fourcolumn" -o "$1" = "-4"
then
	psnup_option="-4"
	shift
fi
if
	test "$1" = "-sixcolumns" -o "$1" = "-sixcolumn" -o "$1" = "-6"
then
	psnup_option="-6"
	shift
fi
if
	test "$1" = "-eightcolumns" -o "$1" = "-eightcolumn" -o "$1" = "-8"
then
	psnup_option="-8"
	shift
fi
if
	test "$1" = "-pagelength" -o "$1" = "-p"
then
	shift
	src2tex_option="-$1"
	shift
fi
if
	test "$1" = "-twocolumns" -o "$1" = "-twocolumn" -o "$1" = "-2"
then
	psnup_option="-2"
	shift
fi
if
	test "$1" = "-fourcolumns" -o "$1" = "-fourcolumn" -o "$1" = "-4"
then
	psnup_option="-4"
	shift
fi
if
	test "$1" = "-sixcolumns" -o "$1" = "-sixcolumn" -o "$1" = "-6"
then
	psnup_option="-6"
	shift
fi
if
	test "$1" = "-eightcolumns" -o "$1" = "-eightcolumn" -o "$1" = "-8"
then
	psnup_option="-8"
	shift
fi

for i in $*
do

if
	test -f $i~
then
	mv $i~ $i.bak
fi

#{\hrulefill\ Any Kanji $\Rightarrow$ EUC Kanji\ \hrulefill\ {\tt\#}
# \par
# This conversion is necessary since {\sl src2tex} works only for EUC codes.
# If you don't use Japanese, you can skip this procedure.
# \par
# \noindent{\tt\#}\ \hrulefill\ {\tt\#}}

if
	test -f $i
then
	mv $i $i~
	nkf -e $i~ > $i
fi

#{\hrulefill\ Source File $\Rightarrow$ TeX file\ \hrulefill\ {\tt\#}
# \par
# This block is actually the main part of {\sl src2tex2ps\/}.
# Given source files are translated into {\TeX} here.
# \par
# \noindent{\tt\#}\ \hrulefill\ {\tt\#}}

if
	test -f $i
then
	echo "src2tex" $src2tex_option $i
	src2tex $src2tex_option $i
fi
if
	test -f $i~
then
	mv $i~ $i
fi

#{\hrulefill\ EUC Kanji $\Rightarrow$ JIS Kanji\ \hrulefill\ {\tt\#}
# \par
# The official Kanji is JIS Kanji at the author's site.
# So, he has applied {\tt nkf}, with {\ \tt -j\ } option,
# to {\TeX} file generated by {\sl src2tex\/}.
# And also, if there exits an input file
# it is included at the beginning of {\TeX} file.
# \par
# \noindent{\tt\#}\ \hrulefill\ {\tt\#}}

if
	test -f $i.tex
then
	if
		test -f $i.input
	then
		mv $i.tex $i.tex~
		nkf -j $i.input > $i.tex
		nkf -j $i.tex~ >> $i.tex
	else
		mv $i.tex $i.tex~
		nkf -j $i.tex~ > $i.tex
	fi
fi

#{\hrulefill\ TeX file $\Rightarrow$ DVI file\ \hrulefill\ {\tt\#}
# \par
# If {\tt jtex} is not installed, then replace it with {\tt tex}.
# Here DVI file is nothing more than intermediate product.
# \par
# \noindent{\tt\#}\ \hrulefill\ {\tt\#}}

if
	test -f $i.tex
then
	jtex $i.tex
#	jlatex $i.tex
fi

#{\hrulefill\ DVI file $\Rightarrow$ PS file\ \hrulefill\ {\tt\#}
# \par
# If {\sl dvi2ps\/} is not installed,
# then replace it with something like that,
# {\it e.g.\/}, {\sl dvips\ ,\ \ jdvi2kps\/}.
# The command \ ''{\tt psnup}`` \ is used
# to put some logical pages on each sheet of paper.
# We remove several intermediate files at the last stage.
# \par
# \noindent{\tt\#}\ \hrulefill\ {\tt\#}}

if
	test -f $i.dvi
then
	dvi2ps $i.dvi > $i.ps~
	psnup $psnup_option $i.ps~ $i.ps
#	rm $i.tex >/dev/null 2>&1
	rm $i.tex~ >/dev/null 2>&1
	rm $i.log >/dev/null 2>&1
	rm $i.dvi >/dev/null 2>&1
	rm $i.ps~ >/dev/null 2>&1
fi

done