diff options
Diffstat (limited to 'sphinx/writers/latex.py')
-rwxr-xr-x[-rw-r--r--] | sphinx/writers/latex.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 8c9b1f5c..dd9a5421 100644..100755 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -25,7 +25,6 @@ from sphinx.errors import SphinxError from sphinx.locale import admonitionlabels, _ from sphinx.util import split_into from sphinx.util.osutil import ustrftime -from sphinx.util.pycompat import any from sphinx.util.texescape import tex_escape_map, tex_replace_map from sphinx.util.smartypants import educate_quotes_latex @@ -249,7 +248,7 @@ class LaTeXTranslator(nodes.NodeVisitor): # the second item is the default for the master file and can be changed # by .. highlight:: directive in the master file self.hlsettingstack = 2 * [[builder.config.highlight_language, - sys.maxint]] + sys.maxsize]] self.footnotestack = [] self.curfilestack = [] self.handled_abbrs = set() @@ -743,14 +742,14 @@ class LaTeXTranslator(nodes.NodeVisitor): # Redirect head output until header is finished. see visit_tbody. self.body = self.tableheaders def depart_thead(self, node): - self.body.append('\\hline') + pass def visit_tbody(self, node): if not self.table.had_head: self.visit_thead(node) self.body = self.tablebody def depart_tbody(self, node): - self.body.append('\\hline') + pass def visit_row(self, node): self.table.col = 0 @@ -758,6 +757,7 @@ class LaTeXTranslator(nodes.NodeVisitor): if self.previous_spanning_row == 1: self.previous_spanning_row = 0 self.body.append('\\\\\n') + self.body.append('\\hline') self.table.rowcount += 1 def visit_entry(self, node): @@ -1153,7 +1153,7 @@ class LaTeXTranslator(nodes.NodeVisitor): else: self.builder.warn( 'unknown index entry type %s found' % type) - except ValueError, err: + except ValueError as err: self.builder.warn(str(err)) raise nodes.SkipNode @@ -1247,6 +1247,13 @@ class LaTeXTranslator(nodes.NodeVisitor): def depart_strong(self, node): self.body.append('}') + def visit_literal_strong(self, node): + self.body.append(r'\textbf{\texttt{') + self.no_contractions += 1 + def depart_literal_strong(self, node): + self.body.append('}}') + self.no_contractions -= 1 + def visit_abbreviation(self, node): abbr = node.astext() self.body.append(r'\textsc{') @@ -1331,6 +1338,11 @@ class LaTeXTranslator(nodes.NodeVisitor): highlight_args['force'] = True if 'linenos' in node: linenos = node['linenos'] + filename = node.get('filename') + if filename: + self.body.append('\n{\\colorbox[rgb]{0.9,0.9,0.9}' + '{\\makebox[\\textwidth][l]' + '{\\small\\texttt{%s}}}}\n' % (filename,)) def warner(msg): self.builder.warn(msg, (self.curfilestack[-1], node.line)) hlcode = self.highlighter.highlight_block(code, lang, warn=warner, |