%%
%% This is file `cookybooky.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% cookybooky.dtx  (with options: `copyright,package')
%% 
%%  ------------------- cookybooky.dtx package -------------------  %%
%%                                                                  %%
%%  ------ Copyright (C) 2009 by J. Gilg <gilg@acrotex.net> ------  %%
%%                                                                  %%
%%    This work may be distributed and/or modified under the        %%
%%    conditions of the LaTeX Project Public License (LPPL),        %%
%%    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.                            %%
%%                                                                  %%
%%    This work has the LPPL maintenance status `maintained'.       %%
%%                                                                  %%
%%    The Current Maintainer of this work is J. Gilg.               %%
%%                                                                  %%
%%            This work consists of the files                       %%
%%            cookybooky.dtx,                                       %%
%%            cookybooky.ins, and the derived files                 %%
%%            cookybooky.sty and myRecipe.cfg.                      %%
%%                                                                  %%
%%  ------------------ Some additional hints ---------------------  %%
%%                                                                  %%
%%    A proper documentation of this package is found in the        %%
%%    folder <cookybooky/documentation> called `Manual.pdf'.        %%
%%                                                                  %%
%%    Demo graphics are within <cookybooky/examples/graphics>.      %%
%%                                                                  %%
%%    Example files are found within <cookybooky/examples>.         %%
%%                                                                  %%
%%  --------------------------------------------------------------  %%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cookybooky}%
[2009/10/10 v0.1 dtx: Easy typesetting recipes (jg)]
\DeclareOption{myconfig}{\AtEndOfPackage{\inputmyRecipe}}
\def\inputmyRecipe{\InputIfFileExists{myRecipe.cfg}
    {\typeout{inputting myRecipe.cfg}}{cannot find myRecipe.cfg}}
\PassOptionsToPackage{distiller}{pstricks}
\PassOptionsToPackage{dvipsnames,svgnames}{xcolor}
\ProcessOptions
\RequirePackage{amsmath,amssymb}
\RequirePackage[%
        dvips,
        latextoc,
        usetemplates,
        nodirectory,
        nobullets,
        pro
]{web}
\RequirePackage[dvips]{graphicxsp}
\RequirePackage{xkeyval}
\RequirePackage{lettrine}
\RequirePackage{pstricks}
\RequirePackage{pst-text}
\RequirePackage[absolute,notitlepage]{pst-abspos}
\RequirePackage{nicefrac}
\RequirePackage{fancyhdr}
\screensize{297mm}{210mm}        % height, width
\margins{.5in}{.25in}{1in}{1in}  % left, right, top, bottom
\useFullWidthForPaper
\pagenumbering{arabic}
\setlength{\parindent}{0cm}
\setlength{\textwidth}{15.5cm}
\setlength{\textheight}{24.7cm}
\setlength{\topmargin}{-0.8cm}
\setlength{\headheight}{0cm}
\setlength{\headsep}{1cm}
\setlength{\topskip}{0cm}
\setlength{\footskip}{1.4cm}
\setlength{\evensidemargin}{-0.5cm}
\setlength{\oddsidemargin}{0.5cm}
\setlength{\paperheight}{29.7cm}
\setlength{\paperwidth}{21cm}
\setlength{\voffset}{0cm}
\setlength{\hoffset}{0cm}
\setcounter{secnumdepth}{2} % subsubsections not numbered
\setcounter{tocdepth}{3}    % subsubsections in the .toc file
\renewcommand*\l@subsubsection
{%
    \@dottedtocline{3}{3em}{0em}
}
\define@key{colorManagment}{recipecolor}[webgreen]{\def\recipecolor{#1}}
\define@key{colorManagment}{ingredcolor}[gray]{\def\ingredcolor{#1}}
\define@key{colorManagment}{ingheadcolor}[gray]{\def\ingheadcolor{#1}}
\define@key{colorManagment}{prepheadcolor}[black]{\def\prepheadcolor{#1}}
\define@key{colorManagment}{linecolor}[red]{\def\linecolor{#1}}
\define@key{colorManagment}{recipecolorop}[webgreen]{\def\recipecolorop{#1}}
\define@key{colorManagment}{initialscolor}[red]{\def\initialscolor{#1}}
\savekeys{colorManagment}
{%
    recipecolor,
    ingredcolor,
    ingheadcolor,
    prepheadcolor,
    linecolor,
    recipecolorop,
    initialscolor
}
\newcommand*{\selectRecipeColors}[1][]
{%
    \setkeys{colorManagment}{#1}
}
\selectRecipeColors
[%
    recipecolor,
    ingredcolor,
    ingheadcolor,
    prepheadcolor,
    linecolor,
    recipecolorop,
    initialscolor
]
\selectRecipeColors
[%
    recipecolor = webgreen,
    ingredcolor = gray,
    ingheadcolor = gray,
    prepheadcolor = black,
    linecolor = red,
    recipecolorop = webgreen,
    initialscolor = red
]
\define@choicekey{fontManagment}{font}%
{hlce,pbsi,hlcw}[pbsi]{\def\thefont{#1}}
\savekeys{fontManagment}{font}
\newcommand*{\selectFont}[1][]
{%
    \setkeys{fontManagment}{#1}
}
\selectFont
[%
    font = hlcw
]
\newcommand{\bsi}[2]
{%
  \fontencoding{T1}
  \fontfamily{\thefont}
  \fontseries{xl}
  \fontshape{n}%
  \fontsize{#1}{#2}
  \selectfont
}
\newcounter{init}\setcounter{init}{0}
\renewcommand{\LettrineFontHook}
{%
    \color{\initialscolor}
}
\newcommand{\init}
{%
    \lettrine
    [%
        lines=2,
        lhang=0.53,
        loversize=0.15,
        nindent=13pt
    ]{\stepcounter{init}\theinit}{\quad}
}
\newcommand{\inghead}
{%
    \textcolor{\ingheadcolor}{\textbf{Zutaten}\ }
}
\newcommand{\prephead}
{%
    \textcolor{\prepheadcolor}{\textbf{Zubereitung}\ }
}
\newcommand{\hinthead}
{%
    \textcolor{\linecolor}{\Large{Tip:}}
}
\newcommand*{\ingredients}[1]
{%
    \def\myingredients
    {%
        \textcolor{\ingheadcolor}{\inghead}
        \\[4pt]
        \footnotesize\color{\ingredcolor}
        \begin{tabular}{rll}
            #1
        \end{tabular}
    }
}
\newcommand*{\preparation}[1]
{%
    \def\mypreparation
    {%
        \prephead
        \\[4pt]
        #1
    }
\setcounter{init}{0}
}
\newcommand*{\hint}[1]
{%
    \def\myhint
    {%
        \psline[linecolor=\linecolor,linewidth=1.5pt](-0.5,0)(2,0)
        \psline[linecolor=\linecolor,linewidth=1.5pt](-0.25,0.25)(-0.25,-1.75)

        \hinthead

        \begin{minipage}{\linewidth}%

            \itshape#1
        \end{minipage}
    }
}
\define@key{graph}{sgraph}[sgraph]{\def\sgraph{#1}}
\define@key{graph}{sdx}[0]{\def\sdx{#1}}
\define@key{graph}{sdy}[0]{\def\sdy{#1}}
\define@key{graph}{bgraph}[bgraph]{\def\bgraph{#1}}
\define@key{graph}{bdx}[0]{\def\bdx{#1}}
\define@key{graph}{bdy}[0]{\def\bdy{#1}}
\define@key{graph}{recipename}[TestRecipe]{\def\recipename{#1}}
\define@key{graph}{recipetime}[TesTime]{\def\recipetime{#1}}
\define@key{graph}{portion}[TestPortion]{\def\portion{#1}}
\define@key{graph}{joule}[TestEnergy]{\def\joule{#1}}
\savekeys{graph}
{%
    sgraph,
    sdx,
    sdy,
    bgraph,
    bdx,
    bdy,
    recipename,
    recipetime,
    portion,
    joule
}
\newcommand*{\graphic}[1][]
{%
    \setkeys{graph}{#1}
}
\graphic
[%
    recipename,
    recipetime,
    portion,
    joule,
    sgraph,
    sdx,
    sdy,
    bgraph,
    bdx,
    bdy
]
\def\graphPath{}
%% DECLARATION OF THE WIDTHS OF THE MINIPAGES
\def\lwA{0.60\linewidth}%
\def\lwB{0.35\linewidth}
\newcommand*{\graph}[1][]
{%
    \setkeys{graph}{#1}
    {%
      \if@twoside
        \ifodd\arabic{page}
    %% FIRST MINIPAGEBLOCK
        \begin{minipage}[t]{\lwA}
            \begin{pspicture*}(0,0)(\linewidth,6)
                \rput[lb](\bdx,\bdy){\includegraphics[width=\linewidth]%
                {\graphPath\bgraph}}
            \end{pspicture*}
        \end{minipage}
        \hfill
        \begin{minipage}[t]{\lwB}
            \begin{pspicture*}(0,0)(\linewidth,6)
                \rput[lb](\sdx,\sdy){\includegraphics[height=6cm]%
                {\graphPath\sgraph}}
        \end{pspicture*}
        \end{minipage}

   %% SECOND MINIPAGEBLOCK

        \begin{minipage}[t]{\lwA}
            \parbox[t]{\lwA}{\subsubsection[\normalsize\recipename]%
            {\textcolor{\recipecolor}{\bsi{24pt}{30pt}\recipename}}}
            \\[14pt]
            \parbox[t]{\lwA}{%
            \recipetime

            \portion

            \joule}
        \end{minipage}
        \hfill
        \begin{minipage}[t]{\lwB}
            %EMPTY MINIPAGE
        \end{minipage}

  %% THIRD MINIPAGEBLOCK

        \begin{minipage}[t]{\lwA}
            \mypreparation\
        \end{minipage}
        \hfill
        \begin{minipage}[t]{\lwB}
            \myingredients\
        \end{minipage}

        \vfill

        \myhint
    \else
        \begin{minipage}[t]{\lwB}
            \begin{pspicture*}(0,0)(\linewidth,6)
                \rput[lb](\sdx,\sdy){\includegraphics[height=6cm]%
                {\graphPath\sgraph}}
            \end{pspicture*}
        \end{minipage}
        \hfill
        \begin{minipage}[t]{\lwA}
            \begin{pspicture*}(0,0)(\linewidth,6)
                \rput[lb](\bdx,\bdy){\includegraphics[width=\linewidth]%
                {\graphPath\bgraph}}
            \end{pspicture*}
        \end{minipage}

        \begin{minipage}[t]{\lwB}
            %EMPTY MINIPAGE
        \end{minipage}
        \hfill
        \begin{minipage}[t]{\lwA}
            \parbox[t]{\lwA}{\subsubsection[\normalsize\recipename]%
            {\textcolor{\recipecolor}{\bsi{24pt}{30pt}\recipename}}}
            \\[14pt]
            \parbox[t]{\lwA}{%
            \recipetime

            \portion

            \joule}
        \end{minipage}

        \begin{minipage}[t]{\lwB}
            \myingredients\
        \end{minipage}
        \hfill
        \begin{minipage}[t]{\lwA}
            \mypreparation\
        \end{minipage}

        \vfill

        \myhint
    \fi
\else
    \begin{minipage}[t]{\lwA}
        \begin{pspicture*}(0,0)(\linewidth,6)
            \rput[lb](\bdx,\bdy){\includegraphics[width=\linewidth]%
            {\graphPath\bgraph}}
        \end{pspicture*}
    \end{minipage}
    \hfill
    \begin{minipage}[t]{\lwB}
        \begin{pspicture*}(0,0)(\linewidth,6)
            \rput[lb](\sdx,\sdy){\includegraphics[height=6cm]%
            {\graphPath\sgraph}}
        \end{pspicture*}
    \end{minipage}

    \begin{minipage}[t]{\lwA}
        \parbox[t]{\lwA}{\subsubsection[\normalsize\recipename]%
        {\textcolor{\recipecolor}{\bsi{24pt}{30pt}\recipename}}}
            \\[14pt]
            \parbox[t]{\lwA}{%
            \recipetime

            \portion

            \joule}
    \end{minipage}
    \hfill
    \begin{minipage}[t]{\lwB}
        %EMPTY MINIPAGE
    \end{minipage}

    \begin{minipage}[t]{\lwA}
        \mypreparation\
    \end{minipage}
    \hfill
    \begin{minipage}[t]{\lwB}
        \myingredients\
    \end{minipage}

    \vfill

    \myhint\nopagebreak
\fi
%% TRANSPARENT SUBSUBSECTION NAME IN THE MIDDLE OF THE PAGE
\def\transpCoeff{0.3}
\pstPutAbs(0.5\paperwidth,-0.5\paperheight){%
        \rput(0,0){\parbox{\linewidth}{\centering%
        \pscharpath[linestyle=none,fillstyle=solid,fillcolor=\recipecolorop,opacity=\transpCoeff]{%
        {\bsi{60pt}{75pt}\recipename}}}}
        }
    }
}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]
{%
    \markright{\MakeUppercase{\thesection.\ #1}}
}
\renewcommand{\headrulewidth}
{%
    0.5pt
}
\fancyhf{}
\fancyfoot[LE,RO]{\bf{\thepage}}
\fancyhead[LE,RO]{\rightmark}
\endinput
%%
%% End of file `cookybooky.sty'.