Latex possible bug?

Messages in english

Modérateur : xcasadmin

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Latex possible bug?

Message par XcasEngGuy » sam. sept. 17, 2022 8:16 pm

It appears that xcas is no longer putting in the parenthesis around the argument in sin:

The xcas entry:
Capture_20220917-160659.jpg
Capture_20220917-160659.jpg (26.48 Kio) Consulté 1553 fois
produces:
Capture_20220917-160659.jpg
Capture_20220917-160659.jpg (26.48 Kio) Consulté 1553 fois
\(\left[\begin{array}{c}a=\mathrm{str2}\cdot \sin \mathrm{ang}\\b=\mathrm{str2}\cdot \cos \mathrm{ang}\end{array}\right]
\)


From:
% Generated by xcas
\documentclass{article}
\usepackage{pst-plot,color}
\usepackage{graphicx}
\begin{document}
\noindent \framebox{1} {\tt eq1:=[[a=(str2*sin(ang))],] } \\
\begin{equation} \label{eq:0}
\left[\begin{array}{c}a=\mathrm{str2}\cdot \sin \mathrm{ang}\\b=\mathrm{str2}\cdot \cos \mathrm{ang}\end{array}\right]
\end{equation}
\noindent \framebox{2} {\tt } \\

\end{document}
Pièces jointes
Clipboard01.jpg
Clipboard01.jpg (6.1 Kio) Consulté 1552 fois
Clipboard01.jpg
Clipboard01.jpg (6.1 Kio) Consulté 1553 fois

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex possible bug?

Message par XcasEngGuy » sam. sept. 17, 2022 8:23 pm

My post got corrupted somehow, hope you can understand it. I was not able to edit it.

Matt

parisse
Messages : 5731
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Latex possible bug?

Message par parisse » mar. sept. 20, 2022 3:00 pm

It seems it is a question for Luka.
Note that you can run

Code : Tout sélectionner

latex("legacy",1)
in your session before converting to latex, this should switch to my old latex code with parenthesis around the argument.

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex possible bug?

Message par XcasEngGuy » mer. sept. 21, 2022 6:05 pm

Thanks. That helps but it breaks some of my recent tweaks using perl scripts to change diff(x(t),t,2), for example, to a more textboox style:

\(\frac{d2\left(\text{y(t)}\right)}{\mathrm{dt2}}=\frac{4 \sqrt{10} \frac{d2\left(x(t)\right)}{\mathrm{dt2}} \sqrt{x\left(t\right)}^{-1}}{2}-4 \sqrt{10} \frac{1}{2} \frac{d\left(\text{x(t)}\right)}{\mathrm{dt}} \frac{1}{2} \frac{d\left(\text{x(t)}\right)}{\mathrm{dt}} \sqrt{x\left(t\right)}^{-1} x\left(t\right)^{-1}
\)

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex possible bug?

Message par XcasEngGuy » mer. sept. 21, 2022 6:11 pm

Even better (added tweak):

\(\frac{d^{2}\left(\text{y(t)}\right)}{\mathrm{dt^{2}}}=4 \sqrt{10} \frac{d^{2}\left(x(t)\right)}{\mathrm{dt^{2}}} \frac{\sqrt{x\left(t\right)}^{-1}}{2}-4 \sqrt{10} \frac{1}{2} \frac{d^{}\left(\text{x(t)}\right)}{\mathrm{dt^{}}} \frac{1}{2} \frac{d^{}\left(\text{x(t)}\right)}{\mathrm{dt^{}}} \sqrt{x\left(t\right)}^{-1} x\left(t\right)^{-1}\)

From:
Capture_20220921-141219.jpg
Capture_20220921-141219.jpg (16.96 Kio) Consulté 1488 fois

lukamar
Messages : 331
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

Re: Latex possible bug?

Message par lukamar » sam. sept. 24, 2022 1:35 am

New latex conversion omits parentheses when applying functions to simple arguments like e.g. x. I will add an additional condition that the argument must be a one-letter symbol, which should make the output better (one-letter symbols are typeset in italic, so removing parentheses wouldn't affect readability).

XcasEngGuy
Messages : 145
Inscription : mer. janv. 13, 2010 3:20 pm

Re: Latex possible bug?

Message par XcasEngGuy » dim. sept. 25, 2022 6:29 pm

Sounds good, Thanks

Répondre