tcolorbox 或 parcolumns 不會為我的食譜提供正確性

tcolorbox 或 parcolumns 不會為我的食譜提供正確性

我目前正在寫我的法國食譜書的新版本(我的意思是,這是法語的)。

我的問題是我想要的食譜如下:

我想要的是

這種風格由兩個獨立的列組成,每個列都包含一個類似 iemize 的結構。

我的需求:

  1. 兩列應該是獨立的
  2. 它應該在頁面末尾處斷開(即它應該像偽列在另一頁上一樣斷開)。

第一次嘗試:tcolorbox

上面的範例使用 sidebyside tcolorbor。它工作得很好,tcolorbox 的光柵庫也是如此,但它不會在頁面末尾中斷。

第二次嘗試:parcolumns

這似乎對於 Lipsum 給出的段落效果很好,但似乎在 itemize 風格的環境中存在一些問題。這是我在有和沒有分頁符號的情況下得到的結果。

在此輸入影像描述

在此輸入影像描述

問題是: 1. 左邊的 itemize 項目空間太短 2. 右邊的項目空間太大 3. 奇怪的額外空間(在第一個枚舉之上)。

我在這個論壇上看到了一個解決方案,其中提出了一個小型頁面來解決這些問題,但這樣就無法解決了:s

結論

看來我嘗試了不同的解決方案,但沒有一個真正有效。你有好主意嗎 ?

最小工作Ex。

\documentclass{article}
\usepackage{showframe}

%% With tcolorbox

\usepackage[most]{tcolorbox}
\tcbuselibrary{raster}
\tcbuselibrary{breakable, skins}

\tcbset{colback=white,colframe=white, left skip=0pt, right skip=0pt, left=0pt, right=0pt, top=0pt, bottom=0pt, rightrule=0pt, leftrule=0pt, toprule=0pt, bottomrule=0pt, sharp corners,  breakable}

\newcommand\itemlist{
    \subsection{Ingredients}
    \begin{itemize}
      \item Element 1
      \item Element 2
      \item Element 3
      \item Element that is quite long
      \item Some nice cheeze
    \end{itemize}
}

\newcommand\enumlist{
    \subsection{Preparation}
    \begin{itemize}
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
    \end{itemize}
}

\newcommand\recipe{
\section{tcolorbox Lipsum}

\begin{tcolorbox}[sidebyside,lefthand width=3cm, sidebyside align=top seam, breakable]
  \itemlist
\tcblower
  \enumlist
\end{tcolorbox}

}

%% With parcolumns
\usepackage{parcolumns}

\newcommand\recipebis{
    \section{parcolumns Lipsum}

    \begin{parcolumns}[colwidths={1=3cm}, distance=3em]{2}
        \colchunk[1]{\itemlist}
        \colchunk[2]{\enumlist}
        \colplacechunks
    \end{parcolumns}
}

\begin{document}

% A test
\section{Test}
\itemlist
\enumlist

% With tcolorbox
\newpage
\recipe
\recipe
\rule{5cm}{1cm}
\recipe

% With parcolumns
\newpage
\recipebis
\recipebis
\recipebis
\rule{1cm}{1cm}
\recipebis
\recipebis

\end{document}

答案1

你可以用包包試試paracol。它以獨立的方式打破柱子,並且似乎尊重itemize距離。如果您發現調整窄列有問題,您可以將其與blankertcolorbox 結合起來,如圖所示這裡

\documentclass{article}
\usepackage{showframe}
\usepackage{paracol}

\newcommand\itemlist{
    \subsection{Ingredients}
    \begin{itemize}
      \item Element 1
      \item Element 2
      \item Element 3
      \item Element 1
      \item Element 2
      \item Element 3
      \item Element 1
      \item Element 2
      \item Element 3
      \item Element 1
      \item Element 2
      \item Element 3
      \item Element 1
      \item Element 2
      \item Element 3
      \item Element 1
      \item Element 2
      \item Element 3
      \item Element 1
      \item Element 2
      \item Element 3
      \item Element that is quite long
      \item Some nice cheeze
    \end{itemize}
}

\newcommand\enumlist{
    \subsection{Preparation}
    \begin{itemize}
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
      \item Preparation 1
      \item Preparation 2
      \item Preparation 3
      \item Preparation that is quite long
      \item Some nice cheeze at the end.
    \end{itemize}
}

\newcommand\recipeparacol{
}

\begin{document}
    \setcolumnwidth{3cm, 7cm}
    \setlength{\columnsep}{3em}

    \section{paracol Lipsum}
    \begin{paracol}{2}
        \itemlist
        \switchcolumn
        \enumlist
    \end{paracol}

\end{document}

在此輸入影像描述

相關內容