| | |
| | \ProvidesClass{recipe-book}[2013/01/14] |
| | -\LoadClass[twoside,11pt]{memoir} |
| | - |
| | -%%%% Page Geometries |
| | -\setstocksize{10in}{8in} |
| | -\settrimmedsize{\stockheight}{\stockwidth}{*} |
| | -\setlrmarginsandblock{1.25in}{.75in}{*} |
| | -\setulmarginsandblock{.75in}{1in}{*} |
| | -\setlength{\footskip}{5em} |
| | -\setlength{\parindent}{0pt} |
| | -\checkandfixthelayout |
| | - |
| | - |
| | -% haven't really figured out the xetex part yet. pdflatex only for now. |
| | -%\RequirePackage{ifxetex,ifpdf} |
| | -%\ifxetex |
| | -%\fi |
| | -%\ifpdf |
| | -\RequirePackage[utf8]{inputenc} |
| | -\RequirePackage[T1]{fontenc} |
| | -\RequirePackage{mathpazo} |
| | -\RequirePackage{avant} |
| | -\RequirePackage{needspace} |
| | -\RequirePackage{ccicons} |
| | -%\fi |
| | - |
| | - |
| | -%%%% Load packages here |
| | -\RequirePackage{graphicx} |
| | -\RequirePackage[xcolornames,svgnames,dvipsnames,rgb]{xcolor} |
| | -\RequirePackage[inline]{enumitem} |
| | -\RequirePackage{etoolbox} |
| | -\RequirePackage{stringstrings} |
| | -\RequirePackage{textcomp,wasysym,marvosym} |
| | -\RequirePackage{amssymb} |
| | -\RequirePackage{tikz} |
| | -\RequirePackage{arrayjobx} |
| | -\usetikzlibrary{shapes,decorations,decorations.pathmorphing} |
| | -\usetikzlibrary{shadows.blur} |
| | -\RequirePackage{multicol} |
| | -\RequirePackage{afterpage} |
| | -\RequirePackage{wallpaper} |
| | -\RequirePackage{filecontents} |
| | -\RequirePackage{microtype} |
| | -\RequirePackage{bookmark} |
| | - |
| | -% From http://tex.stackexchange.com/a/9266/226 |
| | -% to fix potential problems with opacity, colourspace |
| | -% in PDF |
| | -\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>} |
| | - |
| | -\def\@frontcoverphoto{} |
| | -\newcommand{\frontcoverphoto}[1]{% |
| | - \def\@frontcoverphoto{#1} |
| | -} |
| | - |
| | -% For Inserts. |
| | -% \DeclareInserts{25}{ad1.jpg, ad2.jpg, ad3.jpg, ad4.jpg} |
| | -% \InsertAd will cycle through ad1.jpg -> ad4.jpg everytime |
| | -% it is called. |
| | -% It'll be called after every 25 recipes. |
| | -\newarray\Inserts |
| | -\newcounter{advertTotal} |
| | -\newcounter{advertIdx} |
| | -\newcounter{recipeIdx} |
| | -\newcommand{\advertTotal}{\theadvertTotal} |
| | -\newcommand{\DeclareInserts}[2]{% |
| | - \def\recipeAdCount{#1} |
| | - \renewcommand*{\do}[1]{% |
| | - \stepcounter{advertTotal}% |
| | - \Inserts(\arabic{advertTotal})={##1} |
| | - } |
| | - \docsvlist{#2} |
| | -} |
| | -\newcommand{\InsertAd}{% |
| | - \ifnumequal{\theadvertTotal}{0}{}{% |
| | - \thispagestyle{empty} |
| | - \stepcounter{advertIdx}% |
| | - \pgfmathparse{mod(\theadvertIdx - 1,\advertTotal) + 1} |
| | - \pgfmathtruncatemacro{\adIdx}{\pgfmathresult}% |
| | - \checkInserts(\adIdx) |
| | - \ThisTileWallPaper{\paperwidth}{\paperheight}{\cachedata} |
| | - \mbox{}\clearpage |
| | - } |
| | -} |
| | - |
| | - |
| | -%%% Hook for cover page etc |
| | -% TODO: change this to use key options |
| | -\newcommand{\makecover}[1][]{% |
| | -\begin{titlingpage} |
| | -\ifdefempty{\@frontcoverphoto}{% |
| | - \maketitle |
| | -}{% |
| | - \ThisTileWallPaper{\paperwidth}{\paperheight}{\@frontcoverphoto} |
| | - \mbox{}\clearpage |
| | -} |
| | -\thispagestyle{empty} |
| | -\ifstrequal{#1}{copyrightpage}{\clearpage\makecrpage}{} |
| | -\end{titlingpage}% |
| | -} |
| | - |
| | -\newcommand{\makecrpage}{% |
| | -%\begin{titlingpage} |
| | -\mbox{} |
| | -\vfill |
| | -\small |
| | -Recipe compilation by \theauthor.\\ |
| | -\\ |
| | -This book is available under a \href{http://creativecommons.org/licenses/by-sa/3.0/}{Creative Commons Attribution-ShareAlike License}.\\ |
| | -Generated using \href{http://recipezeal.com}{Recipe Zeal} and \LaTeX.\\ |
| | -Book design and themes by \href{http://liantze.penguinattack.org}{Lian Tze Lim}. |
| | -%\end{titlingpage}% |
| | -} |
| | - |
| | -%%% turn off sectional numberings |
| | -\patchcommand{\mainmatter}{}{% |
| | -\setcounter{secnumdepth}{-1} |
| | -\setcounter{tocdepth}{1} |
| | -} |
| | - |
| | -%%%% TODO cooking time, preparation time, portion... "atomic" fields |
| | -\newcommand{\ovenstyle}{} |
| | -\newcommand{\oven}[1]{\makebox{\ovenstyle Preheat oven to #1}\par} |
| | - |
| | -\newcommand{\maintextcolor}{black} |
| | -\newcommand{\primarycolor}{blue} |
| | -\newcommand{\secondarycolor}{blue!80} |
| | -\newcommand{\tertiarycolor}{blue!60} |
| | -\newcommand{\primarycolorcomplement}{white} |
| | -\newcommand{\secondarycolorcomplement}{white} |
| | -\newcommand{\tertiarycolorcomplement}{white} |
| | -\newcommand{\darkhighlight}{red!80!black} |
| | -\newcommand{\brighthighlight}{red} |
| | -\newcommand{\highlightcolor}{\darkhighlight} |
| | -\newcommand{\externallinkcolor}{SteelBlue} |
| | - |
| | -\newcommand{\scriptdefault}{pzc} |
| | -\newcommand{\scriptfamily}{\fontfamily{\scriptdefault}\selectfont} |
| | - |
| | -\newcommand{\recipecolor}{\highlightcolor} |
| | -\newcommand{\recipefamily}{\sffamily} |
| | -\newcommand{\recipesize}{\LARGE} |
| | -\newcommand{\recipestyle}{\bfseries} |
| | -\newcommand{\recipefont}{\recipefamily\recipesize\color{\recipecolor}\recipestyle} |
| | - |
| | -\newcommand{\headingcolor}{\primarycolor} |
| | -\newcommand{\headingfamily}{\sffamily} |
| | -\newcommand{\headingsize}{\large} |
| | -\newcommand{\headingstyle}{\itshape} |
| | -\newcommand{\headingfont}{\headingfamily\headingsize\color{\headingcolor}\headingstyle} |
| | - |
| | -\renewcommand{\chaptitlefont}{\recipefamily\color{\recipecolor}\bfseries\HUGE\centering} |
| | -\setsecheadstyle{\recipefont} |
| | -\setsubsecheadstyle{\headingfont} |
| | - |
| | -\newcommand{\headingmarker}{\textbullet} |
| | -\newcommand{\itemmarker}{\textbullet} |
| | -\newcommand{\enumeratemarker}[1]{#1.} |
| | -\newcommand{\inlinelistmarker}{\makebox[1.5em][c]{\textbullet}} |
| | - |
| | -\newcommand{\equipmentstyle}{leftmargin=*} |
| | -\newcommand{\ingredientsstyle}{label=\textbullet,leftmargin=*} |
| | -\newcommand{\preparationstyle}{label=\textbullet,leftmargin=*} |
| | -\newcommand{\instructionsstyle}{label={\arabic*. },leftmargin=*} |
| | - |
| | - |
| | -%%%% Basic structures, redefine as needed in theme files using titlesec and enumitem. |
| | -\newcommand{\recipecategory}[1]{% |
| | -\clearforchapter |
| | -\formatcategorypage{#1} |
| | -\phantomsection\addcontentsline{toc}{chapter}{#1} |
| | -\clearpage |
| | -} |
| | - |
| | -\newcommand{\formatcategorypage}[1]{% |
| | -\thispagestyle{empty} |
| | -\vspace*{\stretch{1}} |
| | -\begin{center} |
| | -\fontsize{48pt}{50pt}\headingfamily\bfseries\selectfont\color{\recipecolor}#1 |
| | -\end{center} |
| | -\vspace*{\stretch{2}} |
| | -} |
| | - |
| | -\newenvironment{recipe}[1]{% |
| | - \clearpage% |
| | - \color{\maintextcolor}% |
| | - \section{#1} |
| | -}{} |
| | - |
| | -\AfterEndEnvironment{recipe}{% |
| | - % Check if an ad should be inserted |
| | - \ifdef{\recipeAdCount}{ |
| | - \ifnumgreater{\theadvertTotal}{0}{ |
| | - \stepcounter{recipeIdx} |
| | - \pgfmathparse{mod(\therecipeIdx,\recipeAdCount)} |
| | - \pgfmathtruncatemacro{\recIdx}{\pgfmathresult} |
| | - \ifnumequal{\recIdx}{0}{\afterpage{\InsertAd}}{} |
| | - }{} |
| | - }{} |
| | -} |
| | - |
| | - |
| | -\newcommand{\fullpagephoto}[1]{% |
| | -%\ThisTileWallPaper{.7in}{.6in}{photo/echeveria} |
| | -\ThisTileWallPaper{\paperwidth}{\paperheight}{#1} |
| | -\mbox{}\clearpage |
| | -} |
| | - |
| | -\newcommand{\insetphoto}[1]{% |
| | -\includegraphics[width=.4\textwidth]{#1}\par |
| | -} |
| | - |
| | -\newcommand{\checkfiller}{% |
| | - \clearpage |
| | - \checkoddpage\strictpagecheck |
| | - \ifoddpage\ThisTileWallPaper{\paperwidth}{\paperheight}{photo/filler1}\mbox{}\clearpage\fi |
| | -} |
| | - |
| | -\newcommand{\photo}[1]{\insetphoto{#1}} |
| | - |
| | - |
| | -\newcommand{\SpreadWallPaperLeft}[1]{% |
| | -\sbox0{\includegraphics{#1}}% |
| | -\AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){% |
| | - \parbox[b][\paperheight]{\paperwidth}{% |
| | - \vfill |
| | - \centering |
| | - \includegraphics[width=\paperwidth,height=\paperheight,clip,trim=0 0 {.5\wd0} 0]{#1}% |
| | - \vfill |
| | - }}} |
| | -} |
| | - |
| | -\newcommand{\SpreadWallPaperRight}[1]{% |
| | -\sbox0{\includegraphics{#1}}% |
| | -\AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){% |
| | - \parbox[b][\paperheight]{\paperwidth}{% |
| | - \vfill |
| | - \centering |
| | - \includegraphics[width=\paperwidth,height=\paperheight,clip,trim={.5\wd0} 0 0 0]{#1}% |
| | - \vfill |
| | - }}} |
| | -} |
| | - |
| | -\newcommand{\twopagespreadphoto}[1]{% |
| | -%\clearpage |
| | -%\sbox0{\includegraphics{#1}}% |
| | -\SpreadWallPaperLeft{#1} |
| | -\mbox{}\clearpage |
| | -\afterpage{\SpreadWallPaperRight{#1} |
| | -\mbox{}\clearpage} |
| | -} |
| | - |
| | -\newenvironment{equipment}[1][Equipment]{% |
| | - \needspace{3\baselineskip} |
| | - \subsection{#1} |
| | - \expandafter\setlist\expandafter{\equipmentstyle}% |
| | - \begin{equipmentlist} |
| | -}{% |
| | - \end{equipmentlist} |
| | -} |
| | - |
| | -\newenvironment{equipmentlist}{% |
| | - \begin{description} |
| | -}{% |
| | - \end{description} |
| | -} |
| | - |
| | -\newcommand{\compactequipment}{% |
| | - \renewenvironment{equipmentlist}{% |
| | - \begin{description*}[mode=unboxed,leftmargin=*,itemjoin=\inlinelistmarker] |
| | - }{% |
| | - \end{description*}. |
| | - } |
| | -} |
| | - |
| | -\newcommand{\normalequipment}{% |
| | - \renewenvironment{equipmentlist}{% |
| | - \begin{description} |
| | - }{% |
| | - \end{description}. |
| | - } |
| | -} |
| | - |
| | -\newenvironment{preparation}[1][Preparation]{% |
| | - \needspace{3\baselineskip} |
| | - \subsection{#1} |
| | - \expandafter\setlist\expandafter{\preparationstyle}% |
| | - \begin{preparationlist} |
| | -}{% |
| | - \end{preparationlist} |
| | -} |
| | - |
| | -\newenvironment{preparationlist}{% |
| | - \begin{itemize} |
| | -}{% |
| | - \end{itemize} |
| | -} |
| | - |
| | -\newcommand{\normalpreparation}{% |
| | - \renewenvironment{preparationlist}{% |
| | - \begin{itemize} |
| | - }{% |
| | - \end{itemize} |
| | - } |
| | -} |
| | - |
| | -\newcommand{\compactpreparation}{% |
| | - \renewenvironment{preparationlist}{% |
| | - \begin{itemize*}[label={},afterlabel={},itemjoin=\inlinelistmarker] |
| | - }{% |
| | - \end{itemize*} |
| | - } |
| | -} |
| | - |
| | - |
| | -\newenvironment{ingredients}[1][Ingredients]{% |
| | - \needspace{3\baselineskip} |
| | - \subsection{#1}% |
| | - \expandafter\setlist\expandafter{\ingredientsstyle}% |
| | - \begin{ingredientlist} |
| | -}{% |
| | - \end{ingredientlist} |
| | -} |
| | - |
| | -%\RequirePackage{pgfkeys} |
| | -%\pgfkeys{ |
| | -% /myparbox/.is family, /myparbox, |
| | -% width/.estore in = \myparboxWidth, |
| | -% height/.estore in = \myparboxHeight, |
| | -%} |
| | -\newcommand{\ingred}[3]{% |
| | -\item {#1}\space\notblank{#2}{#2\space}{}{#3} |
| | -} |
| | - |
| | -\newenvironment{ingredientlist}{% |
| | - \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}} |
| | - \begin{itemize} |
| | -}{% |
| | - \end{itemize} |
| | -} |
| | - |
| | -\newcommand{\tabularingredients}{% |
| | - \renewcommand{\ingred}[3]{{##1}\space\notblank{##2}{##2}{} & {##3}\\} |
| | - \renewenvironment{ingredientlist}{% |
| | - \begin{tabular}{r l} |
| | - }{% |
| | - \end{tabular} |
| | - } |
| | -} |
| | - |
| | -\newcommand{\compactingredients}{% |
| | - \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}} |
| | - \renewenvironment{ingredientlist}{% |
| | - \begin{itemize*}[label={},afterlabel={},itemjoin={;\space},noitemsep] |
| | - }{% |
| | - \end{itemize*}. |
| | - } |
| | -} |
| | - |
| | -\newcommand{\normalingredients}{% |
| | - \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}} |
| | - \renewenvironment{ingredientlist}{% |
| | - \begin{itemize} |
| | - }{% |
| | - \end{itemize} |
| | - } |
| | -} |
| | - |
| | -\newenvironment{instructions}[1][Cooking Instructions]{% |
| | - \needspace{3\baselineskip} |
| | - \subsection{#1} |
| | - \expandafter\setlist\expandafter{\instructionsstyle}% |
| | - \begin{instructionlist} |
| | -}{ |
| | - \end{instructionlist} |
| | -} |
| | - |
| | -\newenvironment{instructionlist}{% |
| | - \begin{enumerate} |
| | -}{% |
| | - \end{enumerate} |
| | -} |
| | - |
| | -\newcommand{\normalinstructions}{% |
| | - \renewenvironment{instructionlist}{% |
| | - \begin{enumerate} |
| | - }{% |
| | - \end{enumerate} |
| | - } |
| | -} |
| | - |
| | -\newcommand{\compactinstructions}{% |
| | - \renewenvironment{instructionlist}{% |
| | - \begin{enumerate*}[label={},afterlabel={},itemjoin=\inlinelistmarker] |
| | - }{% |
| | - \end{enumerate*} |
| | - } |
| | -} |
| | - |
| | - |
| | -\newcommand{\startinstructions}{} |
| | - |
| | - |
| | -%%% Some useful commands |
| | - |
| | -\newcommand{\framedNum}[1]{\protect\tikz[baseline=-3.5pt]\protect\node[draw=none,fill=\secondarycolor,text=\secondarycolorcomplement,rectangle,aspect=1,minimum width=1.3em,inner xsep=1pt,font=\scriptsize]{#1};} |
| | - |
| | -\newcommand{\circledNum}[1]{\protect\tikz[baseline=-3.5pt]\protect\node[draw=none,fill=\secondarycolor,text=\secondarycolorcomplement,circle,minimum width=1.25em,inner sep=1pt,font=\scriptsize]{#1};} |
| | - |
| | -\newcommand{\triangledNum}[1]{\protect\tikz[baseline=-3.5pt]\protect\node[isosceles triangle,isosceles triangle apex angle=75,shape border rotate=90,draw=none,minimum width=1.5em,inner xsep=1pt,fill=\secondarycolor,font=\scriptsize]{#1};} |
| | - |
| | -\newcommand*{\framedPage}{\tikz[overlay]\node[fill=\tertiarycolor,text=\tertiarycolorcomplement,text depth=.2in,minimum height=.5in,minimum width=2em,font=\sffamily]{\thepage};} |
| | - |
| | - |
| | -%% Indices nested up to 5 levels |
| | -\xindyindex |
| | -%\long\def\lettergroup#1\item{\item\textcolor{\darkhighlight}} |
| | -%\newcommand{\lettergroup}[1]{\item{\item\textbf{#1}}} |
| | -%\let\lettergroupDefault\lettergroup |
| | -\renewcommand\subitem{\@idxitem } |
| | -\renewcommand\subsubitem{\@idxitem \hspace*{10\p@}} |
| | -\newcommand\sssubitem{\@idxitem \hspace*{20\p@}} |
| | -\newcommand\sssssubitem{\@idxitem \hspace*{30\p@}} |
| | -\newcommand\sssssssubitem{\@idxitem \hspace*{40\p@}} |
| | - |
| | -%% placeholders |
| | -\newcommand{\recipetitle}{} |
| | -\providelength{\tmplength} |
| | + |
| | +\RequirePackage{etoolbox} |
| | + |
| | +\newtoggle{ebook}\togglefalse{ebook} |
| | +\DeclareOption{ebook}{\toggletrue{ebook}} |
| | +\ProcessOptions\relax |
| | + |
| | +\iftoggle{ebook}{% |
| | + \LoadClass[oneside,11pt]{memoir} |
| | + \setstocksize{11in}{8.5in} |
| | + \settrimmedsize{\stockheight}{\stockwidth}{*} |
| | + \setlrmarginsandblock{.75in}{.75in}{*} |
| | + \setulmarginsandblock{.75in}{1in}{*} |
| | +}{% |
| | + \LoadClass[twoside,11pt]{memoir} |
| | + \setstocksize{10in}{8in} |
| | + \settrimmedsize{\stockheight}{\stockwidth}{*} |
| | + \setlrmarginsandblock{1.25in}{.75in}{*} |
| | + \setulmarginsandblock{.75in}{1in}{*} |
| | +} |
| | +\setlength{\footskip}{5em} |
| | +\setlength{\parindent}{0pt} |
| | +\checkandfixthelayout |
| | + |
| | +\RequirePackage[utf8]{inputenc} |
| | +\RequirePackage[T1]{fontenc} |
| | +\RequirePackage{mathpazo} |
| | +\RequirePackage{avant} |
| | +\RequirePackage{needspace} |
| | +\RequirePackage{ccicons} |
| | + |
| | + |
| | +%%%% Load packages here |
| | +\RequirePackage{graphicx} |
| | +\RequirePackage[xcolornames,svgnames,dvipsnames,rgb]{xcolor} |
| | +\RequirePackage[inline]{enumitem} |
| | +\RequirePackage{stringstrings} |
| | +\RequirePackage{textcomp,wasysym,marvosym} |
| | +\RequirePackage{amssymb} |
| | +\RequirePackage{tikz} |
| | +\RequirePackage{arrayjobx} |
| | +\usetikzlibrary{shapes,decorations,decorations.pathmorphing} |
| | +\usetikzlibrary{shadows.blur} |
| | +\RequirePackage{multicol} |
| | +\RequirePackage{afterpage} |
| | +\RequirePackage{wallpaper} |
| | +\RequirePackage{filecontents} |
| | +\RequirePackage{microtype} |
| | +\RequirePackage{bookmark} |
| | + |
| | +% From http://tex.stackexchange.com/a/9266/226 |
| | +% to fix potential problems with opacity, colourspace |
| | +% in PDF |
| | +\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>} |
| | + |
| | +%% placeholders |
| | +\newcommand{\recipetitle}{} |
| | +\providelength{\tmplength} |
| | +\def\@frontcoverphoto{} |
| | +\newcommand{\frontcoverphoto}[1]{% |
| | + \def\@frontcoverphoto{#1} |
| | +} |
| | + |
| | +% For Inserts. |
| | +% \DeclareInserts{25}{ad1.jpg, ad2.jpg, ad3.jpg, ad4.jpg} |
| | +% \InsertAd will cycle through ad1.jpg -> ad4.jpg everytime |
| | +% it is called. |
| | +% It'll be called after every 25 recipes. |
| | +\newarray\Inserts |
| | +\newcounter{advertTotal} |
| | +\newcounter{advertIdx} |
| | +\newcounter{recipeIdx} |
| | +\newcommand{\advertTotal}{\theadvertTotal} |
| | +\newcommand{\DeclareInserts}[2]{% |
| | + \def\recipeAdCount{#1} |
| | + \renewcommand*{\do}[1]{% |
| | + \stepcounter{advertTotal}% |
| | + \Inserts(\arabic{advertTotal})={##1} |
| | + } |
| | + \docsvlist{#2} |
| | +} |
| | +\newcommand{\InsertAd}{% |
| | + \ifnumequal{\theadvertTotal}{0}{}{% |
| | + \thispagestyle{empty} |
| | + \stepcounter{advertIdx}% |
| | + \pgfmathparse{mod(\theadvertIdx - 1,\advertTotal) + 1} |
| | + \pgfmathtruncatemacro{\adIdx}{\pgfmathresult}% |
| | + \checkInserts(\adIdx) |
| | + \ThisTileWallPaper{\paperwidth}{\paperheight}{\cachedata} |
| | + \mbox{}\clearpage |
| | + } |
| | +} |
| | + |
| | + |
| | +%%% Hook for cover page etc |
| | +% TODO: change this to use key options |
| | +\newcommand{\makecover}[1][]{% |
| | +\begin{titlingpage} |
| | +\ifdefempty{\@frontcoverphoto}{% |
| | + \maketitle |
| | +}{% |
| | + \ThisTileWallPaper{\paperwidth}{\paperheight}{\@frontcoverphoto} |
| | + \mbox{}\clearpage |
| | +} |
| | +\thispagestyle{empty} |
| | +\ifstrequal{#1}{copyrightpage}{\clearpage\makecrpage}{} |
| | +\end{titlingpage}% |
| | +} |
| | + |
| | +\newcommand{\makecrpage}{% |
| | +%\begin{titlingpage} |
| | +\mbox{} |
| | +\vfill |
| | +\small |
| | +Recipe compilation by \theauthor.\\ |
| | +\\ |
| | +This book is available under a \href{http://creativecommons.org/licenses/by-sa/3.0/}{Creative Commons Attribution-ShareAlike License}.\\ |
| | +Generated using \href{http://recipezeal.com}{Recipe Zeal} and \LaTeX.\\ |
| | +Book design and themes by \href{http://liantze.penguinattack.org}{Lian Tze Lim}. |
| | +%\end{titlingpage}% |
| | +} |
| | + |
| | +%%% turn off sectional numberings |
| | +\patchcommand{\mainmatter}{}{% |
| | +\setcounter{secnumdepth}{-1} |
| | +\setcounter{tocdepth}{1} |
| | +} |
| | + |
| | +%%%% TODO cooking time, preparation time, portion... "atomic" fields |
| | +\newcommand{\ovenstyle}{} |
| | +\newcommand{\oven}[1]{\makebox{\ovenstyle Preheat oven to #1}\par} |
| | + |
| | +\newcommand{\maintextcolor}{black} |
| | +\newcommand{\primarycolor}{blue} |
| | +\newcommand{\secondarycolor}{blue!80} |
| | +\newcommand{\tertiarycolor}{blue!60} |
| | +\newcommand{\primarycolorcomplement}{white} |
| | +\newcommand{\secondarycolorcomplement}{white} |
| | +\newcommand{\tertiarycolorcomplement}{white} |
| | +\newcommand{\darkhighlight}{red!80!black} |
| | +\newcommand{\brighthighlight}{red} |
| | +\newcommand{\highlightcolor}{\darkhighlight} |
| | +\newcommand{\externallinkcolor}{SteelBlue} |
| | + |
| | +\newcommand{\scriptdefault}{pzc} |
| | +\newcommand{\scriptfamily}{\fontfamily{\scriptdefault}\selectfont} |
| | + |
| | +\newcommand{\recipecolor}{\highlightcolor} |
| | +\newcommand{\recipefamily}{\sffamily} |
| | +\newcommand{\recipesize}{\LARGE} |
| | +\newcommand{\recipestyle}{\bfseries} |
| | +\newcommand{\recipefont}{\recipefamily\recipesize\color{\recipecolor}\recipestyle} |
| | + |
| | +\newcommand{\headingcolor}{\primarycolor} |
| | +\newcommand{\headingfamily}{\sffamily} |
| | +\newcommand{\headingsize}{\large} |
| | +\newcommand{\headingstyle}{\itshape} |
| | +\newcommand{\headingfont}{\headingfamily\headingsize\color{\headingcolor}\headingstyle} |
| | + |
| | +\renewcommand{\chaptitlefont}{\recipefamily\color{\recipecolor}\bfseries\HUGE\centering} |
| | +\setsecheadstyle{\recipefont} |
| | +\setsubsecheadstyle{\headingfont} |
| | + |
| | +\newcommand{\headingmarker}{\textbullet} |
| | +\newcommand{\itemmarker}{\textbullet} |
| | +\newcommand{\enumeratemarker}[1]{#1.} |
| | +\newcommand{\inlinelistmarker}{\makebox[1.5em][c]{\textbullet}} |
| | + |
| | +\newcommand{\equipmentstyle}{leftmargin=*} |
| | +\newcommand{\ingredientsstyle}{label=\textbullet,leftmargin=*} |
| | +\newcommand{\preparationstyle}{label=\textbullet,leftmargin=*} |
| | +\newcommand{\instructionsstyle}{label={\arabic*. },leftmargin=*} |
| | + |
| | + |
| | +%%%% Basic structures, redefine as needed in theme files using titlesec and enumitem. |
| | +\newcommand{\recipecategory}[1]{% |
| | +\clearforchapter |
| | +\formatcategorypage{#1} |
| | +\phantomsection\addcontentsline{toc}{chapter}{#1} |
| | +\clearpage |
| | +} |
| | + |
| | +\newcommand{\formatcategorypage}[1]{% |
| | +\thispagestyle{empty} |
| | +\vspace*{\stretch{1}} |
| | +\begin{center} |
| | +\fontsize{48pt}{50pt}\headingfamily\bfseries\selectfont\color{\recipecolor}#1 |
| | +\end{center} |
| | +\vspace*{\stretch{2}} |
| | +} |
| | + |
| | +\newenvironment{recipe}[1]{% |
| | + \clearpage% |
| | + \color{\maintextcolor}% |
| | + \section{#1} |
| | +}{} |
| | + |
| | +\AfterEndEnvironment{recipe}{% |
| | + % Check if an ad should be inserted |
| | + \ifdef{\recipeAdCount}{ |
| | + \ifnumgreater{\theadvertTotal}{0}{ |
| | + \stepcounter{recipeIdx} |
| | + \pgfmathparse{mod(\therecipeIdx,\recipeAdCount)} |
| | + \pgfmathtruncatemacro{\recIdx}{\pgfmathresult} |
| | + \ifnumequal{\recIdx}{0}{\afterpage{\InsertAd}}{} |
| | + }{} |
| | + }{} |
| | +} |
| | + |
| | +\newcommand{\insetphoto}[1]{% |
| | +\includegraphics[width=.4\textwidth]{#1}\par |
| | +} |
| | + |
| | +\newcommand{\fullpagephoto}[1]{% |
| | + \iftoggle{ebook}{ |
| | + %% photo will be displayed after instructions, may |
| | + %% not look nice. If possible, the XML itself should |
| | + %% have converted one-page to recipe-inset. |
| | + \vspace*{\baselineskip} |
| | + \insetphoto{#1} |
| | + }{%% \fullpagephoto needs to be given after instructions |
| | + %% to work nice |
| | + \afterpage{% |
| | + \ThisTileWallPaper{\paperwidth}{\paperheight}{#1} |
| | + \mbox{}\clearpage} |
| | + } |
| | +} |
| | + |
| | +\newcommand{\checkfiller}{% |
| | + \iftoggle{ebook}{}{% |
| | + \clearpage |
| | + \checkoddpage\strictpagecheck |
| | + \ifoddpage\ThisTileWallPaper{\paperwidth}{\paperheight}{photo/filler1}\mbox{}\clearpage\fi |
| | + } |
| | +} |
| | + |
| | +\newcommand{\photo}[1]{\insetphoto{#1}} |
| | + |
| | + |
| | +\newcommand{\SpreadWallPaperLeft}[1]{% |
| | +\sbox0{\includegraphics{#1}}% |
| | +\AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){% |
| | + \parbox[b][\paperheight]{\paperwidth}{% |
| | + \vfill |
| | + \centering |
| | + \includegraphics[width=\paperwidth,height=\paperheight,clip,trim=0 0 {.5\wd0} 0]{#1}% |
| | + \vfill |
| | + }}} |
| | +} |
| | + |
| | +\newcommand{\SpreadWallPaperRight}[1]{% |
| | +\sbox0{\includegraphics{#1}}% |
| | +\AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){% |
| | + \parbox[b][\paperheight]{\paperwidth}{% |
| | + \vfill |
| | + \centering |
| | + \includegraphics[width=\paperwidth,height=\paperheight,clip,trim={.5\wd0} 0 0 0]{#1}% |
| | + \vfill |
| | + }}} |
| | +} |
| | + |
| | +\newcommand{\twopagespreadphoto}[1]{% |
| | + \iftoggle{ebook}{% |
| | + \vspace*{\baselineskip} |
| | + \insetphoto{#1} |
| | + }{% |
| | + \SpreadWallPaperLeft{#1} |
| | + \mbox{}\clearpage |
| | + \afterpage{\SpreadWallPaperRight{#1} |
| | + \mbox{}\clearpage} |
| | + } |
| | +} |
| | + |
| | +\newenvironment{equipment}[1][Equipment]{% |
| | + \needspace{3\baselineskip} |
| | + \subsection{#1} |
| | + \expandafter\setlist\expandafter{\equipmentstyle}% |
| | + \begin{equipmentlist} |
| | +}{% |
| | + \end{equipmentlist} |
| | +} |
| | + |
| | +\newenvironment{equipmentlist}{% |
| | + \begin{description} |
| | +}{% |
| | + \end{description} |
| | +} |
| | + |
| | +\newcommand{\compactequipment}{% |
| | + \renewenvironment{equipmentlist}{% |
| | + \begin{description*}[mode=unboxed,leftmargin=*,itemjoin=\inlinelistmarker] |
| | + }{% |
| | + \end{description*}. |
| | + } |
| | +} |
| | + |
| | +\newcommand{\normalequipment}{% |
| | + \renewenvironment{equipmentlist}{% |
| | + \begin{description} |
| | + }{% |
| | + \end{description}. |
| | + } |
| | +} |
| | + |
| | +\newenvironment{preparation}[1][Preparation]{% |
| | + \needspace{3\baselineskip} |
| | + \subsection{#1} |
| | + \expandafter\setlist\expandafter{\preparationstyle}% |
| | + \begin{preparationlist} |
| | +}{% |
| | + \end{preparationlist} |
| | +} |
| | + |
| | +\newenvironment{preparationlist}{% |
| | + \begin{itemize} |
| | +}{% |
| | + \end{itemize} |
| | +} |
| | + |
| | +\newcommand{\normalpreparation}{% |
| | + \renewenvironment{preparationlist}{% |
| | + \begin{itemize} |
| | + }{% |
| | + \end{itemize} |
| | + } |
| | +} |
| | + |
| | +\newcommand{\compactpreparation}{% |
| | + \renewenvironment{preparationlist}{% |
| | + \begin{itemize*}[label={},afterlabel={},itemjoin=\inlinelistmarker] |
| | + }{% |
| | + \end{itemize*} |
| | + } |
| | +} |
| | + |
| | + |
| | +\newenvironment{ingredients}[1][Ingredients]{% |
| | + \needspace{3\baselineskip} |
| | + \subsection{#1}% |
| | + \expandafter\setlist\expandafter{\ingredientsstyle}% |
| | + \begin{ingredientlist} |
| | +}{% |
| | + \end{ingredientlist} |
| | +} |
| | + |
| | +%\RequirePackage{pgfkeys} |
| | +%\pgfkeys{ |
| | +% /myparbox/.is family, /myparbox, |
| | +% width/.estore in = \myparboxWidth, |
| | +% height/.estore in = \myparboxHeight, |
| | +%} |
| | +\newcommand{\ingred}[3]{% |
| | +\item {#1}\space\notblank{#2}{#2\space}{}{#3} |
| | +} |
| | + |
| | +\newenvironment{ingredientlist}{% |
| | + \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}} |
| | + \begin{itemize} |
| | +}{% |
| | + \end{itemize} |
| | +} |
| | + |
| | +\newcommand{\tabularingredients}{% |
| | + \renewcommand{\ingred}[3]{{##1}\space\notblank{##2}{##2}{} & {##3}\\} |
| | + \renewenvironment{ingredientlist}{% |
| | + \begin{tabular}{r l} |
| | + }{% |
| | + \end{tabular} |
| | + } |
| | +} |
| | + |
| | +\newcommand{\compactingredients}{% |
| | + \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}} |
| | + \renewenvironment{ingredientlist}{% |
| | + \begin{itemize*}[label={},afterlabel={},itemjoin={;\space},noitemsep] |
| | + }{% |
| | + \end{itemize*}. |
| | + } |
| | +} |
| | + |
| | +\newcommand{\normalingredients}{% |
| | + \renewcommand{\ingred}[3]{\item {##1}\space\notblank{##2}{##2\space}{}{##3}} |
| | + \renewenvironment{ingredientlist}{% |
| | + \begin{itemize} |
| | + }{% |
| | + \end{itemize} |
| | + } |
| | +} |
| | + |
| | +\newenvironment{instructions}[1][Cooking Instructions]{% |
| | + \needspace{3\baselineskip} |
| | + \subsection{#1} |
| | + \expandafter\setlist\expandafter{\instructionsstyle}% |
| | + \begin{instructionlist} |
| | +}{ |
| | + \end{instructionlist} |
| | +} |
| | + |
| | +\newenvironment{instructionlist}{% |
| | + \begin{enumerate} |
| | +}{% |
| | + \end{enumerate} |
| | +} |
| | + |
| | +\newcommand{\normalinstructions}{% |
| | + \renewenvironment{instructionlist}{% |
| | + \begin{enumerate} |
| | + }{% |
| | + \end{enumerate} |
| | + } |
| | +} |
| | + |
| | +\newcommand{\compactinstructions}{% |
| | + \renewenvironment{instructionlist}{% |
| | + \begin{enumerate*}[label={},afterlabel={},itemjoin=\inlinelistmarker] |
| | + }{% |
| | + \end{enumerate*} |
| | + } |
| | +} |
| | + |
| | + |
| | +\newcommand{\startinstructions}{} |
| | + |
| | + |
| | +%%% Some useful commands |
| | + |
| | +\newcommand{\framedNum}[1]{\protect\tikz[baseline=-3.5pt]\protect\node[draw=none,fill=\secondarycolor,text=\secondarycolorcomplement,rectangle,aspect=1,minimum width=1.3em,inner xsep=1pt,font=\scriptsize]{#1};} |
| | + |
| | +\newcommand{\circledNum}[1]{\protect\tikz[baseline=-3.5pt]\protect\node[draw=none,fill=\secondarycolor,text=\secondarycolorcomplement,circle,minimum width=1.25em,inner sep=1pt,font=\scriptsize]{#1};} |
| | + |
| | +\newcommand{\triangledNum}[1]{\protect\tikz[baseline=-3.5pt]\protect\node[isosceles triangle,isosceles triangle apex angle=75,shape border rotate=90,draw=none,minimum width=1.5em,inner xsep=1pt,fill=\secondarycolor,font=\scriptsize]{#1};} |
| | + |
| | +\newcommand*{\framedPage}{\tikz[overlay]\node[fill=\tertiarycolor,text=\tertiarycolorcomplement,text depth=.2in,minimum height=.5in,minimum width=2em,font=\sffamily]{\thepage};} |
| | + |
| | + |
| | +%% Indices nested up to 5 levels |
| | +\xindyindex |
| | +%\long\def\lettergroup#1\item{\item\textcolor{\darkhighlight}} |
| | +%\newcommand{\lettergroup}[1]{\item{\item\textbf{#1}}} |
| | +%\let\lettergroupDefault\lettergroup |
| | +\renewcommand\subitem{\@idxitem \hspace*{10\p@}} |
| | +\renewcommand\subsubitem{\@idxitem \hspace*{20\p@}} |
| | +\newcommand\sssubitem{\@idxitem \hspace*{30\p@}} |
| | +\newcommand\sssssubitem{\@idxitem \hspace*{40\p@}} |
| | +\newcommand\sssssssubitem{\@idxitem \hspace*{50\p@}} |
| | + |
| | +\newcommand{\reduceindexindent}{% |
| | +\renewcommand\subitem{\@idxitem } |
| | +\renewcommand\subsubitem{\@idxitem \hspace*{10\p@}} |
| | +\renewcommand\sssubitem{\@idxitem \hspace*{20\p@}} |
| | +\renewcommand\sssssubitem{\@idxitem \hspace*{30\p@}} |
| | +\renewcommand\sssssssubitem{\@idxitem \hspace*{40\p@}} |
| | +} |
| | |