Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cross-references between subdocuments are broken #54

Open
blattms opened this issue Jan 2, 2024 · 11 comments
Open

cross-references between subdocuments are broken #54

blattms opened this issue Jan 2, 2024 · 11 comments

Comments

@blattms
Copy link
Member

blattms commented Jan 2, 2024

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"

@blattms blattms changed the title Bookmarks between subdocuments are broken cross-references between subdocuments are broken Jan 2, 2024
@hakonhagland
Copy link
Collaborator

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

@blattms
Copy link
Member Author

blattms commented Jan 2, 2024

@hakonhagland
Copy link
Collaborator

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
Copy link
Member Author

blattms commented Jan 3, 2024

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
Copy link
Collaborator

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
Copy link
Collaborator

"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
Copy link
Member Author

blattms commented Jan 16, 2024

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

@hakonhagland
Copy link
Collaborator

hakonhagland commented Jan 16, 2024

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.

@gdfldm
Copy link
Collaborator

gdfldm commented Jul 19, 2024

It looks like reference names are not unique, refTable6 appears in 5 different fodt files, for example:

<text:sequence text:ref-name="refTable6" text:name="Table" text:formula="ooow:Table+1" style:num-format="1">2.7</text:sequence>
<text:sequence text:ref-name="refTable6" text:name="Table" text:formula="ooow:Table+1" style:num-format="1">11.2.7</text:sequence>

This might make it difficult to reference a table from a different sub-document file :(

@blattms
Copy link
Member Author

blattms commented Jul 23, 2024

Not sure whether we can resort to bookmarks. See this issue

@blattms
Copy link
Member Author

blattms commented Jul 23, 2024

Hopefully these reference names are persistent. In that case we can come up with a scheme for their name (e.g. section_5_3__table_1 etc.) and rename them. See this question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants