From 9cfdf9b13eaf5cc70e1f83f11e8d9155b2677671 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 5 Apr 2009 00:17:47 +0300 Subject: [PATCH] latex: add support for UTF-8 non-breaking spaces, and reintroduce them in autosummary --- sphinx/ext/autosummary/__init__.py | 7 ++++--- sphinx/writers/latex.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index b1db7863f..00e4307eb 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -259,8 +259,8 @@ class Autosummary(Directive): table = nodes.table('') group = nodes.tgroup('', cols=2) table.append(group) - group.append(nodes.colspec('', colwidth=30)) - group.append(nodes.colspec('', colwidth=70)) + group.append(nodes.colspec('', colwidth=10)) + group.append(nodes.colspec('', colwidth=90)) body = nodes.tbody('') group.append(body) @@ -319,7 +319,8 @@ def mangle_signature(sig, max_chars=30): else: sig = ", ".join(args) - return "(%s)" % sig + sig = unicode(sig).replace(u" ", u"\u00a0") + return u"(%s)" % sig # -- Importing items ----------------------------------------------------------- diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 37281fa9f..a0ea19614 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -30,6 +30,7 @@ from sphinx.util.smartypants import educateQuotesLatex HEADER = r'''%% Generated by Sphinx. \documentclass[%(papersize)s,%(pointsize)s%(classoptions)s]{%(docclass)s} %(inputenc)s +%(utf8extra)s %(fontenc)s %(babel)s %(fontpkg)s @@ -136,6 +137,7 @@ class LaTeXTranslator(nodes.NodeVisitor): 'pointsize': '10pt', 'classoptions': '', 'inputenc': '\\usepackage[utf8]{inputenc}', + 'utf8extra': '\\DeclareUnicodeCharacter{00A0}{\nobreakspace}', 'fontenc': '\\usepackage[T1]{fontenc}', 'babel': '\\usepackage{babel}', 'fontpkg': '\\usepackage{times}',