Bug 138606 - Inserting Cross-Reference to Heading Number also inserts separator text with no option to customize it
Summary: Inserting Cross-Reference to Heading Number also inserts separator text with ...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.6.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 138607 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-12-01 20:13 UTC by William Friedman
Modified: 2020-12-03 03:55 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Example of the problem and what I want to have happen. (12.47 KB, application/vnd.oasis.opendocument.text)
2020-12-02 03:59 UTC, William Friedman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description William Friedman 2020-12-01 20:13:50 UTC
Description:
The Chapter Numbering feature allows customizing the numbering by adding text before and after the numbering, in the separator section. That is excellent functionality.

However, inserting a cross-reference to a Heading -- whether by number, number (no context), and number (full context) -- includes the full separator text without any option for customization. This breaks my use case, which is to configure the separator text to prefix the chapter number before the heading number (e.g., 3.X.Y.Z) and to suffix a period to serve as a separator (thus: 3.X.Y.Z.). However, when I want to cross-reference the header number, I *don't* want the *suffixed* separator text (the period) to appear, while I *do* want the *prefixed* separator text (3.) to appear. So, e.g., let's say I have the following headings (remember that 3. and the final period are separator text):

3.1. Text1
3.2. Text2
3.3. Text3

I want to be able to write something like "In section 3.1 I will discuss ... in section 3.2 I will discuss ..." where 3.1 and 3.2 are the cross-reference field to the appropriate heading with the prefixed text (3.) but not the suffixed period. Right now it looks like this: "In section 3.1. I will discuss ... in section 3.2. I will discuss" which is untenable.

I suppose this is an enhancement request; I certainly would not want to lose the separator text entirely, since I do want the prefixed text. The best solution would be to allow customization in the cross-reference dialog box, e.g., add a section "include separator text?" with checkboxes for "before" and "after". The second best solution (to my mind, although others might prefer this) would be to give the ability to add separator text to cross-references, so that only the actual number of the heading would be inserted (according to the option selected), without any separator text whatsoever.

Steps to Reproduce:
1. Open a new document.
2. Select Tools | Chapter Numbering.
3. In the number field, select "1, 2, 3, ..."
4. In the separator box, add some before text and after text. In my case, the before text is "3." and the after text is ".".
5. Click OK.
6. Select the correct style (by default, Heading 1). Type some text.
7. On a new line, in a non-heading style, go to Insert | Cross-Reference | Cross-References | Type: Headings | Insert reference to: Number. Click Insert.

Actual Results:
The cross-reference with before and after separator text is inserted as the field.

Expected Results:
There should be an option to customize how the cross-reference will be inserted and whether it should also insert the before and/or after separator text.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.4.6.2 (x64)
Build ID: 0ce51a4fd21bff07a5c061082cc82c5ed232f115
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: default; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: CL
Comment 1 m_a_riosv 2020-12-01 22:04:54 UTC
*** Bug 138607 has been marked as a duplicate of this bug. ***
Comment 2 Regina Henschel 2020-12-01 22:15:08 UTC
Your chapter numbering is not clear to me. Please attach a document that has this chapter numbering, and add a comment to the place, where you want the reference and write into the comment, what text you want to see as reference.
Comment 3 William Friedman 2020-12-02 03:59:44 UTC
Created attachment 167744 [details]
Example of the problem and what I want to have happen.

Here is an example of the current design and what I want to have happen. To see the separator text, go to Tools | Chapter Numbering. To demonstrate that this happens no matter what "number" option is chosen in the "Insert Reference to" box, each cross-reference uses a different option: number, number (no context), and number (full context), respectively. I hope this clarifies the matter. Thank you.
Comment 4 Regina Henschel 2020-12-02 23:16:10 UTC
ODF uses the wording "list label" without specifying how to tread prefix and suffix.

LibreOffice uses some special rules, how to show a prefix and suffix. I have not examined the code, but from experiments I see:
Prefix and suffix of the lowest current level is used.
The numbering is concatenated as specified by the "sublevels to show" with dot as separator. The prefix or suffix is then set at start or end of the concatenation.
Prefix and suffix of the lowest level are used.

The reference type "number" takes the label as it is and adds in front of it the labels of the higher levels, in case those of the referenced heading is different from the reference insert place. For type "number (with context)" it is always added, for type "number (no context)" is is never added. Type "chapter" takes the label with neither prefix nor suffix.

The problem in your file is, that you use "1." as prefix instead using a level for the "1" and let LibreOffice add the dot. What is the special reason for this?

Without a very good reason my suggestion will be to resolve the issue as "WONTFIX".
Comment 5 William Friedman 2020-12-03 03:55:36 UTC
Thank you for exploring this and clarifying the different options. To be totally honest, I simply missed the "chapter" option to display only the number without the prefixes and suffixes. (As a side note, the use of the word "chapter" is extremely confusing from an end user perspective, particularly when juxtaposed with three different options for type "number." The names of the "insert reference to" options are far from intuitive, and I would urge renaming them in a more user-friendly way. E.g., the fact that in type headings 'reference' displays the name associated with the heading while in type footnote 'reference' displays the number of the footnote is really confusing.)

The reason I had been appending 1., 2., 3., etc. at the beginning was because I was writing different chapters of a book in different documents, and in each chapter wished to prefix the chapter number, which would remain constant throughout, to the sections. But I see now that I can accomplish my goal by simply having the chapter number be the highest outline level and only using sublevels below the highest outline level, and using the "chapter" type for cross-references.

I can imagine use cases in which someone would nevertheless want the option for the cross-reference to display only the prefix or the suffix, and I tend to think that making the software as user customizable as possible (while retaining UI clarity) is preferable. Nevertheless, since my needs are now satisfied, for which I thank you, I will leave it to others who might need this feature to pursue it.