Ejemplo n.º 1
0
    def __init__(self,
                 document,
                 docstring_linker=None,
                 directory=None,
                 docindex=None,
                 context=None):
        # Set the document's settings.
        if self.settings is None:
            settings = OptionParser([LaTeXWriter()]).get_default_values()
            settings.output_encoding = 'utf-8'

            # This forces eg \EpydocUserSection rather than
            # \EpydocUserSEction*:
            settings.use_latex_toc = True

            self.__class__.settings = settings
        document.settings = self.settings

        LaTeXTranslator.__init__(self, document)
        self._linker = docstring_linker
        self._directory = directory
        self._docindex = docindex
        self._context = context

        # Use custom section names.
        self.d_class = _EpydocDocumentClass()
Ejemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        LaTeXTranslator.__init__(self, *args, **kwargs)

        # Handle author declarations

        self.current_field = ''

        self.author_names = []
        self.author_institutions = []
        self.author_institution_map = dict()
        self.author_emails = []
        self.paper_title = ''
        self.abstract_text = []
        self.keywords = ''
        self.table_caption = []
        self.video_url = ''

        self.abstract_in_progress = False
        self.non_breaking_paragraph = False

        self.figure_type = 'figure'
        self.figure_alignment = 'left'
        self.table_type = 'table'

        self.active_table.set_table_style('booktabs')
Ejemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        LaTeXTranslator.__init__(self, *args, **kwargs)

        # Handle author declarations

        self.current_field = ''

        self.copyright_holder = None
        self.author_names = []
        self.author_institutions = []
        self.author_institution_map = dict()
        self.author_emails = []
        self.corresponding = []
        self.equal_contributors = []
        self.paper_title = ''
        self.abstract_text = []
        self.keywords = ''
        self.table_caption = []
        self.video_url = ''
        self.bibliography = ''

        # This gets read by the underlying docutils implementation.
        # If present, it is a list with the first entry the style name
        # and the second entry the BiBTeX file (see `visit_field_body`)
        self.bibtex = None

        self.abstract_in_progress = False
        self.non_breaking_paragraph = False

        self.figure_type = 'figure'
        self.figure_alignment = 'left'
        self.table_type = 'table'

        self.active_table.set_table_style('booktabs')
Ejemplo n.º 4
0
    def __init__(self, document):
        LaTeXTranslator.__init__(self, document)
        self.head_prefix = [
            x for x in self.head_prefix if ('{typearea}' not in x)
        ]
        hyperref_posn = [
            i for i in range(len(self.head_prefix))
            if ('{hyperref}' in self.head_prefix[i])
        ]
        if not hyperref_posn:
            self.head_prefix.append(None)
            hyperref_posn = [-1]  # XXX hack
        self.head_prefix[hyperref_posn[0]] = (
            '\\usepackage{hyperref}\n' + '\\usepackage{fancyvrb}\n' +
            LatexFormatter(style="manni").get_style_defs() + "\n")

        self.head_prefix.extend([
            '\\definecolor{rrblitbackground}{rgb}{0.55, 0.3, 0.1}\n',
            '\\newenvironment{rtbliteral}{\n',
            '\\begin{ttfamily}\n',
            '\\color{rrblitbackground}\n',
            '}{\n',
            '\\end{ttfamily}\n',
            '}\n',
        ])
        # this fixes the hardcoded section titles in docutils 0.4
        self.d_class = DocumentClass('article')
Ejemplo n.º 5
0
        def __init__ (self, document):
                LaTeXTranslator.__init__ (self, document)
                self.head_prefix = [x for x in self.head_prefix if ('{typearea}' not in x)]
                hyperref_posn = [i for i in range (len (self.head_prefix)) if ('{hyperref}' in self.head_prefix[i])]
                self.head_prefix = [curline+'\n' for curline in self.head_prefix]

                try:
                    self.head_prefix[hyperref_posn[0]] = '\\usepackage{hyperref}\n'
                except:
                    self.head_prefix[2] = '\\usepackage{hyperref}\n'
                
##                 self.head_prefix.extend ([
##                         '\\definecolor{rrblitbackground}{rgb}{0.55, 0.3, 0.1}\n',
##                         '\\newenvironment{rtbliteral}{\n',
##                         '\\begin{ttfamily}\n',
##                         '\\color{rrblitbackground}\n',
##                         '}{\n',
##                         '\\end{ttfamily}\n',
##                         '}\n',
##                 ])
                theme = document.settings.theme
                if theme:
                    self.head_prefix.append('\\usetheme{%s}\n' % theme)

                self.overlay_bullets = string_to_bool(document.settings.overlaybullets, False)#using a False default because
                #True is the actual default.  If you are trying to pass in a value
                #and I can't determine what you really meant, I am assuming you
                #want something other than the actual default.
                self.centerfigs = string_to_bool(document.settings.centerfigs, False)#same reasoning as above

                self.frame_level = 0

                # this fixes the hardcoded section titles in docutils 0.4
                self.d_class = DocumentClass ('article')
Ejemplo n.º 6
0
    def __init__(self, *args, **kwargs):
        LaTeXTranslator.__init__(self, *args, **kwargs)

        # Handle author declarations

        self.current_field = ''

        self.copyright_holder = None
        self.author_names = []
        self.author_institutions = []
        self.author_institution_map = dict()
        self.author_emails = []
        self.corresponding = []
        self.equal_contributors = []
        self.paper_title = ''
        self.abstract_text = []
        self.keywords = ''
        self.table_caption = []
        self.video_url = ''
        self.bibliography = ''

        # This gets read by the underlying docutils implementation.
        # If present, it is a list with the first entry the style name
        # and the second entry the BiBTeX file (see `visit_field_body`)
        self.bibtex = None

        self.abstract_in_progress = False
        self.non_breaking_paragraph = False

        self.figure_type = 'figure'
        self.figure_alignment = 'left'
        self.table_type = 'table'

        self.active_table.set_table_style('booktabs')
Ejemplo n.º 7
0
    def __init__(self, document):
        LaTeXTranslator.__init__(self, document)
        self.label_prefix = ""
        self.docinfo = {}
        self.head_prefix = []
        self.head = []
        self.body_prefix = []
        self.in_title = False
        self.in_anydesc = False  # _title is different if it is a funcdesc
        self.admonition_stack = []

        # Disable a bunch of methods from the base class.
        empty_method = lambda self: None
        for nodetype in ('field_argument',
                         'field_body',
                         'field_list',
                         'field_name'):
            setattr(self, 'visit_' + nodetype, empty_method)
            setattr(self, 'depart_' + nodetype, empty_method)
        self.head_prefix = []
        # definitions must be guarded if multiple modules are included
        self.definitions = [
                "\\ifx\\locallinewidth\\undefined\\newlength{\\locallinewidth}\\fi\n"
                "\\setlength{\\locallinewidth}{\\linewidth}\n"
            ]
Ejemplo n.º 8
0
    def __init__(self, document, docstring_linker):
        # Set the document's settings.
        settings = OptionParser([LaTeXWriter()]).get_default_values()
        document.settings = settings

        LaTeXTranslator.__init__(self, document)
        self._linker = docstring_linker

        # Start at section level 3.  (Unfortunately, we now have to
        # set a private variable to make this work; perhaps the standard
        # latex translator should grow an official way to spell this?)
        self.section_level = 3
        self._section_number = [0]*self.section_level
Ejemplo n.º 9
0
    def __init__(self, document, docstring_linker):
        # Set the document's settings.
        settings = OptionParser([LaTeXWriter()]).get_default_values()
        document.settings = settings

        LaTeXTranslator.__init__(self, document)
        self._linker = docstring_linker

        # Start at section level 3.  (Unfortunately, we now have to
        # set a private variable to make this work; perhaps the standard
        # latex translator should grow an official way to spell this?)
        self.section_level = 3
        self._section_number = [0] * self.section_level
 def __init__ (self, document):
         LaTeXTranslator.__init__ (self, document)
         self.head_prefix = [x for x in self.head_prefix if ('{typearea}' not in x)]
         hyperref_posn = [i for i in range (len (self.head_prefix)) if ('{hyperref}' in self.head_prefix[i])]
         self.head_prefix[hyperref_posn[0]] = '\\usepackage{hyperref}\n'
         self.head_prefix.extend ([
                 '\\definecolor{rrblitbackground}{rgb}{0.55, 0.3, 0.1}\n',
                 '\\newenvironment{rtbliteral}{\n',
                 '\\begin{ttfamily}\n',
                 '\\color{rrblitbackground}\n',
                 '}{\n',
                 '\\end{ttfamily}\n',
                 '}\n',
         ])
         # this fixes the hardcoded section titles in docutils 0.4
         self.d_class = DocumentClass ('article')
Ejemplo n.º 11
0
    def __init__(self, *args, **kwargs):
        LaTeXTranslator.__init__(self, *args, **kwargs)

        # Handle author declarations

        self.current_field = ''

        self.author_names = []
        self.author_institutions = []
        self.author_emails = []
        self.paper_title = ''
        self.abstract_text = []
        self.table_caption = []

        self.abstract_in_progress = False
        self.non_breaking_paragraph = False
Ejemplo n.º 12
0
    def __init__(self, *args, **kwargs):
        LaTeXTranslator.__init__(self, *args, **kwargs)

        # Handle author declarations

        self.current_field = ''

        self.author_names = []
        self.author_institutions = []
        self.author_emails = []
        self.paper_title = ''
        self.abstract_text = []
        self.keywords = ''
        self.table_caption = []

        self.abstract_in_progress = False
        self.non_breaking_paragraph = False
Ejemplo n.º 13
0
 def __init__(self, document):
     LaTeXTranslator.__init__(self, document)
     self.head_prefix = [
         x for x in self.head_prefix if ('{typearea}' not in x)
     ]
     hyperref_posn = [
         i for i in range(len(self.head_prefix))
         if ('{hyperref}' in self.head_prefix[i])
     ]
     self.head_prefix[hyperref_posn[0]] = '\\usepackage{hyperref}\n'
     self.head_prefix.extend([
         '\\definecolor{rrblitbackground}{rgb}{0.55, 0.3, 0.1}\n',
         '\\newenvironment{rtbliteral}{\n',
         '\\begin{ttfamily}\n',
         '\\color{rrblitbackground}\n',
         '}{\n',
         '\\end{ttfamily}\n',
         '}\n',
     ])
     # this fixes the hardcoded section titles in docutils 0.4
     self.d_class = DocumentClass('article')
Ejemplo n.º 14
0
    def __init__(self, document, docstring_linker=None, directory=None,
                 docindex=None, context=None):
        # Set the document's settings.
        if self.settings is None:
            settings = OptionParser([LaTeXWriter()]).get_default_values()
            settings.output_encoding = 'utf-8'
            
            # This forces eg \EpydocUserSection rather than
            # \EpydocUserSEction*:
            settings.use_latex_toc = True
            
            self.__class__.settings = settings
        document.settings = self.settings

        LaTeXTranslator.__init__(self, document)
        self._linker = docstring_linker
        self._directory = directory
        self._docindex = docindex
        self._context = context

        # Use custom section names.
        self.d_class = _EpydocDocumentClass()
Ejemplo n.º 15
0
    def __init__(self, *args, **kwargs):
        LaTeXTranslator.__init__(self, *args, **kwargs)

        # Handle author declarations

        self.current_field = ''

        self.author_names = []
        self.author_institutions = []
        self.author_emails = []
        self.paper_title = ''
        self.abstract_text = []
        self.keywords = ''
        self.table_caption = []

        self.abstract_in_progress = False
        self.non_breaking_paragraph = False

        self.figure_type = 'figure'
        self.figure_alignment = 'left'
        self.table_type = 'table'

        self.d_class.sections.insert(0, 'title')
Ejemplo n.º 16
0
    def __init__(self, *args, **kwargs):
        LaTeXTranslator.__init__(self, *args, **kwargs)

        # Handle author declarations

        self.current_field = ''

        self.author_names = []
        self.author_institutions = []
        self.author_emails = []
        self.paper_title = ''
        self.abstract_text = []
        self.keywords = ''
        self.table_caption = []

        self.abstract_in_progress = False
        self.non_breaking_paragraph = False

        self.figure_type = 'figure'
        self.figure_alignment = 'left'
        self.table_type = 'table'

        self.d_class.sections.insert(0, 'title')
        def __init__ (self, document):
                LaTeXTranslator.__init__ (self, document)
                self.head_prefix = [x for x in self.head_prefix if ('{typearea}' not in x)]
                hyperref_posn = [i for i in range (len (self.head_prefix)) if ('{hyperref}' in self.head_prefix[i])]
                if not hyperref_posn:
                        self.head_prefix.append(None)
                        hyperref_posn = [-1] # XXX hack
                self.head_prefix[hyperref_posn[0]] = ('\\usepackage{hyperref}\n' +
                                                      '\\usepackage{fancyvrb}\n' +
                                                      LatexFormatter(style="manni").get_style_defs() +
                                                      "\n")

                self.head_prefix.extend ([
                        '\\definecolor{rrblitbackground}{rgb}{0.55, 0.3, 0.1}\n',
                        '\\newenvironment{rtbliteral}{\n',
                        '\\begin{ttfamily}\n',
                        '\\color{rrblitbackground}\n',
                        '}{\n',
                        '\\end{ttfamily}\n',
                        '}\n',
                ])
                # this fixes the hardcoded section titles in docutils 0.4
                self.d_class = DocumentClass ('article')
Ejemplo n.º 18
0
    def __init__(self, document):
        LaTeXTranslator.__init__(self, document)
        self.label_prefix = ""
        self.docinfo = {}
        self.head_prefix = []
        self.head = []
        self.body_prefix = []
        self.in_title = False
        self.in_anydesc = False  # _title is different if it is a funcdesc
        self.admonition_stack = []

        # Disable a bunch of methods from the base class.
        empty_method = lambda self: None
        for nodetype in ('field_argument', 'field_body', 'field_list',
                         'field_name'):
            setattr(self, 'visit_' + nodetype, empty_method)
            setattr(self, 'depart_' + nodetype, empty_method)
        self.head_prefix = []
        # definitions must be guarded if multiple modules are included
        self.definitions = [
            "\\ifx\\locallinewidth\\undefined\\newlength{\\locallinewidth}\\fi\n"
            "\\setlength{\\locallinewidth}{\\linewidth}\n"
        ]
Ejemplo n.º 19
0
    def __init__(self, document):
        LaTeXTranslator.__init__(self, document)

        # Used for Beamer title and possibly header/footer. Set from docinfo
        # record the settings for codeblocks.
        self.organization = None
        self.cb_use_pygments = document.settings.cb_use_pygments
        self.cb_replace_tabs = document.settings.cb_replace_tabs
        self.cb_default_lang = document.settings.cb_default_lang

        self.head_prefix = [x for x in self.head_prefix
                            if '{typearea}' not in x]

        self.head_prefix.extend([
            '\\definecolor{rrblitbackground}{rgb}{0.55, 0.3, 0.1}\n',
            '\\newenvironment{rtbliteral}{\n',
            '\\begin{ttfamily}\n',
            '\\color{rrblitbackground}\n',
            '}{\n',
            '\\end{ttfamily}\n',
            '}\n',
        ])

        if self.cb_use_pygments:
            self.head_prefix.extend([
                '\\usepackage{fancyvrb}\n',
                '\\usepackage{color}\n',
            ])

        # set appropriate header options for theming
        theme = document.settings.theme
        if theme:
            self.head_prefix.append('\\usetheme{%s}\n' % theme)

        set_header_options(self.head_prefix, document.settings.shownotes)

        if self.cb_use_pygments:
            from pygments.formatters import LatexFormatter
            self.head_prefix.extend([
                LatexFormatter().get_style_defs(),
            ])

        self.overlay_bullets = string_to_bool(
            document.settings.overlaybullets, False)
        self.fragile_default = string_to_bool(
            document.settings.fragile_default,
            True)
        self.shortauthor = document.settings.shortauthor
        self.shorttitle = document.settings.shorttitle
        # using a False default because
        # True is the actual default. If you are trying to pass in a value
        # and I can't determine what you really meant, I am assuming you
        # want something other than the actual default.
        self.centerfigs = string_to_bool(
            document.settings.centerfigs,
            False)  # same reasoning as above
        self.in_columnset = False
        self.in_column = False
        self.in_note = False
        self.frame_level = 0

        # this fixes the hardcoded section titles in docutils 0.4
        self.d_class = DocumentClass('article')

        self.admonition_alert_type = None
Ejemplo n.º 20
0
 def __init__(self, document):
     LaTeXTranslator.__init__(self, document)
     self._verse_in = []     # add vin indentation.
     self._in_stanza = 0
Ejemplo n.º 21
0
    def __init__ (self, document):
        LaTeXTranslator.__init__ (self, document)

        self.organization = None#used for Beamer title and possibly
                                #header/footer.  Set from docinfo 
        # record the the settings for codeblocks
        self.cb_use_pygments = document.settings.cb_use_pygments
        self.cb_replace_tabs = document.settings.cb_replace_tabs
        self.cb_default_lang = document.settings.cb_default_lang

        self.head_prefix = [x for x in self.head_prefix
            if ('{typearea}' not in x)]
        #hyperref_posn = [i for i in range (len (self.head_prefix))
        #    if ('{hyperref}' in self.head_prefix[i])]
        hyperref_posn = index (self.head_prefix,
            lambda x: '{hyperref}\n' in x)
        ## if (hyperref_posn is None):
        ##     self.head_prefix.extend ([
        ##         '\\usepackage{hyperref}\n'
        ##     ])

        #self.head_prefix[hyperref_posn[0]] = '\\usepackage{hyperref}\n'
        self.head_prefix.extend ([
            '\\definecolor{rrblitbackground}{rgb}{0.55, 0.3, 0.1}\n',
            '\\newenvironment{rtbliteral}{\n',
            '\\begin{ttfamily}\n',
            '\\color{rrblitbackground}\n',
            '}{\n',
            '\\end{ttfamily}\n',
            '}\n',
        ])

        if (self.cb_use_pygments):
            #from pygments.formatters import LatexFormatter
            #fmtr = LatexFormatter()
            self.head_prefix.extend ([
                '\\usepackage{fancyvrb}\n',
                '\\usepackage{color}\n',
                #LatexFormatter().get_style_defs(),
            ])

        # set appropriate header options for theming
        theme = document.settings.theme
        if theme:
            self.head_prefix.append ('\\usetheme{%s}\n' % theme)

        # set appropriate header options for note display
        shownotes = document.settings.shownotes
        if shownotes == SHOWNOTES_TRUE:
            shownotes = SHOWNOTES_RIGHT
        use_pgfpages = True
        if (shownotes == SHOWNOTES_FALSE):
            option_str = 'hide notes'
            use_pgfpages = False
        elif (shownotes == SHOWNOTES_ONLY):
            option_str = 'show only notes'
        else:
            if (shownotes == SHOWNOTES_LEFT):
                notes_posn = 'left'
            elif (shownotes in SHOWNOTES_RIGHT):
                notes_posn = 'right'
            elif (shownotes == SHOWNOTES_TOP):
                notes_posn = 'top'
            elif (shownotes == SHOWNOTES_BOTTOM):
                notes_posn = 'bottom'
            else:
                # TODO: better error handling
                assert False, "unrecognised option for shownotes '%s'" % shownotes
            option_str = 'show notes on second screen=%s' % notes_posn
        if use_pgfpages:
            self.head_prefix.append ('\\usepackage{pgfpages}\n')
        self.head_prefix.append ('\\setbeameroption{%s}\n' % option_str)

        if (self.cb_use_pygments):
            from pygments.formatters import LatexFormatter
            fmtr = LatexFormatter()
            self.head_prefix.extend ([
                LatexFormatter().get_style_defs(),
            ])

        self.overlay_bullets = string_to_bool (document.settings.overlaybullets, False)
        self.fragile_default = string_to_bool (document.settings.fragile_default, True)
        self.shortauthor = document.settings.shortauthor
        self.shorttitle = document.settings.shorttitle
        #using a False default because
        #True is the actual default.  If you are trying to pass in a value
        #and I can't determine what you really meant, I am assuming you
        #want something other than the actual default.
        self.centerfigs = string_to_bool(document.settings.centerfigs, False)#same reasoning as above
        self.in_columnset = False
        self.in_column = False
        self.in_note = False
        self.frame_level = 0

        # this fixes the hardcoded section titles in docutils 0.4
        self.d_class = DocumentClass ('article')
Ejemplo n.º 22
0
 def __init__(self, document, **kwargs):
     LaTeXTranslator.__init__(self, document, **kwargs)
     settings = self.settings
Ejemplo n.º 23
0
 def __init__(self, document):
     LaTeXTranslator.__init__(self, document)
     self._verse_in = []  # add vin indentation.
     self._in_stanza = 0
Ejemplo n.º 24
0
 def __init__(self, *args, **kwargs):
     LaTeXTranslator.__init__(self, *args, **kwargs)
Ejemplo n.º 25
0
 def __init__(self, *args, **kwargs):
     LaTeXTranslator.__init__(self, *args, **kwargs)
Ejemplo n.º 26
0
    def __init__(self, document):
        LaTeXTranslator.__init__(self, document)

        # Used for Beamer title and possibly header/footer. Set from docinfo
        # record the settings for codeblocks.
        self.organization = None
        self.cb_use_pygments = document.settings.cb_use_pygments
        self.cb_replace_tabs = document.settings.cb_replace_tabs
        self.cb_default_lang = document.settings.cb_default_lang

        self.head_prefix = [
            x for x in self.head_prefix if '{typearea}' not in x
        ]

        self.head_prefix.extend([
            '\\definecolor{rrblitbackground}{rgb}{0.55, 0.3, 0.1}\n',
            '\\newenvironment{rtbliteral}{\n',
            '\\begin{ttfamily}\n',
            '\\color{rrblitbackground}\n',
            '}{\n',
            '\\end{ttfamily}\n',
            '}\n',
        ])

        if self.cb_use_pygments:
            self.head_prefix.extend([
                '\\usepackage{fancyvrb}\n',
                '\\usepackage{color}\n',
            ])

        # set appropriate header options for theming
        theme = document.settings.theme
        if theme:
            self.head_prefix.append('\\usetheme{%s}\n' % theme)

        set_header_options(self.head_prefix, document.settings.shownotes)

        if self.cb_use_pygments:
            from pygments.formatters import LatexFormatter
            self.head_prefix.extend([
                LatexFormatter().get_style_defs(),
            ])

        self.overlay_bullets = string_to_bool(document.settings.overlaybullets,
                                              False)
        self.fragile_default = string_to_bool(
            document.settings.fragile_default, True)
        self.shortauthor = document.settings.shortauthor
        self.shorttitle = document.settings.shorttitle
        # using a False default because
        # True is the actual default. If you are trying to pass in a value
        # and I can't determine what you really meant, I am assuming you
        # want something other than the actual default.
        self.centerfigs = string_to_bool(document.settings.centerfigs,
                                         False)  # same reasoning as above
        self.in_columnset = False
        self.in_column = False
        self.in_note = False
        self.frame_level = 0

        # this fixes the hardcoded section titles in docutils 0.4
        self.d_class = DocumentClass('article')

        self.admonition_alert_type = None
Ejemplo n.º 27
0
    def __init__(self, document):
        LaTeXTranslator.__init__(self, document)

        self.organization = None  #used for Beamer title and possibly
        #header/footer.  Set from docinfo
        # record the the settings for codeblocks
        self.cb_use_pygments = document.settings.cb_use_pygments
        self.cb_replace_tabs = document.settings.cb_replace_tabs
        self.cb_default_lang = document.settings.cb_default_lang

        self.head_prefix = [
            x for x in self.head_prefix if ('{typearea}' not in x)
        ]
        #hyperref_posn = [i for i in range (len (self.head_prefix))
        #    if ('{hyperref}' in self.head_prefix[i])]
        hyperref_posn = index(self.head_prefix, lambda x: '{hyperref}\n' in x)
        if (hyperref_posn is None):
            self.head_prefix.extend(['\\usepackage{hyperref}\n'])

        #self.head_prefix[hyperref_posn[0]] = '\\usepackage{hyperref}\n'
        self.head_prefix.extend([
            '\\definecolor{rrblitbackground}{rgb}{0.55, 0.3, 0.1}\n',
            '\\newenvironment{rtbliteral}{\n',
            '\\begin{ttfamily}\n',
            '\\color{rrblitbackground}\n',
            '}{\n',
            '\\end{ttfamily}\n',
            '}\n',
        ])

        if (self.cb_use_pygments):
            #from pygments.formatters import LatexFormatter
            #fmtr = LatexFormatter()
            self.head_prefix.extend([
                '\\usepackage{fancyvrb}\n',
                '\\usepackage{color}\n',
                #LatexFormatter().get_style_defs(),
            ])

        # set appropriate header options for theming
        theme = document.settings.theme
        if theme:
            self.head_prefix.append('\\usetheme{%s}\n' % theme)

        # set appropriate header options for note display
        shownotes = document.settings.shownotes
        if shownotes == SHOWNOTES_TRUE:
            shownotes = SHOWNOTES_RIGHT
        use_pgfpages = True
        if (shownotes == SHOWNOTES_FALSE):
            option_str = 'hide notes'
            use_pgfpages = False
        elif (shownotes == SHOWNOTES_ONLY):
            option_str = 'show only notes'
        else:
            if (shownotes == SHOWNOTES_LEFT):
                notes_posn = 'left'
            elif (shownotes in SHOWNOTES_RIGHT):
                notes_posn = 'right'
            elif (shownotes == SHOWNOTES_TOP):
                notes_posn = 'top'
            elif (shownotes == SHOWNOTES_BOTTOM):
                notes_posn = 'bottom'
            else:
                # TODO: better error handling
                assert False, "unrecognised option for shownotes '%s'" % shownotes
            option_str = 'show notes on second screen=%s' % notes_posn
        if use_pgfpages:
            self.head_prefix.append('\\usepackage{pgfpages}\n')
        self.head_prefix.append('\\setbeameroption{%s}\n' % option_str)

        if (self.cb_use_pygments):
            from pygments.formatters import LatexFormatter
            fmtr = LatexFormatter()
            self.head_prefix.extend([
                LatexFormatter().get_style_defs(),
            ])

        self.overlay_bullets = string_to_bool(document.settings.overlaybullets,
                                              False)
        self.fragile_default = string_to_bool(
            document.settings.fragile_default, True)
        #using a False default because
        #True is the actual default.  If you are trying to pass in a value
        #and I can't determine what you really meant, I am assuming you
        #want something other than the actual default.
        self.centerfigs = string_to_bool(document.settings.centerfigs,
                                         False)  #same reasoning as above
        self.in_columnset = False
        self.in_column = False
        self.in_note = False
        self.frame_level = 0

        # this fixes the hardcoded section titles in docutils 0.4
        self.d_class = DocumentClass('article')