I would like to insert recipe in a book so that I could refer to them as "Recipe 1", "Recipe 2" etc...
I found this code on the internet that I would like to adapt because I don't want to define a new document class. So I just want a new environnement definition in which I could write my recipe.
Here a example (as short as possible but still quite long... sorry...)
Code: Select all
\documentclass[12pt,a4paper]{book}
\usepackage[francais]{babel}
\usepackage[applemac]{inputenc}
\usepackage{graphicx}
\usepackage{array}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{vmargin}
\setmarginsrb{2.5cm}{2cm}{2cm}{2cm}{10mm}{6mm}{0cm}{10mm}
\usepackage{manfnt}
\usepackage{stmaryrd}
\usepackage{color}
\usepackage{marvosym}
\usepackage{nicefrac} %Pour les fractions
\usepackage{multicol} % Pour les deux colonnes dans les ingrédients
\pagestyle{empty}
%Commandes "utiles"
\newcommand{\puces}{$\leftslice$}
\newcommand{\lpage}{15cm}
\newcommand{\hpage}{15cm}
\newcommand{\niveaugris}{.90}
\definecolor{gris}{gray}{\niveaugris}
\newcommand{\rechead}
{\centering\normalfont\Large\sffamily\bfseries}
\newcommand{\bsi}[2]{\fontsize{#1}{#2}\usefont{T1}{pbsi}{xl}{n}}
\renewcommand{\rechead}{\centering\bsi{24pt}{30pt}}
\renewcommand{\subsubsection}
{\@startsection{subsubsection}{3}{\z@}%
{-5ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\rechead}}
\newcommand{\recette}[1]{\subsubsection{#1}%
\vspace{.1cm}
\hrule height0.75pt width\hsize\vspace*{1\p@}%
\hrule height0.25pt width\hsize%
\nobreak
\vskip\parskip \vspace{.3cm}}
\newcommand{\inghead}{\relax}
\newcommand{\temps}[2]
{{\list{}{\rightmargin 1em\leftmargin 1em}%
\item[]\textit{\textbf{\huge \Clocklogo \normalsize \hspace{\stretch{1}} Pr\'eparation} : #1} \hspace{\stretch{2}} \textit{\textbf{Cuisson} : #2}\endlist}%
\vspace{.2cm}\hrule height0.25pt width\hsize \vspace{.2cm}}
\newcommand{\ingredients}[2][]
{{\list{}{\rightmargin 1em\leftmargin 1em}%
\item[]\textit{\textbf{Ingr\'edients #1}: \vspace{-.3cm}\begin{multicols}{2}\begin{itemize}\renewcommand{\labelitemi}{\puces} #2 \end{itemize}\end{multicols}}\endlist}%
\vspace{.2cm} \hrule height0.25pt width\hsize \vspace{.3cm}}
\newenvironment{nouvellerecette}%
{%\newpage
\setbox0=\hbox\bgroup
\begin{minipage}[!h][\hpage][t]{\lpage}\vspace{.5cm}
}%
{%
\end{minipage}
\egroup
\fcolorbox{gris}{white}{\box0}
}
\newcommand{\degrees}{$^\circ$}
\newcommand{\attention}[1]{\vspace{.3cm} \textdbend #1}
\pagestyle{empty}
\begin{document}
toto
\begin{nouvellerecette}
\recette{Recipe one}
\temps{15 minutes + 24 heures}{1 heure}
\ingredients[(for 40 pieces) ]{
\item $\nicefrac{1}{2}$ milk liter
\item 1 salt
\item 2 eggs
}
Just melt all the ingredients together.
\attention{Exemple of warning}
\end{nouvellerecette}
\end{document}
Code: Select all
) [1{/usr/local/texlive/2009/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
! You can't use `\spacefactor' in internal vertical mode.
\@->\spacefactor
\@m
l.85 \nouvellerecette{Recipe one}
! Missing $ inserted.
<inserted text>
$
l.85 \nouvellerecette{Recipe one}
Thanks a lot

Donut