这是上一个问题的附录:如何在图表中插入选修科目部分。
我想要的是
我想matrix
减少只有Ti 环境的一列的节点的长度钾z 包但保持节点之间的空间相同。如果可能的话,也自动执行此操作(根本没有必要,只要知道必要的命令是什么即可):
我做了什么
梅威瑟:
以下所有源代码均属于土拨鼠在所附问题的令人难以置信的公认答案。我只修改了节点之类的东西。
\documentclass{article}
\usepackage[margin=0in,footskip=0in,paperwidth=95cm,paperheight=29cm]{geometry}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{tikz}
\usetikzlibrary{positioning,backgrounds,fit,calc}
\tikzset{
text field/.style={text height=1.5ex,align=center,rounded corners},
nonfillable title field/.style={text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=\footnotesize\sffamily},
fillable title field/.style={text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=\footnotesize\sffamily},
pics/fillable subject/.style={code={%
\node[text field] (-TF)
{\hspace*{-0.5em}\TextField[align=1,name=#1-day,width=1em,charsize=7pt,maxlen=2,bordercolor={1 1 1}]~~/\hspace*{-0.15em}\TextField[align=1,name=#1-month,width=1em,charsize=7pt,maxlen=2,bordercolor={1 1 1}]~~/\hspace*{-0em}\TextField[align=1,name=#1-year,width=2em,charsize=7pt,maxlen=4,bordercolor={1 1 1}]{}~};
\node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) {#1};
\draw[rounded corners] (-TF.south west) |- (-Title.south west)
|- (-Title.north east) -- (-Title.south east) -| (-TF.south east)
-- cycle;
\draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
}},
pics/nonfillable subject/.style={code={%
\node[text field] (-TF)
{\hspace{1.2em}~/~\hspace{1.15em}~/~\hspace{2.35em}{}};
\node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) {#1};
\draw[rounded corners] (-TF.south west) |- (-Title.south west)
|- (-Title.north east) -- (-Title.south east) -| (-TF.south east)
-- cycle;
\draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
}},
pics/fillable elective subject/.style={code={%
\node[text field] (-TF)
{\hspace*{-0.5em}\TextField[align=1,name=#1-day,width=1em,charsize=7pt,maxlen=2,bordercolor={1 1 1}]~~/\hspace*{-0.15em}\TextField[align=1,name=#1-month,width=1em,charsize=7pt,maxlen=2,bordercolor={1 1 1}]~~/\hspace*{-0em}\TextField[align=1,name=#1-year,width=2em,charsize=7pt,maxlen=4,bordercolor={1 1 1}]{}~};
\node[fillable title field] (-Title)
at ([yshift=0.4em]-TF.north) {\hspace*{-0.34em}\TextField[align=1,name=#1-electivesubject,width=4.5cm,charsize=8pt,height=.5cm,bordercolor={1 1 1}]{}};
\draw[rounded corners] (-TF.south west) |- (-Title.south west)
|- (-Title.north east) -- (-Title.south east) -| (-TF.south east)
-- cycle;
\draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
}},
pics/nonfillable elective subject/.style={code={%
\node[text field] (-TF)
{\hspace{1.2em}~/~\hspace{1.15em}~/~\hspace{2.35em}{}};
\node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) {};
\draw[rounded corners] (-TF.south west) |- (-Title.south west)
|- (-Title.north east) -- (-Title.south east) -| (-TF.south east)
-- cycle;
\draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
}},
manoooh/.style={column sep=-1.75cm,row sep=5mm},
manooohE/.style={column sep=-2.25cm,row sep=5mm,anchor=south},
electives/.style={column sep=-7.25cm,row sep=5mm},
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=3cm, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
} % From https://tex.stackexchange.com/a/478723/152550
\makeatletter% from https://tex.stackexchange.com/a/85531/121799
\long\def\ifnodedefined#1#2#3{%
\@ifundefined{pgf@sh@ns@#1}{#3}{#2}%
}
\makeatother
\begin{document}
\thispagestyle{empty} % To suppress page number
\noindent
\begin{tikzpicture}
\fill[white,fill=orange] (0,0) rectangle (\paperwidth,-2cm) node[midway,align=center,font=\Huge] {\bfseries Some text here\\\LARGE More text here};
\end{tikzpicture}
\ifdefined\mymatdist
%\typeout{got\space\mymatdist}
\else
\typeout{Please\space recompile\space your\space file!}
\def\mymatdist{150pt}
\fi
\ifdefined\mymatbottom
%\typeout{got\space\mymatbottom}
\else
\typeout{Please\space recompile\space your\space file!}
\def\mymatbottom{-150pt}
\fi
\ifdefined\myheight
\else
\def\myheight{0}
\typeout{Please\space recompile\space your\space file!}
\fi
\ifdefined\LstMatShifts
\else
\def\LstMatShifts{{0pt,0pt,0pt,0pt,0pt}}
\fi
%\typeout{height:\myheight}
%\typeout{shifts(in):\LstMatShifts}
\vfill
\centering
\begin{Form}
\begin{tikzpicture}
% step 1: add the matrices, name them mat0, mat1 etc.
\begin{scope}[local bounding box=matrices]
\matrix[manoooh] (mat0) at (0*\mymatdist,{\LstMatShifts[0]}) {
& \pic[local bounding box=A] (A) {nonfillable subject={Subject A}}; & \\
& \pic (B) {nonfillable subject={Subject B}}; & \\
};
\matrix[manoooh] (mat1) at (1*\mymatdist,{\LstMatShifts[1]}) {
& \pic (C) {nonfillable subject={Subject C}}; & \\
& \pic (D) {nonfillable subject={Subject D}}; & \\
& \pic (E) {nonfillable subject={Subject E}}; & \\
& \pic (F) {nonfillable subject={Subject F}}; & \\
& \pic (G) {nonfillable subject={Subject G}}; & \\
& \pic (H) {nonfillable subject={Subject H}}; & \\
& \pic (I) {nonfillable subject={Subject I}}; & \\
& \pic[draw=red] (J) {nonfillable subject={Subject J}}; & \\
};
\matrix[manoooh] (mat2) at (2*\mymatdist,{\LstMatShifts[2]}) {
& \pic[draw=red] (K) {nonfillable subject={Subject K}}; & \\
& \pic (L) {nonfillable subject={Subject L}}; & \\
& \pic (M) {nonfillable subject={Subject A}}; & \\
& \pic (N) {nonfillable subject={Subject N}}; & \\
& \pic (O) {nonfillable subject={Subject O}}; & \\
& \pic (P) {nonfillable subject={Subject P}}; & \\
& \pic (Q) {nonfillable subject={Subject Q}}; & \\
& \pic (R) {nonfillable subject={Subject R}}; & \\
};
\matrix[manoooh] (mat3) at (3*\mymatdist,{\LstMatShifts[3]}) {
& \pic[draw=red] (S) {nonfillable subject={Subject S}}; & \\
& \pic (T) {nonfillable subject={Subject T}}; & \\
& \pic (U) {nonfillable subject={Subject U}}; & \\
& \pic (V) {nonfillable subject={Subject V}}; & \\
& \pic (W) {nonfillable subject={Subject W}}; & \\
& \pic (X) {nonfillable subject={Subject X}}; & \\
& \pic (Y) {nonfillable subject={Subject Y}}; & \\
& \pic (Z) {nonfillable subject={Subject Z}}; & \\
};
\matrix[manooohE,column sep=8pt] (matE3) at (3*\mymatdist,\mymatbottom) {
\pic (L3E1) {nonfillable elective subject={Subject}}; &
\pic (L3E2) {nonfillable elective subject={Subject}}; \\
};
\matrix[manoooh] (mat4) at (4*\mymatdist,{\LstMatShifts[4]}) {
& \pic[draw=red] (AA) {nonfillable subject={Subject AA}}; & \\
\pic (AB) {nonfillable subject={Subject AB}}; & & \pic (AC) {nonfillable subject={Subject AC}}; \\
& \pic (AD) {nonfillable subject={Subject AD}}; & \\
& \pic (AE) {nonfillable subject={Subject AE}}; & \\
& \pic (AF) {nonfillable subject={Subject AF}}; & \\
& \pic (AG) {nonfillable subject={Subject AG}}; & \\
};
\matrix[manooohE] (matE4) at (4*\mymatdist,\mymatbottom) {
\pic (L4E1) {nonfillable elective subject={Subject}}; \\
};
\matrix[manoooh] (mat5) at (5*\mymatdist,{\LstMatShifts[5]}) {
& \pic (AH) {nonfillable subject={Subject AH}}; & \\
& \pic (AI) {nonfillable subject={Subject AI}}; & \\
& \pic[draw=red] (AJ) {nonfillable subject={Subject AJ}}; & \\
& \pic (AK) {nonfillable subject={Subject AK}}; & \\
};
\matrix[manooohE] (matE5) at (5*\mymatdist,\mymatbottom) {
& \pic (L5E1) {nonfillable elective subject={Subject}}; & \\
& \pic (L5E2) {nonfillable elective subject={Subject}}; & \\
& \pic (L5E3) {nonfillable elective subject={Subject}}; & \\
& \pic (L5E4) {nonfillable elective subject={Subject}}; & \\
& \pic (L5E5) {nonfillable elective subject={Subject}}; & \\
};
\end{scope}
\pgfmathsetmacro{\mywidth}{0}
\foreach \X in {0,...,5} %<- if you have more or less matrices, adjust 3
{
\ifnodedefined{matE\X}{% has inlay
\path let \p1=($(mat\X.north east)-(mat\X.south west)$),
\p2=($(matE\X.north east)-(matE\X.south west)$)
in
\pgfextra{\pgfmathsetmacro{\mywidth}{max(\x1,\mywidth)}
\pgfmathsetmacro{\myheight}{max(\y1+\y2+%
\pgfkeysvalueof{/tikz/inlay top sep}+\pgfkeysvalueof{/tikz/matrix top sep},%
\myheight)}
\xdef\mywidth{\mywidth}\xdef\myheight{\myheight}
\pgfmathsetmacro{\myshift}{(\pgfkeysvalueof{/tikz/inlay top sep}+\y2)/2}
\ifnum\X=0
\xdef\LstMatShifts{\myshift pt}
\else
\xdef\LstMatShifts{\LstMatShifts,\myshift pt}
\fi};}{% no inlay
\path
let \p1=($(mat\X.north east)-(mat\X.south west)$) in
\pgfextra{\pgfmathsetmacro{\mywidth}{max(\x1,\mywidth)}
\pgfmathsetmacro{\myheight}{max(\y1+\pgfkeysvalueof{/tikz/matrix top sep},\myheight)}
\xdef\mywidth{\mywidth}\xdef\myheight{\myheight}};
\ifnum\X=0
\xdef\LstMatShifts{0pt}
\else
\xdef\LstMatShifts{\LstMatShifts,0pt}
\fi
}
\node[anchor=south,yshift=1cm,align=center,font=\LARGE\bfseries\boldmath]
at (mat\X |-matrices.north) (L\X) {Level $\X$};
\begin{scope}[on background layer]
% the fit parameters determine the shape of the background rectangles
\node[fit=(L\X) (mat\X) (matrices.south-|mat\X.south),inner ysep=5mm,
minimum width=\mymatdist-\pgfkeysvalueof{/tikz/fit dist}/2,
fill=orange!30,rounded corners=50pt](F\X){};
\end{scope}}
%\typeout{height1:\myheight} %
%
\pgfmathsetmacro{\mydist}{\mywidth+2*\pgfkeysvalueof{/tikz/fit
sep}+\pgfkeysvalueof{/tikz/fit dist}}
\xdef\mydist{\mydist}
\def\mymatbottom{0pt}
\foreach \X in {0,...,5} %
{\ifnodedefined{matE\X}{\path let \p1=($(mat\X.north)-(mat\X.south)$),
\p2=($(matE\X.north)-(matE\X.south)$),
\n1={max(abs(\y1)/2+abs(\y2)+2*\pgfkeysvalueof{/tikz/inlay top sep},\mymatbottom)}
in \pgfextra{\xdef\mymatbottom{\n1}}
node[anchor=south east,xshift=-3cm,font=\LARGE\bfseries] (El\X)
at (matE\X.north){Electives};
\begin{scope}[on background layer]
\node[fit=(matE\X) (El\X)] (FE\X){};
\fill[blue!30,rounded corners=30pt] (\X*\mymatdist-
\mymatdist/2+\pgfkeysvalueof{/tikz/fit dist}/4+10pt,0|-FE\X.north)
rectangle (\X*\mymatdist+
\mymatdist/2-\pgfkeysvalueof{/tikz/fit dist}/4-10pt,0|-FE\X.south);
\end{scope}}{}}
%\typeout{shifts(end):\LstMatShifts}
\makeatletter
\immediate\write\@mainaux{\xdef\string\mymatdist{\mydist pt}\relax}
\immediate\write\@mainaux{\xdef\string\mymatbottom{-\mymatbottom}\relax}
\immediate\write\@mainaux{\xdef\string\myheight{\myheight}\relax}
\immediate\write\@mainaux{\xdef\string\LstMatShifts{{\LstMatShifts}}\relax}
\makeatother
% now add the arrows
\foreach \X in {C,D,E,F,G,H,I,J} {
\draw[very thick,blue,-latex] (A-Title) to[out=0,in=180] (\X-Title);
\draw[very thick,red,-latex] (B-Title) to[out=0,in=180] (\X-Title);
}
\foreach \X in {L,O} {
\draw[very thick,orange,-latex] (C-Title) to[out=0,in=180] (\X-Title);
}
\foreach \X in {K,N,O,Z} {
\draw[very thick,green,-latex] (D-Title) to[out=0,in=180] (\X-Title);
}
\end{tikzpicture}
\end{Form}
\vfill
\end{document}
谢谢!!
答案1
一份带有不清楚(即不存在 ;-) 解释的提案。
\documentclass{article}
\usepackage[margin=0in,footskip=0in,paperwidth=95cm,paperheight=29cm]{geometry}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc}
\pgfdeclarelayer{behind}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{behind,background,main,foreground}
\tikzset{
text field/.style={text height=1.5ex,align=center,rounded corners},
nonfillable title field/.style={text height=2ex,text depth=0.3em,anchor=south,text
width=5cm,align=center,font=\footnotesize\sffamily},
fillable title field/.style={text height=3.14ex,text depth=0em,anchor=south,text
width=5cm,align=center,font=\footnotesize\sffamily},
pics/fillable subject/.style={code={%
\node[text field] (-TF)
{\hspace*{-0.5em}\TextField[align=1,name=#1-day,width=1em,charsize=7pt,maxlen=2,bordercolor={1 1 1}]~~/\hspace*{-0.15em}\TextField[align=1,name=#1-month,width=1em,charsize=7pt,maxlen=2,bordercolor={1 1 1}]~~/\hspace*{-0em}\TextField[align=1,name=#1-year,width=2em,charsize=7pt,maxlen=4,bordercolor={1 1 1}]{}~};
\node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) {#1};
\draw[rounded corners] (-TF.south west) |- (-Title.south west)
|- (-Title.north east) -- (-Title.south east) -| (-TF.south east)
-- cycle;
\draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
}},
pics/nonfillable subject/.style={code={%
\node[text field] (-TF)
{\hspace{1.2em}~/~\hspace{1.15em}~/~\hspace{2.35em}{}};
\node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) {#1};
\draw[rounded corners] (-TF.south west) |- (-Title.south west)
|- (-Title.north east) -- (-Title.south east) -| (-TF.south east)
-- cycle;
\draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
}},
pics/fillable elective subject/.style={code={%
\node[text field] (-TF)
{\hspace*{-0.5em}\TextField[align=1,name=#1-day,width=1em,charsize=7pt,maxlen=2,bordercolor={1 1 1}]~~/\hspace*{-0.15em}\TextField[align=1,name=#1-month,width=1em,charsize=7pt,maxlen=2,bordercolor={1 1 1}]~~/\hspace*{-0em}\TextField[align=1,name=#1-year,width=2em,charsize=7pt,maxlen=4,bordercolor={1 1 1}]{}~};
\node[fillable title field] (-Title)
at ([yshift=0.4em]-TF.north) {\hspace*{-0.34em}\TextField[align=1,name=#1-electivesubject,width=4.5cm,charsize=8pt,height=.5cm,bordercolor={1 1 1}]{}};
\draw[rounded corners] (-TF.south west) |- (-Title.south west)
|- (-Title.north east) -- (-Title.south east) -| (-TF.south east)
-- cycle;
\draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
}},
pics/nonfillable elective subject/.style={code={%
\node[text field] (-TF)
{\hspace{1.2em}~/~\hspace{1.15em}~/~\hspace{2.35em}{}};
\node[nonfillable title field] (-Title)
at ([yshift=0.4em]-TF.north) {};
\draw[rounded corners] (-TF.south west) |- (-Title.south west)
|- (-Title.north east) -- (-Title.south east) -| (-TF.south east)
-- cycle;
\draw ([xshift=4pt]-Title.south west) -- ([xshift=-4pt]-Title.south east);
}},
manoooh/.style={column sep=-1.75cm,row sep=5mm},
manooohE/.style={column sep=-2.25cm,row sep=5mm,anchor=south},
electives/.style={column sep=-7.25cm,row sep=5mm},
fit sep/.initial=4pt, % change width of node (big rectangle shape)
fit dist/.initial=40pt, % change node distance (big rectangle shape)
inlay top sep/.initial=24pt,
matrix top sep/.initial=24pt,
manoooh curve/.style={to path={let \p1=($(\tikztotarget)-(\tikztostart)$)
in (\tikztostart) .. controls ($(\tikztostart)+(#1*\x1,0)$)
and ($(\tikztotarget)+(-#1*\x1,0)$) .. (\tikztotarget)}},
manoooh curve/.default=0.3
} % From https://tex.stackexchange.com/a/478723/152550
\makeatletter% from https://tex.stackexchange.com/a/85531/121799
\long\def\ifnodedefined#1#2#3{%
\@ifundefined{pgf@sh@ns@#1}{#3}{#2}%
}
\makeatother
\begin{document}
\thispagestyle{empty} % To suppress page number
\noindent
\begin{tikzpicture}
\fill[white,fill=orange] (0,0) rectangle (\paperwidth,-2cm) node[midway,align=center,font=\Huge] {\bfseries Some text here\\\LARGE More text here};
\end{tikzpicture}
\ifdefined\mymatbottom
\else
\typeout{Please\space recompile\space your\space file!}
\def\mymatbottom{-150pt}
\fi
\ifdefined\myheight
\else
\def\myheight{0}
\typeout{Please\space recompile\space your\space file!}
\fi
\ifdefined\LstMatYShifts
\else
\def\LstMatYShifts{{0pt,0pt,0pt,0pt,0pt,0pt,0pt}}
\fi
\ifdefined\LstMatXShifts
\else
\def\LstMatXShifts{{0pt,0pt,0pt,0pt,0pt,0pt,0pt}}
\fi
%\typeout{height:\myheight}
%\typeout{xshifts(in):\LstMatXShifts}
\vfill
\centering
\begin{Form}
\begin{tikzpicture}
% step 1: add the matrices, name them mat0, mat1 etc.
\begin{scope}[local bounding box=matrices]
\matrix[manoooh] (mat0) at ({\LstMatXShifts[0]},{\LstMatYShifts[0]}) {
\pic[local bounding box=A] (A) {nonfillable subject={Subject A}}; \\
\pic (B) {nonfillable subject={Subject B}}; \\
};
\matrix[manoooh] (mat1) at ({\LstMatXShifts[1]},{\LstMatYShifts[1]}) {
\pic (C) {nonfillable subject={Subject C}}; \\
\pic (D) {nonfillable subject={Subject D}}; \\
\pic (E) {nonfillable subject={Subject E}}; \\
\pic (F) {nonfillable subject={Subject F}}; \\
\pic (G) {nonfillable subject={Subject G}}; \\
\pic (H) {nonfillable subject={Subject H}}; \\
\pic (I) {nonfillable subject={Subject I}}; \\
\pic[draw=red] (J) {nonfillable subject={Subject J}}; \\
};
\matrix[manoooh] (mat2) at ({\LstMatXShifts[2]},{\LstMatYShifts[2]}) {
\pic[draw=red] (K) {nonfillable subject={Subject K}}; \\
\pic (L) {nonfillable subject={Subject L}}; \\
\pic (M) {nonfillable subject={Subject A}}; \\
\pic (N) {nonfillable subject={Subject N}}; \\
\pic (O) {nonfillable subject={Subject O}}; \\
\pic (P) {nonfillable subject={Subject P}}; \\
\pic (Q) {nonfillable subject={Subject Q}}; \\
\pic (R) {nonfillable subject={Subject R}}; \\
};
\matrix[manoooh] (mat3) at ({\LstMatXShifts[3]},{\LstMatYShifts[3]}) {
\pic[draw=red] (S) {nonfillable subject={Subject S}}; \\
\pic (T) {nonfillable subject={Subject T}}; \\
\pic (U) {nonfillable subject={Subject U}}; \\
\pic (V) {nonfillable subject={Subject V}}; \\
\pic (W) {nonfillable subject={Subject W}}; \\
\pic (X) {nonfillable subject={Subject X}}; \\
\pic (Y) {nonfillable subject={Subject Y}}; \\
\pic (Z) {nonfillable subject={Subject Z}}; \\
};
\matrix[manooohE] (matE3) at ({\LstMatXShifts[3]},\mymatbottom) {
\pic (L3E1) {nonfillable elective subject={Subject}}; & &
\pic (L3E2) {nonfillable elective subject={Subject}}; \\
& \pic (L3E3) {nonfillable elective subject={Subject}}; & \\
};
\matrix[manoooh] (mat4) at ({\LstMatXShifts[4]},{\LstMatYShifts[4]}) {
& \pic[draw=red] (AA) {nonfillable subject={Subject AA}}; & \\
\pic (AB) {nonfillable subject={Subject AB}}; & & \pic (AC) {nonfillable subject={Subject AC}}; \\
& \pic (AD) {nonfillable subject={Subject AD}}; & \\
& \pic (AE) {nonfillable subject={Subject AE}}; & \\
& \pic (AF) {nonfillable subject={Subject AF}}; & \\
& \pic (AG) {nonfillable subject={Subject AG}}; & \\
};
\matrix[manooohE] (matE4) at ({\LstMatXShifts[4]},\mymatbottom) {
\pic (L4E1) {nonfillable elective subject={Subject}}; \\
};
\matrix[manoooh] (mat5) at ({\LstMatXShifts[5]},{\LstMatYShifts[5]}) {
\pic (AH) {nonfillable subject={Subject AH}}; \\
\pic (AI) {nonfillable subject={Subject AI}}; \\
\pic[draw=red] (AJ) {nonfillable subject={Subject AJ}}; \\
\pic (AK) {nonfillable subject={Subject AK}}; \\
};
\matrix[manooohE] (matE5) at ({\LstMatXShifts[5]},\mymatbottom) {
\pic (L5E1) {nonfillable elective subject={Subject}}; \\
\pic (L5E2) {nonfillable elective subject={Subject}}; \\
\pic (L5E3) {nonfillable elective subject={Subject}}; \\
\pic (L5E4) {nonfillable elective subject={Subject}}; \\
\pic (L5E5) {nonfillable elective subject={Subject}}; \\
};
\end{scope}
\draw[-latex] (I-Title) to[manoooh curve] (AK-Title);
\pgfmathsetmacro{\groupwidth}{0}
\pgfmathsetmacro{\lastwidth}{0}
\foreach \X in {0,...,5} %<- if you have more or less matrices, adjust 3
{
\node[anchor=south,yshift=1cm,align=center,font=\LARGE\bfseries\boldmath]
at (mat\X |-matrices.north) (L\X) {Level $\X$};
\ifnodedefined{matE\X}{% has inlay
\node[xshift=1em,anchor=south west,font=\LARGE\bfseries,opacity=0] (matEl\X) at (matE\X.north west) {Electives};
\begin{pgfonlayer}{background}
\path let \p1=($(mat\X.north east)-(mat\X.south west)$) in
node[fit=(matE\X) (matEl\X),inner ysep=5mm,fill=blue!30,rounded
corners=40pt,minimum width=\x1-2*\pgfkeysvalueof{/tikz/fit sep},
inner xsep=\pgfkeysvalueof{/tikz/fit sep}](F\X){};
\node[xshift=1em,anchor=south west,font=\LARGE\bfseries]
(matEl\X) at ([xshift=1.3em]F\X.west|-matEl\X.center) {Electives};
\end{pgfonlayer}
\path let \p1=($(mat\X.north east)-(mat\X.south west)$),
\p2=($(F\X.north east)-(F\X.south west)$),
\n1={max(abs(\y1)/2+abs(\y2)/2+0*\pgfkeysvalueof{/tikz/inlay top sep},\mymatbottom)}
in
\pgfextra{\xdef\mymatbottom{\n1}
\ifnum\X=0
\pgfmathsetmacro{\groupwidth}{0}
\else
\pgfmathsetmacro{\groupwidth}{\groupwidth+max(\x1,\x2)/2+\lastwidth/2+2*\pgfkeysvalueof{/tikz/fit sep}+\pgfkeysvalueof{/tikz/fit dist}}
\fi
\pgfmathsetmacro{\lastwidth}{max(\x1,\x2)+8*\pgfkeysvalueof{/tikz/fit sep}}
\xdef\lastwidth{\lastwidth}
\xdef\groupwidth{\groupwidth}
\pgfmathsetmacro{\myheight}{max(\y1+\y2+%
\pgfkeysvalueof{/tikz/inlay top sep}+\pgfkeysvalueof{/tikz/matrix top sep},%
\myheight)}
\xdef\myheight{\myheight}
\pgfmathsetmacro{\myshift}{(\pgfkeysvalueof{/tikz/inlay top sep}+\y2)/2}
\ifnum\X=0
\xdef\LstMatYShifts{\myshift pt}
\xdef\LstMatXShifts{0pt}
\else
\xdef\LstMatYShifts{\LstMatYShifts,\myshift pt}
\xdef\LstMatXShifts{\LstMatXShifts,\groupwidth pt}
\fi};
% the fit parameters determine the shape of the background rectangles
\begin{pgfonlayer}{behind}
\node[fit=(L\X) (mat\X) (matrices.south-|mat\X.south)
(matE\X) (matEl\X),inner ysep=8mm,inner xsep=4*\pgfkeysvalueof{/tikz/fit sep},
fill=orange!30,rounded corners=50pt](F\X){};
\end{pgfonlayer}}{% no inlay
\path
let \p1=($(mat\X.north east)-(mat\X.south west)$),
\n1={max(abs(\y1)/2,\mymatbottom)}
in
\pgfextra{\xdef\mymatbottom{\n1}
\ifnum\X=0
\pgfmathsetmacro{\groupwidth}{0}
\else
\pgfmathsetmacro{\groupwidth}{\groupwidth+\x1/2+\lastwidth/2+\pgfkeysvalueof{/tikz/fit dist}}
\fi
\xdef\groupwidth{\groupwidth}
\xdef\lastwidth{\x1}
\pgfmathsetmacro{\myheight}{max(\y1+\pgfkeysvalueof{/tikz/matrix top sep},\myheight)}
\xdef\myheight{\myheight}
\ifnum\X=0
\xdef\LstMatYShifts{0pt}
\xdef\LstMatXShifts{0pt}
\else
\xdef\LstMatYShifts{\LstMatYShifts,0pt}
\xdef\LstMatXShifts{\LstMatXShifts,\groupwidth pt}
\fi};
% the fit parameters determine the shape of the background rectangles
\begin{pgfonlayer}{behind}
\node[fit=(L\X) (mat\X) (matrices.south-|mat\X.south),inner ysep=8mm,
fill=orange!30,rounded corners=50pt](F\X){};
\end{pgfonlayer}
}
}
\makeatletter
\immediate\write\@mainaux{\xdef\string\mymatbottom{-\mymatbottom}\relax}
\immediate\write\@mainaux{\xdef\string\myheight{\myheight}\relax}
\immediate\write\@mainaux{\xdef\string\LstMatYShifts{{\LstMatYShifts}}\relax}
\immediate\write\@mainaux{\xdef\string\LstMatXShifts{{\LstMatXShifts}}\relax}
\makeatother
% now add the arrows
\foreach \X in {C,D,E,F,G,H,I,J} {
\draw[very thick,blue,-latex] (A-Title) to[out=0,in=180] (\X-Title);
\draw[very thick,red,-latex] (B-Title) to[out=0,in=180] (\X-Title);
}
\foreach \X in {L,O} {
\draw[very thick,orange,-latex] (C-Title) to[out=0,in=180] (\X-Title);
}
\foreach \X in {K,N,O,Z} {
\draw[very thick,green,-latex] (D-Title) to[out=0,in=180] (\X-Title);
}
\end{tikzpicture}
\end{Form}
\vfill
\end{document}