# How to outline a curriculum/course tree?

For the desired output curriculum/course tree below, what is the best approach to reproduce the same conceivable (i.e. to recognize the course prerequisites) output using latex without the need to draw it myself manually?

In other words, is it possible to find a way to define my input to be: (a) the courses names, (b) their prerequisites, and (c) their parent level, while latex optimizes the courses/nodes placement and connects each course with its prerequisites?

• something like this: tex.stackexchange.com/q/203692/15036 ? – Thruston Nov 14 '18 at 16:52
• I don't know, but do you think that adding a few right of and below of keys is really more effort than trying to find the right graph drawing algorithm, and to nudge the boxes if you don't like the result? – user121799 Nov 14 '18 at 17:11
• @marmot For this MWE, you are right. However, for more than 60 courses in 5 levels with different dependencies, I need to find a more robust solution if possible. If the robust solution is not easy to find nor doable, the manual approach is OK for me. – Diaa Nov 14 '18 at 17:16
• Does it helps? tex.stackexchange.com/a/141244/1952 – Ignasi Nov 14 '18 at 18:59

Not an answer but to tell you how much effort it would be to draw this one by hand. I hope to see another, more automatic answer and thus learn something new.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{positioning,fit}
\begin{document}
\begin{tikzpicture}[course/.style={draw,minimum width=2cm,minimum
height=8mm,node contents={Course #1},name=n#1},
font=\sffamily,node distance=2cm and 1cm]
\node[course=1];
\node[right=of n1,course=2];
\node[right=of n2,course=3];
\node[below=of n1,course=5];
\node[right=of n5,course=6];
\node[right=1.8cm of n6,course=4];
%
\node[below=of n5,course=9];
\node[right=2.3cm of n9,course=7];
\node[right=of n7,course=8];
\node[below right=2cm and -0.5cm of n9,course=10];
\node[right=1.8cm of n10,course=11];
\node[right=of n11,course=12];
%
\begin{scope}[thick]
\draw (n1) -- (n5) coordinate[midway] (aux1)
(n6.140) |- (aux1) (n2) -- (n6)
(n6.-40) coordinate(aux2) -- (n7.north -| aux2)
(n3.-155) coordinate(aux3) -- (n7.north -| aux3)
(n9.-35) coordinate(aux4) -- (n10.north -| aux4)
(n12.40) |- (n4)
(n7.south) -- ++ (0,-0.4) coordinate(aux5) -| (n10)
(aux5) -| (n12);
%
\node[fit=(n1) (n4),inner xsep=8mm,inner ysep=2mm] (fit1){};
\draw ([xshift=2mm]fit1.south west) -| (fit1.north west)
node[pos=0.75,left=3mm,font=\sffamily\bfseries]{Level 1} -- ++(2mm,0);
%
\node[fit=(n9) (n12),inner xsep=8mm,inner ysep=2mm] (fit2){};
\draw ([xshift=2mm]fit2.south west) -| (fit2.north west)
node[pos=0.75,left=3mm,font=\sffamily\bfseries]{Level 2} -- ++(2mm,0);
\end{scope}
\end{tikzpicture}
\end{document}