示例#1
0
import os,sys
import random
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,parentdir)

from texifier import structure as s
from texifier import texdocument

if not os.path.exists("output"):
    os.makedirs("output")

# instantiate a new document, specifying its title and the name
# of the author
d = texdocument(author="Simone Mainardi", title="Yet Another \LaTeX{} report")

# generate some random content
randomcontent = ''.join(random.choice(' asd.,') for i in xrange(1000))

# create a section named "One section" containing the previously
# generated random content
d.append(s.section("One section", randomcontent))

# create another section
d.append(s.section("Another Section", randomcontent))

print d.get_tex()

# write the pdf file
d.generate_pdf("output/simple_report.pdf")
import os,sys
import random
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,parentdir)

from texifier import structure as s
from texifier import texdocument

if not os.path.exists("output"):
    os.makedirs("output")

# instantiate a new document, specifying its title and the name
# of the author
d = texdocument(author="Simone Mainardi", title="Yet Another \LaTeX{} not-so-simple Report")

# generate some random content
randomcontent = ''.join(random.choice(' asd.,') for i in xrange(1000))

# create an abstract
d.append(s.abstract(randomcontent))

# add the table of contents
d.append(s.tableofcontents())

# add the list of tables
d.append(s.listoftables())

# add the list of figures
d.append(s.listoffigures())