Bug 54393 - Add option to prevent that Footnotes and Endnotes are always hidden together with anchor
Summary: Add option to prevent that Footnotes and Endnotes are always hidden together ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Depends on:
Blocks: Footnote-Endnote
  Show dependency treegraph
Reported: 2012-09-02 13:29 UTC by Werner Johann
Modified: 2018-04-22 08:46 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:
Regression By:

Document showing the problem (25.18 KB, application/vnd.oasis.opendocument.text)
2012-09-19 20:10 UTC, Werner Johann

Note You need to log in before you can comment on or make changes to this bug.
Description Werner Johann 2012-09-02 13:29:12 UTC
In scientific texts (natural science) it is common and for some articles in many journals necessary to make an extra footnote or endnote for each reference (Vancouver system). These journals also demand that within the main text more than 2 subsequent reference numbers should be written like: 2-5. If libreoffice should be really an alternative for usage in scientific writing at universities the correct implementation of a hiding feature concerning the reference number (footnote/endnote anchor) as given in MS-office is absolutely vital. Otherwise the libreoffice writer is not usable for millions of students and scientists.
If you write 2- 3 4 5 and try to hide 3 4 (together with the spaces), the endnotes themselves are also hidden.
A work around using small font size and white color leads to terrible spaces if you have more reference (e.g. 23-30). Interestingly these formattings are not applied to the endnotes themselves. 
One can apply any formatting to the anchor (strike out, blinking etc.) without having the same effect at the footnote or endnote itself – except hiding.
Therefore the vanishing of the endnotes and also footnotes by hiding their reference number seems to be a bug.
In addition, if the whole text within an endnote or footnote is hidden the footnote/endnote is hidden completely. This can be avoided by at least leaving one space unhidden. As there is already this  way to do so, there is no reason why the note itself should vanish, when the anchor is hidden, if the user would need this in some rare cases.
Comment 1 Jean-Baptiste Faure 2012-09-16 05:43:49 UTC
Please attach a document showing the problem.

Best regards. JBF
Comment 2 Werner Johann 2012-09-19 20:10:26 UTC
Created attachment 67416 [details]
Document showing the problem

I have attached a document showing the problem with examples. It also contains some additional arguments, why this bug should be eliminated.
Comment 3 Werner Johann 2013-03-23 20:22:55 UTC Comment hidden (obsolete)
Comment 4 Werner Johann 2014-06-27 15:43:52 UTC
The problem is still present in Libreoffice

It seems to me that somebody, who is involved in the development of libreoffice, wants an easy way to hide footnote or endnotes by just hiding the corresponding anchors.

Would it be possible to implement an option (Menu->Tools->Options)whether somebody wants to hide the footnote or endnote together with the anchor or not? 
So everybody would be happy.
It is not allways possible to use reference managers like zotero as suggested at http://nabble.documentfoundation.org/Footnotes-and-Endnotes-are-hidden-together-with-reference-numbers-td3758012.html

I am quite sure that many chemist and biologists would appreciate this feature. (Physicists are normally using Latex.)

[ Somebody has requested the same thing at openoffice:
https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=655 ]

Please, help those poor fools, who want to hide anchors without affecting the footnote or endnote themselves!
Comment 5 Owen Genat (retired) 2014-06-28 01:35:00 UTC
Werner, you have my sympathy with this report. I use this form of referencing rarely, but I am well aware of the need. Thanks for including the link to the mailing list discussion. I am surprised that there was not greater recognition that different referencing systems (APA, CMS, Vancouver, et al.) handle the various elements differently.

I notice a number of fields related to this bug have been erroneous altered over time, so I am going to try and set them more correctly:

- Status set to NEW as I am confirming this bug. The history indicates it was previously set from NEEDINFO to REOPENED, when it should have been set back UNCONFIRMED.
- Version set back to v3.6.1.2. This field indicates the earliest release the problem applies to. In this case this feature has never been available and so goes right back to OOo, however QA use this field differently for enhancements (to track versions that enhancements apply to).
- Importance set to medium as this bug "prevents users from making professional quality work". Refer the flowchart under Step 6: https://wiki.documentfoundation.org/QA/BugTriage
- Severity set to enhancement as this is requesting a new feature that has never existed before.

Best wishes with getting this feature implemented.
Comment 6 Werner Johann 2014-06-28 05:39:17 UTC
Dear Owen,

Thank You so much! I am happy that somebody of the developer team understands my problem. I am still forced to use MS-Word for scientific writing. 

I think an option to hide the footnote or endnote anchor alone would also improve the compatibility with the unfortunately still dominating Office from the company in Redmond.

On the other hand some people might appreciate the possibility of quickly hiding a foot- or endnote. To me this makes only sense when not using automatic numbering, as otherwise a number is missing with the document. In this way you could quickly get reprints with and without a certain commentary. 

So maybe there is a possibility to satisfy everybody by offering an option in form of a checkbox within the footnote/endnote settings (Menu->Tools->Footnotes/Endnotes...) wether the foot- or endnote should be hidden together with the anchor.

But I am aware that changing such a complex software like libreoffice is very difficult. 

Best wishes 

Comment 7 Werner Johann 2015-01-19 13:28:55 UTC Comment hidden (obsolete)
Comment 8 Werner Johann 2015-08-26 07:55:41 UTC
The bug is still present in:
Build-ID: 81898c9f5c0d43f3473ba111d7b351050be20261

Is there no hope to get this problem fixed?
Comment 9 Stefan 2015-09-03 22:17:42 UTC
Werner, this IMPROVEMENT is desirable.
Maybe the gods of coding will stand by you ;)
Comment 10 Werner Johann 2015-11-03 18:32:24 UTC
The following source files contain "HideFootnotes"


Maybe somebody, who knows something about coding could have a look at it.

I don't know wether this is connected to bug 54393.

Please could somebody help!!!!!!!!!!!!!!!!!!!

Comment 11 Werner Johann 2015-11-04 08:12:17 UTC
An otption, whether foot- or endnotes should be hidden together with the corresponding anchor, might be added to the menu at: "Tools-Options-LibreOffice Writer-Compatibility" 
e.g.: "Hide footnote/endnote together with anchor"
(German: Fussnote/Endnote gemeinsam mit Anker ausblenden)
(French: Cacher la note de page/note de fin avec l'ancre)
(Spanish: Ocultar nota al pie/nota al final junto con el ancla)

Comment 12 Werner Johann 2015-11-04 08:38:29 UTC
Comment 11 was a suggestion, how compatibility with files exploiting the present behavior of LibreOffice might be preserved.

Source files for corresponding translations (e.g. German):
Comment 13 Werner Johann 2015-11-04 09:28:35 UTC
This should be added to source file list at Comment 11:

Comment 14 Werner Johann 2015-11-04 09:46:33 UTC
This should be added to source file list at Comment 10:

Comment 15 Werner Johann 2018-02-05 17:01:10 UTC
The problem is still present in Version:
Build-ID: 92a7159f7e4af62137622921e809f8546db437e5
Comment 16 Justin L 2018-02-08 12:35:48 UTC
Comment 10 and comment 14 are good code pointers, showing that footnotes within a range of hidden text are intentionally hidden.

Stepping back and looking at the big picture - normally if a paragraph is hidden, you would want any attached things like comments or footnotes to also hidden. So the concept in general makes sense. Rarely would anyone hide only a footnote anchor in order to hide a footnote.

It would be rather difficult to specify an exception clause for this.  One possible clause could be that if the hidden range contains only anchor character and spaces, then don't hide the footnote. However, this kind of "black box" implementation I'm sure would be frowned on.

 bool SwHiddenTextPortion::Format( SwTextFormatInfo &rInf )
    const OUString sHidden = rInf.GetText().copy(rInf.GetIdx(), GetLen());
    bool bShowFootEndnotes = true;
    for (int i=0; i < sHidden.getLength(); ++i)
        if ( sHidden[i] != 1 && sHidden[i] != ' ' )
            bShowFootEndnotes = false;
     Width( 0 );
    if ( !bShowFootEndnotes )
        rInf.GetTextFrame()->HideFootnotes( rInf.GetIdx(), rInf.GetIdx() + GetLen() );
     return false;

For some reason, upon loading the document, the footnote is still hidden, even with this change. Also, the field shaping isn't hidden.

I'm a bug fixer, not a developer, so I don't expect to continue much further on this bug. There already is a right-click window for footnotes - perhaps an invisible flag could be added to hide the anchor.
Comment 17 Justin L 2018-03-19 12:19:53 UTC
>For some reason, upon loading the document, the footnote is still hidden,
>even with this change.
A little more work on this bug re-enforces that this is too complicated for me to handle.  A total hack that lets the footnote section to appear on document load is sw/source/core/text/itrform2.cxx:

@@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
         sal_Int32 nEnd = rInf.GetIdx();
         if ( ::lcl_BuildHiddenPortion( rInf, nEnd ) )
+        {
+            if ( rInf.GetChar( rInf.GetIdx() ) == CH_TXTATR_BREAKWORD )
+            {
+                /*pPor =*/ NewExtraPortion( rInf );
+            }
             pPor = new SwHiddenTextPortion( nEnd - rInf.GetIdx() );
+        }
Comment 18 Werner Johann 2018-04-22 08:46:00 UTC
Dear Justin L.,
thanks for your efforts. 

Microsoft Word doesn't hide the footnotes/endnotes even if one hides the whole paragraph containing the anchor. You have to hide all notes separately and in case that all notes at one page should be hidden, you manually have to hide the footnote separator in an extra step. So Microsoft's solution maybe is somewhat suboptimal too, but it at least allows the user to get all results, he wants. Libreoffice doesn't even offer a tedious way not to hide the note together with the anchor. There is no possibility at all.

Anyhow, if one uses automatically numbered footnotes/endnotes hiding delivers omited numbers within the numbering sequence in Libreoffice Writer and in Microsoft Word. So, apart from special case (e.g. the accurate reproduction of a historic document containing a numbering mistake) hiding the footnote together with the anchor only makes sense in case of manual symbol anchors, which are not numbered.

Although your approach, to hide the footnote only automatically together with the main text, when a larger text passage is hidden, is reasonable, it isn't easy to implement, because the length of that string can vary even if one doesn't want to hide the footnotes. For instance if I want to insert more references according to the Vancouver citing system and want to have instead of [1],[2],[3],[4],...[10] the abreviated form [1-10].
OK, 10 references at the same position may be regarded as an extrem example, but I have already seen it in some publications. 

I suggested already the implementation of an additional option (Menu->Tools->Options) where the user can choose whether the note should be hidden as in the past (of OpenOffice and Libreoffice) or should have to be hidden extra like in Microsoft Office.
(This option would imply the creation of an additional new variable for a document or a template, which is used to decide wether the notes are hidden together with anchor or not. The default [no variable defined yet] would have to be to handle it as in the past)

This of course is not just a bug fix but a new feature, which nontheless would also improve the compatibility for users changing from Microsoft to Libreoffice.