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

Escape underscores #208

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Escape underscores #208

wants to merge 2 commits into from

Conversation

bjude
Copy link

@bjude bjude commented May 13, 2024

Overview

Add the option to not escape underscores in IdentifierConverter

Details

This allows for generating symbols with subscripts (possibly multiple layers), e.g. x_2_i becomes x_{2_{i}}. This is done by splitting the identifier on underscores, converting each 'sub-identifier' as normal, then concatenating the converted identifiers back together, separated by underscores. There is some simple logic in the concatenation to wrap the subscripts in braces to accommodate multiple layers of subscripts.

This option also creates the possibility of generating invalid latex if the identifier starts or ends with an underscore, or has a double underscore in it. In these cases we now raise a ValueError. Tests have been added exercising the new functionality, including the error path.

bjude added 2 commits May 13, 2024 09:36
This allows for generating symbols with subscripts (possibly multiple layers), e.g. `x_2_i` becomes `x_{2_{i}}`. This option also creates the possibility of generating invalid latex if the identifier starts or ends with an underscore, or has a double underscore in it. In these cases we now raise a ValueError.
@bjude bjude requested a review from odashi as a code owner May 13, 2024 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant