将 xcookybooky 食谱扩展至更大的宽度

将 xcookybooky 食谱扩展至更大的宽度

刚接触 tex,想用 xcookybooky 来排版一些食谱以供打印。我想打印在方形页面上,具体来说是 11 英寸 x 11 英寸,但是当我为 geometry 包设置 paperwidth 和 paperheight 时,如下所示:

\usepackage[paperwidth=11in,paperheight=11in]{geometry}

运行时我似乎在右边有多余的空格pdflatex

我似乎无法在 xcookybooky 文档中找到任何选项,是否有一个更“全局”的 tex 选项我应该设置来让内容填满页面宽度?

编辑:添加 MWE,主要取自 xcookybooky 示例https://github.com/SvenHarder/xcookybooky/tree/master/example

\documentclass{article}
\usepackage[paperwidth=11in,paperheight=11in]{geometry}

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


\usepackage{nicefrac}

\usepackage[
    nowarnings,
    %myconfig
]
{xcookybooky}

\begin{document}
% Complete recipe example


\begin{recipe}
[% 
    preparationtime = {\unit[1]{h}},
    portion = {\portion{6}},
]
{Rice and Lamb}



    \introduction{%
      Introduction to the dish
    }

    \ingredients{%
        \unit[2]{tbsp} & Vegetable Oil\\
        3 & Onion, chopped\\
        2 pound & Stewing Lamb or Beef\\
        \unit[1]{tbsp} & Minced Garlic\\
        \unit[2]{tsp} & Salt\\
        \unit[8]{cups} & Water\\
        \unit[1.5]{tbsp} & Ground Cardamom\\
    }

    \preparation{%
      \step Do some things
      \step Do some other things
      \step Finish doing things
    }

\end{recipe}

\end{document} 

谢谢

答案1

复制xcookybooky.sty到工作目录中并编辑它,使行

\setlength{\textwidth}{15.5cm}
\setlength{\textheight}{24.0cm}
\setlength{\topmargin}{-0.8cm}
\setlength{\headheight}{14pt} %0cm
\setlength{\headsep}{1cm}
\setlength{\topskip}{0cm}
\setlength{\footskip}{1.4cm}
\setlength{\evensidemargin}{-0.5cm}
\setlength{\oddsidemargin}{0.5cm}
\setlength{\voffset}{0cm}
\setlength{\hoffset}{0cm}

变得

\@ifpackageloaded{geometry}{}{%
  \setlength{\textwidth}{15.5cm}%
  \setlength{\textheight}{24.0cm}%
  \setlength{\topmargin}{-0.8cm}%
  \setlength{\headheight}{14pt}%0cm
  \setlength{\headsep}{1cm}%
  \setlength{\topskip}{0cm}%
  \setlength{\footskip}{1.4cm}%
  \setlength{\evensidemargin}{-0.5cm}%
  \setlength{\oddsidemargin}{0.5cm}%
  \setlength{\voffset}{0cm}%
  \setlength{\hoffset}{0cm}%
}

因此,如果geometry在 之前加载xcookybooky,包将不会按照自己的想法设置页面参数,而是按照用户的想法设置。

您还需要修复以避免在使用xcookybookyTeX Live 2018(具有更新版本lettrine)时出现虚假错误。

\documentclass{article}
\usepackage[paperwidth=11in,paperheight=11in,margin=1in]{geometry}

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


\usepackage{nicefrac}

\usepackage[
    nowarnings,
    %myconfig
]
{xcookybooky}

% 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}
% Complete recipe example


\begin{recipe}
[% 
    preparationtime = {\unit[1]{h}},
    portion = {\portion{6}},
]
{Rice and Lamb}



    \introduction{%
      Introduction to the dish
    }

    \ingredients{%
        \unit[2]{tbsp} & Vegetable Oil\\
        3 & Onion, chopped\\
        2 pound & Stewing Lamb or Beef\\
        \unit[1]{tbsp} & Minced Garlic\\
        \unit[2]{tsp} & Salt\\
        \unit[8]{cups} & Water\\
        \unit[1.5]{tbsp} & Ground Cardamom\\
    }

    \preparation{%
      \step Do some things
      \step Do some other things
      \step Finish doing things
    }

\end{recipe}

\end{document} 

在此处输入图片描述

相关内容