forked from csev/py4e
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtexpatch.py
31 lines (27 loc) · 832 Bytes
/
texpatch.py
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
# Post process the LaTeX Output
while True:
try:
line = raw_input()
except:
break
# \includegraphics{width=0.25cm,height=0.25cm@../images/pda.eps}
# \includegraphics[width=0.25cm,height=0.25cm]{../images/pda.eps}
if line.find('\\includegraphics') == 0 :
curly = line.find('{')
exclam = line.find('@')
if curly < 1 or exclam < 1 :
print line
continue
newline = line.replace('{','[').replace('@',']{')
print newline
continue
if line == '\\begin{verbatim}' :
# print '\\vspace{0.0\\parskip\\fontsize{9}{11}}'
print '{\\small'
print line
elif line == '\\end{verbatim}' :
print line
print '}'
# print '\\vspace{0.0\\parskip\\normalsize}'
else:
print line