Bug 156536 - Support ranges / multi-selection for cross-referencing
Summary: Support ranges / multi-selection for cross-referencing
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on: 156790
Blocks: Fields-Cross-Reference
  Show dependency treegraph
 
Reported: 2023-07-30 18:30 UTC by Eyal Rozenberg
Modified: 2024-03-23 15:16 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2023-07-30 18:30:37 UTC
At the moment, the Insert | Cross-Reference... dialog only lets you select a single item. However, one often wants to refer to several items, or a range of items. For example: "See clauses 4--6".

It would be convenient if the dialog would allow selecting a contiguous sequence of items, and insert two cross-references with an en-dash between then (or the appropriately-localized range signifier).

One could go further and support an arbitrary selection, which would be treated as a sequence of single references and ranges of references; each ref or range-of-refs would be treated as usual or as per the above respectively, and be followed by a comma, e,g, "4--6, 10" with 4, 6 and 10 being references.
Comment 1 V Stuart Foote 2023-08-14 11:16:27 UTC
Some utility, but highly dependent on what ODF will support. Does it?
Comment 2 Eyal Rozenberg 2023-08-14 12:26:21 UTC
Regina, does ODF support referencing multi-paragraph ranges? Non-contiguous ranges? I can't quite find a references section in the ODF spec.
Comment 3 Regina Henschel 2023-08-14 13:40:00 UTC
You can reference bookmarks and such can span several paragraphs. But the format of what is shown in the cross-reference field is limited to 19.860 text:reference-format.
https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part3-schema/OpenDocument-v1.3-os-part3-schema.html#attribute-text_reference-format

Non-continues things are not possible because all kind of references always refer to one start-end pair.

An implementation would need to specify a new value of the text:reference-format attribute.

Is it worth the effort? Define a bookmark at start (location "4") and at end (location "6") and insert two cross-references with the hyphen between them. That will show as "4-6". In principle, such could be done by a macro.
Comment 4 Heiko Tietze 2023-08-16 13:26:24 UTC
(In reply to Regina Henschel from comment #3)
> Non-continues things are not possible...

So WF. And I fail to see the use case.
Comment 5 Eyal Rozenberg 2023-08-16 16:00:24 UTC
(In reply to Regina Henschel from comment #3)
> You can reference bookmarks and such can span several paragraphs. 

So, there's an implicit assumption that the only the beginning of the bookmark merits referencing. This is a bit strange considering that a bookmark can be a range.


(In reply to Heiko Tietze from comment #4)
> So WF. 

You're mixing up the order of conclusions here.

> And I fail to see the use case.

You fail to see the use case for references to a range rather than a point? Surely you just... I had to use pairs of bookmarks for this all the time in legal documents, and occasionally in academic documents: "Mr. Smith's conduct clearly exhibited bad faith, as is elaborated in paragraphs 43--51 below".
Comment 6 Heiko Tietze 2023-08-18 09:13:04 UTC
(In reply to Eyal Rozenberg from comment #5)
> "Mr. Smith's conduct clearly exhibited bad faith, 
> as is elaborated in paragraphs 43--51 below".

This would be a great start for any kind of request. How does bookmarks come into play now?
Comment 7 Eyal Rozenberg 2023-08-18 10:37:01 UTC
(In reply to Heiko Tietze from comment #6)
> How does bookmarks come into play now?

Oh, I misspoke. I meant "pair of references". 

So, I needed to reference these kinds of ranges, and would need to:

1. Insert reference to first numbered item.
2. Insert reference to second numbered item.
3. move the cursor between the references and enter the hyphen

Now - that's not so bad, but I would have liked to be able to mark a range on the list of numbered item and get that done for me at once. I think the request makes sense UI-wise since no additional widgets are necessary, just an interpretation of a range selection in the list.
Comment 8 Stéphane Guillou (stragu) 2024-03-23 07:22:11 UTC
(In reply to Eyal Rozenberg from comment #7)
> 1. Insert reference to first numbered item.
> 2. Insert reference to second numbered item.
> 3. move the cursor between the references and enter the hyphen
> 
> Now - that's not so bad, but I would have liked to be able to mark a range
> on the list of numbered item and get that done for me at once. I think the
> request makes sense UI-wise since no additional widgets are necessary, just
> an interpretation of a range selection in the list.
I can see how this extra convenience would simplify things. But the challenge lies in the UI. Let's say you have references:
- 1
- 2
- 3
- 4

One user wants to reference 1, 2 and 3 at once (shown as "1,2,3", excluding any future reference added in between), the other wants the range 1 _to_ 3 (shown as "1-3", including any future references added in between). How do we accommodate both use cases?
Comment 9 Eyal Rozenberg 2024-03-23 15:16:10 UTC
(In reply to Stéphane Guillou (stragu) from comment #8)

First note that we can't refer to references. So let's suppose you meant, say, four numbered paragraphs.

Now, it's true that one could want to refer to one of two thinbgs:

* The range beginning at the start of paragraph 1 and ending with the end of numbered paragraph 4 (which may include unnumbered paragraphs other than the four)
* The four individual numbered paragraphs

These both have legitimate uses.

> How do we accommodate both use cases?

Hmmm. If we want to accommodate both, perhaps we would need a checkbox to choose between them (which is only enabled when the selection is of multiple item).