I am using the TikZ code given in this answer.
I would like the text in each rectangle to be on the top left of the rectangle. I already managed to bring the text to the left by replacing align=center
by align=left
inside the \tikzset
command. But now I am still missing a way to bring the text to the top of the rectangles.
Here is the code I have so far:
\documentclass{article}
\usepackage{tikz}
\begin{document}
% These set the width of a day and the height of an hour.
\newcommand*\daywidth{6cm}
\newcommand*\hourheight{1.2em}
% The entry style will have two options:
% * the first option sets how many hours the entry will be (i.e. its height);
% * the second option sets how many overlapping entries there are (thus
% determining the width).
\tikzset{entry/.style 2 args={
draw,
rectangle,
anchor=north west,
line width=0.4pt,
inner sep=0.3333em,
text width={\daywidth/#2-0.6666em-0.4pt},
minimum height=#1*\hourheight,
align=left
}}
% Start the picture and set the x coordinate to correspond to days and the y
% coordinate to correspond to hours (y should point downwards).
\begin{tikzpicture}[y=-\hourheight,x=\daywidth]
% First print a list of times.
\foreach \time/\ustime in {8/8am,9/9am,10/10am,11/11am,12/12pm,13/1pm,14/2pm,15/3pm,16/4pm,17/5pm,18/6pm}
\node[anchor=north east] at (1,\time) {\ustime};
% Draw some day dividers.
\draw (1,6.5) -- (1,19);
\draw (2,6.5) -- (2,19);
\draw (3,6.5) -- (3,19);
% Start Monday.
\node[anchor=north] at (1.5,6.5) {Monday};
% Write the entries. Note that the x coordinate is 1 (for Monday) plus an
% appropriate amount of shifting. The y coordinate is simply the starting
% time.
\node[entry={4}{2}] at (1,8) {Virtual Reality};
\node[entry={3}{2}] at (1.5,8) {Realtime Network};
\node[entry={3}{1}] at (1,13) {EOSA};
% The same for Tuesday.
\node[anchor=north] at (2.5,6.5) {Tuesday};
\node[entry={3.5}{3}] at (2,9) {Class A};
\node[entry={2.5}{3}] at (2.33333,9.5) {Class B};
\node[entry={2.5}{3}] at (2.66667,10) {Class C};
\end{tikzpicture}
\end{document}
below right
of father node.north west.