Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/recipe-books.git
layout/twocolumn-twoside.tex
\color{\maintextcolor}%
\raggedcolumns
- \checkoddpage\strictpagecheck\ifoddpage\RLmulticolcolumns\else\LRmulticolcolumns\fi
+ \iftoggle{ebook}{%
+ \LRmulticolcolumns
+ }{%
+ \checkoddpage\strictpagecheck\ifoddpage\RLmulticolcolumns\else\LRmulticolcolumns\fi
+ }
\begin{multicols*}{2}[\section{#1}]%
}{%
recipe-book.cls
\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}{*}
+\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
-
-% 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}
}{}
}{}
-}
-
-
-\newcommand{\fullpagephoto}[1]{%
-%\ThisTileWallPaper{.7in}{.6in}{photo/echeveria}
-\ThisTileWallPaper{\paperwidth}{\paperheight}{#1}
-\mbox{}\clearpage
}
\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}{%
- \clearpage
- \checkoddpage\strictpagecheck
- \ifoddpage\ThisTileWallPaper{\paperwidth}{\paperheight}{photo/filler1}\mbox{}\clearpage\fi
+ \iftoggle{ebook}{}{%
+ \clearpage
+ \checkoddpage\strictpagecheck
+ \ifoddpage\ThisTileWallPaper{\paperwidth}{\paperheight}{photo/filler1}\mbox{}\clearpage\fi
+ }
}
\newcommand{\twopagespreadphoto}[1]{%
-%\clearpage
-%\sbox0{\includegraphics{#1}}%
-\SpreadWallPaperLeft{#1}
-\mbox{}\clearpage
-\afterpage{\SpreadWallPaperRight{#1}
-\mbox{}\clearpage}
+ \iftoggle{ebook}{%
+ \vspace*{\baselineskip}
+ \insetphoto{#1}
+ }{%
+ \SpreadWallPaperLeft{#1}
+ \mbox{}\clearpage
+ \afterpage{\SpreadWallPaperRight{#1}
+ \mbox{}\clearpage}
+ }
}
theme/Modern.tex
\renewcommand{\recipesize}{\Huge}
-\renewcommand{\recipestyle}{\bfseries\itshape\checkoddpage\strictpagecheck\ifoddpage\raggedleft\else\raggedright\fi\fullruled}
+\renewcommand{\recipestyle}{\bfseries\itshape\iftoggle{ebook}{\raggedleft}{\checkoddpage\strictpagecheck\ifoddpage\raggedleft\else\raggedright\fi}\fullruled}
\renewcommand{\headingsize}{\large}
\renewcommand{\headingstyle}{\bfseries\halfruled}
xsl/latex.xsl
<xsl:template match="uri" mode="one-page">
- <xsl:text>\afterpage{\fullpagephoto{</xsl:text>
+ <xsl:text>\fullpagephoto{</xsl:text>
<xsl:apply-templates />
- <xsl:text>}}&#xa;</xsl:text>
+ <xsl:text>}&#xa;</xsl:text>
</xsl:template>

Implemented ebook and print versions. Print is the default. \documentclass[ebook]{recipe-book} to trigger ebook version. In the recipe-zeal book creation screen, choosing the ebook option should 1. Insert a XML param tag, 2. Force all recipe photos to set use='recipe-inset'.

Author liantze <email>
Date 2013-02-28 00:15:53 GMT+0800
Commit f257b475c19b2baa8f3c44b17ad045af6e39de23
Parent 4c04861
Delta 56 lines added, 34 lines removed, 22-line increase