%% %% This is file `xcookybooky.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% xcookybooky.dtx (with options: `package') %% %% This is a generated file. %% Copyright (C) 2015 by Sven Harder %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either %% version 1.3 of this license or (at your option) any later %% version. The latest version of this license is in: %% %% http://www.latex-project.org/lppl.txt %% %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{xcookybooky} [2015/03/03 v1.5 Easy typesetting (potentially long) recipes with pictures] \newif\ifHandwrittenFont@required \HandwrittenFont@requiredfalse \DeclareOption{handwritten} {% displays the recipename in a handwitten font \HandwrittenFont@requiredtrue \AtEndOfPackage{ \setRecipeSizes{recipename = \fontsize{25pt}{30pt}} \setRecipenameFont{fjd}{T1}{m}{n} } } \DeclareOption{nowarnings} {% tries to eliminate nasty warnings \AtEndOfPackage{ \def\WF@conflict{} %\def\@fancywarning#1{} } } \DeclareOption{myconfig} {% load personal configuration \AtEndOfPackage{ \InputIfFileExists{xcookybooky.cfg} {\PackageInfo{xcookybooky}{inputting 'xcookybooky.cfg'}} {\PackageWarning{xcookybooky}{cannot find the configuration file 'xcookybooky.cfg'}} } } \ProcessOptions\relax \RequirePackage{tikz} % for creating the lines for the hint \RequirePackage{graphicx} \RequirePackage{xcolor} \RequirePackage[clock, misc, weather]{ifsym} % Symbol package e.g. \Interval, \Wecker etc \RequirePackage{cookingsymbols} % Cookings symbols e.g. \Oven, \Dish etc \ifHandwrittenFont@required \RequirePackage{emerald} % Handwritten Fonts \fi \RequirePackage{wrapfig} % To wrap the tabular with the ingredients \RequirePackage{iflang} % detecting the language \RequirePackage{ifthen} \RequirePackage{xkeyval} \RequirePackage{lettrine} % numbering the preparation steps \RequirePackage{fancyhdr} \RequirePackage{units} \RequirePackage{eso-pic} % for background pictures \RequirePackage{picture} % for modfifying the position of the bg pictures \RequirePackage{tabulary} % line breaks in tabular \RequirePackage{framed} % frame for the introduction \setlength{\parindent}{0cm} \setlength{\parskip}{2ex plus 0.5ex} \setlength{\textwidth}{15.5cm} \setlength{\textheight}{24.0cm} \setlength{\topmargin}{-0.8cm} \setlength{\headheight}{14pt} %0cm \setlength{\headsep}{1cm} \setlength{\topskip}{0cm} \setlength{\footskip}{1.4cm} \setlength{\evensidemargin}{-0.5cm} \setlength{\oddsidemargin}{0.5cm} \setlength{\voffset}{0cm} \setlength{\hoffset}{0cm} \setcounter{secnumdepth}{2} % subsubsections not numbered \setcounter{tocdepth}{3} % subsubsections in the .toc file \newcommand*{\recipesection}[2][] {% \subsubsection[#1]{#2} } \providecolor{DarkGreen}{rgb}{0,.5,0} \providecolor{DarkBlue}{rgb}{0, 0, 0.7} \providecolor{DarkGray}{rgb}{0.23, 0.23, 0.23} \define@key{colorManagement}{recipename}[DarkGreen]{\def\xcb@color@recipename{#1}} \define@key{colorManagement}{intro}[black]{\def\xcb@color@intro{#1}} \define@key{colorManagement}{ing}[DarkGray]{\def\xcb@color@ing{#1}} \define@key{colorManagement}{inghead}[DarkGray]{\def\xcb@color@inghead{#1}} \define@key{colorManagement}{prep}[black]{\def\xcb@color@prep{#1}} \define@key{colorManagement}{prephead}[black]{\def\xcb@color@prephead{#1}} \define@key{colorManagement}{suggestion}[black]{\def\xcb@color@suggestion{#1}} \define@key{colorManagement}{suggestionhead}[black]{\def\xcb@color@suggestionhead{#1}} \define@key{colorManagement}{separationgraph}[black]{\def\xcb@color@separationgraph{#1}} \define@key{colorManagement}{hint}[black]{\def\xcb@color@hint{#1}} \define@key{colorManagement}{hinthead}[red]{\def\xcb@color@hinthead{#1}} \define@key{colorManagement}{hintline}[red]{\def\xcb@color@hintline{#1}} \define@key{colorManagement}{numeration}[red]{\def\xcb@color@numeration{#1}} \savekeys{colorManagement} {% recipename, % color of recipename intro, % color of introduction (text) ing, % color of ingredients (text) inghead, % color of headline of ingredients prep, % color of preparation (text) prephead, % color of headline of preparation suggestion, % color of suggestions (text) suggestionhead, % color of headline of suggestion separationgraph, % color of graphical separator hint, % color of hint (text) hinthead, % color of headline of hint hintline, % color of lines of hint numeration % color of numeration (preparation) } \newcommand*{\setRecipeColors}[1] {% \setkeys{colorManagement}{#1} } \setRecipeColors {% initialisation recipename, intro, ing, inghead, prep, prephead, suggestion, suggestionhead, separationgraph, hint, hinthead, hintline, numeration } \define@key{sizeManagement}{recipename}[\fontsize{25pt}{30pt}]{\def\xcb@fontsize@recipename{#1}} \define@key{sizeManagement}{intro}[\normalsize]{\def\xcb@fontsize@intro{#1}} \define@key{sizeManagement}{ing}[\normalsize]{\def\xcb@fontsize@ing{#1}} \define@key{sizeManagement}{inghead}[\normalsize]{\def\xcb@fontsize@inghead{#1}} \define@key{sizeManagement}{prep}[\normalsize]{\def\xcb@fontsize@prep{#1}} \define@key{sizeManagement}{prephead}[\normalsize]{\def\xcb@fontsize@prephead{#1}} \define@key{sizeManagement}{suggestion}[\normalsize]{\def\xcb@fontsize@suggestion{#1}} \define@key{sizeManagement}{hint}[\normalsize]{\def\xcb@fontsize@hint{#1}} \define@key{sizeManagement}{hinthead}[\Large]{\def\xcb@fontsize@hinthead{#1}} \savekeys{sizeManagement} { recipename, % font size of recipe name intro, % font size of introduction (text) ing, % font size of ingredients (text) inghead, % font size of headline of ingredients prep, % font size of preparation (text) prephead, % font size of headline of preparation suggestion, % font size of suggestion (text) hint, % font size of hint (text) hinthead % font size of headline of hint } \newcommand*{\setRecipeSizes}[1] {% \setkeys{sizeManagement}{#1} } \setRecipeSizes {% initialisation recipename, intro, ing, inghead, prep, prephead, suggestion, hint, hinthead } %% Handwritten fonts: hlce, pbsi, hlcw, fjd, fau %% Other fonts: fwb \newcommand*{\setRecipenameFont}[4] {% sets the font for the recipename \def\xcb@font@recipename { \fontfamily{#1} \fontencoding{#2} \fontseries{#3} %x1 \fontshape{#4} \xcb@fontsize@recipename \selectfont } } \setRecipenameFont{\familydefault}{\encodingdefault}{b}{n} \newcounter{step} \setcounter{step}{0} \renewcommand{\LettrineFontHook} {% \color{\xcb@color@numeration} } \define@key{headlines}{inghead}[Ingredients]{ \def\xcb@name@inghead{\textcolor{\xcb@color@inghead}{\textbf{\xcb@fontsize@inghead{#1}}\ }} } \define@key{headlines}{prephead}[Preparation]{ \def\xcb@name@prephead{\textcolor{\xcb@color@prephead}{\textbf{\xcb@fontsize@prephead{#1}}\ }} } \define@key{headlines}{hinthead}[Hint]{ \def\xcb@name@hinthead{\textcolor{\xcb@color@hinthead}{\xcb@fontsize@hinthead{#1}}} } \define@key{headlines}{continuationhead}[Continuation]{\def\xcb@name@continuationhead{#1}} \define@key{headlines}{continuationfoot}[Continuation on next page]{\def\xcb@name@continuationfoot{#1}} \define@key{headlines}{preparationtime}[\fontsize{14.5pt}{10pt}\Gloves]{\def\xcb@name@preparationtime{#1}} \define@key{headlines}{bakingtime}[\fontsize{14.5pt}{10pt}\Oven]{\def\xcb@name@bakingtime{#1}} \define@key{headlines}{bakingtemperature}[\Thermo{4}]{\def\xcb@name@bakingtemperature{#1}} \define@key{headlines}{portion}[\fontsize{14.5pt}{10pt}\Dish]{\def\xcb@name@portion{#1}} \define@key{headlines}{portionvalue}[Portions]{\def\xcb@name@portionvalue{#1}} \define@key{headlines}{calory}[Calorific value]{\def\xcb@name@calory{#1}} \define@key{headlines}{source}[\PaperPortrait]{\def\xcb@name@source{#1}} \savekeys{headlines} { inghead, prephead, hinthead, continuationhead, continuationfoot, preparationtime, bakingtime, bakingtemperature, portion, portionvalue, calory, source } \newcommand*{\setHeadlines}[1] {% \setkeys{headlines}{#1} } \setHeadlines {% initialisation inghead, prephead, hinthead, continuationhead, continuationfoot, preparationtime, bakingtime, bakingtemperature, portion, portionvalue, calory, source } \IfLanguagePatterns{german} {% German \setHeadlines {% translation inghead = Zutaten, prephead = Zubereitung, hinthead = Tipp, continuationhead = Fortsetzung, continuationfoot = Fortsetzung auf n\"achster Seite, portionvalue = Personen, calory = Brennwert } }{} \IfLanguagePatterns{english} {% English \setHeadlines {% translation inghead = Ingredients, prephead = Preparation, hinthead = Hint, continuationhead = Continuation, continuationfoot = Continuation on next page, portionvalue = Portions, calory = Calorific value } }{} \IfLanguagePatterns{french} {% French \setHeadlines {% translation inghead = Ingrédients, prephead = Préparation, hinthead = Tuyau, continuationhead = Suite, continuationfoot = Suite page suivante, portionvalue = Portions, calory = Valeur calorifique } }{} \IfLanguagePatterns{spanish} {% Spanish \setHeadlines {% translation inghead = Ingredientes, prephead = Preparación, hinthead = Soplo, continuationhead = Continuación, continuationfoot = Continúa en la página siguiente, portionvalue = Porción, calory = Poder calorífico } }{} \IfLanguagePatterns{portuguese} {% Portuguese \setHeadlines {% translation inghead = Ingredientes, prephead = Prepara\c{c}\~{a}o, hinthead = Dica, continuationhead = Continua\c{c}\~{a}o, continuationfoot = Continua na pr\'{o}xima p\'{a}gina, portionvalue = Por\c{c}\~{o}es, calory = Valor Cal\'{o}rico } }{} \IfLanguagePatterns{brazil} {% Portuguese PT-BR \setHeadlines {% translation inghead = Ingredientes, prephead = Prepara\c{c}\~{a}o, hinthead = Dica, continuationhead = Continua\c{c}\~{a}o, continuationfoot = Continua na pr\'{o}xima p\'{a}gina, portionvalue = Por\c{c}\~{o}es, calory = Valor Cal\'{o}rico } }{} \define@key{recipelengths}{pictureheight}[6cm]{\def\xcb@pictureheight{#1}} \define@key{recipelengths}{bigpicturewidth}[0.60\textwidth]{\def\xcb@bigpicturewidth{#1}} \define@key{recipelengths}{smallpicturewidth}[0.35\textwidth]{\def\xcb@smallpicturewidth{#1}} \define@key{recipelengths}{introductionwidth}[\textwidth]{\def\xcb@introductionwidth{#1}} \define@key{recipelengths}{preparationwidth}[0.60\textwidth]{\def\xcb@preparationwidth{#1}} \define@key{recipelengths}{ingredientswidth}[0.35\textwidth]{\def\xcb@ingredientswidth{#1}} \savekeys{recipelengths} { pictureheight, % height of both pictures bigpicturewidth, % width of the bigger picture smallpicturewidth, % width of the smaller picture introductionwidth, % width of introduction preparationwidth, % width of preparation ingredientswidth % width of ingredients } \newcommand*{\setRecipeLengths}[1] {% \setkeys{recipelengths}{#1} } \setRecipeLengths {% initialisation pictureheight, bigpicturewidth, smallpicturewidth, introductionwidth, preparationwidth, ingredientswidth } %% MAIN COMMANDS \newcommand{\introduction}[1] {% Introduction before the preparation and ingredients \def\xcb@introduction {% \color{\xcb@color@intro} \begin{framed} \xcb@fontsize@intro#1 \end{framed} } } \newcommand*{\graph}[1] {% \setkeys{picture}{#1} } \newcommand*{\ingredients}[2][\empty] {% The optional argument contains the number of lines \def\xcb@ingredientslines{#1} \def\xcb@ingredients {% \xcb@name@inghead \\[1em] {\xcb@fontsize@ing\color{\xcb@color@ing} \begin{tabulary}{\xcb@ingredientswidth}{rL} #2 \end{tabulary}} } } \newcommand{\preparation}[1] {% \def\xcb@preparation {% \xcb@name@prephead %\\[4pt] \xcb@fontsize@prep\color{\xcb@color@prep}#1 } \setcounter{step}{0} } \newcommand{\suggestion}[2][] {% \g@addto@macro\xcb@suggestion {% \xcb@separationgraph{\xcb@color@separationgraph} \ifthenelse{\equal{#1}{}} {% {\color{\xcb@color@suggestion}#2} } {% \textbf{{\color{\xcb@color@suggestionhead}#1}} {\color{\xcb@color@suggestion}#2} } } } \newcommand{\hint}[1] {% \def\xcb@hint {% \pagebreak[1] % begin here a new page, if the space is small \begin{tikzpicture}[line width = 1.5pt, \xcb@color@hintline] \useasboundingbox (0,0) -- ++(right:3.5cm) -- ++(up:3mm) -- ++(left:3.5cm) -- cycle; \draw (-3mm, 0mm) -- ++(right:3.5cm); \draw (0, 3mm) -- ++(down:2.4cm); \end{tikzpicture} \nopagebreak \begingroup % a group for the hint \leftskip1em \xcb@name@hinthead \nopagebreak \itshape{\color{\xcb@color@hint}\xcb@fontsize@hint{#1}} \par \endgroup } } %% SUPPORTING COMMANDS \newcommand{\step} {% \lettrine [% lines=2, lhang=0, % space into margin, value between 0 and 1 loversize=0.15, % enlarges the height of the capital slope=0em, findent=1em, % gap between capital and intended text nindent=0em % shifts all intended lines, begining with the second line ]{\stepcounter{step}\thestep}{}% } \newcommand*{\portion}[2][\xcb@name@portionvalue] {% \unit[#2]{#1} } \define@key{bakingtemperature}{fanoven}[]{\def\xcb@bakingtemperature@fanoven{#1}} \define@key{bakingtemperature}{topbottomheat}[]{\def\xcb@bakingtemperature@topbottomheat{#1}} \define@key{bakingtemperature}{topheat}[]{\def\xcb@bakingtemperature@topheat{#1}} \define@key{bakingtemperature}{bottomheat}[]{\def\xcb@bakingtemperature@bottomheat{#1}} \define@key{bakingtemperature}{gasstove}[]{\def\xcb@bakingtemperature@gasstove{#1}} \newboolean{xcb@bakingtemperature@firstentry} \newcommand*{\bakingtemperature}[1] {% \setboolean{xcb@bakingtemperature@firstentry}{true}% \setkeys{bakingtemperature}{fanoven, topbottomheat, topheat, bottomheat, gasstove}% \setkeys{bakingtemperature}{#1}% \ifthenelse{\equal{\xcb@bakingtemperature@fanoven}{}}% {}% {% \xcb@bakingtemperature@fanoven \ {\fontsize{14.5pt}{10pt}\Fanoven}% \setboolean{xcb@bakingtemperature@firstentry}{false}% }% \ifthenelse{\equal{\xcb@bakingtemperature@topbottomheat}{}}% {}% {% \ifthenelse{\boolean{xcb@bakingtemperature@firstentry}}{\setboolean{xcb@bakingtemperature@firstentry}{false}}{, }% \xcb@bakingtemperature@topbottomheat \ {\fontsize{14.5pt}{10pt}\Topbottomheat}% }% \ifthenelse{\equal{\xcb@bakingtemperature@topheat}{}}% {}% {% \ifthenelse{\boolean{xcb@bakingtemperature@firstentry}}{\setboolean{xcb@bakingtemperature@firstentry}{false}}{, }% \xcb@bakingtemperature@topheat \ {\fontsize{14.5pt}{10pt}\Topheat}% }% \ifthenelse{\equal{\xcb@bakingtemperature@bottomheat}{}}% {}% {% \ifthenelse{\boolean{xcb@bakingtemperature@firstentry}}{\setboolean{xcb@bakingtemperature@firstentry}{false}}{, }% \xcb@bakingtemperature@bottomheat \ {\fontsize{14.5pt}{10pt}\Bottomheat}% }% \ifthenelse{\equal{\xcb@bakingtemperature@gasstove}{}}% {}% {% \ifthenelse{\boolean{xcb@bakingtemperature@firstentry}}{\setboolean{xcb@bakingtemperature@firstentry}{false}}{, }% \xcb@bakingtemperature@gasstove \ {\fontsize{14.5pt}{10pt}\Gasstove}% }% } %% INTERNAL COMMANDS \newcommand{\xcb@cmd@recipeoverview} { \begin{tabular}{rl} \ifthenelse{\equal{\xcb@preparationtime}{}} {% not set => not shown } { \xcb@name@preparationtime & \xcb@preparationtime\\ } \ifthenelse{\equal{\xcb@bakingtime}{}} {% not set => not shown } { \xcb@name@bakingtime & \xcb@bakingtime\ifthenelse{\equal{\xcb@bakingtemperature}{}} { \\ } {,\hspace{1em} \xcb@name@bakingtemperature \hspace{1ex} \xcb@bakingtemperature\\ } } \ifthenelse{\equal{\xcb@portion}{}} {% not set => not shown } { \xcb@name@portion & \xcb@portion\\ } \ifthenelse{\equal{\xcb@calory}{}} {% not set => not shown } { \xcb@name@calory & \xcb@calory\\ } \ifthenelse{\equal{\xcb@source}{}} {% not set => not shown } { \xcb@name@source & \xcb@source } \end{tabular} } \newcommand\xcb@cmd@wrapfill {% Bug fix for wrapfigure package \par \ifx\parshape\WF@fudgeparshape \nobreak \vskip-\baselineskip \vskip\c@WF@wrappedlines\baselineskip \allowbreak \WFclear \fi } \define@key{picture}{small}[]{ \def\xcb@picture@small{ \ifthenelse{\equal{#1}{}} {% not set => not shown } { \vspace{-0.6cm} \includegraphics[width=\linewidth, height = \xcb@pictureheight, keepaspectratio]{#1} } } } \define@key{picture}{smallpicturewidth}[]{\def\xcb@picture@smallwidth{#1}} \define@key{picture}{bigpicturewidth}[]{\def\xcb@picture@bigwidth{#1}} \define@key{picture}{big}[]{ \def\xcb@picture@big{ \ifthenelse{\equal{#1}{}} {% not set => not shown } { \vspace{-0.6cm} \includegraphics[width=\linewidth, height = \xcb@pictureheight, keepaspectratio]{#1} } } } \define@key{recipe}{preparationtime}[]{\def\xcb@preparationtime{#1}} \define@key{recipe}{bakingtime}[]{\def\xcb@bakingtime{#1}} \define@key{recipe}{bakingtemperature}[]{\def\xcb@bakingtemperature{#1}} \define@key{recipe}{portion}[]{\def\xcb@portion{#1}} \define@key{recipe}{calory}[]{\def\xcb@calory{#1}} \define@key{recipe}{source}[]{\def\xcb@source{#1}} \newcommand*{\xcb@separationgraph}[2][1.5] {% Graphical separator \begin{center} \begin{tikzpicture}[scale=#1] \fill[color=#2] (0,0) -- (-0.2, 0.1) -- (-4, 0) -- (-0.2, -0.1) -- cycle; \fill[color=#2] (0,0) -- (0.2, 0.1) -- (4, 0) -- (0.2, -0.1) -- cycle; \fill[color=#2] (0,0) circle (0.1); \end{tikzpicture} \end{center} } %% HOOKS \newcommand*{\pregraph}[1] {% Hook: entered before the pictures \def\xcb@hook@pregraph {% \begin{minipage}[T]{\textwidth} #1 \vspace{0.6cm} \end{minipage} } } \newcommand*{\pretitle}[1] {% Hook: entered before the recipe title \def\xcb@hook@pretitle {% #1 } } \newcommand*{\prerecipeoverview}[1] {% Hook: entered before the recipe overview \def\xcb@hook@prerecipeoverview {% #1 } } \newcommand*{\prepreparation}[1] {% Hook: entered before the preparation (steps) \def\xcb@hook@prepreparation {% #1 } } \newcommand*{\postpreparation}[1] {% Hook: entered after the preparation (steps) \def\xcb@hook@postpreparation {% #1 } } \newcommand*{\preingredients}[1] {% Hook: entered before the ingredients \def\xcb@hook@preingredients {% #1 } } \newcommand*{\postingredients}[1] {% Hook: entered after the ingredients \def\xcb@hook@postingredients {% #1 } } \newenvironment{recipe}[2][] {% initialisation \setkeys{recipe}{preparationtime, bakingtime, bakingtemperature, portion, calory, source} \setkeys{picture}{small, big, smallpicturewidth=\xcb@smallpicturewidth, bigpicturewidth=\xcb@bigpicturewidth} % load the default values \def\xcb@hook@pregraph{} \def\xcb@hook@pretitle{} \def\xcb@introduction{} \def\xcb@hook@prepreparation{} \preparation{} \def\xcb@hook@postpreparation{} \def\xcb@hook@preingredients{} \ingredients{} \def\xcb@hook@postingredients{} \def\xcb@suggestion{} \def\xcb@hint{} \def\xcb@recipename{#2} \setkeys{recipe}{#1} % reading the optional parameters \setcounter{xcb@newpagefoot}{1} \setcounter{xcb@newpagehead}{\value{page}} } {% this part is executed at \end{recipe} %% FIRST BLOCK \xcb@hook@pregraph \if@twoside \ifodd\arabic{page} \begin{minipage}[T]{\xcb@picture@bigwidth} \xcb@picture@big \end{minipage} \hfill \begin{minipage}[T]{\xcb@picture@smallwidth} \xcb@picture@small \end{minipage} \else \begin{minipage}[T]{\xcb@picture@smallwidth} \xcb@picture@small \end{minipage} \hfill \begin{minipage}[T]{\xcb@picture@bigwidth} \xcb@picture@big \end{minipage} \fi \else \begin{minipage}[T]{\xcb@picture@bigwidth} \xcb@picture@big \end{minipage} \hfill \begin{minipage}[T]{\xcb@picture@smallwidth} \xcb@picture@small \end{minipage} \fi %% SECOND BLOCK \xcb@hook@pretitle \recipesection[\normalsize\xcb@recipename]% {\hspace{-1em}\textcolor{\xcb@color@recipename}{\xcb@font@recipename\xcb@recipename}} \xcb@cmd@recipeoverview \xcb@introduction %% THIRD BLOCK \ifthenelse{\equal{\xcb@ingredientslines}{\empty}}% {% \begin{wraptable}{r}{\xcb@ingredientswidth} {% No line number given by the user \vspace{-1em} % same height of ingredients and preparation \xcb@hook@preingredients \xcb@ingredients \xcb@hook@postingredients } \end{wraptable} } {% \begin{wraptable}[\xcb@ingredientslines]{r}{\xcb@ingredientswidth} {% Use the given line number by the user \vspace{-1em} % same height of ingredients and preparation \xcb@hook@preingredients \xcb@ingredients \xcb@hook@postingredients } \end{wraptable} } \xcb@hook@prepreparation \xcb@preparation \xcb@hook@postpreparation \xcb@suggestion \vfill \xcb@cmd@wrapfill \xcb@hint \setcounter{xcb@newpagefoot}{0} } \pagestyle{fancy} \renewcommand{\sectionmark}[1] {% \markright{\MakeUppercase{\thesection.\ #1}} } \renewcommand{\headrulewidth} {% 0.5pt } \fancyhf{} \if@twoside \fancyfoot[LE,RO]{\textbf{\thepage}} \fancyhead[LE,RO]{\rightmark} \else \fancyfoot[R]{\textbf{\thepage}} \fancyhead[R]{\rightmark} \fi \fancyhead[C]{\@newpagehint{head}} \fancyfoot[C]{\@newpagehint{foot}} \newcounter{xcb@newpagehead} \setcounter{xcb@newpagehead}{0} \newcounter{xcb@newpagefoot} \setcounter{xcb@newpagefoot}{0} \newcommand*{\@newpagehint}[1] { \ifthenelse{\equal{#1}{head}} { \ifnum \value{xcb@newpagehead} < \value{page} \ifnum \value{xcb@newpagehead} > 0 \xcb@name@continuationhead \fi \fi } { \ifthenelse{\value{xcb@newpagefoot} > 0} { \xcb@name@continuationfoot } {% if no message at the bottom is set, there is no need for a message on the next page \setcounter{xcb@newpagehead}{0} } } } \define@key{background}{width}[\linewidth]{\def\xcb@background@width{#1}} \define@key{background}{height}[\paperheight]{\def\xcb@background@height{#1}} \define@key{background}{x}[0cm]{\def\xcb@background@x{#1}} \define@key{background}{y}[0cm]{\def\xcb@background@y{#1}} \define@key{background}{orientation}[default]{\def\xcb@background@orientation{#1}} \savekeys{background} {% width, height, x, y, orientation } \newcommand*{\setBackgroundPicture}[2][] {% \ClearShipoutPictureBG \setkeys{background}{width, height, x, y, orientation} % initialisation \setkeys{background}{#1} \AddToShipoutPicture {% \ifthenelse{\equal{\xcb@background@orientation}{default}} {% default \put(\xcb@background@x, \xcb@background@y) {% \parbox[b][\xcb@background@height]{\xcb@background@width} {% \vfill \includegraphics[width=\xcb@background@width, height=\xcb@background@height, keepaspectratio]{#2}% \vfill } } } {% \ifthenelse{\equal{\xcb@background@orientation}{pagecenter}} {% pagecenter \AtPageCenter{% \makebox(\xcb@background@x, \xcb@background@y)[c] {% \includegraphics[width=\xcb@background@width, height=\xcb@background@height, keepaspectratio]{#2} } } } {% \ifthenelse{\equal{\xcb@background@orientation}{textcenter}} {% textcenter \AtTextCenter{% \makebox(\xcb@background@x, \xcb@background@y)[c] {% \includegraphics[width=\xcb@background@width, height=\xcb@background@height, keepaspectratio]{#2} } } } {% \ifthenelse{\equal{\xcb@background@orientation}{stockcenter}} {% stockcenter \AtStockCenter{% \makebox(\xcb@background@x, \xcb@background@y)[c] {% \includegraphics[width=\xcb@background@width, height=\xcb@background@height, keepaspectratio]{#2} } } } {% error message \PackageError{xcookybooky} {There is no '\xcb@background@orientation' option for background picture orientation available!} {The possible options are: default, pagecenter, textcenter or stockcenter} } } } } } } \endinput %% %% End of file `xcookybooky.sty'.