I adopted the bracket notation, e.g., x[i]
, for the discrete signal x
where i
is the time index. The problem occurs in a pgfplots
figure but I figured, the syntax highlighting behavior is due to being math mode in a LaTeX command option, i.e., \begin{command}[option] ... \end{command}
.
Here is a MWE originally named demonstration.tex
which compiles correctly:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
Here, I show you a not so very interesting graph
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
xlabel=$i$,
ylabel={$x[i]$},
]
\addplot+[ycomb] plot coordinates
{
(1,1)
(2,2)
(3,1)
};
\end{axis}
\end{tikzpicture}
\caption{Example figure}
\end{figure}
\end{document}
The erroneous syntax highlighting occurs in the line with ylabel={$x[i]$}
. There, the closing bracket ]
is matched with the opening [
two lines above. Then everything after the closing $
is displayed as if in math mode.
I assume the issue can be resolved by allowing math mode in command option mode (if these are the right terms) but I wasn't able to find or comprehend the right spot in the syntax file.