New to LaTeX and need help with a table for my Lesson Plan
Here is another possible solution, after fine tuning and tweeking. All columns are set in relation of the \columnwidth
, so it will survive a change from letter
to A4
. The text with in the cells relate to the width of individual table column. I have set all tables in relation to each other, i.e. base width is 1/15-column width, and the other columns are 2/15 and 4/15 (before all the \multicolumns
. Still it is lot of room for improvement. The last column is too narrow compared to your example. It is easy to fix, but some coding work.
\documentclass[a4paper]{article}
\usepackage{multirow}
\usepackage{pdflscape, array, calc}
\usepackage[margin=1cm]{geometry}
\newlength{\bcw} % basis column (Medien) 1/15 columnwidth - tabcolsep
\newcolumntype{L}{@{}>{\rule{0pt}{1.1\normalbaselineskip}}m{0pt}@{}}
\newcolumntype{P}{>{\arraybackslash}p{2\bcw}}
\newcolumntype{B}{>{\arraybackslash}p{4\bcw}}
\newcolumntype{S}{>{\centering\arraybackslash}p{2\bcw}}
\newcolumntype{s}{>{\centering\arraybackslash}p{\bcw}}
\newcommand{\Imc}[1]{\multicolumn{1}{c|}{#1}}
\newcommand{\mci}[1]{\multicolumn{1}{p{2\bcw}}{#1}}
\newcommand{\mcI}[1]{\multicolumn{1}{|l}{#1}}
\newcommand{\mcc}[1]{\multicolumn{1}{|c|}{#1}}
\newcommand{\mcII}[1]{\multicolumn{2}{|m{4\bcw+2\tabcolsep}}{#1}}
\newcommand{\mcV}[1]{\multicolumn{5}{m{9\bcw+6\tabcolsep}|}{#1}}
\thispagestyle{empty}
\begin{document}
\begin{landscape}
\setlength{\bcw}{((\columnwidth) / 15) - \tabcolsep}
\centering
\noindent\rule{\columnwidth}{2pt}\\[1ex] % Chicking the width of the table
\noindent\begin{tabular}{|P|P|P|P|S|s|B|L}
\hline
\mcI{Name:}
& Max Mustermann
&\mci{Datum:}
&08.05.2018
&\mci{Stundenthema:}
&\multicolumn{2}{p{5\bcw}|}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit}
&\rule{0pt}{2.2\normalbaselineskip}
\\
\mcI{Lerngruppe:}
&5B
&\mci{Zeit:}
&12:25 -- 13:10
&\mci{}
&\multicolumn{2}{p{5\bcw}|}{}
&
\\
\hline
\mcI{Stundenziel: }
&\multicolumn{6}{>{\raggedright}m{13\bcw+10\tabcolsep}|}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. }
&\rule{0pt}{4.4\normalbaselineskip}
\\
\hline
\mcc{Phasen}
&\multicolumn{3}{>{\centering}p{6\bcw+2\tabcolsep}|}{Inhaltliche Schwerpunkte/ Operatoren}
&\Imc{Sozialform}
&\Imc{Medien}
&\multicolumn{1}{c|}{Intention (Lernziele o.Ä)}
&\rule{0pt}{2.2\normalbaselineskip}
\\
\hline
&
\multicolumn{3}{p{6\bcw+2\tabcolsep}|}{}
&&
&\rule{0pt}{2.2\normalbaselineskip}
\\
\textbf{Einstieg/\newline Problemaufw.}
&\multicolumn{3}{p{6\bcw+2\tabcolsep}|}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
&XY
&XY
&Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
&\rule{0pt}{2.2\normalbaselineskip}
\\
(5’)
&\multicolumn{3}{p{6\bcw+2\tabcolsep}|}{}
&&&
&
\\
\textbf{Erarbeitung}
&\multicolumn{3}{p{6\bcw+2\tabcolsep}|}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
&XY
&XY
&Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
&\rule{0pt}{2.2\normalbaselineskip}
\\
(10’)
&\multicolumn{3}{p{6\bcw+2\tabcolsep}|}{}
&&&&
\\
\textbf{Präsentation}
&\multicolumn{3}{p{6\bcw+2\tabcolsep}|}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
&XY
&XY
&Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
&\rule{0pt}{2.2\normalbaselineskip}
\\
(15’)
&\multicolumn{3}{p{6\bcw+2\tabcolsep}|}{}
&&&&
\\
\textbf{Transfer}
&\multicolumn{3}{p{6\bcw+2\tabcolsep}|}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
&XY
&XY
&Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
&\rule{0pt}{2.2\normalbaselineskip}
\\
(15’)
&\multicolumn{3}{p{6\bcw+2\tabcolsep}|}{}
&&&&
\\
\hline
\mcII{Hausaufgabe zur Stunden:}
&\mcV{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}
&\rule{0pt}{3.3\normalbaselineskip}
\\
\hline
\mcII{Hausaufgabe zur näcsten Stunden:}
&\mcV{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. }
&\rule{0pt}{3.3\normalbaselineskip}
\\
\hline
\end{tabular}
\end{landscape}
\end{document}
I'll provide a solution that covers the first section of your table, and leave the remaining rows as an exercise for the reader (forgive me, teacher habits ;) ).
First, to address your column width issue.
In this case, where you have a large amount of text, the tabulary
package seems to fit the best. It allows shorter columns to be resized to their natural length, while trying its best to not go past the total width you specify. This will be enough to keep the bounds of your table inside the page.
Next, to address your overflow issue
You use multirow
several times in your example. However, you are using the *
specifier; this allows the text to overflow outside the column walls. So for columns with lots of content, you must replace the *
with a length that forces text to wrap at that length.
There is some more caution to be had when using multirow
: you can't think of it as filling a number of rows (go figure). Rather, you have to think of it as replacing a number of lines of text. This is why in my example below I use four rows for the lorem ipsum. While specifying column width according to the paragraph above is sufficient to make your text wrap, you have to adjust your multirow
specification in order to have the cell's borders span the entire height of the text.
Without further ado...
The example! As mentioned earlier, I only wrote enough to cover the first section of your desired table. Hopefully this was enough to help guide the rest of your design. Good luck with your lesson plans!
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{geometry}
\usepackage{pdflscape}
\usepackage{tabulary}
\newcommand{\lorem}{Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}
\begin{document}
\newgeometry{margin=1cm}
\begin{landscape}
\begin{tabulary}{1.25\textwidth}{|LL|LL|LL|}
\hline
\multirow{2}{*}{Name:} & \multirow{2}{*}{Max Mustermann} & \multirow{2}{*}{Datum:} & \multirow{2}{*}{08.05.2019} & \multirow{4}{*}{Studenthema:} & \multirow{4}{12cm}{\lorem}\\
&&&&&\\
\multirow{2}{*}{Lerngruppe:} & \multirow{2}{*}{5B} & \multirow{2}{*}{Zeit:} & \multirow{2}{*}{12:25 - 13:10} & &\\
&&&&&\\
\hline
\end{tabulary}
\end{landscape}
\restoregeometry
\end{document}
The result:
A totally different approach is to use the eminent, but little known, package cals to build the tabular. Actually, cals is more or less tailor made to build this type of tabulars, because you build the tabular cell by cell. The documentation is rudimentary and a little bit difficult to understand. In particular, the spanning commands are difficult to understand, but when you understand them, they are logically.
\documentclass[a4paper]{article}
\usepackage{cals, pdflscape}
\usepackage[margin=1cm]{geometry}
\thispagestyle{empty}
% Shortcuts
\let\nc=\nullcell
\let\sc=\spancontent
\begin{document}
\begin{landscape}
\begin{calstable}[c]
\colwidths{{\dimexpr(\columnwidth)/30*4\relax}
{\dimexpr(\columnwidth)/30*4\relax}
{\dimexpr(\columnwidth)/30*3\relax}
{\dimexpr(\columnwidth)/30*3\relax}
{\dimexpr(\columnwidth)/30*4\relax}
{\dimexpr(\columnwidth)/30*2\relax}
{\dimexpr(\columnwidth)/30*10\relax}
{0pt}
}
\makeatletter
\def\cals@framers@width{0.4pt}
\def\cals@framecs@width{0.4pt}
\def\tb{\ifx\cals@borderT\relax % Top border switch (off-on)
\def\cals@borderT{0pt}
\else \let\cals@borderT\relax\fi}
\def\bb{\ifx\cals@borderB\relax % Bottom border switch (off-on)
\def\cals@borderB{0pt}
\else \let\cals@borderB\relax\fi}
\def\rb{\ifx\cals@borderR\relax % Right border switch (off-on)
\def\cals@borderR{0pt}
\else \let\cals@borderR\relax\fi}
\def\lp{\ifdim\cals@paddingL=0.0pt\relax % Left padding switch (off-on)
\cals@setpadding{Ag}
\else \setlength{\cals@paddingL}{0pt}\fi}
\def\rp{\ifdim\cals@paddingR=0.0pt\relax % Left padding switch (off-on)
\cals@setpadding{Ag}
\else \setlength{\cals@paddingR}{0pt}\fi}
%
\brow
\rb\alignL \cell{Name:\vfill Lerngruppe:}\rb
\alignL \cell{Max Mustermann\vfill 5B}
\rb\alignL \cell{Datum:\vfill Zeit:}\rb
\alignL \cell{08-05-2019\vfill 12:25 -- 13:10}
\rb\alignC \cell{\vfil Stundenthema:}\rb
\nc{ltb}
\nc{rtb}\alignL\sc{\vfil Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit}
\cell{\rule{0pt}{3.3\normalbaselineskip}}
\erow
%
\brow
\rb\alignL \cell{\vfil Stundenziel:}\rb
\nc{ltb}
\nc{tb}
\nc{tb}
\nc{tb}
\nc{tb}
\nc{rtb}\alignL\sc{\vfil Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit. Lorem ipsum dolor sit amet, \\ consectetuer adipiscing elit. Ut purus elit}
\cell{\rule{0pt}{4.4\normalbaselineskip}}
\erow
%
\brow
\alignC \cell{\vfil Phasen}
\nc{ltb}
\nc{tb}
\nc{rtb}\alignC\sc{Inhaltliche Schwerpunkte/ Operatoren}
\alignC \cell{\vfil Sozialform}
\alignC \cell{\vfil Medien}
\alignC \cell{\vfil Intention (Lernziele o.Ä)}
\cell{\rule{0pt}{1.1\normalbaselineskip}}
\erow
%
\brow
\bb\alignC \cell{}
\nc{ltb}
\nc{tb}
\nc{rtb}\alignC\sc{}
\alignC \cell{}
\alignC \cell{}
\alignC \cell{}
\cell{\rule{0pt}{1.1\normalbaselineskip}}
\erow
%
\brow
\alignL\cell{\textbf{Einstieg/\\ Problemaufw.}\vfil(5’)}
\nc{ltb}
\nc{tb}
\nc{rtb}\alignL\sc{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
\alignC \cell{XY}
\alignC \cell{XY}
\alignL\cell{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
\cell{\rule{0pt}{4.4\normalbaselineskip}}
\erow
%
\brow
\alignL\cell{\textbf{Erarbeitung}\vfil(10’)}
\nc{ltb}
\nc{tb}
\nc{rtb}\alignL\sc{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
\alignC \cell{XY}
\alignC \cell{XY}
\alignL\cell{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
\cell{\rule{0pt}{4.4\normalbaselineskip}}
\erow
%
\brow
\alignL\cell{\textbf{Präsentation}\vfil(15’)}
\nc{ltb}
\nc{tb}
\nc{rtb}\alignL\sc{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
\alignC \cell{XY}
\alignC \cell{XY}
\alignL\cell{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
\bb\cell{\rule{0pt}{4.4\normalbaselineskip}}
\erow
%
\brow
\alignL\cell{\textbf{Transfer}\vfil(15’)}
\nc{ltb}
\nc{tb}
\nc{rtb}\alignL\sc{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
\alignC \cell{XY}
\alignC \cell{XY}
\alignL\cell{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
\cell{\rule{0pt}{4.4\normalbaselineskip}}
\erow
%
\brow
\nc{ltb}
\nc{tb}
\nc{rtb}\alignL\sc{\vfil Hausaufgabe zur Stunde:}
\nc{ltb}
\nc{tb}
\nc{tb}
\nc{rtb}\alignL\sc{\vfil Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
\cell{\rule{0pt}{3.85\normalbaselineskip}}
\erow
%
\brow
\nc{ltb}
\nc{tb}
\nc{rtb}\alignL\sc{\vfil Hausaufgabe zur nächten Stunde:}
\nc{ltb}
\nc{tb}
\nc{tb}
\nc{rtb}\alignL\sc{\vfil Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauri}
\cell{\rule{0pt}{3.85\normalbaselineskip}}
\erow
\makeatother
\end{calstable}\par
\end{landscape}
\end{document}