I would like to reproduce the result of the following code




&&&& \mathcal{T}\ar@{-}[dr]\ar@{-}[dl]\\
&&&\mathcal{A}^\perp\ar@{-}[dr]\ar@{-}[dl] && **[r] \mathcal{A} = \mathcal{A}_3\\
&&\mathcal{B}^{\perp, \mathcal{A}^\perp}\ar@{-}[dr]\ar@{-}[dl] && **[r] \mathcal{B} = \mathcal{A}_2\\
& \mathcal{C}^{\perp, \mathcal{B}^\perp}\ar@{-}[dr]\ar@{-}[dl] && **[r] \mathcal{C} = \mathcal{A}_1 \\
\mathcal{D}^{\perp, \mathcal{C}^\perp} & & **[r] \mathcal{D} = \mathcal{A}_0

in a more efficient and smart way (y'know, I have a life to live and stuff to do :) ). More precisely, how can I draw the boxes you see, telling xypic only a minimum informations (e.g. the nodes that the box has to cover) and more importantly in a uniform manner (same size, same length, etc.)? Here is the output I want:

enter image description here

  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Sep 10, 2014 at 13:45
  • 2
    Done. Sorry!!!!
    – fosco
    Sep 10, 2014 at 13:48
  • 1
    Maybe doable with Xy, but perhaps TikZ is much better at this.
    – egreg
    Sep 10, 2014 at 13:59
  • I'll be glad to accept a tikz solution to the problem.
    – fosco
    Sep 10, 2014 at 14:36

1 Answer 1


A starting point in tikz, using the fit library for the boxes and the cd library for tikz-cd features.

\usetikzlibrary{cd, fit}
\tikzset{myboxgroup/.style={draw, densely dotted}} % style for the boxed groups

\begin{tikzpicture}[commutative diagrams/every diagram]
\matrix[matrix of math nodes, name=m, commutative diagrams/every cell] {
 & & \mathcal{T} & \\
 & \mathcal{A}^{\perp} & & \mathcal{A} = \mathcal{A}_3 \\
 \mathcal{B}^{\perp,\mathcal{A}^{\perp}} & & \mathcal{B} = \mathcal{A}_2 \\
\node[myboxgroup, fit=(m-2-2) (m-2-4), label={right:$=t_3$}] {};
\node[myboxgroup, fit=(m-3-1) (m-3-3), label={right:$=t_2$}] {};
\path[commutative diagrams/.cd, every arrow/.append style={dash}]
  (m-1-3) edge (m-2-2)
  (m-1-3) edge (m-2-4)
  (m-2-2) edge (m-3-1)
  (m-2-2) edge (m-3-3);

enter image description here

Further information in response to a comment:

The keys commutative diagrams/every diagram and commutative diagrams/every cell are used by the tikz-cd package to make a few settings at the beginning of every tikzcd environment. Since the tikzcd environment is not used here directly (I use a normal tikzpicture environment to allow for the fitted boxes), I set them manually. This ensures an appearance similar to that obtained using the tikzcd environment. The full definition of these keys is given in the tikz-cd package documentation, section 2.1.

  • Wonderful! Let me doodle a bit with the library for today and if nobody else proposes something better, you are the winner
    – fosco
    Sep 10, 2014 at 15:58
  • What does the "[commutative diagrams/every diagram]" part do? Also, the "commutative diagrams/every cell" part gives me a "TeX capacity exceeded" error... No clue why. If I remove it, no error, same output as you.
    – fosco
    Sep 10, 2014 at 21:20
  • I added some details about these keys to the post. About the error: Is your TeX distribution up to date? I'm on an updated TeX Live 2014, with Tikz/PGF v3.0.0 and tikz-cd v0.9b. Sep 10, 2014 at 22:28

You must log in to answer this question.

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