1

Is there a package that offers nested commutative diagrams? I want to be able to use a commutative diagram in a marginal note to a main diagram. The idea of what I'm looking for should hopefully be given by the following, non-working code.

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
    \begin{tikzcd}
        a \arrow[r] \arrow[d] & b \arrow[d] \\
        c \arrow[r] \arrow[d] & d \arrow[d] & \text{since} 
            \begin{tikzcd}
                e \arrow[r] \arrow[d] & f \arrow[d] \\
                g & h
            \end{tikzcd}
        i & k
    \end{tikzcd}
\end{document}
2
  • 1
    you can always do the inner one first in a \savebox then just \usebox to nest it. Mar 2, 2021 at 14:59
  • @DavidCarlisle Thanks, it works. If you make that an answer I'll accept it.
    – mjc
    Mar 2, 2021 at 15:15

3 Answers 3

2

You can do the inner one first in a \savebox then use \usebox to nest it.

1

You can also make a single TikZ-cd:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}
a\ar[r]\ar[dd] & b\ar[dd] &[-1em] &[-2em]\\
&&& c\ar[r]\ar[dd] & f\ar[dd]\\[-4ex]
c\ar[r]\ar[dd] & d\ar[dd] & \text{since}\\[-3ex]
&&& g & h\\
i & k
\end{tikzcd}
\end{document}

enter image description here

1

These are two diagrams.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}

\begin{document}

\[
\begin{gathered}
\begin{tikzcd}
  a \arrow[r] \arrow[d] & b \arrow[d] \\
  c \arrow[r] \arrow[d] & d \arrow[d] \\
  i & k
\end{tikzcd}
\end{gathered}
\quad\text{since}\quad
\begin{gathered}
\begin{tikzcd}
  e \arrow[r] \arrow[d] & f \arrow[d] \\
  g & h
\end{tikzcd}
\end{gathered}
\]

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .