diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 3eea2ffe7..3929f1e9b 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -6,7 +6,7 @@ % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{sphinx}[2017/01/16 v1.6 LaTeX package (Sphinx markup)] +\ProvidesPackage{sphinx}[2017/02/01 v1.6 LaTeX package (Sphinx markup)] % we delay handling of options to after having loaded packages, because % of the need to use \definecolor. @@ -24,6 +24,9 @@ ******** ERROR !! PLEASE UPDATE titlesec.sty !!********^^J% ******** THIS VERSION SWALLOWS SECTION NUMBERS.********}}}}{} \RequirePackage{tabulary} +% use of \X to minimize possibility of conflict with one-character column types +\newcolumntype{\X}[2]{p{\dimexpr + (\linewidth-\arrayrulewidth)*#1/#2-\tw@\tabcolsep-\arrayrulewidth\relax}} \RequirePackage{makeidx} % For framing code-blocks and warning type notices, and shadowing topics \RequirePackage{framed} diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 519e655ce..e806dad54 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1206,14 +1206,12 @@ class LaTeXTranslator(nodes.NodeVisitor): self.body.append(self.table.colspec) elif self.table.colwidths: total = sum(self.table.colwidths) - colspec = ['p{\\dimexpr(\\linewidth-\\arrayrulewidth)*%d/%d' - '-2\\tabcolsep-\\arrayrulewidth\\relax}' % (width, total) + colspec = ['\\X{%d}{%d}' % (width, total) for width in self.table.colwidths] self.body.append('{|%s|}\n' % '|'.join(colspec)) else: if self.table.has_problematic: - colspec = ('*{%d}{p{\\dimexpr(\\linewidth-\\arrayrulewidth)/%d' - '-2\\tabcolsep-\\arrayrulewidth\\relax}|}' % + colspec = ('*{%d}{\\X{1}{%d}|}' % (self.table.colcount, self.table.colcount)) self.body.append('{|' + colspec + '}\n') elif self.table.longtable: