## easylatex

Wraps your text in LaTeX article header/footer. Easy way to generate a document which can be compiled using LaTeX (includes Pygments syntax highlighting).

### Aliases for this filter

• easylatex

### Converts from file formats:

• .tex

### To file formats:

• .tex

### Available settings:

SettingDescriptionDefault
add-new-filesBoolean or list of extensions/patterns to match.False
added-in-versionDexy version when this filter was first available.
authorAuthor of article.
data-typeAlias of custom data class to use to store filter output.generic
dateDate of article.
documentclassThe document class to generate.article
examplesTemplates which should be used as examples for this filter.[]
exclude-new-files-from-dirList of directories to skip when adding new files.[]
extFile extension to output.None
extension-mapDictionary mapping input extensions to default output extensions.None
fontThe font size to use.11pt
helpHelpstring for plugin.Wraps your text in LaTeX article header/footer. Easy way to generate a document which can be compiled using LaTeX (includes Pygments syntax highlighting).
input-extensionsList of extensions which this filter can accept as input.['.tex']
keep-originalsWhether, if additional-doc-filters are specified, the original unmodified docs should also be added.False
mkdirA directory which should be created in working dir.None
mkdirsA list of directories which should be created in working dir.[]
nodocWhether filter should be excluded from documentation.False
outputWhether to output results of this filter by default by reporters such as 'output' or 'website'.False
output-extensionsList of extensions which this filter can produce as output.['.tex']
override-workspace-exclude-filtersIf True, document will be populated to other workspaces ignoring workspace-exclude-filters.False
papersizeThe document class to generate.a4paper
  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 class EasyLatex(DexyFilter): """ Wraps your text in LaTeX article header/footer. Easy way to generate a document which can be compiled using LaTeX (includes Pygments syntax highlighting). """ aliases = ['easylatex'] _settings = { 'input-extensions' : ['.tex'], 'output-extensions' : ['.tex'], 'documentclass' : ("The document class to generate.", "article"), 'style' : ("The pygments style to use.", "default"), 'title' : ("Title of article.", ""), 'author' : ("Author of article.", ""), 'date' : ("Date of article.", ""), 'font' : ("The font size to use.", "11pt"), 'papersize' : ("The document class to generate.", "a4paper"), "preamble" : ("Additional custom LaTeX content to include in header.", "") } def pygments_sty(self): formatter = LatexFormatter(style=self.setting('style')) return formatter.get_style_defs() def process_text(self, input_text): args = self.setting_values() args['input'] = input_text args['pygments'] = self.pygments_sty() if self.setting('title'): args['title'] = r"\title{%(title)s}" % args args['maketitle'] = r"\maketitle" else: args['title'] = "" args['maketitle'] = "" if self.setting('date'): args['date'] = r"\date{%(date)s}" % args if self.setting('author'): args['author'] = r"\author{%(author)s}" % args return self.template % args template = r"""\documentclass[%(font)s,%(papersize)s]{%(documentclass)s} \usepackage{color} \usepackage{fancyvrb} %(pygments)s %(preamble)s %(title)s %(author)s %(date)s \begin{document} %(maketitle)s %(input)s \end{document} """