On 05/11/2018 09:25, Andrew Parsloe wrote:
On 4/11/2018 2:15 a.m., Graeme wrote:
The spreadtab module is extremely useful, as it provides a wrapper around a conventional table environment, to enable some spreadsheet-like capabilities within the table (using the LaTeX package spreadtab).
It can be downloaded from wiki.lyx.org/Layouts/Modules.

When creating a long(multipage) table within the sLTable environment provided by the spreadtab module, there is one small difference between the plain LaTeX code produced by LyX 2.3.0 and 2.3.1.
Specifically, LyX 2.3.0 exports the lines:
    \sLTable{}{%
    \begin{longtable}{|c|c|c|c|c|}
while LyX 2.3.1 exports the lines
    \sLTable{}{%
    \begin{longtable}[c]{|c|c|c|c|c|}

In practice I think the LyX 2.3.1 version is correct, but it exposes a bug in spreadtab module version 1.4, which cannot handle the optional [c] argument following \begin{longtable}.

Thus LyX 2.3.0 can successfully generate a PDF file, while LyX 2.3.1 fails with a LaTeX error. This applies to LyX under both Windows 10 with MikTeX, and Linux Mint with TeXLive 2017.

An example LyX file is attached, along with the PDF file generated successfully from it using File/Export/PDF(ps2pdf) with LyX 2.3.0.

Unfortunately, I am not sure how to fix the bug in the spreadtab module, so help on this would be welcome.

Graeme
I've attached the new module which works with longtables now, and also "normal" tables -- the tabular environment with or without the optional vertical alignment  argument. The documentation also needs updating. When that's done I'll make a zip file of both module and documentation and make them available from the wiki as before.

The spreadtab documentation nowhere mentions longtables. I suspect the author of that package  would be suprised to find someone contemplating using it for tables big enough to break across pages. He writes "... the 3 stages [of pdf compilation] described above take time, and above all, fp is slow in its calculations. The spreadtab environment leads to much slower
compilation than with a classical table."

(But then, perhaps he would think that that is just the sort of thing a LyX user would do. He is scathing of LyX, and of people who use LyX. To add to my sins, I wrote to him in English. Thrice a sinner.)

Andrew


Thanks for producing an updated spreadtab module so quickly. I've tested it with LyX 2.3.1 and can now successfully generate PDF output from files that failed with the previous version.

In practice my usage requires only fairly simple arithmetic operations on the contents of table cells, but some of the longer tables do extend over five A4 pages. Any small time penalty arising from the use of the fp package is far outweighed by the convenience of letting LyX do the recalculations, instead of doing them manually, or having to re-import a modified spreadsheet every time the values in a few cells are changed.

Graeme

Reply via email to