1

I have problems rebuilding a complex table for my training plan. A filled macrocycle from the book Training for Climbing looks like: Macrocycle

I tried to use tabularx and subtables for the fine grid lines, but it crashs. Here is a code example (without the subtables):

\documentclass[11pt,a4paper,landscape]{scrartcl}

\usepackage[left=1.5cm,right=1cm,top=2cm,bottom=1cm]{geometry} \usepackage{tabularx} \usepackage{array,booktabs,pgffor}

\newcommand{\numarr}[1]{% \foreach \n in {1,...,#1}{\footnotesize\ \n} } \newcommand{\emarr}[1]{% \foreach \n in {1,...,#1}{\footnotesize\ \phantom{x}} }

\newcolumntype{Y}{>{\centering\arraybackslash}X} \renewcommand{\arraystretch}{1.3}

\begin{document} \begin{tabularx}{.4\textwidth}{@{}r|Y|Y|Y@{}} Year & \multicolumn{3}{c}{Header} \ \hline \phantom{x2022x}% & \multicolumn{3}{c}{}% \[1cm] \hline month & Jan & Feb & Mär \ \hline weak% &\numarr{5}% &\numarr{4}% &\numarr{4}% \ \hline Fokus &grid&grid&grid \[3em] \hline &grid&grid&grid \[3em] \hline &&& \[8em] \hline \end{tabularx} \end{document}

I would be really happy if someone has a hint or a similar example.

Thank in advance! Tommy

  • 1
    The usual approach is to start with the smallest divisions and use \multicolumn and \multirow for the larger divisions. In other words, weeks (or whatever that is) not months. – John Kormylo Nov 20 '21 at 15:52
  • I suspected this answer. Is there an easy and clear way to generate a given number of "&" symbols (perhaps as macro or something else)? – ettoetto Nov 20 '21 at 16:29

2 Answers2

1

You could also try the bytefield package which is sometimes easier when you would need lots of \multicolumns in a table. Since all the gridlines are all the same size though, I added some extra spacing

\documentclass{article}
\usepackage[margin=.75in]{geometry}
\usepackage{bytefield}
\usepackage{rotating}
\begin{document}
\thispagestyle{empty}
\begin{sidewaystable}
\centering
\begin{bytefield}[bitwidth=1em]{67}
\bitbox{15}{\raggedright\ Name/Year}& \bitbox{52}{Training Objectives and Seasonal Climbing Goals}\\
\bytefieldsetup{bitheight=12ex}%
\bitbox{15}{}&\bitboxes{13}{{}{}{}{}}\\
\bytefieldsetup{bitheight=3ex}%

\bitbox{15}{\raggedright\ Month} & \bitbox{5}{Jan} & \bitboxes{4}{{Feb}{Mar}} & \bitbox{5}{Apr} & \bitboxes{4}{{Jun}{May}} & \bitbox{5}{Jul} & \bitboxes{4}{{Aug}{Sep}} & \bitbox{5}{Oct} & \bitboxes{4}{{Nov}{Dec}}\

\bitbox{15}{\raggedright\ Week} & \bitboxes{1}{{\tiny1} {\tiny2} {\tiny3} {\tiny4} {\tiny5} {\tiny6} {\tiny7} {\tiny8} {\tiny9} {\tiny10} {\tiny11} {\tiny12} {\tiny13} {\tiny14} {\tiny15} {\tiny16} {\tiny17} {\tiny18} {\tiny19} {\tiny20} {\tiny21} {\tiny22} {\tiny23} {\tiny24} {\tiny25} {\tiny26} {\tiny27} {\tiny28} {\tiny29} {\tiny30} {\tiny31} {\tiny32} {\tiny33} {\tiny34} {\tiny35} {\tiny36} {\tiny37} {\tiny38} {\tiny39} {\tiny40} {\tiny41} {\tiny42} {\tiny43} {\tiny44} {\tiny45} {\tiny46} {\tiny47} {\tiny48} {\tiny49} {\tiny50} {\tiny51} {\tiny52}}\[1ex]

\bitbox[lt]{2}{}&\bitbox{13}{\raggedright\ Stamina/skill}&\bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\ \bitbox[l]{2}{}&\bitbox{13}{\raggedright\ Max. Strength and power}&\bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\ \bitbox[l]{2}{\rotatebox[origin=tl]{90}{\ \ \ Training focus}}&\bitbox{13}{\raggedright\ Anaerobic Performance}&\bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\ \bitbox[lb]{2}{}&\bitbox{13}{\raggedright\ Rest}&\bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\[1ex]

\bitbox[lt]{14}{} & \bitbox[tr]{1}{\tiny7} & \bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\ \bitbox[l]{14}{} & \bitbox[]{1}{\tiny6} & \bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\ \bitbox[l]{14}{} & \bitbox[r]{1}{\tiny5} & \bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\ \bitbox[l]{14}{\raggedright\ Total number of days per\\ week of finger training or\\ climbing} & \bitbox[]{1}{\tiny4} & \bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\ \bitbox[l]{14}{} & \bitbox[]{1}{\tiny3} & \bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\ \bitbox[l]{14}{} & \bitbox[]{1}{\tiny2} & \bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\ \bitbox[lb]{14}{} & \bitbox[b]{1}{\tiny1} & \bitboxes{1}{{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}}\ \bytefieldsetup{bitheight=18ex}% \bitbox{15}{\raggedright\ Benchmark achievements\\ and notes} & \bitbox{5}{} & \bitboxes{4}{{}{}} & \bitbox{5}{} & \bitboxes{4}{{}{}} & \bitbox{5}{} & \bitboxes{4}{{}{}} & \bitbox{5}{} & \bitboxes{4}{{}{}}\ \end{bytefield} \end{sidewaystable} \end{document}

enter image description here

Dan
  • 3,699
  • Thanks for implementing the full example ... I already build an own table, but this is more beautiful :-) – ettoetto Nov 20 '21 at 20:30
0

After getting the usual approach from John Kormylo, I switched to the tabu-package and used the code from https://tex.stackexchange.com/a/489775/238225 to generate a numbered (and empty) loop over the calendar weeks. Here is my way:

\documentclass{article}
\usepackage[margin=.75in]{geometry}
\usepackage{rotating}
\usepackage[ngerman]{babel} % English language hyphenation
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Use 8-bit encoding
\usepackage{tabu}
\usepackage{multirow}
\usepackage{array,booktabs}

\newcolumntype{Y}{>{\centering\arraybackslash}X} \newcommand{\mcfront}[1]{\multicolumn{3}{c!{\vrule width 1.2pt}}{#1}} \newcommand{\mcquart}{\multicolumn{13}{c!{\vrule width 1.2pt}}{}} \newcommand{\mcmonth}[1]{\multicolumn{4}{c|}{#1}} \newcommand{\mcrmonth}[1]{\multicolumn{4}{c!{\vrule width 1.2pt}}{#1}} \newcommand{\mclmonth}[1]{\multicolumn{5}{c|}{#1}}

%loop to generate cells \newcounter{col} \makeatletter \newcommand\colloop@add[2] {% \expandafter\g@addto@macro\expandafter\colloop@\expandafter {\colloop@@{#1}}% \ifnum#2>\value{col} \g@addto@macro\colloop@{&}% \fi } \newcommand\colloop[2] {% {% \setcounter{col}{0}% \gdef\colloop@{}% \gdef\colloop@@##1{#2}% \loop\ifnum#1>\value{col} \stepcounter{col}% \expandafter\colloop@add\expandafter{\the\value{col}}{#1}% \repeat }% \colloop@ } \makeatletter

\begin{document} \setlength{\tabcolsep}{1pt} \begin{sidewaystable} \centering \begin{tabu} to .9\textwidth {llr !{\vrule width 1.2pt}Y {12}{|Y} !{\vrule width 1.2pt}Y {12}{|Y} !{\vrule width 1.2pt}Y {12}{|Y} !{\vrule width 1.2pt}Y {12}{|Y} !{\vrule width 1.2pt}}% \tabucline[1.2pt]- \rowfont[c]\bfseries \multicolumn{3}{c!{\vrule width 1.2pt}}{Jahr}& \multicolumn{52}{c!{\vrule width 1.2pt}}{Trainings- und Kletterziele} \ \tabucline[1.2pt]- \mcfront{} & \mcquart & \mcquart & \mcquart & \mcquart \[2cm] \tabucline[1.2pt]- \multicolumn{3}{r!{\vrule width 1.2pt}}{Monat\phantom{x}} & \mclmonth{Jan} & \mcmonth{Feb} & \mcrmonth{Mär} & \mclmonth{Apr} & \mcmonth{Mai} & \mcrmonth{Jun} & \mclmonth{Jul} & \mcmonth{Aug} & \mcrmonth{Sep} & \mclmonth{Okt} & \mcmonth{Nov} & \mcrmonth{Dez} \ \tabucline[1.4pt]- \multicolumn{3}{r!{\vrule width 1.2pt}}{Woche\phantom{x}} & \colloop{52}{\footnotesize #1} \ \tabucline[1.4pt]- \parbox[t]{4mm}{\multirow{6}{}{\rotatebox{90}{Fokus}}} & \multicolumn{2}{|c!{\vrule width 1.2pt}}{Technik} &\colloop{52}{}\\tabucline{2-} & \multicolumn{2}{|c!{\vrule width 1.2pt}}{Max-/Schnellkraft} &\colloop{52}{}\\tabucline{2-} & \multicolumn{2}{|c!{\vrule width 1.2pt}}{Kraftausdauer} &\colloop{52}{}\\tabucline{2-} & \multicolumn{2}{|c!{\vrule width 1.2pt}}{Anaerobe Ausdauer} &\colloop{52}{}\\tabucline{2-} & \multicolumn{2}{|c!{\vrule width 1.2pt}}{Aerobe Ausdauer} &\colloop{52}{}\\tabucline{2-} & \multicolumn{2}{|c!{\vrule width 1.2pt}}{Ruhetag} &\colloop{52}{} \ \tabucline[1.4pt]- & \parbox[t]{4mm}{\multirow{8}{}{\begin{minipage}{8em}\centering Anzahl an Kletter- und Trainingstagen pro Woche\end{minipage}}} & \parbox[t]{4mm}{\multirow{8}{*}{\begin{minipage}{1em}\centering\vspace{.3em}7\vspace{.3pt} 6\vspace{0.3pt} 5\vspace{0.3pt} 4\vspace{0.3pt} 3\vspace{0.3pt} 2\vspace{0.3pt} 1\vspace{0.3pt} \end{minipage}}} &\colloop{52}{}\\tabucline{4-} && &\colloop{52}{}\\tabucline{4-} && &\colloop{52}{}\\tabucline{4-} && &\colloop{52}{}\\tabucline{4-} && &\colloop{52}{}\\tabucline{4-} && &\colloop{52}{}\\tabucline{4-} && &\colloop{52}{}\\tabucline{4-} && &\colloop{52}{} \ \tabucline[1.4pt]- \multicolumn{3}{r!{\vrule width 1.2pt}}{Gewicht\phantom{x}} &\colloop{52}{} \ \tabucline[1.4pt]- \multicolumn{3}{r!{\vrule width 1.2pt}}{\begin{minipage}{8em}\centering \vspace{2.25cm}Erfolge und Kommentare\vspace{2.25cm}\end{minipage}} & \mclmonth{} & \mcmonth{} & \mcrmonth{} & \mclmonth{} & \mcmonth{} & \mcrmonth{} & \mclmonth{} & \mcmonth{} & \mcrmonth{} & \mclmonth{} & \mcmonth{} & \mcrmonth{} \ \tabucline[1.4pt]- \end{tabu} \end{sidewaystable} \end{document}

with the result: Macrocycle from Eric Hörst

I tried to avoid the tabu-package, but I couldn't rebuild it with tabularx.