Re: [LyX/master] Fix handling of \int with external math tools

2025-04-29 Thread Richard Kimberly Heck

On 4/29/25 3:07 AM, Jean-Marc Lasgouttes wrote:

Le 21/04/2025 à 12:57, Jean-Marc Lasgouttes a écrit :

Le 21/04/2025 à 12:54, Jean-Marc Lasgouttes a écrit :

commit 0ed7820843d2b4dd09240d6e6145ddb013d090b8
Author: Jean-Marc Lasgouttes 
Date:   Mon Apr 21 12:53:34 2025 +0200

 Fix handling of \int with external math tools


Riki, this is candidate for branch.


Riki, the request still holds. However, it was a wise move not to 
answer earlier, since now we know that the commit below is needed too :)


OK?


Yes, go ahead.

I just missed that one, sorry.

Riki


--
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Fix handling of \int with external math tools

2025-04-29 Thread Jean-Marc Lasgouttes

Le 21/04/2025 à 12:57, Jean-Marc Lasgouttes a écrit :

Le 21/04/2025 à 12:54, Jean-Marc Lasgouttes a écrit :

commit 0ed7820843d2b4dd09240d6e6145ddb013d090b8
Author: Jean-Marc Lasgouttes 
Date:   Mon Apr 21 12:53:34 2025 +0200

 Fix handling of \int with external math tools


Riki, this is candidate for branch.


Riki, the request still holds. However, it was a wise move not to answer 
earlier, since now we know that the commit below is needed too :)


OK?

JMarc

commit 5c5b248356b73bd99d51af835c71f430bce41213
Author: Jean-Marc Lasgouttes 
Date:   Wed Apr 23 16:53:23 2025 +0200

Fixup 0ed78208: avoid crash with XHTML export.

Since \int is a macro and the real symbol is \intop, give this as
symbol name in InsetMathExInt. Moreover, make this class more robust
to the int vs intop thing.
--
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Fix handling of \int with external math tools

2025-04-23 Thread Scott Kostyshak
On Wed, Apr 23, 2025 at 04:57:35PM +0200, Jean-Marc Lasgouttes wrote:
> Le 22/04/2025 à 11:49, Scott Kostyshak a écrit :
> > I think this commit broke something with the XHTML export.
> > 
> > The following ctest now fails:
> > 
> >export/doc/UserGuide_xhtml (Failed)
> 
> 
> Is it better now?

Yes, looks good!

Thanks,
Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Fix handling of \int with external math tools

2025-04-23 Thread Jean-Marc Lasgouttes

Le 22/04/2025 à 11:49, Scott Kostyshak a écrit :

I think this commit broke something with the XHTML export.

The following ctest now fails:

   export/doc/UserGuide_xhtml (Failed)



Is it better now?

JMarc
--
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Fix handling of \int with external math tools

2025-04-23 Thread Scott Kostyshak
On Tue, Apr 22, 2025 at 12:46:13PM +0200, Scott Kostyshak wrote:
> On Tue, Apr 22, 2025 at 12:33:56PM +0200, Jean-Marc Lasgouttes wrote:
> > Le 22 avril 2025 11:49:32 GMT+02:00, Scott Kostyshak  a 
> > écrit :
> > >On Mon, Apr 21, 2025 at 10:54:17AM +, Jean-Marc Lasgouttes wrote:
> > >> commit 0ed7820843d2b4dd09240d6e6145ddb013d090b8
> > >> Author: Jean-Marc Lasgouttes 
> > >> Date:   Mon Apr 21 12:53:34 2025 +0200
> > >> 
> > >> Fix handling of \int with external math tools
> > >> ---
> > >>  src/mathed/MathExtern.cpp | 7 +++
> > >>  1 file changed, 3 insertions(+), 4 deletions(-)
> > >> 
> > >> diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp
> > >> index caa05aeadc..c8c5acf00e 100644
> > >> --- a/src/mathed/MathExtern.cpp
> > >> +++ b/src/mathed/MathExtern.cpp
> > >> @@ -292,7 +292,7 @@ bool testString(MathAtom const & at, char const * 
> > >> const str)
> > >>  
> > >>  bool testSymbol(MathAtom const & at, docstring const & name)
> > >>  {
> > >> -return at->asSymbolInset() && at->asSymbolInset()->name() == 
> > >> name;
> > >> +return (at->asSymbolInset() || at->asMacro()) && at->name() == 
> > >> name;
> > >>  }
> > >>  
> > >>  
> > >> @@ -373,9 +373,8 @@ void splitScripts(MathData & ar)
> > >>  
> > >>  if (script->nuc().size() == 1) {
> > >>  // leave alone sums and integrals
> > >> -InsetMathSymbol const * sym =
> > >> -script->nuc().front()->asSymbolInset();
> > >> -if (sym && (sym->name() == "sum" || sym->name() 
> > >> == "int"))
> > >> +MathAtom const & atom = script->nuc().front();
> > >> +if (testSymbol(atom, "sum") || testSymbol(atom, 
> > >> "int"))
> > >>  continue;
> > >>  }
> > >
> > >I think this commit broke something with the XHTML export.
> > >
> > >The following ctest now fails:
> > >
> > >  export/doc/UserGuide_xhtml (Failed)
> > >
> > >I don't know what the specific error is but I can figure it out and give
> > >more details tomorrow when I'm at my computer with the ctests set up.
> > >
> > >Scott
> > 
> > Thanks for the heads up. This is just an html export, right ?
> 
> Yes, correct.

The following gives a SIGSEGV:

  lyx -e xhtml UserGuide.lyx

Can you reproduce? I attach a backtrace just in case.

Scott
Program received signal SIGSEGV, Segmentation fault.
std::__cxx11::basic_string, 
std::allocator >::_M_data (this=0x80)
at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:223
223   { return _M_dataplus._M_p; }
(gdb) bt
#0  std::__cxx11::basic_string, 
std::allocator >::_M_data (this=0x80)
at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:223
#1  0x556dca25 in std::__cxx11::basic_string, std::allocator >::begin (this=0x80)
at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/basic_string.h:965
#2  0x561dd6a9 in lyx::operator== (l=, r=0x56225e42 "mathord")
at /home/scott/lyxbuilds/master-master/repo/src/support/docstring.cpp:175
#3  0x55b9a9f9 in lyx::latexkeys::mathml_type[abi:cxx11]() const 
(this=0x0) at 
/home/scott/lyxbuilds/master-master/repo/src/mathed/MathParser.cpp:2148
#4  0x55c0165d in lyx::InsetMathSymbol::mathmlize (this=0x7ffee1b8, 
ms=...) at 
/home/scott/lyxbuilds/master-master/repo/src/mathed/InsetMathSymbol.cpp:162
#5  0x55bdcb15 in lyx::InsetMathExInt::mathmlize (this=0x5794b3f0, 
ms=...) at 
/home/scott/lyxbuilds/master-master/repo/src/mathed/InsetMathExInt.cpp:142
#6  0x55bb61d9 in lyx::operator<< (ms=..., at=...) at 
/home/scott/lyxbuilds/master-master/repo/src/mathed/MathStream.cpp:651
#7  0x55b825b7 in lyx::mathmlize (dat=..., ms=...) at 
/home/scott/lyxbuilds/master-master/repo/src/mathed/MathExtern.cpp:1643
#8  0x55bb620d in lyx::operator<< (ms=..., ar=...) at 
/home/scott/lyxbuilds/master-master/repo/src/mathed/MathStream.cpp:658
#9  0x55b30a63 in lyx::InsetMathHull::mathmlize (this=0x56fbd1a0, 
ms=...) at 
/home/scott/lyxbuilds/master-master/repo/src/mathed/InsetMathHull.cpp:2569
#10 0x55b32d1d in lyx::InsetMathHull::xhtml[abi:cxx11](lyx::XMLStream&, 
lyx::OutputParams const&) const (this=0x56fbd1a0, xs=..., op=...)
at 
/home/scott/lyxbuilds/master-master/repo/src/mathed/InsetMathHull.cpp:2680
#11 0x55983b5d in 
lyx::Paragraph::simpleLyXHTMLOnePar[abi:cxx11](lyx::Buffer const&, 
lyx::XMLStream&, lyx::OutputParams const&, lyx::Font const&, bool, bool, long) 
const (
this=0x5709aa70, buf=..., xs=..., runparams=..., outerfont=..., 
start_paragraph=false, close_paragraph=false, initial=0)
at /home/scott/lyxbuilds/master-master/repo/src/Paragraph.cpp:4227
#12 0x55aefdbd in lyx::(anonymous namespace)::makeParagraphs (buf=..., 
xs=..., runparams

Re: [LyX/master] Fix handling of \int with external math tools

2025-04-22 Thread Scott Kostyshak
On Tue, Apr 22, 2025 at 12:33:56PM +0200, Jean-Marc Lasgouttes wrote:
> Le 22 avril 2025 11:49:32 GMT+02:00, Scott Kostyshak  a 
> écrit :
> >On Mon, Apr 21, 2025 at 10:54:17AM +, Jean-Marc Lasgouttes wrote:
> >> commit 0ed7820843d2b4dd09240d6e6145ddb013d090b8
> >> Author: Jean-Marc Lasgouttes 
> >> Date:   Mon Apr 21 12:53:34 2025 +0200
> >> 
> >> Fix handling of \int with external math tools
> >> ---
> >>  src/mathed/MathExtern.cpp | 7 +++
> >>  1 file changed, 3 insertions(+), 4 deletions(-)
> >> 
> >> diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp
> >> index caa05aeadc..c8c5acf00e 100644
> >> --- a/src/mathed/MathExtern.cpp
> >> +++ b/src/mathed/MathExtern.cpp
> >> @@ -292,7 +292,7 @@ bool testString(MathAtom const & at, char const * 
> >> const str)
> >>  
> >>  bool testSymbol(MathAtom const & at, docstring const & name)
> >>  {
> >> -  return at->asSymbolInset() && at->asSymbolInset()->name() == name;
> >> +  return (at->asSymbolInset() || at->asMacro()) && at->name() == name;
> >>  }
> >>  
> >>  
> >> @@ -373,9 +373,8 @@ void splitScripts(MathData & ar)
> >>  
> >>if (script->nuc().size() == 1) {
> >>// leave alone sums and integrals
> >> -  InsetMathSymbol const * sym =
> >> -  script->nuc().front()->asSymbolInset();
> >> -  if (sym && (sym->name() == "sum" || sym->name() == 
> >> "int"))
> >> +  MathAtom const & atom = script->nuc().front();
> >> +  if (testSymbol(atom, "sum") || testSymbol(atom, "int"))
> >>continue;
> >>}
> >
> >I think this commit broke something with the XHTML export.
> >
> >The following ctest now fails:
> >
> >  export/doc/UserGuide_xhtml (Failed)
> >
> >I don't know what the specific error is but I can figure it out and give
> >more details tomorrow when I'm at my computer with the ctests set up.
> >
> >Scott
> 
> Thanks for the heads up. This is just an html export, right ?

Yes, correct.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Fix handling of \int with external math tools

2025-04-22 Thread Jean-Marc Lasgouttes
Le 22 avril 2025 11:49:32 GMT+02:00, Scott Kostyshak  a écrit 
:
>On Mon, Apr 21, 2025 at 10:54:17AM +, Jean-Marc Lasgouttes wrote:
>> commit 0ed7820843d2b4dd09240d6e6145ddb013d090b8
>> Author: Jean-Marc Lasgouttes 
>> Date:   Mon Apr 21 12:53:34 2025 +0200
>> 
>> Fix handling of \int with external math tools
>> ---
>>  src/mathed/MathExtern.cpp | 7 +++
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>> 
>> diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp
>> index caa05aeadc..c8c5acf00e 100644
>> --- a/src/mathed/MathExtern.cpp
>> +++ b/src/mathed/MathExtern.cpp
>> @@ -292,7 +292,7 @@ bool testString(MathAtom const & at, char const * const 
>> str)
>>  
>>  bool testSymbol(MathAtom const & at, docstring const & name)
>>  {
>> -return at->asSymbolInset() && at->asSymbolInset()->name() == name;
>> +return (at->asSymbolInset() || at->asMacro()) && at->name() == name;
>>  }
>>  
>>  
>> @@ -373,9 +373,8 @@ void splitScripts(MathData & ar)
>>  
>>  if (script->nuc().size() == 1) {
>>  // leave alone sums and integrals
>> -InsetMathSymbol const * sym =
>> -script->nuc().front()->asSymbolInset();
>> -if (sym && (sym->name() == "sum" || sym->name() == 
>> "int"))
>> +MathAtom const & atom = script->nuc().front();
>> +if (testSymbol(atom, "sum") || testSymbol(atom, "int"))
>>  continue;
>>  }
>
>I think this commit broke something with the XHTML export.
>
>The following ctest now fails:
>
>  export/doc/UserGuide_xhtml (Failed)
>
>I don't know what the specific error is but I can figure it out and give
>more details tomorrow when I'm at my computer with the ctests set up.
>
>Scott

Thanks for the heads up. This is just an html export, right ?

JMarc 
-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Fix handling of \int with external math tools

2025-04-22 Thread Scott Kostyshak
On Mon, Apr 21, 2025 at 10:54:17AM +, Jean-Marc Lasgouttes wrote:
> commit 0ed7820843d2b4dd09240d6e6145ddb013d090b8
> Author: Jean-Marc Lasgouttes 
> Date:   Mon Apr 21 12:53:34 2025 +0200
> 
> Fix handling of \int with external math tools
> ---
>  src/mathed/MathExtern.cpp | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp
> index caa05aeadc..c8c5acf00e 100644
> --- a/src/mathed/MathExtern.cpp
> +++ b/src/mathed/MathExtern.cpp
> @@ -292,7 +292,7 @@ bool testString(MathAtom const & at, char const * const 
> str)
>  
>  bool testSymbol(MathAtom const & at, docstring const & name)
>  {
> - return at->asSymbolInset() && at->asSymbolInset()->name() == name;
> + return (at->asSymbolInset() || at->asMacro()) && at->name() == name;
>  }
>  
>  
> @@ -373,9 +373,8 @@ void splitScripts(MathData & ar)
>  
>   if (script->nuc().size() == 1) {
>   // leave alone sums and integrals
> - InsetMathSymbol const * sym =
> - script->nuc().front()->asSymbolInset();
> - if (sym && (sym->name() == "sum" || sym->name() == 
> "int"))
> + MathAtom const & atom = script->nuc().front();
> + if (testSymbol(atom, "sum") || testSymbol(atom, "int"))
>   continue;
>   }

I think this commit broke something with the XHTML export.

The following ctest now fails:

  export/doc/UserGuide_xhtml (Failed)

I don't know what the specific error is but I can figure it out and give
more details tomorrow when I'm at my computer with the ctests set up.

Scott


signature.asc
Description: PGP signature
-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel


Re: [LyX/master] Fix handling of \int with external math tools

2025-04-21 Thread Jean-Marc Lasgouttes

Le 21/04/2025 à 12:54, Jean-Marc Lasgouttes a écrit :

commit 0ed7820843d2b4dd09240d6e6145ddb013d090b8
Author: Jean-Marc Lasgouttes 
Date:   Mon Apr 21 12:53:34 2025 +0200

 Fix handling of \int with external math tools


Riki, this is candidate for branch.

JMarc



---
  src/mathed/MathExtern.cpp | 7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp
index caa05aeadc..c8c5acf00e 100644
--- a/src/mathed/MathExtern.cpp
+++ b/src/mathed/MathExtern.cpp
@@ -292,7 +292,7 @@ bool testString(MathAtom const & at, char const * const str)
  
  bool testSymbol(MathAtom const & at, docstring const & name)

  {
-   return at->asSymbolInset() && at->asSymbolInset()->name() == name;
+   return (at->asSymbolInset() || at->asMacro()) && at->name() == name;
  }
  
  
@@ -373,9 +373,8 @@ void splitScripts(MathData & ar)
  
  		if (script->nuc().size() == 1) {

// leave alone sums and integrals
-   InsetMathSymbol const * sym =
-   script->nuc().front()->asSymbolInset();
-   if (sym && (sym->name() == "sum" || sym->name() == 
"int"))
+   MathAtom const & atom = script->nuc().front();
+   if (testSymbol(atom, "sum") || testSymbol(atom, "int"))
continue;
}
  


--
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel