On Wed, Jan 02, 2019 at 06:09:24PM -0500, Scott Kostyshak wrote:
> For the attached example .lyx file (created from the Embedded Objects
> manual), consider the following:
> 
>   $ lyx -e lyx16x embedded_mwe.lyx
>   starting local cmake binary for lyx
>   $ lyx -e lyx16x embedded_mwe.16.lyx
>   starting local cmake binary for lyx
>   $ lyx -e lyx16x embedded_mwe.16.16.lyx
>   starting local cmake binary for lyx
>   $ lyx -e lyx16x embedded_mwe.16.16.16.lyx
>   starting local cmake binary for lyx
>   $ lyx -e lyx16x embedded_mwe.16.16.16.16.lyx
>   starting local cmake binary for lyx
>   $ lyx -e lyx16x embedded_mwe.16.16.16.16.16.lyx
>   starting local cmake binary for lyx
>   $ lyx -e lyx16x embedded_mwe.16.16.16.16.16.16.lyx
>   starting local cmake binary for lyx
>   $ sha256sum *lyx
>   20230fb977921f2c19b11391baffe9fdc929800aecba2ae4ac98585c5d0fb0be  
> embedded_mwe.16.16.16.16.16.16.16.lyx
>   b30cb55c0a67b1e72f441f4d61a69c6152bcb29eadbe4f0c30b8f18ff7b8864e  
> embedded_mwe.16.16.16.16.16.16.lyx
>   20230fb977921f2c19b11391baffe9fdc929800aecba2ae4ac98585c5d0fb0be  
> embedded_mwe.16.16.16.16.16.lyx
>   b30cb55c0a67b1e72f441f4d61a69c6152bcb29eadbe4f0c30b8f18ff7b8864e  
> embedded_mwe.16.16.16.16.lyx
>   20230fb977921f2c19b11391baffe9fdc929800aecba2ae4ac98585c5d0fb0be  
> embedded_mwe.16.16.16.lyx
>   b30cb55c0a67b1e72f441f4d61a69c6152bcb29eadbe4f0c30b8f18ff7b8864e  
> embedded_mwe.16.16.lyx
>   20230fb977921f2c19b11391baffe9fdc929800aecba2ae4ac98585c5d0fb0be  
> embedded_mwe.16.lyx
>   2c52cc90dcac90c263842fe23f7a8be9b781559714cce245cdd8efc3b212c953  
> embedded_mwe.lyx
> 
> Notice how all of the odd-numbered checksums are the same and how all of
> the even-numbered checksums are the same (except for the non-1.6.x
> format .lyx file): It seems to alter back and forth between two states.
> Here is the difference:
> 
>   $ diff -u embedded_mwe.16.lyx embedded_mwe.16.16.lyx 
>   --- embedded_mwe.16.lyx     2019-01-02 17:53:39.562138989 -0500
>   +++ embedded_mwe.16.16.lyx  2019-01-02 17:53:40.254142043 -0500
>   @@ -51,7 +51,7 @@
>    <column alignment="center" valignment="top">
>    <column alignment="center" valignment="top">
>    <column alignment="center" valignment="top">
>   -<row endfirsthead="false" caption="true">
>   +<row caption="true">
>    <cell multicolumn="1" alignment="center" valignment="top" usebox="none">
>    \begin_inset Text
> 
> Is this an issue that should be fixed, or is this expected?

Attached is a patch. With the patch, the .lyx exports converge. Further,
the difference in .tex files produced, compared with the original, is
reduced.

Without the patch, I get the following:

    $ rm *16*
    $ mylyx master -e lyx16x embedded_mwe.lyx
    $ mylyx master -e lyx16x embedded_mwe.16.lyx
    $ mylyx master -e lyx16x embedded_mwe.16.16.lyx
    $ mylyx master -e lyx16x embedded_mwe.16.16.16.lyx
    $ md5sum *lyx
    575ff2f9805e828ecbfaf7cc1d94f154  embedded_mwe.16.16.16.16.lyx
    86cf64c01d3efa8b4fb73eb790d46e81  embedded_mwe.16.16.16.lyx
    575ff2f9805e828ecbfaf7cc1d94f154  embedded_mwe.16.16.lyx
    86cf64c01d3efa8b4fb73eb790d46e81  embedded_mwe.16.lyx
    1f291ae3ea117832f87aeda6985b347b  embedded_mwe.lyx
    $ diff embedded_mwe.16.16.16.lyx embedded_mwe.16.16.16.16.lyx
    54c54
    < <row endfirsthead="false" caption="true">
    ---
    > <row caption="true">
    $ rm *tex
    $ mylyx master -e pdflatex embedded_mwe.lyx
    $ mylyx master -e pdflatex embedded_mwe.16.16.16.lyx
    $ diff *tex
    5a6
    > \synctex=-1
    22a24
    > \endfirsthead
    $ 

Note the difference in .lyx files and of the LaTeX output of \endfirsthead.

With the patch, I get:

    $ rm *16*
    $ mylyx master -e lyx16x embedded_mwe.lyx
    $ mylyx master -e lyx16x embedded_mwe.16.lyx
    $ mylyx master -e lyx16x embedded_mwe.16.16.lyx
    $ mylyx master -e lyx16x embedded_mwe.16.16.16.lyx
    $ md5sum *lyx
    92b43acbf7f54361a9c8a2231037a8ea  embedded_mwe.16.16.16.16.lyx
    92b43acbf7f54361a9c8a2231037a8ea  embedded_mwe.16.16.16.lyx
    92b43acbf7f54361a9c8a2231037a8ea  embedded_mwe.16.16.lyx
    92b43acbf7f54361a9c8a2231037a8ea  embedded_mwe.16.lyx
    1f291ae3ea117832f87aeda6985b347b  embedded_mwe.lyx
    $ diff embedded_mwe.16.16.16.lyx embedded_mwe.16.16.16.16.lyx
    $ rm *tex
    $ mylyx master -e pdflatex embedded_mwe.lyx
    $ mylyx master -e pdflatex embedded_mwe.16.16.16.lyx
    $ diff *tex
    5a6
    > \synctex=-1
    $ 

There is still the LaTeX difference of \synctex=-1, but the difference
of \endfirsthead is gone and there is no difference in .lyx files.

As a further test, I looked at the difference between the exported .tex
from 2.1.0 (I don't have 1.6.x) compared to the exported .tex from
master of the original .lyx file.

Without the patch:

    $ diff embedded_mwe.16.16.16_2.1.0.tex embedded_mwe.tex
    1c1
    < %% LyX 2.1.0 created this file.  For more info, see http://www.lyx.org/.
    ---
    > %% LyX 2.4.0dev created this file.  For more info, see 
https://www.lyx.org/.
    5a6
    > \synctex=-1
    20c21
    < \begin{longtable}{|c|c|c|c|c|}
    ---
    > \begin{longtable}[c]{|c|c|c|c|c|}
    22a24
    > \endfirsthead
    $

With the patch:

    $ diff embedded_mwe.16.16.16_2.1.0.tex embedded_mwe.tex
    1c1
    < %% LyX 2.1.0 created this file.  For more info, see http://www.lyx.org/.
    ---
    > %% LyX 2.4.0dev created this file.  For more info, see 
https://www.lyx.org/.
    5a6
    > \synctex=-1
    20c21
    < \begin{longtable}{|c|c|c|c|c|}
    ---
    > \begin{longtable}[c]{|c|c|c|c|c|}
    $ 

Note that with the patch, there is no longer the difference of \endfirsthead.

I arrived at the patch by experimentation and am not sure it's correct.
But perhaps it gives a clue to someone for what the correct patch would
be?

Scott
diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py
index 1dfe163b32..63d7621ab1 100644
--- a/lib/lyx2lyx/lyx_2_1.py
+++ b/lib/lyx2lyx/lyx_2_1.py
@@ -556,8 +556,6 @@ def handle_longtable_captions(document, forward):
                     get_option_value(document.body[begin_row], 'endlastfoot') != 'true'):
                     document.body[begin_row] = set_option_value(document.body[begin_row], 'caption', 'true", endfirsthead="true')
             elif get_option_value(document.body[begin_row], 'caption') == 'true':
-                if get_option_value(document.body[begin_row], 'endfirsthead') == 'true':
-                    document.body[begin_row] = set_option_value(document.body[begin_row], 'endfirsthead', 'false')
                 if get_option_value(document.body[begin_row], 'endhead') == 'true':
                     document.body[begin_row] = set_option_value(document.body[begin_row], 'endhead', 'false')
                 if get_option_value(document.body[begin_row], 'endfoot') == 'true':

Attachment: signature.asc
Description: PGP signature

Reply via email to