Better handling of "bullet" items
svn: r108
This commit is contained in:
parent
8ac4efdba3
commit
1215614d56
@ -41,14 +41,29 @@ class LaTeXDoc(TextDoc):
|
|||||||
self.filename = filename
|
self.filename = filename
|
||||||
|
|
||||||
self.f = open(self.filename,"w")
|
self.f = open(self.filename,"w")
|
||||||
self.f.write('\\documentclass[12pt]{article}\n')
|
options = "12pt"
|
||||||
|
|
||||||
|
if self.orientation == PAPER_LANDSCAPE:
|
||||||
|
options = options + ",landscape"
|
||||||
|
|
||||||
|
if self.paper.name == "A4":
|
||||||
|
options = options + ",a4paper"
|
||||||
|
elif self.paper.name == "A5":
|
||||||
|
options = options + ",a5paper"
|
||||||
|
elif self.paper.name == "B5":
|
||||||
|
options = options + ",b4paper"
|
||||||
|
|
||||||
|
self.f.write('\\documentclass[%s]{article}\n' % options)
|
||||||
self.f.write('\\usepackage[T1]{fontenc}\n')
|
self.f.write('\\usepackage[T1]{fontenc}\n')
|
||||||
self.f.write('\\usepackage[latin1]{inputenc}\n')
|
self.f.write('\\usepackage[latin1]{inputenc}\n')
|
||||||
self.f.write('\\begin{document}\n')
|
self.f.write('\\begin{document}\n')
|
||||||
self.f.write("\\title{}\n")
|
self.f.write("\\title{}\n")
|
||||||
self.f.write("\\author{}\n")
|
self.f.write("\\author{}\n")
|
||||||
|
self.in_list = 0
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
if self.in_list:
|
||||||
|
self.f.write('\\end{description}\n')
|
||||||
self.f.write('\\end{document}\n')
|
self.f.write('\\end{document}\n')
|
||||||
self.f.close()
|
self.f.close()
|
||||||
|
|
||||||
@ -58,22 +73,33 @@ class LaTeXDoc(TextDoc):
|
|||||||
def end_page(self):
|
def end_page(self):
|
||||||
self.f.write('\\newpage')
|
self.f.write('\\newpage')
|
||||||
|
|
||||||
def start_paragraph(self,style_name):
|
def start_paragraph(self,style_name,leader=None):
|
||||||
style = self.style_list[style_name]
|
style = self.style_list[style_name]
|
||||||
self.level = style.get_header_level()
|
self.level = style.get_header_level()
|
||||||
|
|
||||||
|
if leader == None and self.in_list:
|
||||||
|
self.f.write('\\end{description}\n')
|
||||||
|
self.in_list = 0
|
||||||
|
|
||||||
if self.level == 1 :
|
if self.level == 1 :
|
||||||
self.f.write('\\section*{')
|
self.f.write('\\section*{')
|
||||||
elif self.level == 2:
|
elif self.level == 2:
|
||||||
self.f.write('\\subsection*{')
|
self.f.write('\\subsection*{')
|
||||||
elif self.level == 3:
|
elif self.level == 3:
|
||||||
self.f.write('\\subsubsection*{')
|
self.f.write('\\subsubsection*{')
|
||||||
pass
|
if leader != None and not self.in_list:
|
||||||
|
self.f.write('\\begin{description}\n')
|
||||||
|
self.in_list = 1
|
||||||
|
if leader != None:
|
||||||
|
self.f.write('\\item{%s} ' % leader)
|
||||||
|
|
||||||
def end_paragraph(self):
|
def end_paragraph(self):
|
||||||
if self.level > 0:
|
if self.level > 0:
|
||||||
self.f.write('}\n')
|
self.f.write('}\n')
|
||||||
else:
|
elif not self.in_list:
|
||||||
self.f.write('\n\\par\\noindent\n')
|
self.f.write('\n\\par\\noindent\n')
|
||||||
|
else:
|
||||||
|
self.f.write('\n')
|
||||||
|
|
||||||
def start_bold(self):
|
def start_bold(self):
|
||||||
self.f.write('\\bfseries ')
|
self.f.write('\\bfseries ')
|
||||||
|
Loading…
Reference in New Issue
Block a user