Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latex representation of products #38043

Open
1 task done
BenjaminMoraga opened this issue May 21, 2024 · 2 comments
Open
1 task done

Latex representation of products #38043

BenjaminMoraga opened this issue May 21, 2024 · 2 comments

Comments

@BenjaminMoraga
Copy link

Problem Description

When writing mathematics, it is usual to denote the product $xy$ between two symbolic variables $x$ and $y$ just by concatenation; this also aplies to the product of a number and a symbolic variable like $2x$. In Sagemath, the latex representation of a product introduce a thin non-separation space between both variables, say $x\, y$ and $2\, x$, respectively. Although this is acceptable, and may be also prefered by some authors, I think there should be an easy manner to modify this behaviour. Also, I would change the default behaviour.

Proposed Solution

Add a method to latex that modifies the representation of products as matrix_delimiters change delimiters of a matrix. Also, the default behaviour should be plain concatenation.

Alternatives Considered

Add a global option that change the way products are represented.

Additional Information

No response

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
@DaveWitteMorris
Copy link
Member

Please provide code that illustrates the issue, because I am not seeing it. There is no thinspace here:

sage: x,y = var("x y")
sage: latex(x * y)
x y

Actually, I think perhaps the default should be to have thinspace because, unlike in usual mathematics, sagemath routinely allows variables to have more than one letter, e.g.:

sage: var("distance rate time")
(distance, rate, time)
sage: latex(distance == rate * time)
\mathit{distance} = \mathit{rate} \mathit{time}

I think there should be something between the two variables on the right-hand side. Probably it should be \times, but a space would be better than nothing.

@BenjaminMoraga
Copy link
Author

You are right, there is no thin space between the product of two variables. I think that behaviour is desirable, because most of the times we use one letter variables and is better for copy/paste on LaTeX source. The problem is the inconsistency with the product between an integer and a symbolic variable:

sage: latex(2*x)
2 \, x

I think that the default should be non thin space between coeficients and variables, similar to products of variables. But a function to control that representation should be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants