Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-16 Thread Pavel Sanda
On Sat, Mar 14, 2020 at 09:46:22AM +0100, Jürgen Spitzmüller wrote:
> Am Freitag, den 13.03.2020, 16:45 +0100 schrieb Jürgen Spitzmüller:
> > A major problem with this is that it breaks
> > 
> > 1. children stand-alone compiling if they have references to siblings
> > or their master
> > 
> > 2. multi-part documents compiled with "includeonly" and "maintain
> > counters and references: no" that contain references to excluded
> > children
> > 
> > I think this is a central use-case which is basically defunc'ed with
> > this change.
> 
> I mitigated this problem now: If a reference is reported as unknown, we
> check whether it exists in the master or a sibling. If so, we do not
> error (the references are still warned about in the log).

Thanks for taking the compromise approach. Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Joel Kulesza


> On Mar 14, 2020, at 08:39, Jürgen Spitzmüller  wrote:
> 
> Am Samstag, den 14.03.2020, 08:25 -0600 schrieb Joel Kulesza:
>> One thing that's been on my mind for a while is coloring the broken
>> elements differently than default; however, it was not clear to me
>> how to achieve that in a straightforward way.
> 
> I've done this as well. See
> https://www.lyx.org/trac/ticket/11503
> 
> Jürgen

Awesome, thank you again!

Joel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Jürgen Spitzmüller
Am Samstag, den 14.03.2020, 08:25 -0600 schrieb Joel Kulesza:
> One thing that's been on my mind for a while is coloring the broken
> elements differently than default; however, it was not clear to me
> how to achieve that in a straightforward way.

I've done this as well. See
https://www.lyx.org/trac/ticket/11503

Jürgen


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Joel Kulesza
On Sat, Mar 14, 2020 at 8:19 AM Jürgen Spitzmüller  wrote:

> Am Samstag, den 14.03.2020, 14:29 +0100 schrieb Daniel:
> > > How about a dedicated outliner entry "Broken citations and
> > > references"?
> > > This would be easiest to implement, and it would give you both a
> > > quick
> > > report and the possibility to navigate to the broken insets
> > > quickly.
> > >
> > > Jürgen
> >
> > Yes, I think that would be helpful.
>
> Implemented in master.
>

This is awesome, thank you!  Seeing this information before the PDF is
created is excellent.  One thing that's been on my mind for a while is
coloring the broken elements differently than default; however, it was not
clear to me how to achieve that in a straightforward way.

Thanks again,
Joel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Jürgen Spitzmüller
Am Samstag, den 14.03.2020, 14:29 +0100 schrieb Daniel:
> > How about a dedicated outliner entry "Broken citations and
> > references"?
> > This would be easiest to implement, and it would give you both a
> > quick
> > report and the possibility to navigate to the broken insets
> > quickly.
> > 
> > Jürgen
> 
> Yes, I think that would be helpful.

Implemented in master.

Jürgen


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Jürgen Spitzmüller
Am Samstag, den 14.03.2020, 14:29 +0100 schrieb Daniel:
> Yes, I think that would be helpful. In particular if some broken 
> references would be classified as such that currently aren't. For 
> example, visible references to hidden labels 
> (https://www.lyx.org/trac/ticket/11782). 

This seems to have been fixed in master already.

> On the other hand, there are 
> some that are currently classified only as in the work area BROKEN
> that 
> I wouldn't want to see there, e.g. hidden broken references (those
> in 
> notes).

It would be easy to omit these in this outliner section.

Jürgen

> 
> Daniel
> 
> 


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Daniel

On 2020-03-14 11:20, Jürgen Spitzmüller wrote:

Am Samstag, den 14.03.2020, 10:04 +0100 schrieb Daniel:

Great. (Just for reference: This was part of the suggestions of the
rest
of my post.) I think that would be helpful.


I know. I just cut it for readability.


However, depending on how large the document and how many sub-
documents
there are, it might still be asking too much that the user should
scroll
through all those documents. So, some kind of comprehensive
reporting
could still be helpful.


How about a dedicated outliner entry "Broken citations and references"?
This would be easiest to implement, and it would give you both a quick
report and the possibility to navigate to the broken insets quickly.

Jürgen


Yes, I think that would be helpful. In particular if some broken 
references would be classified as such that currently aren't. For 
example, visible references to hidden labels 
(https://www.lyx.org/trac/ticket/11782). On the other hand, there are 
some that are currently classified only as in the work area BROKEN that 
I wouldn't want to see there, e.g. hidden broken references (those in 
notes).


Daniel


--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Jürgen Spitzmüller
Am Samstag, den 14.03.2020, 10:04 +0100 schrieb Daniel:
> Great. (Just for reference: This was part of the suggestions of the
> rest 
> of my post.) I think that would be helpful.

I know. I just cut it for readability.

> However, depending on how large the document and how many sub-
> documents 
> there are, it might still be asking too much that the user should
> scroll 
> through all those documents. So, some kind of comprehensive
> reporting 
> could still be helpful.

How about a dedicated outliner entry "Broken citations and references"?
This would be easiest to implement, and it would give you both a quick
report and the possibility to navigate to the broken insets quickly.

Jürgen


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Daniel

On 2020-03-14 09:32, Jürgen Spitzmüller wrote:

Am Samstag, den 14.03.2020, 09:13 +0100 schrieb Daniel:

For me, incorrect references are basically the only point where
using
LyX/LaTeX is worse than a WYSIWYG word processor because in the
letter
you are able to more easily spot them in context. Broken and wrongly
formatted references are one my major source of handing out mistaken
documents. So, every help I can get to recognize those is very
welcome.


We could easily color undefined references in the workarea. This would
be easily detectable and would not annoy people who use documents in
different output routes (or want to work on subdocuments standalone).


Great. (Just for reference: This was part of the suggestions of the rest 
of my post.) I think that would be helpful.


However, depending on how large the document and how many sub-documents 
there are, it might still be asking too much that the user should scroll 
through all those documents. So, some kind of comprehensive reporting 
could still be helpful.


Daniel

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Jürgen Spitzmüller
Am Freitag, den 13.03.2020, 16:45 +0100 schrieb Jürgen Spitzmüller:
> A major problem with this is that it breaks
> 
> 1. children stand-alone compiling if they have references to siblings
> or their master
> 
> 2. multi-part documents compiled with "includeonly" and "maintain
> counters and references: no" that contain references to excluded
> children
> 
> I think this is a central use-case which is basically defunc'ed with
> this change.

I mitigated this problem now: If a reference is reported as unknown, we
check whether it exists in the master or a sibling. If so, we do not
error (the references are still warned about in the log).

Jürgen


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Jürgen Spitzmüller
Am Samstag, den 14.03.2020, 09:13 +0100 schrieb Daniel:
> For me, incorrect references are basically the only point where
> using 
> LyX/LaTeX is worse than a WYSIWYG word processor because in the
> letter 
> you are able to more easily spot them in context. Broken and wrongly 
> formatted references are one my major source of handing out mistaken 
> documents. So, every help I can get to recognize those is very
> welcome.

We could easily color undefined references in the workarea. This would
be easily detectable and would not annoy people who use documents in
different output routes (or want to work on subdocuments standalone).

Jürgen


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-14 Thread Daniel

On 2020-03-13 17:31, Jürgen Spitzmüller wrote:

Am Freitag, den 13.03.2020, 17:11 +0100 schrieb Daniel:

I am not sure what you mean by "defunc'ed", but doesn't the patch
"let
users see the results anyway"?


Yes, but if you have clicked this each time you want to update your
preview for only a few times, you'll see that this is not a workable
solution.


Alternatively, maybe there could be a setting for the reporting
level?
Or, maybe reporting could be silenced the two cases you mention?


Or the feature could be reverted. If there is just an opt-out, I think
many users will simply be overtaxed. If we keep the feature, I'd vote
for making it opt-in.


For me, incorrect references are basically the only point where using 
LyX/LaTeX is worse than a WYSIWYG word processor because in the letter 
you are able to more easily spot them in context. Broken and wrongly 
formatted references are one my major source of handing out mistaken 
documents. So, every help I can get to recognize those is very welcome.


I didn't even know that there were warnings in the log when references 
are broken. To make the user aware of the fact that there are such would 
be very helpful, I think.


I don't know how the "let users see the results anyway" is implemented. 
If I would have to click on "Show Output Anyway" in the log dialog, that 
might be a bit taxing. However, if the log just showed up in addition to 
the output that seems fine to me. It might be nice if there where a 
summary about the errors and warnings somewhere in the log dialog, such as


"0 errors, 30 warnings (3 missing citations, 2 broken references)".

An additional extremely helpful cue when scrolling through a document in 
the work area would be color highlighting, I think. For example, for 
missing citations and references (https://www.lyx.org/trac/ticket/11503).


Now that I think about it, since LyX is already so good at supporting 
the formatting of references, in almost 100% of all cases, a "Ref:..." 
cross-references means something has gone wrong in my document. The only 
case when I still use these references is because adding multiple 
references in a "Format:..." is still unsupported. But Riki might have 
something in the pipe for that (https://www.lyx.org/trac/ticket/10201). 
So, it would be nice if those "unspecified" references could be colored 
as well. As a default, I would suggest some yellowish color (as in the 
warning of a traffic light).


Also, if there was a default format set depending on prefix (none, tab, 
fig, eq, etc.) that would be helpful I think. Maybe one could change and 
add defaults in the settings somewhere? This format will be set when 
using Copy as Reference (https://www.lyx.org/trac/ticket/10975) and, 
maybe, when choosing a reference in the cross-reference dialog. And when 
a cross-reference does not match its default, then the inset will be 
colored (yellow by default).


Colors might be formatted through the color preferences, and hence could 
be opt-out as well.


I guess the major alternative that LyX currently has is filtering 
references in the outliner and checking them one by one.


Daniel



Jürgen



Daniel





--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-13 Thread Jürgen Spitzmüller
Am Freitag, den 13.03.2020, 17:11 +0100 schrieb Daniel:
> I am not sure what you mean by "defunc'ed", but doesn't the patch
> "let 
> users see the results anyway"?

Yes, but if you have clicked this each time you want to update your
preview for only a few times, you'll see that this is not a workable
solution.

> Alternatively, maybe there could be a setting for the reporting
> level? 
> Or, maybe reporting could be silenced the two cases you mention?

Or the feature could be reverted. If there is just an opt-out, I think
many users will simply be overtaxed. If we keep the feature, I'd vote
for making it opt-in.

Jürgen

> 
> Daniel
> 


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-13 Thread Daniel

On 2020-03-13 16:45, Jürgen Spitzmüller wrote:

Am Freitag, den 07.06.2019, 17:05 +0200 schrieb Pavel Sanda:

commit bf99ece7366ad479458b3cecb067341a3320286a
Author: Pavel Sanda 
Date:   Fri Jun 7 16:47:04 2019 +0200

 Start reporting missing citations and broken references in LaTeX
build.
 
 Now we report these in the same way as LaTeX errors (but let the

user to
 see the result anyway). It remains to be shown much is this
disturbing
 to users. Generally, ignoring these is not a good idea, because
they are
 harder to manually spot in longer documents.


A major problem with this is that it breaks

1. children stand-alone compiling if they have references to siblings
or their master

2. multi-part documents compiled with "includeonly" and "maintain
counters and references: no" that contain references to excluded
children

I think this is a central use-case which is basically defunc'ed with
this change.

Jürgen


I am not sure what you mean by "defunc'ed", but doesn't the patch "let 
users see the results anyway"?


Alternatively, maybe there could be a setting for the reporting level? 
Or, maybe reporting could be silenced the two cases you mention?


Daniel

--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2020-03-13 Thread Jürgen Spitzmüller
Am Freitag, den 07.06.2019, 17:05 +0200 schrieb Pavel Sanda:
> commit bf99ece7366ad479458b3cecb067341a3320286a
> Author: Pavel Sanda 
> Date:   Fri Jun 7 16:47:04 2019 +0200
> 
> Start reporting missing citations and broken references in LaTeX
> build.
> 
> Now we report these in the same way as LaTeX errors (but let the
> user to
> see the result anyway). It remains to be shown much is this
> disturbing
> to users. Generally, ignoring these is not a good idea, because
> they are
> harder to manually spot in longer documents.

A major problem with this is that it breaks

1. children stand-alone compiling if they have references to siblings
or their master

2. multi-part documents compiled with "includeonly" and "maintain
counters and references: no" that contain references to excluded
children

I think this is a central use-case which is basically defunc'ed with
this change.

Jürgen


signature.asc
Description: This is a digitally signed message part
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2019-09-10 Thread Scott Kostyshak
On Mon, Sep 09, 2019 at 03:45:54PM -0700, Pavel Sanda wrote:
> On Sun, Sep 08, 2019 at 12:56:44PM -0400, Scott Kostyshak wrote:
> > 1. Would it be more efficient to use "prefixIs()" instead of
> > "contains()"? Are you concerned that for some older versions there is
> > white space at the beginning of the line? Since this is a new feature,
> 
> I'm not sure what exact line of code you are refering to, but in some cases
> the same err message get prepended with different strings (like "Natbib 
> Warning:")
> or similar.

Ah good to know. This answers my question.

> Given that I am aware of both prefixIs/contains routines I find
> it more likely that contains() was actually needed :)

OK.

> > 2. I think we can extend this to work with biblatex. For example,
> > currently if there is a citation of multiple keys, if one of the keys is
> > undefined, there is no error. There is no instance of "There were
> > undefined citations" in the log file. Instead, the following is in the
> > .log file:
> > 
> >Package biblatex Warning: The following entry could not be found
> >(biblatex)in the database:
> >(biblatex)abc123
> >(biblatex)Please verify the spelling and rerun
> >(biblatex)LaTeX afterwards.
> > 
> > The attached patch fixes this partly. It gives an error, but it does not
> > specify the name of the missing key in the log file. If you think you
> > can extend the patch to also report the missing key in the log file,
> > please go ahead (I'm not interested in spending more time on this at the
> > moment). Otherwise, should I at least commit this attached patch? I can
> > change the prefixIs() to contains() if you prefer.
> 
> I never worked with biblatex, so feel free to update the code any way you see
> fit.

I pushed the patch at ef6d83bc.

> If you want me to check it I would need example file(s) how to reproduce
> your scenario. In any case it's unlikely I will have time for any coding in 
> the
> forthcoming month...

I attach an MWE in case anyone wants to look into it.

Thanks for the reply and good luck with your busy month!

Scott


mwe.23.lyx
Description: application/lyx
@article{thisoneexists,
  title={My title},
  author={First Last},
  journal={The Incredible Journal},
  volume={41},
  number={2},
  pages={1081--2801},
  year={2001},
  publisher={The Publisher}
}


signature.asc
Description: PGP signature


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2019-09-09 Thread Pavel Sanda
On Sun, Sep 08, 2019 at 12:56:44PM -0400, Scott Kostyshak wrote:
> 1. Would it be more efficient to use "prefixIs()" instead of
> "contains()"? Are you concerned that for some older versions there is
> white space at the beginning of the line? Since this is a new feature,

I'm not sure what exact line of code you are refering to, but in some cases
the same err message get prepended with different strings (like "Natbib 
Warning:")
or similar. Given that I am aware of both prefixIs/contains routines I find
it more likely that contains() was actually needed :)

> 2. I think we can extend this to work with biblatex. For example,
> currently if there is a citation of multiple keys, if one of the keys is
> undefined, there is no error. There is no instance of "There were
> undefined citations" in the log file. Instead, the following is in the
> .log file:
> 
>Package biblatex Warning: The following entry could not be found
>(biblatex)in the database:
>(biblatex)abc123
>(biblatex)Please verify the spelling and rerun
>(biblatex)LaTeX afterwards.
> 
> The attached patch fixes this partly. It gives an error, but it does not
> specify the name of the missing key in the log file. If you think you
> can extend the patch to also report the missing key in the log file,
> please go ahead (I'm not interested in spending more time on this at the
> moment). Otherwise, should I at least commit this attached patch? I can
> change the prefixIs() to contains() if you prefer.

I never worked with biblatex, so feel free to update the code any way you see
fit. If you want me to check it I would need example file(s) how to reproduce
your scenario. In any case it's unlikely I will have time for any coding in the
forthcoming month...

Pavel


Re: [LyX/master] Start reporting missing citations and broken references in LaTeX build.

2019-09-08 Thread Scott Kostyshak
On Fri, Jun 07, 2019 at 05:05:20PM +0200, Pavel Sanda wrote:
> commit bf99ece7366ad479458b3cecb067341a3320286a
> Author: Pavel Sanda 
> Date:   Fri Jun 7 16:47:04 2019 +0200
> 
> Start reporting missing citations and broken references in LaTeX build.
> 
> Now we report these in the same way as LaTeX errors (but let the user to
> see the result anyway). It remains to be shown much is this disturbing
> to users. Generally, ignoring these is not a good idea, because they are
> harder to manually spot in longer documents.
> 
> The details of reported error varies because log linebreaks at 90
> induced by pdflatex make log harder to parse.
> The committed code is more robust than previous, in which some missing
> cits/refs with long keys would go unnoticed.
> 
> Tested on bibtex and natbib.
> 
> https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg208912.html

Thanks for your work on this, Pavel!

A couple of comments:

1. Would it be more efficient to use "prefixIs()" instead of
"contains()"? Are you concerned that for some older versions there is
white space at the beginning of the line? Since this is a new feature,
perhaps we could accept a 1% chance of risk that the more strict
prefixIs() would not match certain versions of output for the sake of
long-run efficiency? I don't actually know whether it is a 1% chance or
a 50% chance, but perhaps someone else has an idea. Or perhaps the
concern is related to the comments about the log breaking lines in
arbitrary places?

2. I think we can extend this to work with biblatex. For example,
currently if there is a citation of multiple keys, if one of the keys is
undefined, there is no error. There is no instance of "There were
undefined citations" in the log file. Instead, the following is in the
.log file:

   Package biblatex Warning: The following entry could not be found
   (biblatex)in the database:
   (biblatex)abc123
   (biblatex)Please verify the spelling and rerun
   (biblatex)LaTeX afterwards.

The attached patch fixes this partly. It gives an error, but it does not
specify the name of the missing key in the log file. If you think you
can extend the patch to also report the missing key in the log file,
please go ahead (I'm not interested in spending more time on this at the
moment). Otherwise, should I at least commit this attached patch? I can
change the prefixIs() to contains() if you prefer.

Scott
From ed60ad522f41e7d32697d2e67d5c1bf72f6f917d Mon Sep 17 00:00:00 2001
From: Scott Kostyshak 
Date: Sun, 8 Sep 2019 11:43:29 -0400
Subject: [PATCH] Catch undefined citations with Biblatex

This catches situations when one key in a multi-key citation is not
defined.
---
 src/LaTeX.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index 4096ca9f63..5cb5df4c78 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -781,7 +781,8 @@ int LaTeX::scanLogFile(TeXErrors & terr)
 		//TODO: TL 2020 engines will contain new commandline switch --cnf-line which we  
 		//can use to set max_print_line variable for appropriate length and detect all
 		//errors correctly.
-		if (contains(token, "There were undefined citations."))
+		if (contains(token, "There were undefined citations.") ||
+		prefixIs(token, "Package biblatex Warning: The following entry could not be found"))
 			retval |= UNDEF_CIT;
 
 		if (prefixIs(token, "LaTeX Warning:") ||
-- 
2.20.1



signature.asc
Description: PGP signature