OPM / opm-reference-manual

Other
1 stars 5 forks source link

cross-references between subdocuments are broken #54

Open blattms opened 6 months ago

blattms commented 6 months ago

E.g. in ./parts/chapters/subsections/12.3/GRUPNET.fodt there is a reference to figure 12.4 in ./parts/chapters/subsections/12.3/GRUPTREE.fodt which is unkown "Error: Reference not found"

hakonhagland commented 6 months ago

@blattms Thanks. I will check what is going on here.

blattms commented 6 months ago

Seems to be rather tricky: https://ask.libreoffice.org/t/cross-reference-within-a-masterdocument/45922/7

hakonhagland commented 6 months ago

This looks like a bug in libreoffice. I created a minimal example, a main file m.fodt and a child file c.fodt. If m.fodt includes a section from c.fodt, using <text:section-source xlink:href="c.fodt" ... and c.fodt defines some figures using <text:sequence-decl text:display-outline-level="???" text:name="Figure"/> and one of the figure has a caption which defines a reference: <text:sequence text:ref-name="refFigure0" text:name="Figure" text:formula="ooow:Figure+1" style:num-format="1">1</text:sequence> and m.fodt tries to reference this figure using <text:sequence-ref text:reference-format="caption" text:ref-name="refFigure0">A reference to a figure in c.fodt</text:sequence-ref> and I now try to open m.fodt in libreoffice it will display as "Error: Reference not found". I can right-click that text and choose "Edit fields..." from the context popup menu, and then click ok in the next dialog. This seems to fix the issue. But this requires manual user interaction. We are looking for an automated solution, right?

blattms commented 6 months ago

Wow, great that you found that. Seems like magic to me.

Maybe we should present your test case in the libreoffice bug-tracker or whatever they are using.

We need a solution. Doing it manually would be a last (unfortunate) option. The problem that i am seeing is that there is no easy way to find all undefined references. We cannot store the main file and do not know what happens if we split it again.

hakonhagland commented 5 months ago

Maybe we should present your test case in the libreoffice bug-tracker

@blattms Created a small example at the libreoffice forum

https://ask.libreoffice.org/t/make-a-cross-reference-from-one-included-section-to-another-included-section/100329

Let's see if we get any response there first.

hakonhagland commented 5 months ago

"Error: Reference not found"

Seems like the problem is gone for the latest development version of libreoffice. At least for a small test example. Here is what I did to test this: Since I am not able to install the development version on my laptop with Ubuntu 22.04 (too old version of gcc), I installed it in a docker image with Ubuntu 23.10. The problem is that it crashes for the main.fodt on my machine, but I can open smaller documents, and there it seems to fix the problem with references between sub documents. (My default installation of libreoffice on Ubuntu 22.04 is quite old: 7.3.7.2, and for this version I get "Error: Reference not found")

blattms commented 5 months ago

Seems like the problem is gone for the latest development version of libreoffice. :sunglasses: What numbered version is this?

hakonhagland commented 5 months ago

What numbered version is this?

@blattms As I remember the development version did not have a regular version number. However, I have now upgraded my laptop from Ubuntu 22.04 to Ubuntu 23.10 which has libreoffice version 7.6.4.1. But unfortunately I experience the same issue here as with the development version mentioned above. I cannot open main.fodt, it just freezes. So it might be that a bug was fixed (references working) and one bug was introduced (not able to open large documents) at some point between versions 7.3 and 7.6.