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


Re: Stuck between v2.4-RC1 and v2.3.7

2024-01-30 Thread Steven Paulson
Thanks for the pointer. I realized where the problem is. I just upgraded to
macOS 14.3 and have not agreed to the Xcode license. This makes python
invisible to LyX. After updating Xcode, LyX can convert OLDER versions now.

Thanks,
Yuwen

> What operating system are you using?
>
> The only reason to get that type of error is to have a mix between
different versions installed. Because RC1 has a more recent conversion tool
(lyx2lyx) and so that error should not happen.
>
> In 2.4 what do you get on Help->About LyX (I am interested in "System
directory" entry.
>
> Regards,
> --
> José Abílio
> --
> lyx-users mailing list
> lyx-users@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-users

On Mon, Jan 29, 2024 at 9:46 PM Steven Paulson 
wrote:

> Hi everyone,
>
> I recently upgraded LyX to v2.4-RC1. Previously, I was using v2.4-beta3
> without problems. However, ever since v2.4-RC1, I have failed to open all
> my LyX documents previously created under beta 3, showing me the "LyX
> cannot open OLDER version of documents" error. Right now, I cannot seem to
> locate the beta 3 installer from anywhere, so I went back to v2.3.7 from
> the official website, but got the "LyX cannot open newer versions of
> documents" error for those documents. I am stuck in between v2.4-RC1 and
> v2.3.7.
>
> I cannot understand why the newer version 2.4-RC1 cannot open an older
> version:
>
>
> ~/Documents/example.lyx is from an older version of LyX and the lyx2lyx
> script failed to convert it.
>
>
> Any help would be appreciated.
>
>
> Thanks,
>
> Steven
>
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users