I need to create a large diagram i.e. a diagram of custom subject correlativities but I am not able to do certain things. To do this I am going to use TikZ.
Ingredients
The ingredients are:
- A title. There is not much to say.
Subjects. To create these objects I will use the source code of this very helpful answer:
Big rectangles. Every rectangle will indicate the year (a.k.a. level) in which the subjects are grouped:
Arrows. They relate the subjects within the same year of the curriculum and even between different years:
How things are assembled
- The subjects are grouped within a rectangle (year career).
- Two subjects can be related in the same year, or in different years. The relation between subjects of the same year are always side by side (one on the left, one on the right).
What I have done
MWE:
\documentclass{article}
\usepackage[showframe,margin=0in,footskip=0.25in,paperwidth=100cm,paperheight=20cm]{geometry}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{tikz}
\tikzset{text field/.style={text height=1.5ex,align=center,rounded corners},
title field/.style={text height=2ex,text depth=0.3em,anchor=south,text
width=4.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[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[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);
}},
}
\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}
\noindent
\begin{Form} % From https://tex.stackexchange.com/a/478346/152550
\begin{tikzpicture}
\path (0,0) pic (Geo) {nonfillable subject={Subject}} (8.5cm,0) pic (Whatever) {nonfillable subject={Subject}} (15cm,0) pic[draw=red] (Math) {nonfillable subject={Math}};
\draw[-latex] (Geo-Title) -- (Whatever-Title);
\draw[-latex] (Whatever-Title) -- (Math-Title);
\end{tikzpicture}
\end{Form}
\noindent
\begin{tikzpicture}
\fill[fill=orange!30,rounded corners=50pt] (0,0) rectangle (11.5cm,-14cm) node[midway,align=center,font=\LARGE] {\bfseries Level $0$};
\end{tikzpicture}
\end{document}
Final result
This is what I want:
You are not obliged to copy the image textually but some subjects and some rectangles.
What I need
- The number of rectangles varies between
6
and7
(not like the last image where they are four). The code should be as simple as possible to be able to add subjects easily. - At most each rectangle has
8
or9
vertical subjects, and at most each rectangle has2
horizontal subjects. The current year's label must be centered superiorly and not centered in the middle:
As much as the rectangles and the subjects within the rectangles must be centered horizontally and vertically, not like my MWE that are aligned to the left. Briefly, everything has to be centered:
There must be an appropriate space between all the objects, and the space between year and year must be the most important thing to take care of since, if there is little space, the arrows will be very close together and the document will look ugly. As a reference, you can take the measurements (in centimeters) that I have calculated:
If they are
7
years (i.e. the largest amount), then the width of the page will be:(0.5+4.5+1.5+4.5+0.5+3)*7-(3)+(1+1)
, which is equal to100.5cm
. I have not calculated the height, but it must be around20cm
(considering the maximum of vertical subjects i.e.8/9
).As long as the length of the sheet is smaller it is much better, but without worsening the diagram visually (because I would also like to adapt the diagram to an
A4
format).
The last thing that could happen:
(Optional requirement)
Automate the color of the arrows. Each subject has its own arrow color. As you see in "Final result", there are a lot of arrows for each subject, so the ideal would be to have a command that by passing the total number of subjects, say n
, divide the gradient of colors in n
equal parts, in order to homogenize the colors. If this seems crazy, there is no problem in coloring the arrows manually.
Thanks!!