From 49b006e1a6bc383fdf41f765683a3d6397de45ae Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 10 Feb 2016 16:39:56 -0500 Subject: [PATCH] cheese: Add a macro with the standard "setup" section These rows are duplicated across just about all of my cheeses, so let's use a standard definition that only needs to be modified in a single place. Signed-off-by: Anna Schumaker --- cheddar.tex | 14 +------------- cheese.sty | 33 +++++++++++++++++++++++++++++++++ gouda.tex | 1 + 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/cheddar.tex b/cheddar.tex index f75731c..d0d1daa 100644 --- a/cheddar.tex +++ b/cheddar.tex @@ -5,30 +5,18 @@ \usepackage{cheese} \usepackage{gensymb} -\usepackage{graphicx} -\usepackage{hhline} -\usepackage{multirow} \usepackage[document]{ragged2e} -\usepackage[table]{xcolor} % Create new table commands \newcommand{\chline} { \hhline{|~*{7}{|-}|} } -\newcommand{\gray} { \cellcolor{gray!30} } -\newcommand{\newsection}[2] { \thickline\multirow{#2}{*}{\rotatebox{90}{\tbhead{#1}}} } % Let's make some shortcuts! \newcommand{\tempF}[1] {#1\degree F} -\newcommand{\half} {\(\frac{1}{2}\) } -\newcommand{\quarter} {\(\frac{1}{4}\) } \begin{document} \begin{cheese}{Cheddar} -\newsection{Setup}{4} - & Prepare Milk & 2 gallons & & \gray & & & \\ \chline - & Calcium Chloride & \half teaspoon & & \gray & & & (Optional) Diluted in \quarter cup distilled water. \\ \chline - & Begin Heating & & & \gray & \gray & & \\ \chline - & Remove from Heat & \gray & & & & & \\ +\StandardCheeseSetupSection \newsection{Acid}{2} & Mesophilic Starter & 1 packet & & \tempF{81} & & & 1 packet = \quarter teaspoon. \\ \chline diff --git a/cheese.sty b/cheese.sty index 5ebae05..6bd8c05 100644 --- a/cheese.sty +++ b/cheese.sty @@ -3,12 +3,22 @@ % \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}} @@ -48,3 +58,26 @@ % FIXME: A newline was required for the \thickline to show up? } + +% Preformat some fractions +\newcommand{\half} {\(\frac{1}{2}\) } +\newcommand{\quarter} {\(\frac{1}{4}\) } + +% Make a reusable diluted message +\newcommand{\diluted} { Diluted in \quarter cup distilled water} + +% 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 & & & & & \\ +} diff --git a/gouda.tex b/gouda.tex index 74879bc..886d532 100644 --- a/gouda.tex +++ b/gouda.tex @@ -8,6 +8,7 @@ \begin{document} \begin{cheese}{Gouda} +\StandardCheeseSetupSection \end{cheese} \end{document}