Created attachment 185671 [details] demonstration of problem with Category and Number and Caption Text The topic is the cross-reference dialog (Ctrl-F2), cross-references tab. The problem concerns the "Category and Number" and "Caption Text" options in the "Refer to" window. The attached document demonstrates that these two options depend on/presuppose the caption structure: [Category Name] [Caption Number] [Caption Text]. Captions with this structure will behave as "expected" when using this dialog. Deviations from this structure (as illustrated in the attachment) will not give "expected" behavior. Although the attachment may be considered a pathological case, there are actual cases where formatting is: Caption Text ([Category Name] [Caption Number]) With that structure, then cross-references to "Caption Text" would not work as expected. NB. The example in the attachment uses "Table", but the same point can be illustrated any number range variable. (tested with 7.2.7.2 and 7.6.0.0.alpha0+)
OP only describes problematic situation. Matter of taste whether this is bug or enhancement request. Obviously, expected behavior is that "Category and Number" show only Category Number and "Caption Text" shows only caption text. Solution is more difficult because, at present, there is no systematic way to identify (markup) these three components in the caption label. Solution to this bug would probably also provide a solution to bug 148597, and may be relevant to bug 114467.
I'd say it's a bug to be fixed.
Asking for UXEval, because of comment 1. And in relation to the following: 1. Main "problem" is that there is no markup for "Caption text". This issue is already raised somewhat in bug 148597, and according to bug 148597, comment 19 this issue is already on the UXEval agenda. Attachment 185881 [details] in bug 148597, comment 20 elaborates the issues even further. But cross-referencing is not mentioned in bug 148597 or the attachment, so maybe a note about cross-referencing could be added in an appropriate place? 2. Main purpose of the present ticket was to highlight this current behavior/limitation in cross-references. If that limitation is added somewhere in the previous tickets, then this ticket could be converted into a documentation ticket, which could be easily resolved and closed. Slight changes in the documentation [1] can give accurate information about "expected" behavior (without mentioning the structural requirement explicitly). There are three changes in particular. Current text between dashed lines, followed by proposed change. --------- Category and Number Inserts the category (caption type) and the number of the reference target. This option is only available when the reference target is an object with a caption. --------- Propose: Inserts the caption category and caption number (or number range variable name and value). Any text between the category and number (or variable name and value) is also inserted. This option is available for all number range variables, which includes caption numbers. -------------- Caption Text Inserts the caption label of the reference target. This option is only available when the reference target is an object with a caption. ---------------- Propose: Insert all text that follows the caption category and caption number until end of paragraph. This option is available for all number range variables, which includes caption numbers. ---------------- Numbering Inserts the caption number of the reference target. This option is only available when the reference target is an object with a caption. --------------- Propose: "Numbering" -> "Number" Inserts number range value. This option is available for all number range variables, which includes caption numbers. About name change: 1. A little more in parallel with "Category and Number" and "Caption Text", as well as ... 2. ... "Caption Number", which was considered and rejected, because the critical feature is "number range" variable, which does not have to be used only in captions. 3. Perhaps someone thought "Numbering" should be different for "Number" (which appears for Headings and Numbered Paragraphs)? But use context should disambiguate, similarly for help page, where the context is explicitly mentioned. [1] https://help.libreoffice.org/7.6/en-US/text/swriter/01/04090002.html
The issue is that, for example a) Figure 1: Lorem ipsum = CC C#: CT b) Lorem ipsum (Figure 1) = CT (CC C#) the cross-reference of a) for caption text is correct while b) would be empty. Obviously the program treats everything _after_ the caption number as text. If we follow André's suggestion from bug 148597 comment 20, discussed in bug 153248 the CT field would have a clear definition. Until then I suggest to just treat everything which is not category or number as text. Meaning "Lorem Figure 1: ipsum" generates "Lorem ipsum" as cross-reference. (Ignoring the other topics in c3.)
(In reply to Heiko Tietze from comment #4) > Until then I suggest to just treat everything which is not category > or number as text. iiuc, this is a proposal for changing the current implementation (until a better solution, e.g., a CT field) is developed? Perhaps an EasyHack? I am guessing the change would be needed around here: https://opengrok.libreoffice.org/xref/core/sw/source/core/fields/reffld.cxx?r=71337b43#558 Such a hack would also have to address the current behavior that any text between the category name and caption number is currently included when the "Category and Number" option is chosen. In relation to the proposal, perhaps that text should not be included as "Caption Text"? If not an EasyHack, then maybe better to wait for a CT field?
I would not wait for a CT-tag solution. Don't see a clear path to implement it, so not really easyhackable. Maybe Andreas is interested.
@Heiko -- need to ask again. 1. It is clear that CT is not likely happen in the near future (as a better solution to this and other tickets). 2. In light of that, Comment 3 suggests an "improvement" to the help page, so that it describes accurately the actual behavior of the cross-reference variables -- without having to tell about the "inelegancy" that motivated this ticket. This would, at least, provide the information needed to understand/explain (possible unexpected) behavior of the cross-reference choices (with no need for implementation changes). 3. Your response (comment 4) to that improvement suggestion seems to indicate (as a temporary improvement) "to just treat everything which is not category or number as text". My queries remain: 1. Should that comment 4 suggestion become the summary of this ticket? 2. Is that suggestion an EasyHack? If not, then maybe not worth making? 3. I can update the help page (using the descriptions in comment 3), but if an EasyHack was going to change the current behavior, then I would wait with the updating.
(In reply to sdc.blanco from comment #7) > 1. Should that comment 4 suggestion become the summary of this ticket? The summary describes the issue precisely. Any other solution than my proposed is welcome. > 2. Is that suggestion an EasyHack? If not, then maybe not worth making? I don't know if it's easy to hack. But the issue is clear and definitely worth to realize (as long it does not mean S/M-size or smaller). > 3. I can update the help page (using the descriptions in comment 3)... Wouldn't do so unless something has been implemented. You may add a note for now but maybe tomorrow someone provides a patch...
Created attachment 185996 [details] screenshot of current Cross-reference dialog for number range variables (In reply to Heiko Tietze from comment #8) Thanks for clear summary. Will leave bug summary - and add mention of relevant comments. > Wouldn't do so unless something has been implemented. You may add a note for > now but maybe tomorrow someone provides a patch... The descriptions are minimal and already written (in comment 3). "Category and Number" and "Numbering" need to be changed anyway (because at present they only refer to "captions", but they apply to number range variables). Plus I am betting now that tomorrow will be a long time. (-; If a patch does show up, only one or two sentences need to be modified. Just one remaining open issue -- the proposal to change "Numbering" -> "Number" in the "Refer using" box. (see attached screenshot)
Seth Chaiklin committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/669c7505358e0362d8829a79994946239c2cc7ce tdf#153903 "Numbering" -> "Number" for "number range" cross-ref format It will be available in 7.6.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Seth Chaiklin committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/help/commit/18bfaed6e90eb353d17fc837162e9ad9924bec04 tdf#153903 corrections to "caption" format descriptions