In TexStudio, when I make a diagram with TikZ and use the matrix of math nodes
option, it doesn't register that it's supposed to look like math mode... so it ends up having a bunch of highlighting for "wrong syntax" everywhere. For instance, in the text below, the &
, \times
, and ^
are all highlighted because everything registers as normal text.
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix(m)[matrix of math nodes]
{ A & B\times B' \\
C^n & D \\};
\end{tikzpicture}
\end{document}
So it ends up looking like this:
instead of something more like this (my settings make math bolded):
You might ask, "Couldn't you just surround the diagram with math delimiters?" But that doesn't seem quite right... and in fact I am also asking this question because I'm using a package (based on the diagrams
package I think) which defines a new environment using such a TikZ matrix, and it breaks if you add extra delimiters for some reason I haven't figured out. Why is this highlighting occurring, and how do I get rid of it?