After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 691758 - unreferenced labels should not be highlight as warnings
unreferenced labels should not be highlight as warnings
Status: RESOLVED FIXED
Product: gedit-latex
Classification: Core
Component: General
git master
Other All
: Normal normal
: ---
Assigned To: José Aliste
Gedit maintainers
: 679614 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-01-15 01:48 UTC by Carnë Draug
Modified: 2019-02-22 03:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix (1.73 KB, patch)
2013-01-15 18:18 UTC, Carnë Draug
accepted-commit_now Details | Review
fancyref commands to defaults patch (425 bytes, patch)
2013-01-17 13:48 UTC, Aleksei Lissitsin
none Details | Review

Description Carnë Draug 2013-01-15 01:48:24 UTC
The latex plugin will highlight labels that are still unreferenced as warnings. While this may good, the problem is that is not always possible to know when the label is actually referenced, specially since \ref{} is not the only method to do so. I use the memoir class which also allows to reference with \fref.

This can be fixed with line 89 of the file latex/latex/validator.py which issues an "unused" label as SEVERITY_WARNING. This block already has a FIXME note. As I don't believe this is reason to act, I just commented the line. If permission is given I can push this change.

If not, I'm guessing it would also be possible to add alternative reference commands but we never know what some exotic classes are out there, and some of those commands only work for figures or sections.

This is specially annoying for me, because together with bug #691757, I can't read the labels.
Comment 1 Carnë Draug 2013-01-15 02:50:21 UTC
Actually, the whole for loop needs to be commented, not only that line.
Comment 2 Carnë Draug 2013-01-15 03:00:24 UTC
Actually, the whole for loop needs to be commented, not only that line. That line was the only one inside the loop that did anything anyway.
Comment 3 Carnë Draug 2013-01-15 18:18:49 UTC
Created attachment 233539 [details] [review]
proposed fix

here's the changeset I mentioned after discussion with nacho on IRC
Comment 4 Carnë Draug 2013-01-15 18:46:09 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 5 Aleksei Lissitsin 2013-01-17 13:47:31 UTC
I do not like the above patch. I, personally, do not have any problem with unused label highlighting and really liked the feature.

Moreover, the easy fix for the reporter's problem is simply to add fref and Fref to REF_CMDS set on line 139 of latex/latex/model.py.

Yes, ideally there could be a dynamic way to add more commands. But fancyref is pretty much a standard nowadays, so adding its ref commands to defaults should be a fine solution.

I opt for reverting the previous patch and applying the following one.
Comment 6 Aleksei Lissitsin 2013-01-17 13:48:52 UTC
Created attachment 233671 [details] [review]
fancyref commands to defaults patch
Comment 7 Carnë Draug 2013-01-20 15:52:52 UTC
Actually, the proposed patch does not solve my problem at all.

I use \fref for referencing pictures because of the memoir class, not the fancyref package. It would fix my problem if the patch also added \tref, \Aref and \Sref (there's even more in the class that I don't use) but I don't think that's the way to go. By looking at data/latex.xml (line 967) I'd guess that the developer of the plugin would also disagree as he seemed to consider the cleveref package the most standard. I'm sure there are other classes and packages (some publishers require you use their own class which has its own ref commands), not counting with the new commands that a user may write himself. It's just not possible to actually know if the label as been referenced. The only way I can think of would be to give users an option menu with a list of possible commands (this could also be used to extend the list of commands that cause a drop down menu with a list of labels).

By the way, the list of REF_CMDS is repeated on latex/latex/model.py and latex/outline.py.

Finally, there's nothing wrong with an unreferenced label. Nothing bad comes from it so it makes no sense to highlight it as a warning. While writing, I create labels for sections as I start them, before I know if they are going to be used at all. This is no reason for a warning. Not even the LaTeX compilers will warn about unreferenced labels, you'll need external packages for this (package is named refcheck).

Depending on the style you are using, the warning background might be just a light yellow on white. If you're using oblivion, that light yellow makes impossible to actually read the text which is very annoying (see bug #691757).
Comment 8 Carnë Draug 2013-03-07 11:38:39 UTC
*** Bug 679614 has been marked as a duplicate of this bug. ***