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

Expand to $ and $$ in Latex #61

Open
excetara2 opened this issue Mar 29, 2016 · 4 comments
Open

Expand to $ and $$ in Latex #61

excetara2 opened this issue Mar 29, 2016 · 4 comments

Comments

@excetara2
Copy link

Was there a reason expanding to inline math symbols $ and $$ was left out or can it be added in easily? This I think would be a very useful expansion for the latex plugin.

@excetara2 excetara2 changed the title Expand to $ and $$ Expand to $ and $$ in Latex Mar 29, 2016
@r-stein
Copy link
Collaborator

r-stein commented Mar 29, 2016

The main reason is, that I did not thought about it. However it is not as trivial as it might look like in the current state, because expansions are on the plain string without scope selectors considered. This has the advantage, that it can be tested with a build server, but we cannot use the information of being inside math or outside math. Obviously this information is very important to decide whether to expand or not to $.

With #57 we get the ability to change the behavior according to scopes and after pulling #59 it will be easier to change the behavior, but harder to test and fix user errors.

A single line support for $ is relatively easy to establish, but full support will only be added after merging that PR.

@excetara2
Copy link
Author

I am assuming the below won't work properly (or something along those lines) and I guess a math environment has to be defined to properly scope is what your saying?

"auto_complete_triggers": [ { "characters": "$", "selector": "text.latex" } ]

Mainly I just want the current math environment I am in to be selected (usually just inline math like this $W_s$ that would be really useful). Then it is easy to cut/copy and move elsewhere. Is that what you mean by single line support and how can I add this in?

@r-stein
Copy link
Collaborator

r-stein commented Mar 29, 2016

I mean, we cannot use the scopes defined by the syntax file. This approach is for example used by BracketHighlighter. There the scope boundaries (start and end of the yellow math highlighting) can be used to extract the surrounding brackets.

I made a pull request #62 to support $..$, which works if the opening $ and the closing $ are in the same line (single line). Hence you can just wait until it is merged.

@excetara2
Copy link
Author

Okay I get it.

Yeah the opening and closing for the in-line math $ delimiters usually are but for $$ support I guess that will have to wait. $ is mainly what I was after so thanks.

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