[Numpy-discussion] numpydoc - latex longtables error

Matthew Brett matthew.brett at gmail.com
Wed Aug 10 15:28:53 EDT 2011


Hi,

I think this one might be for Pauli.

I've run into an odd problem that seems to be an interaction of
numpydoc and autosummary and large classes.

In summary, large classes and numpydoc lead to large tables of class
methods, and there seems to be an error in the creation of the large
tables in latex.

Specifically, if I run 'make latexpdf' with the attached minimal
sphinx setup, I get a pdflatex error ending thus:

...
l.118 \begin{longtable}{LL}

and this is because longtable does not accept LL as an argument, but
needs '|l|l|' (bar - el - bar - el - bar).

I see in sphinx.writers.latex.py, around line 657, that sphinx knows
about this in general, and long tables in standard ReST work fine with
the el-bar arguments passed to longtable.

        if self.table.colspec:
            self.body.append(self.table.colspec)
        else:
            if self.table.has_problematic:
                colwidth = 0.95 / self.table.colcount
                colspec = ('p{%.3f\\linewidth}|' % colwidth) * \
                          self.table.colcount
                self.body.append('{|' + colspec + '}\n')
            elif self.table.longtable:
                self.body.append('{|' + ('l|' * self.table.colcount) + '}\n')
            else:
                self.body.append('{|' + ('L|' * self.table.colcount) + '}\n')

However, using numpydoc and autosummary (see the conf.py file), what
seems to happen is that, when we reach the self.table.colspec test at
the beginning of the snippet above, 'self.table.colspec' is defined:

In [1]: self.table.colspec
Out[1]: '{LL}\n'

and thus the LL gets written as the arg to longtable:

\begin{longtable}{LL}

and the pdf build breaks.

I'm using the numpydoc out of the current numpy source tree.

At that point I wasn't sure how to proceed with debugging.  Can you
give any hints?

Thanks a lot,

Matthew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: long_test.tgz
Type: application/x-gzip
Size: 11907 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110810/3ca69969/attachment.bin>


More information about the NumPy-Discussion mailing list