Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/recipe-books.git

Added footercitations and inlinecitations for recipe photos. \documentclass[footercitations]… \documentclass[inlinecitations]…

Author liantze <email>
Date 2013-03-03 00:00:15 GMT+0800
Commit a66f15f136873ed22ed2d6f1b21d7c897aac07bf
Parent 25878f9
pdf/hyperlinks.tex
% PDF hyperlink style and configuration
+\AtEndPreamble{%
\hypersetup{
% Show bookmarks bar?
bookmarks=true,
- % Non-Latin characters in Acrobat's bookmarks
+ % Non-Latin characters in bookmarks
unicode=true,
- % Show Acrobat's toolbar?
+ % Show toolbar?
pdftoolbar=true,
- % Show Acrobat's menu?
+ % Show menu?
pdfmenubar=true,
% Window fit to page when opened
pdffitwindow=false,
% Fit the width of the page to the window
pdfstartview={FitH},
- % TODO: Title
- %pdftitle={Recipe Title},
- % TODO: author
- %pdfauthor={Recipe Book Author},
+ % Title
+ pdftitle={\thetitle},
+ % author
+ pdfauthor={\theauthor},
% subject of the document
pdfsubject={Recipes},
colorlinks=true,
% Color of internal links
- linkcolor=primarycolor,
+ linkcolor=\primarycolor,
% Color of links to bibliography
citecolor=black,
% Color of file links
filecolor=black,
% Color of external links
- urlcolor=secondarycolor,
+ urlcolor=\externallinkcolor,
% No border around links
pdfborder={0 0 0}
}
-
+}
recipe-book.cls
\newtoggle{print}\togglefalse{print}
\newtoggle{clearpn}\toggletrue{clearpn}
-\DeclareOption{print}{\toggletrue{print}}
-\DeclareOption{fullpagefooter}{\togglefalse{clearpn}}
-\ProcessOptions\relax
-
-\iftoggle{print}{%
- \LoadClass[twoside,11pt]{memoir}
- \setstocksize{10in}{8in}
- \settrimmedsize{\stockheight}{\stockwidth}{*}
- \setlrmarginsandblock{1.25in}{.75in}{*}
- \setulmarginsandblock{.75in}{1in}{*}
-}{%
- \LoadClass[oneside,11pt]{memoir}
- \setstocksize{11in}{8.5in}
- \settrimmedsize{\stockheight}{\stockwidth}{*}
- \setlrmarginsandblock{.75in}{.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{pdflscape}
-\RequirePackage{wrapfig}
-\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}
-}
-
-%%% Overview as a bit of a chapter introduction
-\newenvironment{overview}[1]{%
-\chapter*{#1}
-\providelength{\oldparskip}
-\setlength{\oldparskip}{\parskip}
-\setlength{\parskip}{\onelineskip}
-}{%
-\setlength{\parskip}{\oldparskip}
-\clearpage
-}
-
-%%%% 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}[2][.4\textwidth]{%
-\includegraphics[width=#1]{#2}\par
-}
-
-\newcommand{\fullpagephoto}[1]{%
- \afterpage{%
- \ThisTileWallPaper{\paperwidth}{\paperheight}{#1}
- \iftoggle{clearpn}{\thispagestyle{empty}}{}
- \mbox{}\clearpage}
-}
-
-\newcommand{\checkfiller}{%
- \iftoggle{print}{%
- \clearpage
- \checkoddpage\strictpagecheck
-% \ifoddpage\ThisTileWallPaper{\paperwidth}{\paperheight}{photo/filler1}\mbox{}\clearpage\fi
- \ifoddpage\InsertAd\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
- }}}
-% \iftoggle{clearpn}{\thispagestyle{empty}}{}
-}
-
-\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
- }}}
- \iftoggle{clearpn}{\thispagestyle{empty}}{}
-}
-
-\newcommand{\landscapedphoto}[1]{%
-\AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
- \parbox[b][\paperheight]{\paperwidth}{%
- \vfill
- \centering
- \includegraphics[width=\paperheight,height=\paperwidth,angle=90]{#1}%
- \vfill
- }}}
-}
-
-\newcommand{\twopagespreadphoto}[1]{%
- \iftoggle{print}{%
- \SpreadWallPaperLeft{#1}
- \mbox{}\clearpage
- \afterpage{\SpreadWallPaperRight{#1}
- \mbox{}\clearpage}
- }{\afterpage{%
- \begin{landscape}
- \thispagestyle{empty}
- \landscapedphoto{#1}\mbox{}\clearpage
- \end{landscape}
- }}
-}
-
-\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}{}
-
+\newtoggle{inlinecitations}\togglefalse{inlinecitations}
+\newtoggle{footercitations}\togglefalse{footercitations}
+\newtoggle{endcitations}\toggletrue{endcitations}
+\DeclareOption{print}{\toggletrue{print}}
+\DeclareOption{fullpagefooter}{\togglefalse{clearpn}}
+\DeclareOption{inlinecitations}{\togglefalse{endcitations}\togglefalse{footercitations}\toggletrue{inlinecitations}}
+\DeclareOption{footercitations}{\togglefalse{endcitations}\toggletrue{footercitations}\togglefalse{inlinecitations}}
+\DeclareOption{endcitations}{\toggletrue{endcitations}\togglefalse{footercitations}\togglefalse{inlinecitations}}
+\ProcessOptions\relax
+
+\iftoggle{print}{%
+ \LoadClass[twoside,11pt]{memoir}
+ \setstocksize{10in}{8in}
+ \settrimmedsize{\stockheight}{\stockwidth}{*}
+ \setlrmarginsandblock{1.25in}{.75in}{*}
+ \setulmarginsandblock{.75in}{1in}{*}
+}{%
+ \LoadClass[oneside,12pt]{memoir}
+ \setstocksize{11in}{8.5in}
+ \settrimmedsize{\stockheight}{\stockwidth}{*}
+ \setlrmarginsandblock{.75in}{.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{pdflscape}
+\RequirePackage{wrapfig}
+\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}
+\providelength{\afterinsetphotoskip}
+\setlength{\afterinsetphotoskip}{1em}
+\def\@frontcoverphoto{}
+\newcommand{\frontcoverphoto}[1]{%
+ \def\@frontcoverphoto{#1}
+}
+\def\@citationref{}
+\def\@recipecredittext{}
+\def\@recipelicensetext{}
+\def\@photocredittext{}
+\def\@photolicensetext{}
+\def\citationtext{}
+\newcommand{\recipecredit}[2][]{%
+}
+\newcommand{\recipelicense}[2][]{%
+}
+\newcommand{\photocredit}[2][]{%
+ \gdef\@photocredittext{Photo courtesy %
+ \ifblank{#1}{#2}{\href{#1}{#2}}}
+}
+\newcommand{\photolicense}[2][]{%
+ \gdef\@photolicensetext{, %
+ \ifblank{#1}{#2}{\href{#1}{#2}}}
+}
+
+\iftoggle{endcitations}{\makepagenote}{}
+\def\blfootnote{\xdef\@thefnmark{}\@footnotetext}
+
+% 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}
+}
+
+%%% Overview as a bit of a chapter introduction
+\newenvironment{overview}[1]{%
+\chapter*{#1}
+\providelength{\oldparskip}
+\setlength{\oldparskip}{\parskip}
+\setlength{\parskip}{\onelineskip}
+}{%
+\setlength{\parskip}{\oldparskip}
+\clearpage
+}
+
+%%%% 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}
+}{}
+
+\renewcommand{\memsecinfo}[5]{%
+ \ifstrequal{#1}{section}{\renewcommand{\recipetitle}{#3}}{}
+}
+
+\AtBeginEnvironment{recipe}{%
+ \gdef\@recipecredittext{}
+ \gdef\@photocredittext{}
+ \gdef\citationtext{}
+}
+
+\AtEndEnvironment{recipe}{%
+ \ifdefempty{\@photocredittext}{}{\apptocmd{\citationtext}{\@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.}{}{}}
+ \iftoggle{footercitations}{%
+ \ifdefempty{\citationtext}{}{\blfootnote{\citationtext}}
+ }{}
+ \iftoggle{endcitations}{%
+ \ifdefempty{\citationtext}{}{\pagenote[hey]{\citationtext}}
+ }{}
+}
+
+\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}[2][.4\textwidth]{%
+ \includegraphics[width=#1]{#2}\par
+}
+
+\newcommand{\fullpagephoto}[1]{%
+ \afterpage{%
+ \ThisTileWallPaper{\paperwidth}{\paperheight}{#1}
+ \iftoggle{clearpn}{\thispagestyle{empty}}{}
+ \iftoggle{inlinecitations}{%
+ \ifdefempty{\@photocredittext}{}{%
+ \begin{tikzpicture}[overlay,remember picture]
+ \node[fill=white,fill opacity=.8,text opacity=1,font=\small\sffamily\itshape,
+ anchor=north east,xshift=-.5in,yshift=-.5in]
+ at (current page.north east)
+ {\@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.};
+ \end{tikzpicture}
+ }
+ }{}
+ \mbox{}\clearpage}
+}
+
+\newcommand{\checkfiller}{%
+ \iftoggle{print}{%
+ \clearpage
+ \checkoddpage\strictpagecheck
+% \ifoddpage\ThisTileWallPaper{\paperwidth}{\paperheight}{photo/filler1}\mbox{}\clearpage\fi
+ \ifoddpage\InsertAd\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
+ }}}
+% \iftoggle{clearpn}{\thispagestyle{empty}}{}
+}
+
+\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
+ }}}
+ \iftoggle{clearpn}{\thispagestyle{empty}}{}
+ \iftoggle{inlinecitations}{%
+ \ifdefempty{\@photocredittext}{no}{%
+ \begin{tikzpicture}[overlay,remember picture]
+ \node[fill=white,fill opacity=.8,text opacity=1,font=\small\sffamily\itshape,
+ anchor=north east,xshift=-.5in,yshift=-.5in]
+ at (current page.north east)
+ {\@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.};
+ \end{tikzpicture}
+ }
+ }{}
+
+}
+
+\newcommand{\landscapedphoto}[1]{%
+ \AddToShipoutPicture*{\put(\LenToUnit{\wpXoffset},\LenToUnit{\wpYoffset}){%
+ \parbox[b][\paperheight]{\paperwidth}{%
+ \vfill
+ \centering
+ \includegraphics[width=\paperheight,height=\paperwidth,angle=90]{#1}%
+ \vfill
+ }}}
+ \iftoggle{inlinecitations}{%
+ \ifdefempty{\@photocredittext}{}{%
+ \begin{tikzpicture}%[overlay,remember picture]
+ \node[fill=white,fill opacity=.8,text opacity=1,font=\small\sffamily\itshape,
+ %anchor=north west,%xshift=.5in,yshift=-.5in
+ ]
+ %at (current page.north)
+ {\@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.};
+ \end{tikzpicture}
+ }
+ }{}
+}
+
+\newcommand{\twopagespreadphoto}[1]{%
+ \iftoggle{print}{%
+ \SpreadWallPaperLeft{#1}
+ \mbox{}\clearpage
+ \afterpage{\SpreadWallPaperRight{#1}
+ \mbox{}\clearpage}
+ }{\afterpage{%
+ \begin{landscape}
+ \thispagestyle{empty}
+ \landscapedphoto{#1}\mbox{}\clearpage
+ \end{landscape}
+ }}
+}
+
+\AtBeginDocument{%
+ \iftoggle{inlinecitations}{%
+ % See http://tex.stackexchange.com/a/68741/226
+ \expandafter\apptocmd\csname\string\insetphoto\endcsname{%
+ \ifdefempty{\@photocredittext}{}{\vskip-\afterinsetphotoskip
+ {\centering\small\sffamily\itshape\@photocredittext\ifdefempty{\@photolicensetext}{}{\@photolicensetext}.\par}
+ \vskip\afterinsetphotoskip
+ }%
+ }{}{}
+ }{}
+}
+
+\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}{}
+
+\setlength{\footmarkwidth}{0pt}
+\setlength{\footmarksep}{0pt}
+\setlength{\footparindent}{0pt}
+\renewcommand{\foottextfont}{\small\sffamily\itshape\color{\darkhighlight}}
+\renewcommand*{\footnoterule}{}
+
+\apptocmd{\backmatter}{\iftoggle{endcitations}{\printpagenotes}{}}{}{}
%%% Some useful commands
xsl/latex.xsl
<xsl:param name="nofooter" select="true()" />
+<!-- Citation style format. Valid values are endcitations (default), footercitations and inlinecitations. -->
+<xsl:param name="citationstyle" select="''" />
+
<!-- These will come from the XML...
<xsl:param name="book-back-cover" select="true()" />
<xsl:template match="/recipe-book">
<xsl:text>\documentclass</xsl:text>
- <xsl:if test="not($ebook and $nofooter)">
<xsl:text>[</xsl:text>
<xsl:if test="not($ebook)">
<xsl:text>print,</xsl:text>
</xsl:if>
<xsl:if test="not($nofooter)">
<xsl:text>fullpagefooter,</xsl:text>
</xsl:if>
+ <xsl:value-of select="$citationstyle"/>
<xsl:text>]</xsl:text>
- </xsl:if>
<xsl:text>{recipe-book}&#xa;</xsl:text>
<xsl:text>\usepackage{hyperref}&#xa;</xsl:text>
<xsl:template match="photo[@use='front-cover']" mode="book">
+ <xsl:apply-templates select="citation[descendant::*]" />
<xsl:apply-templates select="uri" mode="book" />
</xsl:template>
<xsl:template match="photo[@use='overview']" mode="book" />
<xsl:template match="photo[@use='recipe-inset']" mode="recipe">
+ <xsl:apply-templates select="citation[descendant::*]" />
<xsl:apply-templates select="uri" mode="recipe-inset" />
</xsl:template>
<xsl:template match="photo[@use='one-page']" mode="recipe">
+ <xsl:apply-templates select="citation[descendant::*]" />
<xsl:apply-templates select="uri" mode="one-page" />
</xsl:template>
<xsl:template match="photo[@use='two-page']" mode="recipe">
+ <xsl:apply-templates select="citation[descendant::*]" />
<xsl:apply-templates select="uri" mode="two-page" />
</xsl:template>
<xsl:text>}&#xa;</xsl:text>
</xsl:template>
+
+<xsl:template match="photo/citation[descendant::*]">
+ <xsl:if test="author">
+ <xsl:text>\photocredit</xsl:text>
+ <xsl:if test="author/@url">
+ <xsl:text>[</xsl:text>
+ <xsl:apply-templates select="author/@url" mode="escape" />
+ <xsl:text>]</xsl:text>
+ </xsl:if>
+ <xsl:text>{</xsl:text>
+ <xsl:apply-templates select="author" mode="escape" />
+ <xsl:text>}&#xa;</xsl:text>
+ </xsl:if>
+ <xsl:if test="license">
+ <xsl:text>\photolicense</xsl:text>
+ <xsl:if test="license/@url">
+ <xsl:text>[</xsl:text>
+ <xsl:apply-templates select="license/@url" mode="escape" />
+ <xsl:text>]</xsl:text>
+ </xsl:if>
+ <xsl:text>{</xsl:text>
+ <xsl:apply-templates select="license" mode="escape" />
+ <xsl:text>}&#xa;</xsl:text>
+ </xsl:if>
+</xsl:template>
<xsl:template match="description/title">
Delta 583 lines added, 452 lines removed, 131-line increase