使用 xcookybooky 排版食谱时,如何设置 \suggestion 的宽度并对齐其编号

使用 xcookybooky 排版食谱时,如何设置 \suggestion 的宽度并对齐其编号

我想知道如何在 xcookybooky 中设置“建议”的宽度,以便排版食谱。我用于设置配料和准备宽度的命令如下:

\setRecipeLengths{
    preparationwidth = 0.65\textwidth,
    ingredientswidth = 0.45\textwidth
}

我面临的另一个问题是编号对齐。对于我使用的每个建议环境,最后一个数字及其条目都对齐不齐。以下是使用的建议环境(另请参见图中的第 6 个条目),请也提出解决方案:

\suggestion[Variations]{
    \step Add \unit[1]{tsp} of balsamic or apple cider vinegar at the end
    \step Add \unit[\half]{Tbsp} of lemon juice at the end
    \step Dice a sweet apple (\textit{e.g.} honeycrisp) and add half way through roasting to potatoes.  Top with Parmesan
    \step Top with grated Parmesan or Asiago.
    \step Toss with \unit[\quarter]{c} tart dried fruit (\textit{e.g.} craisins) and feta at end.
}

编译后的结果如下: 在此处输入图片描述

以下是使用的完整代码:

\documentclass[a4paper,12pt]{article}
\usepackage{xcookybooky}
\usepackage{nicefrac}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{fancyhdr}
\usepackage{bookman}
\pagestyle{plain}
\let\half\textonehalf
\let\quarter\textonequarter
\newcommand\textfahrenheit{\textdegree F}
\DeclareRobustCommand{\textcelcius}{\ensuremath{^{\circ}\mathrm{C}}}

\setcounter{secnumdepth}{1}
\renewcommand*{\recipesection}[2][]
{%
    \subsection[#1]{#2}
}
\renewcommand{\subsectionmark}[1]
{% no implementation to display the section name instead
}

\hbadness=10000 % Ignore underfull boxes
\setlength\parindent{20pt}
\setRecipeLengths{
    preparationwidth = 0.65\textwidth,
    ingredientswidth = 0.45\textwidth
}

\renewcommand{\step}
{%
    \stepcounter{step}%shouldn't be in the argument of lettrine
    \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[10]{min}}]{Sour Cream Dip}
    \introduction{%
        A guise under which to sneak a commoner into a fancy ball.  Adjust
        flavors to taste before moving to a clean bowl for presentation.
    }
    \ingredients{%
        \unit[1]{c}&Sour Cream\\
        \unit[2]{Tbsp}&Olive Oil (divided)\\
        \unit[0.5]{c}&Grated Parmesan\\
        \unit[1]{tsp}&Smoke Flavoring\\
        Spices:&Paprika, Salt, \& Pepper
    }
    \preparation{%
        \step Mix sour cream, \unit[1]{Tbsp} olive oil, Parmesan, and
        smoke flavoring in a bowl.  Season with salt and pepper to
        taste.  Move to clean bowl and sprinkle with paprika and drizzle
        remaining olive oil.
        
    }

    \suggestion[Variations]{
    \step Add \unit[1]{tsp} of balsamic or apple cider vinegar at the end
    \step Add \unit[\half]{Tbsp} of lemon juice at the end
    \step Dice a sweet apple (\textit{e.g.} honeycrisp) and add half way through roasting to potatoes.  Top with Parmesan
    \step Top with grated Parmesan or Asiago.
    \step Toss with \unit[\quarter]{c} tart dried fruit (\textit{e.g.} craisins) and feta at end.
}
\hint{%
\textbf{Enjoy this recipe and don't follow the variations to mess up !!}}

\end{recipe}
    
\end{document}

相关内容