问题
我正在为正在整理的一本食谱写几条菜谱条目。为此,我使用了包xcookybooky
。对于某些菜谱,我希望能够将准备步骤分成几组(例如,“烤肉”、“酱汁”等)。我曾尝试应用此处条目的代码(见下文),但无济于事。基本上,我看到的是准备步骤被绕到了菜谱的开头,打乱了整个菜谱页面(见下文)。
我读过的内容
我的主要方法基于以下回应:xcookybooky 中的多种准备工作。
平均能量损失
\documentclass[%
a4paper,
11pt
]{article}
\usepackage{nicefrac}
\usepackage{tabularx}
\usepackage[]{xcookybooky}
\usepackage{multirow}
\usepackage{lipsum}
\makeatletter
\newcounter{preparationnumber}\setcounter{preparationnumber}{1}
\setHeadlines{prephead = Preparation method~\thepreparationnumber}% define the heading <<<<<<<<<
\renewcommand*{\prepreparation}[1]
{% Hook: entered before the preparation (steps)
\def\xcb@hook@prepreparation
{%
\xcb@name@prephead%
\xcb@fontsize@prep\color{\xcb@color@prep} #1%
\vspace*{2em}\stepcounter{preparationnumber}\setcounter{step}{0}
}
}
\renewcommand*{\postpreparation}[1]
{% Hook: entered after the preparation (steps)
\def\xcb@hook@postpreparation
{\vspace*{2em}\setcounter{step}{0}\stepcounter{preparationnumber}%
\xcb@name@prephead%
\xcb@fontsize@prep\color{\xcb@color@prep} #1%
}
}
\makeatother
% fix from https://tex.stackexchange.com/a/445886/
\renewcommand{\step}
{%
\stepcounter{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
]{\thestep}{}%
}
\begin{document}
\begin{recipe}
[%
preparationtime={\unit[45]{m}},
portion={\portion{4-6}},
]
{Recipe Title}
\ingredients[35]{
\textbf{List - 1} \\
\unit[2]{T} & & olive oil \\
\unit[1]{} & & red onion \\
\unit[6]{cloves} & & garlic \\
\textbf{List - 2} \\
\unit[1]{} & & cucumber\\
\unit[1]{cup} & \unit[245]{g} & yogurt \\
\unit[2]{cloves} & & garlic \\
\textbf{List - 3} \\
\multicolumn{3}{r}{pita wraps} \\
\multicolumn{3}{r}{shredded red cabbage} \\
}
\prepreparation{Main}{
\step \lipsum[1][1-4]
\step \lipsum[2][1-4]
\step \lipsum[3][1-4]
}
\preparation{Sauce}{
\step \lipsum[1][1-4]
\step \lipsum[2][1-4]
}
\end{recipe}
\end{document}
结果
如图所示,菜谱标题和配料现在出现在准备步骤下方,而准备步骤不知为何被添加到了菜谱的顶部。如能帮助正确格式化,我将不胜感激!