-
Notifications
You must be signed in to change notification settings - Fork 391
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
Syntax definitions for Chemformula package. #2235
Comments
Seems useful to implement. From the docs it seems the following examples should give a relatively complete sense of what needs to be supported here. \ch[〈options〉]{〈input〉}
\ch[decimal-marker={,}]{3.5}
\ch[frac-style=xfrac]{3/2}
\ch{A + B ->[a] C}
\ch{ "escaped text" }
\ch{ 'escaped text' }
\ch{"\ldots\," Na + "\ldots\," Cl2 -> "\ldots\," NaCl}
\ch{ $escaped math$ }
\ch{ \(escaped math\) }
\ch{$2n$ Na + $n$ Cl2 -> $2n$ NaCl} I'll work on it when I get the time! |
Looking forward to it. Thank you! |
Can you update and test now? It may not be perfect, but I believe it should be an improvement already. |
It works perfectly, however, it does not work when chemformula is imported by chemmacros. MWE:
|
Ah, yes; if you load |
Okay, loading chemformula implicitly along with chemmacros does not seem to produce any errors, and syntax also works, so I'll take this as a win. Thank you for the quick update! Much appreciated :) |
Great. Note, I could of course load chemformula explicitly from chemmacros, but going that path would imply a huge effort if I want to support all kinds of latex package dependencies. So, instead, I think living with the minor inconvenience that we have to parse the
My pleasure; thanks for raising the issue! |
Yeah, I understand, doing that would be overkill IMO because not many packages import other packages. |
Chemformula is a comprehensive package for chemistry-related typesetting. It features a single main command:
\ch{}
.VimTeX offers a very handy function to check whether the cursor (scope?) is currently in a "mathzone". This is really useful in defining math-specific snippets. I would like to replicate this functionality with
\ch{}
.The
\ch{}
command has 2 use cases:Zinc deposition (\ch{Zn^{2+} + 2 e^{-} -> Zn}) at \SI{<-0.76}{\V}.
Describe the solution you'd like
Since
vimtex#syntax#in_mathzone()
relies on syntax definitions, I would like similar syntax definitions for\ch{}
.Describe alternatives you've considered
I have tried the following:
This works for inline
\ch
, but not within math environments.The text was updated successfully, but these errors were encountered: