2

I am an undergrad math major learning latex so I can optimize my notes. I would appreciate if someone can help recreate a diagram like this one:

enter image description here

1
  • 2
    Either via pure tikz or tikz-cd which is a diagram setup build on top of tikz – daleif Oct 22 '20 at 9:41
7

enter image description here

The hardest aspect is persuading tikz-cd that the top object can overlap the bottom ones.

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

\begin{document}

\begin{tikzcd}[column sep=-1em,row sep=2.5ex]
& \mbox{13 Total} \arrow[dl] \arrow[d] \arrow[dr] & \\
3C \arrow[d] & 6B \arrow[d] & 4E \arrow[d] \\
1C & 2B & 2E
\end{tikzcd}

\end{document}

You can play with the lengths until the result is what you like best.

4
  • Oh wow this is perfect! I appreciate the help. – Mobius.Drip Oct 22 '20 at 10:03
  • Does the arrow need to come from under the 1 of 13 instead of the T or Total? – fomin Oct 23 '20 at 12:48
  • @fomin Why? Would the other arrow come from the “a”? – egreg Oct 23 '20 at 14:22
  • I think the suggestion is just because of the difference to OPs diagram. – Anush Oct 24 '20 at 15:09
5

Since your image resembles a tree diagram, try drawing it with the forest specialized for such drawings:

\documentclass[margin=3mm]{standalone}
\usepackage{forest}

\begin{document}
    \begin{forest}
for tree = {math content,
            s sep=3mm,
            l sep=6mm,
            edge={->}}
[\mbox{13 Total}
    [3C [1C]]
    [6B [2B]]
    [4E [2E]]
]
    \end{forest}
\end{document}

enter image description here

Addendum: Well, we all have different tastes. While I prefer the original answer (special its simple code), it looks like you like something similar to the picture below:

enter image description here

\documentclass[margin=3mm]{standalone}
\usepackage{forest}

\begin{document}
    \begin{forest}
for tree = {math content,
            s sep=3mm,
            l sep=6mm,
            edge={->}}
[\mbox{13 Total}, name=r
    [3C, name=c,no edge [1C]]
    [6B [2B]]
    [4E, name=e,no edge [2E]]
]
\draw[->] ([xshift=+1ex] r.south west) -- (c);     
\draw[->] ([xshift=-1ex] r.south east) -- (e);
    \end{forest}
\end{document}
6
  • Does the arrow need to come from under the 1 of 13 instead of the T or Total? – fomin Oct 23 '20 at 12:48
  • @fomin, I do not know from where you like to have, that comes. Now are comes from middle of root node, however, the part to node borders is not visible. The same are at all other answers. – Zarko Oct 23 '20 at 13:21
  • I think the suggestion is just because of the difference to OP's diagram. – Anush Oct 24 '20 at 15:09
  • @Anush, I see, but accepted answer has the same source of lines. For it in the first (s)he say Oh wow this is perfect!, it seem that now (s)he changed the mind. See addendum to answer (unfortunately, now the code is not so simple as before :-( ). And to my taste looks awful ... – Zarko Oct 24 '20 at 16:29
  • 1
    @Anush, thank you to help me understanding, what OP like to have. So, I was able to do new example (for which I express my personal opinion). – Zarko Oct 24 '20 at 18:43
4

egreg already gave the best answer, but able to meet the OP's requirement without using additional packages like tikz, and the code is:

\documentclass{book}
\usepackage{mathtools}
\begin{document}

\[
\begin{array}{ccc}
\multicolumn{3}{c}{\text{13 Total}}\\
\swarrow &\downarrow &\searrow\\
3C &6B &4E\\
\downarrow &\downarrow &\downarrow\\
1C &2B &2E
\end{array}
\]

\end{document}

Output

enter image description here

1
  • I had no idea you could do this with just array! But does the arrow going down and left from the 1 of 13 needs to point at the C of 3C and not the 3? Similarly for 4E. – fomin Oct 23 '20 at 12:50

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.