document.preamble.extend(text)
+def insert_to_preamble(index, document, text):
+ """ Insert text to the preamble at a given line"""
+
+ document.preamble.insert(index, text)
+
# Convert a LyX length into a LaTeX length
def convert_len(len):
units = {"text%":"\\backslash\ntextwidth", "col%":"\\backslash\ncolumnwidth",
setupstart = ""
setupend = ""
# write the preamble
- add_to_preamble(document,
- ['% Commands inserted by lyx2lyx for PDF properties',
- '\\usepackage[unicode=true'
+ # babel must be loaded before hyperref and hyperref the first part
+ # of the preamble, like in LyX 1.6
+ insert_to_preamble(0, document,
+ '% Commands inserted by lyx2lyx for PDF properties\n'
+ + '\\usepackage{babel}\n'
+ + '\\usepackage[unicode=true'
+ bookmarks
+ breaklinks
+ pdfborder
+ colorlinks
+ pagemode
+ ']\n'
- ' {hyperref}\n'
+ + ' {hyperref}\n'
+ setupstart
+ title
+ author
+ subject
+ keywords
+ otheroptions
- + setupend])
+ + setupend)
def remove_inzip_options(document):