Not sure when this started, and not sure why I didn't report this earlier. Open a latex file, and write an unmatched `[` (opening square bracket) after a command in math mode, i.e.: `$ a \in [0,2\pi) $`
Expected behavior: Geany/ctags/IDon'tKnow still knows that we're in math mode, so an opening bracket does not necessarily start an optional argument.
Actual behavior: the opening bracket causes *everything* after it (including the text after math mode) to be highlighted as a command argument (i.e., bold blue).
Minimal working example:
\documentclass[a4paper,parskip]{scrartcl} \usepackage[utf8]{inputenc} \usepackage{amsmath,amssymb,amsfonts}
\begin{document}
\section{Hello}
We know that $angle(x,p) \in [0,2\pi)$ must hold.
\end{document}
Essentially the newest version:
$ LC_ALL=C geany --version geany 1.27 (git >= d1fcd9f) (built on 2016-01-03 with GTK 2.24.29, GLib 2.46.2)
The bugtracker does not seem to know this issue already. If this needs forwarding to ctags/scintilla/IDon'tKnow, please do that for me.
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/859
Yes its the lexer, https://github.com/geany/geany/blob/master/scintilla/lexers/LexLaTeX.cxx#L26... which says any [ after (optional) whitespace is the start of options.
I assume latex itself gets around it because it knows the `\in` is a no-argument command, but the lexer won't know that, its purely syntax only, so I'm not sure how it can do anything different to what it is doing.
You could try reporting it to Scintilla anyway.
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/859#issuecomment-169996461
I don't know LaTeX, but I guess it could be possible to recognize some stuff can't be part of the optional arguments maybe? BTW, this is the same as SF bug https://sourceforge.net/p/geany/bugs/1087/, and is already forwarded to Scintlla as https://sourceforge.net/p/scintilla/bugs/1690/
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/859#issuecomment-170269092
I am not a Latexpurt either, but I think nearly anything can be in the [ of a command, it would be hard to find a suitable heuristic that worked enough of the time to avoid the reverse bug (arguments not highlighted :)
The solution is probably as pointed out on the Scintilla report, add a wordlist that specified no-option commands, but I think there are a lot of them, see [here](https://www.sharelatex.com/learn/List_of_Greek_letters_and_math_symbols) for some (don't forget to follow the links at the bottom for more) including `\in`.
Since the report is nearly a year old I guess anybody who can do it isn't interested in doing it.
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/issues/859#issuecomment-170292164
github-comments@lists.geany.org