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

Syntax issue in defining shortcuts for \begin or \end. #76

Open
coccoinomane opened this issue Feb 16, 2014 · 1 comment
Open

Syntax issue in defining shortcuts for \begin or \end. #76

coccoinomane opened this issue Feb 16, 2014 · 1 comment

Comments

@coccoinomane
Copy link

Dear all,

In my field of research (physics) many authors define the following shortcuts in their Latex files:

\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}

From the point of view of Latex, these shortcuts are perfectly legit, but alas they break down Textmate syntax highlighting. In fact, any text written after the first line is parsed as if being in math mode. This happens because Textmate finds an opening of math mode (\begin{equation}) but it cannot parse the corresponding ending (\end{equation}).

Thank you for your attention.
Cheers,
Guido

@ciandorr
Copy link

A good fix for issues like this one, which I have also encountered, would be to change the LaTeX grammar so that many of the LaTeX additions to the basic TeX grammar are invoked only between the "\begin{document}" and "\end{document}" environments. In particular, the special significance of \begin and \end only applies within the "document" environment - any '\begin' and '\end' that occurs anywhere else will almost certainly be part of the definition of some command or environment, which means that it will be surrounded by braces as in {\begin{equation}}.

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

3 participants