0

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:

annoying syntax highlighting

instead of something more like this (my settings make math bolded):

what I want instead

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?

2
  • 1
    Welcome to the TeX.SE. What is, please, your minimal complete code?
    – Sebastiano
    Feb 24, 2021 at 20:10
  • 1
    @Sebastiano Oops, sorry, I edited the original post and made the code complete! Feb 24, 2021 at 22:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.