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

support indicies #52

Closed
MAKMED1337 opened this issue Oct 17, 2022 · 4 comments · Fixed by #67
Closed

support indicies #52

MAKMED1337 opened this issue Oct 17, 2022 · 4 comments · Fixed by #67
Labels
Milestone

Comments

@MAKMED1337
Copy link

Add suppot for indicies

import math
import latexify

@latexify.with_latex
def solve(a):
	return a[0]

print(solve)

to be something like \mathrm{solve}(a) \triangleq a_0

@odashi odashi added this to the v0.2 milestone Oct 17, 2022
@odashi odashi added the feature label Oct 17, 2022
@odashi
Copy link
Collaborator

odashi commented Oct 18, 2022

I considered about some caveats by introducing this. I think there is not so large problem, except we got slices: a[x:y]. I also think we can simply raise errors when such input is given.

@MAKMED1337
Copy link
Author

What to do with a[1][2] ?

@MAKMED1337
Copy link
Author

What to do with a[1][2] ?

I think a_1_2 will be wrong because it's looks like a[12]
maybe a_{1,2} or a_{1\,2}

@odashi
Copy link
Collaborator

odashi commented Oct 19, 2022

@MAKMED1337 Ah thanks, your suggestion seems reasonable. It requires some tricky parsing over the syntax tree though: if we found a node chain of indexing, we need to convert it to a single subscript.

Furthermore we might also want some setting to keep the bracket notation as-is: $x[a][b]$ since it is also used frequently.

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

Successfully merging a pull request may close this issue.

2 participants