summaryrefslogtreecommitdiff
path: root/pygments/formatters/latex.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygments/formatters/latex.py')
-rw-r--r--pygments/formatters/latex.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pygments/formatters/latex.py b/pygments/formatters/latex.py
index 15e68e37..66d521f5 100644
--- a/pygments/formatters/latex.py
+++ b/pygments/formatters/latex.py
@@ -413,11 +413,18 @@ class LatexFormatter(Formatter):
outfile.write(u'\\end{' + self.envname + u'}\n')
if self.full:
+ encoding = self.encoding or 'utf8'
+ # map known existings encodings from LaTeX distribution
+ encoding = {
+ 'utf_8': 'utf8',
+ 'latin_1': 'latin1',
+ 'iso_8859_1': 'latin1',
+ }.get(encoding.replace('-', '_'), encoding)
realoutfile.write(DOC_TEMPLATE %
dict(docclass = self.docclass,
preamble = self.preamble,
title = self.title,
- encoding = self.encoding or 'utf8',
+ encoding = encoding,
styledefs = self.get_style_defs(),
code = outfile.getvalue()))