Question: Wrong Latex generated when using _C1 for constants of integration. Any work around?

This is some serious problem in Latex in Maple 2024.1

I went back to using _C1, _C2 for my own constants of integration.

But I want to get the nice latex for c__1,c__2.

So to do that, my understanding is that I just need to call Maple's dsolve after restart on some random ode in order to set c__1,c__2 for display only and also for latex.

This below seems to confirm this.  But now the latex generated is all wrong and messed up on some places. 

My question is: I want to use use _C1,_C2 (i.e. the traditional constants) in my own code I write which generates solution to an ode, but for Latex, I'd like these to come out as c__1,c__2 since they look nicer.

What is the correct way to do this? What Am I doing wrong here? I do not see it.

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

#EXAMPLE showing using _C1 for input and latex. All works OK
restart;

sol:=y(x) = x+_C1/x^2;

y(x) = x+_C1/x^2

#correct latex. No problem compiling, but not nice looking _C1
latex(sol)

y \! \left(x \right) = x +\frac{\textit{\_C1}}{x^{2}}

#Example showing what happens when making call to dsolve initially
restart;

dsolve(diff(y(x),x$2)=0); #this call is used to just activate display of nicer constants

y(x) = c__1*x+c__2

sol:=y(x) = x+_C1/x^2;

y(x) = x+c__1/x^2

#bad latex, gives error when compiling with texlive
latex(sol)

y \! \left(x \right) = x +\frac{c}{_}

 

 

Download latex_problem_maple_2024_july_18_2024.mw

And to confirm this is new problem in Maple 2024, I run the same exact worksheet now in Maple 2023.2, and there it works correctly. i.e. Latex generated is correct in both cases. Here is the Maple 2023.2 worksheet, you can see below the difference in Latex.

interface(version);

`Standard Worksheet Interface, Maple 2023.2, Windows 10, November 24 2023 Build ID 1762575`

#EXAMPLE showing using _C1 for input and latex. All works OK
restart;

38296

sol:=y(x) = x+_C1/x^2;

y(x) = x+_C1/x^2

#correct latex. No problem compiling, but not nice looking _C1
latex(sol)

y \! \left(x \right) = x +\frac{\textit{\_C1}}{x^{2}}

#Example showing what happens when making call to dsolve initially
restart;

38296

dsolve(diff(y(x),x$2)=0); #this call is used to just activate display of nicer constants

y(x) = c__1*x+c__2

sol:=y(x) = x+_C1/x^2;

y(x) = x+c__1/x^2

#good Latex now in Maple 2023.2.
latex(sol)

y \! \left(x \right) = x +\frac{c_{1}}{x^{2}}

 

 

Download latex_problem_maple_2023.2.mw

If it makes any difference to Maple, I am using the typesetting EXTENDED now for everything. But I do not think Latex should care about this, but thought to mention it just in case.

Please Wait...