diff --git a/sphinx/texinputs/sphinxmulticell.sty b/sphinx/texinputs/sphinxmulticell.sty index 87679a9ca..f0d11b1f9 100644 --- a/sphinx/texinputs/sphinxmulticell.sty +++ b/sphinx/texinputs/sphinxmulticell.sty @@ -128,7 +128,7 @@ \xdef\sphinx@multiwidth {\the\dimexpr\sphinx@multiwidth+\sphinx@tempb+\tw@\tabcolsep+\arrayrulewidth}% % hack the \vline and the colortbl macros - \aftergroup\sphinx@hack@vline\aftergroup\sphinx@hack@CT&\relax + \sphinx@hack@vline\sphinx@hack@CT&\relax % repeat \expandafter\sphinx@multispan\expandafter{\the\numexpr#1-\@ne}% }% @@ -210,14 +210,24 @@ % standard \multirow % 1. does not allow verbatim contents, % 2. does not allow blank lines in its argument, -% 3. requires manual intervention if the contents is too long to fit +% 3. its * specifier means to typeset "horizontally" which is very +% bad for paragraph content. 2016 version has = specifier but it +% must be used with p type columns only, else results are bad, +% 4. it requires manual intervention if the contents is too long to fit % in the asked-for number of rows. +% 5. colour panels (either from \rowcolor or \columncolor) will hide +% the bottom part of multirow text, hence manual tuning is needed +% to put the multirow insertion at the _bottom_. +% % The Sphinx solution consists in always having contents wrapped % in a varwidth environment so that it makes sense to estimate how many % lines it will occupy, and then ensure by insertion of suitable struts % that the table rows have the needed height. The needed mark-up is done % by LaTeX writer, which has its own id for the merged cells. % +% The colour issue is solved by clearing colour panels in all cells, +% whether or not the multirow is single-column or multi-column. +% % In passing we obtain baseline alignements across rows (only if % \arraylinestretch is 1, as LaTeX's does not obey \arraylinestretch in "p" % multi-line contents, only first and last line...) @@ -299,6 +309,8 @@ \@depth\dimexpr\count@\ht\@arstrutbox+\count@\dp\@arstrutbox-\ht\@arstrutbox\relax \@width\z@ \endgroup + % we need this to avoid colour panels hiding bottom parts of multirow text + \sphinx@hack@CT }% \endinput %% diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index ae429e708..9060c290a 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1480,6 +1480,7 @@ class LaTeXTranslator(nodes.NodeVisitor): self.body.append('&') if nextcell.width == 1: # insert suitable strut for equalizing row heights in multirow + # they also serve to clear colour panels which would hide the text self.body.append('\\sphinxtablestrut{%d}' % nextcell.cell_id) else: # use \multicolumn for wide multirow cell