%
% Copyright 2016 (c) Anna Schumaker.
%

\usepackage{gensymb}
\usepackage[landscape, top=0.8in, bottom=0.5in, left=0.7in, right=0.7in]{geometry}
\usepackage{graphicx}
\usepackage{hhline}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage[table]{xcolor}

% Create a thick line for table borders
\newcommand{\thickline}{\Xhline{2\arrayrulewidth}}

% Create a thinner line for separating steps
\renewcommand{\_} {\\ \hhline{|~*{7}{|-}|}}

% Turn a table cell gray
\newcommand{\gray}{\cellcolor{gray!30}}

% Set up a common table header style
\newcommand{\tbhead}[1]{\bfseries\centering\arraybackslash\footnotesize{#1}}

% Add a new column type for centered columns of specified width
\newcolumntype{C}{>{\centering\arraybackslash}p{0.85in}}

% ... and a new column type for thick vertical lines
\newcolumntype{'}{!{\vrule width 1pt}}

% Create a new environment that sets up everything we need to make cheese
\newenvironment{cheese}[1]
{
	\thispagestyle{empty}

	\noindent
	\setlength{\extrarowheight}{2pt}
	\begin{tabularx}{\textwidth}{ p{2.5in}lllX }
		Cheese: \textbf{#1} & Flavors: \hfill & & Date: & Age Until: \\
		Milk Brand: \hfill  & Type: ( Whole / \hspace{4em} )
				    & Homogenized: (Y / N )
				    & Pastuerized: ( Y / N )
				    & Other: \\
	\end{tabularx}

	\noindent
	\setlength{\tabcolsep}{3pt}
	\setlength{\extrarowheight}{4pt}
	\tabularx{\textwidth}{ 'c'c|C|C|C|C|c|X' }
		\thickline
		\tbhead{} & \tbhead{Operation} & \tbhead{Amount} & \tbhead{Time}
			  & \tbhead{Goal Temp} & \tbhead{Actual Temp}
			  & \tbhead{Ph} & \tbhead{Comments And Notes} \\
}
{
	\thickline
	\endtabularx

	% FIXME: A newline was required for the \thickline to show up?
}

% Preformat some fractions
\newcommand{\half}    {\(\frac{1}{2}\) }
\newcommand{\quarter} {\(\frac{1}{4}\) }

% Format a Fahrenheit temperature
\newcommand{\ftemp}[1] {#1\degree F}

% Make reusable diluted messages
\newcommand{\diluted}    {Diluted in \quarter cup distilled water}
\newcommand{\dilutemilk} {Diluted in \quarter cup cheese milk}

% Use this command to start a new section
\newcommand{\newsection}[2]
{
	\thickline\multirow{#2}{*}{\rotatebox{90}{\tbhead{#1}}}
}

% Standard setup section used by most cheeses
\newcommand{\StandardCheeseSetupSection}
{
	\newsection{Setup}{4}
	 & Prepare Milk     & 2 gallons      & & \gray &       &  & \_
	 & Calcium Chloride & \half teaspoon & & \gray & \gray &  & (Optional) \diluted. \_
	 & Begin Heating    &                & & \gray & \gray &  & \_
	 & Remove from Heat & \gray          & &       &       &  & \\
}
