0

I'm currently using the package "xcookybooky" and it uses the wraptable environment for the ingredients list. Now the problem is: if the recipe starts near the end of the page, the wraptable ignores the margin and pagebreak and "disappears" into the latter. I've found a workaround for it at Wrapfig w/ Non-Ugly Page Breaks but unfortunately I'm too much of a noob in LaTeX to be able to adjust the solution given for wraptable (and I don't have enough reputation to make a comment with my question there).

Can someone please help me adjust the solution to work for wraptable?

example:

\documentclass{article}
% !TEX encoding = UTF-8
\usepackage[T2A,T1]{fontenc}
\usepackage[german]{babel}
\usepackage{xcookybooky}
\usepackage[utf8]{inputenc}

\begin{document} a \vspace{18cm} \begin{recipe}[bakingtime={\unit[15]{min}}, bakingtemperature={\protect\bakingtemperature{topbottomheat=\unit[220]{$^\circ$C}}}]{Flammkuchen} \ingredients[5]{ \unit[]{} & \textbf{Für den Teig}\ \unit[200]{g} & Mehl\ \unit[2]{EL} & Öl\ \unit[1]{TL} & Salz\ \unit[125]{ml} & Wasser\ \unit{} & \textbf{Für den Belag}\ \unit[400]{g} & Crème fraîche \ \unit{} & weiterer Belag } \preparation{ } \end{recipe} \begin{recipe}[bakingtime={\unit[15]{min}}, bakingtemperature={\protect\bakingtemperature{topbottomheat=\unit[220]{$^\circ$C}}}]{Flammkuchen} \ingredients[5]{ \unit[]{} & \textbf{Für den Teig}\ \unit[200]{g} & Mehl\ \unit[2]{EL} & Öl\ \unit[1]{TL} & Salz\ \unit[125]{ml} & Wasser\ \unit{} & \textbf{Für den Belag}\ \unit[400]{g} & Crème fraîche \ \unit{} & weiterer Belag } \preparation{ } \end{recipe} \end{document}

Code sample looks like this. ingredients is coded in the following way in xcookybooky:

\newcommand*{\ingredients}[2][\empty]
{% The optional argument contains the number of lines
    \def\xcb@ingredientslines{#1}
    \def\xcb@ingredients
    {%
        \xcb@name@inghead
        \\[1em]
        {\xcb@fontsize@ing\color{\xcb@color@ing}
        \begin{tabulary}{\xcb@ingredientswidth}{rL}
            #2
        \end{tabulary}}
    }
}

and

 \begin{wraptable}[\xcb@ingredientslines]{r}{\xcb@ingredientswidth}
        {% Use the given line number by the user
            \vspace{-1em}    % same height of ingredients and preparation
            \xcb@hook@preingredients
        \xcb@ingredients

        \xcb@hook@postingredients
    }
    \end{wraptable}

I've tried changing \RequirePackage{wrapfig} to \RequirePackage{wrapfig} which is given in the link above. It didn't help.

  • you have provided no example so hard to comment but the image looks rather like a list, wrapfig explicitly documents that it can not be used in a latex list, is that is what is happening here? – David Carlisle Mar 11 '22 at 11:08
  • @DavidCarlisle I haven't provided an example because it's just a wraptable. Please note, wraptable, not wrapfig. (Though both part of the wrapfig package) What's happening here, seems to me, to be the exact problem which has been solved for wrapfig in the link provided. – ahermann Mar 11 '22 at 14:22
  • the definition of wraptable is in total \def\wraptable{\wrapfloat{table}} any changes to the wrapfigure package made there would apply to wrapfigure and wraptable If you have an example that does not work, you should show it otherwise I don't know what answer can be given here. – David Carlisle Mar 11 '22 at 16:20
  • Wrapfig has the [R] option to delay until the next page. The question is whether you need to synchronize the text. – John Kormylo Mar 11 '22 at 16:37
  • @DavidCarlisle I've added code. – ahermann Mar 11 '22 at 16:53
  • @JohnKormylo The [R] option is indeed helpful. I didn't know it existed. It does push the ingredients list onto the next page, but unfortunately, the first line of the text on the next page seems to ignore the table and not warp around it. – ahermann Mar 11 '22 at 16:58

0 Answers0