----Original Message-----
From: lyx-users@lists.lyx.org [mailto:lyx-users@lists.lyx.org] On Behalf Of
Helge Hafting
Sent: Wednesday, August 31, 2016 10:02 AM
To: lyx-users@lists.lyx.org
Subject: Re: imported gnumeric table with lyx caption results in +2 table
counter (expected +1)

Den 30. aug. 2016 00:35, skrev Jannick:
> Hi,
>
> Putting tables created by gnumeric's ssconvert (from original .xlsx) 
> into floating boxes results in table numbers increasing by 2. My 
> document having such tables only shows even table numbers only.
>
> I think this is because each of the converted tables itself (defined 
> as
> 'longtable') increases the table counter by 1 - and so does the 
> floating box \caption on top of that. The preamble hack
>
>       \let\oldinput\input
>       \renewcommand{\input}[1]{\oldinput{#1}\addtocounter{table}{-1}}
>
> reduces the table counter by 1 right after table import, which is only 
> correct if \caption appears after \input.
>
> I am not sure if this is considered a bug, but to me it seems that the 
> hack works only contingent what syntactically follows \input. I leave 
> it with you guys if you deem that a bug and put a 
> '\addtocounter{table}{-1}' after \input when syntactically appropriate.
>
A longtable is not supposed to go into "a floating box".
"Short" tables are not broken up if they appear on the bottom of a page. 
Instead, the entire table is moved to the next page. (It is assumed that
short tables will look really bad if broken up.) However, this may leave the
previous page with a big gap. Therefore, we have floats to avoid that
particular problem. Short tables are not numbered, the numbering is done by
the float mechanism.

  A longtable don't need to float, if it appear at the bottom of a page, it
will get broken up. This is a better way of handling tables that are very
long. (Optionally, headings can repeat on each page.) No float is involved,
so long tables handle table numbering themselves.

Therefore, numbers screw up when a long table goes into a float. But you are
not supposed to need that, if you want a floating table - use one that is
not 'long'.

If gnumeric only exports long tables and that is not what you want - ask
them if they can implement another latex export.

Helge Hafting
_______

Understand. Maybe a question with an easy answer: Assuming that ssconvert
creates a long table or any other kind of table, is there a way to add a
table label (caption) other than using a floating object? This is why I was
using the nested structure which as you say is not necessary.

Thanks,
J.

Reply via email to