5

I like to pass options for a specific column (or row) in a tikzcd diagram. The obvious choice column x/.style=... does not work. I think the problem is connected with the hierarchy of styles.

Code:

\documentclass{article}
\usepackage{tikz}

\begin{document}
Does not work:
\begin{tikzcd}[column 2/.style=red]
    8 & 1 \\
    3 & 5  \\
    4 & 9  \\
\end{tikzcd}
Does work:
\begin{tikzpicture}[column 2/.style=red]
    \matrix [matrix of nodes]
    {
     8 & 1 \\
     3 & 5  \\
     4 & 9  \\
      };
 \end{tikzpicture}
\end{document}

1
  • 1
    every matrix/.append style={/tikz/column 2/.style=red} might already do it.
    – Daniel
    Dec 5, 2014 at 16:09

1 Answer 1

3
+50
\documentclass{article}
\usepackage{tikz-cd}

\begin{document}
\emph{Does} work:
\begin{tikzcd}[/tikz/column 2/.style=red]
    8 & 1 \\
    3 & 5  \\
    4 & 9  \\
\end{tikzcd}
\end{document}

We need to specify the full path of the /tikz/column 2 style because options passed to {tikzcd} are executed in the path /tikz/commutative diagrams. The code in your questions creates a style /tikz/commutative diagrams/column 2.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.