forked from nfeske/gosh
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathslides.gosh
128 lines (110 loc) · 3.76 KB
/
slides.gosh
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
### WRITE HEADER OF TEX FILE ###
proc produce_head_latex {} {
global title authors config_slides_lang
puts {\documentclass[17pt,a4paper,landscape,headrule]{foils}}
puts {\usepackage[latin1]{inputenc}}
puts {\usepackage{graphicx}}
puts {\usepackage{epsfig}}
if {$title != ""} {
puts "\\title{[out_latex $title]}"
if {$authors != ""} {
puts "\\author{[out_latex $authors]}"
}
}
# puts {\MyLogo{\epsfig{file=img/logo,width=0.1\columnwidth}}}
if {$config_slides_lang == "german"} {
puts {\usepackage[nerman]{babel}} }
puts {\MyLogo{}}
puts {\rightfooter{}}
puts "\\leftheader{$title}"
puts {\rightheader{\quad\textsf{\tiny[\thepage]}}}
puts {\begin{document}}
puts {\maketitle}
}
### ABSTRACT ###
proc process_abstract_latex {txtblock} {
set title [lindex $txtblock 0]
puts "\n[indent]% -+*|\[ [string toupper $title] \]|*+-\n"
puts "[indent]\\center{"
handle_txtblock abstract [lrange $txtblock 2 end]
puts "[indent]}"
}
### CHAPTER ###
proc process_chapter_latex {txtblock} {
global curr_chapter
set title [linetxt [lindex $txtblock 0]]
set curr_chapter $title
puts "\n[indent]% -+*|\[ [string toupper $title] \]|*+-\n"
puts "[indent]\\foilhead{[out_latex $title]}"
puts "[indent]\\vspace{-2cm}"
handle_txtblock chapter [lrange $txtblock 2 end]
}
### SECTION ###
proc process_section_latex {txtblock} {
global curr_chapter curr_section
set title [linetxt [lindex $txtblock 0]]
set curr_section $title
puts "\n[indent]% -+*|\[ [string toupper $title] \]|*+-\n"
puts "[indent]\\foilhead{[out_latex $curr_chapter]\\\\\\textit{\\normalsize{[out_latex $title]}}}"
puts "[indent]\\vspace{-1.5cm}"
handle_txtblock section [lrange $txtblock 2 end]
}
### SUBSECTION ###
proc process_subsection_latex {txtblock} {
global curr_chapter curr_section
set title [linetxt [lindex $txtblock 0]]
puts "\n[indent]% -+*|\[ [string toupper $title] \]|*+-\n"
puts "[indent]\\foilhead{[out_latex $curr_chapter]\\\\\\normalsize{[out_latex $curr_section]}\\\\\\textit{\\small{[out_latex $title]}}}"
puts "[indent]\\vspace{-1.5cm}"
handle_txtblock subsection [lrange $txtblock 2 end]
}
### PARAGRAPH ###
proc process_paragraph_latex {txtblock} {
global curr_chapter curr_section depth
set title [linetxt [lindex $txtblock 0]]
puts "[indent]\\textbf{$title}"
handle_txtblock paragraph [lrange $txtblock 2 end]
}
### ITEMIZE ###
proc process_itemize_latex {txtblock} {
puts "[indent]\\begin{itemize}\\setlength{\\itemsep}{0pt}"
handle_txtblock itemize $txtblock
puts "[indent]\\end{itemize}"
}
### ENUMERATION ###
proc process_enumeration_latex {txtblock} {
puts "[indent]\\begin{enumerate}\\setlength{\\itemsep}{0pt}"
handle_txtblock enumeration $txtblock
puts "[indent]\\end{enumerate}"
}
### IMAGE ###
proc process_image_latex {txtblock} {
set img_info ""
set img_size 80
set img_angle "0"
regexp {\[(image \w+.*)\]} [lindex $txtblock 0] dummy img_info
if {$img_info == ""} return
set img_name [lindex $img_info 1]
regexp { (\d+)%} $img_info dummy img_size
regexp { (\d+)°} $img_info dummy img_angle
set img_cap ""
foreach img_capline $txtblock {
set img_capline [linetxt $img_capline]
regsub {^\[.*\]} $img_capline "" img_capline
regsub {^ *} $img_capline "" img_capline
append img_cap $img_capline " "
}
regsub { *$} $img_cap "" img_cap
puts "[indent]\n[indent]\\begin{figure}\[h\]\n[indent] \\begin{center}"
puts "[indent] \\epsfig{file=$img_name,angle=$img_angle,width=[expr $img_size.0/100]\\columnwidth}"
# puts "[indent] \\caption{[out_latex $img_cap]}"
# puts "[indent] \\label{[label_latex $img_name]}"
puts "[indent] \\end{center}\n[indent]\\end{figure}\n"
}
#
# Process command-line arguments specific for the slides backend
#
set config_slides_lang english
if {[regexp {\--slides-lang-german} $argv dummy]} {
set config_slides_lang german
}