Re: Customization ctests now failing on master

2023-08-15 Thread Jürgen Spitzmüller
Am Samstag, dem 12.08.2023 um 12:47 +0200 schrieb Jürgen Spitzmüller:
> > Another possible patch attached
> 
> Yes, this is neat, but I wanted to avoid changing the package loading
> order if not absolutely necessary.

I came back to this because I like its simplicity and went ahead
implementing a variant that maintains the loading order.

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


Re: Customization ctests now failing on master

2023-08-13 Thread Jürgen Spitzmüller
Am Sonntag, dem 13.08.2023 um 16:38 +0200 schrieb Jean-Pierre Chrétien:
> I think that there are not many prettyref users in general, since
> refstyle is much more powerful.

Not sure about that. Personally, I never got warm with refstyle and
still prefer prettyref (also due to its simplicity).

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


Re: Customization ctests now failing on master

2023-08-13 Thread Jean-Pierre Chrétien

Le 12/08/2023 à 12:43, Jürgen Spitzmüller a écrit :



I think the approach is sane enough. Since we haven't heard many
reports about this bug recently, the case seems to be rather seldom (I
suppose French users avoid prettyref).



Thanks for solving this issue, Jürgen.
I think that there are not many prettyref users in general, since refstyle is 
much more powerful.


--
Jean-Pierre

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


Re: Customization ctests now failing on master

2023-08-12 Thread Jürgen Spitzmüller
Am Samstag, dem 12.08.2023 um 12:18 +0300 schrieb Udicoudco:
> 
> Another possible patch attached

Yes, this is neat, but I wanted to avoid changing the package loading
order if not absolutely necessary.

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


Re: Customization ctests now failing on master

2023-08-12 Thread Jürgen Spitzmüller
Am Freitag, dem 11.08.2023 um 23:11 +0300 schrieb Udicoudco:
> Jürgen, your code should work, you just forgot
> to  change the category code of @.
> See the patch prettyref-detokenize.patch.

Ouch %-/ Thanks!

> But I think we should note it could potentially
> change the behaviour of the package, If you'll
> export the file newfile1.lyx after applying prettyref-
> detokenize.patch,
> you will get different results if the language of the document
>  is english or french.

I see. Yes, this is an issue to consider.

> I propose a different approach. see the patch prettyref.patch.

So let's go with this one.

> I'm not sure what is the best way to stream strings into the latex
> source, so feel free to change things, and if you have the patience
> to explain what I should have done, I'll appreciate it :)

I think the approach is sane enough. Since we haven't heard many
reports about this bug recently, the case seems to be rather seldom (I
suppose French users avoid prettyref).

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


Re: Customization ctests now failing on master

2023-08-12 Thread Udicoudco
On Fri, Aug 11, 2023 at 11:11 PM Udicoudco  wrote:
> I propose a different approach. see the patch prettyref.patch.

Another possible patch attached

>  lyx-devel mailing list
>  lyx-devel@lists.lyx.org
>  http://lists.lyx.org/mailman/listinfo/lyx-devel
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 0e678ea62a..457d7236ac 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -1107,7 +1107,6 @@ char const * simplefeatures[] = {
 	"pifont",
 	// subfig is handled in BufferParams.cpp
 	"varioref",
-	"prettyref",
 	"refstyle",
 	/*For a successful cooperation of the `wrapfig' package with the
 	  `float' package you should load the `wrapfig' package *after*
@@ -1286,10 +1285,16 @@ string const LaTeXFeatures::getPackages() const
 
 	// Babel languages with activated colon (such as French) break
 	// with prettyref. Work around that.
-	if (!runparams_.isFullUnicode() && useBabel()
-	&& mustProvide("prettyref") && contains(getActiveChars(), ':')) {
-		packages << "% Make prettyref compatible with babel active colon\n"
-			 << "\\def\\prettyref#1{\\expandafter\\@prettyref\\detokenize{#1:}}\n";
+	bool const fix_prettyref = (!runparams_.isFullUnicode() && useBabel()
+	&& contains(getActiveChars(), ':'));
+
+	if (mustProvide("prettyref")) {
+		if (fix_prettyref)
+			packages << "% Make prettyref compatible with babel active colon\n"
+ << "\\edef\\LyXFixForPrettyRef{\\the\\catcode`:}\\catcode`:=13\n";
+		packages << "\\usepackage{prettyref}\n";
+		if (fix_prettyref)
+			packages << "\\catcode`:=\\LyXFixForPrettyRef\\relax\n";
 	}
 
 	if (mustProvide("changebar")) {
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Customization ctests now failing on master

2023-08-11 Thread Udicoudco
On Fri, Aug 11, 2023 at 8:09 PM Jürgen Spitzmüller  wrote:
>
> Am Freitag, dem 11.08.2023 um 17:39 +0200 schrieb Jürgen Spitzmüller:
> > Should be fixed now.
>
> Not yet. It does compile, but the references are broken.

Jürgen, your code should work, you just forgot
to  change the category code of @.
See the patch prettyref-detokenize.patch.

But I think we should note it could potentially
change the behaviour of the package, If you'll
export the file newfile1.lyx after applying prettyref-detokenize.patch,
you will get different results if the language of the document
 is english or french.

I propose a different approach. see the patch prettyref.patch.
I'm not sure what is the best way to stream strings into the latex source,
so feel free to change things, and if you have the patience to explain
what I should have done, I'll appreciate it :)

> lyx-devel mailing list
> lyx-devel@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-devel
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 0e678ea62a..ffddef2b85 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -1289,7 +1289,9 @@ string const LaTeXFeatures::getPackages() const
 	if (!runparams_.isFullUnicode() && useBabel()
 	&& mustProvide("prettyref") && contains(getActiveChars(), ':')) {
 		packages << "% Make prettyref compatible with babel active colon\n"
-			 << "\\def\\prettyref#1{\\expandafter\\@prettyref\\detokenize{#1:}}\n";
+			 << "\\makeatletter\n"
+			 << "\\def\\prettyref#1{\\expandafter\\@prettyref\\detokenize{#1:}}\n"
+			 << "\\makeatother\n";
 	}
 
 	if (mustProvide("changebar")) {
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 0e678ea62a..6c53e19e23 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -1289,7 +1289,18 @@ string const LaTeXFeatures::getPackages() const
 	if (!runparams_.isFullUnicode() && useBabel()
 	&& mustProvide("prettyref") && contains(getActiveChars(), ':')) {
 		packages << "% Make prettyref compatible with babel active colon\n"
-			 << "\\def\\prettyref#1{\\expandafter\\@prettyref\\detokenize{#1:}}\n";
+			"\\bgroup\n"
+			"\\makeatletter\n"
+			"\\catcode`:=13\n"
+			"\\gdef\\prettyref#1{\\@prettyref#1:}\n"
+			"\\gdef\\@prettyref#1:#2:{%\n"
+			" 	\\expandafter\\ifx\\csname pr@#1\\endcsname\\relax\n"
+			"		\\PackageWarning{prettyref}{Reference format #1\\space undefined}%\n"
+			"		\\ref{#1:#2}%\n"
+			"	\\else\n"
+			"		\\csname pr@#1\\endcsname{#1:#2}%\n"
+			"	\\fi}\n"
+			"\\egroup\n";
 	}
 
 	if (mustProvide("changebar")) {


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


Re: Customization ctests now failing on master

2023-08-11 Thread Udicoudco
On Fri, Aug 11, 2023 at 8:09 PM Jürgen Spitzmüller  wrote:
>
> Am Freitag, dem 11.08.2023 um 17:39 +0200 schrieb Jürgen Spitzmüller:
> > Should be fixed now.
>
> Not yet. It does compile, but the references are broken. I'll see if I

I think

   \def\prettyref#1{\expandafter\@prettyref\expanded{#1\string:}}

will give correct results

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


Re: Customization ctests now failing on master

2023-08-11 Thread Scott Kostyshak
On Fri, Aug 11, 2023 at 07:08:34PM +0200, Jürgen Spitzmüller wrote:
> Am Freitag, dem 11.08.2023 um 17:39 +0200 schrieb Jürgen Spitzmüller:
> > Should be fixed now.
> 
> Not yet. It does compile,

Indeed the tests pass now.

> but the references are broken. I'll see if I
> can fix that. Otherwise, I'll revert.

Sounds good, thanks.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Customization ctests now failing on master

2023-08-11 Thread Jürgen Spitzmüller
Am Freitag, dem 11.08.2023 um 17:39 +0200 schrieb Jürgen Spitzmüller:
> Should be fixed now.

Not yet. It does compile, but the references are broken. I'll see if I
can fix that. Otherwise, I'll revert.

-- 
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: Customization ctests now failing on master

2023-08-11 Thread Jürgen Spitzmüller
Am Freitag, dem 11.08.2023 um 10:56 -0400 schrieb Scott Kostyshak:
> Thanks for taking a look,

Should be fixed now.

-- 
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: Customization ctests now failing on master

2023-08-11 Thread Scott Kostyshak
On Fri, Aug 11, 2023 at 04:36:20PM +0200, Jürgen Spitzmüller wrote:
> Am Freitag, dem 11.08.2023 um 07:56 -0400 schrieb Scott Kostyshak:
> > I get the following:
> > 
> >   export/doc/Customization_lyx22 (Failed)
> >   export/doc/Customization_lyx23 (Failed)
> >   export/doc/Customization_dvi (Failed)
> >   export/doc/Customization_pdf (Failed)
> >   DEFAULTOUTPUT_export/doc/Customization_pdf2 (Failed)
> >   export/doc/Customization_pdf3 (Failed)
> 
> This is due to the French word Théorème used in the docs. French
> activates : which doesn't work with prettyref.
> 
> I thought we fixed this, but apparently we didn't.
> 
> I'll have a look.

Thanks for taking a look,
Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Customization ctests now failing on master

2023-08-11 Thread Scott Kostyshak
On Fri, Aug 11, 2023 at 03:29:58PM +0100, José Matos wrote:
> On Fri, 2023-08-11 at 07:56 -0400, Scott Kostyshak wrote:
> > I get the following:
> > 
> >   export/doc/Customization_lyx22 (Failed)
> >   export/doc/Customization_lyx23 (Failed)
> >   export/doc/Customization_dvi (Failed)
> >   export/doc/Customization_pdf (Failed)
> >   DEFAULTOUTPUT_export/doc/Customization_pdf2 (Failed)
> >   export/doc/Customization_pdf3 (Failed)
> > 
> > Scott
> 
> I was curious on how to look into these tests.
> Are those coming from https://gitlab.com/scottkosty/lyx-tester?
> 
> BTW, if that is the case there is a funny typo in README:
> "a full installation of TeX Live 2013"

Ha, thanks! Fixed.

> This requirement will be hard to fill nowadays. :-D

The tests do not need lyx-tester. lyx-tester is mainly for me (although
if anyone is interested, let me know) to go from a clean install of
Ubuntu to a test environment that satisfies all of the dependencies of
all of the tests.

The tests are documented in Development.lyx.

The tests are handled by ctest, which means you need to build with
CMake. The following should do it:

  cmake -DLYX_ENABLE_EXPORT_TESTS=ON . && make && ctest -R "Customization"

Alternatively, in this case you can reproduce manually by opening the
Customization manual and compiling.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Re: Customization ctests now failing on master

2023-08-11 Thread Jürgen Spitzmüller
Am Freitag, dem 11.08.2023 um 07:56 -0400 schrieb Scott Kostyshak:
> I get the following:
> 
>   export/doc/Customization_lyx22 (Failed)
>   export/doc/Customization_lyx23 (Failed)
>   export/doc/Customization_dvi (Failed)
>   export/doc/Customization_pdf (Failed)
>   DEFAULTOUTPUT_export/doc/Customization_pdf2 (Failed)
>   export/doc/Customization_pdf3 (Failed)

This is due to the French word Théorème used in the docs. French
activates : which doesn't work with prettyref.

I thought we fixed this, but apparently we didn't.

I'll have a look.

-- 
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: Customization ctests now failing on master

2023-08-11 Thread Jürgen Spitzmüller
Am Freitag, dem 11.08.2023 um 07:56 -0400 schrieb Scott Kostyshak:
> I get the following:
> 
>   export/doc/Customization_lyx22 (Failed)
>   export/doc/Customization_lyx23 (Failed)
>   export/doc/Customization_dvi (Failed)
>   export/doc/Customization_pdf (Failed)
>   DEFAULTOUTPUT_export/doc/Customization_pdf2 (Failed)
>   export/doc/Customization_pdf3 (Failed)

-- 
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: Customization ctests now failing on master

2023-08-11 Thread José Matos
On Fri, 2023-08-11 at 07:56 -0400, Scott Kostyshak wrote:
> I get the following:
> 
>   export/doc/Customization_lyx22 (Failed)
>   export/doc/Customization_lyx23 (Failed)
>   export/doc/Customization_dvi (Failed)
>   export/doc/Customization_pdf (Failed)
>   DEFAULTOUTPUT_export/doc/Customization_pdf2 (Failed)
>   export/doc/Customization_pdf3 (Failed)
> 
> Scott

I was curious on how to look into these tests.
Are those coming from https://gitlab.com/scottkosty/lyx-tester?

BTW, if that is the case there is a funny typo in README:
"a full installation of TeX Live 2013"

This requirement will be hard to fill nowadays. :-D

Best regards,
-- 
José Abílio
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel


Customization ctests now failing on master

2023-08-11 Thread Scott Kostyshak
I get the following:

  export/doc/Customization_lyx22 (Failed)
  export/doc/Customization_lyx23 (Failed)
  export/doc/Customization_dvi (Failed)
  export/doc/Customization_pdf (Failed)
  DEFAULTOUTPUT_export/doc/Customization_pdf2 (Failed)
  export/doc/Customization_pdf3 (Failed)

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel