summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/xcookybooky/xcookybooky.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-02-04 22:14:06 +0000
committerKarl Berry <karl@freefriends.org>2015-02-04 22:14:06 +0000
commit22e2fa164b34a0ea2bdc4ffbdcd3eab070bd3876 (patch)
tree991173e6fb70cf6262fc956ad5c3eb47ae02b860 /Master/texmf-dist/source/latex/xcookybooky/xcookybooky.dtx
parentba6a5f77c55f21dbb9baa453c0d98255a00cba1f (diff)
xcookybooky (4feb15)
git-svn-id: svn://tug.org/texlive/trunk@36212 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/xcookybooky/xcookybooky.dtx')
-rw-r--r--Master/texmf-dist/source/latex/xcookybooky/xcookybooky.dtx1117
1 files changed, 772 insertions, 345 deletions
diff --git a/Master/texmf-dist/source/latex/xcookybooky/xcookybooky.dtx b/Master/texmf-dist/source/latex/xcookybooky/xcookybooky.dtx
index f74083c8803..e0ed4c9c323 100644
--- a/Master/texmf-dist/source/latex/xcookybooky/xcookybooky.dtx
+++ b/Master/texmf-dist/source/latex/xcookybooky/xcookybooky.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2013 by Sven Harder
+% Copyright (C) 2015 by Sven Harder
% -----------------------------------
%
% This file may be distributed and/or modified under the
@@ -18,9 +18,9 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{xcookybooky}
-%<package> [2013/03/10 v1.2 Easy typesetting (potentially long) recipes with pictures]
+%<package> [2015/02/03 v1.4 Easy typesetting (potentially long) recipes with pictures]
%<config>\ProvidesFile{xcookybooky.cfg}
-%<config> [2011/12/29 v1.0 'xcookybooky' configuration]
+%<config> [2015/02/03 v1.1 'xcookybooky' configuration file]
%
%<*driver>
\documentclass{ltxdoc}
@@ -28,8 +28,23 @@
\usepackage[latin1]{inputenc}
\usepackage{lmodern}
\usepackage{xcookybooky}
+\usepackage{booktabs}
\usepackage{units}
\usepackage{pdfpages}
+\usepackage{listings}
+\renewcommand{\lstlistingname}{Example}
+\renewcommand{\lstlistlistingname}{List of \lstlistingname s}
+\lstset
+{%
+ keywordstyle=\color{blue}\bfseries,
+ commentstyle=\ttfamily,
+ stringstyle=\ttfamily,
+ language=[LaTeX]{TeX},
+ breaklines=true,
+ captionpos=b,
+ gobble=2,
+ %morekeywords={unit, bakingtemperature, portion},
+}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -53,7 +68,7 @@
%</driver>
% \fi
%
-% \CheckSum{666}
+% \CheckSum{792}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -75,6 +90,8 @@
% \changes{v1.0}{2011/12/29}{Initial version}
% \changes{v1.1}{2012/04/06}{Load the non-free package 'emerald' per option. Possibility to change the picture width independently from the text columns}
% \changes{v1.2}{2013/03/10}{Better way for displaying the ingredients (tabularx). Thanks to Bartosz Dziubaczyk for developing.}
+% \changes{v1.3}{2013/06/04}{Fixed a problem with the default recipe name font. Thanks to Václav Zeman for reporting. New environment for the ingredients. Thanks to Andreas Pöge for this suggestion.}
+% \changes{v1.4}{2015/02/03}{Added two commands for a introduction and recipe suggestions. Additional several hooks are implement in order to insert user-defined text blocks at different places in the recipe. Thanks to Heikki Lehvaslaiho for designing the graphical separator and sending suggestions. Added translations for German, English, French and Spanish.}
%
% \GetFileInfo{xcookybooky.sty}
%
@@ -89,12 +106,12 @@
% \title{The \textsf{xcookybooky} package\thanks{This document
% corresponds to \textsf{xcookybooky}~\fileversion,
% dated \filedate.}}
-% \author{Sven Harder \\ \texttt{sven\_one1@gmx.de}}
+% \author{Sven Harder \\ \texttt{sven\_one1@gmx.de} \\ \url{https://code.google.com/p/xcookybooky/}}
%
% \maketitle
%
% \begin{abstract}
-% This package is made for typesetting recipes. You simply enter ingredients, preparation steps and get a beautiful recipe page. It is also possible to enter 2 pictures, which are displayes above the name of the recipe. Another option is to write a hint, which is displayed at the bottom.
+% This package is made for typesetting recipes. You simply enter ingredients, preparation steps and get a beautiful recipe page. It is also possible to enter two pictures, which are displayed above the name of the recipe. Another option is to write a introduction, several suggestions and s hint, which is displayed at the bottom of the page.
% \end{abstract}
%
% \vspace{3em}
@@ -107,154 +124,179 @@
%
% \section{Introduction}
%
-% When I was looking for template for recipes, I found the cookybooky package by Jürgen Gilg (http://www.ctan.org/tex-archive/macros/latex/contrib/cookybooky).
-% It looks very good, but I was unable to compile it correctly (e.g. I haven't got the Lucida fonts). Also there are some packages which have to be downloaded by hand, because there are not available at CTAN. Other handicaps are the missing possibility to create a PDF-file directly and a recipe cannot be longer than a single page.
-% So decided to take a look at the code. Step by step I replaced all critical parts. Finally it is now possible to write recipes much easier (at least in my opinion).
-%
-% \section{Comparison between xcookybooky and cookybooky}
+% It all begin in 2011 when I wanted to make a cookbook with \LaTeX. Thus I was looking for recipe templates and found the \texttt{cookybooky} package by Jürgen Gilg (\url{http://www.ctan.org/pkg/cookybooky}). It looks very good, but I was unable to compile it (e.g. I haven't got the Lucida fonts). Also there are some packages which have to be downloaded by hand, because there are not available at CTAN. Other handicaps are the missing possibility to create a PDF-file directly and a recipe cannot be longer than a single page. So decided to take a look at the code. Step by step I replaced all critical parts. Finally the code is nearly complete different from the original and now it is possible to create beautiful designed recipes much easier (at least in my opinion).
%
-% There is no compatibility between xcookybooky and cookybooky, even the name is associating it. The reason for the naming is nearly similar design.
+% Please note that there is no compatibility between xcookybooky and cookybooky, even the name is associating it. I chose the name, because I was was inspired by the layout.
%
-% A comparison between \texttt{xcookybooky} and \texttt{cookybooky} is shown in table \ref{tbl:comparison}.
-% \begin{table}[htbp]
-% \centering
-% \begin{tabular}{rll}
-% \textbf{Characteristic} & \textbf{xcookybooky} & \textbf{cookybooky}\\
-% Maximum recipe length & unlimited & 1 page\\
-% Support missing pictures & yes & no\\
-% Transparent background graphic & not part of package (see section \ref{sec:background}) & yes\\
-% Main Layout & wraptable & minipages\\
-% Support twoside option & only changing pictures above & full\\
-% Generate recipe & environment & macro\\
-% \end{tabular}
-% \caption{Comparison between xcookybooky and cookybooky}
-% \label{tbl:comparison}
-% \end{table}
-% \newpage
%
% \section{Usage}
-% First I want to explain the most important macros. After this you should be able to insert recipes. Afterwards some macros are shown, which allows you to modify the design (e.g. colors, headlines).
+% In this section the most important macros are explained. After this you should be able to insert recipes. For more details take a look at the implementation in section~\ref{sec:implementation}. Afterwards some macros are shown, which allows you to modify the design (e.g. colors, headlines).
+%
+% \subsection{Main}
+% This commands are commonly used for typesetting recipes. For more details take a look at the implementation in section~\ref{sec:implementation}. You can also investigate the examples and the configuration file.
%
% \DescribeEnv{recipe}
-% This the environment to insert recipes. Each recipe is included in a single enviroment. It is necessary to enter the name of the recipe. It is possible to insert also the recipetime, the portions, the calory content and the source (where you get this recipe).
+% The \texttt{recipe} environment is used to insert recipes. Each recipe is included in a single enviroment. It is necessary to enter the name of the recipe. Besides it is possible to insert also the recipetime, the portions, the calory content and the source (where you get this recipe).
%
-% Example:
-% \begin{verbatim}
-% \begin{recipe}[
-% preparationtime = 30 min,
-% bakingtime = 1 hour,
-% bakingtemperature = \unit[225]{°C},
-% portion = 4 portions,
-% calory = 4 kj,
-% source = My neighbour Sarah
-% ]{Currywurst}
+% \begin{lstlisting}[caption={Recipe Environment}]
+% \begin{recipe}
+% [%
+% preparationtime = {\unit[1]{h}},
+% bakingtime={\unit[1]{h}},
+% bakingtemperature={\protect\bakingtemperature{fanoven=\unit[230]{°C}}},
+% portion = {\portion{5-6}},
+% calory={\unit[3]{kJ}},
+% source = {Somebody you used know}
+% ]
+% {Test Recipe}
% ...
% \end{recipe}
-% \end{verbatim}
+% \end{lstlisting}
%
% \DescribeMacro{\graph}
-% It is possible to set 2 pictures by the macro \texttt{graph}. They are displayed above the other content. If no pictures are set, the space is used by the other content.
-% The \texttt{big} picture should be bigger than the \texttt{small} picture ;) but it also possible to modify this behaviour.
-% The reason for this is that the widths of the pictures are predefined by the command \texttt{setRecipeLengths}.
+% It is possible to set two pictures by using the macro \texttt{graph}. They are displayed at the top of the page and therefore above all other content. If no pictures are set, the space is used by the other content. The \texttt{big} picture should be larger than the \texttt{small} picture of course. The width of both graphics can be adapt to your needs by applying the command \texttt{setRecipeLengths}.
%
-% Example (simple):
-% \begin{verbatim}
+% \begin{lstlisting}[caption={Graph Command (simple)}]
% \graph{
% small = strawberry,
% big = strawberrycake
% }
-% \end{verbatim}
+% \end{lstlisting}
%
-% Another possibility is shown in the following example. It is recommended if you only want to change the widths of the pictures for one recipe.
-% \textbf{Note:} These values are one only used for one recipe.
+% Another possibility is shown in the following example. It is recommended if you only want to change the widths of the pictures for one recipe, because these values are one only used for one recipe. If you want to changed it for all recipes use \texttt{setRecipeLengths}.
%
-% Example (extended):
-% \begin{verbatim}
+% \begin{lstlisting}[caption={Graph Command (extended)}]
% \graph{
% small = strawberry,
% smallpicturewidth = 0.3\textwidth,
% big = strawberrycake,
% bigpicturewidth = 0.6\textwidth,
% }
-% \end{verbatim}
+% \end{lstlisting}
%
% \DescribeMacro{\ingredients}
% Here the ingredients of your recipe are set. They should be entered by number (unit) \& ingredient. If the unit is a SI-Unit, it looks better if you use the \texttt{units} package instead of a blank.
% Since the version 1.2 there is only one possibility to enter ingredients, which is shown in the example. Note that a overlong ingredient will automatically create a line break.
%
-% Example:
-% \begin{verbatim}
+% \begin{lstlisting}[caption={Ingredients Command}]
% \ingredients{
-% 2 Tafeln & dunkle Schokolade (über \unit[70]{\%})\\
-% 3 & Eier\\
-% \unit[200]{ml} & Sahne\\
-% \unit[40]{g} & Zucker\\
+% 2 bar & Dark Chocolate (above \unit[70]{\%})\\
+% 3 & Eggs\\
+% \unit[200]{ml} & Cream\\
+% \unit[40]{g} & Sugar\\
% \unit[50]{g} & Butter
% }
-% \end{verbatim}
+% \end{lstlisting}
%
-% In the versions up to 1.1 there was also a method to enter ingredients with three columns. Due to the substitution of \texttt{tabular} with \texttt{tabularx} I decided that the three columns method is no longer supported, because it would mean a lot of work. This method has also the drawback it needs more space and in my opinion it also looks ugly.
+% In the versions up to 1.1 there was also a method to enter ingredients with three columns. Due to the substitution of \texttt{tabular} with \texttt{tabulary} I decided that the three columns method is no longer supported, because it would mean a lot of work. This method has also the drawback it needs more space and in my opinion it also looks ugly.
% If you are using the three columns solution there are two options:
% \begin{enumerate}
-% \item Use the version 1.1 of thsi package
+% \item Use the version 1.1 of this package, which can be found at \url{https://code.google.com/p/xcookybooky/}
% \item Redefine the concerning command in your latex file or in the configuration file
% \end{enumerate}
%
% \DescribeMacro{\preparation}
-% The preparation steps are inserted by this macro. Every step is written after \texttt{step} command. This is necessarry for the numeration.
+% The preparation steps are inserted by this macro. Every step is written after \texttt{step} command. This is necessarry for the numeration. Since version 1.4 it is allowed to use blank lines to create passages.
%
-% Example:
-% \begin{verbatim}
+% \begin{lstlisting}[caption={Preparation Command}]
% \preparation{
% \step This is the first step for cooking a brilliant meal.
% \step The second step follows...
% \step and so on
% \step Enjoy your meal!
% }
-% \end{verbatim}
+% \end{lstlisting}
+%
+% If you don't like the step number, you can either redefine it or simply use an enumeration as demonstrated in the next example.
+% \begin{lstlisting}[caption={Preparation Command with Enumeration}]
+% \preparation{
+% \begin{enumerate}
+% \item This is the first step for cooking a brilliant meal.
+% \item The second step follows...
+% \item and so on
+% \item Enjoy your meal!
+% \end{enumerate}
+% }
+% \end{lstlisting}
+%
+%
+% \subsection{Advanced}
+%
+% \DescribeMacro{\introduction}
+% The \texttt{introduction} macro can be used for inserting an introduction before the preparation and ingredients part. It has a frame and the text can contain blank lines to create passages.
+%
+% \begin{lstlisting}[caption={Introduction Command}]
+% \introduction{%
+% This text block can contain an introduction to the recipe.
+% }
+% \end{lstlisting}
+%
+% \DescribeMacro{\suggestion}
+% This command is displayed after the ingredients and preparation part of the recipe. It is expandable so that you can insert multiple suggestions. The optional parameter can be used to set a headline.
+% \begin{lstlisting}[caption={Suggestion Command}]
+% \suggestion{%
+% Another possibility to insert additional information to the recipe.
+% }
+% % \suggestion[Headline]{%
+% Another possibility to insert additional information to the recipe.
+% }
+% \end{lstlisting}
%
+% \subsection{Support Commands}
% \DescribeMacro{\portion}
% This macro is intented as an interface for an equal formating of portions entries. For this it can be easily modified. You just have to renew this command.
+% \begin{lstlisting}[caption={Portion Command}]
+% \portion{5}
+% \portion[People]{5}
+% \end{lstlisting}
%
% \DescribeMacro{\bakingtemperature}
% This macro allows you to enter some bakingtemperatures. If you do not like the order of the temperatures you can change them by redefining the command. The temperatures are inserted as key/value pairs as known from the \texttt{xkeyval} package.
%
-% Example (an entry in options of an recipe):
-% \begin{verbatim}
+% \begin{lstlisting}[caption={Baking Temperature Command}]
% \begin{recipe}
% [
-% bakingtemperature={\protect\bakingtemperature{fanoven=\unit[230]{°C},
-% topbottomheat=\unit[195]{°C}, topheat=\unit[195]{°C}, bottomheat, gasstove=Stufe 2}}
-% ]{Currywurst}
+% bakingtemperature={\protect\bakingtemperature{
+% fanoven=\unit[230]{°C},
+% topbottomheat=\unit[195]{°C},
+% topheat=\unit[195]{°C},
+% bottomheat, gasstove=Level 2}
+% }
+% ]{Test Recipe}
% \end{recipe}
-% \end{verbatim}
+% \end{lstlisting}
+%
%
-% \subsection{Modify design}
+% \subsection{Modify Design}
% The following macros can be used outside the recipe environment to choose your personal color etc.
%
% \DescribeMacro{\setRecipeColors}
-% If you want to change the default colors, you can use \texttt{setRecipeColors}. The colors are set by <key~=~value> as known by the \texttt{xkeyval} package. The names of colors can be found in table \ref{tbl:colormanagement}. New colors can be easiliy defined by the \texttt{xcolor} package as shown the example below.
+% If you want to change the default colors, you can use \texttt{setRecipeColors}. The colors are set by <key~=~value> as known by the \texttt{xkeyval} package. The names of colors can be found in table \ref{tbl:colormanagement}.
% \begin{table}[htbp]
% \centering
% \begin{tabular}{rcl}
-% \textbf{key}& \textbf{default value} & \textbf{description}\\
-% recipename & green & recipe name\\
-% ing & gray & ingredients (text)\\
-% inghead & gray & headline of the ingredients\\
-% prep & black & preparation (text)\\
-% prephead & black & headline of the preparation\\
-% hint & red & hint (text)\\
-% hinthead & red & headline of the hint\\
-% hintline & red & lines leftside the hint text (cross)\\
-% numeration & red & numeration of the preparation steps\\
+% \textbf{Key} & \textbf{Default Value} & \textbf{Description} \\
+% \toprule
+% recipename & DarkGreen & recipe name \\
+% intro & black & introduction \\
+% ing & DarkGray & ingredients (text) \\
+% inghead & DarkGray & headline of the ingredients \\
+% prep & black & preparation (text) \\
+% prephead & black & headline of the preparation \\
+% suggestion & black & suggestions (text) \\
+% suggestionhead & black & headline of suggestions\\
+% separationgraph & black & graphical separator \\
+% hint & red & hint (text) \\
+% hinthead & red & headline of the hint \\
+% hintline & red & lines leftside the hint text (cross) \\
+% numeration & red & numeration of the preparation steps \\
% \end{tabular}
% \caption{Color Management}
% \label{tbl:colormanagement}
% \end{table}
+% New colors can be easiliy defined by the \texttt{xcolor} package as shown the example below.
%
-% \begin{samepage}
-% Example:
-% \begin{verbatim}
+% \begin{lstlisting}[caption={Setting Recipe Colors Command}]
% \definecolor{webgreen}{rgb}{0,.5,0}
%
% \setRecipeColors{
@@ -262,71 +304,110 @@
% ing = blue,
% numeration = black,
% }
-% \end{verbatim}
-% \end{samepage}
+% \end{lstlisting}
%
% \DescribeMacro{\setRecipeLengths}
-% By using the command \texttt{setRecipeLengths} it is possible to change the (default) values for the picture widths and the text column width.
+% By using the command \texttt{setRecipeLengths} it is possible to change the (default) values for the picture widths and the text column widths. In the table~\ref{tbl:recipelengths} all implemented keys are listed.
+% \begin{table}[htbp]
+% \centering
+% \begin{tabular}{rl}
+% \textbf{Key} & \textbf{Description} \\
+% \toprule
+% 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
+% \end{tabular}
+% \caption{Recipe Lengths}
+% \label{tbl:recipelengths}
+% \end{table}
%
-% Example:
-% \begin{verbatim}
+% \begin{lstlisting}[caption={Setting Recipe Lengths Command}]
% \setRecipeLengths{
-% preparationwidth = 0.60\textwidth,
-% ingredientswidth = 0.35\textwidth,
-% pictureheight = 6cm,
-% bigpicturewidth = 0.6\textwidth,
-% smallpicturewidth = 0.35\textwidth
+% preparationwidth = 0.5\textwidth,
+% ingredientswidth = 0.4\textwidth,
% }
-% \end{verbatim}
+% \end{lstlisting}
%
% \DescribeMacro{\setRecipeSizes}
-% The macro \texttt{setRecipeSizes} enables you to modify the fontsize of many parts of the recipe. The sizes are inserted by <key~=~value> (\texttt{xkeyval}).
+% The macro \texttt{setRecipeSizes} enables you to modify the font size of many parts of the recipe. The sizes are inserted by <key~=~value> (\texttt{xkeyval}). All supported keys can be found in the following table~\ref{tbl:sizemanagement}.
+% \begin{table}[htbp]
+% \centering
+% \begin{tabular}{rl}
+% \textbf{Key} & \textbf{Description} \\
+% \toprule
+% 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 \\
+% 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
+% \end{tabular}
+% \caption{Font Size Management}
+% \label{tbl:sizemanagement}
+% \end{table}
%
-% Example (these are the default values):
-% \begin{samepage}
-% \begin{verbatim}
+% \begin{lstlisting}[caption={Setting Recipe Sizes Command}]
% \setRecipeSizes{
% recipename = \fontsize{25pt}{30pt},
% ing = \normalsize,
-% inghead = \normalsize,
-% prep = \normalsize,
-% prephead = \normalsize,
-% hint = \normalsize,
% hinthead = \Large
% }
-% \end{verbatim}
-% \end{samepage}
+% \end{lstlisting}
%
% \DescribeMacro{\setRecipenameFont}
-% The name of recipe is displayed with a handwritten font by default. In my opinion it looks much better than a standard font. But if you want to change it you can use this macro. A well-arranged list of fonts can be found at \texttt{http://www.tug.dk/FontCatalogue/}. The other parameters are fontencoding, fontseries and fontshape. The size is changed by \texttt{setRecipeSizes}.
-%
-% Example (some fonts you could try out, requires option \texttt{handwritten}):
-% \begin{verbatim}
-% \setRecipenameFont{
-% % pbsi
-% % fau
-% % fwb
-% % fjd % default when using the option handwritten
-% cmr % default
-% }{T1}{m}{n}
-% \end{verbatim}
+% The name of recipe is only displayed with a handwritten font, if the corresponding option is selected. See section~\ref{sec:options} for details. In my opinion it looks much better than a standard font. But if you want to change it you can use this macro. A well-arranged list of fonts can be found at \url{http://www.tug.dk/FontCatalogue/}. The four parameters are font name,font encoding, font series and font shape. The size is changed by \texttt{setRecipeSizes}. The following example shows a bunch of interesting fonts, which you should try out.
+%
+% \begin{lstlisting}[caption={Setting Recipename Font Command (package \texttt{pbsi})}]
+% \setRecipenameFont{cmr}{T1}{m}{n} % probably the default setting
+% \usepackage{pbsi}
+% \setRecipenameFont{pbsi}{T1}{xl}{n}
+% \end{lstlisting}
+% \begin{lstlisting}[caption={Setting Recipename Font Command (package \texttt{emerald})}]
+% \usepackage{emerald}
+% \setRecipenameFont{fau}{T1}{m}{n}
+% \setRecipenameFont{fwb}{T1}{m}{n}
+% \setRecipenameFont{fjd}{T1}{m}{n} % default by option handwritten
+% \end{lstlisting}
+%
%
% \subsection{Translation}
% \DescribeMacro{\setHeadlines}
-% \texttt{setHeadlines} allows to modify the default headlines. This is also needed for translations (The default values are german, sorry).
-% The headlines are also inserted in <key~=~value> form.
+% The command \texttt{setHeadlines} allows to modify the (translated) headlines. This is also needed for translations, if the used language is not supported yet. If you have improvements for a translation or created a new one, feel free to send me a e-mail.
+% The headlines are also inserted in <key~=~value> form. All possible key are described in table~\ref{tbl:headlines}.
+% \begin{table}[htbp]
+% \centering
+% \begin{tabulary}{0.75\textwidth}{rcL}
+% \textbf{Key} & \textbf{Graphic} & \textbf{Description} \\
+% \toprule
+% inghead & no & Headline of ingredients \\
+% prephead & no & Headline of preparation \\
+% hinthead & no & Headline of hint \\
+% continuationhead & no & Text at the top of the second page of a recipe \\
+% continuationfoot & no & Text at the bottom of the first page, if the recipe is longer than one page \\
+% preparationtime & yes & \\
+% bakingtime & yes & \\
+% bakingtemperature & yes & \\
+% portion & yes & \\
+% portionvalue & no & Unit for the portions \\
+% calory & no & Text for the calorific value \\
+% source & yes & \\
+% \end{tabulary}
+% \caption{Recipe Headlines}
+% \label{tbl:headlines}
+% \end{table}
%
-% Example (a possible english translation):
-% \begin{verbatim}
+% \begin{lstlisting}[caption={Setting Headlines Command}]
% \setHeadlines{
% inghead = Ingredients,
-% prephead = Preparation,
-% hinthead = Hint,
-% calory = energy content,
-% continuationhead = Continuation,
-% continuationfoot = Continuation on next page
+% hinthead = Straight Tip,
+% continuationhead = Continuation \dots,
% }
-% \end{verbatim}
+% \end{lstlisting}
%
%
% \subsection{Options}
@@ -342,12 +423,17 @@
%
% \subsection{Background graphic}
% \label{sec:background}
-% Inside this package there is only the option to set a background picture using the \texttt{setBackgroundPicture} macro.
-% For creating transparent backgrounds I recommand \textbf{Inkscape}\footnote{http://inkscape.org/}. You just have to import a picture and reduce the opacity of the picture (I prefer \unit[22]{\%}).
-% The possible options for the orientation are: default, pagecenter, textcenter or stockcenter. To modify these orientations you have the possibility to change it manually by setting the \texttt{x} and \texttt{y} option (as shown below).
+% Inside this package there is only the option to set a background picture using the \texttt{setBackgroundPicture} macro. For creating transparent backgrounds I recommand \textbf{Inkscape}\footnote{http://inkscape.org/}. You just have to import a picture and reduce the opacity of the picture (I prefer \unit[22]{\%}). The possible options for the orientation are:
+% \vspace{-1em}
+% \begin{itemize}
+% \item default
+% \item pagecenter
+% \item textcenter
+% \item stockcenter
+% \end{itemize}
+% These orientations can be modified by using the \texttt{x} and \texttt{y} option. This is demonstrated in the following example.
%
-% Example:
-% \begin{verbatim}
+% \begin{lstlisting}[caption={Background Picture Command}]
% \setBackgroundPicture
% [%
% x = 2cm,
@@ -356,7 +442,7 @@
% height,
% orientation=pagecenter
% ]{pic/bg_transparent} % filepath
-% \end{verbatim}
+% \end{lstlisting}
%
% \newpage
% \IfFileExists{example/example.pdf}
@@ -377,9 +463,9 @@
% This package is non-free and therefore not available in TeX Live.
%
% \section{Bugs}
-% If you found a bug, which is not described in the following section, feel free to write me an email. It can be found at the titlepage.
+% If you found a bug, which is not described in the following section, feel free to write me an email. It can be found at the titlepage. Alternatively you can visit \url{https://code.google.com/p/xcookybooky/} and report the issue. All reported problems are registered there.
%
-% \subsection{Known issues}
+% \subsection{Known Issues}
% \label{sec:knownissues}
% The \texttt{wrapfig} package has some problems with enumerations and the \texttt{lettrine} package. This is the reason, why some warnings are generated by compiling (the example), if do not use the package option \textbf{nowarnings}. But nevertheless the results look quite well, so I decided to ignore this issue.
% By using \texttt{wrapfig} it is not possible to switch ingredients and preparation (the result looks really ugly). This is the reason, why the layout is not changed when setting the \texttt{twoside} option in the document class. I also tried \texttt{parcolumns} and \texttt{parallel}, but the results were disappointing. If you want to use this feature, you have to use \texttt{cookybooky}.
@@ -387,11 +473,15 @@
% Another limitation is the length of the ingredients. The maximum length is one page, because the \texttt{wrapfigure} package does not work with \texttt{longtable}. As a result no pagebreak in the ingredients is possible.
% \StopEventually{\PrintIndex}
%
+%
+% \newpage
+%
% \section{Implementation}
+% \label{sec:implementation}
% Let's have a look at the implementation.
%
% \subsection{Options}
-% You can use the option \texttt{myconfig} to load your personal configuration (file). See section \ref{sec:configuration}
+% \texttt{xcookybooky} provides three options as explained in section~\ref{sec:options}. You can use the option \texttt{myconfig} to load your personal configuration (file). See section \ref{sec:configuration} for details.
% \begin{macrocode}
%<*package>
\newif\ifHandwrittenFont@required
@@ -429,13 +519,14 @@
\RequirePackage{tikz} % for creating the lines for the hint
\RequirePackage{graphicx}
\RequirePackage{xcolor}
-\RequirePackage[clock, misc, weather]{ifsym} % Symbolpackage e.g. \Interval, \Wecker etc
+\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
@@ -443,12 +534,13 @@
\RequirePackage{units}
\RequirePackage{eso-pic} % for background pictures
\RequirePackage{picture} % for modfifying the position of the bg pictures
-\RequirePackage{tabularx} % line breaks in tabular
+\RequirePackage{tabulary} % line breaks in tabular
+\RequirePackage{framed} % frame for the introduction
% \end{macrocode}
%
% \subsection{Page Layout}
-% This will set up the page. It is optimized for the documentclass \texttt{article}. If you use a other package you probably have to modify this.
+% This will set up the page. It is optimized for the document class \texttt{article}. If you use an other class you probably have to modify this.
%
% \textbf{Note:} I tried to use the KOMA class \texttt{scrartcl}, but unfortunately some strange effects occured.
% \begin{macrocode}
@@ -473,6 +565,7 @@
%
% \begin{macro}{\recipesection}
% The macro \texttt{recipesection} allows to modify the entry in the table of contents.
+%
% \textbf{Note:} If you modify the macro you may change the two upper lines as well.
% \begin{macrocode}
\newcommand*{\recipesection}[2][]
@@ -484,28 +577,43 @@
% \end{macro}
%
% \subsection{Color Management}
+% At first the used non-standard colors must be defined.
+% \begin{macrocode}
+\providecolor{DarkGreen}{rgb}{0,.5,0}
+\providecolor{DarkBlue}{rgb}{0, 0, 0.7}
+\providecolor{DarkGray}{rgb}{0.23, 0.23, 0.23}
+
+% \end{macrocode}
% Below the (default) colors are defined using the \texttt{xkeyval} package.
% \begin{macrocode}
-\define@key{colorManagement}{recipename}[green]{\def\xcb@color@recipename{#1}}
-\define@key{colorManagement}{ing}[gray]{\def\xcb@color@ing{#1}}
-\define@key{colorManagement}{inghead}[gray]{\def\xcb@color@inghead{#1}}
+\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
- ing, % color of ingredients (text)
- inghead, % color of headline of ingredients
- prep, % color of preparation (text)
- prephead, % color of headline of preparation
- hint, % color of hint (text)
- hinthead, % color of headline of hint
- hintline, % color of lines of hint
- numeration % color of numeration (preparation)
+ 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)
}
% \end{macrocode}
@@ -526,10 +634,14 @@
\setRecipeColors
{% initialisation
recipename,
+ intro,
ing,
inghead,
prep,
prephead,
+ suggestion,
+ suggestionhead,
+ separationgraph,
hint,
hinthead,
hintline,
@@ -538,24 +650,28 @@
% \end{macrocode}
% \subsection{Size Management}
-% Below the (default) sizes are definded.
+% Below the (default) font sizes of the recipe are defined.
% \begin{macrocode}
\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,
- ing,
- inghead,
- prep,
- prephead,
- hint,
- hinthead
+ 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
}
% \end{macrocode}
@@ -564,7 +680,7 @@
% The parameter are set in the form "key~=~value" as known by the \texttt{xkeyval} package.
% \begin{macrocode}
\newcommand*{\setRecipeSizes}[1]
-{
+{%
\setkeys{sizeManagement}{#1}
}
@@ -575,18 +691,22 @@
\setRecipeSizes
{% initialisation
recipename,
+ intro,
ing,
inghead,
prep,
prephead,
+ suggestion,
hint,
hinthead
}
% \end{macrocode}
%
+% \subsection{Recipe Font}
+%
% \begin{macro}{\setRecipenameFont}
-% This macro sets the font for the name of the recipe. You have to insert the fontfamily, fontencoding, fontseries and fontshape. The size is set by the \texttt{sizeManagement}
+% This macro sets the font for the name of the recipe. You have to insert the font family, font encoding, font series and font shape. The size is set by the command \texttt{sizeManagement}.
% \begin{macrocode}
%% Handwritten fonts: hlce, pbsi, hlcw, fjd, fau
%% Other fonts: fwb
@@ -605,9 +725,10 @@
% \end{macrocode}
% \end{macro}
%
-% This is the initialisation of the font for the recipename. The default is Computer Modern, because it is available on every \LaTeX{} distribution.
+% This is the initialisation of the font of the recipename. The default is set to the system default settings to support as many \LaTeX{} distributions as possible.
+% Before version 1.3 a certain font was chosen per default. But this choice created an error if one uses UTF-8 input encoding.
% \begin{macrocode}
-\setRecipenameFont{cmr}{T1}{b}{n}
+\setRecipenameFont{\familydefault}{\encodingdefault}{b}{n}
% \end{macrocode}
%
@@ -626,45 +747,26 @@
% \end{macrocode}
%
-%
-% \begin{macro}{\step}
-% The command is used for numbering the steps of preparation. Take a look at the \texttt{lettrine} package for details.
+% \subsection{Headlines and Translations}
+% The following section defines the default English headlines of the recipe. They are only used if no supported language is detected.
% \begin{macrocode}
-\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}{}%
-}
-
-% \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macrocode}
-\define@key{headlines}{inghead}[Zutaten]{
+\define@key{headlines}{inghead}[Ingredients]{
\def\xcb@name@inghead{\textcolor{\xcb@color@inghead}{\textbf{\xcb@fontsize@inghead{#1}}\ }}
}
-\define@key{headlines}{prephead}[Zubereitung]{
+\define@key{headlines}{prephead}[Preparation]{
\def\xcb@name@prephead{\textcolor{\xcb@color@prephead}{\textbf{\xcb@fontsize@prephead{#1}}\ }}
}
-\define@key{headlines}{hinthead}[Tipp:]{
+\define@key{headlines}{hinthead}[Hint]{
\def\xcb@name@hinthead{\textcolor{\xcb@color@hinthead}{\xcb@fontsize@hinthead{#1}}}
}
-\define@key{headlines}{continuationhead}[Fortsetzung]{\def\xcb@name@continuationhead{#1}}
-\define@key{headlines}{continuationfoot}[Fortsetzung auf n\"achster Seite]{\def\xcb@name@continuationfoot{#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}[Personen]{\def\xcb@name@portionvalue{#1}}
-\define@key{headlines}{calory}[Brennwert]{\def\xcb@name@calory{#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}
{
@@ -684,7 +786,7 @@
% \end{macrocode}
%
% \begin{macro}{\setHeadlines}
-% This allows you to modify the headlines for the recipe parts. This also needed for translations (The default values are german, sorry). The parameter are set in the form "key~=~value" as known by the \texttt{xkeyval} package.
+% This allows you to modify the headlines for the recipe parts. This also needed for translations. If you are going to define a language which is not supported by \texttt{xcookybooky} yet, please send me an email and I will integrate it in the next version! The parameter are set in the form "key~=~value" as known by the \texttt{xkeyval} package.
% \begin{macrocode}
\newcommand*{\setHeadlines}[1]
{%
@@ -711,27 +813,92 @@
}
% \end{macrocode}
-% The values xcb@bigpicturewidth and xcb@smallpicturewidth are the default values.
-% They can be changed with the \texttt{graph} command.
+%
+% After the initialization the supported languages are used as default values.
+% \begin{macrocode}
+\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
+ }
+}{}
+
+% \end{macrocode}
+%
+% \subsection{Recipe Lengths}
+%
+% The values \texttt{xcb@bigpicturewidth} and \texttt{xcb@smallpicturewidth} are the default values.
+% They can be temporarily changed with the \texttt{graph} command, i.e for a single recipe.
% \begin{macrocode}
-\define@key{recipelengths}{preparationwidth}[0.60\textwidth]{\def\xcb@preparationwidth{#1}}
-\define@key{recipelengths}{ingredientswidth}[0.35\textwidth]{\def\xcb@ingredientswidth{#1}}
\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}
{
- preparationwidth,
- ingredientswidth,
- pictureheight,
- bigpicturewidth,
- smallpicturewidth
+ 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
}
% \end{macrocode}
%
% \begin{macro}{\setRecipeLengths}
-% This command allows to modify most sizes of the recipe. The \texttt{pictureheight} is the height of the two pictures above the text.
+% This command allows to modify most sizes of the recipe.
% \begin{macrocode}
\newcommand*{\setRecipeLengths}[1]
{%
@@ -743,53 +910,169 @@
% \begin{macrocode}
\setRecipeLengths
{% initialisation
- preparationwidth,
- ingredientswidth,
pictureheight,
bigpicturewidth,
- smallpicturewidth
+ smallpicturewidth,
+ introductionwidth,
+ preparationwidth,
+ ingredientswidth
}
% \end{macrocode}
+%
+% \subsection{Recipe Commands}
+% The following commands are implemented for inserting the recipe content.
+%
+% \subsubsection{Main Commands}
+% These commands provide the main functionality for inserting a recipe.
+%
+% \begin{macro}{\introduction}
% \begin{macrocode}
-\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}
- }
+%% 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}
}
}
-\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{
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\graph}
+% This command is used for entering the filename of the pictures. If a picture is not set, it is not shown.
+% \begin{macrocode}
+\newcommand*{\graph}[1]
+{%
+ \setkeys{picture}{#1}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ingredients}
+% The command is used to insert the ingredients, which are displayed as a table.
+% \begin{macrocode}
+\newcommand*{\ingredients}[1]
+{%
+ \def\xcb@ingredients
+ {%
+ \xcb@name@inghead
+ \\[1em]
+ {\xcb@fontsize@ing\color{\xcb@color@ing}
+ \begin{tabulary}{\xcb@ingredientswidth}{rL}
+ #1
+ \end{tabulary}}
+ }
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\preparation}
+% This command enables the user to insert the preparation steps.
+% \begin{macrocode}
+\newcommand{\preparation}[1]
+{%
+ \def\xcb@preparation
+ {%
+ \xcb@name@prephead
+ %\\[4pt]
+ \xcb@fontsize@prep\color{\xcb@color@prep}#1
+ }
+ \setcounter{step}{0}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\suggestion}
+% The command is intended to insert some suggestions after the preparation and ingredients part. It is expandable in order to create more than one suggestion in one recipe.
+% \begin{macrocode}
+\newcommand{\suggestion}[2][]
+{%
+ \g@addto@macro\xcb@suggestion
+ {%
+ \xcb@separationgraph{\xcb@color@separationgraph}
\ifthenelse{\equal{#1}{}}
- {% not set => not shown
+ {%
+ {\color{\xcb@color@suggestion}#2}
}
- {
- \vspace{-0.6cm}
- \includegraphics[width=\linewidth, height = \xcb@pictureheight, keepaspectratio]{#1}
+ {%
+ \textbf{{\color{\xcb@color@suggestionhead}#1}}
+
+ {\color{\xcb@color@suggestion}#2}
}
}
}
-\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}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hint}
+% This command allows the user to insert an optional hint at the bottom of the recipe.
+% \begin{macrocode}
+\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
+ }
+}
% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Supporting Commands}
+% The following commands are intended to simplify inserting some parts of the recipe like backing temperatures.
+%
+% \begin{macro}{\step}
+% The command is used for numbering the steps of preparation. Take a look at the \texttt{lettrine} package for details.
+% \begin{macrocode}
+%% 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}{}%
+}
+
+% \end{macrocode}
+% \end{macro}
%
% \begin{macro}{\portion}
% This macro is for inserting the portions correctly. By renewing this command you can easiliy define your own design for the portions.
% \begin{macrocode}
-\newcommand*{\portion}[2][\xcb@name@portionvalue]{\unit[#2]{#1}}
+\newcommand*{\portion}[2][\xcb@name@portionvalue]
+{%
+ \unit[#2]{#1}
+}
% \end{macrocode}
% \end{macro}
@@ -841,136 +1124,257 @@
\xcb@bakingtemperature@gasstove \ {\fontsize{14.5pt}{10pt}\Gasstove}%
}%
}
+
% \end{macrocode}
% \end{macro}
%
-% \subsection{Recipe Environment}
-% \begin{environment}{recipe}
-% This the environment for inserting recipes. Inside you define your ingredients, preparation, pictures (graph) and maybe a hint.
-% The commands \texttt{xcb@cmd@myrecipeoverview} and \texttt{xcb@cmd@wrapfill} are intended for internal use only.
+% \subsubsection{Internal Commands}
+% \begin{macro}{\xcb@cmd@recipeoverview}
% \begin{macrocode}
-\newenvironment{recipe}[2][]
+%% INTERNAL COMMANDS
+\newcommand{\xcb@cmd@recipeoverview}
{
- %% macros
- \newcommand*{\graph}[1]
- {%
- \setkeys{picture}{##1}
- }
+ \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*{\ingredients}[1]
- {%
- \def\xcb@ingredients
- {%
- \vspace{-1em} % same height of ingredients and preparation
- \xcb@name@inghead
- %\\[4pt]
- \\[1em]
- \xcb@fontsize@ing\color{\xcb@color@ing}
- \begin{tabularx}{\xcb@ingredientswidth}{rX}
- ##1
- \end{tabularx}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}
+% The following command is needed, if more ingredients than preparation (steps) are inserted. In this case the \texttt{wrapfigure} package behaves in a strange way. The result is that the hint is also floating around the ingredients, although the "box" is already closed. This command repairs this effect.
+% It is taken from \url{http://mizine.de/latex/wrapfigure-austricksen/}.
+% \begin{macrocode}
+\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
+}
+
+% \end{macrocode}
+% \end{macro}
+% The following code lines define the behaviour of the two pictures
+% \begin{macrocode}
+\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}
}
}
-
- \newcommand*{\preparation}[1]
- {%
- \def\xcb@preparation
- {%
- \xcb@name@prephead
- %\\[4pt]
- \xcb@fontsize@prep\color{\xcb@color@prep}##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}
}
- \setcounter{step}{0}
}
-
- \newcommand*{\hint}[1]
+}
+
+% \end{macrocode}
+%
+% The definition of the recipe properties.
+% \begin{macrocode}
+\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}}
+
+% \end{macrocode}
+%
+% This command provides an graphical separator. It is intended to separate the preparation and ingredients part from the optional suggestions. The required parameter must be a color and the optional argument is used to scale the graphic.
+% \begin{macro}{\xcb@separationgraph}
+% \begin{macrocode}
+\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}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Hooks}
+% The following hooks allow the user to insert data many different places in the recipe in order to customize the recipe.
+%
+% \begin{macro}
+% The content of this hook command is inserted before the (two) pictures. Therefore it is the first page content (aside from the page headline etc).
+% \begin{macrocode}
+%% HOOKS
+\newcommand*{\pregraph}[1]
+{% Hook: entered before the pictures
+ \def\xcb@hook@pregraph
{%
- \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
+ \begin{minipage}[T]{\textwidth}
+ #1
+ \vspace{0.6cm}
+ \end{minipage}
+ }
+}
- \begingroup % a group for the hint
- \leftskip1em
- \xcb@name@hinthead
- \nopagebreak
-
- \itshape\textcolor{\xcb@color@hint}{\xcb@fontsize@hint{##1}}
- \par
- \endgroup
- }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}
+% This command is inserted before the title of the recipe. That means it is displayed after the pictures.
+% \begin{macrocode}
+\newcommand*{\pretitle}[1]
+{% Hook: entered before the recipe title
+ \def\xcb@hook@pretitle
+ {%
+ #1
+ }
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}
+% The next macro is integrated before the overview of the recipe and therefore after the recipe title.
+% \begin{macrocode}
+\newcommand*{\prerecipeoverview}[1]
+{% Hook: entered before the recipe overview
+ \def\xcb@hook@prerecipeoverview
+ {%
+ #1
}
-
- \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}
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}
+% This command is inserted before the preparation headline and steps, i.e. it is beside the ingredients.
+% \begin{macrocode}
+\newcommand*{\prepreparation}[1]
+{% Hook: entered before the preparation (steps)
+ \def\xcb@hook@prepreparation
+ {%
+ #1
+ }
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}
+% This command is inserted after the preparation headline and steps, i.e. it is beside the ingredients.
+% \begin{macrocode}
+\newcommand*{\postpreparation}[1]
+{% Hook: entered after the preparation (steps)
+ \def\xcb@hook@postpreparation
+ {%
+ #1
}
+}
% \end{macrocode}
-% The following command is needed, if more ingredients than preparation (steps) are inserted. In this case the \texttt{wrapfigure} package behaves in a strange way. The result is that the hint is also floating around the ingredients, although the "box" is already closed. This command repairs this effect.
-% It is taken from http://mizine.de/latex/wrapfigure-austricksen/
-% \begin{macrocode}
- \newcommand\xcb@cmd@wrapfill
+% \end{macro}
+%
+% \begin{macro}
+% The following hook command is integrated before the ingredients. That means it parallel to the preparation.
+% \begin{macrocode}
+\newcommand*{\preingredients}[1]
+{% Hook: entered before the ingredients
+ \def\xcb@hook@preingredients
{%
- \par
- \ifx\parshape\WF@fudgeparshape
- \nobreak
- \vskip-\baselineskip
- \vskip\c@WF@wrappedlines\baselineskip
- \allowbreak
- \WFclear
- \fi
+ #1
}
- %% end of macros
-
-
- % initialisation
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}
+% The following hook command is integrated after the ingredients. That means it parallel to the preparation.
+% \begin{macrocode}
+\newcommand*{\postingredients}[1]
+{% Hook: entered after the ingredients
+ \def\xcb@hook@postingredients
+ {%
+ #1
+ }
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Recipe Environment}
+% \begin{environment}{recipe}
+% This the environment for inserting recipes. Inside you define your ingredients, preparation, pictures (graph) and maybe suggestions and/or a hint.
+% The commands \texttt{xcb@cmd@myrecipeoverview} and \texttt{xcb@cmd@wrapfill} are intended for internal use only.
+% \begin{macrocode}
+\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
- \ingredients{}
+ \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}
@@ -981,6 +1385,7 @@
}
{% this part is executed at \end{recipe}
%% FIRST BLOCK
+ \xcb@hook@pregraph
\if@twoside
\ifodd\arabic{page}
\begin{minipage}[T]{\xcb@picture@bigwidth}
@@ -1010,18 +1415,32 @@
\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
\begin{wraptable}{r}{\xcb@ingredientswidth}
{
+ \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
@@ -1182,10 +1601,14 @@
\setRecipeColors
{%
recipename,
+ intro,
ing,
inghead,
prep,
prephead,
+ suggestion,
+ suggestionhead,
+ separationgraph,
hint,
hinthead,
hintline,
@@ -1195,25 +1618,28 @@
\setRecipeSizes
{%
recipename,
+ intro,
ing,
inghead,
prep,
prephead,
+ suggestion,
hint,
hinthead
}
\setRecipeLengths
{%
+ pictureheight,
+ bigpicturewidth,
+ smallpicturewidth,
+ introductionwidth,
preparationwidth,
- ingredientswidth,
- pictureheight
+ ingredientswidth
}
-\setRecipenameFont{fjd}{T1}{m}{n}
+\setRecipenameFont{cmr}{T1}{m}{n}
-
-%% Translation
\setHeadlines
{%
inghead,
@@ -1229,6 +1655,7 @@
calory,
source
}
+
%</config>
% \end{macrocode}
%