答案1
以下是如何处理表格的概念证明(灵感来自如何使用 \whiledo 制作 tabularx 列?)
\documentclass{article}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{etoolbox}
\newcounter{index}
\newcounter{temp}
\newcounter{currentline}
\newcounter{numberoflines}
%% This create a command \Line to print a row of n elements, where n is the
%% argument of the command
\newcommand{\settabindex}[1]{%
\setcounter{index}{#1}%
\setcounter{temp}{0}%
\def\Line{}%
\whileboolexpr{test { \ifnumless{\value{temp}}{\value{index}} }}
{\stepcounter{temp}\edef\Line{\Line & }}%
}
%% set the counters for how many row we want to print
\newcommand{\setnumberoflines}[1]{
\setcounter{currentline}{0}
\setcounter{numberoflines}{#1}
}
%% This is for the second table. We create a command workout that print n
%% workout lines (and increase the counter for each workout)
\newcounter{workout}
\newcommand{\workouts}[1]{%
\setcounter{workout}{0}%
\whileboolexpr{test { \ifnumless{\value{workout}}{#1} }}
{\stepcounter{workout}Workout \theworkout \Line
\ifnumless{\value{workout}}{#1}{\\\hline}{}}
}
\begin{document}
%% FIRST TABLE
\settabindex{10}
\setnumberoflines{10}
\begin{tabularx}{\textwidth}
{|X|
>{\columncolor{cyan!20}}c|
c|c|
>{\columncolor{cyan!20}}c|
c|c|
>{\columncolor{cyan!20}}c|
c|c|c|}
\hline
\rowcolor{black!15}
\multicolumn{1}{|l}{Exercise} &
\multicolumn{1}{c}{TR} &
\multicolumn{1}{c}{AR} &
\multicolumn{1}{c}{W} &
\multicolumn{1}{c}{TR} &
\multicolumn{1}{c}{AR} &
\multicolumn{1}{c}{W} &
\multicolumn{1}{c}{TR} &
\multicolumn{1}{c}{AR} &
\multicolumn{1}{c}{W} &
\multicolumn{1}{c|}{RBS}
\whileboolexpr
{test { \ifnumless{\value{currentline}}{\value{numberoflines}} }}
{\\\hline\stepcounter{currentline}\Line}\\
\hline
\end{tabularx}
\newpage
%% SECOND TABLE
\settabindex{8}
\noindent
\begin{tabularx}{\textwidth}{|l|c|c|*{5}{X|}c|}
\rowcolor{black}
\textcolor{white}{Exercise} &
\textcolor{white}{Sets} &
\textcolor{white}{Reps} &
\textcolor{white}{Set 1} &
\textcolor{white}{Set 2} &
\textcolor{white}{Set 3} &
\textcolor{white}{Set 4} &
\textcolor{white}{Set 5} &
\textcolor{white}{Rest}\\
\hline
\multicolumn{9}{|c|}{}\\
\hline
\workouts{4}\\
\hline
\multicolumn{9}{|c|}{}\\
\hline
\workouts{5}\\
\hline
\multicolumn{9}{|c|}{}\\
\hline
\workouts{3}\\
\hline
\workouts{4}\\
\hline
\end{tabularx}
\end{document}
答案2
抱歉只提供了链接,但我认为最好的办法是找到一些 excel 格式的锻炼日志(这一页有一些很好的例子,但最好还是自己动手做,然后通过简化 LaTeX 表格生成的工具综合列表...