Re: refstyle and amsmath

2024-02-02 Thread Jürgen Spitzmüller
Am Freitag, dem 02.02.2024 um 11:14 -0500 schrieb Richard Kimberly
Heck:
> Should we add a note to the RELEASE-NOTES about needing an up to date
> refstyle when used with AMS?

This problem is not specific to 2.4, so I don't know.

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


Re: refstyle and amsmath

2024-02-02 Thread Richard Kimberly Heck

On 2/2/24 10:30, Jürgen Spitzmüller wrote:

Am Freitag, dem 02.02.2024 um 16:25 +0100 schrieb Kees Zeelenberg:

He has, and refstyle now works OK, also in more complicated
documents, with export both to Pdf-pdflatex and to Pdf-luatex, and
also with the autonum package.

Thanks for reporting back.


Should we add a note to the RELEASE-NOTES about needing an up to date 
refstyle when used with AMS?


Riki


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


Re: refstyle and amsmath

2024-02-02 Thread Jürgen Spitzmüller
Am Freitag, dem 02.02.2024 um 16:25 +0100 schrieb Kees Zeelenberg:
> He has, and refstyle now works OK, also in more complicated
> documents, with export both to Pdf-pdflatex and to Pdf-luatex, and
> also with the autonum package.

Thanks for reporting back.

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


RE: refstyle and amsmath

2024-02-02 Thread Kees Zeelenberg
Van: lyx-users  Namens Jürgen Spitzmüller
Verzonden: donderdag 1 februari 2024 10:22



Am Do., 1. Feb. 2024 um 08:20 Uhr schrieb Jürgen Spitzmüller :

FYI version 0.6. of refstyle, now on CTAN and soon distributed via the
package managers, will contain the fix of this issue.

 

The new version still does not completely work. I have reported it. Here is the 
needed fix of the fix:

…

Let's hope Danie takes care of this soon, as well.

 

He has, and refstyle now works OK, also in more complicated documents, with 
export both to Pdf-pdflatex and to Pdf-luatex, and also with the autonum 
package.

Thanks!

 

Kees

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


Re: refstyle and amsmath

2024-02-01 Thread Jürgen Spitzmüller
Am Do., 1. Feb. 2024 um 08:20 Uhr schrieb Jürgen Spitzmüller <
jspi...@gmail.com>:

> FYI version 0.6. of refstyle, now on CTAN and soon distributed via the
> package managers, will contain the fix of this issue.
>

The new version still does not completely work. I have reported it. Here is
the needed fix of the fix:

--- /usr/local/texlive/2019/texmf-dist/tex/latex/refstyle/refstyle.cfg
+++ /home/juergen/texmf/tex/latex/testen/refstyle.cfg
@@ -513,7 +513,7 @@
 \newcommand*{\RSeqrefform}[1]{\textup{(\ref{#1})}}
 \AddToHook{package/amsmath/after}%
 {\NewCommandCopy\AMSeqref\eqref
- \RS@removedef{eqref}}%
+ \DeclareRobustCommand\eqref{\relax}}%
 \newref{eq}{%
name  = \RSeqtxt,
names = \RSeqstxt,

Let's hope Danie takes care of this soon, as well.


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


Re: refstyle and amsmath

2024-01-31 Thread Jürgen Spitzmüller
Am Mittwoch, dem 31.01.2024 um 08:34 +0100 schrieb Jürgen Spitzmüller:
> Am Dienstag, dem 30.01.2024 um 22:26 -0500 schrieb Richard Kimberly
> Heck:
> > Maybe if he knew this was causing specific problems for us, he'd go
> > ahead and fix it.
> 
> He just responded that he intends to do it already today.

FYI version 0.6. of refstyle, now on CTAN and soon distributed via the
package managers, will contain the fix of this issue.

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


Re: refstyle and amsmath

2024-01-30 Thread Jürgen Spitzmüller
Am Dienstag, dem 30.01.2024 um 22:26 -0500 schrieb Richard Kimberly
Heck:
> Maybe if he knew this was causing specific problems for us, he'd go
> ahead and fix it.

He just responded that he intends to do it already today.

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


Re: refstyle and amsmath

2024-01-30 Thread Jürgen Spitzmüller
Am Mittwoch, dem 31.01.2024 um 07:05 +0100 schrieb Jürgen Spitzmüller:
> Am Dienstag, dem 30.01.2024 um 22:26 -0500 schrieb Richard Kimberly
> Heck:
> > > I would just ping him, most likely he just got busy with other
> > > stuff.
> > 
> > I'd be happy to write him, if someone has an email address. Maybe
> > if
> > he knew this was causing specific problems for us, he'd go ahead
> > and
> > fix it. The patch looked good to me.
> 
> Yes, I am going to ping him today.

Done. For reference, here is the revised patch I proposed. This works
independent of the loading order of amsmath and refstyle.

Also attached, for convenience, a patched version of refstyle.cfg which
you can store in your personal TEXMF tree until refstyle is fixed.

-- 
Jürgen
%%
%% This is file `refstyle.cfg',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% refconfig.dtx  (with options: `cfg')
%% 
%% ---
%% The refstyle package
%% for the formatting of references
%% ---
%% This file may be  customized to suit specific user requirements.
%% 
%% Original by Danie Els 
%% ---
%% 
\ProvidesFile{refstyle.cfg}[2010/11/02\space
0.5\space
Configuration file for refstyle (DNJ Els)]
%%-- ENGLISH 
\newcommand\RSukenglish{%
\def\RSrngtxt{\space to~}%... Range: figures 5 to 6
\def\RSlsttwotxt{\space and~}%... List two:  figures 5 and 6
\def\RSlsttxt{, and~}%... List more: figures 5, 6, and 7
\def\RSparttxt{Part~}%... Part lowercase singular
\def\RSpartstxt{Parts~}%.  lowercase plural
\def\RSParttxt{Part~}%...  uppercase singular (sentence start)
\def\RSPartstxt{Parts~}%.  uppercase plural   (sentence start)
\def\RSappendixname{appendix~}%.. Appendix lowercase singular
\def\RSappendicesname{appendices~}%..  lowercase plural
\def\RSAppendixname{Appendix~}%..  uppercase singular (sentence start)
\def\RSAppendicesname{Appendices~}%..  uppercase plural   (sentence start)
\def\RSchaptername{chapter~}% Chapter  lowercase singular
\def\RSchaptersname{chapters~}%..  lowercase plural
\def\RSChaptername{Chapter~}%  uppercase singular (sentence start)
\def\RSChaptersname{Chapters~}%..  uppercase plural   (sentence start)
\def\RSsectxt{section~}%. Section  lowercase singular
\def\RSsecstxt{sections~}%...  lowercase plural
\def\RSSectxt{Section~}%.  uppercase singular (sentence start)
\def\RSSecstxt{Sections~}%...  uppercase plural   (sentence start)
\def\RSeqtxt{equation~}%. Equation lowercase singular
\def\RSeqstxt{equations~}%...  lowercase plural
\def\RSEqtxt{Equation~}%.  uppercase singular (sentence start)
\def\RSEqstxt{Equations~}%...  uppercase plural   (sentence start)
\def\RSfigtxt{figure~}%.. Figure   lowercase singular
\def\RSfigstxt{figures~}%  lowercase plural
\def\RSFigtxt{Figure~}%..  uppercase singular (sentence start)
\def\RSFigstxt{Figures~}%  uppercase plural   (sentence start)
\def\RStabtxt{table~}%... Tablelowercase singular
\def\RStabstxt{tables~}%.  lowercase plural
\def\RSTabtxt{Table~}%...  uppercase singular (sentence start)
\def\RSTabstxt{Tables~}%.  uppercase plural   (sentence start)
\def\RSfootntxt{footnote~}%.. Footnote lowercase singular
\def\RSfootnstxt{footnotes~}%  lowercase plural
\def\RSFootntxt{Footnote~}%..  uppercase singular (sentence start)
\def\RSFootnstxt{Footnotes~}%  uppercase plural   (sentence start)
}
\newcommand\RSenglish{%
\def\RSrngtxt{\space to~}%
\def\RSlsttwotxt{\space and~}%
\def\RSlsttxt{\space and~}%
\def\RSparttxt{Part~}%
\def\RSpartstxt{Parts~}%
\def\RSParttxt{Part~}%
\def\RSPartstxt{Parts~}%
\def\RSappendixname{appendix~}%
\def\RSappendicesname{appendices~}%
\def\RSAppendixname{Appendix~}%
\def\RSAppendicesname{Appendices~}%
\def\RSchaptername{chapter~}%
\def\RSchaptersname{chapters~}%
\def\RSChaptername{Chapter~}%
\def\RSChaptersname{Chapters~}%
\def\RSsectxt{section~}%
\def\RSsecstxt{sections~}%
\def\RSSectxt{Section~}%
\def\RSSecstxt{Sections~}%
\def\RSeqtxt{equation~}%
\def\RSeqstxt{equations~}%
\def\RSEqtxt{Equation~}%
   

Re: refstyle and amsmath

2024-01-30 Thread Jürgen Spitzmüller
Am Dienstag, dem 30.01.2024 um 22:26 -0500 schrieb Richard Kimberly
Heck:
> > I would just ping him, most likely he just got busy with other
> > stuff.
> 
> I'd be happy to write him, if someone has an email address. Maybe if
> he knew this was causing specific problems for us, he'd go ahead and
> fix it. The patch looked good to me.

Yes, I am going to ping him today.

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


Re: refstyle and amsmath

2024-01-30 Thread Richard Kimberly Heck

On 1/30/24 15:10, Pavel Sanda wrote:

On Tue, Jan 30, 2024 at 06:42:23PM +0100, Jürgen Spitzmüller wrote:

Am Dienstag, dem 30.01.2024 um 18:17 +0100 schrieb Jürgen Spitzmüller:

I reported this to the maintainer in March 2023 and even sent a patch [2] but 
never got a response.

I have to correct myself. Danie responded that he will have a look. So
it is possible that this will be fixed in refstyle eventually.

I would just ping him, most likely he just got busy with other stuff.


I'd be happy to write him, if someone has an email address. Maybe if he 
knew this was causing specific problems for us, he'd go ahead and fix 
it. The patch looked good to me.


Riki


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


Re: refstyle and amsmath

2024-01-30 Thread Pavel Sanda
On Tue, Jan 30, 2024 at 06:42:23PM +0100, Jürgen Spitzmüller wrote:
> Am Dienstag, dem 30.01.2024 um 18:17 +0100 schrieb Jürgen Spitzmüller:
> > I reported this to the maintainer in March 2023 and even sent a patch
> > [2] but never got a response.
> 
> I have to correct myself. Danie responded that he will have a look. So
> it is possible that this will be fixed in refstyle eventually.

I would just ping him, most likely he just got busy with other stuff.

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


Re: refstyle and amsmath

2024-01-30 Thread Jürgen Spitzmüller
Am Dienstag, dem 30.01.2024 um 12:30 -0500 schrieb Richard Kimberly
Heck:
> I guess we need to do something like that for 2.4?

I can have a look tomorrow.

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


Re: refstyle and amsmath

2024-01-30 Thread Jürgen Spitzmüller
Am Dienstag, dem 30.01.2024 um 18:17 +0100 schrieb Jürgen Spitzmüller:
> I reported this to the maintainer in March 2023 and even sent a patch
> [2] but never got a response.

I have to correct myself. Danie responded that he will have a look. So
it is possible that this will be fixed in refstyle eventually.

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


Re: refstyle and amsmath

2024-01-30 Thread Richard Kimberly Heck

On 1/30/24 12:17, Jürgen Spitzmüller wrote:

Am Montag, dem 29.01.2024 um 15:00 +0100 schrieb Kees Zeelenberg:

Some time ago there was a discussion on the list about refstyle in
combination with amsmath, leading to error messages from refstyle. It
appears refstyle is now loaded after amsmath, but this now leads to
messages like “LaTeX Warning: Reference `ab' on page 1 undefined on
input line 39” from the enclosed LyX file ‘testref.lyx’.

The loading order has not been changed, and it also doesn't matter (as
a view into refstyle.sty reveals). The warning is also in LyX 2.3.x,
although it is less prominent (the heightening of prominence was done
in purpose for 2.4, since you will want to be informed about broken
references).


It seems that this is related to the LaTeX line
“\AtBeginDocument{\providecommand\eqref[1]{\ref{eq:#1}}}”, which is
added by LyX in ‘testref.tex’. This line does not have any effect, so
that e.g. \eqref{ab}  is interpreted as \ref{ab}  instead of
\ref{eq:ab}.

This is by design as well. This definition gets only active in case
\eqref is undefined, hence \providecommand.


Replacing this line with
\AtBeginDocument{\DeclareRobustCommand{\eqref}[1]{\textup{\tagform@{\
ref{eq:#1} (as in amsmath), the LaTeX file ‘testref_robust.tex’
compiles without problems.

Yes, but this is not the right fix as it will break the refstyle
integration with equation references.

The problem here is that refstyle attempts to overwrite and integrate
amsmath's \eqref definition into its own \eqref definition. This does
not work anymore since \eqref has been made robust in the 2022-06-01
release of amsmath [1], and the command copying and redefinition
refstyle used (via \let) does not work with robust commands.
\NewCommandCopy needs to be used instead of \let.

Ultimately, this needs to be fixed in refstyle. I reported this to the
maintainer in March 2023 and even sent a patch [2] but never got a
response. It seems the package is factually unmaintained.

We can check for the respective amsmath version and patch into refstyle
ourselves in LyX.


I guess we need to do something like that for 2.4?

Riki


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


Re: refstyle and amsmath

2024-01-30 Thread Jürgen Spitzmüller
Am Montag, dem 29.01.2024 um 15:00 +0100 schrieb Kees Zeelenberg:
> Some time ago there was a discussion on the list about refstyle in
> combination with amsmath, leading to error messages from refstyle. It
> appears refstyle is now loaded after amsmath, but this now leads to
> messages like “LaTeX Warning: Reference `ab' on page 1 undefined on
> input line 39” from the enclosed LyX file ‘testref.lyx’. 

The loading order has not been changed, and it also doesn't matter (as
a view into refstyle.sty reveals). The warning is also in LyX 2.3.x,
although it is less prominent (the heightening of prominence was done
in purpose for 2.4, since you will want to be informed about broken
references).

> It seems that this is related to the LaTeX line
> “\AtBeginDocument{\providecommand\eqref[1]{\ref{eq:#1}}}”, which is
> added by LyX in ‘testref.tex’. This line does not have any effect, so
> that e.g. \eqref{ab}  is interpreted as \ref{ab}  instead of
> \ref{eq:ab}. 

This is by design as well. This definition gets only active in case
\eqref is undefined, hence \providecommand.

> Replacing this line with
> \AtBeginDocument{\DeclareRobustCommand{\eqref}[1]{\textup{\tagform@{\
> ref{eq:#1} (as in amsmath), the LaTeX file ‘testref_robust.tex’
> compiles without problems.

Yes, but this is not the right fix as it will break the refstyle
integration with equation references.

The problem here is that refstyle attempts to overwrite and integrate
amsmath's \eqref definition into its own \eqref definition. This does
not work anymore since \eqref has been made robust in the 2022-06-01
release of amsmath [1], and the command copying and redefinition
refstyle used (via \let) does not work with robust commands.
\NewCommandCopy needs to be used instead of \let.

Ultimately, this needs to be fixed in refstyle. I reported this to the
maintainer in March 2023 and even sent a patch [2] but never got a
response. It seems the package is factually unmaintained.

We can check for the respective amsmath version and patch into refstyle
ourselves in LyX. Long term, I think we should abandon refstyle and go
for another package (cleveref or zref-clever).

Best,
Jürgen

[1] See
https://github.com/latex3/latex2e/commit/7c1184dc800f8902f279103660f118e5a82e62b0#diff-94ab1b0d7fdf9c2f8420be553012d86a5a18e3d4ab139512d12773b6e5228efdR2697-R2699

[2] this is the fix

--- /usr/local/texlive/current/texmf-
dist/tex/latex/refstyle/refstyle.cfg
+++ /home/juergen/texmf/tex/latex/testen/refstyle.cfg
@@ -512,7 +512,8 @@
 %%-- TEMPLATE FOR EQUATIONS -
 \newcommand*{\RSeqrefform}[1]{\textup{(\ref{#1})}}
 \@ifpackageloaded{amsmath}%
-   {\let\AMSeqref\eqref
+   {\DeclareCommandCopy\AMSeqref\eqref
+\DeclareRobustCommand\eqref{\relax}
 \let\eqref\relax}%
{}
 \newref{eq}{%
@@ -528,8 +529,8 @@
 \let\eqref\relax
 \AtBeginDocument{%
\@ifpackageloaded{amsmath}%
-  {\RS@ifundefined{AMSeqref}{\let\AMSeqref\eqref}{}%
-   \let\RSeqrefform\AMSeqref}%
+
{\RS@ifundefined{AMSeqref}{\DeclareCommandCopy\AMSeqref\eqref}{}%
+   \DeclareCommandCopy\RSeqrefform\AMSeqref}%
  {}%
  \let\eqref=\RSeqref
}


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