软件包 xcookybooky / TexLive 中缺少 \endcsname

软件包 xcookybooky / TexLive 中缺少 \endcsname

我最近开始使用 latex 将所有食谱整理成统一格式。因此我使用包xcookybooky。当我输入一个配方并尝试编译它时,我收到一条错误消息,提示“!缺少 \endcsname 插入。”

我只在使用 \step 输入食谱步骤时才会出现此错误。如果我使用枚举,则不会出现任何问题。失败的代码如下。我不知道要保留什么和要保留什么,所以我只是将所有与格式相关的内容留在其中……

\documentclass[%
a4paper,
%twoside,
11pt
]{article}

% encoding, font, language
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{lmodern}
\usepackage[ngerman, english]{babel}

\usepackage{nicefrac}

\usepackage[]{xcookybooky}
\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
}

\usepackage{hyperref}    % must be the last package
\hypersetup{%
    pdfauthor            = {Sven Harder},
    pdftitle             = {Example Recipes for xcookybooky},
    pdfsubject           = {Recipes},
    pdfkeywords          = {example, recipes, cookbook, xcookybooky},
    pdfstartview         = {FitV},
    pdfview              = {FitH},
    pdfpagemode          = {UseNone}, % Options; UseNone, UseOutlines
    bookmarksopen        = {true},
    pdfpagetransition    = {Glitter},
    colorlinks           = {true},
    linkcolor            = {black},
    urlcolor             = {blue},
    citecolor            = {black},
    filecolor            = {black},
}
\hbadness=10000 % Ignore underfull boxes
\setHeadlines{
    inghead = Zutaten,
    prephead = Zubereitung,
    hinthead = Tipps,
    portionvalue = Portion(en)
}
\setRecipeColors{
    recipename = black,
    ing = black,
    inghead = black,
    hint = black,
    hinthead = black,
    hintline = black,
    numeration = black
}
\setRecipeLengths{
    preparationwidth = 0.65\textwidth,
    ingredientswidth = 0.45\textwidth
}
\begin{document}

% Complete recipe example
\begin{recipe}
[% 
    preparationtime = {\unit[50]{min}},
    bakingtime = {\unit[30]{min}},
    bakingtemperature={\protect\bakingtemperature{topbottomheat=\unit[200]{°C}}},
    portion = {\portion{2}}
]
{Kubanischer Bohnen-Gemüse-Reis}

    \ingredients[16]{%
        1 & Paprika(Gelb)\\
        1 & Paprika(Rot)\\
        \unit[1]{TL} & Räucherpaprika\\
        \unit[2+2]{EL} & Olivenöl\\

    }

    \preparation{%


       \step qfahflkj 
       \step afjlöfj
       \step ajlföja


    }


\end{recipe}
\end{document} 

非常感谢您的帮助!

答案1

lettrine 前段时间发生了变化,xcookybooky 中 \step 的定义应该进行调整。提交错误报告。我不会使用 utf8x 而是使用 utf8,但没有删除它。

 \documentclass[%
a4paper,
%twoside,
11pt
]{article}

% encoding, font, language
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{lmodern}
\usepackage[ngerman, english]{babel}

\usepackage{nicefrac}

\usepackage[]{xcookybooky}
\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
}

\usepackage{hyperref}    % must be the last package
\hypersetup{%
    pdfauthor            = {Sven Harder},
    pdftitle             = {Example Recipes for xcookybooky},
    pdfsubject           = {Recipes},
    pdfkeywords          = {example, recipes, cookbook, xcookybooky},
    pdfstartview         = {FitV},
    pdfview              = {FitH},
    pdfpagemode          = {UseNone}, % Options; UseNone, UseOutlines
    bookmarksopen        = {true},
    pdfpagetransition    = {Glitter},
    colorlinks           = {true},
    linkcolor            = {black},
    urlcolor             = {blue},
    citecolor            = {black},
    filecolor            = {black},
}
\hbadness=10000 % Ignore underfull boxes
\setHeadlines{
    inghead = Zutaten,
    prephead = Zubereitung,
    hinthead = Tipps,
    portionvalue = Portion(en)
}
\setRecipeColors{
    recipename = black,
    ing = black,
    inghead = black,
    hint = black,
    hinthead = black,
    hintline = black,
    numeration = black
}
\setRecipeLengths{
    preparationwidth = 0.65\textwidth,
    ingredientswidth = 0.45\textwidth
}

% NEW
\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}

% Complete recipe example
\begin{recipe}
[%
    preparationtime = {\unit[50]{min}},
    bakingtime = {\unit[30]{min}},
    bakingtemperature={\protect\bakingtemperature{topbottomheat=\unit[200]{°C}}},
    portion = {\portion{2}}
]
{Kubanischer Bohnen-Gemüse-Reis}

    \ingredients[16]{%
        1 & Paprika(Gelb)\\
        1 & Paprika(Rot)\\
        \unit[1]{TL} & Räucherpaprika\\
        \unit[2+2]{EL} & Olivenöl
    }

    \preparation{%
       \step qfahflkj
       \step afjlöfj
       \step ajlföja
    }


\end{recipe}
\end{document} 

相关内容