다시 생각해보면...

다시 생각해보면...

나는 한동안 ShareLaTeX를 사용하여 보기 좋은 요리법 책을 만들려고 노력해 왔습니다. cookybooky및 패키지를 사용해 보았지만 cuisine제대로 작동하지 못하는 것 같습니다. 각 페이지에 다음이 포함되기를 바랍니다.

  1. 레시피의 제목을 지정하고 해당 제목을 목차 페이지에 배치합니다.
  2. 표시할 기호:

    (a) 식사가 냉동 가능한지 여부

    (b) 채식인지 여부;

    (c) 만드는 데 걸리는 시간(준비 및 조리 시간)

    (d) 얼마나 많은 사람들에게 서비스를 제공하는지.

  3. 성분 목록은

    (a) 자체 자막이 있어야 합니다.

    (b) 매리네이드 등과 같은 항목에 대한 자막 옵션이 있습니다.

    (c) 수치 측정 성분(제조)으로 배열됩니다.

  4. "지침"과 첫 번째 지침 사이에 "오븐을 x도까지 예열하세요"를 넣을 수 있는 옵션이 포함된 지침(다시 자체 부제 포함)입니다.

  5. 같은 크기의 각 레시피에 같은 위치에 이미지를 추가하는 옵션입니다.

현재 일반적인 레시피는 다음과 같습니다.

여기에 이미지 설명을 입력하세요

나는 그것이 보이는 방식에 대부분 만족합니다(일부 색상은 좋을 수도 있지만). 그러나 저는 이 모든 작업을 '수작업으로' 수행했기 때문에 모든 레시피의 형식이 동일한지 확인하는 데 많은 작업이 필요합니다.

이런 템플릿도 만들 수 있나요?

위 레시피에 대한 내 코드는 다음과 같습니다.

\newpage
\section{Raspberry Chocolate Tiramisu}
\lhead{}\chead{Serves 4}\rhead{V}
\lfoot{Prep time:}\rfoot{Cook time:}
\begin{multicols}{2}
{\Large Instructions}
\begin{itemize}
    \item 100ml Double Strength Coffee
    \item 400g Raspberries (blitzed)
    \item 200g Mascarpone
    \item 2 tbsp Sweetener
    \item 1 tsp Vanilla Extract
    \item 700g Vanilla Yogurt
    \item 15g Dark Chocolate (finely grated)
\end{itemize}
\columnbreak
\textit{For the Crumble Mixture}:
\begin{itemize}
    \item 80g Wholemeal Flour
    \item 80g Plain Flour
    \item 80g Butter (diced)
    \item 70g Demerara Sugar
\end{itemize}
\end{multicols}
{\Large Instructions}\\
Preheat the over to Gas Mark 4, Electric $180^\circ$C, Fan $160^\circ$C.
\begin{enumerate}
    \item Stir the two kinds of flour together in a bowl, add the butter and rub it into the flour. When the mixture looks like breadcrumbs, mix in the brown sugar. Lay the mixture on a shallow baking tray and bake for 25-30 minutes until golden brown. Leave on the side to cool.
    \item Mix together the mascarpone, sweetener, vanilla extract, and three quarters of the chocolate. Put half the crumble mixture in each of the glasses and pour over half the quark mixture along with half the raspberries.
    \item Put the other half of the crumble mixture on top, followed by the remaining quark mixture and raspberries. Sprinkle over the last of the chocolate. Chill for 3 hours before serving.
\end{enumerate}

답변1

이것을 실제 LaTeX 프로젝트로 만들어준 @alephzero에게 감사드립니다. 즉, LaTeX 마크업과 달리 레시피의 의미에 집중하는 것입니다.

그러기 위해서는 깔끔하고 정돈된 입력과 출력을 선호합니다. 나는 \obeylines수반되는 마크업 없이 목록 환경을 에뮬레이션하는 데 사용했습니다 . 또한 몇 가지 가능성을 나타내기 위해 약간의 색상을 사용했습니다. 나는 그 방법을 보여줄 매우 간단한 코드에 주석을 포함시켰습니다. Computer Modern은 내 선택이 아니지만 TeXing 환경이 무엇인지 모르므로 부적절한 가정을 하고 싶지 않았습니다. 나는 조리법을 최대한 명확하게 표현하는 데 도움이 되도록 장식(규칙 등)을 최소한으로 유지하겠습니다. 많이 드세요.

나중에:

누락된 일부를 공급했습니다 %. 또한 에 대한 선택적 인수로 헤드노트의 가능성을 제공했습니다 \recipe. 또한, 나 자신의 이익을 위해 geometry.sty5.5인치 x 8.5인치 출력을 생산하는 데 도움을 요청했습니다. 물론 상황에 맞게 변경할 수 있습니다.

나중에:

\frontmatter또한 이는 and \backmatterfrom을 사용하여 목차를 생성한다는 점을 지적해야 합니다 book.cls. 땅콩과 비슷해요. 하나만 먹을 수는 없어요...

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = XeLaTeX

%% pagestyle alterations per user request 14 xii 2020

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{multicol}
\usepackage[%
    %a5paper,
    papersize={5.5in,8.5in},
    margin=0.75in,
    top=0.75in,
    bottom=0.75in,
    %twoside
    ]{geometry}
\usepackage{xcolor}
\usepackage{graphicx}

\raggedcolumns
\setlength{\multicolsep}{0pt}
\setlength{\columnseprule}{1pt}

\makeatletter

%% Used for the headnote and in \showit
%% If the text is small it is placed on one line;
%% otherwise it is put into a raggedright paragraph.
\long\def\testoneline#1{%
  \sbox\@tempboxa{#1}%
  \ifdim \wd\@tempboxa <0.75\linewidth
        \begingroup
            \itshape
            #1\par
        \endgroup
  \else
    \parbox{0.75\linewidth}{\raggedright\itshape#1}%
    \par
  \fi
}

\newif\if@mainmatter \@mainmattertrue

%% Borrowed from book.cls
\newcommand\frontmatter{%
    \cleardoublepage
  \@mainmatterfalse
  \pagenumbering{roman}}
\newcommand\mainmatter{%
    \cleardoublepage
  \@mainmattertrue
  \pagenumbering{arabic}}
\makeatother

%% Vary the colors at will

\definecolor{vegcolor}{rgb}{0,0.5,0.2}
\definecolor{frzcolor}{rgb}{0,0,1}
\definecolor{dessertcolor}{rgb}{0.5,0.2,0.1}
\definecolor{makeaheadcolor}{rgb}{0.5,0.5,0.6}

%% Thanks to alephzero for the excellent start:
\newcommand{\recipe}[2][]{%
    \newpage
    \thispagestyle{fancy}
    \lhead{}%
    \chead{}%
    \rhead{}%
    \lfoot{}%
    \rfoot{}%
    \section{#2}%
    \if###1##%
    \else
        \begin{center}
            \testoneline{#1}%
        \end{center}
    \fi
}
\newcommand{\serves}[2][Serves]{%
    \chead{#1 #2}}
\newcommand{\dishtype}[1]{%
    \rhead{#1}%
}
\newcommand{\dishother}[1]{%
    \lhead{#1}%
}
\newcommand{\vegetarian}{%
    {\large\color{vegcolor}\textbf{V}}%
}
\newcommand{\freeze}{%
    {\large\color{frzcolor}\textbf{F}}%
}
\newcommand{\dessert}{%
    {\large\color{dessertcolor}\textbf{D}}%
}
\newcommand{\makeahead}{%
    {\large\color{makeaheadcolor}\textbf{M}}%
}
%% Optional arguments for alternate names for these:
\newcommand{\preptime}[2][Prep time]{%
    \lfoot{#1: #2}%
}
\newcommand{\cooktime}[2][Cook time]{%
    \rfoot{#1: #2}%
}
\newcommand{\temp}[1]{%
    $#1^\circ$C}
%% Optional argument is the width of the graphic, default = 1in
\newcommand{\showit}[3][1in]{%
    \begin{center}
        \bigskip
            \includegraphics[width=#1]{#2}%
            \par
            \medskip
            \testoneline{#3}%
            \par
    \end{center}%
}

%% Optional argument for a  heading within the ingredients section
\newcommand{\ingredients}[1][]{%
    \if###1##%
        {\color{red}\Large\textbf{Ingredients}}%
    \else
        \emph{#1}%
    \fi
}

%% Use \obeylines to minimize markup
\newenvironment{ingreds}{%
    \parindent0pt
    \noindent
    \ingredients
    \par
    \smallskip
    \begin{multicols}{2}
    \leftskip1em
    \rightskip0pt plus 3em
    \parskip=0.25em
    \obeylines
    \everypar={\hangindent2em}
}{%
    \end{multicols}%
    \medskip
}

\newcounter{stepnum}

%% Optional argument for an italicized pre-step
%% Also use obeylines to minimize markup here as well
\newenvironment{method}[1][]{%
    \setcounter{stepnum}{0}
    \noindent
    {\color{red}\Large\textbf{Instructions}}%
    \par
    \smallskip
    \if###1##%
    \else
        \noindent
        \emph{#1}
        \par
    \fi
    \begingroup
    \parindent0pt
    \parskip0.25em
        \leftskip2em
    \everypar={\llap{\stepcounter{stepnum}\hbox to2em{\thestepnum.\hfill}}}
}{%
    \par
    \endgroup
    }

\pagestyle{plain}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\recipe[This is a simple headnote that describes the product for the user. A simple but elegant dessert.]{Raspberry Chocolate Tiramisu}
\serves{4}
\preptime{1 hour}
\cooktime[Chill time]{1$\frac{1}{2}$ hours}
\dishtype{\dessert,\vegetarian}
\dishother{\makeahead, \freeze}
\begin{ingreds}
     100ml double strength coffee
     400g raspberries (blitzed)
     200g mascarpone
     2 tbsp sweetener
     1 tsp vanilla extract
     700g vanilla yogurt
     15g dark chocolate (finely grated) and a really long one
\columnbreak
\ingredients[For the Crumble Mixture:]
     80g wholemeal flour
     80g plain flour
     80g butter (diced)
     70g demerara sugar
\end{ingreds}

\begin{method}[Preheat the oven to Gas Mark 4, Electric \temp{180}, Fan \temp{160}.]
     Stir the two kinds of flour together in a bowl, add the butter and rub it into the flour. When the mixture looks like breadcrumbs, mix in the brown sugar. Lay the mixture on a shallow baking tray and bake for 25--30 minutes until golden brown. Leave on the side to cool.

     Mix together the mascarpone, sweetener, vanilla extract, and three quarters of the chocolate. Put half the crumble mixture in each of the glasses, sprinkling over with half the coffee, and pour over half the mascarpone mixture along with half the raspberries.

     Put the other half of the crumble mixture on top, sprinkling over with the remaining half of the coffee, followed by the remaining quark mixture and raspberries. Sprinkle over the last of the chocolate. Chill for 3 hours before serving.

\end {method}

\showit[1.25in]{example-image-b}{This is a picture}

\end{document}

첫 번째 버전

다시 생각해보면...

저는 이런 형식을 별로 좋아하지 않습니다.이분법,성분은 시각적으로 구별되는 영역에 그 자체로 표시되며 방법과 완전히 분리되어 있습니다. 표면상으로는 이 기능의 목적은 사용자가 처음에 어떤 원자재가 필요한지 확인할 수 있도록 하는 것이었습니다. 이사벨라 비튼(가계관리서,1861)은 독자들에게 “요리법이 제시된 순서를 정확히 따르라”고 촉구했습니다. 따라서 먼저 필요한 모든 재료를 테이블 위에 놓도록 하십시오. 그러면 운영 방식(modus Operandi), 즉 준비 모드(MOD)가 쉽게 관리될 것입니다.” 현재 일반적으로제자리에 있어요. 그러나 너무 자주, 특히 긴 레시피에서는 재료와 방법 사이를 왔다갔다하면서 무언가(주로 재료)가 손실되거나 잘못 읽히거나 한 단계를 건너뛰거나 오해하는 경우가 너무 많습니다. 그 효과는 지나치게 긴 텍스트 줄을 읽는 것과 유사합니다. 눈은 다음 줄의 시작 부분을 정확하게 찾는 데 어려움을 겪고 같은 줄을 다시 읽거나 줄을 건너뜁니다. (https://www.fonts.com/content/learning/fontology/level-2/text-typography/length-column-width) 어쨌든 나는 이 조리법을 다소 다르게 형식화할 것이라고만 말하면 충분합니다(아래 참조).

현재로서는 이 레시피를 그대로 유지하고 또 다른 문제인 재료의 사양을 다루겠습니다. 인쇄물에 이분 형식이 등장한 이후(19세기 초 영어) 성분은 뚜렷하게 표시되어 왔습니다.이야기형식: 소금 1티스푼, 밀가루 1컵, 코코아 2온스 등. 말로는 관용적이지만 인쇄물에서는 다음과 같은 인상을 줍니다.화두는 성분이 아니라 성분이다.신원성분 자체의. 다행스럽게도 TeX는 불필요한 마크업으로 이 관례적인(불만족스러운 경우) 형식을 과도하게 방해하지 않고 성분을 구문 분석하여 이를 수정할 수 있는 도구를 제공합니다. 더욱이, 성분 앞에 양이 나오지 않는 경우에만 성분을 대문자로 표기해야 합니다(Whitman,조리법을 종류별로,pp.124--125), 여기와 같습니다. 또한 측정 단위는 축약되지 않은 상태로 두는 것이 가장 좋습니다(Whitman,조리법을 종류별로,pp. 15-16). 단, 공간이 제한된 경우는 제외됩니다.

또한 OpenType 글꼴(STIX Two)이 도 기호(°)와 분수(½)를 처리하도록 하여 코딩을 더욱 최소화합니다.

\documentclass{article}
\usepackage{fancyhdr,multicol,xcolor,graphicx,xparse,fontspec}
\usepackage[%
    %a5paper,
    papersize={5.5in,8.5in},
    margin=0.75in,
    top=0.75in,
    bottom=0.75in,
    %twoside
    ]{geometry}

\makeatletter

%% Used for the headnote and in \showit
%% If the text is small it is placed on one line;
%% otherwise it is put into a raggedright paragraph.
\long\def\testoneline#1{%
  \sbox\@tempboxa{#1}%
  \ifdim \wd\@tempboxa <0.75\linewidth
        \begingroup
            \itshape
            #1\par
        \endgroup
  \else
    \parbox{0.75\linewidth}{\raggedright\itshape#1}%
    \par
  \fi
}

\newif\if@mainmatter \@mainmattertrue

%% Borrowed from book.cls
\newcommand\frontmatter{%
    \cleardoublepage
  \@mainmatterfalse
  \pagenumbering{roman}}
\newcommand\mainmatter{%
    \cleardoublepage
  \@mainmattertrue
  \pagenumbering{arabic}}
\makeatother

%% Vary the colors at will

\definecolor{vegcolor}{rgb}{0,0.5,0.2}
\definecolor{frzcolor}{rgb}{0,0.8,0.8}
\definecolor{dessertcolor}{rgb}{0.5,0.2,0.1}
\definecolor{makeaheadcolor}{rgb}{0.5,0.5,0.6}

%% Thanks to alephzero for the excellent start:
\newcommand{\recipe}[2][]{%
    \newpage
    \thispagestyle{fancy}
    \lhead{}%
    \chead{}%
    \rhead{}%
    \lfoot{}%
    \rfoot{}%
    \section{#2}%
    \if###1##%
    \else
        \begin{center}
            \testoneline{#1}%
        \end{center}
    \fi
}
\newcommand{\serves}[2][Serves]{%
    \chead{#1 #2}}
\newcommand{\dishtype}[1]{%
    \rhead{#1}%
}
\newcommand{\dishother}[1]{%
    \lhead{#1}%
}
\newcommand{\vegetarian}{%
    {\large\color{vegcolor}\textbf{V}}%
}
\newcommand{\freeze}{%
    {\large\color{frzcolor}\textbf{F}}%
}
\newcommand{\dessert}{%
    {\large\color{dessertcolor}\textbf{D}}%
}
\newcommand{\makeahead}{%
    {\large\color{makeaheadcolor}\textbf{M}}%
}
%% Optional arguments for alternate names for these:
\newcommand{\preptime}[2][Prep time]{%
    \lfoot{#1: #2}%
}
\newcommand{\cooktime}[2][Cook time]{%
    \rfoot{#1: #2}%
}
\newcommand{\temp}[1]{%
    #1°C}
%% Optional argument is the width of the graphic, default = 1in
\newcommand{\showit}[3][1in]{%
    \begin{center}
        \bigskip
            \includegraphics[width=#1]{#2}%
            \par
            \medskip
            \testoneline{#3}%
            \par
    \end{center}%
}

%% Optional argument for a  heading within the ingredients section
\newcommand{\ingredients}[1][]{%
    \if###1##%
        {\color{red}\Large\textbf{Ingredients}}%
    \else
        \emph{#1}%
    \fi
}

\def\ucit#1{\uppercase{#1}}
\begingroup
    \lccode`~=`\^^M
    \lowercase{%
\endgroup%% Ingredient first, then measure; empty measure and/or unit = " . "
    %% *=column break; amount<space>ingredient
    \NewDocumentCommand{\ing}{s u{ } u{~}}{% %% basically the same as: \def\ing#1 #2~{%
         %% or: \bfseries\ucit#3\if#1#2---\else,\ \fi
        \if.#2%
            \emph{#3}~ % A heading
        \else % Amounts containing spaces <1 teaspoon> have to use '~' <1~teaspoon>
            \textbf{\ucit#3, }#2 \IfBooleanT{#1}{\columnbreak}~ %
        \fi
    }%
}%


%% Use \obeylines to minimize markup
\newenvironment{ingreds}{%
    \parindent0pt
    \noindent
    \ingredients
    \par
    \smallskip
    \begin{multicols}{2}
    \leftskip1em
    \parindent-1em
    \rightskip0pt plus 3em
    \parskip=0.25em
    \obeylines
    \everypar={\ing}
}{%
    \end{multicols}%
    \medskip
}

\newcounter{stepnum}

%% Optional argument for an italicized pre-step
%% Also use obeylines to minimize markup here as well
\newenvironment{method}[1][]{%
    \setcounter{stepnum}{0}
    \noindent
    {\color{red}\Large\textbf{Instructions}}%
    \par
    \smallskip
    \if###1##%
    \else
        \noindent
        \emph{#1}
        \par
    \fi
    \begingroup
    \rightskip0pt plus 3em
    \parindent0pt
    \parskip0.25em
        \leftskip2em
    \everypar={\llap{\stepcounter{stepnum}\hbox to2em{\thestepnum.\hfill}}}
}{%
    \par
    \endgroup
    }

\setmainfont{STIX Two Text}

\pagestyle{plain}
\raggedcolumns
\setlength{\multicolsep}{0pt}
\setlength{\columnseprule}{1pt}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\recipe[This is a simple headnote that describes the product for the user. A simple but elegant dessert.]{Raspberry Chocolate Tiramisu}
\serves{4}
\preptime{1 hour}
\cooktime[Chill time]{1½ hours}
\dishtype{\dessert,\vegetarian}
\dishother{\makeahead, \freeze}
\begin{ingreds}% amount<space>ingredient; initial <.>=comment;*=column break
     100ml double strength coffee
     400g raspberries (blitzed)
     200g mascarpone
     2~tablespoons sweetener
     1~teaspoon vanilla extract
     700g vanilla yogurt
     *15g dark chocolate (finely grated) 
     . for the crumble mixture:
     80g wholemeal flour
     80g plain flour
     80g butter (diced)
     70g demerara sugar
\end{ingreds}

\begin{method}[Preheat the oven to Gas Mark 4, Electric \temp{180}, Fan \temp{160}.]
     Stir the two kinds of flour together in a bowl, add the butter and rub it into the flour. When the mixture looks like breadcrumbs, mix in the brown sugar. Lay the mixture on a shallow baking tray and bake for 25--30 minutes until golden brown. Leave on the side to cool.

     Mix together the mascarpone, sweetener, vanilla extract, and three quarters of the chocolate. Put half the crumble mixture in each of the glasses and pour over half the quark mixture along with half the raspberries.

     Put the other half of the crumble mixture on top, followed by the remaining quark mixture and raspberries. Sprinkle over the last of the chocolate. Chill for 3 hours before serving.
\end {method}

\showit[1.25in]{example-image-b}{This is a picture}

\end{document}

두 번째 버전

그리고 마지막으로...

여기에 동일한 조리법이 있습니다.조정된 이분 형식,즉, 각 단계의 성분이 해당 단계와 함께 표시되었습니다. 원래 레시피가 실제로 그렇지 않다는 사실을 발견했을 때 미스터리가 나타났습니다.사용성분 목록에서 요구되는 "두 배 강도의 커피". 나는 세 가지 버전 모두에서 그 누락을 수정하려고 시도했습니다.

\documentclass{article}
\usepackage{fancyhdr,wrapfig,xcolor,graphicx,xparse,fontspec}
\usepackage[%
    %a5paper,
    papersize={5.5in,8.5in},
    margin=0.75in,
    top=0.75in,
    bottom=0.75in,
    %twoside
    ]{geometry}

\newcounter{stepnum}

%% |=====8><-----| %%


\makeatletter

%% From Donald Arseneau. Add after the wrapping text. Whew!
\def\wrapfill{% Just glad it works.
    \par
  \ifx\parshape\WF@fudgeparshape
    \nobreak
    \ifnum\c@WF@wrappedlines>\@ne
      \advance\c@WF@wrappedlines\m@ne
      \vskip\c@WF@wrappedlines\baselineskip
      \global\c@WF@wrappedlines\z@
    \fi
    \allowbreak
    \WF@finale
  \fi
}


%% Used for the headnote and in \showit
%% If the text is small it is placed on one line;
%% otherwise it is put into a raggedright paragraph.
\long\def\testoneline#1{%
  \sbox\@tempboxa{#1}%
  \ifdim \wd\@tempboxa <0.75\linewidth
        \begingroup
            \itshape
            #1\par
        \endgroup
  \else
    \parbox{0.75\linewidth}{\raggedright\itshape#1}%
    \par
  \fi
}

\newif\if@mainmatter \@mainmattertrue

%% Borrowed from book.cls
\newcommand\frontmatter{%
    \cleardoublepage
  \@mainmatterfalse
  \pagenumbering{roman}}
\newcommand\mainmatter{%
    \cleardoublepage
  \@mainmattertrue
  \pagenumbering{arabic}}
\makeatother

%% Vary the colors at will

\definecolor{vegcolor}{rgb}{0,0.5,0.2}
\definecolor{frzcolor}{rgb}{0,0.8,0.8}
\definecolor{dessertcolor}{rgb}{0.5,0.2,0.1}
\definecolor{makeaheadcolor}{rgb}{0.5,0.5,0.6}

%% Thanks to alephzero for the excellent start:
%% #1 [optional headnote]; #2 Title of recipe; #3 [Initial instructions]
\NewDocumentCommand{\recipe}{o m o}{%
    \setcounter{stepnum}{0}%
    \newpage
    \thispagestyle{fancy}
    \lhead{}%
    \chead{}%
    \rhead{}%
    \lfoot{}%
    \rfoot{}%
    \section{#2}%
    \IfNoValueF{#1}{\begin{center}\testoneline{#1}\end{center}}
    \IfNoValueF{#3}{\noindent\emph{#3}\par\medskip}
}
\newcommand{\serves}[2][Serves]{%
    \chead{#1 #2}}
\newcommand{\dishtype}[1]{%
    \rhead{#1}%
}
\newcommand{\dishother}[1]{%
    \lhead{#1}%
}
\newcommand{\vegetarian}{%
    {\large\color{vegcolor}\textbf{V}}%
}
\newcommand{\freeze}{%
    {\large\color{frzcolor}\textbf{F}}%
}
\newcommand{\dessert}{%
    {\large\color{dessertcolor}\textbf{D}}%
}
\newcommand{\makeahead}{%
    {\large\color{makeaheadcolor}\textbf{M}}%
}
%% Optional arguments for alternate names for these:
\newcommand{\preptime}[2][Prep time]{%
    \lfoot{#1: #2}%
}
\newcommand{\cooktime}[2][Cook time]{%
    \rfoot{#1: #2}%
}
\newcommand{\temp}[1]{%
    #1°C}
%% Optional argument is the width of the graphic, default = 1in
\newcommand{\showpic}[3][1in]{%
    \begin{center}
        \bigskip
            \includegraphics[width=#1]{#2}%
            \par
            \medskip
            \testoneline{#3}%
            \par
    \end{center}%
}

\def\ucit#1{\uppercase{#1}}
\begingroup
    \lccode`~=`\^^M
    \lowercase{%
\endgroup%% Ingredient first, then measure; empty measure and/or unit = " . "
    %% *=column break; amount<space>ingredient
    \NewDocumentCommand{\ing}{u{ } u{~}}{% %% basically the same as: \def\ing#1 #2~{% requires xparse
        \noindent
        \if.#1% Is a heading, a non-ingredient, in the ingredients block
            \emph{#2}~ % A heading
        \else % Amounts containing spaces <1 teaspoon> have to use '~' <1~teaspoon>
            \textbf{\ucit#2, }#1~ %
        \fi
    }%
}%

\NewDocumentEnvironment{step}{}{%
    \parindent0pt
    \leftskip0pt
    \begin{minipage}{\textwidth}
        \begin{wrapfigure}{r}{0pt}
            \kern-0.5em
            \vrule width 1pt\enskip
            \begin{minipage}{0.5\textwidth}
                \leftskip=1.5em
                \parindent=-1.5em
                \parskip=0.25em
                \obeylines
                    \everypar={\ing}
}{%
        \wrapfill
    \end{minipage}
    \medskip
}

\NewDocumentCommand{\method}{}{%
            \end{minipage}
        \end{wrapfigure}
        \rightskip0pt plus 2em
        \parskip0.25em
        \everypar={\llap{\stepcounter{stepnum}\hbox to 1.5em{\thestepnum.\hfill}}}
}

\setmainfont{STIX Two Text}

\pagestyle{plain}
\setlength{\intextsep}{0pt}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\recipe[This is a simple headnote that describes the product for the user. A simple but elegant dessert.]{Raspberry Chocolate Tiramisu}[Preheat the oven to Gas Mark 4, Electric \temp{180}, Fan \temp{160}.]
\serves{4}
\preptime{1 hour}
\cooktime[Chill time]{1½ hours}
\dishtype{\dessert,\vegetarian}
\dishother{\makeahead, \freeze}

\begin{step}
     100ml double strength coffee
     400g raspberries 
\method
Prepare the coffee and set aside to cool; mash the raspberries with a fork and set aside.
\end{step}

\begin{step}
     . For the crumble mixture:
     80g wholemeal flour
     80g plain flour
     80g butter (diced)
     70g demerara sugar
    \method
    Stir the two kinds of flour together in a bowl, add the butter and rub it into the flour. When the mixture looks like breadcrumbs, mix in the brown sugar. Lay the mixture on a shallow baking tray and bake for 25--30 minutes until golden brown. Leave on the side to cool.
\end{step}

\begin{step}
     200g mascarpone
     2~tablespoons sweetener
     1~teaspoon vanilla extract
     700g vanilla yogurt
     15g dark chocolate (finely grated)
     \method
         Mix together the mascarpone, sweetener, vanilla extract, and three quarters of the chocolate.

    Put half the crumble mixture in each of the glasses, sprinkling over half the coffee, and pour over half the quark mixture along with half the raspberries.

     Put the other half of the crumble mixture on top, sprinkling over the remaining half of the coffee, followed by the remaining quark mixture and raspberries. Sprinkle over the last of the chocolate. Chill for 3 hours before serving.
\end{step}

\showpic[1.25in]{example-image-b}{This is a picture}

\end{document}

세 번째 버전

마지막 한가지...

@Alborz가 올바르게 지적했듯이 여기에 수정이 필요한 몇 가지 사항이 있습니다. 해당 방법보다 긴 성분 목록 문제에 대해 다음에서 \wrapfill찾을 수 있고 사용된 수정 사항을 제공한 Donald Arseneau에게 감사드립니다 . wrapfig.sty다음 코드에서는 재료를 입력하는 것이 더 간단합니다.

\documentclass{article}
\usepackage{fancyhdr,wrapfig,xcolor,graphicx,xparse,fontspec}
\usepackage[%
    %a5paper,
    papersize={5.5in,8.5in},
    margin=0.75in,
    top=0.75in,
    bottom=0.75in,
    %twoside
    ]{geometry}

\newcounter{stepnum}

%% |=====8><-----| %%


\makeatletter

%% From Donald Arseneau. Add after the wrapping text. Whew!
\def\wrapfill{% Just glad it works.
    \par
  \ifx\parshape\WF@fudgeparshape
    \nobreak
    \ifnum\c@WF@wrappedlines>\@ne
      \advance\c@WF@wrappedlines\m@ne
      \vskip\c@WF@wrappedlines\baselineskip
      \global\c@WF@wrappedlines\z@
    \fi
    \allowbreak
    \WF@finale
  \fi
}


%% Used for the headnote and in \showit
%% If the text is small it is placed on one line;
%% otherwise it is put into a raggedright paragraph.
\long\def\testoneline#1{%
  \sbox\@tempboxa{#1}%
  \ifdim \wd\@tempboxa <0.75\linewidth
        \begingroup
            \itshape
            #1\par
        \endgroup
  \else
    \parbox{0.75\linewidth}{\raggedright\itshape#1}%
    \par
  \fi
}

\newif\if@mainmatter \@mainmattertrue

%% Borrowed from book.cls
\newcommand\frontmatter{%
    \cleardoublepage
  \@mainmatterfalse
  \pagenumbering{roman}}
\newcommand\mainmatter{%
    \cleardoublepage
  \@mainmattertrue
  \pagenumbering{arabic}}
\makeatother

%% Vary the colors at will

\definecolor{vegcolor}{rgb}{0,0.5,0.2}
\colorlet{gfcolor}{brown}
\definecolor{frzcolor}{rgb}{0,0.8,0.8}
\definecolor{dessertcolor}{rgb}{0.5,0.2,0.1}
\definecolor{makeaheadcolor}{rgb}{0.5,0.5,0.6}

%% Thanks to alephzero for the excellent start:
%% #1 [optional headnote]; #2 Title of recipe; #3 [Initial instructions]
\NewDocumentCommand{\recipe}{o m o}{%
    \setcounter{stepnum}{0}%
    \newpage
    \thispagestyle{fancy}
    \lhead{}%
    \chead{}%
    \rhead{}%
    \lfoot{}%
    \rfoot{}%
    \section{#2}%
    \IfNoValueF{#1}{\begin{center}\testoneline{#1}\end{center}}
    \IfNoValueF{#3}{\noindent\emph{#3}\par\medskip}
}
\newcommand{\serves}[2][Serves]{%
    \chead{#1 #2}}
\newcommand{\dishtype}[1]{%
    \rhead{#1}%
}
\newcommand{\dishother}[1]{%
    \lhead{#1}%
}
\newcommand{\vegetarian}{%
    {\large\color{vegcolor}\textbf{V}}%
}
\newcommand{\glutenfree}{%
    {\large\color{gfcolor}\textbf{GF}}%
}
\newcommand{\freeze}{%
    {\large\color{frzcolor}\textbf{F}}%
}
\newcommand{\dessert}{%
    {\large\color{dessertcolor}\textbf{D}}%
}
\newcommand{\makeahead}{%
    {\large\color{makeaheadcolor}\textbf{M}}%
}
%% Optional arguments for alternate names for these:
\newcommand{\preptime}[2][Prep time]{%
    \lfoot{#1: #2}%
}
\newcommand{\cooktime}[2][Cook time]{%
    \rfoot{#1: #2}%
}
\newcommand{\temp}[1]{%
    #1°C}
%% Optional argument is the width of the graphic, default = 1in
\newcommand{\showpic}[3][1in]{%
    \begin{center}
        \bigskip
            \includegraphics[width=#1]{#2}%
            \par
            \medskip
            \testoneline{#3}%
            \par
    \end{center}%
}

\def\ucit#1{\uppercase{#1}}
\begingroup
    \lccode`~=`\^^M
    \lowercase{%
\endgroup%% Ingredient first, then measure; empty measure and/or unit = " . "
    %% *=column break; amount<space>ingredient
    \NewDocumentCommand{\ing}{u{ } u{ } u{~}}{% %% basically the same as: \def\ing#1 #2~{% requires xparse
        \noindent
        \if#1#2% Is a heading, a non-ingredient, in the ingredients block
            \emph{#3}~ % A heading
        \else % Amounts containing spaces <1 teaspoon> have to use '~' <1~teaspoon>
            \textbf{\ucit#3, }#1\if.#2\else\ #2\fi~ %
        \fi
    }%
}%

\NewDocumentEnvironment{step}{}{%
    \parindent0pt
    \leftskip0pt
    \begin{minipage}{\textwidth}
        \begin{wrapfigure}{r}{0pt}
            \kern-0.5em
            \vrule width 1pt\enskip
            \begin{minipage}{0.5\textwidth}
                \leftskip=1.5em
                \parindent=-1.5em
                \parskip=0.25em
                \obeylines
                    \everypar={\ing}
}{%
        \wrapfill
    \end{minipage}
    \medskip
}

\NewDocumentCommand{\method}{}{%
            \end{minipage}
        \end{wrapfigure}
        \rightskip0pt plus 2em
        \parskip0.25em
        \everypar={\llap{\stepcounter{stepnum}\hbox to 1.5em{\thestepnum.\hfill}}}
}

\setmainfont{STIX Two Text}

\pagestyle{plain}
\setlength{\intextsep}{0pt}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\recipe[Some would say this is better than pie. It is certainly easier. And delicious. The original recipe came from Dorie Greenspan; this version also includes almond flour, suggested by King Arthur Baking.]{French Apple Cake}[Center a rack in the oven and preheat the oven to 350°F. Generously butter an 8-inch springform pan and put it on a baking sheet lined with a silicone baking mat or parchment paper.]
\serves{6-8}
\preptime{1 hour}
\cooktime{1 hour}
\dishtype{\dessert}
\dishother{\glutenfree}

\begin{step}
. . Batter, the dry:
1 cup AP (or GF) flour
½ cup almond flour
1 teaspoon baking powder
½ teaspoon cinnamon
¼ teaspoon nutmeg
¼ teaspoon salt
\method
Whisk the flour, baking powder, spices, and salt together in small bowl.
\end{step}

\begin{step}
4 large apples (if you can, choose 4 different kinds)
\method
Peel the apples, cut them in half and remove the cores. Cut the apples into 1- to 2-inch chunks.
\end{step}

\begin{step}
. . Batter, the wet:
2 large eggs
¾ cup maple or brown sugar
3 tablespoons dark rum
½ teaspoon pure vanilla extract
2--3 drops lemon extract
8 tablespoons unsalted butter, melted and cooled
\method
In a medium bowl, beat the eggs with a whisk until they’re foamy. Pour in the sugar and whisk for a minute or so to blend. Whisk in the rum, vanilla, and lemon oil. Whisk in  the flour and when it is incorporated, add the melted butter, mixing gently so that you have a smooth, rather thick batter.

Use a rubber spatula to fold-in the apples--it might look as if there isn't enough batter, but there is. Put the batter into the prepared pan, smoothing the top as much as possible. Bake for 55--65 minutes, or until a toothpick inserted  in the middle comes out clean.

Let cool 30 minutes. Before removing the side of the springform pan, run a knife around the edge of the cake to make sure no apples stuck to the pan.
\end{step}


\end{document}

새로운 예

요즘 나는 "TeX in the Kitchen" 또는 "TeX en Cuisine"이라는 제목으로 블로그를 시작하고 싶은 유혹을 느낍니다. 흥미로울 수도 있습니다...

답변2

제가 취할 첫 번째 단계는 다음을 캡처하기 위해 일부 매크로를 정의하는 것입니다.의미론LateX 대신 레시피를 활용하세요통사론.

그런 다음 편집과 별도로 각 의미 항목의 형식(색상 적용 등)을 조정할 수 있습니다.콘텐츠조리법 중.

이것은 완전하지는 않지만(어쨌든 당신이 원하는 책의 모습이 정확히 무엇인지는 모르겠습니다!) 실행되며 기본 아이디어를 제공합니다.

\documentclass{article}
\usepackage{fancyhdr}
\usepackage{multicol}

% Your "recipes.sty" package starts here:
\newcommand{\recipe}{%
    \newpage\lhead{}\chead{}\rhead{}\lfoot{}\rfoot{}\section}
\newcommand{\serves}[1]{%
    \chead{Serves #1}}
\newcommand{\vegetarian}{%
    \rhead{V}}
\newcommand{\preptime}[1]{%
    \lfoot{Prep time: #1}}
\newcommand{\cooktime}[1]{%
    \rfoot{Cook time: #1}}
\newcommand{\ingredients}[1][\Large\emph{Ingredients}]{%
    \emph{#1}\\}
\newcommand{\instructions}[1][\Large\emph{Instructions}]{%
    \emph{#1}\\}
\newcommand{\temp}[1]{%
    $#1^\circ$C}

\pagestyle{fancy}
% End of "recipes.sty"

\begin{document}
\recipe{Raspberry Chocolate Tiramisu}
\serves{4}
\vegetarian

\begin{multicols}{2}
\ingredients
\begin{itemize}
    \item 100ml Double Strength Coffee
    \item 400g Raspberries (blitzed)
    \item 200g Mascarpone
    \item 2 tbsp Sweetener
    \item 1 tsp Vanilla Extract
    \item 700g Vanilla Yogurt
    \item 15g Dark Chocolate (finely grated)
\end{itemize}
\columnbreak
\ingredients[For the Crumble Mixture:]
\begin{itemize}
    \item 80g Wholemeal Flour
    \item 80g Plain Flour
    \item 80g Butter (diced)
    \item 70g Demerara Sugar
\end{itemize}
\end{multicols}

\instructions
Preheat the over to Gas Mark 4, Electric \temp{180}, Fan \temp{160}.
\begin{enumerate}
    \item Stir the two kinds of flour together in a bowl, add the butter and rub it into the flour. When the mixture looks like breadcrumbs, mix in the brown sugar. Lay the mixture on a shallow baking tray and bake for 25--30 minutes until golden brown. Leave on the side to cool.
    \item Mix together the mascarpone, sweetener, vanilla extract, and three quarters of the chocolate. Put half the crumble mixture in each of the glasses and pour over half the quark mixture along with half the raspberries.
    \item Put the other half of the crumble mixture on top, followed by the remaining quark mixture and raspberries. Sprinkle over the last of the chocolate. Chill for 3 hours before serving.
\end{enumerate}

\end{document}

\instructions\ingredients매크로에 선택적 인수가 있는 방식에 유의하세요 . 인수가 없으면 기본 텍스트 "지침" 및 "성분"이 자동으로 생성됩니다. 대괄호 안의 인수를 사용하면 "For the Crumble Mixture:" 등에서와 같이 이를 덮어쓸 수 있습니다.

관련 정보